diff --git a/.gitignore b/.gitignore index 3cda3e54..d900793f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,12 +8,14 @@ ortc/internal/ortc.stats.events_win_etw.h ortc/internal/ortc.stats.events_win.h ortc/internal/ortc.stats.events.h ortc/internal/ortc.stats.events.jman +ortc/internal/ortc.stats.events.jman.h ortc/internal/ortc.stats.events_win_etw.wprp ortc/internal/ortc.stats.events_win_etw.man ortc/internal/ortc.events_win_etw.h ortc/internal/ortc.events_win.h ortc/internal/ortc.events.h ortc/internal/ortc.events.jman +ortc/internal/ortc.events.jman.h ortc/internal/ortc.events_win_etw.wprp ortc/internal/ortc.events_win_etw.man *.db @@ -21,3 +23,6 @@ ortc/internal/ortc.events_win_etw.man .vs/ ipch/ *.user +ortc/idl/wrapper/generated/ +ortc/idl/wrapper/cx +webrtc/idl/wrapper/generated/ diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 00000000..8742a5f9 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,1340 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/ortc/zsLib-eventing/zslib_eventing_tool.gni") +import("//third_party/ortc/ortclib/ortc/idl/sources.gni") + +config("ortclib_config") { + if (is_win) { + cflags_cc = [ + "/WX-", + "/wd4068", + "/GR", + ] + + if (current_os != "winuwp") + { + cflags_cc += ["/EHsc"] + defines = [ + "CRYPTOPP_IGNORE_CALNG_LIMITATION", + ] + } + } else { + cflags_cc = [ "-g" ] + cflags_cc += [ + "-Wall", + "-std=c++11", + ] + } + + include_dirs = [ + ".", + "..", + "../zsLib", + "../zsLib/zsLib/extras", + "../zsLib-eventing", + "../ortclib-services", + "../../usrsctp/usrsctplib", + "../../libsrtp/srtp/include", + "../../libsrtp/srtp/crypto/include", + "../../libsrtp/config", + "../../usrsctp/usrsctplib/usrsctplib", + "../../boringssl/include/openssl", + "../../boringssl/include", + "../../libsrtp/include", + "../../libsrtp/crypto/include", + "../../boringssl/src/include", + "../..", + "../ortclib", + "../ortclib/ortc", + "../ortclib/ortc/idl", + "../ortclib/ortc/idl/wrapper", + ] + + if (current_os == "winuwp") + { + include_dirs += [ "../ortclib/ortc/idl/wrapper/cx", ] + } +} + +ortclib_sources = [ + "ortc/ICapabilities.h", + "ortc/ICertificate.h", + "ortc/IConstraints.h", + "ortc/IDataChannel.h", + "ortc/IDataChannelTypes.h", + "ortc/IDataTransport.h", + "ortc/IDTLSTransport.h", + "ortc/IDTMFSender.h", + "ortc/IHelper.h", + "ortc/IICEGatherer.h", + "ortc/IICETransport.h", + "ortc/IICETransportController.h", + "ortc/IICETypes.h", + "ortc/IIdentity.h", + "ortc/IMediaDevices.h", + "ortc/IMediaElement.h", + "ortc/IMediaStreamTrack.h", + "ortc/IMediaStreamTrackSelector.h", + "ortc/IORTC.h", + "ortc/IRTPListener.h", + "ortc/IRTPReceiver.h", + "ortc/IRTPSender.h", + "ortc/IRTPTypes.h", + "ortc/ISCTPTransport.h", + "ortc/ISRTPSDESTransport.h", + "ortc/IStatsProvider.h", + "ortc/IStatsReport.h", + "ortc/ortc.h", + "ortc/RTCPPacket.h", + "ortc/RTPPacket.h", + "ortc/types.h", + "ortc/adapter/adapter.h", + "ortc/adapter/IHelper.h", + "ortc/adapter/IMediaStream.h", + "ortc/adapter/IPeerConnection.h", + "ortc/adapter/ISessionDescription.h", + "ortc/adapter/types.h", + "ortc/adapter/cpp/ortc_adapter_adapter.cpp", + "ortc/adapter/cpp/ortc_adapter_Helper.cpp", + "ortc/adapter/cpp/ortc_adapter_MediaStream.cpp", + "ortc/adapter/cpp/ortc_adapter_PeerConnection.cpp", + "ortc/adapter/cpp/ortc_adapter_SDPParser.cpp", + "ortc/adapter/cpp/ortc_adapter_SDPParser_DescriptionToSDP.cpp", + "ortc/adapter/cpp/ortc_adapter_SDPParser_GenerateSDP.cpp", + "ortc/adapter/cpp/ortc_adapter_SDPParser_ParseSDP.cpp", + "ortc/adapter/cpp/ortc_adapter_SDPParser_SDPToDescription.cpp", + "ortc/adapter/cpp/ortc_adapter_SessionDescription.cpp", + "ortc/adapter/internal/ortc_adapter_adapter.h", + "ortc/adapter/internal/ortc_adapter_Helper.h", + "ortc/adapter/internal/ortc_adapter_MediaStream.h", + "ortc/adapter/internal/ortc_adapter_PeerConnection.h", + "ortc/adapter/internal/ortc_adapter_SDPParser.h", + "ortc/adapter/internal/ortc_adapter_SessionDescription.h", + "ortc/adapter/internal/types.h", + "ortc/cpp/ifaddrs-android.cc", + "ortc/cpp/ortc.cpp", + "ortc/cpp/ortc_Capabilities.cpp", + "ortc/cpp/ortc_Certificate.cpp", + "ortc/cpp/ortc_Constraints.cpp", + "ortc/cpp/ortc_DataChannel.cpp", + "ortc/cpp/ortc_DTLSTransport.cpp", + "ortc/cpp/ortc_DTMFSender.cpp", + "ortc/cpp/ortc_Helper.cpp", + "ortc/cpp/ortc_ICEGatherer.cpp", + "ortc/cpp/ortc_ICEGathererRouter.cpp", + "ortc/cpp/ortc_ICETransport.cpp", + "ortc/cpp/ortc_ICETransportController.cpp", + "ortc/cpp/ortc_ICETypes.cpp", + "ortc/cpp/ortc_Identity.cpp", + "ortc/cpp/ortc_ISecureTransport.cpp", + "ortc/cpp/ortc_MediaChannelTraceHelper.cpp", + "ortc/cpp/ortc_MediaDevice.cpp", + "ortc/cpp/ortc_MediaDeviceCapture.cpp", + "ortc/cpp/ortc_MediaDeviceCaptureAudio.cpp", + "ortc/cpp/ortc_MediaDeviceCaptureVideo.cpp", + "ortc/cpp/ortc_MediaDeviceRenderAudio.cpp", + "ortc/cpp/ortc_MediaDevices.cpp", + "ortc/cpp/ortc_MediaEngine.cpp", + "ortc/cpp/ortc_MediaStreamTrack.cpp", + "ortc/cpp/ortc_ORTC.cpp", + "ortc/cpp/ortc_RTP.cpp", + "ortc/cpp/ortc_RTCPPacket.cpp", + "ortc/cpp/ortc_RTPDecoderAudio.cpp", + "ortc/cpp/ortc_RTPDecoderVideo.cpp", + "ortc/cpp/ortc_RTPEncoderAudio.cpp", + "ortc/cpp/ortc_RTPEncoderVideo.cpp", + "ortc/cpp/ortc_RTPListener.cpp", + "ortc/cpp/ortc_RTPPacket.cpp", + "ortc/cpp/ortc_RTPReceiver.cpp", + "ortc/cpp/ortc_RTPReceiverChannel.cpp", + "ortc/cpp/ortc_RTPSender.cpp", + "ortc/cpp/ortc_RTPSenderChannel.cpp", + "ortc/cpp/ortc_RTPTypes.cpp", + "ortc/cpp/ortc_RTPUtils.cpp", + "ortc/cpp/ortc_SCTPTransport.cpp", + "ortc/cpp/ortc_SCTPTransportListener.cpp", + "ortc/cpp/ortc_SRTPSDESTransport.cpp", + "ortc/cpp/ortc_SRTPTransport.cpp", + "ortc/cpp/ortc_StatsReport.cpp", + "ortc/cpp/ortc_webrtc.cpp", + "ortc/internal/ifaddrs-android.h", + "ortc/internal/ortc.events.h", + "ortc/internal/ortc.events_win.h", + "ortc/internal/ortc.events_win_etw.h", + "ortc/internal/ortc.h", + "ortc/internal/ortc.stats.events.h", + "ortc/internal/ortc.stats.events_win.h", + "ortc/internal/ortc.stats.events_win_etw.h", + "ortc/internal/ortc_Certificate.h", + "ortc/internal/ortc_DataChannel.h", + "ortc/internal/ortc_DTLSTransport.h", + "ortc/internal/ortc_DTMFSender.h", + "ortc/internal/ortc_Helper.h", + "ortc/internal/ortc_ICEGatherer.h", + "ortc/internal/ortc_ICEGathererRouter.h", + "ortc/internal/ortc_ICETransport.h", + "ortc/internal/ortc_ICETransportController.h", + "ortc/internal/ortc_Identity.h", + "ortc/internal/ortc_IMediaDevice.h", + "ortc/internal/ortc_IMediaDeviceCapture.h", + "ortc/internal/ortc_IMediaDeviceRender.h", + "ortc/internal/ortc_IMediaStreamTrack.h", + "ortc/internal/ortc_IMediaStreamTrackChannel.h", + "ortc/internal/ortc_IMediaStreamTrackMonitor.h", + "ortc/internal/ortc_IMediaStreamTrackSubscriber.h", + "ortc/internal/ortc_IRTP.h", + "ortc/internal/ortc_IRTPDecoder.h", + "ortc/internal/ortc_IRTPEncoder.h", + "ortc/internal/ortc_ISecureTransport.h", + "ortc/internal/ortc_ISRTPTransport.h", + "ortc/internal/ortc_MediaChannelTraceHelper.h", + "ortc/internal/ortc_MediaDeviceCaptureAudio.h", + "ortc/internal/ortc_MediaDeviceCaptureVideo.h", + "ortc/internal/ortc_MediaDeviceRenderAudio.h", + "ortc/internal/ortc_MediaDevices.h", + "ortc/internal/ortc_MediaEngine.h", + "ortc/internal/ortc_MediaStreamTrack.h", + "ortc/internal/ortc_MediaStreamTrackChannel.h", + "ortc/internal/ortc_MediaStreamTrackSubscriberMedia.h", + "ortc/internal/ortc_MediaStreamTrackSubscriberRTP.h", + "ortc/internal/ortc_ORTC.h", + "ortc/internal/ortc_RTPDecoderAudio.h", + "ortc/internal/ortc_RTPDecoderVideo.h", + "ortc/internal/ortc_RTPEncoderAudio.h", + "ortc/internal/ortc_RTPEncoderVideo.h", + "ortc/internal/ortc_RTPListener.h", + "ortc/internal/ortc_RTPReceiver.h", + "ortc/internal/ortc_RTPReceiverChannel.h", + "ortc/internal/ortc_RTPSender.h", + "ortc/internal/ortc_RTPSenderChannel.h", + "ortc/internal/ortc_RTPTypes.h", + "ortc/internal/ortc_RTPUtils.h", + "ortc/internal/ortc_SCTPTransport.h", + "ortc/internal/ortc_SCTPTransportListener.h", + "ortc/internal/ortc_SRTPSDESTransport.h", + "ortc/internal/ortc_SRTPTransport.h", + "ortc/internal/ortc_StatsReport.h", + "ortc/internal/ortcEvents.h", + "ortc/internal/platform.h", + "ortc/internal/types.h", +] + +if (is_android) { + ortclib_sources -= [ + "ortc/cpp/ifaddrs-android.cc", + ] +} + +ortc_sources_cxx_generated = [ + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_MediaStream.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCAnswerOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCConfiguration.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCIceCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCMediaStreamTrackConfiguration.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCOfferAnswerOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCOfferOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCPeerConnection.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCPeerConnectionIceEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescription.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionConnectionData.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionDescription.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionRtpSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCSessionDescriptionTransportParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_adapter_RTCTrackEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainBoolean.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainBooleanParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainDouble.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainDoubleRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainLong.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainLongRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainString.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ConstrainStringParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_DoubleRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_Error.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_ErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_EventQueue.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_EventQueueMaker.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_Json.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_Logger.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_LongRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaControl.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaDeviceInfo.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaDevices.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaSource.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaStreamConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaStreamTrack.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaTrackCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaTrackConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaTrackConstraintSet.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaTrackSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_MediaTrackSupportedConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_OrtcLib.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_OverconstrainedError.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_OverconstrainedErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCCertificate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCCertificateStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCCodec.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDataChannel.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDataChannelEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDataChannelParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDataChannelStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDataChannelStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDataTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtlsCertificateBinary.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtlsFingerprint.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtlsParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtlsTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtlsTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtlsTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtmfSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCDtmfToneChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceCandidateAttributes.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceCandidateComplete.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceCandidatePair.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceCandidatePairChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceCandidatePairStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGatherer.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGathererCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGathererCandidateCompleteEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGathererCandidateEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGathererIceErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGathererStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGathererStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGatherInterfacePolicy.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceGatherOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceServer.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceTransportController.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceTransportOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIceTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIdentity.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIdentityAssertion.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIdentityError.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCIdentityResult.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCInboundRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCMediaStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCMediaStreamTrackStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCMessageEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCOutboundRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtcpFeedback.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtcpParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtcpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpCodecCapability.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpCodecCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpCodecParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpContributingSource.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpEncodingParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpFecParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpFlexFecCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpH264CodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpH264CodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpHeaderExtension.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpHeaderExtensionParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpListener.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpOpusCodecCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpOpusCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpOpusCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpReceiver.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpRedCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpRtxCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpRtxCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpRtxParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpUnhandledEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpVp8CodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCRtpVp8CodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSctpCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSctpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSctpTransportListener.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSctpTransportListenerEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSctpTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSctpTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSrtpSdesCryptoParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSrtpSdesKeyParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSrtpSdesParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSrtpSdesTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSrtpTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCSsrcConflictEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCStatsProvider.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCStatsReport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_RTCStatsTypeSet.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_Settings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/org_ortc_StringOrStringList.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/output.json", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/types.h", +] + +ortc_sources = [] +webrtc_sources = [] + +if(current_os != "winuwp"){ +webrtc_sources = [ + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/webRtc/idl/wrapper/generated/c/c_helpers.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/webRtc/idl/wrapper/generated/c/c_helpers.h", +] +ortc_sources = [ + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_helpers.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_helpers.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_MediaStream.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_MediaStream.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCAnswerOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCAnswerOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCCapabilityOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCConfiguration.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCConfiguration.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCIceCandidate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCIceCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCOfferAnswerOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCOfferAnswerOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCOfferOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCOfferOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCPeerConnection.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCPeerConnection.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCPeerConnectionIceEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescription.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescription.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionDescription.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCTrackEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_adapter_RTCTrackEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainBoolean.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainBoolean.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainBooleanParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainBooleanParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainDouble.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainDouble.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainDoubleRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainDoubleRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainLong.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainLong.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainLongRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainLongRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainString.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainString.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainStringParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ConstrainStringParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_DoubleRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_DoubleRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Error.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Error.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_ErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_EventQueue.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_EventQueue.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_EventQueueMaker.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_EventQueueMaker.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Json.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Json.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Logger.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Logger.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_LongRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_LongRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaControl.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaControl.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaDeviceInfo.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaDeviceInfo.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaDevices.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaDevices.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaSource.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaSource.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaStreamConstraints.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaStreamConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaStreamTrack.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaStreamTrack.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackCapabilities.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackConstraints.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackConstraintSet.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackConstraintSet.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackSupportedConstraints.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_MediaTrackSupportedConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_OrtcLib.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_OrtcLib.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_OverconstrainedError.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_OverconstrainedError.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_OverconstrainedErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_OverconstrainedErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCCertificate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCCertificate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCCertificateStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCCertificateStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCCodec.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCCodec.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannel.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannel.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataChannelStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDataTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsCertificateBinary.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsCertificateBinary.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsFingerprint.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsFingerprint.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtlsTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtmfSender.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtmfSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtmfToneChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCDtmfToneChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidateAttributes.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidateAttributes.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidateComplete.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidateComplete.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidatePair.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidatePair.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidatePairChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidatePairChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidatePairStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceCandidatePairStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGatherer.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGatherer.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererCandidate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererCandidateCompleteEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererCandidateEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererCandidateEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererIceErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererIceErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGathererStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGatherInterfacePolicy.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGatherInterfacePolicy.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGatherOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceGatherOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceServer.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceServer.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportController.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportController.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIceTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentity.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentity.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentityAssertion.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentityAssertion.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentityError.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentityError.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentityResult.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCIdentityResult.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCInboundRtpStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCInboundRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCMediaStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCMediaStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCMediaStreamTrackStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCMediaStreamTrackStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCMessageEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCMessageEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCOutboundRtpStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCOutboundRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtcpFeedback.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtcpFeedback.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtcpParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtcpParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtcpTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtcpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCapabilities.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecCapability.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecCapability.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecCapabilityOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpContributingSource.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpContributingSource.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpEncodingParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpEncodingParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpFecParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpFecParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpH264CodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpH264CodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpH264CodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpHeaderExtension.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpHeaderExtension.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpHeaderExtensionParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpHeaderExtensionParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpListener.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpListener.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpOpusCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpReceiver.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpReceiver.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRedCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRedCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRtxCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRtxParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpRtxParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpSender.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpUnhandledEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpUnhandledEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCRtpVp8CodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpCapabilities.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportListener.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportListener.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportListenerEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportListenerEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSctpTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesCryptoParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesCryptoParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesKeyParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesKeyParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSrtpTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSsrcConflictEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCSsrcConflictEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStatsProvider.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStatsProvider.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStatsReport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStatsReport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStatsTypeSet.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_RTCStatsTypeSet.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Settings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_Settings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_StringOrStringList.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/c_org_ortc_StringOrStringList.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/c/types.h", +] +} + +if(current_os == "winuwp"){ + webrtc_sources = [ + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/webRtc/idl/wrapper/generated/cx/cx_Helpers.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/webRtc/idl/wrapper/generated/cx/cx_Helpers.h", + ] + ortc_sources = [ + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/cx_Helpers.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/cx_Helpers.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_MediaStream.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_MediaStream.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCAnswerOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCAnswerOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCCapabilityOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCConfiguration.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCConfiguration.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCIceCandidate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCIceCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCMediaStreamTrackConfiguration.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCMediaStreamTrackConfiguration.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCOfferAnswerOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCOfferAnswerOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCOfferOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCOfferOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCPeerConnection.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCPeerConnection.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCPeerConnectionIceErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCPeerConnectionIceErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCPeerConnectionIceEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCPeerConnectionIceEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescription.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescription.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionConnectionData.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionConnectionData.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionConnectionDataDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionConnectionDataDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionDescription.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionDescription.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionDescriptionDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionDescriptionDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionMediaLine.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionMediaLineDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionMediaLineDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionRtpMediaLine.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionRtpMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionRtpSender.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionRtpSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionRtpSenderDetails.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionRtpSenderDetails.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionSctpMediaLine.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionSctpMediaLine.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionTransportParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCSessionDescriptionTransportParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCTrackEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Adapter_RTCTrackEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainBoolean.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainBoolean.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainBooleanParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainBooleanParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainDouble.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainDouble.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainDoubleRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainDoubleRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainLong.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainLong.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainLongRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainLongRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainString.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainString.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainStringParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ConstrainStringParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_DoubleRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_DoubleRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Error.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Error.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_ErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_EventQueue.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_EventQueue.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_EventQueueMaker.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_EventQueueMaker.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Json.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Json.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Logger.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Logger.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_LongRange.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_LongRange.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaControl.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaControl.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaDeviceInfo.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaDeviceInfo.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaDevices.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaDevices.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaSource.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaSource.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaStreamConstraints.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaStreamConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaStreamTrack.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaStreamTrack.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackCapabilities.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackConstraints.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackConstraintSet.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackConstraintSet.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackSupportedConstraints.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_MediaTrackSupportedConstraints.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_OrtcLib.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_OrtcLib.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_OverconstrainedError.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_OverconstrainedError.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_OverconstrainedErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_OverconstrainedErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCCertificate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCCertificate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCCertificateStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCCertificateStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCCodec.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCCodec.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannel.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannel.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataChannelStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDataTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsCertificateBinary.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsCertificateBinary.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsFingerprint.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsFingerprint.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsTransportStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtlsTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtmfSender.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtmfSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtmfToneChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCDtmfToneChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidateAttributes.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidateAttributes.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidateComplete.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidateComplete.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidatePair.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidatePair.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidatePairChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidatePairChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidatePairStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceCandidatePairStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGatherer.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGatherer.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererCandidate.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererCandidate.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererCandidateCompleteEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererCandidateCompleteEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererCandidateEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererCandidateEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererIceErrorEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererIceErrorEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGathererStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGatherInterfacePolicy.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGatherInterfacePolicy.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGatherOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceGatherOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceServer.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceServer.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportController.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportController.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIceTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentity.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentity.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentityAssertion.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentityAssertion.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentityError.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentityError.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentityResult.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCIdentityResult.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCInboundRtpStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCInboundRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCMediaStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCMediaStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCMediaStreamTrackStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCMediaStreamTrackStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCMessageEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCMessageEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCOutboundRtpStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCOutboundRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtcpFeedback.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtcpFeedback.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtcpParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtcpParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtcpTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtcpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCapabilities.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecCapability.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecCapability.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecCapabilityOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpContributingSource.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpContributingSource.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpEncodingParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpEncodingParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpFecParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpFecParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpFlexFecCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpFlexFecCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpFlexFecCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpH264CodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpH264CodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpH264CodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpH264CodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpHeaderExtension.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpHeaderExtension.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpHeaderExtensionParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpHeaderExtensionParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpListener.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpListener.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpOpusCodecCapabilityOptions.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpOpusCodecCapabilityOptions.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpOpusCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpOpusCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpOpusCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpOpusCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpReceiver.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpReceiver.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRedCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRedCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRtxCodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRtxCodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRtxCodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRtxCodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRtxParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpRtxParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpSender.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpSender.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpStreamStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpStreamStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpUnhandledEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpUnhandledEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpVp8CodecCapabilityParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpVp8CodecCapabilityParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpVp8CodecParameterSettings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCRtpVp8CodecParameterSettings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpCapabilities.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpCapabilities.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportListener.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportListener.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportListenerEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportListenerEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportStateChangeEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportStateChangeEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSctpTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesCryptoParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesCryptoParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesKeyParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesKeyParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesParameters.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesParameters.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesTransport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesTransport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpTransportStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSrtpTransportStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSsrcConflictEvent.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCSsrcConflictEvent.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStats.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStats.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStatsProvider.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStatsProvider.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStatsReport.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStatsReport.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStatsTypeSet.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_RTCStatsTypeSet.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Settings.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_Settings.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_StringOrStringList.cpp", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/Org_Ortc_StringOrStringList.h", + "$target_gen_dir/../../../../../../third_party/ortc/ortclib/ortc/idl/wrapper/generated/cx/types.h", + ] +} + +#Exists just to keep non generated ortclib code, in case we need it some day +static_library("ortclib_static") { + configs += [ ":ortclib_config" ] + + configs -= [ "//build/config/compiler:no_rtti" ] + configs -= [ "//build/config/compiler:chromium_code" ] + + if (!is_win) { + configs -= [ "//build/config/gcc:no_exceptions" ] + } + + #To include sources generated from IDL set sources value to ortc_sources + sources = ortclib_sources + + defines = [ + "_LIB", + "USE_ETW", + "USE_OPENSSL=1", + "NOMINMAX", + "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE", + "_CRT_SECURE_NO_WARNINGS", + "_UNICODE", + "UNICODE", + ] + + if (is_linux || is_android) { + defines += [ + "WEBRTC_POSIX", + "WEBRTC_BUILD_LIBEVENT", + ] + } + + if (is_ios || is_mac) { + defines += [ + "WEBRTC_POSIX", + ] + } + + if (is_win) { + defines += [ "WEBRTC_WIN", ] + } + + if (is_linux) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } + + public_deps = [ + ":ortclib_events", + ":ortclib_idl", + ":webrtc_idl", + "//pc/:libjingle_peerconnection", + "//system_wrappers/:system_wrappers_default", + ] +} + + +shared_library("libOrtc") { + + configs -= [ "//build/config/compiler:no_rtti" ] + configs -= [ "//build/config/compiler:chromium_code" ] + + if (!is_win) { + configs -= [ "//build/config/gcc:no_exceptions", ] + if (is_ios || is_mac) { + cflags_cc = [ + "-Wall", + "-std=c++11", + "-g", + ] + ldflags = [ + "-lz", + "-lresolv", + ] + } + } else { + cflags_cc = [ + "/WX-", + "/wd4068", + ] + if (current_os != "winuwp") { + ldflags = [ + "/FIXED:NO", + ] + cflags_cc += ["/EHsc"] + } + } + include_dirs = [ + ".", + "..", + "../zsLib", + "../zsLib/zsLib/extras", + "../zsLib-eventing", + "../ortclib-services", + "../..", + "../../boringssl/include", + "../../usrsctp/usrsctplib", + "../../libsrtp/srtp/include", + "../../libsrtp/srtp/crypto/include", + "../../libsrtp/config", + "../../usrsctp/usrsctplib/usrsctplib", + "../../boringssl/include/openssl", + "../../boringssl/include", + "../../libsrtp/include", + "../../libsrtp/crypto/include", + "../../boringssl/src/include", + "../../libyuv/include", + "../..", + "../../ortc", + "../ortclib", + "../ortclib/ortc", + "../ortclib/ortc/idl", + "../ortclib/ortc/idl/wrapper", + ] + + sources = ortc_sources + + if (current_os == "winuwp") + { + include_dirs += [ "../ortclib/ortc/idl/wrapper/cx", ] + + #sources += [ + # "../ortclib/ortc/idl/wrapper/override/cx/MediaSourceHelper.cc", + # "../ortclib/ortc/idl/wrapper/override/cx/RTMediaStreamSource.cc", + # "../ortclib/ortc/idl/wrapper/override/cx/WebRtcMediaSource.cc", + # "../ortclib/ortc/idl/wrapper/override/cx/WebRtcMediaStream.cc", + #] + } + if (is_linux) { + + if (target_cpu == "x64") { + lib_dirs = [ + "/usr/lib", + "/usr/lib/x86_64-linux-gnu", + ] + } else if (target_cpu == "x86") { + lib_dirs = [ + "/usr/lib", + "/usr/lib/i386-linux-gnu", + "/lib/i386-linux-gnu", + ] + } + + libs = [ "uuid", "curl", "ssl", "crypto" ] + } + + if ((current_os != "winuwp") && is_win && is_debug) { + lib_dirs = [ + "..\..\ortc\curl\x86-debug-static\lib", + ] + libs = [ "libcurl.lib", "userenv.lib", "normaliz.lib" ] + } else if ((current_os != "winuwp") && is_win && !is_debug) { + lib_dirs = [ + "..\..\ortc\curl\x86-release-static\lib", + ] + libs = [ "libcurl.lib", "userenv.lib", "normaliz.lib" ] + } else if (is_mac || is_ios){ + libs = [ "../../ortc/curl/curl/ios-appstore/lib/libcurl.a" ] + } + + deps = [ + "//third_party/ortc/zsLib:zslib", + "//third_party/ortc/zsLib-eventing:zslib-eventing", + "//third_party/idnkit:idnkit", + "//third_party/udns:udns", + ":ortclib_generated_static", + "//third_party/ortc/ortclib-services", + "//third_party/boringssl:boringssl", + "//third_party/usrsctp:usrsctp", + "//third_party/libsrtp:libsrtp", + "//modules/audio_device", + "//system_wrappers:metrics_default", + "//modules/video_capture:video_capture_module", + "//modules/video_capture:video_capture_internal_impl" + ] + + if (is_win && (current_os != "winuwp")) { + deps += [ "//third_party/cryptopp(//build/toolchain/win:$current_cpu)", ] + } else { + deps += [ "//third_party/cryptopp", ] + } + defines = [ + "SHARED", + "ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION", + "USE_ETW", + "USE_OPENSSL=1", + "NOMINMAX", + "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE", + "_CRT_SECURE_NO_WARNINGS", + "_UNICODE", + "UNICODE", + ] + + if (is_ios || is_mac) { + defines += [ + "WEBRTC_POSIX", + ] + } + + if (is_linux || is_android) { + defines += [ + "WEBRTC_POSIX", + "WEBRTC_BUILD_LIBEVENT", + ] + } + + if (is_win && (current_os != "winuwp")) { + defines += [ + "CRYPTOPP_IGNORE_CALNG_LIMITATION", + ] + } + + if (is_linux) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } + +} + +static_library("ortclib_generated_static") { + + configs += [ ":ortclib_config" ] + + configs -= [ "//build/config/compiler:no_rtti" ] + configs -= [ "//build/config/compiler:chromium_code" ] + + if (!is_win) { + configs -= [ "//build/config/gcc:no_exceptions" ] + } + + + #To include sources generated from IDL set sources value to ortc_sources + sources = ortc_sources_cxx_glue + sources += ortc_sources_cxx_generated + + defines = [ + "_LIB", + "USE_ETW", + "USE_OPENSSL=1", + "NOMINMAX", + "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE", + "_CRT_SECURE_NO_WARNINGS", + "_UNICODE", + "UNICODE", + ] + + if (is_linux) { + defines += [ + "WEBRTC_POSIX", + "WEBRTC_BUILD_LIBEVENT", + ] + } + + if (is_win) { + defines += [ "WEBRTC_WIN", ] + } + + public_deps = [ + ":ortclib_static", + ] + + if (is_linux) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } +} + +compile_event_macro("ortclib_events") { + + sources = [ + "ortc/cpp/ortc.events.json", + "ortc/cpp/ortc.stats.events.json", + ] + +} + +compile_idl_macro("ortclib_idl") { + + sources = [ + "ortc/idl/config.json", + ] + + outputs = ortc_sources + + idlAlreadyCompletedFlag = "ortclibIdlCompiledFlag.flg" +} + + +compile_idl_macro("webrtc_idl") { + + sources = [ + "webrtc/idl/config.json", + ] + + outputs = webrtc_sources + + idlAlreadyCompletedFlag = "webrtcIdlCompiledFlag.flg" +} diff --git a/ortc/ICapabilities.h b/ortc/ICapabilities.h index 45e1367a..d0fd143d 100644 --- a/ortc/ICapabilities.h +++ b/ortc/ICapabilities.h @@ -41,117 +41,117 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities - #pragma mark + // + // ICapabilities + // interaction ICapabilities { - ZS_DECLARE_STRUCT_PTR(CapabilityBoolean) - ZS_DECLARE_STRUCT_PTR(CapabilityLong) - ZS_DECLARE_STRUCT_PTR(CapabilityDouble) - ZS_DECLARE_STRUCT_PTR(CapabilityString) + ZS_DECLARE_STRUCT_PTR(CapabilityBoolean); + ZS_DECLARE_STRUCT_PTR(CapabilityLong); + ZS_DECLARE_STRUCT_PTR(CapabilityDouble); + ZS_DECLARE_STRUCT_PTR(CapabilityString); //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityBoolean - #pragma mark + // + // ICapabilities::CapabilityBoolean + // struct CapabilityBoolean : public std::set { - CapabilityBoolean() {} - CapabilityBoolean(const CapabilityBoolean &op2) {*this = op2;} + CapabilityBoolean() noexcept {} + CapabilityBoolean(const CapabilityBoolean &op2) noexcept {*this = op2;} CapabilityBoolean( ElementPtr elem, const char *objectName = "bool" - ); + ) noexcept; // {"objectName": {"objectValueName": [true,false]}} ElementPtr createElement( const char *objectName, const char *objectValueName = "bool" - ) const; + ) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityLong - #pragma mark + // + // ICapabilities::CapabilityLong + // struct CapabilityLong { LONG mMin {}; LONG mMax {}; - CapabilityLong() {} - CapabilityLong(LONG value) : mMin(value), mMax(value) {} + CapabilityLong() noexcept {} + CapabilityLong(LONG value) noexcept : mMin(value), mMax(value) {} CapabilityLong( LONG min, LONG max - ) : mMin(min), mMax(max) {} - CapabilityLong(const CapabilityLong &op2) {*this = op2;} + ) noexcept : mMin(min), mMax(max) {} + CapabilityLong(const CapabilityLong &op2) noexcept {*this = op2;} // {"objectName": {"min": 0, "max": 0}} - CapabilityLong(ElementPtr elem); + CapabilityLong(ElementPtr elem) noexcept; // {"objectName": {"min": 0, "max": 0}} - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityDouble - #pragma mark + // + // ICapabilities::CapabilityDouble + // struct CapabilityDouble { double mMin {}; double mMax {}; - CapabilityDouble() {} - CapabilityDouble(double value) : mMin(value), mMax(value) {} + CapabilityDouble() noexcept {} + CapabilityDouble(double value) noexcept : mMin(value), mMax(value) {} CapabilityDouble( double min, double max - ) : mMin(min), mMax(max) {} - CapabilityDouble(const CapabilityDouble &op2) {*this = op2;} + ) noexcept : mMin(min), mMax(max) {} + CapabilityDouble(const CapabilityDouble &op2) noexcept {*this = op2;} // {"objectName": {"min": 0.0, "max": 0.0}} - CapabilityDouble(ElementPtr elem); + CapabilityDouble(ElementPtr elem) noexcept; // {"objectName": {"min": 0, "max": 0}} - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityString - #pragma mark + // + // ICapabilities::CapabilityString + // struct CapabilityString : public std::set { - CapabilityString() {} - CapabilityString(const CapabilityString &op2) {*this = op2;} + CapabilityString() noexcept {} + CapabilityString(const CapabilityString &op2) noexcept {*this = op2;} CapabilityString( ElementPtr elem, const char *objectName = "string" - ); + ) noexcept; // {"objectName": {"objectValueName": ["a","b","c"]}} ElementPtr createElement( const char *objectName, const char *objectValueName = "string" - ) const; + ) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; } diff --git a/ortc/ICertificate.h b/ortc/ICertificate.h index 35aa2c93..dc2e18ab 100644 --- a/ortc/ICertificate.h +++ b/ortc/ICertificate.h @@ -44,22 +44,22 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportTypes - #pragma mark + // + // ICertificateTypes + // interaction ICertificateTypes { - ZS_DECLARE_STRUCT_PTR(Fingerprint) - ZS_DECLARE_TYPEDEF_PTR(std::list, FingerprintList) + ZS_DECLARE_STRUCT_PTR(Fingerprint); + ZS_DECLARE_TYPEDEF_PTR(std::list, FingerprintList); typedef PromiseWith PromiseWithCertificate; - ZS_DECLARE_PTR(PromiseWithCertificate) + ZS_DECLARE_PTR(PromiseWithCertificate); //------------------------------------------------------------------------- - #pragma mark - #pragma mark Fingerprint - #pragma mark + // + // Fingerprint + // struct Fingerprint { @@ -67,13 +67,13 @@ namespace ortc String mValue; Fingerprint() {} - Fingerprint(const Fingerprint &op2) {(*this) = op2;} - Fingerprint(ElementPtr elem); + Fingerprint(const Fingerprint &op2) noexcept {(*this) = op2;} + Fingerprint(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "fingerprint") const; + ElementPtr createElement(const char *objectName = "fingerprint") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -81,26 +81,26 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransport - #pragma mark + // + // ICertificate + // interaction ICertificate : public ICertificateTypes, public IStatsProvider, public Any { - static ElementPtr toDebug(ICertificatePtr certificate); + static ElementPtr toDebug(ICertificatePtr certificate) noexcept; - static ICertificatePtr convert(AnyPtr any); + static ICertificatePtr convert(AnyPtr any) noexcept; - static PromiseWithCertificatePtr generateCertificate(ElementPtr keygenAlgorithm) throw (NotSupportedError); - static PromiseWithCertificatePtr generateCertificate(const char *keygenAlgorithm = NULL) throw (NotSupportedError); + static PromiseWithCertificatePtr generateCertificate(ElementPtr keygenAlgorithm) noexcept(false); // throws NotSupportedError + static PromiseWithCertificatePtr generateCertificate(const char *keygenAlgorithm = NULL) noexcept(false); // throws NotSupportedError - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual Time expires() const = 0; + virtual Time expires() const noexcept = 0; - virtual FingerprintPtr fingerprint() const = 0; + virtual FingerprintPtr fingerprint() const noexcept = 0; }; } diff --git a/ortc/IConstraints.h b/ortc/IConstraints.h index ea634b69..76a2c5a7 100644 --- a/ortc/IConstraints.h +++ b/ortc/IConstraints.h @@ -42,71 +42,71 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints - #pragma mark + // + // IConstraints + // interaction IConstraints { - ZS_DECLARE_STRUCT_PTR(ConstrainBoolean) - ZS_DECLARE_STRUCT_PTR(ConstrainBooleanParameters) - ZS_DECLARE_STRUCT_PTR(ConstrainLong) - ZS_DECLARE_STRUCT_PTR(ConstrainLongRange) - ZS_DECLARE_STRUCT_PTR(ConstrainDouble) - ZS_DECLARE_STRUCT_PTR(ConstrainDoubleRange) - ZS_DECLARE_STRUCT_PTR(ConstrainString) - ZS_DECLARE_STRUCT_PTR(ConstrainStringParameters) - ZS_DECLARE_STRUCT_PTR(StringOrStringList) - - ZS_DECLARE_TYPEDEF_PTR(zsLib::LONG, Long) - ZS_DECLARE_TYPEDEF_PTR(bool, Bool) - ZS_DECLARE_TYPEDEF_PTR(double, Double) - ZS_DECLARE_TYPEDEF_PTR(String, String) - - ZS_DECLARE_TYPEDEF_PTR(std::list, StringList) + ZS_DECLARE_STRUCT_PTR(ConstrainBoolean); + ZS_DECLARE_STRUCT_PTR(ConstrainBooleanParameters); + ZS_DECLARE_STRUCT_PTR(ConstrainLong); + ZS_DECLARE_STRUCT_PTR(ConstrainLongRange); + ZS_DECLARE_STRUCT_PTR(ConstrainDouble); + ZS_DECLARE_STRUCT_PTR(ConstrainDoubleRange); + ZS_DECLARE_STRUCT_PTR(ConstrainString); + ZS_DECLARE_STRUCT_PTR(ConstrainStringParameters); + ZS_DECLARE_STRUCT_PTR(StringOrStringList); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::LONG, Long); + ZS_DECLARE_TYPEDEF_PTR(bool, Bool); + ZS_DECLARE_TYPEDEF_PTR(double, Double); + ZS_DECLARE_TYPEDEF_PTR(String, String); + + ZS_DECLARE_TYPEDEF_PTR(std::list, StringList); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainBooleanParameters - #pragma mark + // + // IConstraints::ConstrainBooleanParameters + // struct ConstrainBooleanParameters { Optional mExact; Optional mIdeal; - ConstrainBooleanParameters() {} - ConstrainBooleanParameters(const ConstrainBooleanParameters &op2) {(*this) = op2;} - ConstrainBooleanParameters(ElementPtr elem); + ConstrainBooleanParameters() noexcept {} + ConstrainBooleanParameters(const ConstrainBooleanParameters &op2) noexcept {(*this) = op2;} + ConstrainBooleanParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainBoolean - #pragma mark + // + // IConstraints::ConstrainBoolean + // struct ConstrainBoolean { Optional mValue; Optional mParameters; - ConstrainBoolean() {} - ConstrainBoolean(const ConstrainBoolean &op2) {(*this) = op2;} - ConstrainBoolean(ElementPtr elem); + ConstrainBoolean() noexcept {} + ConstrainBoolean(const ConstrainBoolean &op2) noexcept {(*this) = op2;} + ConstrainBoolean(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainLongRange - #pragma mark + // + // IConstraints::ConstrainLongRange + // struct ConstrainLongRange { Optional mMin; @@ -114,39 +114,39 @@ namespace ortc Optional mExact; Optional mIdeal; - ConstrainLongRange() {} - ConstrainLongRange(const ConstrainLongRange &op2) {(*this) = op2;} - ConstrainLongRange(ElementPtr elem); + ConstrainLongRange() noexcept {} + ConstrainLongRange(const ConstrainLongRange &op2) noexcept {(*this) = op2;} + ConstrainLongRange(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainLong - #pragma mark + // + // IConstraints::ConstrainLong + // struct ConstrainLong { Optional mValue; Optional mRange; - ConstrainLong() {} - ConstrainLong(const ConstrainLong &op2) {(*this) = op2;} - ConstrainLong(ElementPtr elem); + ConstrainLong() noexcept {} + ConstrainLong(const ConstrainLong &op2) noexcept {(*this) = op2;} + ConstrainLong(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainDoubleRange - #pragma mark + // + // IConstraints::ConstrainDoubleRange + // struct ConstrainDoubleRange { Optional mMin; @@ -154,104 +154,107 @@ namespace ortc Optional mExact; Optional mIdeal; - ConstrainDoubleRange() {} - ConstrainDoubleRange(const ConstrainDoubleRange &op2) {(*this) = op2;} - ConstrainDoubleRange(ElementPtr elem); + ConstrainDoubleRange() noexcept {} + ConstrainDoubleRange(const ConstrainDoubleRange &op2) noexcept {(*this) = op2;} + ConstrainDoubleRange(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainDouble - #pragma mark + // + // IConstraints::ConstrainDouble + // struct ConstrainDouble { Optional mValue; Optional mRange; - ConstrainDouble() {} - ConstrainDouble(const ConstrainDouble &op2) {(*this) = op2;} - ConstrainDouble(ElementPtr elem); + ConstrainDouble() noexcept {} + ConstrainDouble(const ConstrainDouble &op2) noexcept {(*this) = op2;} + ConstrainDouble(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::StringOrStringList - #pragma mark + // + // IConstraints::StringOrStringList + // struct StringOrStringList { Optional mValue; Optional mValues; - StringOrStringList() {} - StringOrStringList(const StringOrStringList &op2) {(*this) = op2;} + StringOrStringList() noexcept {} + StringOrStringList(const StringOrStringList &op2) noexcept {(*this) = op2;} StringOrStringList( ElementPtr elem, const char *objectValueName = "value" - ); + ) noexcept; // {"objectName": {"abc"}} // {"objectName": {"objectValueName": ["a","b","c"]}} ElementPtr createElement( const char *objectName, const char *objectValueName = "value" - ) const; + ) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstraintStringParameters - #pragma mark + // + // IConstraints::ConstraintStringParameters + // struct ConstrainStringParameters { Optional mExact; Optional mIdeal; - ConstrainStringParameters() {} - ConstrainStringParameters(const ConstrainStringParameters &op2) {(*this) = op2;} - ConstrainStringParameters(ElementPtr elem); + ConstrainStringParameters() noexcept {} + ConstrainStringParameters(const ConstrainStringParameters &op2) noexcept {(*this) = op2;} + ConstrainStringParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstraintString - #pragma mark + // + // IConstraints::ConstraintString + // struct ConstrainString { Optional mValue; Optional mParameters; - ConstrainString() {} - ConstrainString(const ConstrainString &op2) {(*this) = op2;} + ConstrainString() noexcept {} + ConstrainString(const ConstrainString &op2) noexcept {(*this) = op2;} ConstrainString( ElementPtr elem, const char *objectValueName = "value" - ); + ) noexcept; ElementPtr createElement( const char *objectName, const char *objectValueName = "value" - ) const; + ) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; + + void exact(StringList &values) const noexcept; + void ideal(StringList &values) const noexcept; }; }; diff --git a/ortc/IDTLSTransport.h b/ortc/IDTLSTransport.h index 6cd23942..61bc559f 100644 --- a/ortc/IDTLSTransport.h +++ b/ortc/IDTLSTransport.h @@ -45,24 +45,24 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportTypes - #pragma mark + // + // IDTLSTransportTypes + // interaction IDTLSTransportTypes { - ZS_DECLARE_STRUCT_PTR(Parameters) - ZS_DECLARE_TYPEDEF_PTR(std::list, SecureByteBlockList) - ZS_DECLARE_TYPEDEF_PTR(ICertificateTypes::FingerprintList, FingerprintList) - ZS_DECLARE_TYPEDEF_PTR(std::list, CertificateList) + ZS_DECLARE_STRUCT_PTR(Parameters); + ZS_DECLARE_TYPEDEF_PTR(std::list, SecureByteBlockList); + ZS_DECLARE_TYPEDEF_PTR(ICertificateTypes::FingerprintList, FingerprintList); + ZS_DECLARE_TYPEDEF_PTR(std::list, CertificateList); typedef PromiseWith PromiseWithParameters; - ZS_DECLARE_PTR(PromiseWithParameters) + ZS_DECLARE_PTR(PromiseWithParameters); //------------------------------------------------------------------------- - #pragma mark - #pragma mark TransportStates - #pragma mark + // + // TransportStates + // enum States { @@ -77,13 +77,13 @@ namespace ortc State_Last = State_Failed, }; - static const char *toString(States state); - static States toState(const char *state) throw (InvalidParameters); + static const char *toString(States state) noexcept; + static States toState(const char *state) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark Roles - #pragma mark + // + // Roles + // enum Roles { @@ -96,29 +96,29 @@ namespace ortc Role_Last = Role_Server, }; - static const char *toString(Roles role); - static Roles toRole(const char *role) throw (InvalidParameters); + static const char *toString(Roles role) noexcept; + static Roles toRole(const char *role) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark Roles - #pragma mark + // + // Roles + // struct Parameters : public Any { Roles mRole {Role_Auto}; FingerprintList mFingerprints; - Parameters() {} - Parameters(const Parameters &op2) {(*this) = op2;} - Parameters(ElementPtr rootEl); + Parameters() noexcept {} + Parameters(const Parameters &op2) noexcept {(*this) = op2;} + Parameters(ElementPtr rootEl) noexcept; - static ParametersPtr create(ElementPtr rootEl) { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName) const; + static ParametersPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName) const noexcept; - static ParametersPtr convert(AnyPtr any); - ElementPtr toDebug() const; - String hash() const; + static ParametersPtr convert(AnyPtr any) noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -126,55 +126,52 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransport - #pragma mark + // + // IDTLSTransport + // interaction IDTLSTransport : public IDTLSTransportTypes, public IRTPTransport, public IRTCPTransport, public IStatsProvider { - static ElementPtr toDebug(IDTLSTransportPtr transport); + static ElementPtr toDebug(IDTLSTransportPtr transport) noexcept; - static IDTLSTransportPtr convert(IRTPTransportPtr object); - static IDTLSTransportPtr convert(IRTCPTransportPtr object); + static IDTLSTransportPtr convert(IRTPTransportPtr object) noexcept; + static IDTLSTransportPtr convert(IRTCPTransportPtr object) noexcept; static IDTLSTransportPtr create( IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificates - ); + ) noexcept(false); // throws InvalidParameters - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IDTLSTransportSubscriptionPtr subscribe(IDTLSTransportDelegatePtr delegate) = 0; + virtual IDTLSTransportSubscriptionPtr subscribe(IDTLSTransportDelegatePtr delegate) noexcept = 0; - virtual CertificateListPtr certificates() const = 0; - virtual IICETransportPtr transport() const = 0; + virtual CertificateListPtr certificates() const noexcept = 0; + virtual IICETransportPtr transport() const noexcept = 0; - virtual States state() const = 0; + virtual States state() const noexcept = 0; - virtual ParametersPtr getLocalParameters() const = 0; - virtual ParametersPtr getRemoteParameters() const = 0; + virtual ParametersPtr getLocalParameters() const noexcept = 0; + virtual ParametersPtr getRemoteParameters() const noexcept = 0; - virtual SecureByteBlockListPtr getRemoteCertificates() const = 0; + virtual SecureByteBlockListPtr getRemoteCertificates() const noexcept = 0; - virtual void start(const Parameters &remoteParameters) throw ( - InvalidStateError, - InvalidParameters - ) = 0; + virtual void start(const Parameters &remoteParameters) noexcept(false) = 0; // throws InvalidStateError, InvalidParameters - virtual void stop() = 0; + virtual void stop() noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportDelegate - #pragma mark + // + // IDTLSTransportDelegate + // interaction IDTLSTransportDelegate { @@ -193,17 +190,17 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportSubscription - #pragma mark + // + // IDTLSTransportSubscription + // interaction IDTLSTransportSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } @@ -211,14 +208,14 @@ ZS_DECLARE_PROXY_BEGIN(ortc::IDTLSTransportDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IDTLSTransportPtr, IDTLSTransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IDTLSTransport::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::ErrorAnyPtr, ErrorAnyPtr) -ZS_DECLARE_PROXY_METHOD_2(onDTLSTransportStateChange, IDTLSTransportPtr, States) -ZS_DECLARE_PROXY_METHOD_2(onDTLSTransportError, IDTLSTransportPtr, ErrorAnyPtr) +ZS_DECLARE_PROXY_METHOD(onDTLSTransportStateChange, IDTLSTransportPtr, States) +ZS_DECLARE_PROXY_METHOD(onDTLSTransportError, IDTLSTransportPtr, ErrorAnyPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IDTLSTransportDelegate, ortc::IDTLSTransportSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDTLSTransportPtr, IDTLSTransportPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDTLSTransport::States, States) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::ErrorAnyPtr, ErrorAnyPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onDTLSTransportStateChange, IDTLSTransportPtr, States) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onDTLSTransportError, IDTLSTransportPtr, ErrorAnyPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDTLSTransportStateChange, IDTLSTransportPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDTLSTransportError, IDTLSTransportPtr, ErrorAnyPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IDTMFSender.h b/ortc/IDTMFSender.h index 61af595b..3f573939 100644 --- a/ortc/IDTMFSender.h +++ b/ortc/IDTMFSender.h @@ -39,61 +39,58 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderTypes - #pragma mark + // + // IDTMFSenderTypes + // interaction IDTMFSenderTypes { - ZS_DECLARE_CUSTOM_EXCEPTION(InvalidCharacterError) + ZS_DECLARE_CUSTOM_EXCEPTION(InvalidCharacterError); }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSender - #pragma mark + // + // IDTMFSender + // interaction IDTMFSender : public IDTMFSenderTypes { - static ElementPtr toDebug(IDTMFSenderPtr sender); + static ElementPtr toDebug(IDTMFSenderPtr sender) noexcept; static IDTMFSenderPtr create( IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) = 0; + virtual IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) noexcept = 0; - virtual bool canInsertDTMF() const = 0; + virtual bool canInsertDTMF() const noexcept = 0; virtual void insertDTMF( const char *tones, Milliseconds duration = Milliseconds(70), Milliseconds interToneGap = Milliseconds(70) - ) throw ( - InvalidStateError, - InvalidCharacterError - ) = 0; + ) noexcept(false) = 0; //throws InvalidStateError, InvalidCharacterError - virtual IRTPSenderPtr sender() const = 0; + virtual IRTPSenderPtr sender() const noexcept = 0; - virtual String toneBuffer() const = 0; - virtual Milliseconds duration() const = 0; - virtual Milliseconds interToneGap() const = 0; + virtual String toneBuffer() const noexcept = 0; + virtual Milliseconds duration() const noexcept = 0; + virtual Milliseconds interToneGap() const noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderDelegate - #pragma mark + // + // IDTMFSenderDelegate + // interaction IDTMFSenderDelegate { @@ -107,27 +104,27 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderSubscription - #pragma mark + // + // IDTMFSenderSubscription + // interaction IDTMFSenderSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } ZS_DECLARE_PROXY_BEGIN(ortc::IDTMFSenderDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IDTMFSenderPtr, IDTMFSenderPtr) -ZS_DECLARE_PROXY_METHOD_2(onDTMFSenderToneChanged, IDTMFSenderPtr, String) +ZS_DECLARE_PROXY_METHOD(onDTMFSenderToneChanged, IDTMFSenderPtr, String) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IDTMFSenderDelegate, ortc::IDTMFSenderSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDTMFSenderPtr, IDTMFSenderPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onDTMFSenderToneChanged, IDTMFSenderPtr, String) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDTMFSenderToneChanged, IDTMFSenderPtr, String) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IDataChannel.h b/ortc/IDataChannel.h index ff9028b8..9f686b3f 100644 --- a/ortc/IDataChannel.h +++ b/ortc/IDataChannel.h @@ -41,60 +41,60 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannel - #pragma mark + // + // IDataChannel + // interaction IDataChannel : public Any, public IDataChannelTypes, public IStatsProvider { - static ElementPtr toDebug(IDataChannelPtr channel); + static ElementPtr toDebug(IDataChannelPtr channel) noexcept; static IDataChannelPtr create( IDataChannelDelegatePtr delegate, IDataTransportPtr transport, const Parameters ¶ms - ) throw (InvalidParameters, InvalidStateError); + ) noexcept(false); // throws InvalidParameters, InvalidStateError - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IDataChannelSubscriptionPtr subscribe(IDataChannelDelegatePtr delegate) = 0; + virtual IDataChannelSubscriptionPtr subscribe(IDataChannelDelegatePtr delegate) noexcept = 0; - virtual IDataTransportPtr transport() const = 0; + virtual IDataTransportPtr transport() const noexcept = 0; - virtual ParametersPtr parameters() const = 0; + virtual ParametersPtr parameters() const noexcept = 0; - virtual States readyState() const = 0; + virtual States readyState() const noexcept = 0; - virtual size_t bufferedAmount() const = 0; - virtual size_t bufferedAmountLowThreshold() const = 0; - virtual void bufferedAmountLowThreshold(size_t value) = 0; + virtual size_t bufferedAmount() const noexcept = 0; + virtual size_t bufferedAmountLowThreshold() const noexcept = 0; + virtual void bufferedAmountLowThreshold(size_t value) noexcept = 0; - virtual String binaryType() const = 0; - virtual void binaryType(const char *str) = 0; + virtual String binaryType() const noexcept = 0; + virtual void binaryType(const char *str) noexcept = 0; - virtual void close() = 0; + virtual void close() noexcept = 0; - virtual void send(const String &data) = 0; - virtual void send(const SecureByteBlock &data) = 0; + virtual void send(const String &data) noexcept = 0; + virtual void send(const SecureByteBlock &data) noexcept = 0; virtual void send( const BYTE *buffer, size_t bufferSizeInBytes - ) = 0; + ) noexcept(false) = 0; // throws InvalidParameters }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelDelegate - #pragma mark + // + // IDataChannelDelegate + // interaction IDataChannelDelegate { - ZS_DECLARE_STRUCT_PTR(MessageEventData) + ZS_DECLARE_STRUCT_PTR(MessageEventData); typedef IDataChannelTypes::States States; @@ -126,17 +126,17 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelSubscription - #pragma mark + // + // IDataChannelSubscription + // interaction IDataChannelSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } @@ -147,10 +147,10 @@ ZS_DECLARE_PROXY_TYPEDEF(ortc::IDataChannelTypes::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::ErrorAnyPtr, ErrorAnyPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::SecureByteBlockPtr, SecureByteBlockPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IDataChannelDelegate::MessageEventDataPtr, MessageEventDataPtr) -ZS_DECLARE_PROXY_METHOD_2(onDataChannelStateChange, IDataChannelPtr, States) -ZS_DECLARE_PROXY_METHOD_2(onDataChannelError, IDataChannelPtr, ErrorAnyPtr) -ZS_DECLARE_PROXY_METHOD_1(onDataChannelBufferedAmountLow, IDataChannelPtr) -ZS_DECLARE_PROXY_METHOD_2(onDataChannelMessage, IDataChannelPtr, MessageEventDataPtr) +ZS_DECLARE_PROXY_METHOD(onDataChannelStateChange, IDataChannelPtr, States) +ZS_DECLARE_PROXY_METHOD(onDataChannelError, IDataChannelPtr, ErrorAnyPtr) +ZS_DECLARE_PROXY_METHOD(onDataChannelBufferedAmountLow, IDataChannelPtr) +ZS_DECLARE_PROXY_METHOD(onDataChannelMessage, IDataChannelPtr, MessageEventDataPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IDataChannelDelegate, ortc::IDataChannelSubscription) @@ -159,8 +159,8 @@ ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDataChannelTypes::States, States) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::ErrorAnyPtr, ErrorAnyPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::SecureByteBlockPtr, SecureByteBlockPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDataChannelDelegate::MessageEventDataPtr, MessageEventDataPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onDataChannelStateChange, IDataChannelPtr, States) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onDataChannelError, IDataChannelPtr, ErrorAnyPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_1(onDataChannelBufferedAmountLow, IDataChannelPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onDataChannelMessage, IDataChannelPtr, MessageEventDataPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDataChannelStateChange, IDataChannelPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDataChannelError, IDataChannelPtr, ErrorAnyPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDataChannelBufferedAmountLow, IDataChannelPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onDataChannelMessage, IDataChannelPtr, MessageEventDataPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IDataChannelTypes.h b/ortc/IDataChannelTypes.h index 30220c2d..fbc06f6d 100644 --- a/ortc/IDataChannelTypes.h +++ b/ortc/IDataChannelTypes.h @@ -39,18 +39,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelTypes - #pragma mark + // + // IDataChannelTypes + // interaction IDataChannelTypes { - ZS_DECLARE_STRUCT_PTR(Parameters) + ZS_DECLARE_STRUCT_PTR(Parameters); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelTypes::States - #pragma mark + // + // IDataChannelTypes::States + // enum States { State_First, @@ -63,13 +63,13 @@ namespace ortc State_Last = State_Closed, }; - static const char *toString(States state); - static Optional toState(const char *state); + static const char *toString(States state) noexcept; + static Optional toState(const char *state) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelTypes::Parameters - #pragma mark + // + // IDataChannelTypes::Parameters + // struct Parameters { String mLabel; @@ -80,14 +80,14 @@ namespace ortc bool mNegotiated {false}; Optional mID; - Parameters() {} - Parameters(const Parameters &op2) {(*this) = op2;} - Parameters(ElementPtr elem); + Parameters() noexcept {} + Parameters(const Parameters &op2) noexcept {(*this) = op2;} + Parameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; } diff --git a/ortc/IDataTransport.h b/ortc/IDataTransport.h index 81d37fb2..8af4e9b6 100644 --- a/ortc/IDataTransport.h +++ b/ortc/IDataTransport.h @@ -40,9 +40,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataTransportTypes - #pragma mark + // + // IDataTransportTypes + // interaction IDataTransportTypes { @@ -52,13 +52,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSender - #pragma mark + // + // IDTMFSender + // interaction IDataTransport : public IDataTransportTypes, public IStatsProvider { - virtual ~IDataTransport() {} + virtual ~IDataTransport() noexcept {} }; } diff --git a/ortc/IHelper.h b/ortc/IHelper.h index 3fb54107..b90bdef8 100644 --- a/ortc/IHelper.h +++ b/ortc/IHelper.h @@ -41,9 +41,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IHelper - #pragma mark + // + // IHelper + // interaction IHelper : public services::IHelper { diff --git a/ortc/IICEGatherer.h b/ortc/IICEGatherer.h index a9d3b24e..5122e93a 100644 --- a/ortc/IICEGatherer.h +++ b/ortc/IICEGatherer.h @@ -41,25 +41,25 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes - #pragma mark + // + // IICEGathererTypes + // interaction IICEGathererTypes : public IICETypes { - ZS_DECLARE_STRUCT_PTR(Options) - ZS_DECLARE_STRUCT_PTR(Server) - ZS_DECLARE_STRUCT_PTR(InterfacePolicy) - ZS_DECLARE_STRUCT_PTR(ErrorEvent) + ZS_DECLARE_STRUCT_PTR(Options); + ZS_DECLARE_STRUCT_PTR(Server); + ZS_DECLARE_STRUCT_PTR(InterfacePolicy); + ZS_DECLARE_STRUCT_PTR(ErrorEvent); - ZS_DECLARE_TYPEDEF_PTR(std::list, StringList) - ZS_DECLARE_TYPEDEF_PTR(std::list, ServerList) - ZS_DECLARE_TYPEDEF_PTR(std::list, InterfacePolicyList) + ZS_DECLARE_TYPEDEF_PTR(std::list, StringList); + ZS_DECLARE_TYPEDEF_PTR(std::list, ServerList); + ZS_DECLARE_TYPEDEF_PTR(std::list, InterfacePolicyList); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::States - #pragma mark + // + // IICEGathererTypes::States + // enum States { State_First, @@ -72,13 +72,13 @@ namespace ortc State_Last = State_Closed, }; - static const char *toString(States state); - static States toState(const char *state) throw (InvalidParameters); + static const char *toString(States state) noexcept; + static States toState(const char *state) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::FilterPolicies - #pragma mark + // + // IICEGathererTypes::FilterPolicies + // enum FilterPolicies { FilterPolicy_None = 0, @@ -105,13 +105,13 @@ namespace ortc FilterPolicy_NoCandidates = (0x7FFFFFFF) }; - static String toString(FilterPolicies policies); - static FilterPolicies toPolicy(const char *filters); + static String toString(FilterPolicies policies) noexcept; + static FilterPolicies toPolicy(const char *filters) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::CredentialType - #pragma mark + // + // IICEGathererTypes::CredentialType + // enum CredentialTypes { CredentialType_First, @@ -122,33 +122,33 @@ namespace ortc CredentialType_Last = CredentialType_Token, }; - static const char *toString(CredentialTypes type); - static CredentialTypes toCredentialType(const char *type) throw (InvalidParameters); + static const char *toString(CredentialTypes type) noexcept; + static CredentialTypes toCredentialType(const char *type) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::Options - #pragma mark + // + // IICEGathererTypes::Options + // struct Options { bool mContinuousGathering {true}; InterfacePolicyList mInterfacePolicies; ServerList mICEServers; - Options() {} - Options(const Options &op2) {(*this) = op2;} - Options(ElementPtr elem); + Options() noexcept {} + Options(const Options &op2) noexcept {(*this) = op2;} + Options(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::Server - #pragma mark + // + // IICEGathererTypes::Server + // struct Server { StringList mURLs; @@ -156,39 +156,39 @@ namespace ortc String mCredential; CredentialTypes mCredentialType {CredentialType_Password}; - Server() {} - Server(const Server &op2) {(*this) = op2;} - Server(ElementPtr elem); + Server() noexcept {} + Server(const Server &op2) noexcept {(*this) = op2;} + Server(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "iceServer") const; + ElementPtr createElement(const char *objectName = "iceServer") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::InterfacePolicy - #pragma mark + // + // IICEGathererTypes::InterfacePolicy + // struct InterfacePolicy { String mInterfaceType; FilterPolicies mGatherPolicy {FilterPolicy_None}; - InterfacePolicy() {} - InterfacePolicy(const InterfacePolicy &op2) {(*this) = op2;} - InterfacePolicy(ElementPtr elem); + InterfacePolicy() noexcept {} + InterfacePolicy(const InterfacePolicy &op2) noexcept {(*this) = op2;} + InterfacePolicy(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "interfacePolicy") const; + ElementPtr createElement(const char *objectName = "interfacePolicy") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::ErrorEvent - #pragma mark + // + // IICEGathererTypes::ErrorEvent + // struct ErrorEvent { typedef WORD ErrorCode; @@ -198,14 +198,14 @@ namespace ortc ErrorCode mErrorCode; String mErrorText; - ErrorEvent() {} - ErrorEvent(const ErrorEvent &op2) { (*this) = op2; } - ErrorEvent(ElementPtr elem); + ErrorEvent() noexcept {} + ErrorEvent(const ErrorEvent &op2) noexcept { (*this) = op2; } + ErrorEvent(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "errorEvent") const; + ElementPtr createElement(const char *objectName = "errorEvent") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -213,50 +213,50 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGatherer - #pragma mark + // + // IICEGatherer + // interaction IICEGatherer : public IICEGathererTypes, public IStatsProvider { - static ElementPtr toDebug(IICEGathererPtr gatherer); + static ElementPtr toDebug(IICEGathererPtr gatherer) noexcept; static IICEGathererPtr create( IICEGathererDelegatePtr delegate, const Options &options - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) = 0; + virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) noexcept = 0; - virtual Components component() const = 0; - virtual States state() const = 0; + virtual Components component() const noexcept = 0; + virtual States state() const noexcept = 0; - virtual ParametersPtr getLocalParameters() const = 0; - virtual CandidateListPtr getLocalCandidates() const = 0; + virtual ParametersPtr getLocalParameters() const noexcept = 0; + virtual CandidateListPtr getLocalCandidates() const noexcept = 0; - virtual IICEGathererPtr createAssociatedGatherer(IICEGathererDelegatePtr delegate) throw(InvalidStateError) = 0; + virtual IICEGathererPtr createAssociatedGatherer(IICEGathererDelegatePtr delegate) noexcept(false) = 0; // throws InvalidStateError - virtual void gather(const Optional &options = Optional()) = 0; + virtual void gather(const Optional &options = Optional()) noexcept = 0; - virtual void close() = 0; + virtual void close() noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererDelegate - #pragma mark + // + // IICEGathererDelegate + // interaction IICEGathererDelegate { - ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate) - ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateComplete, CandidateComplete) - ZS_DECLARE_TYPEDEF_PTR(IICEGathererTypes::ErrorEvent, ErrorEvent) + ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate); + ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateComplete, CandidateComplete); + ZS_DECLARE_TYPEDEF_PTR(IICEGathererTypes::ErrorEvent, ErrorEvent); virtual void onICEGathererStateChange( IICEGathererPtr gatherer, @@ -288,17 +288,17 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererSubscription - #pragma mark + // + // IICEGathererSubscription + // interaction IICEGathererSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } @@ -308,11 +308,11 @@ ZS_DECLARE_PROXY_TYPEDEF(ortc::IICEGatherer::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICEGathererDelegate::CandidatePtr, CandidatePtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICEGathererDelegate::CandidateCompletePtr, CandidateCompletePtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICEGathererTypes::ErrorEventPtr, ErrorEventPtr) -ZS_DECLARE_PROXY_METHOD_2(onICEGathererStateChange, IICEGathererPtr, States) -ZS_DECLARE_PROXY_METHOD_2(onICEGathererLocalCandidate, IICEGathererPtr, CandidatePtr) -ZS_DECLARE_PROXY_METHOD_2(onICEGathererLocalCandidateComplete, IICEGathererPtr, CandidateCompletePtr) -ZS_DECLARE_PROXY_METHOD_2(onICEGathererLocalCandidateGone, IICEGathererPtr, CandidatePtr) -ZS_DECLARE_PROXY_METHOD_2(onICEGathererError, IICEGathererPtr, ErrorEventPtr) +ZS_DECLARE_PROXY_METHOD(onICEGathererStateChange, IICEGathererPtr, States) +ZS_DECLARE_PROXY_METHOD(onICEGathererLocalCandidate, IICEGathererPtr, CandidatePtr) +ZS_DECLARE_PROXY_METHOD(onICEGathererLocalCandidateComplete, IICEGathererPtr, CandidateCompletePtr) +ZS_DECLARE_PROXY_METHOD(onICEGathererLocalCandidateGone, IICEGathererPtr, CandidatePtr) +ZS_DECLARE_PROXY_METHOD(onICEGathererError, IICEGathererPtr, ErrorEventPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IICEGathererDelegate, ortc::IICEGathererSubscription) @@ -321,9 +321,9 @@ ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICEGatherer::States, States) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICEGathererDelegate::CandidatePtr, CandidatePtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICEGathererDelegate::CandidateCompletePtr, CandidateCompletePtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICEGathererTypes::ErrorEventPtr, ErrorEventPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICEGathererStateChange, IICEGathererPtr, States) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICEGathererLocalCandidate, IICEGathererPtr, CandidatePtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICEGathererLocalCandidateComplete, IICEGathererPtr, CandidateCompletePtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICEGathererLocalCandidateGone, IICEGathererPtr, CandidatePtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICEGathererError, IICEGathererPtr, ErrorEventPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICEGathererStateChange, IICEGathererPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICEGathererLocalCandidate, IICEGathererPtr, CandidatePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICEGathererLocalCandidateComplete, IICEGathererPtr, CandidateCompletePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICEGathererLocalCandidateGone, IICEGathererPtr, CandidatePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICEGathererError, IICEGathererPtr, ErrorEventPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IICETransport.h b/ortc/IICETransport.h index 412253eb..19ef55f3 100644 --- a/ortc/IICETransport.h +++ b/ortc/IICETransport.h @@ -41,19 +41,19 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes - #pragma mark + // + // IICETransportTypes + // interaction IICETransportTypes : public IICETypes { - ZS_DECLARE_STRUCT_PTR(CandidatePair) - ZS_DECLARE_STRUCT_PTR(Options) + ZS_DECLARE_STRUCT_PTR(CandidatePair); + ZS_DECLARE_STRUCT_PTR(Options); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes::States - #pragma mark + // + // IICETransportTypes::States + // enum States { @@ -70,47 +70,47 @@ namespace ortc State_Last = State_Closed, }; - static const char *toString(States state); - static States toState(const char *state) throw (InvalidParameters); + static const char *toString(States state) noexcept; + static States toState(const char *state) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes::States - #pragma mark + // + // IICETransportTypes::States + // struct CandidatePair { CandidatePtr mLocal; CandidatePtr mRemote; - CandidatePair() {} - CandidatePair(const CandidatePair &op2); - CandidatePair(ElementPtr elem); + CandidatePair() noexcept {} + CandidatePair(const CandidatePair &op2) noexcept; + CandidatePair(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "candidatePair") const; + ElementPtr createElement(const char *objectName = "candidatePair") const noexcept; - ElementPtr toDebug() const; - String hash(bool includePriorities = true) const; + ElementPtr toDebug() const noexcept; + String hash(bool includePriorities = true) const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes::Options - #pragma mark + // + // IICETransportTypes::Options + // struct Options { bool mAggressiveICE {false}; IICETypes::Roles mRole {IICETypes::Role_Controlled}; - Options() {} - Options(const Options &op2) {(*this) = op2;} - Options(ElementPtr elem); + Options() noexcept {} + Options(const Options &op2) noexcept {(*this) = op2;} + Options(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -118,70 +118,70 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransport - #pragma mark + // + // IICETransport + // interaction IICETransport : public IICETransportTypes, public IRTCPTransport, public IStatsProvider { - static ElementPtr toDebug(IICETransportPtr transport); + static ElementPtr toDebug(IICETransportPtr transport) noexcept; - static IICETransportPtr convert(IRTCPTransportPtr object); + static IICETransportPtr convert(IRTCPTransportPtr object) noexcept; static IICETransportPtr create( IICETransportDelegatePtr delegate, IICEGathererPtr gatherer = IICEGathererPtr() // option to specify a gatherer - ); + ) noexcept(false); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) = 0; + virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) noexcept = 0; - virtual IICEGathererPtr iceGatherer() const = 0; + virtual IICEGathererPtr iceGatherer() const noexcept = 0; - virtual Roles role() const = 0; - virtual Components component() const = 0; - virtual States state() const = 0; + virtual Roles role() const noexcept = 0; + virtual Components component() const noexcept = 0; + virtual States state() const noexcept = 0; - virtual CandidateListPtr getRemoteCandidates() const = 0; + virtual CandidateListPtr getRemoteCandidates() const noexcept = 0; - virtual CandidatePairPtr getSelectedCandidatePair() const = 0; + virtual CandidatePairPtr getSelectedCandidatePair() const noexcept = 0; virtual void start( IICEGathererPtr gatherer, const Parameters &remoteParameters, Optional options = Optional() - ) throw (InvalidParameters) = 0; + ) noexcept(false) = 0; // throws InvalidParameters - virtual void stop() = 0; + virtual void stop() noexcept = 0; - virtual ParametersPtr getRemoteParameters() const = 0; + virtual ParametersPtr getRemoteParameters() const noexcept = 0; - virtual IICETransportPtr createAssociatedTransport(IICETransportDelegatePtr delegate) throw (InvalidStateError) = 0; + virtual IICETransportPtr createAssociatedTransport(IICETransportDelegatePtr delegate) noexcept(false) = 0; // throws InvalidStateError - virtual void addRemoteCandidate(const GatherCandidate &remoteCandidate) throw (InvalidStateError, InvalidParameters) = 0; - virtual void setRemoteCandidates(const CandidateList &remoteCandidates) throw (InvalidStateError, InvalidParameters) = 0; - virtual void removeRemoteCandidate(const GatherCandidate &remoteCandidate) throw (InvalidStateError, InvalidParameters) = 0; + virtual void addRemoteCandidate(const GatherCandidate &remoteCandidate) noexcept(false) = 0; // throws InvalidStateError, InvalidParameters + virtual void setRemoteCandidates(const CandidateList &remoteCandidates) noexcept(false) = 0; // throws InvalidStateError, InvalidParameters + virtual void removeRemoteCandidate(const GatherCandidate &remoteCandidate) noexcept(false) = 0; // throws InvalidStateError, InvalidParameters virtual void keepWarm( const CandidatePair &candidatePair, bool keepWarm = true - ) throw (InvalidStateError) = 0; + ) noexcept(false) = 0; // throws InvalidStateError }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportDelegate - #pragma mark + // + // IICETransportDelegate + // interaction IICETransportDelegate { - ZS_DECLARE_TYPEDEF_PTR(IICETransportTypes::CandidatePair, CandidatePair) + ZS_DECLARE_TYPEDEF_PTR(IICETransportTypes::CandidatePair, CandidatePair); virtual void onICETransportStateChange( IICETransportPtr transport, @@ -207,17 +207,17 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportSubscription - #pragma mark + // + // IICETransportSubscription + // interaction IICETransportSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } @@ -225,18 +225,18 @@ ZS_DECLARE_PROXY_BEGIN(ortc::IICETransportDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICETransportPtr, IICETransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICETransport::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICETransport::CandidatePairPtr, CandidatePairPtr) -ZS_DECLARE_PROXY_METHOD_2(onICETransportStateChange, IICETransportPtr, States) -ZS_DECLARE_PROXY_METHOD_2(onICETransportCandidatePairAvailable, IICETransportPtr, CandidatePairPtr) -ZS_DECLARE_PROXY_METHOD_2(onICETransportCandidatePairGone, IICETransportPtr, CandidatePairPtr) -ZS_DECLARE_PROXY_METHOD_2(onICETransportCandidatePairChanged, IICETransportPtr, CandidatePairPtr) +ZS_DECLARE_PROXY_METHOD(onICETransportStateChange, IICETransportPtr, States) +ZS_DECLARE_PROXY_METHOD(onICETransportCandidatePairAvailable, IICETransportPtr, CandidatePairPtr) +ZS_DECLARE_PROXY_METHOD(onICETransportCandidatePairGone, IICETransportPtr, CandidatePairPtr) +ZS_DECLARE_PROXY_METHOD(onICETransportCandidatePairChanged, IICETransportPtr, CandidatePairPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IICETransportDelegate, ortc::IICETransportSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICETransportPtr, IICETransportPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICETransport::States, States) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IICETransport::CandidatePairPtr, CandidatePairPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICETransportStateChange, IICETransportPtr, States) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICETransportCandidatePairAvailable, IICETransportPtr, CandidatePairPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICETransportCandidatePairGone, IICETransportPtr, CandidatePairPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onICETransportCandidatePairChanged, IICETransportPtr, CandidatePairPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICETransportStateChange, IICETransportPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICETransportCandidatePairAvailable, IICETransportPtr, CandidatePairPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICETransportCandidatePairGone, IICETransportPtr, CandidatePairPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onICETransportCandidatePairChanged, IICETransportPtr, CandidatePairPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IICETransportController.h b/ortc/IICETransportController.h index d48ad62f..0a460004 100644 --- a/ortc/IICETransportController.h +++ b/ortc/IICETransportController.h @@ -42,39 +42,36 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportControllerTypes - #pragma mark + // + // IICETransportControllerTypes + // interaction IICETransportControllerTypes : public IICETypes { - ZS_DECLARE_TYPEDEF_PTR(std::list, ICETransportList) + ZS_DECLARE_TYPEDEF_PTR(std::list, ICETransportList); }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportController - #pragma mark + // + // IICETransportController + // interaction IICETransportController : public IICETransportControllerTypes, public IStatsProvider { - static ElementPtr toDebug(IICETransportControllerPtr controller); + static ElementPtr toDebug(IICETransportControllerPtr controller) noexcept; - static IICETransportControllerPtr create(); + static IICETransportControllerPtr create() noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ICETransportList getTransports() const = 0; + virtual ICETransportList getTransports() const noexcept = 0; virtual void addTransport( IICETransportPtr transport, Optional index = Optional() - ) throw( - InvalidParameters, - InvalidStateError - ) = 0; + ) noexcept(false) = 0; // throws InvalidParameters, InvalidStateError }; } diff --git a/ortc/IICETypes.h b/ortc/IICETypes.h index bcc3c634..01df008a 100644 --- a/ortc/IICETypes.h +++ b/ortc/IICETypes.h @@ -39,22 +39,22 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes - #pragma mark + // + // IICETypes + // interaction IICETypes { - ZS_DECLARE_STRUCT_PTR(GatherCandidate) - ZS_DECLARE_STRUCT_PTR(Candidate) - ZS_DECLARE_STRUCT_PTR(CandidateComplete) - ZS_DECLARE_TYPEDEF_PTR(std::list, CandidateList) - ZS_DECLARE_STRUCT_PTR(Parameters) + ZS_DECLARE_STRUCT_PTR(GatherCandidate); + ZS_DECLARE_STRUCT_PTR(Candidate); + ZS_DECLARE_STRUCT_PTR(CandidateComplete); + ZS_DECLARE_TYPEDEF_PTR(std::list, CandidateList); + ZS_DECLARE_STRUCT_PTR(Parameters); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Roles - #pragma mark + // + // IICETypes::Roles + // enum Roles { @@ -66,13 +66,13 @@ namespace ortc Role_Last = Role_Controlled, }; - static const char *toString(Roles role); - static Roles toRole(const char *role) throw (InvalidParameters); + static const char *toString(Roles role) noexcept; + static Roles toRole(const char *role) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Components - #pragma mark + // + // IICETypes::Components + // enum Components { @@ -84,13 +84,13 @@ namespace ortc Component_Last = Component_RTCP }; - static const char *toString(Components component); - static Components toComponent(const char *component) throw (InvalidParameters); + static const char *toString(Components component) noexcept; + static Components toComponent(const char *component) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Protocols - #pragma mark + // + // IICETypes::Protocols + // enum Protocols { @@ -102,13 +102,13 @@ namespace ortc Protocol_Last = Protocol_TCP }; - static const char *toString(Protocols protocol); - static Protocols toProtocol(const char *protocol) throw (InvalidParameters); + static const char *toString(Protocols protocol) noexcept; + static Protocols toProtocol(const char *protocol) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::CandidateTypes - #pragma mark + // + // IICETypes::CandidateTypes + // enum CandidateTypes { @@ -122,13 +122,13 @@ namespace ortc CandidateType_Last = CandidateType_Relay }; - static const char *toString(CandidateTypes type); - static CandidateTypes toCandidateType(const char *type) throw (InvalidParameters); + static const char *toString(CandidateTypes type) noexcept; + static CandidateTypes toCandidateType(const char *type) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::TCPCandidateTypes - #pragma mark + // + // IICETypes::TCPCandidateTypes + // enum TCPCandidateTypes { @@ -141,31 +141,31 @@ namespace ortc TCPCandidateType_Last = TCPCandidateType_SO }; - static const char *toString(TCPCandidateTypes type); - static TCPCandidateTypes toTCPCandidateType(const char *type) throw (InvalidParameters); + static const char *toString(TCPCandidateTypes type) noexcept; + static TCPCandidateTypes toTCPCandidateType(const char *type) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- struct GatherCandidate { Components mComponent {Component_RTP}; - static GatherCandidatePtr create(ElementPtr elem); + static GatherCandidatePtr create(ElementPtr elem) noexcept; - virtual ElementPtr createElement(const char *objectName = NULL) const = 0; + virtual ElementPtr createElement(const char *objectName = NULL) const noexcept = 0; - virtual ~GatherCandidate() {} // make polymorphic + virtual ~GatherCandidate() noexcept {} // make polymorphic protected: - GatherCandidate() {} - GatherCandidate(const GatherCandidate &op2) : + GatherCandidate() noexcept {} + GatherCandidate(const GatherCandidate &op2) noexcept : mComponent(op2.mComponent) {} }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Components - #pragma mark + // + // IICETypes::Components + // struct Candidate : public GatherCandidate { String mInterfaceType; @@ -180,49 +180,50 @@ namespace ortc String mRelatedAddress; WORD mRelatedPort {}; - static CandidatePtr convert(GatherCandidatePtr candidate); + static CandidatePtr convert(GatherCandidatePtr candidate) noexcept; - Candidate() {} - Candidate(const Candidate &op2) {(*this) = op2;} - Candidate(ElementPtr elem); + Candidate() noexcept; + Candidate(const Candidate &op2) noexcept; + Candidate(ElementPtr elem) noexcept; + ~Candidate() noexcept; - virtual ElementPtr createElement(const char *objectName = "candidate") const; + ElementPtr createElement(const char *objectName = "candidate") const noexcept override; - ElementPtr toDebug() const; - String hash(bool includePriorities = true) const; + ElementPtr toDebug() const noexcept; + String hash(bool includePriorities = true) const noexcept; - IPAddress ip() const; - IPAddress relatedIP() const; + IPAddress ip() const noexcept; + IPAddress relatedIP() const noexcept; String foundation( const char *relatedServerURL = NULL, const char *baseIP = NULL - ) const; + ) const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Components - #pragma mark + // + // IICETypes::Components + // struct CandidateComplete : public GatherCandidate { bool mComplete {true}; - static CandidateCompletePtr convert(GatherCandidatePtr candidate); + static CandidateCompletePtr convert(GatherCandidatePtr candidate) noexcept; - CandidateComplete() {} - CandidateComplete(const CandidateComplete &op2) {(*this) = op2;} - CandidateComplete(ElementPtr elem); + CandidateComplete() noexcept {} + CandidateComplete(const CandidateComplete &op2) noexcept {(*this) = op2;} + CandidateComplete(ElementPtr elem) noexcept; - virtual ElementPtr createElement(const char *objectName = "candidateComplete") const; + ElementPtr createElement(const char *objectName = "candidateComplete") const noexcept override; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Parameters - #pragma mark + // + // IICETypes::Parameters + // struct Parameters { bool mUseUnfreezePriority {false}; @@ -230,15 +231,15 @@ namespace ortc String mPassword; bool mICELite {false}; - Parameters() {} - Parameters(const Parameters &op2) {(*this) = op2;} - Parameters(ElementPtr rootEl); + Parameters() noexcept {} + Parameters(const Parameters &op2) noexcept {(*this) = op2;} + Parameters(ElementPtr rootEl) noexcept; - static ParametersPtr create(ElementPtr rootEl) { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName) const; + static ParametersPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; } diff --git a/ortc/IIdentity.h b/ortc/IIdentity.h index bc4e2ce2..f58f13a4 100644 --- a/ortc/IIdentity.h +++ b/ortc/IIdentity.h @@ -39,25 +39,25 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes - #pragma mark + // + // IIdentityTypes + // interaction IIdentityTypes { - ZS_DECLARE_STRUCT_PTR(Assertion) - ZS_DECLARE_STRUCT_PTR(Result) - ZS_DECLARE_STRUCT_PTR(Error) + ZS_DECLARE_STRUCT_PTR(Assertion); + ZS_DECLARE_STRUCT_PTR(Result); + ZS_DECLARE_STRUCT_PTR(Error); typedef PromiseWith PromiseWithResult; - ZS_DECLARE_PTR(PromiseWithResult) + ZS_DECLARE_PTR(PromiseWithResult); - ZS_DECLARE_TYPEDEF_PTR(PromiseWith, PromiseWithAssertion) + ZS_DECLARE_TYPEDEF_PTR(PromiseWith, PromiseWithAssertion); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes::Assertion - #pragma mark + // + // IIdentityTypes::Assertion + // struct Assertion { String mIDP; @@ -65,27 +65,27 @@ namespace ortc }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes::Result - #pragma mark + // + // IIdentityTypes::Result + // struct Result : public Any { String mAssertion; - static ResultPtr convert(AnyPtr any); + static ResultPtr convert(AnyPtr any) noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes::Error - #pragma mark + // + // IIdentityTypes::Error + // struct Error : public Any { String mIDP; String mProtocol; String mLoginURL; - static ErrorPtr convert(AnyPtr any); + static ErrorPtr convert(AnyPtr any) noexcept; }; }; @@ -93,28 +93,28 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentity - #pragma mark + // + // IIdentity + // interaction IIdentity : public IIdentityTypes { - static ElementPtr toDebug(IIdentityPtr channel); + static ElementPtr toDebug(IIdentityPtr channel) noexcept; - static IIdentityPtr create(IDTLSTransportPtr transport); + static IIdentityPtr create(IDTLSTransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual AssertionPtr peerIdentity() const = 0; + virtual AssertionPtr peerIdentity() const noexcept = 0; - virtual IDTLSTransportPtr transport() const = 0; + virtual IDTLSTransportPtr transport() const noexcept = 0; virtual PromiseWithResultPtr getIdentityAssertion( const char *provider, - const char *protoocl = "default", + const char *protocol = "default", const char *username = NULL - ) throw (InvalidStateError) = 0; + ) noexcept(false) = 0; // throws InvalidStateError - virtual PromiseWithAssertionPtr setIdentityAssertion(const String &assertion) = 0; + virtual PromiseWithAssertionPtr setIdentityAssertion(const String &assertion) noexcept = 0; }; } diff --git a/ortc/IMediaDevices.h b/ortc/IMediaDevices.h index 84635d3d..05e64c34 100644 --- a/ortc/IMediaDevices.h +++ b/ortc/IMediaDevices.h @@ -42,19 +42,29 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices - #pragma mark + // + // IMediaDevices + // interaction IMediaDevicesTypes : public IMediaStreamTrackTypes { - ZS_DECLARE_STRUCT_PTR(SupportedConstraints) - ZS_DECLARE_STRUCT_PTR(Device) - ZS_DECLARE_STRUCT_PTR(DeviceList) - ZS_DECLARE_STRUCT_PTR(MediaStreamTrackList) + ZS_DECLARE_STRUCT_PTR(SupportedConstraints); + ZS_DECLARE_STRUCT_PTR(Device); + ZS_DECLARE_STRUCT_PTR(DeviceList); + ZS_DECLARE_STRUCT_PTR(MediaStreamTrackList); - ZS_DECLARE_TYPEDEF_PTR(PromiseWith, PromiseWithMediaStreamTrackList) - ZS_DECLARE_TYPEDEF_PTR(PromiseWith, PromiseWithDeviceList) + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, Settings); + + struct SettingsList : public std::list, + public Any + { + }; + + ZS_DECLARE_PTR(SettingsList); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith, PromiseWithMediaStreamTrackList); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith, PromiseWithDeviceList); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith, PromiseWithSettingsList); enum DeviceKinds { @@ -67,12 +77,12 @@ namespace ortc DeviceKind_Last = DeviceKind_VideoInput, }; - static const char *toString(DeviceKinds kind); - static DeviceKinds toDeviceKind(const char *deviceKindStr); - static Kinds toKind(DeviceKinds kind); + static const char *toString(DeviceKinds kind) noexcept; + static DeviceKinds toDeviceKind(const char *deviceKindStr) noexcept(false); // throws InvalidParameters + static Kinds toKind(DeviceKinds kind) noexcept; - static bool isAudio(DeviceKinds kind); - static bool isVideo(DeviceKinds kind); + static bool isAudio(DeviceKinds kind) noexcept; + static bool isVideo(DeviceKinds kind) noexcept; struct SupportedConstraints { @@ -86,26 +96,28 @@ namespace ortc bool mSampleSize {false}; bool mEchoCancellation {false}; bool mLatency {false}; + bool mChannelCount {false}; bool mDeviceID {false}; bool mGroupID {false}; - SupportedConstraints() {} - SupportedConstraints(const SupportedConstraints &op2) {(*this) = op2;} - SupportedConstraints(ElementPtr elem); + SupportedConstraints() noexcept {} + SupportedConstraints(const SupportedConstraints &op2) noexcept {(*this) = op2;} + SupportedConstraints(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices::Device - #pragma mark + // + // IMediaDevices::Device + // - struct Device { - DeviceKinds mKind {DeviceKind_First}; + struct Device + { + DeviceKinds mKind {DeviceKind_First}; String mLabel; String mDeviceID; @@ -113,48 +125,48 @@ namespace ortc SupportedConstraints mSupportedConstraints; - Device() {} - Device(const Device &op2) {(*this) = op2;} - Device(ElementPtr elem); + Device() noexcept {} + Device(const Device &op2) noexcept {(*this) = op2;} + Device(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "device") const; + ElementPtr createElement(const char *objectName = "device") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices::MediaStreamTrackList - #pragma mark + // + // IMediaDevices::MediaStreamTrackList + // struct MediaStreamTrackList : public std::list, public Any { - static MediaStreamTrackListPtr convert(AnyPtr any); + static MediaStreamTrackListPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices::DeviceList - #pragma mark + // + // IMediaDevices::DeviceList + // struct DeviceList : public std::list, public Any { - static DeviceListPtr convert(AnyPtr any); + static DeviceListPtr convert(AnyPtr any) noexcept; - DeviceList() {} - DeviceList(const DeviceList &op2) {(*this) = op2;} - DeviceList(ElementPtr elem); + DeviceList() noexcept {} + DeviceList(const DeviceList &op2) noexcept {(*this) = op2;} + DeviceList(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "devices") const; + ElementPtr createElement(const char *objectName = "devices") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -162,32 +174,33 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices - #pragma mark + // + // IMediaDevices + // interaction IMediaDevices : public IMediaDevicesTypes { - static ElementPtr toDebug(); + static ElementPtr toDebug() noexcept; - static SupportedConstraintsPtr getSupportedConstraints(); + static SupportedConstraintsPtr getSupportedConstraints() noexcept; - static PromiseWithDeviceListPtr enumerateDevices(); + static PromiseWithDeviceListPtr enumerateDevices() noexcept; + static PromiseWithSettingsListPtr enumerateDefaultModes(const char *deviceID) noexcept; - static PromiseWithMediaStreamTrackListPtr getUserMedia(const Constraints &constraints = Constraints()); + static PromiseWithMediaStreamTrackListPtr getUserMedia(const Constraints &constraints = Constraints()) noexcept; - static IMediaDevicesSubscriptionPtr subscribe(IMediaDevicesDelegatePtr delegate); + static IMediaDevicesSubscriptionPtr subscribe(IMediaDevicesDelegatePtr delegate) noexcept; - virtual ~IMediaDevices() {} // make polymorphic + virtual ~IMediaDevices() noexcept {} // make polymorphic }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesDelegate - #pragma mark + // + // IMediaDevicesDelegate + // interaction IMediaDevicesDelegate { @@ -198,25 +211,25 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesSubscription - #pragma mark + // + // IMediaDevicesSubscription + // interaction IMediaDevicesSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } ZS_DECLARE_PROXY_BEGIN(ortc::IMediaDevicesDelegate) -ZS_DECLARE_PROXY_METHOD_0(onMediaDevicesChanged) +ZS_DECLARE_PROXY_METHOD(onMediaDevicesChanged) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IMediaDevicesDelegate, ortc::IMediaDevicesSubscription) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_0(onMediaDevicesChanged) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaDevicesChanged) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IMediaElement.h b/ortc/IMediaElement.h new file mode 100644 index 00000000..e2b85c9b --- /dev/null +++ b/ortc/IMediaElement.h @@ -0,0 +1,162 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include + +namespace ortc +{ + ZS_DECLARE_INTERACTION_PTR(IWindowSink); + ZS_DECLARE_INTERACTION_PTR(IMediaElementTypes); + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IWindowSink + // + + interaction IWindowSink + { +#ifdef _WIN32 +#ifdef __cplusplus_winrt + static IMediaElementPtr create() noexcept; +#else + static IMediaElementPtr create(HWND hwnd) noexcept; +#endif // __cplusplus_winrt +#else + static IMediaElementPtr create(void *window) noexcept; +#endif // _WIN32 + + virtual PUID getID() const noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaElementTypes + // + + interaction IMediaElementTypes + { + typedef std::list MediaStreamTrackList; + typedef IMediaStreamTrackTypes::Kinds Kinds; + typedef IMediaStreamTrackTypes::States States; + + struct MediaSink + { + String mAudioSinkID; + IWindowSinkPtr mVideoSinkWindow; + }; + + virtual ~IMediaElementTypes() noexcept {} + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrack + // + + interaction IMediaElement : public Any, + public IMediaElementTypes + { + static ElementPtr toDebug(IMediaElementPtr object) noexcept; + + static IMediaElementPtr convert(AnyPtr any) noexcept; + + static IMediaElementPtr create(MediaSink sink) noexcept; + + virtual PUID getID() const noexcept = 0; + + virtual IMediaStreamTrackSubscriptionPtr subscribe(IMediaElementDelegatePtr delegate) noexcept = 0; + + virtual String sinkID() const noexcept = 0; // unique audio device ID delivering audio output + virtual IWindowSinkPtr sinkWindow() const noexcept = 0; // window where media is being delivered + + virtual bool muted() const noexcept = 0; + virtual void muted(bool muted) noexcept = 0; + virtual bool paused() const noexcept = 0; + virtual void paused(bool paused) noexcept = 0; + virtual States readyState() const noexcept = 0; + + virtual void stop() noexcept = 0; + + virtual MediaStreamTrackList audioTracks() noexcept = 0; + virtual MediaStreamTrackList videoTracks() noexcept = 0; + + virtual PromisePtr attach(IMediaStreamTrackPtr track) noexcept = 0; + virtual void detach(IMediaStreamTrackPtr track) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaElementDelegate + // + + interaction IMediaElementDelegate + { + virtual ~IMediaElementDelegate() noexcept {} + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaElementSubscription + // + + interaction IMediaElementSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; +} + +ZS_DECLARE_PROXY_BEGIN(ortc::IMediaElementDelegate) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IMediaElementDelegate, ortc::IMediaElementSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IMediaStreamTrack.h b/ortc/IMediaStreamTrack.h index 0e94f1d6..3c2cc552 100644 --- a/ortc/IMediaStreamTrack.h +++ b/ortc/IMediaStreamTrack.h @@ -34,42 +34,48 @@ #include #include #include +#include #include +#include + namespace ortc { //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackCallback - #pragma mark - - interaction IMediaStreamTrackRenderCallback - { - virtual ~IMediaStreamTrackRenderCallback() {} - }; - - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes - #pragma mark + // + // IMediaStreamTrackTypes + // interaction IMediaStreamTrackTypes : public ICapabilities, public IConstraints { + typedef PUID MediaChannelID; + typedef std::list MediaChannelIDList; + typedef std::set MediaChannelIDSet; + ZS_DECLARE_STRUCT_PTR(Capabilities); ZS_DECLARE_STRUCT_PTR(Settings); + ZS_DECLARE_TYPEDEF_PTR(Settings, ImmutableSettings); ZS_DECLARE_STRUCT_PTR(ConstraintSet); ZS_DECLARE_STRUCT_PTR(TrackConstraints); ZS_DECLARE_STRUCT_PTR(Constraints); ZS_DECLARE_STRUCT_PTR(OverconstrainedError); + ZS_DECLARE_STRUCT_PTR(MediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(MediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_STRUCT_PTR(Frame); + ZS_DECLARE_STRUCT_PTR(AudioFrame); + ZS_DECLARE_STRUCT_PTR(VideoFrame); + + ZS_DECLARE_PTR(MediaChannelIDList); + ZS_DECLARE_PTR(MediaChannelIDSet); + ZS_DECLARE_TYPEDEF_PTR(std::list, ConstraintSetList); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::ImmutableParameters, ImmutableParameters); enum Kinds { @@ -81,13 +87,13 @@ namespace ortc Kind_Last = Kind_Video, }; - static const char *toString(Kinds kind); - static Kinds toKind(const char *kind); + static const char *toString(Kinds kind) noexcept; + static Kinds toKind(const char *kind) noexcept(false); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::States - #pragma mark + // + // IMediaStreamTrackTypes::States + // enum States { @@ -99,13 +105,34 @@ namespace ortc State_Last = State_Ended, }; - static const char *toString(States state); - static States toState(const char *state); + static const char *toString(States state) noexcept; + static States toState(const char *state) noexcept(false); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::Capabilities - #pragma mark + // + // IMediaStreamTrackTypes::MediaActivityStates + // + + enum MediaActivityStates + { + MediaActivityState_First, + + MediaActivityState_Muted = MediaActivityState_First, + MediaActivityState_Inactive, // media source is not active + MediaActivityState_ActiveButUnknown, // media source is active but the active speaker state is unknown + MediaActivityState_Background, // the media is identified as being background (e.g. background noise, and no active speaker) + MediaActivityState_Active, // the media is identified as containing activity (e.g. active speaker / active face detected) + + MediaActivityState_Last = MediaActivityState_Active, + }; + + static const char *toString(MediaActivityStates state) noexcept; + static MediaActivityStates toMediaActivityState(const char *state) noexcept; + + //------------------------------------------------------------------------- + // + // IMediaStreamTrackTypes::Capabilities + // struct Capabilities : Any { Optional mWidth; @@ -124,24 +151,26 @@ namespace ortc String mDeviceID; String mGroupID; - Capabilities() {} - Capabilities(const Capabilities &op2) {(*this) = op2;} - Capabilities(ElementPtr elem); + Optional mEncodingFormat; + + Capabilities() noexcept {} + Capabilities(const Capabilities &op2) noexcept {(*this) = op2;} + Capabilities(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "capabilities") const; + ElementPtr createElement(const char *objectName = "capabilities") const noexcept; - static CapabilitiesPtr create(); - static CapabilitiesPtr create(const CapabilitiesPtr &value); - static CapabilitiesPtr create(const Capabilities &value); - static CapabilitiesPtr convert(AnyPtr any); - ElementPtr toDebug() const; - String hash() const; + static CapabilitiesPtr create() noexcept; + static CapabilitiesPtr create(const CapabilitiesPtr &value) noexcept; + static CapabilitiesPtr create(const Capabilities &value) noexcept; + static CapabilitiesPtr convert(AnyPtr any) noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::Settings - #pragma mark + // + // IMediaStreamTrackTypes::Settings + // struct Settings : Any { Optional mWidth; @@ -158,25 +187,26 @@ namespace ortc Optional mChannelCount; Optional mDeviceID; Optional mGroupID; + Optional mEncodingFormat; - Settings() {} - Settings(const Settings &op2) {(*this) = op2;} - Settings(ElementPtr elem); + Settings() noexcept {} + Settings(const Settings &op2) noexcept {(*this) = op2;} + Settings(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "settings") const; + ElementPtr createElement(const char *objectName = "settings") const noexcept; - static SettingsPtr create(); - static SettingsPtr create(const SettingsPtr &value); - static SettingsPtr create(const Settings &value); - static SettingsPtr convert(AnyPtr any); - ElementPtr toDebug() const; - String hash() const; + static SettingsPtr create() noexcept; + static SettingsPtr create(const SettingsPtr &value) noexcept; + static SettingsPtr create(const Settings &value) noexcept; + static SettingsPtr convert(AnyPtr any) noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::ConstraintSet - #pragma mark + // + // IMediaStreamTrackTypes::ConstraintSet + // struct ConstraintSet { ConstrainLong mWidth; @@ -193,127 +223,237 @@ namespace ortc ConstrainLong mChannelCount; ConstrainString mDeviceID; ConstrainString mGroupID; + ConstrainString mEncodingFormat; - ConstraintSet() {} - ConstraintSet(const ConstraintSet &op2) {(*this) = op2;} - ConstraintSet(ElementPtr elem); + ConstraintSet() noexcept {} + ConstraintSet(const ConstraintSet &op2) noexcept {(*this) = op2;} + ConstraintSet(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "constraintSet") const; + ElementPtr createElement(const char *objectName = "constraintSet") const noexcept; - static ConstraintSetPtr create(); - static ConstraintSetPtr create(const ConstraintSetPtr &value); - static ConstraintSetPtr create(const ConstraintSet &value); - ElementPtr toDebug() const; - String hash() const; + static ConstraintSetPtr create() noexcept; + static ConstraintSetPtr create(const ConstraintSetPtr &value) noexcept; + static ConstraintSetPtr create(const ConstraintSet &value) noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::TrackConstraints - #pragma mark + // + // IMediaStreamTrackTypes::TrackConstraints + // struct TrackConstraints : public ConstraintSet { ConstraintSetList mAdvanced; - TrackConstraints() {} - TrackConstraints(const TrackConstraints &op2) {(*this) = op2;} - TrackConstraints(ElementPtr elem); + TrackConstraints() noexcept {} + TrackConstraints(const TrackConstraints &op2) noexcept {(*this) = op2;} + TrackConstraints(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "trackConstraints") const; + ElementPtr createElement(const char *objectName = "trackConstraints") const noexcept; - static TrackConstraintsPtr create(); - static TrackConstraintsPtr create(const TrackConstraintsPtr &value); - static TrackConstraintsPtr create(const TrackConstraints &value); - ElementPtr toDebug() const; - String hash() const; + static TrackConstraintsPtr create() noexcept; + static TrackConstraintsPtr create(const TrackConstraintsPtr &value) noexcept; + static TrackConstraintsPtr create(const TrackConstraints &value) noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::Constraints - #pragma mark + // + // IMediaStreamTrackTypes::Constraints + // struct Constraints { TrackConstraintsPtr mVideo; TrackConstraintsPtr mAudio; - Constraints() {} - Constraints(const Constraints &op2) {(*this) = op2;} - Constraints(ElementPtr elem); + Constraints() noexcept {} + Constraints(const Constraints &op2) noexcept {(*this) = op2;} + Constraints(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "constraints") const; + ElementPtr createElement(const char *objectName = "constraints") const noexcept; - static ConstraintsPtr create(); - static ConstraintsPtr create(const ConstraintsPtr &value); - static ConstraintsPtr create(const Constraints &value); - ElementPtr toDebug() const; - String hash() const; + static ConstraintsPtr create() noexcept; + static ConstraintsPtr create(const ConstraintsPtr &value) noexcept; + static ConstraintsPtr create(const Constraints &value) noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; + //------------------------------------------------------------------------- + // + // IMediaStreamTrackTypes::OverconstrainedError + // + struct OverconstrainedError : public Any { String mName; String mConstraint; String mMessage; - OverconstrainedError() : mName("OverconstrainedError") {} - OverconstrainedError(const OverconstrainedError &op2) { *this = (op2); } + OverconstrainedError() noexcept : mName("OverconstrainedError") {} + OverconstrainedError(const OverconstrainedError &op2) noexcept { *this = (op2); } }; + //------------------------------------------------------------------------- + // + // IMediaStreamTrackTypes::MediaChannelTrace + // + + struct MediaChannelTrace + { + MediaChannelTrace(MediaChannelID mediaChannelID) noexcept { mMediaChannelIDTracked.push_back(mediaChannelID); mMediaChannelIDs.insert(mediaChannelID); } + MediaChannelTrace( + const ImmutableMediaChannelTrace &op2, + MediaChannelID mediaChannelID = 0 + ) noexcept : + mMediaChannelIDTracked(op2.mMediaChannelIDTracked), + mMediaChannelIDs(op2.mMediaChannelIDs), + mKind(op2.mKind), + mSettings(op2.mSettings), + mParameters(op2.mParameters) + { if (0 == mediaChannelID) return; mMediaChannelIDTracked.push_back(mediaChannelID); mMediaChannelIDs.insert(mediaChannelID); } + + static MediaChannelTracePtr create(MediaChannelID mediaChannelID) noexcept { return make_shared(mediaChannelID); } + static MediaChannelTracePtr create( + const MediaChannelTrace &op2, + MediaChannelID mediaChannelID = 0 + ) noexcept { return make_shared(op2, mediaChannelID); } + + bool hasChannel(MediaChannelID mediaChannelID) const noexcept { auto found = mMediaChannelIDs.find(mediaChannelID); return found != mMediaChannelIDs.end(); } + + PUID id() const noexcept { return mID; } + Kinds kind() const noexcept { return mKind; } + ImmutableSettingsPtr settings() const noexcept { return mSettings; } + ImmutableParametersPtr parameters() const noexcept { return mParameters; } + MediaChannelID frontMediaChannelID() const noexcept { return mMediaChannelIDTracked.front(); } + MediaChannelID endMediaChannelID() const noexcept { return mMediaChannelIDTracked.back(); } + MediaChannelIDList::const_iterator begin() const noexcept { return mMediaChannelIDTracked.begin(); } + MediaChannelIDList::const_iterator end() const noexcept { return mMediaChannelIDTracked.end(); } + + public: + zsLib::AutoPUID mID; + MediaChannelIDList mMediaChannelIDTracked; + MediaChannelIDSet mMediaChannelIDs; + Kinds mKind {Kind_First}; + ImmutableSettingsPtr mSettings; + ImmutableParametersPtr mParameters; + }; + + //------------------------------------------------------------------------- + // + // IMediaStreamTrackTypes::Frame + // + + struct Frame : public Any + { + virtual Kinds getKind() const noexcept = 0; + + virtual MediaActivityStates getMediaActivityState() const noexcept = 0; + virtual uint64_t getTimestamp() const noexcept = 0; // get the timestamp relative to the clock/sample rate + virtual Milliseconds getNTPTime() const noexcept = 0; // get the NTP time + virtual Time getTime() const noexcept = 0; // get the absolute time + + virtual const BYTE *getData() const noexcept = 0; // get the pointer to the raw buffer + virtual size_t getDataSize() const noexcept = 0; // get the number of bytes contained within the raw buffer + }; + + //------------------------------------------------------------------------- + // + // IMediaStreamTrackTypes::AudioFrame + // + + struct AudioFrame : public Frame + { + Kinds getKind() const noexcept override { return Kind_Audio; } + }; + + //------------------------------------------------------------------------- + // + // IMediaStreamTrackTypes::VideoFrame + // + + struct VideoFrame : public Frame + { + enum DataFormats + { + DataFormat_NativeTexture, + DataFormat_Packed, + + DataFormat_Y, + DataFormat_U, + DataFormat_V, + }; + + Kinds getKind() const noexcept override { return Kind_Video; } + + // returns true of available otherwise false + virtual bool getEncodedData( + DataFormats encodedDataFormat, + const void * &outData, // set to NULL if not available + size_t &outDataSizeIfKnown // set to 0 if not available + ) noexcept = 0; // get the pointer to the raw buffer + }; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrack - #pragma mark + // + // IMediaStreamTrack + // interaction IMediaStreamTrack : public Any, public IMediaStreamTrackTypes, public IStatsProvider { - static ElementPtr toDebug(IMediaStreamTrackPtr object); + static IMediaStreamTrackPtr convert(AnyPtr any) noexcept; - static IMediaStreamTrackPtr convert(AnyPtr any); + virtual MediaChannelID getID() const noexcept = 0; - virtual PUID getID() const = 0; + virtual void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept = 0; - virtual IMediaStreamTrackSubscriptionPtr subscribe(IMediaStreamTrackDelegatePtr delegate) = 0; + virtual IMediaStreamTrackSubscriptionPtr subscribe(IMediaStreamTrackDelegatePtr delegate) noexcept = 0; - virtual Kinds kind() const = 0; - virtual String id() const = 0; - virtual String deviceID() const = 0; // created based om which original media device ID (only applicable if created from a device) - virtual String label() const = 0; - virtual bool enabled() const = 0; - virtual void enabled(bool enabled) = 0; - virtual bool muted() const = 0; - virtual void muted(bool muted) = 0; - virtual bool remote() const = 0; - virtual States readyState() const = 0; + virtual Kinds kind() const noexcept = 0; + virtual String id() const noexcept = 0; + virtual String deviceID() const noexcept = 0; // created based om which original media device ID (only applicable if created from a device) + virtual String label() const noexcept = 0; + virtual bool enabled() const noexcept = 0; + virtual void enabled(bool enabled) noexcept = 0; + virtual bool muted() const noexcept = 0; + virtual void muted(bool muted) noexcept = 0; + virtual bool remote() const noexcept = 0; + virtual States readyState() const noexcept = 0; - virtual IMediaStreamTrackPtr clone() const = 0; + virtual IMediaStreamTrackPtr clone() const noexcept = 0; - virtual void stop() = 0; + virtual void stop() noexcept = 0; - virtual CapabilitiesPtr getCapabilities() const = 0; - virtual TrackConstraintsPtr getConstraints() const = 0; - virtual SettingsPtr getSettings() const = 0; + virtual CapabilitiesPtr getCapabilities() const noexcept = 0; + virtual TrackConstraintsPtr getConstraints() const noexcept = 0; + virtual SettingsPtr getSettings() const noexcept = 0; - virtual PromisePtr applyConstraints(const TrackConstraints &constraints) = 0; + virtual PromisePtr applyConstraints(const TrackConstraints &constraints) noexcept = 0; - virtual void setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) = 0; - virtual void setH264Rendering(bool h264Rendering) = 0; - virtual bool isH264Rendering() = 0; + virtual IMediaStreamTrackMediaSubscriptionPtr subscribeMedia(IMediaStreamTrackSyncMediaDelegatePtr delegate) noexcept = 0; + + // WARNING: extreme caution must be done not to cause a deadlock or delaying media by blocking. Gather information + // needed within a lock but do any operations outside a lock as fast as possible. + virtual IMediaStreamTrackMediaSubscriptionPtr subscribeMedia(IMediaStreamTrackAsyncMediaDelegatePtr delegate) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackDelegate - #pragma mark + // + // IMediaStreamTrackDelegate + // interaction IMediaStreamTrackDelegate { @@ -335,32 +475,150 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackSubscription - #pragma mark + // + // IMediaStreamTrackSubscription + // interaction IMediaStreamTrackSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackSyncMediaDelegate + // + + interaction IMediaStreamTrackSyncMediaDelegate : public IMediaStreamTrackDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void notifyMediaStreamTrackMediaAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyMediaStreamTrackMediaVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackAsyncMediaDelegate + // + + interaction IMediaStreamTrackAsyncMediaDelegate : public IMediaStreamTrackDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void onMediaStreamTrackMediaAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) = 0; + virtual void onMediaStreamTrackMediaVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMediaSubscription + // + + interaction IMediaStreamTrackMediaSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; }; } ZS_DECLARE_PROXY_BEGIN(ortc::IMediaStreamTrackDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) -ZS_DECLARE_PROXY_METHOD_2(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) -ZS_DECLARE_PROXY_METHOD_1(onMediaStreamTrackEnded, IMediaStreamTrackPtr) -ZS_DECLARE_PROXY_METHOD_2(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IMediaStreamTrackDelegate, ortc::IMediaStreamTrackSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_1(onMediaStreamTrackEnded, IMediaStreamTrackPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() + +ZS_DECLARE_PROXY_BEGIN(ortc::IMediaStreamTrackAsyncMediaDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMediaAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMediaVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IMediaStreamTrackAsyncMediaDelegate, ortc::IMediaStreamTrackMediaSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMediaAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMediaVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() + +ZS_DECLARE_PROXY_BEGIN(ortc::IMediaStreamTrackSyncMediaDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyMediaStreamTrackMediaAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyMediaStreamTrackMediaVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IMediaStreamTrackSyncMediaDelegate, ortc::IMediaStreamTrackMediaSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyMediaStreamTrackMediaAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyMediaStreamTrackMediaVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() + diff --git a/ortc/IMediaStreamTrackSelector.h b/ortc/IMediaStreamTrackSelector.h new file mode 100644 index 00000000..ac9f5904 --- /dev/null +++ b/ortc/IMediaStreamTrackSelector.h @@ -0,0 +1,138 @@ +/* + + Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include + +namespace ortc +{ + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackSelectorTypes + // + + interaction IMediaStreamTrackSelectorTypes + { + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + typedef IMediaStreamTrackTypes::Kinds Kinds; + ZS_DECLARE_TYPEDEF_PTR(std::list, MediaStreamTrackList); + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackSelector + // + + interaction IMediaStreamTrackSelector : public Any, + public IMediaStreamTrackSelectorTypes, + public IStatsProvider + { + static IMediaStreamTrackSelectorPtr convert(AnyPtr any) noexcept; + + static IMediaStreamTrackSelectorPtr create( + Kinds kind, + size_t totalOutputMediaStreamTracks = 1, + IMediaStreamTrackSelectorDelegatePtr delegate = IMediaStreamTrackSelectorDelegatePtr() + ) noexcept; + + virtual PUID getID() const noexcept = 0; + + virtual IMediaStreamTrackSelectorSubscriptionPtr subscribe(IMediaStreamTrackSelectorDelegatePtr delegate) noexcept = 0; + + virtual Kinds kind() const noexcept = 0; + virtual IMediaStreamTrackPtr getOutputTrack(size_t index) const noexcept = 0; + virtual MediaStreamTrackList getInputTracks() const noexcept = 0; + + virtual PromisePtr attachInputTrack( + IMediaStreamTrackPtr inputTrack, + IMediaStreamTrackPtr useThisTrackToDetermineMediaActivityState // use this track to detect media activity + ) noexcept(false); // throws InvalidParameters + virtual void detachInputTrack(IMediaStreamTrackPtr track) noexcept; + + virtual void stop() noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackSelectorDelegate + // + + interaction IMediaStreamTrackSelectorDelegate + { + virtual ~IMediaStreamTrackSelectorDelegate() noexcept {} + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackSelectorSubscription + // + + interaction IMediaStreamTrackSelectorSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; +} + +ZS_DECLARE_PROXY_BEGIN(ortc::IMediaStreamTrackSelectorDelegate) +//ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +//ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +//ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +//ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +//ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IMediaStreamTrackSelectorDelegate, ortc::IMediaStreamTrackSelectorSubscription) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IORTC.h b/ortc/IORTC.h index 18cd8556..9a8e54b1 100644 --- a/ortc/IORTC.h +++ b/ortc/IORTC.h @@ -39,35 +39,40 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IORTC - #pragma mark + // + // IORTC + // interaction IORTC { typedef zsLib::Log Log; - static void setup(IMessageQueuePtr defaultDelegateMessageQueue); -#ifdef WINRT - static void setup(Windows::UI::Core::CoreDispatcher ^dispatcher); -#endif //WINRT + static void setup(IMessageQueuePtr defaultDelegateMessageQueue) noexcept; +#ifdef WINUWP +#ifdef __cplusplus_winrt + static void setup(Windows::UI::Core::CoreDispatcher ^ dispatcher) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + static void setup(winrt::Windows::UI::Core::CoreDispatcher dispatcher) noexcept; +#endif //CPPWINRT_VERSION +#endif //WINUWP - static Milliseconds ntpServerTime(); - static void ntpServerTime(const Milliseconds &value); + static Milliseconds ntpServerTime() noexcept; + static void ntpServerTime(const Milliseconds &value) noexcept; - static void setDefaultLogLevel(Log::Level level); - static void setLogLevel(const char *componenet, Log::Level level); + static void setDefaultLogLevel(Log::Level level) noexcept; + static void setLogLevel(const char *componenet, Log::Level level) noexcept; - static void setDefaultEventingLevel(Log::Level level); - static void setEventingLevel(const char *componenet, Log::Level level); + static void setDefaultEventingLevel(Log::Level level) noexcept; + static void setEventingLevel(const char *componenet, Log::Level level) noexcept; - static void startMediaTracing(); - static void stopMediaTracing(); - static bool isMediaTracing(); - static bool saveMediaTrace(String filename); - static bool saveMediaTrace(String host, int port); - static bool isMRPInstalled(); + static void startMediaTracing() noexcept; + static void stopMediaTracing() noexcept; + static bool isMediaTracing() noexcept; + static bool saveMediaTrace(String filename) noexcept; + static bool saveMediaTrace(String host, int port) noexcept; + static bool isMRPInstalled() noexcept; - virtual ~IORTC() {} // make polymorphic + virtual ~IORTC() noexcept {} // make polymorphic }; } diff --git a/ortc/IRTPListener.h b/ortc/IRTPListener.h index cd187f35..1de6969f 100644 --- a/ortc/IRTPListener.h +++ b/ortc/IRTPListener.h @@ -41,9 +41,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerTypes - #pragma mark + // + // IRTPListenerTypes + // interaction IRTPListenerTypes : public IRTPTypes { @@ -53,26 +53,26 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListener - #pragma mark + // + // IRTPListener + // interaction IRTPListener : public IRTPListenerTypes, public IStatsProvider { - static ElementPtr toDebug(IRTPListenerPtr listener); + static ElementPtr toDebug(IRTPListenerPtr listener) noexcept; static IRTPListenerPtr create( IRTPListenerDelegatePtr delegate, IRTPTransportPtr transport, Optional headerExtensions = Optional() - ); + ) noexcept(false); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr delegate) = 0; + virtual IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr delegate) noexcept = 0; - virtual IRTPTransportPtr transport() const = 0; + virtual IRTPTransportPtr transport() const noexcept = 0; //------------------------------------------------------------------------- // PURPOSE: (re-)set a mapping between a local indentifiers present in the @@ -81,16 +81,16 @@ namespace ortc // THROWS: InvalidParameters - if any RTPReceiver has already mapped this // local identifier mapped to an another // header URI definition - virtual void setHeaderExtensions(const HeaderExtensionParametersList &headerExtensions) = 0; + virtual void setHeaderExtensions(const HeaderExtensionParametersList &headerExtensions) noexcept(false) = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerDelegate - #pragma mark + // + // IRTPListenerDelegate + // interaction IRTPListenerDelegate { @@ -110,17 +110,17 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerSubscription - #pragma mark + // + // IRTPListenerSubscription + // interaction IRTPListenerSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } @@ -128,12 +128,12 @@ ZS_DECLARE_PROXY_BEGIN(ortc::IRTPListenerDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPListenerPtr, IRTPListenerPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPListenerDelegate::SSRCType, SSRCType) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPListenerDelegate::PayloadType, PayloadType) -ZS_DECLARE_PROXY_METHOD_5(onRTPListenerUnhandledRTP, IRTPListenerPtr, SSRCType, PayloadType, const char *, const char *) +ZS_DECLARE_PROXY_METHOD(onRTPListenerUnhandledRTP, IRTPListenerPtr, SSRCType, PayloadType, const char *, const char *) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IRTPListenerDelegate, ortc::IRTPListenerSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IRTPListenerPtr, IRTPListenerPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IRTPListenerDelegate::SSRCType, SSRCType) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IRTPListenerDelegate::PayloadType, PayloadType) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_5(onRTPListenerUnhandledRTP, IRTPListenerPtr, SSRCType, PayloadType, const char *, const char *) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onRTPListenerUnhandledRTP, IRTPListenerPtr, SSRCType, PayloadType, const char *, const char *) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IRTPReceiver.h b/ortc/IRTPReceiver.h index 790f8789..8b99425d 100644 --- a/ortc/IRTPReceiver.h +++ b/ortc/IRTPReceiver.h @@ -44,22 +44,22 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverTypes - #pragma mark + // + // IRTPReceiverTypes + // interaction IRTPReceiverTypes : public IRTPTypes { typedef IMediaStreamTrack::Kinds Kinds; - ZS_DECLARE_STRUCT_PTR(ContributingSource) + ZS_DECLARE_STRUCT_PTR(ContributingSource); - ZS_DECLARE_TYPEDEF_PTR(std::list, ContributingSourceList) + ZS_DECLARE_TYPEDEF_PTR(std::list, ContributingSourceList); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverTypes::ContributingSource - #pragma mark + // + // IRTPReceiverTypes::ContributingSource + // struct ContributingSource { Time mTimestamp {}; @@ -67,8 +67,8 @@ namespace ortc BYTE mAudioLevel {}; Optional mVoiceActivityFlag {}; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -76,73 +76,73 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiver - #pragma mark + // + // IRTPReceiver + // interaction IRTPReceiver : public IRTPReceiverTypes, public IStatsProvider { - static ElementPtr toDebug(IRTPReceiverPtr receiver); + static ElementPtr toDebug(IRTPReceiverPtr receiver) noexcept; static IRTPReceiverPtr create( IRTPReceiverDelegatePtr delegate, Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IRTPReceiverSubscriptionPtr subscribe(IRTPReceiverDelegatePtr delegate) = 0; + virtual IRTPReceiverSubscriptionPtr subscribe(IRTPReceiverDelegatePtr delegate) noexcept = 0; - virtual IMediaStreamTrackPtr track() const = 0; - virtual IRTPTransportPtr transport() const = 0; - virtual IRTCPTransportPtr rtcpTransport() const = 0; + virtual IMediaStreamTrackPtr track() const noexcept = 0; + virtual IRTPTransportPtr transport() const noexcept = 0; + virtual IRTCPTransportPtr rtcpTransport() const noexcept = 0; virtual void setTransport( IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ) = 0; + ) noexcept(false) = 0; // throws InvalidParameters - static CapabilitiesPtr getCapabilities(Optional kind = Optional()); + static CapabilitiesPtr getCapabilities(Optional kind = Optional()) noexcept; - virtual PromisePtr receive(const Parameters ¶meters) = 0; - virtual void stop() = 0; + virtual PromisePtr receive(const Parameters ¶meters) noexcept(false) = 0; // throws InvalidParameters + virtual void stop() noexcept = 0; - virtual ContributingSourceList getContributingSources() const = 0; + virtual ContributingSourceList getContributingSources() const noexcept = 0; - virtual void requestSendCSRC(SSRCType csrc) = 0; + virtual void requestSendCSRC(SSRCType csrc) noexcept(false) = 0; // throws NotImplemented }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverDelegate - #pragma mark + // + // IRTPReceiverDelegate + // interaction IRTPReceiverDelegate { - virtual ~IRTPReceiverDelegate() {} + virtual ~IRTPReceiverDelegate() noexcept {} }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverSubscription - #pragma mark + // + // IRTPReceiverSubscription + // interaction IRTPReceiverSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } diff --git a/ortc/IRTPSender.h b/ortc/IRTPSender.h index c608f15a..d17999e1 100644 --- a/ortc/IRTPSender.h +++ b/ortc/IRTPSender.h @@ -42,9 +42,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderTypes - #pragma mark + // + // IRTPSenderTypes + // interaction IRTPSenderTypes : public IRTPTypes { @@ -54,7 +54,7 @@ namespace ortc struct IncompatibleMediaStreamTrackError : public Any { - static IncompatibleMediaStreamTrackErrorPtr convert(AnyPtr any); + static IncompatibleMediaStreamTrackErrorPtr convert(AnyPtr any) noexcept; }; }; @@ -62,55 +62,55 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSender - #pragma mark + // + // IRTPSender + // interaction IRTPSender : public Any, public IRTPSenderTypes, public IStatsProvider { - static ElementPtr toDebug(IRTPSenderPtr sender); + static ElementPtr toDebug(IRTPSenderPtr sender) noexcept; static IRTPSenderPtr create( IRTPSenderDelegatePtr delegate, IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IRTPSenderSubscriptionPtr subscribe(IRTPSenderDelegatePtr delegate) = 0; + virtual IRTPSenderSubscriptionPtr subscribe(IRTPSenderDelegatePtr delegate) noexcept = 0; - virtual IMediaStreamTrackPtr track() const = 0; - virtual IRTPTransportPtr transport() const = 0; - virtual IRTCPTransportPtr rtcpTransport() const = 0; + virtual IMediaStreamTrackPtr track() const noexcept = 0; + virtual IRTPTransportPtr transport() const noexcept = 0; + virtual IRTCPTransportPtr rtcpTransport() const noexcept = 0; virtual void setTransport( IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ) = 0; + ) noexcept(false) = 0; // throws InvalidParameters - virtual PromisePtr setTrack(IMediaStreamTrackPtr track) = 0; + virtual PromisePtr setTrack(IMediaStreamTrackPtr track) noexcept = 0; - static CapabilitiesPtr getCapabilities(Optional kind = Optional()); + static CapabilitiesPtr getCapabilities(Optional kind = Optional()) noexcept; - virtual PromisePtr send(const Parameters ¶meters) = 0; - virtual void stop() = 0; + virtual PromisePtr send(const Parameters ¶meters) noexcept(false) = 0; // throws InvalidParameters + virtual void stop() noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderDelegate - #pragma mark + // + // IRTPSenderDelegate + // interaction IRTPSenderDelegate { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::SSRCType, SSRCType) + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::SSRCType, SSRCType); virtual void onRTPSenderSSRCConflict( IRTPSenderPtr sender, @@ -122,17 +122,17 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderSubscription - #pragma mark + // + // IRTPSenderSubscription + // interaction IRTPSenderSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } @@ -140,11 +140,11 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::IRTPSenderDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPSenderPtr, IRTPSenderPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPSenderDelegate::SSRCType, SSRCType) -ZS_DECLARE_PROXY_METHOD_2(onRTPSenderSSRCConflict, IRTPSenderPtr, SSRCType) +ZS_DECLARE_PROXY_METHOD(onRTPSenderSSRCConflict, IRTPSenderPtr, SSRCType) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::IRTPSenderDelegate, ortc::IRTPSenderSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IRTPSenderPtr, IRTPSenderPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IRTPSenderDelegate::SSRCType, SSRCType) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onRTPSenderSSRCConflict, IRTPSenderPtr, SSRCType) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onRTPSenderSSRCConflict, IRTPSenderPtr, SSRCType) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IRTPTypes.h b/ortc/IRTPTypes.h index 29779aae..528e05b9 100644 --- a/ortc/IRTPTypes.h +++ b/ortc/IRTPTypes.h @@ -42,56 +42,57 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes - #pragma mark + // + // IRTPTypes + // interaction IRTPTypes { - ZS_DECLARE_STRUCT_PTR(Capabilities) - ZS_DECLARE_STRUCT_PTR(CodecCapability) - ZS_DECLARE_STRUCT_PTR(OpusCodecCapabilityOptions) - ZS_DECLARE_STRUCT_PTR(OpusCodecCapabilityParameters) - ZS_DECLARE_STRUCT_PTR(VP8CodecCapabilityParameters) - ZS_DECLARE_STRUCT_PTR(H264CodecCapabilityParameters) - ZS_DECLARE_STRUCT_PTR(RTXCodecCapabilityParameters) - ZS_DECLARE_STRUCT_PTR(FlexFECCodecCapabilityParameters) - ZS_DECLARE_STRUCT_PTR(HeaderExtension) - ZS_DECLARE_STRUCT_PTR(RTCPFeedback) - ZS_DECLARE_STRUCT_PTR(Parameters) - ZS_DECLARE_STRUCT_PTR(CodecParameters) - ZS_DECLARE_STRUCT_PTR(OpusCodecParameters) - ZS_DECLARE_TYPEDEF_PTR(VP8CodecCapabilityParameters, VP8CodecParameters) - ZS_DECLARE_TYPEDEF_PTR(H264CodecCapabilityParameters, H264CodecParameters) - ZS_DECLARE_TYPEDEF_PTR(RTXCodecCapabilityParameters, RTXCodecParameters) - ZS_DECLARE_TYPEDEF_PTR(FlexFECCodecCapabilityParameters, FlexFECCodecParameters) - ZS_DECLARE_STRUCT_PTR(REDCodecParameters) - ZS_DECLARE_STRUCT_PTR(HeaderExtensionParameters) - ZS_DECLARE_STRUCT_PTR(EncodingParameters) - ZS_DECLARE_STRUCT_PTR(RTCPParameters) - ZS_DECLARE_STRUCT_PTR(FECParameters) - ZS_DECLARE_STRUCT_PTR(RTXParameters) - - ZS_DECLARE_TYPEDEF_PTR(std::list, CodecCapabilitiesList) - ZS_DECLARE_TYPEDEF_PTR(std::list, HeaderExtensionsList) - ZS_DECLARE_TYPEDEF_PTR(std::list, RTCPFeedbackList) - ZS_DECLARE_TYPEDEF_PTR(std::list, CodecParametersList) - ZS_DECLARE_TYPEDEF_PTR(std::list, HeaderExtensionParametersList) - ZS_DECLARE_TYPEDEF_PTR(std::list, EncodingParametersList) + ZS_DECLARE_STRUCT_PTR(Capabilities); + ZS_DECLARE_STRUCT_PTR(CodecCapability); + ZS_DECLARE_STRUCT_PTR(OpusCodecCapabilityOptions); + ZS_DECLARE_STRUCT_PTR(OpusCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(VP8CodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(H264CodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTXCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(FlexFECCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(HeaderExtension); + ZS_DECLARE_STRUCT_PTR(RTCPFeedback); + ZS_DECLARE_STRUCT_PTR(Parameters); + ZS_DECLARE_TYPEDEF_PTR(Parameters, ImmutableParameters); + ZS_DECLARE_STRUCT_PTR(CodecParameters); + ZS_DECLARE_STRUCT_PTR(OpusCodecParameters); + ZS_DECLARE_TYPEDEF_PTR(VP8CodecCapabilityParameters, VP8CodecParameters); + ZS_DECLARE_TYPEDEF_PTR(H264CodecCapabilityParameters, H264CodecParameters); + ZS_DECLARE_TYPEDEF_PTR(RTXCodecCapabilityParameters, RTXCodecParameters); + ZS_DECLARE_TYPEDEF_PTR(FlexFECCodecCapabilityParameters, FlexFECCodecParameters); + ZS_DECLARE_STRUCT_PTR(REDCodecParameters); + ZS_DECLARE_STRUCT_PTR(HeaderExtensionParameters); + ZS_DECLARE_STRUCT_PTR(EncodingParameters); + ZS_DECLARE_STRUCT_PTR(RTCPParameters); + ZS_DECLARE_STRUCT_PTR(FECParameters); + ZS_DECLARE_STRUCT_PTR(RTXParameters); + + ZS_DECLARE_TYPEDEF_PTR(std::list, CodecCapabilitiesList); + ZS_DECLARE_TYPEDEF_PTR(std::list, HeaderExtensionsList); + ZS_DECLARE_TYPEDEF_PTR(std::list, RTCPFeedbackList); + ZS_DECLARE_TYPEDEF_PTR(std::list, CodecParametersList); + ZS_DECLARE_TYPEDEF_PTR(std::list, HeaderExtensionParametersList); + ZS_DECLARE_TYPEDEF_PTR(std::list, EncodingParametersList); typedef String FECMechanism; - ZS_DECLARE_TYPEDEF_PTR(std::list, FECMechanismList) + ZS_DECLARE_TYPEDEF_PTR(std::list, FECMechanismList); typedef BYTE PayloadType; typedef DWORD SSRCType; - ZS_DECLARE_TYPEDEF_PTR(std::list, PayloadTypeList) + ZS_DECLARE_TYPEDEF_PTR(std::list, PayloadTypeList); typedef String EncodingID; - ZS_DECLARE_TYPEDEF_PTR(std::list, EncodingIDList) + ZS_DECLARE_TYPEDEF_PTR(std::list, EncodingIDList); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::DegradationPreference - #pragma mark + // + // IRTPTypes::DegradationPreference + // enum DegradationPreferences { DegradationPreference_First, @@ -103,34 +104,34 @@ namespace ortc DegradationPreference_Last = DegradationPreference_Balanced, }; - static const char *toString(DegradationPreferences preference); - static DegradationPreferences toDegredationPreference(const char *preference) throw (InvalidParameters); + static const char *toString(DegradationPreferences preference) noexcept; + static DegradationPreferences toDegredationPreference(const char *preference) noexcept(false); // throws InvalidParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::Capabilities - #pragma mark + // + // IRTPTypes::Capabilities + // struct Capabilities { CodecCapabilitiesList mCodecs; HeaderExtensionsList mHeaderExtensions; FECMechanismList mFECMechanisms; - Capabilities() {} - Capabilities(const Capabilities &op2) {(*this) = op2;} - Capabilities(ElementPtr rootEl); + Capabilities() noexcept {} + Capabilities(const Capabilities &op2) noexcept {(*this) = op2;} + Capabilities(ElementPtr rootEl) noexcept; - static CapabilitiesPtr create(ElementPtr rootEl) { if (!rootEl) return CapabilitiesPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "capabilities") const; + static CapabilitiesPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return CapabilitiesPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "capabilities") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::CodecCapability - #pragma mark + // + // IRTPTypes::CodecCapability + // struct CodecCapability { String mName; @@ -147,22 +148,24 @@ namespace ortc USHORT mMaxSpatialLayers {0}; bool mSVCMultiStreamSupport {}; - CodecCapability() {}; - CodecCapability(const CodecCapability &source); - CodecCapability(ElementPtr elem); + CodecCapability() noexcept {}; + CodecCapability(const CodecCapability &source) noexcept; + CodecCapability(ElementPtr elem) noexcept; + CodecCapability &operator=(const CodecCapability &op2) noexcept; - CodecCapability &operator=(const CodecCapability &op2) = delete; + ElementPtr createElement(const char *objectName = "codecCapability") const noexcept; - ElementPtr createElement(const char *objectName = "codecCapability") const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; - ElementPtr toDebug() const; - String hash() const; + protected: + void copyAny(const CodecCapability &source) noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::OpusCodecCapabilityOptions - #pragma mark + // + // IRTPTypes::OpusCodecCapabilityOptions + // struct OpusCodecCapabilityOptions : public Any { @@ -175,8 +178,8 @@ namespace ortc Signal_Last = Signal_Voice }; - static const char *toString(Signals signal); - static Signals toSignal(const char *signal); + static const char *toString(Signals signal) noexcept; + static Signals toSignal(const char *signal) noexcept(false); enum Applications { Application_First, @@ -187,8 +190,8 @@ namespace ortc Application_Last = Application_LowDelay }; - static const char *toString(Applications application); - static Applications toApplication(const char *application); + static const char *toString(Applications application) noexcept; + static Applications toApplication(const char *application) noexcept(false); // sender capabilities Optional mComplexity; @@ -197,23 +200,23 @@ namespace ortc Optional mPacketLossPerc; Optional mPredictionDisabled; - OpusCodecCapabilityOptions() {} - OpusCodecCapabilityOptions(const OpusCodecCapabilityOptions &op2) {(*this) = op2;} - OpusCodecCapabilityOptions(ElementPtr elem); + OpusCodecCapabilityOptions() noexcept {} + OpusCodecCapabilityOptions(const OpusCodecCapabilityOptions &op2) noexcept {(*this) = op2;} + OpusCodecCapabilityOptions(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "codecCapability") const; + ElementPtr createElement(const char *objectName = "codecCapability") const noexcept; - static OpusCodecCapabilityOptionsPtr create(const OpusCodecCapabilityOptions &capability); - static OpusCodecCapabilityOptionsPtr convert(AnyPtr any); + static OpusCodecCapabilityOptionsPtr create(const OpusCodecCapabilityOptions &capability) noexcept; + static OpusCodecCapabilityOptionsPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::OpusCodecCapabilityParameters - #pragma mark + // + // IRTPTypes::OpusCodecCapabilityParameters + // // https://tools.ietf.org/html/rfc7587#section-6.1 struct OpusCodecCapabilityParameters : public Any @@ -230,23 +233,23 @@ namespace ortc Optional mSPropMaxCaptureRate; Optional mSPropStereo; - OpusCodecCapabilityParameters() {} - OpusCodecCapabilityParameters(const OpusCodecCapabilityParameters &op2) {(*this) = op2;} - OpusCodecCapabilityParameters(ElementPtr elem); + OpusCodecCapabilityParameters() noexcept {} + OpusCodecCapabilityParameters(const OpusCodecCapabilityParameters &op2) noexcept {(*this) = op2;} + OpusCodecCapabilityParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "opusCodecCapabilityParameters") const; + ElementPtr createElement(const char *objectName = "opusCodecCapabilityParameters") const noexcept; - static OpusCodecCapabilityParametersPtr create(const OpusCodecCapabilityParameters &capability); - static OpusCodecCapabilityParametersPtr convert(AnyPtr any); + static OpusCodecCapabilityParametersPtr create(const OpusCodecCapabilityParameters &capability) noexcept; + static OpusCodecCapabilityParametersPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::VP8CodecCapabilityParameters - #pragma mark + // + // IRTPTypes::VP8CodecCapabilityParameters + // // https://tools.ietf.org/html/rfc7741#section-6.1 struct VP8CodecCapabilityParameters : public Any @@ -254,23 +257,23 @@ namespace ortc Optional mMaxFR; Optional mMaxFS; - VP8CodecCapabilityParameters() {} - VP8CodecCapabilityParameters(const VP8CodecCapabilityParameters &op2) {(*this) = op2;} - VP8CodecCapabilityParameters(ElementPtr elem); + VP8CodecCapabilityParameters() noexcept {} + VP8CodecCapabilityParameters(const VP8CodecCapabilityParameters &op2) noexcept {(*this) = op2;} + VP8CodecCapabilityParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "vp8CodecCapabilityParameters") const; + ElementPtr createElement(const char *objectName = "vp8CodecCapabilityParameters") const noexcept; - static VP8CodecCapabilityParametersPtr create(const VP8CodecCapabilityParameters &capability); - static VP8CodecCapabilityParametersPtr convert(AnyPtr any); + static VP8CodecCapabilityParametersPtr create(const VP8CodecCapabilityParameters &capability) noexcept; + static VP8CodecCapabilityParametersPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::H264CodecCapabilityParameters - #pragma mark + // + // IRTPTypes::H264CodecCapabilityParameters + // // https://tools.ietf.org/html/rfc7742#section-6.2 struct H264CodecCapabilityParameters : public Any @@ -287,23 +290,23 @@ namespace ortc Optional mMaxDPB {}; Optional mMaxBR {}; - H264CodecCapabilityParameters() {} - H264CodecCapabilityParameters(const H264CodecCapabilityParameters &op2) {(*this) = op2;} - H264CodecCapabilityParameters(ElementPtr elem); + H264CodecCapabilityParameters() noexcept {} + H264CodecCapabilityParameters(const H264CodecCapabilityParameters &op2) noexcept {(*this) = op2;} + H264CodecCapabilityParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "h264CodecCapabilityParameters") const; + ElementPtr createElement(const char *objectName = "h264CodecCapabilityParameters") const noexcept; - static H264CodecCapabilityParametersPtr create(const H264CodecCapabilityParameters &capability); - static H264CodecCapabilityParametersPtr convert(AnyPtr any); + static H264CodecCapabilityParametersPtr create(const H264CodecCapabilityParameters &capability) noexcept; + static H264CodecCapabilityParametersPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTXCodecCapabilityParameters - #pragma mark + // + // IRTPTypes::RTXCodecCapabilityParameters + // // https://tools.ietf.org/html/rfc4588#section-8.1 struct RTXCodecCapabilityParameters : public Any @@ -311,23 +314,23 @@ namespace ortc PayloadType mApt {}; Milliseconds mRTXTime {}; - static RTXCodecCapabilityParametersPtr create(const RTXCodecCapabilityParameters ¶ms); - static RTXCodecCapabilityParametersPtr convert(AnyPtr any); + static RTXCodecCapabilityParametersPtr create(const RTXCodecCapabilityParameters ¶ms) noexcept; + static RTXCodecCapabilityParametersPtr convert(AnyPtr any) noexcept; - RTXCodecCapabilityParameters() {} - RTXCodecCapabilityParameters(const RTXCodecParameters &op2) {(*this) = op2;} - RTXCodecCapabilityParameters(ElementPtr elem); + RTXCodecCapabilityParameters() noexcept {} + RTXCodecCapabilityParameters(const RTXCodecParameters &op2) noexcept {(*this) = op2;} + RTXCodecCapabilityParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "rtxCodecCapabilityParameters") const; + ElementPtr createElement(const char *objectName = "rtxCodecCapabilityParameters") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::FlexFECCodecCapabilityParameters - #pragma mark + // + // IRTPTypes::FlexFECCodecCapabilityParameters + // // https://tools.ietf.org/html/draft-ietf-payload-flexible-fec-scheme-02 struct FlexFECCodecCapabilityParameters : public Any @@ -342,9 +345,9 @@ namespace ortc ToP_Last = ToP_Reserved, }; - static const char *toString(ToPs top); - static ToPs toToP(const char *top); - static ToPs toToP(ULONG value); + static const char *toString(ToPs top) noexcept; + static ToPs toToP(const char *top) noexcept; + static ToPs toToP(ULONG value) noexcept(false); Microseconds mRepairWindow {}; @@ -352,23 +355,23 @@ namespace ortc Optional mD; Optional mToP; - FlexFECCodecCapabilityParameters() {} - FlexFECCodecCapabilityParameters(const FlexFECCodecCapabilityParameters &op2) {(*this) = op2;} - FlexFECCodecCapabilityParameters(ElementPtr elem); + FlexFECCodecCapabilityParameters() noexcept {} + FlexFECCodecCapabilityParameters(const FlexFECCodecCapabilityParameters &op2) noexcept {(*this) = op2;} + FlexFECCodecCapabilityParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "flexFecCodecParameters") const; + ElementPtr createElement(const char *objectName = "flexFecCodecParameters") const noexcept; - static FlexFECCodecCapabilityParametersPtr create(const FlexFECCodecCapabilityParameters ¶ms); - static FlexFECCodecCapabilityParametersPtr convert(AnyPtr any); + static FlexFECCodecCapabilityParametersPtr create(const FlexFECCodecCapabilityParameters ¶ms) noexcept; + static FlexFECCodecCapabilityParametersPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::HeaderExtensions - #pragma mark + // + // IRTPTypes::HeaderExtensions + // struct HeaderExtension { String mKind; @@ -376,39 +379,39 @@ namespace ortc USHORT mPreferredID {}; bool mPreferredEncrypt {false}; - HeaderExtension() {} - HeaderExtension(const HeaderExtension &op2) {(*this) = op2;} - HeaderExtension(ElementPtr elem); + HeaderExtension() noexcept {} + HeaderExtension(const HeaderExtension &op2) noexcept {(*this) = op2;} + HeaderExtension(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "headerExtensions") const; + ElementPtr createElement(const char *objectName = "headerExtensions") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTCPFeedback - #pragma mark + // + // IRTPTypes::RTCPFeedback + // struct RTCPFeedback { String mType; String mParameter; - RTCPFeedback() {} - RTCPFeedback(const RTCPFeedback &op2) {(*this) = op2;} - RTCPFeedback(ElementPtr elem); + RTCPFeedback() noexcept {} + RTCPFeedback(const RTCPFeedback &op2) noexcept {(*this) = op2;} + RTCPFeedback(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "rtcpFeedback") const; + ElementPtr createElement(const char *objectName = "rtcpFeedback") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTCPParameters - #pragma mark + // + // IRTPTypes::RTCPParameters + // struct RTCPParameters { SSRCType mSSRC {}; @@ -416,20 +419,20 @@ namespace ortc bool mReducedSize {false}; bool mMux {true}; - RTCPParameters() {} - RTCPParameters(const RTCPParameters &op2) {(*this) = op2;} - RTCPParameters(ElementPtr elem); + RTCPParameters() noexcept {} + RTCPParameters(const RTCPParameters &op2) noexcept {(*this) = op2;} + RTCPParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "rtcpParameters") const; + ElementPtr createElement(const char *objectName = "rtcpParameters") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::Parameters - #pragma mark + // + // IRTPTypes::Parameters + // struct Parameters { String mMuxID; @@ -448,26 +451,26 @@ namespace ortc bool mRTCP {true}; bool mDegredationPreference {true}; - HashOptions() {} + HashOptions() noexcept {} }; - Parameters() {} - Parameters(const Parameters &op2); - Parameters(ElementPtr rootEl); + Parameters() noexcept {} + Parameters(const Parameters &op2) noexcept; + Parameters(ElementPtr rootEl) noexcept; - Parameters &operator=(const Parameters &op2); + Parameters &operator=(const Parameters &op2) noexcept; - static ParametersPtr create(ElementPtr rootEl) { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName) const; + static ParametersPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash(const HashOptions &options = HashOptions()) const; + ElementPtr toDebug() const noexcept; + String hash(const HashOptions &options = HashOptions()) const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::CodecParameters - #pragma mark + // + // IRTPTypes::CodecParameters + // struct CodecParameters { String mName; @@ -479,22 +482,25 @@ namespace ortc RTCPFeedbackList mRTCPFeedback; AnyPtr mParameters; // see OpusCodecParameters, RTXCodecParameters, REDCodecParameters, FlexFECCodecParameters for definitions - CodecParameters() {} - CodecParameters(const CodecParameters &source); - CodecParameters(ElementPtr elem); + CodecParameters() noexcept {} + CodecParameters(const CodecParameters &source) noexcept; + CodecParameters(ElementPtr elem) noexcept; - CodecParameters &operator=(const CodecParameters &op2) = delete; + CodecParameters &operator=(const CodecParameters &op2) noexcept; + + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; - ElementPtr toDebug() const; - String hash() const; + protected: + void copyAny(const CodecParameters &op2) noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::OpusCodecParameters - #pragma mark + // + // IRTPTypes::OpusCodecParameters + // struct OpusCodecParameters : public Any { @@ -519,130 +525,128 @@ namespace ortc Optional mSPropMaxCaptureRate; Optional mSPropStereo; - OpusCodecParameters() {} - OpusCodecParameters(const OpusCodecParameters &op2) {(*this) = op2;} - OpusCodecParameters(ElementPtr elem); + OpusCodecParameters() noexcept {} + OpusCodecParameters(const OpusCodecParameters &op2) noexcept {(*this) = op2;} + OpusCodecParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "opusCodecParameters") const; + ElementPtr createElement(const char *objectName = "opusCodecParameters") const noexcept; - static OpusCodecParametersPtr create(const OpusCodecParameters &capability); - static OpusCodecParametersPtr convert(AnyPtr any); + static OpusCodecParametersPtr create(const OpusCodecParameters &capability) noexcept; + static OpusCodecParametersPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::VP8CodecParameters - #pragma mark + // + // IRTPTypes::VP8CodecParameters + // // see VP8CodecCapabilityParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::H264CodecParameters - #pragma mark + // + // IRTPTypes::H264CodecParameters + // // see H264CodecCapabilityParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTXCodecParameters - #pragma mark + // + // IRTPTypes::RTXCodecParameters + // // see RTXCodecCapabilityParameters //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::REDCodecParameters - #pragma mark + // + // IRTPTypes::REDCodecParameters + // struct REDCodecParameters : public Any { PayloadTypeList mPayloadTypes; - REDCodecParameters() {} - REDCodecParameters(const REDCodecParameters &op2) {(*this) = op2;} - REDCodecParameters(ElementPtr elem); + REDCodecParameters() noexcept {} + REDCodecParameters(const REDCodecParameters &op2) noexcept {(*this) = op2;} + REDCodecParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "redCodecParameters") const; + ElementPtr createElement(const char *objectName = "redCodecParameters") const noexcept; - static REDCodecParametersPtr create(const REDCodecParameters ¶ms); - static REDCodecParametersPtr convert(AnyPtr any); + static REDCodecParametersPtr create(const REDCodecParameters ¶ms) noexcept; + static REDCodecParametersPtr convert(AnyPtr any) noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::HeaderExtensionParameters - #pragma mark + // + // IRTPTypes::HeaderExtensionParameters + // struct HeaderExtensionParameters { String mURI; USHORT mID {}; bool mEncrypt {false}; - HeaderExtensionParameters() {} - HeaderExtensionParameters(const HeaderExtensionParameters &op2) {(*this) = op2;} - HeaderExtensionParameters(ElementPtr elem); + HeaderExtensionParameters() noexcept {} + HeaderExtensionParameters(const HeaderExtensionParameters &op2) noexcept {(*this) = op2;} + HeaderExtensionParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "headerExtensionParameters") const; + ElementPtr createElement(const char *objectName = "headerExtensionParameters") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::FECParameters - #pragma mark + // + // IRTPTypes::FECParameters + // struct FECParameters { Optional mSSRC; String mMechanism; - FECParameters() {} - FECParameters(const FECParameters &op2) {(*this) = op2;} - FECParameters(ElementPtr elem); + FECParameters() noexcept {} + FECParameters(const FECParameters &op2) noexcept {(*this) = op2;} + FECParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "fecParameters") const; + ElementPtr createElement(const char *objectName = "fecParameters") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTXParameters - #pragma mark + // + // IRTPTypes::RTXParameters + // struct RTXParameters { Optional mSSRC; - RTXParameters() {} - RTXParameters(const RTXParameters &op2) {(*this) = op2;} - RTXParameters(ElementPtr elem); + RTXParameters() noexcept {} + RTXParameters(const RTXParameters &op2) noexcept {(*this) = op2;} + RTXParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "rtxParameters") const; + ElementPtr createElement(const char *objectName = "rtxParameters") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::PriorityTypes - #pragma mark + // + // IRTPTypes::PriorityTypes + // enum PriorityTypes { PriorityType_First, - PriorityType_Unknown = PriorityType_First, - - PriorityType_VeryLow, + PriorityType_VeryLow = PriorityType_First, PriorityType_Low, PriorityType_Medium, PriorityType_High, @@ -650,20 +654,20 @@ namespace ortc PriorityType_Last = PriorityType_High, }; - static const char *toString(PriorityTypes type); - static PriorityTypes toPriorityType(const char *type); + static const char *toString(PriorityTypes type) noexcept; + static PriorityTypes toPriorityType(const char *type) noexcept(false); //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::EncodingParameters - #pragma mark + // + // IRTPTypes::EncodingParameters + // struct EncodingParameters { Optional mSSRC {}; Optional mCodecPayloadType; Optional mFEC; Optional mRTX; - PriorityTypes mPriority {PriorityType_Unknown}; + Optional mPriority; Optional mMaxBitrate {}; Optional mMinQuality {0}; Optional mResolutionScale {}; @@ -672,20 +676,20 @@ namespace ortc EncodingID mEncodingID; EncodingIDList mDependencyEncodingIDs; - EncodingParameters() {} - EncodingParameters(const EncodingParameters &op2) {(*this) = op2;} - EncodingParameters(ElementPtr elem); + EncodingParameters() noexcept {} + EncodingParameters(const EncodingParameters &op2) noexcept {(*this) = op2;} + EncodingParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName = "encodingParameters") const; + ElementPtr createElement(const char *objectName = "encodingParameters") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::CodecKinds - #pragma mark + // + // IRTPTypes::CodecKinds + // enum CodecKinds { @@ -707,13 +711,13 @@ namespace ortc CodecKind_Last = CodecKind_FEC, }; - static const char *toString(CodecKinds kind); - static CodecKinds toCodecKind(const char *kind); + static const char *toString(CodecKinds kind) noexcept; + static CodecKinds toCodecKind(const char *kind) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::SupportedCodecs - #pragma mark + // + // IRTPTypes::SupportedCodecs + // enum SupportedCodecs { @@ -749,22 +753,22 @@ namespace ortc SupportedCodec_Last = SupportedCodec_TelephoneEvent }; - static const char *toString(SupportedCodecs codec); - static SupportedCodecs toSupportedCodec(const char *codec); - static bool hasCapabilityOptions(SupportedCodecs codec); - static bool hasCapabilityParameters(SupportedCodecs codec); - static bool hasParameters(SupportedCodecs codec); - static bool requiresCapabilityParameters(SupportedCodecs codec); - static bool requiresParameters(SupportedCodecs codec); + static const char *toString(SupportedCodecs codec) noexcept; + static SupportedCodecs toSupportedCodec(const char *codec) noexcept; + static bool hasCapabilityOptions(SupportedCodecs codec) noexcept; + static bool hasCapabilityParameters(SupportedCodecs codec) noexcept; + static bool hasParameters(SupportedCodecs codec) noexcept; + static bool requiresCapabilityParameters(SupportedCodecs codec) noexcept; + static bool requiresParameters(SupportedCodecs codec) noexcept; - static CodecKinds getCodecKind(SupportedCodecs codec); - static bool isSRSTCodec(SupportedCodecs codec); // Single RTP streams Single Transport - static bool isMRSTCodec(SupportedCodecs codec); // Multiple RTP streams Single Transport + static CodecKinds getCodecKind(SupportedCodecs codec) noexcept; + static bool isSRSTCodec(SupportedCodecs codec) noexcept; // Single RTP streams Single Transport + static bool isMRSTCodec(SupportedCodecs codec) noexcept; // Multiple RTP streams Single Transport //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::SupportedCodecs - #pragma mark + // + // IRTPTypes::SupportedCodecs + // enum ReservedCodecPayloadTypes { @@ -806,20 +810,20 @@ namespace ortc ReservedCodecPayloadType_Last = ReservedCodecPayloadType_H263_90000 }; - static const char *toString(ReservedCodecPayloadTypes reservedCodec); - static ReservedCodecPayloadTypes toReservedCodec(PayloadType pt); - static ReservedCodecPayloadTypes toReservedCodec(const char *encodingName); + static const char *toString(ReservedCodecPayloadTypes reservedCodec) noexcept; + static ReservedCodecPayloadTypes toReservedCodec(PayloadType pt) noexcept; + static ReservedCodecPayloadTypes toReservedCodec(const char *encodingName) noexcept; - static ULONG getDefaultClockRate(ReservedCodecPayloadTypes reservedCodec); - static Optional getDefaultNumberOfChannels(ReservedCodecPayloadTypes reservedCodec); + static ULONG getDefaultClockRate(ReservedCodecPayloadTypes reservedCodec) noexcept; + static Optional getDefaultNumberOfChannels(ReservedCodecPayloadTypes reservedCodec) noexcept; - static CodecKinds getCodecKind(ReservedCodecPayloadTypes reservedCodec); - static SupportedCodecs toSupportedCodec(ReservedCodecPayloadTypes reservedCodec); + static CodecKinds getCodecKind(ReservedCodecPayloadTypes reservedCodec) noexcept; + static SupportedCodecs toSupportedCodec(ReservedCodecPayloadTypes reservedCodec) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::HeaderExtensionURIs - #pragma mark + // + // IRTPTypes::HeaderExtensionURIs + // enum HeaderExtensionURIs { @@ -854,14 +858,14 @@ namespace ortc HeaderExtensionURI_Last = HeaderExtensionURI_TransportSequenceNumber }; - static const char *toString(HeaderExtensionURIs extension); // converts header enum to URN format - static HeaderExtensionURIs toHeaderExtensionURI(const char *uri); - static String toKind(HeaderExtensionURIs extension); // returns "audio", "video" or "" for both + static const char *toString(HeaderExtensionURIs extension) noexcept; // converts header enum to URN format + static HeaderExtensionURIs toHeaderExtensionURI(const char *uri) noexcept; + static String toKind(HeaderExtensionURIs extension) noexcept; // returns "audio", "video" or "" for both //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownFECMechanisms - #pragma mark + // + // IRTPTypes::KnownFECMechanisms + // enum KnownFECMechanisms { @@ -876,13 +880,13 @@ namespace ortc KnownFECMechanism_Last = KnownFECMechanism_FlexFEC, }; - static const char *toString(KnownFECMechanisms mechanism); - static KnownFECMechanisms toKnownFECMechanism(const char *mechanism); + static const char *toString(KnownFECMechanisms mechanism) noexcept; + static KnownFECMechanisms toKnownFECMechanism(const char *mechanism) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownFeedbackTypes - #pragma mark + // + // IRTPTypes::KnownFeedbackTypes + // enum KnownFeedbackTypes { @@ -909,13 +913,13 @@ namespace ortc typedef std::set KnownFeedbackTypesSet; - static const char *toString(KnownFeedbackTypes type); - static KnownFeedbackTypes toKnownFeedbackType(const char *type); + static const char *toString(KnownFeedbackTypes type) noexcept; + static KnownFeedbackTypes toKnownFeedbackType(const char *type) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownFeedbackParameters - #pragma mark + // + // IRTPTypes::KnownFeedbackParameters + // enum KnownFeedbackParameters { @@ -942,15 +946,15 @@ namespace ortc KnownFeedbackParameter_Last = KnownFeedbackParameter_PAUSE, }; - static const char *toString(KnownFeedbackParameters parameter); - static KnownFeedbackParameters toKnownFeedbackParameter(const char *parameter); + static const char *toString(KnownFeedbackParameters parameter) noexcept; + static KnownFeedbackParameters toKnownFeedbackParameter(const char *parameter) noexcept; - static KnownFeedbackTypesSet getUseableWithFeedbackTypes(KnownFeedbackParameters mechanism); + static KnownFeedbackTypesSet getUseableWithFeedbackTypes(KnownFeedbackParameters mechanism) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownRTCP - #pragma mark + // + // IRTPTypes::KnownRTCP + // enum SupportedRTCPMechanisms { @@ -970,7 +974,7 @@ namespace ortc SupportedRTCPMechanism_Last = SupportedRTCPMechanism_PSFB }; - static const char *toString(SupportedRTCPMechanisms mechanism); - static SupportedRTCPMechanisms toSupportedRTCPMechanism(const char *mechanism); + static const char *toString(SupportedRTCPMechanisms mechanism) noexcept; + static SupportedRTCPMechanisms toSupportedRTCPMechanism(const char *mechanism) noexcept; }; } diff --git a/ortc/ISCTPTransport.h b/ortc/ISCTPTransport.h index 1b79964c..a8769182 100644 --- a/ortc/ISCTPTransport.h +++ b/ortc/ISCTPTransport.h @@ -40,9 +40,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportTypes - #pragma mark + // + // ISCTPTransportTypes + // interaction ISCTPTransportTypes { @@ -62,12 +62,12 @@ namespace ortc State_Last = State_Closed, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportTypes::Capabilities - #pragma mark + // + // ISCTPTransportTypes::Capabilities + // struct Capabilities { size_t mMaxMessageSize {}; @@ -76,15 +76,15 @@ namespace ortc WORD mMaxUsablePorts {}; WORD mMaxSessionsPerPort {}; - Capabilities() {} - Capabilities(const Capabilities &op2) {(*this) = op2;} - Capabilities(ElementPtr rootEl); + Capabilities() noexcept {} + Capabilities(const Capabilities &op2) noexcept {(*this) = op2;} + Capabilities(ElementPtr rootEl) noexcept; - static CapabilitiesPtr create(ElementPtr rootEl) { if (!rootEl) return CapabilitiesPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName) const; + static CapabilitiesPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return CapabilitiesPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; // Example set: @@ -169,7 +169,7 @@ namespace ortc Optional mSackInfo; Optional mStatus; - bool hasValue() const; + bool hasValue() const noexcept; }; }; @@ -177,60 +177,60 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransport - #pragma mark + // + // ISCTPTransport + // interaction ISCTPTransport : public ISCTPTransportTypes, public IDataTransport { - static ElementPtr toDebug(ISCTPTransportPtr transport); + static ElementPtr toDebug(ISCTPTransportPtr transport) noexcept; - static ISCTPTransportPtr convert(IDataTransportPtr object); + static ISCTPTransportPtr convert(IDataTransportPtr object) noexcept; static ISCTPTransportPtr create( ISCTPTransportDelegatePtr delegate, IDTLSTransportPtr transport, WORD localPort = 0 // 0 = port automatically chosen - ) throw (InvalidParameters, InvalidStateError); + ) noexcept(false); // throws InvalidParameters, InvalidStateError static ISCTPTransportListenerSubscriptionPtr listen( ISCTPTransportListenerDelegatePtr delegate, IDTLSTransportPtr transport, const Capabilities &remoteCapabilities - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - static CapabilitiesPtr getCapabilities(); + static CapabilitiesPtr getCapabilities() noexcept; - virtual IDTLSTransportPtr transport() const = 0; - virtual States state() const = 0; + virtual IDTLSTransportPtr transport() const noexcept = 0; + virtual States state() const noexcept = 0; - virtual WORD port() const = 0; + virtual WORD port() const noexcept = 0; - virtual WORD localPort() const = 0; - virtual Optional remotePort() const = 0; + virtual WORD localPort() const noexcept = 0; + virtual Optional remotePort() const noexcept = 0; - virtual PromiseWithSocketOptionsPtr getOptions(const SocketOptions &inWhichOptions) = 0; - virtual PromisePtr setOptions(const SocketOptions &inOptions) = 0; + virtual PromiseWithSocketOptionsPtr getOptions(const SocketOptions &inWhichOptions) noexcept = 0; + virtual PromisePtr setOptions(const SocketOptions &inOptions) noexcept = 0; virtual void start( const Capabilities &remoteCapabilities, WORD remotePort = 0 - ) throw (InvalidStateError, InvalidParameters) = 0; - virtual void stop() = 0; + ) noexcept(false) = 0; // throws InvalidStateError, InvalidParameters + virtual void stop() noexcept = 0; - virtual ISCTPTransportSubscriptionPtr subscribe(ISCTPTransportDelegatePtr delegate) = 0; + virtual ISCTPTransportSubscriptionPtr subscribe(ISCTPTransportDelegatePtr delegate) noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportDelegate - #pragma mark + // + // ISCTPTransportDelegate + // interaction ISCTPTransportDelegate { @@ -250,26 +250,26 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportSubscription - #pragma mark + // + // ISCTPTransportSubscription + // interaction ISCTPTransportSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerDelegate - #pragma mark + // + // ISCTPTransportListenerDelegate + // interaction ISCTPTransportListenerDelegate { @@ -280,9 +280,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerSubscription - #pragma mark + // + // ISCTPTransportListenerSubscription + // interaction ISCTPTransportListenerSubscription { @@ -299,23 +299,23 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::ISCTPTransportDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::ISCTPTransportPtr, ISCTPTransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IDataChannelPtr, IDataChannelPtr) -ZS_DECLARE_PROXY_METHOD_2(onSCTPTransportStateChange, ISCTPTransportPtr, States) -ZS_DECLARE_PROXY_METHOD_2(onSCTPTransportDataChannel, ISCTPTransportPtr, IDataChannelPtr) +ZS_DECLARE_PROXY_METHOD(onSCTPTransportStateChange, ISCTPTransportPtr, States) +ZS_DECLARE_PROXY_METHOD(onSCTPTransportDataChannel, ISCTPTransportPtr, IDataChannelPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::ISCTPTransportDelegate, ortc::ISCTPTransportSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::ISCTPTransportPtr, ISCTPTransportPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDataChannelPtr, IDataChannelPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onSCTPTransportStateChange, ISCTPTransportPtr, States) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onSCTPTransportDataChannel, ISCTPTransportPtr, IDataChannelPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSCTPTransportStateChange, ISCTPTransportPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSCTPTransportDataChannel, ISCTPTransportPtr, IDataChannelPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() ZS_DECLARE_PROXY_BEGIN(ortc::ISCTPTransportListenerDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::ISCTPTransportPtr, ISCTPTransportPtr) -ZS_DECLARE_PROXY_METHOD_1(onSCTPTransport, ISCTPTransportPtr) +ZS_DECLARE_PROXY_METHOD(onSCTPTransport, ISCTPTransportPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::ISCTPTransportListenerDelegate, ortc::ISCTPTransportListenerSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::ISCTPTransportPtr, ISCTPTransportPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_1(onSCTPTransport, ISCTPTransportPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSCTPTransport, ISCTPTransportPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/ISRTPSDESTransport.h b/ortc/ISRTPSDESTransport.h index 58dcc72a..25ab7ce9 100644 --- a/ortc/ISRTPSDESTransport.h +++ b/ortc/ISRTPSDESTransport.h @@ -45,26 +45,26 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportTypes - #pragma mark + // + // ISRTPSDESTransportTypes + // interaction ISRTPSDESTransportTypes { typedef String SessionParam; - ZS_DECLARE_STRUCT_PTR(Parameters) - ZS_DECLARE_STRUCT_PTR(CryptoParameters) - ZS_DECLARE_STRUCT_PTR(KeyParameters) + ZS_DECLARE_STRUCT_PTR(Parameters); + ZS_DECLARE_STRUCT_PTR(CryptoParameters); + ZS_DECLARE_STRUCT_PTR(KeyParameters); - ZS_DECLARE_TYPEDEF_PTR(std::list, CryptoParametersList) - ZS_DECLARE_TYPEDEF_PTR(std::list, KeyParametersList) - ZS_DECLARE_TYPEDEF_PTR(std::list, SessionParamList) + ZS_DECLARE_TYPEDEF_PTR(std::list, CryptoParametersList); + ZS_DECLARE_TYPEDEF_PTR(std::list, KeyParametersList); + ZS_DECLARE_TYPEDEF_PTR(std::list, SessionParamList); //------------------------------------------------------------------------- - #pragma mark - #pragma mark CryptoParameters - #pragma mark + // + // CryptoParameters + // struct CryptoParameters { // see RFC 4568 sect 9.2 WORD mTag {}; @@ -72,39 +72,39 @@ namespace ortc KeyParametersList mKeyParams; SessionParamList mSessionParams; - CryptoParameters() {} - CryptoParameters(const CryptoParameters &op2) {(*this) = op2;} - CryptoParameters(ElementPtr elem); + CryptoParameters() noexcept {} + CryptoParameters(const CryptoParameters &op2) noexcept {(*this) = op2;} + CryptoParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark Parameters - #pragma mark + // + // Parameters + // struct Parameters { CryptoParametersList mCryptoParams; - Parameters() {} - Parameters(const Parameters &op2) {(*this) = op2;} - Parameters(ElementPtr rootEl); + Parameters() noexcept {} + Parameters(const Parameters &op2) noexcept {(*this) = op2;} + Parameters(ElementPtr rootEl) noexcept; - static ParametersPtr create(ElementPtr rootEl) { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName) const; + static ParametersPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //------------------------------------------------------------------------- - #pragma mark - #pragma mark KeyParameters - #pragma mark + // + // KeyParameters + // struct KeyParameters { // see RFC 4568 sect 9.2 String mKeyMethod; // must be "inline" @@ -113,14 +113,14 @@ namespace ortc String mMKIValue; // base 10 expressed value of Master Key Identifier (MKI) converted to string WORD mMKILength {}; // number of bytes allocated on each SRTP packet for Master Key Identifier (MKI) [max = 128 bytes] - KeyParameters() {} - KeyParameters(const KeyParameters &op2) {(*this) = op2;} - KeyParameters(ElementPtr elem); + KeyParameters() noexcept {} + KeyParameters(const KeyParameters &op2) noexcept {(*this) = op2;} + KeyParameters(ElementPtr elem) noexcept; - ElementPtr createElement(const char *objectName) const; + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -128,44 +128,44 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransport - #pragma mark + // + // ISRTPSDESTransport + // interaction ISRTPSDESTransport : public ISRTPSDESTransportTypes, public IRTPTransport, public IStatsProvider { - static ElementPtr toDebug(ISRTPSDESTransportPtr transport); + static ElementPtr toDebug(ISRTPSDESTransportPtr transport) noexcept; - static ISRTPSDESTransportPtr convert(IRTPTransportPtr rtpTransport); + static ISRTPSDESTransportPtr convert(IRTPTransportPtr rtpTransport) noexcept; static ISRTPSDESTransportPtr create( ISRTPSDESTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ISRTPSDESTransportSubscriptionPtr subscribe(ISRTPSDESTransportDelegatePtr delegate) = 0; + virtual ISRTPSDESTransportSubscriptionPtr subscribe(ISRTPSDESTransportDelegatePtr delegate) noexcept = 0; - virtual IICETransportPtr transport() const = 0; - virtual IICETransportPtr rtcpTransport() const = 0; + virtual IICETransportPtr transport() const noexcept = 0; + virtual IICETransportPtr rtcpTransport() const noexcept = 0; - static ParametersPtr getLocalParameters(); + static ParametersPtr getLocalParameters() noexcept; - virtual void stop() = 0; + virtual void stop() noexcept = 0; }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportDelegate - #pragma mark + // + // ISRTPSDESTransportDelegate + // interaction ISRTPSDESTransportDelegate { @@ -179,7 +179,7 @@ namespace ortc virtual void onSRTPSDESTransportError( ISRTPSDESTransportPtr transport, - ErrorAnyPtr errorCode + ErrorAnyPtr error ) = 0; }; @@ -187,30 +187,30 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportSubscription - #pragma mark + // + // ISRTPSDESTransportSubscription + // interaction ISRTPSDESTransportSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } ZS_DECLARE_PROXY_BEGIN(ortc::ISRTPSDESTransportDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::ISRTPSDESTransportPtr, ISRTPSDESTransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::ErrorAnyPtr, ErrorAnyPtr) -ZS_DECLARE_PROXY_METHOD_3(onSRTPSDESTransportLifetimeRemaining, ISRTPSDESTransportPtr, ULONG, ULONG) -ZS_DECLARE_PROXY_METHOD_2(onSRTPSDESTransportError, ISRTPSDESTransportPtr, ErrorAnyPtr) +ZS_DECLARE_PROXY_METHOD(onSRTPSDESTransportLifetimeRemaining, ISRTPSDESTransportPtr, ULONG, ULONG) +ZS_DECLARE_PROXY_METHOD(onSRTPSDESTransportError, ISRTPSDESTransportPtr, ErrorAnyPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::ISRTPSDESTransportDelegate, ortc::ISRTPSDESTransportSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::ISRTPSDESTransportPtr, ISRTPSDESTransportPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::ErrorAnyPtr, ErrorAnyPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_3(onSRTPSDESTransportLifetimeRemaining, ISRTPSDESTransportPtr, ULONG, ULONG) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onSRTPSDESTransportError, ISRTPSDESTransportPtr, ErrorAnyPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSRTPSDESTransportLifetimeRemaining, ISRTPSDESTransportPtr, ULONG, ULONG) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSRTPSDESTransportError, ISRTPSDESTransportPtr, ErrorAnyPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/IStatsProvider.h b/ortc/IStatsProvider.h index f263f614..465530d9 100644 --- a/ortc/IStatsProvider.h +++ b/ortc/IStatsProvider.h @@ -42,9 +42,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsProviderTypes - #pragma mark + // + // IStatsProviderTypes + // interaction IStatsProviderTypes { @@ -56,13 +56,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsProvider - #pragma mark + // + // IStatsProvider + // interaction IStatsProvider : public IStatsProviderTypes { - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const = 0; + virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept = 0; }; } diff --git a/ortc/IStatsReport.h b/ortc/IStatsReport.h index bb1401c0..cfce57e5 100644 --- a/ortc/IStatsReport.h +++ b/ortc/IStatsReport.h @@ -42,9 +42,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes - #pragma mark + // + // IStatsReportTypes + // interaction IStatsReportTypes { @@ -78,9 +78,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::StatsType - #pragma mark + // + // IStatsReportTypes::StatsType + // enum StatsTypes { @@ -106,13 +106,13 @@ namespace ortc StatsType_Last = StatsType_RemoteCandidate }; - static Optional toStatsType(const char *type); - static const char *toString(StatsTypes type); - static const char *toString(const Optional &type); + static Optional toStatsType(const char *type) noexcept; + static const char *toString(StatsTypes type) noexcept; + static const char *toString(const Optional &type) noexcept; struct StatsTypeSet : public std::set { - bool hasStatType(StatsTypes stat) const; + bool hasStatType(StatsTypes stat) const noexcept; }; enum StatsICECandidatePairStates @@ -129,16 +129,16 @@ namespace ortc StatsICECandidatePairState_Last = StatsICECandidatePairState_Cancelled, }; - static Optional toCandidatePairState(const char *type); - static const char *toString(StatsICECandidatePairStates type); + static Optional toCandidatePairState(const char *type) noexcept; + static const char *toString(StatsICECandidatePairStates type) noexcept; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::Stats - #pragma mark + // + // IStatsReportTypes::Stats + // struct Stats : public Any { @@ -147,36 +147,37 @@ namespace ortc String mStatsTypeOther; String mID; - Stats(); - Stats(const Stats &op2); - Stats(ElementPtr rootEl); + Stats() noexcept; + Stats(const Stats &op2) noexcept; + Stats(ElementPtr rootEl) noexcept; - String statsType() const { if (mStatsType.hasValue()) return IStatsReportTypes::toString(mStatsType); return mStatsTypeOther; } + String statsType() const noexcept { if (mStatsType.hasValue()) return IStatsReportTypes::toString(mStatsType); return mStatsTypeOther; } - static StatsPtr create(ElementPtr rootEl); + static StatsPtr create(const Stats &source) noexcept; + static StatsPtr create(ElementPtr rootEl) noexcept; - static StatsPtr convert(AnyPtr any); + static StatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName) const; + virtual ElementPtr createElement(const char *objectName) const noexcept; - virtual ElementPtr toDebug() const; - virtual String hash() const; + virtual ElementPtr toDebug() const noexcept; + virtual String hash() const noexcept; - virtual void eventTrace() const; + virtual void eventTrace() const noexcept; - Stats &operator=(const Stats &op2) = delete; + Stats &operator=(const Stats &op2) noexcept = delete; protected: - virtual void eventTrace(double timestamp) const; + virtual void eventTrace(double timestamp) const noexcept; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::RTPStreamStats - #pragma mark + // + // IStatsReportTypes::RTPStreamStats + // struct RTPStreamStats : public Stats { @@ -192,32 +193,35 @@ namespace ortc unsigned long mNACKCount {}; unsigned long mSLICount {}; - RTPStreamStats() {} - RTPStreamStats(const RTPStreamStats &op2); - RTPStreamStats(ElementPtr rootEl); + RTPStreamStats() noexcept {} + RTPStreamStats(const RTPStreamStats &op2) noexcept; + RTPStreamStats(ElementPtr rootEl) noexcept; - static RTPStreamStatsPtr create(ElementPtr rootEl); + static RTPStreamStatsPtr create(ElementPtr rootEl) noexcept; + static RTPStreamStatsPtr create(const RTPStreamStats &op2) noexcept { return std::dynamic_pointer_cast(Stats::create(op2)); } - static RTPStreamStatsPtr convert(AnyPtr any); + static RTPStreamStatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName) const override; + ElementPtr createElement(const char *objectName) const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - RTPStreamStats &operator=(const RTPStreamStats &op2) = delete; + RTPStreamStats &operator=(const RTPStreamStats &op2) noexcept = delete; + + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::Codec - #pragma mark + // + // IStatsReportTypes::Codec + // struct Codec : public Stats { @@ -227,32 +231,35 @@ namespace ortc Optional mChannels {}; String mParameters; - Codec() { mStatsType = IStatsReportTypes::StatsType_Codec; } - Codec(const Codec &op2); - Codec(ElementPtr rootEl); + Codec() noexcept { mStatsType = IStatsReportTypes::StatsType_Codec; } + Codec(const Codec &op2) noexcept; + Codec(ElementPtr rootEl) noexcept; + + static CodecPtr create(ElementPtr rootEl) noexcept; + static CodecPtr create(const Codec &op2) noexcept { return std::make_shared(op2); } - static CodecPtr create(ElementPtr rootEl); + static CodecPtr convert(AnyPtr any) noexcept; - static CodecPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "codec") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "codec") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + Codec &operator=(const Codec &op2) noexcept = delete; - Codec &operator=(const Codec &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::InboundRTPStreamStats - #pragma mark + // + // IStatsReportTypes::InboundRTPStreamStats + // struct InboundRTPStreamStats : public RTPStreamStats { @@ -263,32 +270,35 @@ namespace ortc double mFractionLost {}; Milliseconds mEndToEndDelay {}; - InboundRTPStreamStats() { mStatsType = IStatsReportTypes::StatsType_InboundRTP; } - InboundRTPStreamStats(const InboundRTPStreamStats &op2); - InboundRTPStreamStats(ElementPtr rootEl); + InboundRTPStreamStats() noexcept { mStatsType = IStatsReportTypes::StatsType_InboundRTP; } + InboundRTPStreamStats(const InboundRTPStreamStats &op2) noexcept; + InboundRTPStreamStats(ElementPtr rootEl) noexcept; - static InboundRTPStreamStatsPtr create(ElementPtr rootEl); + static InboundRTPStreamStatsPtr create(ElementPtr rootEl) noexcept; + static InboundRTPStreamStatsPtr create(const InboundRTPStreamStats &op2) noexcept { return std::make_shared(op2); } - static InboundRTPStreamStatsPtr convert(AnyPtr any); + static InboundRTPStreamStatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName = "inboundrtp") const override; + ElementPtr createElement(const char *objectName = "inboundrtp") const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - InboundRTPStreamStats &operator=(const InboundRTPStreamStats &op2) = delete; + InboundRTPStreamStats &operator=(const InboundRTPStreamStats &op2) noexcept = delete; + + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::OutboundRTPStreamStats - #pragma mark + // + // IStatsReportTypes::OutboundRTPStreamStats + // struct OutboundRTPStreamStats : public RTPStreamStats { @@ -297,96 +307,105 @@ namespace ortc double mTargetBitrate {}; double mRoundTripTime {}; - OutboundRTPStreamStats() { mStatsType = IStatsReportTypes::StatsType_OutboundRTP; } - OutboundRTPStreamStats(const OutboundRTPStreamStats &op2); - OutboundRTPStreamStats(ElementPtr rootEl); + OutboundRTPStreamStats() noexcept { mStatsType = IStatsReportTypes::StatsType_OutboundRTP; } + OutboundRTPStreamStats(const OutboundRTPStreamStats &op2) noexcept; + OutboundRTPStreamStats(ElementPtr rootEl) noexcept; + + static OutboundRTPStreamStatsPtr create(ElementPtr rootEl) noexcept; + static OutboundRTPStreamStatsPtr create(const OutboundRTPStreamStats &op2) noexcept { return std::make_shared(op2); } - static OutboundRTPStreamStatsPtr create(ElementPtr rootEl); + static OutboundRTPStreamStatsPtr convert(AnyPtr any) noexcept; - static OutboundRTPStreamStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "outboundrtp") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "outboundrtp") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + OutboundRTPStreamStats &operator=(const OutboundRTPStreamStats &op2) noexcept = delete; - OutboundRTPStreamStats &operator=(const OutboundRTPStreamStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::SCTPTransportStats - #pragma mark + // + // IStatsReportTypes::SCTPTransportStats + // struct SCTPTransportStats : public Stats { unsigned long mDataChannelsOpened {}; unsigned long mDataChannelsClosed {}; - SCTPTransportStats() { mStatsType = IStatsReportTypes::StatsType_SCTPTransport; } - SCTPTransportStats(const SCTPTransportStats &op2); - SCTPTransportStats(ElementPtr rootEl); + SCTPTransportStats() noexcept { mStatsType = IStatsReportTypes::StatsType_SCTPTransport; } + SCTPTransportStats(const SCTPTransportStats &op2) noexcept; + SCTPTransportStats(ElementPtr rootEl) noexcept; - static SCTPTransportStatsPtr create(ElementPtr rootEl); + static SCTPTransportStatsPtr create(ElementPtr rootEl) noexcept; + static SCTPTransportStatsPtr create(const SCTPTransportStats &op2) noexcept { return std::make_shared(op2); } - static SCTPTransportStatsPtr convert(AnyPtr any); + static SCTPTransportStatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName = "sctptransport") const override; + ElementPtr createElement(const char *objectName = "sctptransport") const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - SCTPTransportStats &operator=(const SCTPTransportStats &op2) = delete; + SCTPTransportStats &operator=(const SCTPTransportStats &op2) noexcept = delete; + + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::MediaStreamStats - #pragma mark + // + // IStatsReportTypes::MediaStreamStats + // struct MediaStreamStats : public Stats { String mStreamID; StringList mTrackIDs; - MediaStreamStats() { mStatsType = IStatsReportTypes::StatsType_Stream; } - MediaStreamStats(const MediaStreamStats &op2); - MediaStreamStats(ElementPtr rootEl); + MediaStreamStats() noexcept { mStatsType = IStatsReportTypes::StatsType_Stream; } + MediaStreamStats(const MediaStreamStats &op2) noexcept; + MediaStreamStats(ElementPtr rootEl) noexcept; - static MediaStreamStatsPtr create(ElementPtr rootEl); + static MediaStreamStatsPtr create(ElementPtr rootEl) noexcept; + static MediaStreamStatsPtr create(const MediaStreamStats &op2) noexcept { return std::make_shared(op2); } - static MediaStreamStatsPtr convert(AnyPtr any); + static MediaStreamStatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName = "stream") const override; + ElementPtr createElement(const char *objectName = "stream") const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - MediaStreamStats &operator=(const MediaStreamStats &op2) = delete; + MediaStreamStats &operator=(const MediaStreamStats &op2) noexcept = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } + protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::MediaStreamTrackStats - #pragma mark + // + // IStatsReportTypes::MediaStreamTrackStats + // struct MediaStreamTrackStats : public Stats { @@ -405,32 +424,35 @@ namespace ortc double mEchoReturnLoss {}; double mEchoReturnLossEnhancement {}; - MediaStreamTrackStats() { mStatsType = IStatsReportTypes::StatsType_Track; } - MediaStreamTrackStats(const MediaStreamTrackStats &op2); - MediaStreamTrackStats(ElementPtr rootEl); + MediaStreamTrackStats() noexcept { mStatsType = IStatsReportTypes::StatsType_Track; } + MediaStreamTrackStats(const MediaStreamTrackStats &op2) noexcept; + MediaStreamTrackStats(ElementPtr rootEl) noexcept; + + static MediaStreamTrackStatsPtr create(ElementPtr rootEl) noexcept; + static MediaStreamTrackStatsPtr create(const MediaStreamTrackStats &op2) noexcept { return std::make_shared(op2); } - static MediaStreamTrackStatsPtr create(ElementPtr rootEl); + static MediaStreamTrackStatsPtr convert(AnyPtr any) noexcept; - static MediaStreamTrackStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "track") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "track") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + MediaStreamTrackStats &operator=(const MediaStreamStats &op2) noexcept = delete; - MediaStreamTrackStats &operator=(const MediaStreamStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::DataChannelStats - #pragma mark + // + // IStatsReportTypes::DataChannelStats + // struct DataChannelStats : public Stats { @@ -443,32 +465,35 @@ namespace ortc unsigned long mMessagesReceived {}; unsigned long long mBytesReceived {}; - DataChannelStats() { mStatsType = IStatsReportTypes::StatsType_DataChannel; } - DataChannelStats(const DataChannelStats &op2); - DataChannelStats(ElementPtr rootEl); + DataChannelStats() noexcept { mStatsType = IStatsReportTypes::StatsType_DataChannel; } + DataChannelStats(const DataChannelStats &op2) noexcept; + DataChannelStats(ElementPtr rootEl) noexcept; + + static DataChannelStatsPtr create(ElementPtr rootEl) noexcept; + static DataChannelStatsPtr create(const DataChannelStats &op2) noexcept { return std::make_shared(op2); } - static DataChannelStatsPtr create(ElementPtr rootEl); + static DataChannelStatsPtr convert(AnyPtr any) noexcept; - static DataChannelStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "datachannel") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "datachannel") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + DataChannelStats &operator=(const DataChannelStats &op2) noexcept = delete; - DataChannelStats &operator=(const DataChannelStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICEGathererStats - #pragma mark + // + // IStatsReportTypes::ICEGathererStats + // struct ICEGathererStats : public Stats { @@ -476,23 +501,26 @@ namespace ortc unsigned long long mBytesReceived{}; String mRTCPGathererStatsID; - ICEGathererStats() { mStatsType = IStatsReportTypes::StatsType_ICEGatherer; } - ICEGathererStats(const ICEGathererStats &op2); - ICEGathererStats(ElementPtr rootEl); + ICEGathererStats() noexcept { mStatsType = IStatsReportTypes::StatsType_ICEGatherer; } + ICEGathererStats(const ICEGathererStats &op2) noexcept; + ICEGathererStats(ElementPtr rootEl) noexcept; - static ICEGathererStatsPtr create(ElementPtr rootEl); + static ICEGathererStatsPtr create(ElementPtr rootEl) noexcept; + static ICEGathererStatsPtr create(const ICEGathererStats &op2) noexcept { return std::make_shared(op2); } - static ICEGathererStatsPtr convert(AnyPtr any); + static ICEGathererStatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName = "icegatherer") const override; + ElementPtr createElement(const char *objectName = "icegatherer") const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - ICEGathererStats &operator=(const ICEGathererStats &op2) = delete; + ICEGathererStats &operator=(const ICEGathererStats &op2) noexcept = delete; + + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; @@ -500,9 +528,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICETransportStats - #pragma mark + // + // IStatsReportTypes::ICETransportStats + // struct ICETransportStats : public Stats { @@ -512,93 +540,102 @@ namespace ortc bool mActiveConnection {}; String mSelectedCandidatePairID; - ICETransportStats() { mStatsType = IStatsReportTypes::StatsType_ICETransport; } - ICETransportStats(const ICETransportStats &op2); - ICETransportStats(ElementPtr rootEl); + ICETransportStats() noexcept { mStatsType = IStatsReportTypes::StatsType_ICETransport; } + ICETransportStats(const ICETransportStats &op2) noexcept; + ICETransportStats(ElementPtr rootEl) noexcept; + + static ICETransportStatsPtr create(ElementPtr rootEl) noexcept; + static ICETransportStatsPtr create(const ICETransportStats &op2) noexcept { return std::make_shared(op2); } - static ICETransportStatsPtr create(ElementPtr rootEl); + static ICETransportStatsPtr convert(AnyPtr any) noexcept; - static ICETransportStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "icetransport") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "icetransport") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ICETransportStats &operator=(const ICETransportStats &op2) noexcept = delete; - ICETransportStats &operator=(const ICETransportStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::DTLSTransportStats - #pragma mark + // + // IStatsReportTypes::DTLSTransportStats + // struct DTLSTransportStats : public Stats { String mLocalCertificateID; String mRemoteCertificateID; - DTLSTransportStats() { mStatsType = IStatsReportTypes::StatsType_DTLSTransport; } - DTLSTransportStats(const DTLSTransportStats &op2); - DTLSTransportStats(ElementPtr rootEl); + DTLSTransportStats() noexcept { mStatsType = IStatsReportTypes::StatsType_DTLSTransport; } + DTLSTransportStats(const DTLSTransportStats &op2) noexcept; + DTLSTransportStats(ElementPtr rootEl) noexcept; - static DTLSTransportStatsPtr create(ElementPtr rootEl); + static DTLSTransportStatsPtr create(ElementPtr rootEl) noexcept; + static DTLSTransportStatsPtr create(const DTLSTransportStats &op2) noexcept { return std::make_shared(op2); } - static DTLSTransportStatsPtr convert(AnyPtr any); + static DTLSTransportStatsPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName = "dtlstransport") const override; + ElementPtr createElement(const char *objectName = "dtlstransport") const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - DTLSTransportStats &operator=(const DTLSTransportStats &op2) = delete; + DTLSTransportStats &operator=(const DTLSTransportStats &op2) noexcept = delete; + + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::SRTPTransportStats - #pragma mark + // + // IStatsReportTypes::SRTPTransportStats + // struct SRTPTransportStats : public Stats { - SRTPTransportStats() { mStatsType = IStatsReportTypes::StatsType_SRTPTransport; } - SRTPTransportStats(const SRTPTransportStats &op2); - SRTPTransportStats(ElementPtr rootEl); + SRTPTransportStats() noexcept { mStatsType = IStatsReportTypes::StatsType_SRTPTransport; } + SRTPTransportStats(const SRTPTransportStats &op2) noexcept; + SRTPTransportStats(ElementPtr rootEl) noexcept; + + static SRTPTransportStatsPtr create(ElementPtr rootEl) noexcept; + static SRTPTransportStatsPtr create(const SRTPTransportStats &op2) noexcept { return std::make_shared(op2); } - static SRTPTransportStatsPtr create(ElementPtr rootEl); + static SRTPTransportStatsPtr convert(AnyPtr any) noexcept; - static SRTPTransportStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "srtptransport") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "srtptransport") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + SRTPTransportStats &operator=(const SRTPTransportStats &op2) noexcept = delete; - SRTPTransportStats &operator=(const SRTPTransportStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICECandidateAttributes - #pragma mark + // + // IStatsReportTypes::ICECandidateAttributes + // struct ICECandidateAttributes : public Stats { @@ -610,32 +647,35 @@ namespace ortc unsigned long mPriority {}; String mAddressSourceURL; - ICECandidateAttributes() { mStatsType = IStatsReportTypes::StatsType_Candidate; } - ICECandidateAttributes(const ICECandidateAttributes &op2); - ICECandidateAttributes(ElementPtr rootEl); + ICECandidateAttributes() noexcept { mStatsType = IStatsReportTypes::StatsType_Candidate; } + ICECandidateAttributes(const ICECandidateAttributes &op2) noexcept; + ICECandidateAttributes(ElementPtr rootEl) noexcept; - static ICECandidateAttributesPtr create(ElementPtr rootEl); + static ICECandidateAttributesPtr create(ElementPtr rootEl) noexcept; + static ICECandidateAttributesPtr create(const ICECandidateAttributes &op2) noexcept { return std::make_shared(op2); } - static ICECandidateAttributesPtr convert(AnyPtr any); + static ICECandidateAttributesPtr convert(AnyPtr any) noexcept; - virtual ElementPtr createElement(const char *objectName = "dtlstransport") const override; + ElementPtr createElement(const char *objectName = "dtlstransport") const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - ICECandidateAttributes &operator=(const ICECandidateAttributes &op2) = delete; + ICECandidateAttributes &operator=(const ICECandidateAttributes &op2) noexcept = delete; + + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICECandidatePairStats - #pragma mark + // + // IStatsReportTypes::ICECandidatePairStats + // struct ICECandidatePairStats : public Stats { @@ -653,32 +693,35 @@ namespace ortc double mAvailableOutgoingBitrate {}; double mAvailableIncomingBitrate {}; - ICECandidatePairStats() { mStatsType = IStatsReportTypes::StatsType_CandidatePair; } - ICECandidatePairStats(const ICECandidatePairStats &op2); - ICECandidatePairStats(ElementPtr rootEl); + ICECandidatePairStats() noexcept { mStatsType = IStatsReportTypes::StatsType_CandidatePair; } + ICECandidatePairStats(const ICECandidatePairStats &op2) noexcept; + ICECandidatePairStats(ElementPtr rootEl) noexcept; + + static ICECandidatePairStatsPtr create(ElementPtr rootEl) noexcept; + static ICECandidatePairStatsPtr create(const ICECandidatePairStats &op2) noexcept { return std::make_shared(op2); } - static ICECandidatePairStatsPtr create(ElementPtr rootEl); + static ICECandidatePairStatsPtr convert(AnyPtr any) noexcept; - static ICECandidatePairStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "candidatepair") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "candidatepair") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + ICECandidatePairStats &operator=(const ICECandidatePairStats &op2) noexcept = delete; - ICECandidatePairStats &operator=(const ICECandidatePairStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::CertificateStats - #pragma mark + // + // IStatsReportTypes::CertificateStats + // struct CertificateStats : public Stats { @@ -687,23 +730,26 @@ namespace ortc String mBase64Certificate; String mIssuerCertificateID; - CertificateStats() { mStatsType = IStatsReportTypes::StatsType_Certificate; } - CertificateStats(const CertificateStats &op2); - CertificateStats(ElementPtr rootEl); + CertificateStats() noexcept { mStatsType = IStatsReportTypes::StatsType_Certificate; } + CertificateStats(const CertificateStats &op2) noexcept; + CertificateStats(ElementPtr rootEl) noexcept; + + static CertificateStatsPtr create(ElementPtr rootEl) noexcept; + static CertificateStatsPtr create(const CertificateStats &op2) noexcept { return std::make_shared(op2); } - static CertificateStatsPtr create(ElementPtr rootEl); + static CertificateStatsPtr convert(AnyPtr any) noexcept; - static CertificateStatsPtr convert(AnyPtr any); + ElementPtr createElement(const char *objectName = "certificate") const noexcept override; - virtual ElementPtr createElement(const char *objectName = "certificate") const override; + ElementPtr toDebug() const noexcept override; + String hash() const noexcept override; - virtual ElementPtr toDebug() const override; - virtual String hash() const override; + CertificateStats &operator=(const CertificateStats &op2) noexcept = delete; - CertificateStats &operator=(const CertificateStats &op2) = delete; + void eventTrace() const noexcept override { Stats::eventTrace(); } protected: - virtual void eventTrace(double timestamp) const override; + void eventTrace(double timestamp) const noexcept override; }; }; @@ -712,20 +758,20 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReport - #pragma mark + // + // IStatsReport + // interaction IStatsReport : public IStatsReportTypes, public Any { - static ElementPtr toDebug(IStatsReportPtr report); - static IStatsReportPtr convert(AnyPtr any); + static ElementPtr toDebug(IStatsReportPtr report) noexcept; + static IStatsReportPtr convert(AnyPtr any) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IDListPtr getStatesIDs() const = 0; - virtual StatsPtr getStats(const char *id) const = 0; + virtual IDListPtr getStatesIDs() const noexcept = 0; + virtual StatsPtr getStats(const char *id) const noexcept = 0; }; } diff --git a/ortc/RTCPPacket.h b/ortc/RTCPPacket.h new file mode 100644 index 00000000..24dc3780 --- /dev/null +++ b/ortc/RTCPPacket.h @@ -0,0 +1,1611 @@ +/* + + Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include +#include + +namespace ortc +{ + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket + // + + class RTCPPacket + { + protected: + struct make_private {}; + + public: + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + + public: + //----------------------------------------------------------------------- + // + // RTCPPacket::Report + // + + struct Report + { + Report *next() const noexcept {return mNext;} + + const BYTE *ptr() const noexcept {return mPtr;} + size_t size() const noexcept {return mSize;} + + BYTE version() const noexcept {return mVersion;} + size_t padding() const noexcept {return static_cast(mPadding);} + BYTE reportSpecific() const noexcept {return mReportSpecific;} + + BYTE pt() const noexcept {return mPT;} + static const char *ptToString(BYTE pt) noexcept; + const char *ptToString() const noexcept {return ptToString(mPT);} + + public: + Report *mNext {}; + + const BYTE *mPtr {}; + size_t mSize {}; + + BYTE mVersion {}; + BYTE mPadding {}; + BYTE mReportSpecific {}; + + BYTE mPT {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::SenderReceiverCommonReport + // + + struct SenderReceiverCommonReport : public Report + { + //--------------------------------------------------------------------- + // + // RTCPPacket::SenderReceiverCommonReport::ReportBlock + // + + struct ReportBlock + { + ReportBlock *next() const noexcept {return mNext;} + + DWORD ssrc() const noexcept {return mSSRC;} + BYTE fractionLost() const noexcept {return mFractionLost;} + DWORD cumulativeNumberOfPacketsLost() const noexcept {return mCumulativeNumberOfPacketsLost;} + DWORD extendedHighestSequenceNumberReceived() const noexcept {return mExtendedHighestSequenceNumberReceived;} + DWORD interarrivalJitter() const noexcept {return mInterarrivalJitter;} + DWORD lsr() const noexcept {return mLSR;} + DWORD dlsr() const noexcept {return mDLSR;} + + public: + ReportBlock *mNext {}; + + DWORD mSSRC {}; + BYTE mFractionLost {}; + DWORD mCumulativeNumberOfPacketsLost {}; + DWORD mExtendedHighestSequenceNumberReceived {}; + DWORD mInterarrivalJitter {}; + DWORD mLSR {}; // last SR timestamp + DWORD mDLSR {}; // delay since last SR + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::SenderReceiverCommonReport (public) + // + + size_t rc() const noexcept {return static_cast(mReportSpecific);} + DWORD ssrcOfSender() const noexcept {return mSSRCOfSender;} + + ReportBlock *firstReportBlock() const noexcept {return mFirstReportBlock;} + + const BYTE *extension() const noexcept {return mExtension;} + size_t extensionSize() const noexcept {return mExtensionSize;} + + public: + DWORD mSSRCOfSender {}; + + const BYTE *mExtension {}; + size_t mExtensionSize {}; + + ReportBlock *mFirstReportBlock {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::SenderReport + // + + struct SenderReport : public SenderReceiverCommonReport + { + // https://tools.ietf.org/html/rfc3550#section-6.4.1 + + static const BYTE kPayloadType {200}; + + SenderReport *nextSenderReport() const noexcept {return mNextSenderReport;} + + DWORD ntpTimestampMS() const noexcept {return mNTPTimestampMS;} + DWORD ntpTimestampLS() const noexcept {return mNTPTimestampLS;} + Time ntpTimestamp() const noexcept; + DWORD rtpTimestamp() const noexcept {return mRTPTimestamp;} + DWORD senderPacketCount() const noexcept {return mSenderPacketCount;} + DWORD senderOctetCount() const noexcept {return mSenderOctetCount;} + + public: + SenderReport *mNextSenderReport {}; + + DWORD mNTPTimestampMS {}; + DWORD mNTPTimestampLS {}; + DWORD mRTPTimestamp {}; + DWORD mSenderPacketCount {}; + DWORD mSenderOctetCount {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::ReceiverReport + // + + struct ReceiverReport : public SenderReceiverCommonReport + { + // https://tools.ietf.org/html/rfc3550#section-6.4.2 + + static const BYTE kPayloadType {201}; + + ReceiverReport *nextReceiverReport() const noexcept {return mNextReceiverReport;} + + DWORD ssrcOfPacketSender() const noexcept {return mSSRCOfSender;} + + public: + ReceiverReport *mNextReceiverReport {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::SDES + // + + struct SDES : public Report + { + // https://tools.ietf.org/html/rfc3550#section-6.5 + + //--------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk + // + + struct Chunk + { + static const BYTE kEndOfItemsType = 0; + + struct StringItem + { + BYTE type() const noexcept {return mType;} + size_t length() const noexcept {return mLength;} + const char *value() const noexcept {return mValue;} + + static const char *typeToString(BYTE type) noexcept; + const char *typeToString() const noexcept {return typeToString(mType);} + + public: + StringItem *mNext {}; + + BYTE mType {}; + size_t mLength {}; + const char *mValue {}; + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::CName + // + + struct CName : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.1 + + static const BYTE kItemType = 1; + + CName *next() const noexcept {return static_cast(mNext);} + + const char *userAndDomainName() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Name + // + + struct Name : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.2 + + static const BYTE kItemType = 2; + + Name *next() const noexcept {return static_cast(mNext);} + + const char *commonName() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Email + // + + struct Email : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.3 + + static const BYTE kItemType = 3; + + Email *next() const noexcept {return static_cast(mNext);} + + const char *emailAddress() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Phone + // + + struct Phone : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.4 + + static const BYTE kItemType = 4; + + Phone *next() const noexcept {return static_cast(mNext);} + + const char *phoneNumber() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Loc + // + + struct Loc : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.5 + + static const BYTE kItemType = 5; + + Loc *next() const noexcept {return static_cast(mNext);} + + const char *geographicLocation() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Tool + // + + struct Tool : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.6 + + static const BYTE kItemType = 6; + + Tool *next() const noexcept {return static_cast(mNext);} + + const char *nameVersion() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Note + // + + struct Note : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.7 + + static const BYTE kItemType = 7; + + Note *next() const noexcept {return static_cast(mNext);} + + const char *note() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Priv + // + + struct Priv : public StringItem + { + // https://tools.ietf.org/html/rfc3550#section-6.5.8 + + static const BYTE kItemType = 8; + + Priv *next() const noexcept {return static_cast(mNext);} + + size_t prefixLength() const noexcept {return mPrefixLength;} + const char *prefix() const noexcept {return mPrefix;} + + public: + size_t mPrefixLength {}; + const char *mPrefix {}; + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Unknown + // + + struct Unknown : public StringItem + { + Unknown *next() const noexcept {return static_cast(mNext);} + + const BYTE *ptr() const noexcept {return reinterpret_cast(value());} + size_t size() const noexcept {return length();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Mid + // + + struct Mid : public StringItem + { + // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-23#section-14.2 + static const BYTE kItemType = 12; // TBD + + Mid *next() const noexcept {return static_cast(mNext);} + + const char *mid() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::Rid + // + + struct Rid : public StringItem + { + // https://tools.ietf.org/html/draft-roach-avtext-rid-02#section-4.1 + static const BYTE kItemType = 13; // TBD + + Rid *next() const noexcept {return static_cast(mNext);} + + const char *rid() const noexcept {return value();} + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk + // + + Chunk *next() const noexcept {return mNext;} + + DWORD ssrc() const noexcept {return mSSRC;} + + size_t count() const noexcept {return mCount;} + + CName *firstCName() const noexcept {return mFirstCName;} + Name *firstName() const noexcept {return mFirstName;} + Email *firstEmail() const noexcept {return mFirstEmail;} + Phone *firstPhone() const noexcept {return mFirstPhone;} + Loc *firstLoc() const noexcept {return mFirstLoc;} + Tool *firstTool() const noexcept {return mFirstTool;} + Note *firstNote() const noexcept {return mFirstNote;} + Priv *firstPriv() const noexcept {return mFirstPriv;} + Mid *firstMid() const noexcept {return mFirstMid;} + Rid *firstRid() const noexcept {return mFirstRid;} + Unknown *firstUnknown() const noexcept {return mFirstUnknown;} + + size_t cNameCount() const noexcept {return mCNameCount;} + size_t nameCount() const noexcept {return mNameCount;} + size_t emailCount() const noexcept {return mEmailCount;} + size_t phoneCount() const noexcept {return mPhoneCount;} + size_t locCount() const noexcept {return mLocCount;} + size_t toolCount() const noexcept {return mToolCount;} + size_t noteCount() const noexcept {return mNoteCount;} + size_t privCount() const noexcept {return mPrivCount;} + size_t midCount() const noexcept {return mMidCount;} + size_t ridCount() const noexcept {return mRidCount;} + size_t unknownCount() const noexcept {return mUnknownCount;} + + CName *cNameAtIndex(size_t index) const noexcept; + Name *nameAtIndex(size_t index) const noexcept; + Email *emailAtIndex(size_t index) const noexcept; + Phone *phoneAtIndex(size_t index) const noexcept; + Loc *locAtIndex(size_t index) const noexcept; + Tool *toolAtIndex(size_t index) const noexcept; + Note *noteAtIndex(size_t index) const noexcept; + Priv *privAtIndex(size_t index) const noexcept; + Mid *midAtIndex(size_t index) const noexcept; + Rid *ridAtIndex(size_t index) const noexcept; + Unknown *unknownAtIndex(size_t index) const noexcept; + + public: + Chunk *mNext {}; + + DWORD mSSRC {}; + + size_t mCount {}; + + size_t mCNameCount {}; + size_t mNameCount {}; + size_t mEmailCount {}; + size_t mPhoneCount {}; + size_t mLocCount {}; + size_t mToolCount {}; + size_t mNoteCount {}; + size_t mPrivCount {}; + size_t mMidCount {}; + size_t mRidCount {}; + size_t mUnknownCount {}; + + CName *mFirstCName {}; + Name *mFirstName {}; + Email *mFirstEmail {}; + Phone *mFirstPhone {}; + Loc *mFirstLoc {}; + Tool *mFirstTool {}; + Note *mFirstNote {}; + Priv *mFirstPriv {}; + Mid *mFirstMid {}; + Rid *mFirstRid {}; + Unknown *mFirstUnknown {}; + }; + + static const BYTE kPayloadType {202}; + + SDES *nextSDES() const noexcept {return mNextSDES;} + + size_t sc() const noexcept {return static_cast(mReportSpecific);} + + Chunk *firstChunk() const noexcept {return mFirstChunk;} + + public: + SDES *mNextSDES {}; + + Chunk *mFirstChunk {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::Bye + // + + struct Bye : public Report + { + // https://tools.ietf.org/html/rfc3550#section-6.6 + + static const BYTE kPayloadType {203}; + + Bye *nextBye() const noexcept {return mNextBye;} + + size_t sc() const noexcept {return static_cast(mReportSpecific);} + + DWORD ssrc(size_t index) const noexcept; + + const char *reasonForLeaving() const noexcept {return mReasonForLeaving;} + + public: + Bye *mNextBye {}; + + const char *mReasonForLeaving {}; + + DWORD *mSSRCs {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::App + // + + struct App : public Report + { + // https://tools.ietf.org/html/rfc3550#section-6.7 + + static const BYTE kPayloadType {204}; + + App *nextApp() const noexcept {return mNextApp;} + + BYTE subtype() const noexcept {return mReportSpecific;} + + DWORD ssrc() const noexcept {return mSSRC;} + const char *name() const noexcept {return &(mName[0]);} + + const BYTE *data() const noexcept {return mData;} + size_t dataSize() const noexcept {return mDataSize;} + + public: + App *mNextApp {}; + + DWORD mSSRC {}; + char mName[sizeof(DWORD)+1] {}; + + const BYTE *mData {}; + size_t mDataSize {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::FeedbackMessage + // + + struct FeedbackMessage : public Report + { + // https://tools.ietf.org/html/rfc4585#section-6.1 + + BYTE fmt() const noexcept {return mReportSpecific;} + + DWORD ssrcOfPacketSender() const noexcept {return mSSRCOfPacketSender;} + DWORD ssrcOfMediaSource() const noexcept {return mSSRCOfMediaSource;} + + const BYTE *fci() const noexcept {return mFCI;} + size_t fciSize() const noexcept {return mFCISize;} + + static const char *fmtToString(BYTE pt, BYTE fmt, DWORD subFmt = 0) noexcept; + const char *fmtToString() const noexcept; + + public: + DWORD mSSRCOfPacketSender {}; + DWORD mSSRCOfMediaSource {}; + + const BYTE *mFCI {}; + size_t mFCISize {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage + // + + struct TransportLayerFeedbackMessage : public FeedbackMessage + { + // https://tools.ietf.org/html/rfc4585#section-6.2 + + //--------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage::GenericNACK + // + + struct GenericNACK + { + // https://tools.ietf.org/html/rfc4585#section-6.2.1 + + static const BYTE kFmt {1}; + + WORD pid() const noexcept {return mPID;} + WORD blp() const noexcept {return mBLP;} + + public: + WORD mPID {}; + WORD mBLP {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage::TMMBRCommon + // + + struct TMMBRCommon + { + DWORD ssrc() const noexcept {return mSSRC;} + + BYTE mxTBRExp() const noexcept {return mMxTBRExp;} + DWORD mxTBRMantissa() const noexcept {return mMxTBRMantissa;} + WORD measuredOverhead() const noexcept {return mMeasuredOverhead;} + + public: + DWORD mSSRC {}; + + BYTE mMxTBRExp {}; + DWORD mMxTBRMantissa {}; + WORD mMeasuredOverhead {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage::TMMBR + // + + struct TMMBR : public TMMBRCommon + { + // http://tools.ietf.org/html/rfc5104#section-4.2.1.1 + + static const BYTE kFmt {3}; + + public: + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage::TMMBN + // + + struct TMMBN : public TMMBRCommon + { + // http://tools.ietf.org/html/rfc5104#section-4.2.2.1 + + static const BYTE kFmt {4}; + + public: + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage (public) + // + + static const BYTE kPayloadType {205}; + + TransportLayerFeedbackMessage *nextTransportLayerFeedbackMessage() const {return mNextTransportLayerFeedbackMessage;} + + size_t genericNACKCount() const noexcept {return mGenericNACKCount;} + GenericNACK *genericNACKAtIndex(size_t index) const noexcept; + + size_t tmmbrCount() const noexcept {return mTMMBRCount;} + TMMBR *tmmbrAtIndex(size_t index) const noexcept; + + size_t tmmbnCount() const noexcept {return mTMMBNCount;} + TMMBN *tmmbnAtIndex(size_t index) const noexcept; + + TransportLayerFeedbackMessage *unknown() const noexcept {return mUnknown;} + + public: + TransportLayerFeedbackMessage *mNextTransportLayerFeedbackMessage {}; + + size_t mGenericNACKCount {}; + GenericNACK *mFirstGenericNACK {}; + + size_t mTMMBRCount {}; + TMMBR *mFirstTMMBR {}; + + size_t mTMMBNCount {}; + TMMBN *mFirstTMMBN {}; + + TransportLayerFeedbackMessage *mUnknown {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage + // + + struct PayloadSpecificFeedbackMessage : public FeedbackMessage + { + // https://tools.ietf.org/html/rfc4585#section-6.3 + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::PLI + // + + struct PLI + { + // https://tools.ietf.org/html/rfc4585#section-6.3.1 + + static const BYTE kFmt {1}; + public: + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::SLI + // + + struct SLI + { + // https://tools.ietf.org/html/rfc4585#section-6.3.2 + + static const BYTE kFmt {2}; + + WORD first() const noexcept {return mFirst;} + WORD number() const noexcept {return mNumber;} + BYTE pictureID() const noexcept {return mPictureID;} + + public: + WORD mFirst {}; + WORD mNumber {}; + BYTE mPictureID {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::RPSI + // + + struct RPSI + { + // https://tools.ietf.org/html/rfc4585#section-6.3.3 + + static const BYTE kFmt {3}; + + BYTE zeroBit() const noexcept {return mZeroBit;} + BYTE payloadType() const noexcept {return mPayloadType;} + + const BYTE *nativeRPSIBitString() const noexcept {return mNativeRPSIBitString;} + size_t nativeRPSIBitStringSizeInBits() const noexcept {return mNativeRPSIBitStringSizeInBits;} + + public: + BYTE mZeroBit {}; + BYTE mPayloadType {}; + + const BYTE *mNativeRPSIBitString {}; + size_t mNativeRPSIBitStringSizeInBits {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::FIR + // + + struct CodecControlCommon + { + DWORD ssrc() const noexcept {return mSSRC;} + BYTE seqNr() const noexcept {return mSeqNr;} + DWORD reserved() const noexcept {return mReserved;} + + public: + DWORD mSSRC {}; + BYTE mSeqNr {}; + DWORD mReserved {}; + DWORD mControlSpecific {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::FIR + // + + struct FIR : public CodecControlCommon + { + // http://tools.ietf.org/html/rfc5104#section-4.3.1.1 + + static const BYTE kFmt {4}; + + public: + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::TSTR + // + + struct TSTR : public CodecControlCommon + { + // http://tools.ietf.org/html/rfc5104#section-4.3.2.1 + + static const BYTE kFmt {5}; + + BYTE index() const noexcept {return static_cast(mControlSpecific);} + + public: + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::TSTN + // + + struct TSTN : public CodecControlCommon + { + // http://tools.ietf.org/html/rfc5104#section-4.3.3.1 + + static const BYTE kFmt {6}; + + BYTE index() const noexcept {return static_cast(mControlSpecific);} + + public: + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::VBCM + // + + struct VBCM : public CodecControlCommon + { + // http://tools.ietf.org/html/rfc5104#section-4.3.4.1 + + static const BYTE kFmt {7}; + + BYTE zeroBit() const noexcept; + BYTE payloadType() const noexcept; + + const BYTE *vbcmOctetString() const noexcept {return mVBCMOctetString;} + size_t vbcmOctetStringSize() const noexcept; + + public: + const BYTE *mVBCMOctetString {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::AFB + // + + struct AFB + { + // https://tools.ietf.org/html/rfc4585#section-6.4 + + static const BYTE kFmt {15}; + + const BYTE *data() const noexcept {return mData;} + size_t dataSize() const noexcept {return mDataSize;} + + public: + const BYTE *mData {}; + size_t mDataSize {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::REMB + // + + struct REMB + { + // https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03#section-2.2 + + static const BYTE kFmt {15}; + + size_t numSSRC() const noexcept {return static_cast(mNumSSRC);} + BYTE brExp() const noexcept {return mBRExp;} + DWORD brMantissa() const noexcept {return mBRMantissa;} + + DWORD ssrcAtIndex(size_t index) const noexcept; + + public: + BYTE mNumSSRC {}; + BYTE mBRExp {}; + DWORD mBRMantissa {}; + DWORD *mSSRCs {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage (public) + // + + static const BYTE kPayloadType {206}; + + PayloadSpecificFeedbackMessage *nextPayloadSpecificFeedbackMessage() const {return mNextPayloadSpecificFeedbackMessage;} + + size_t sliCount() const noexcept {return mSLICount;} + size_t firCount() const noexcept {return mFIRCount;} + size_t tstrCount() const noexcept {return mTSTRCount;} + size_t tstnCount() const noexcept {return mTSTNCount;} + size_t vbcmCount() const noexcept {return mVBCMCount;} + + PLI *pli() const noexcept; + SLI *sliAtIndex(size_t index) const noexcept; + RPSI *rpsi() const noexcept; + FIR *firAtIndex(size_t index) const noexcept; + TSTR *tstrAtIndex(size_t index) const noexcept; + TSTN *tstnAtIndex(size_t index) const noexcept; + VBCM *vbcmAtIndex(size_t index) const noexcept; + AFB *afb() const noexcept; + REMB *remb() const noexcept; + PayloadSpecificFeedbackMessage *unknown() const noexcept {return mUnknown;} + + public: + PayloadSpecificFeedbackMessage *mNextPayloadSpecificFeedbackMessage {}; + + PLI mPLI {}; + size_t mSLICount {}; + SLI *mFirstSLI {}; + RPSI mRPSI {}; + size_t mFIRCount {}; + FIR *mFirstFIR {}; + size_t mTSTRCount {}; + TSTR *mFirstTSTR {}; + size_t mTSTNCount {}; + TSTN *mFirstTSTN {}; + size_t mVBCMCount {}; + VBCM *mFirstVBCM {}; + AFB mAFB {}; + bool mHasREMB {false}; + REMB mREMB {}; + + PayloadSpecificFeedbackMessage *mUnknown {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::XR + // + + struct XR : public Report + { + // https://tools.ietf.org/html/rfc3611#section-2 + // https://tools.ietf.org/html/rfc3611#section-3 + + typedef WORD RLEChunk; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::ReportBlock + // + + struct ReportBlock + { + ReportBlock *next() const noexcept {return mNext;} + + BYTE blockType() const noexcept {return mBlockType;} + BYTE typeSpecific() const noexcept {return mTypeSpecific;} + + const BYTE *typeSpecificContents() const noexcept {return mTypeSpecificContents;} + size_t typeSpecificContentSize() const noexcept {return mTypeSpecificContentSize;} + + static const char *blockTypeToString(BYTE blockType) noexcept; + const char *blockTypeToString() const noexcept {return blockTypeToString(mBlockType);} + + public: + ReportBlock *mNext {}; + + BYTE mBlockType {}; + BYTE mTypeSpecific {}; + + const BYTE *mTypeSpecificContents {}; + size_t mTypeSpecificContentSize {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::ReportBlockRange + // + + struct ReportBlockRange : public ReportBlock + { + BYTE reserved() const noexcept; + BYTE thinning() const noexcept; + + DWORD ssrcOfSource() const noexcept {return mSSRCOfSource;} + WORD beginSeq() const noexcept {return mBeginSeq;} + WORD endSeq() const noexcept {return mEndSeq;} + + public: + DWORD mSSRCOfSource {}; + WORD mBeginSeq {}; + WORD mEndSeq {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::RLEReportBlock + // + + struct RLEReportBlock : public ReportBlockRange + { + size_t chunkCount() const noexcept {return mChunkCount;} + RLEChunk chunkAtIndex(size_t index) const noexcept; + + public: + size_t mChunkCount {}; + RLEChunk *mChunks {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::LossRLEReportBlock + // + + struct LossRLEReportBlock : public RLEReportBlock + { + // https://tools.ietf.org/html/rfc3611#section-4.1 + + static const BYTE kBlockType {1}; + + LossRLEReportBlock *nextLossRLE() const noexcept {return mNextLossRLE;} + + public: + LossRLEReportBlock *mNextLossRLE {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::DuplicateRLEReportBlock + // + + struct DuplicateRLEReportBlock : public RLEReportBlock + { + // https://tools.ietf.org/html/rfc3611#section-4.2 + + static const BYTE kBlockType {2}; + + DuplicateRLEReportBlock *nextDuplicateRLE() const noexcept {return mNextDuplicateRLE;} + + public: + DuplicateRLEReportBlock *mNextDuplicateRLE {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::PacketReceiptTimesReportBlock + // + + struct PacketReceiptTimesReportBlock : public ReportBlockRange + { + // https://tools.ietf.org/html/rfc3611#section-4.3 + + static const BYTE kBlockType {3}; + + PacketReceiptTimesReportBlock *nextPacketReceiptTimesReportBlock() const noexcept {return mNextPacketReceiptTimesReportBlock;} + + size_t receiptTimeCount() const noexcept {return mReceiptTimeCount;} + DWORD receiptTimeAtIndex(size_t index) const noexcept; + + public: + PacketReceiptTimesReportBlock *mNextPacketReceiptTimesReportBlock {}; + + size_t mReceiptTimeCount {}; + DWORD *mReceiptTimes {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::ReceiverReferenceTimeReportBlock + // + + struct ReceiverReferenceTimeReportBlock : public ReportBlock + { + // https://tools.ietf.org/html/rfc3611#section-4.4 + + static const BYTE kBlockType {4}; + + ReceiverReferenceTimeReportBlock *nextReceiverReferenceTimeReportBlock() const noexcept {return mNextReceiverReferenceTimeReportBlock;} + + DWORD ntpTimestampMS() const noexcept {return mNTPTimestampMS;} + DWORD ntpTimestampLS() const noexcept {return mNTPTimestampLS;} + Time ntpTimestamp() const noexcept; + + public: + ReceiverReferenceTimeReportBlock *mNextReceiverReferenceTimeReportBlock {}; + + DWORD mNTPTimestampMS {}; + DWORD mNTPTimestampLS {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::DLRRReportBlock + // + + struct DLRRReportBlock : public ReportBlock + { + // https://tools.ietf.org/html/rfc3611#section-4.5 + + static const BYTE kBlockType {5}; + + struct SubBlock + { + DWORD ssrc() const noexcept {return mSSRC;} + DWORD lrr() const noexcept {return mLRR;} + DWORD dlrr() const noexcept {return mDLRR;} + + DWORD mSSRC {}; + DWORD mLRR {}; + DWORD mDLRR {}; + }; + + DLRRReportBlock *nextDLRRReportBlock() const noexcept {return mNextDLRRReportBlock;} + + size_t subBlockCount() const noexcept {return mSubBlockCount;} + SubBlock *subBlockAtIndex(size_t index) const noexcept; + + public: + DLRRReportBlock *mNextDLRRReportBlock {}; + + size_t mSubBlockCount {}; + SubBlock *mSubBlocks {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::StatisticsSummaryReportBlock + // + + struct StatisticsSummaryReportBlock : public ReportBlockRange + { + // https://tools.ietf.org/html/rfc3611#section-4.6 + + static const BYTE kBlockType {6}; + + StatisticsSummaryReportBlock *nextStatisticsSummaryReportBlock() const noexcept {return mNextStatisticsSummaryReportBlock;} + + bool lossReportFlag() const noexcept; + bool duplicateReportFlag() const noexcept; + bool jitterFlag() const noexcept; + bool ttlFlag() const noexcept; + bool hopLimitFlag() const noexcept; + + DWORD lostPackets() const noexcept {return mLostPackets;} + DWORD dupPackets() const noexcept {return mDupPackets;} + + DWORD minJitter() const noexcept {return mMinJitter;} + DWORD maxJitter() const noexcept {return mMaxJitter;} + DWORD meanJitter() const noexcept {return mMeanJitter;} + DWORD devJitter() const noexcept {return mDevJitter;} + + BYTE minTTL() const noexcept {return mMinTTLOrHL;} + BYTE maxTTL() const noexcept {return mMaxTTLOrHL;} + BYTE meanTTL() const noexcept {return mMeanTTLOrHL;} + BYTE devTTL() const noexcept {return mDevTTLOrHL;} + + BYTE minHopLimit() const noexcept {return mMinTTLOrHL;} + BYTE maxHopLimit() const noexcept {return mMaxTTLOrHL;} + BYTE meanHopLimit() const noexcept {return mMeanTTLOrHL;} + BYTE devHopLimit() const noexcept {return mDevTTLOrHL;} + + public: + StatisticsSummaryReportBlock *mNextStatisticsSummaryReportBlock {}; + + DWORD mLostPackets {}; + DWORD mDupPackets {}; + DWORD mMinJitter {}; + DWORD mMaxJitter {}; + DWORD mMeanJitter {}; + DWORD mDevJitter {}; + + BYTE mMinTTLOrHL {}; + BYTE mMaxTTLOrHL {}; + BYTE mMeanTTLOrHL {}; + BYTE mDevTTLOrHL {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::VoIPMetricsReportBlock + // + + struct VoIPMetricsReportBlock : public ReportBlock + { + // https://tools.ietf.org/html/rfc3611#section-4.7 + + static const BYTE kBlockType {7}; + + VoIPMetricsReportBlock *nextVoIPMetricsReportBlock() const noexcept {return mNextVoIPMetricsReportBlock;} + + DWORD ssrcOfSource() const noexcept {return mSSRCOfSource;} + + BYTE lossRate() const noexcept {return mLossRate;} + BYTE discardRate() const noexcept {return mDiscardRate;} + BYTE burstDensity() const noexcept {return mBurstDensity;} + BYTE gapDensity() const noexcept {return mGapDensity;} + + WORD burstDuration() const noexcept {return mBurstDuration;} + WORD gapDuration() const noexcept {return mGapDuration;} + + WORD roundTripDelay() const noexcept {return mRoundTripDelay;} + WORD endSystemDelay() const noexcept {return mEndSystemDelay;} + + BYTE signalLevel() const noexcept {return mSignalLevel;} + BYTE noiseLevel() const noexcept {return mNoiseLevel;} + BYTE rerl() const noexcept {return mRERL;} + BYTE Gmin() const noexcept {return mGmin;} + + BYTE rFactor() const noexcept {return mRFactor;} + BYTE extRFactor() const noexcept {return mExtRFactor;} + BYTE mosLQ() const noexcept {return mMOSLQ;} + BYTE mosCQ() const noexcept {return mMOSCQ;} + + BYTE rxConfig() const noexcept {return mRXConfig;} + BYTE plc() const noexcept; + BYTE jba() const noexcept; + BYTE jbRate() const noexcept; + + WORD jbNominal() const noexcept {return mJBNominal;} + WORD jbMaximum() const noexcept {return mJBMaximum;} + WORD jbAbsMax() const noexcept {return mJBAbsMax;} + + public: + VoIPMetricsReportBlock *mNextVoIPMetricsReportBlock {}; + + DWORD mSSRCOfSource {}; + + BYTE mLossRate {}; + BYTE mDiscardRate {}; + BYTE mBurstDensity {}; + BYTE mGapDensity {}; + + WORD mBurstDuration {}; + WORD mGapDuration {}; + + WORD mRoundTripDelay {}; + WORD mEndSystemDelay {}; + + BYTE mSignalLevel {}; + BYTE mNoiseLevel {}; + BYTE mRERL {}; + BYTE mGmin {}; + + BYTE mRFactor {}; + BYTE mExtRFactor {}; + BYTE mMOSLQ {}; + BYTE mMOSCQ {}; + + BYTE mRXConfig {}; + BYTE mReservedVoIP {}; + + WORD mJBNominal {}; + WORD mJBMaximum {}; + WORD mJBAbsMax {}; + }; + + //--------------------------------------------------------------------- + // + // RTCPPacket::XR::UnknownReportBlock + // + + struct UnknownReportBlock : public ReportBlock + { + UnknownReportBlock *nextUnknownReportBlock() const noexcept {return mNextUnknownReportBlock;} + + public: + UnknownReportBlock *mNextUnknownReportBlock {}; + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::XR::RunLength + // + + struct RunLength + { + // https://tools.ietf.org/html/rfc3611#section-4.1.1 + + RunLength(RLEChunk chunk) noexcept; + + BYTE runType() const noexcept {return mRunType;} + size_t runLength() const noexcept {return static_cast(mRunLength);} + + public: + BYTE mRunType {}; // Zero indicates a run of 0s. One indicates a run of 1s. + WORD mRunLength {}; // A value between 1 and 16,383. + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::XR::BitVector + // + + struct BitVector + { + // https://tools.ietf.org/html/rfc3611#section-4.1.2 + + BitVector(RLEChunk chunk) noexcept; + + BYTE bitAtIndex(size_t index) const noexcept; // Zero indicates loss. + WORD bitVector() const noexcept { return mBitVector; } + + public: + WORD mBitVector {}; + }; + + //------------------------------------------------------------------- + // + // RTCPPacket::XR + // + + static const BYTE kPayloadType {207}; + + XR *nextXR() const noexcept {return mNextXR;} + + BYTE reserved() const noexcept {return mReportSpecific;} + + DWORD ssrc() const noexcept {return mSSRC;} + + ReportBlock *firstReportBlock() const noexcept {return mFirstReportBlock;} + + LossRLEReportBlock *firstLossRLEReportBlock() const noexcept {return mFirstLossRLEReportBlock;} + DuplicateRLEReportBlock *firstDuplicateRLEReportBlock() const noexcept {return mFirstDuplicateRLEReportBlock;} + PacketReceiptTimesReportBlock *firstPacketReceiptTimesReportBlock() const noexcept {return mFirstPacketReceiptTimesReportBlock;} + ReceiverReferenceTimeReportBlock *firstReceiverReferenceTimeReportBlock() const noexcept {return mFirstReceiverReferenceTimeReportBlock;} + DLRRReportBlock *firstDLRRReportBlock() const noexcept {return mFirstDLRRReportBlock;} + StatisticsSummaryReportBlock *firstStatisticsSummaryReportBlock() const noexcept {return mFirstStatisticsSummaryReportBlock;} + VoIPMetricsReportBlock *firstVoIPMetricsReportBlock() const noexcept {return mFirstVoIPMetricsReportBlock;} + UnknownReportBlock *firstUnknownReportBlock() const noexcept {return mFirstUnknownReportBlock;} + + size_t reportBlockCount() const noexcept {return mReportBlockCount;} + + size_t lossRLEReportBlockCount() const noexcept {return mLossRLEReportBlockCount;} + size_t duplicateRLEReportBlockCount() const noexcept {return mDuplicateRLEReportBlockCount;} + size_t packetReceiptTimesReportBlockCount() const noexcept {return mPacketReceiptTimesReportBlockCount;} + size_t receiverReferenceTimeReportBlockCount() const noexcept {return mReceiverReferenceTimeReportBlockCount;} + size_t dlrrReportBlockCount() const noexcept {return mDLRRReportBlockCount;} + size_t statisticsSummaryReportBlockCount() const noexcept {return mStatisticsSummaryReportBlockCount;} + size_t voIPMetricsReportBlockCount() const noexcept {return mVoIPMetricsReportBlockCount;} + size_t unknownReportBlockCount() const noexcept {return mUnknownReportBlockCount;} + + LossRLEReportBlock *lossRLEReportBlockAtIndex(size_t index) const noexcept; + DuplicateRLEReportBlock *duplicateRLEReportBlockAtIndex(size_t index) const noexcept; + PacketReceiptTimesReportBlock *packetReceiptTimesReportBlockAtIndex(size_t index) const noexcept; + ReceiverReferenceTimeReportBlock *receiverReferenceTimeReportBlockAtIndex(size_t index) const noexcept; + DLRRReportBlock *dlrrReportBlockAtIndex(size_t index) const noexcept; + StatisticsSummaryReportBlock *statisticsSummaryReportBlockAtIndex(size_t index) const noexcept; + VoIPMetricsReportBlock *voIPMetricsReportBlockAtIndex(size_t index) const noexcept; + UnknownReportBlock *unknownReportBlockAtIndex(size_t index) const noexcept; + + static bool isRunLengthChunk(RLEChunk chunk) noexcept; + static bool isBitVectorChunk(RLEChunk chunk) noexcept; + + static RunLength runLength(RLEChunk chunk) noexcept {return RunLength(chunk);} + static BitVector bitVector(RLEChunk chunk) noexcept {return BitVector(chunk);} + + public: + XR *mNextXR {}; + + DWORD mSSRC {}; + + size_t mReportBlockCount {}; + + size_t mLossRLEReportBlockCount {}; + size_t mDuplicateRLEReportBlockCount {}; + size_t mPacketReceiptTimesReportBlockCount {}; + size_t mReceiverReferenceTimeReportBlockCount {}; + size_t mDLRRReportBlockCount {}; + size_t mStatisticsSummaryReportBlockCount {}; + size_t mVoIPMetricsReportBlockCount {}; + size_t mUnknownReportBlockCount {}; + + ReportBlock *mFirstReportBlock {}; + + LossRLEReportBlock *mFirstLossRLEReportBlock {}; + DuplicateRLEReportBlock *mFirstDuplicateRLEReportBlock {}; + PacketReceiptTimesReportBlock *mFirstPacketReceiptTimesReportBlock {}; + ReceiverReferenceTimeReportBlock *mFirstReceiverReferenceTimeReportBlock {}; + DLRRReportBlock *mFirstDLRRReportBlock {}; + StatisticsSummaryReportBlock *mFirstStatisticsSummaryReportBlock {}; + VoIPMetricsReportBlock *mFirstVoIPMetricsReportBlock {}; + UnknownReportBlock *mFirstUnknownReportBlock {}; + }; + + //----------------------------------------------------------------------- + // + // RTCPPacket::UnknownReport + // + + struct UnknownReport : public Report + { + UnknownReport *nextUnknown() const noexcept {return mNextUnknown;} + + public: + UnknownReport *mNextUnknown {}; + }; + + public: + //----------------------------------------------------------------------- + // + // (public) + // + + RTCPPacket( + const make_private &, + MediaChannelID mediaChannelID + ) noexcept; + ~RTCPPacket() noexcept; + + static RTCPPacketPtr create( + const BYTE *buffer, + size_t bufferLengthInBytes, + MediaChannelID mediaChannelID = 0 + ) noexcept(false); // throws InvalidParameters + static RTCPPacketPtr create( + const SecureByteBlock &buffer, + MediaChannelID mediaChannelID = 0 + ) noexcept(false); // throws InvalidParameters + static RTCPPacketPtr create( + SecureByteBlockPtr buffer, + MediaChannelID mediaChannelID = 0 + ) noexcept(false); // NOTE: ownership of buffer is taken / assumed // throws InvalidParameters + static RTCPPacketPtr create( + const Report *first, + MediaChannelID mediaChannelID = 0 + ) noexcept(false); // throws InvalidParameters + static SecureByteBlockPtr generateFrom(const Report *first) noexcept(false); // throws InvalidParameters + + const BYTE *ptr() const noexcept; + size_t size() const noexcept; + SecureByteBlockPtr buffer() const noexcept; + + Report *first() const noexcept {return mFirst;} + + SenderReport *firstSenderReport() const noexcept {return mFirstSenderReport;} + ReceiverReport *firstReceiverReport() const noexcept {return mFirstReceiverReport;} + SDES *firstSDES() const noexcept {return mFirstSDES;} + Bye *firstBye() const noexcept {return mFirstBye;} + App *firstApp() const noexcept {return mFirstApp;} + TransportLayerFeedbackMessage *firstTransportLayerFeedbackMessage() const noexcept {return mFirstTransportLayerFeedbackMessage;} + PayloadSpecificFeedbackMessage *firstPayloadSpecificFeedbackMessage() const noexcept {return mFirstPayloadSpecificFeedbackMessage;} + XR *firstXR() const noexcept {return mFirstXR;} + UnknownReport *firstUnknownReport() const noexcept {return mFirstUnknownReport;} + + size_t count() const noexcept {return mCount;} + + size_t senderReportCount() const noexcept {return mSenderReportCount;} + size_t receiverReportCount() const noexcept {return mReceiverReportCount;} + size_t sdesCount() const noexcept {return mSDESCount;} + size_t byeCount() const noexcept {return mByeCount;} + size_t appCount() const noexcept {return mAppCount;} + size_t transportLayerFeedbackMessageCount() const noexcept {return mTransportLayerFeedbackMessageCount;} + size_t payloadSpecificFeedbackMessage() const noexcept {return mPayloadSpecificFeedbackMessageCount;} + size_t xrCount() const noexcept {return mXRCount;} + size_t unknownReportCount() const noexcept {return mUnknownReportCount;} + + SenderReport *senderReportAtIndex(size_t index) const noexcept; + ReceiverReport *receiverReportAtIndex(size_t index) const noexcept; + SDES *sdesAtIndex(size_t index) const noexcept; + Bye *byeAtIndex(size_t index) const noexcept; + App *appAtIndex(size_t index) const noexcept; + TransportLayerFeedbackMessage *transportLayerFeedbackReportAtIndex(size_t index) const noexcept; + PayloadSpecificFeedbackMessage *payloadSpecificFeedbackReportAtIndex(size_t index) const noexcept; + XR *xrAtIndex(size_t index) const noexcept; + UnknownReport *unknownAtIndex(size_t index) const noexcept; + + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept; + + protected: + //----------------------------------------------------------------------- + // + // (internal) + // + + bool parse() noexcept; + + bool getAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, BYTE pt, const BYTE *contents, size_t contentSize) noexcept; + bool getSenderReportAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getReceiverReportAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getSDESAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getByeAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getAppAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getTransportLayerFeedbackMessageAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getUnknownReportAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize) noexcept; + + bool getTransportLayerFeedbackMessageGenericNACKAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getTransportLayerFeedbackMessageTMMBRAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getTransportLayerFeedbackMessageTMMBNAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + + bool getPayloadSpecificFeedbackMessagePLIAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageSLIAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageRPSIAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageFIRAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageTSTRAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageTSTNAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageVBCMAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageAFBAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + bool getPayloadSpecificFeedbackMessageREMBAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize) noexcept; + + bool getXRLossRLEReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRDuplicateRLEReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRPacketReceiptTimesReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRReceiverReferenceTimeReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRDLRRReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRStatisticsSummaryReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRVoIPMetricsReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + bool getXRUnknownReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + + bool parse(Report * &ioLastReport, BYTE version, BYTE padding, BYTE reportSpecific, BYTE pt, const BYTE *contents, size_t contentSize) noexcept; + void fill(Report *report, BYTE version, BYTE padding, BYTE reportSpecific, BYTE pt, const BYTE *contents, size_t contentSize) noexcept; + + bool parseCommon( + SenderReceiverCommonReport *report, + size_t detailedHeaderSize + ) noexcept; + bool parse(SenderReport *report) noexcept; + bool parse(ReceiverReport *report) noexcept; + bool parse(SDES *report) noexcept; + bool parse(Bye *report) noexcept; + bool parse(App *report) noexcept; + bool parse(TransportLayerFeedbackMessage *report) noexcept; + bool parse(PayloadSpecificFeedbackMessage *report) noexcept; + bool parse(XR *report) noexcept; + bool parse(UnknownReport *report) noexcept; + + void fill(FeedbackMessage *report, const BYTE *contents, size_t contentSize) noexcept; + void fill(XR *report, XR::ReportBlock *reportBlock, XR::ReportBlock * &ioPreviousReportBlock, BYTE blockType, BYTE typeSpecific, const BYTE *contents, size_t contentSize) noexcept; + + bool parseGenericNACK(TransportLayerFeedbackMessage *report) noexcept; + void fillTMMBRCommon(TransportLayerFeedbackMessage *report, TransportLayerFeedbackMessage::TMMBRCommon *common, const BYTE *pos) noexcept; + bool parseTMMBR(TransportLayerFeedbackMessage *report) noexcept; + bool parseTMMBN(TransportLayerFeedbackMessage *report) noexcept; + bool parseUnknown(TransportLayerFeedbackMessage *report) noexcept; + + //CodecControlCommon + bool parsePLI(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseSLI(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseRPSI(PayloadSpecificFeedbackMessage *report) noexcept; + void fillCodecControlCommon(PayloadSpecificFeedbackMessage *report, PayloadSpecificFeedbackMessage::CodecControlCommon *common, const BYTE *pos) noexcept; + bool parseFIR(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseTSTR(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseTSTN(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseVBCM(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseAFB(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseREMB(PayloadSpecificFeedbackMessage *report) noexcept; + bool parseUnknown(PayloadSpecificFeedbackMessage *report) noexcept; + + bool parseCommonRange(XR *xr, XR::ReportBlockRange *reportBlock) noexcept; + bool parseCommonRLE(XR *xr, XR::RLEReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::LossRLEReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::DuplicateRLEReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::PacketReceiptTimesReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::ReceiverReferenceTimeReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::DLRRReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::StatisticsSummaryReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::VoIPMetricsReportBlock *reportBlock) noexcept; + bool parse(XR *xr, XR::UnknownReportBlock *reportBlock) noexcept; + + void *allocateBuffer(size_t size) noexcept; + + static size_t getPacketSize(const Report *first) noexcept(false); // throws InvalidParameters + static void writePacket(const Report *first, BYTE * &ioPos, size_t &ioRemaining) noexcept; + + public: + SecureByteBlockPtr mBuffer; + SecureByteBlockPtr mAllocationBuffer; + + MediaChannelID mMediaChannelID {}; + + BYTE *mAllocationPos {}; + size_t mAllocationSize {}; + + Report *mFirst {}; + + size_t mCount {}; + + size_t mSenderReportCount {}; + size_t mReceiverReportCount {}; + size_t mSDESCount {}; + size_t mByeCount {}; + size_t mAppCount {}; + size_t mTransportLayerFeedbackMessageCount {}; + size_t mPayloadSpecificFeedbackMessageCount {}; + size_t mXRCount {}; + size_t mUnknownReportCount {}; + + SenderReport *mFirstSenderReport {}; + ReceiverReport *mFirstReceiverReport {}; + SDES *mFirstSDES {}; + Bye *mFirstBye {}; + App *mFirstApp {}; + TransportLayerFeedbackMessage *mFirstTransportLayerFeedbackMessage {}; + PayloadSpecificFeedbackMessage *mFirstPayloadSpecificFeedbackMessage {}; + XR *mFirstXR {}; + UnknownReport *mFirstUnknownReport {}; + }; + +} // namespace ortc diff --git a/ortc/RTPPacket.h b/ortc/RTPPacket.h new file mode 100644 index 00000000..abfefa51 --- /dev/null +++ b/ortc/RTPPacket.h @@ -0,0 +1,466 @@ +/* + + Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include +#include + +namespace ortc +{ + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPPacket + // + + class RTPPacket + { + protected: + struct make_private {}; + + public: + struct HeaderExtension; + struct VideoOrientationHeaderExtension; + struct VideoOrientation6HeaderExtension; + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + + public: + //----------------------------------------------------------------------- + // + // RTPPacket::CreationParams + // + + struct CreationParams + { + MediaChannelID mMediaChannelID {}; + BYTE mVersion {2}; + size_t mPadding {}; + bool mM {}; + BYTE mPT {}; + WORD mSequenceNumber {}; + DWORD mTimestamp {}; + DWORD mSSRC {}; + + size_t mCC {}; + DWORD *mCSRCList {}; + + const BYTE *mPayload {}; + size_t mPayloadSize {}; + + HeaderExtension *mFirstHeaderExtension {}; + BYTE mHeaderExtensionAppBits {}; + + size_t mHeaderExtensionPrepaddedSize {}; + const BYTE *mHeaderExtensionStopParsePos {}; + size_t mHeaderExtensionStopParseSize {}; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::Extension + // + + struct HeaderExtension + { + // see https://tools.ietf.org/html/rfc5285 + + BYTE mID {}; + + const BYTE *mData {}; + size_t mDataSizeInBytes {}; + size_t mPostPaddingSize {}; + + HeaderExtension *mNext {}; + + virtual void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::ClientToMixerExtension + // + + struct ClientToMixerExtension : public HeaderExtension + { + // see https://tools.ietf.org/html/rfc6464 + + ClientToMixerExtension(const HeaderExtension &header) noexcept; + ClientToMixerExtension( + BYTE id, + bool voiceActivity, + BYTE level + ) noexcept; + + bool voiceActivity() const noexcept; + BYTE level() const noexcept; + + virtual void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + BYTE mLevelBuffer {}; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::MixerToClientExtension + // + + struct MixerToClientExtension : public HeaderExtension + { + // see https://tools.ietf.org/html/rfc6464 + + static const size_t kMaxLevelCount {0xF}; + + MixerToClientExtension(const HeaderExtension &header) noexcept; + MixerToClientExtension( + BYTE id, + BYTE *levels, + size_t count + ) noexcept; + + size_t levelsCount() const noexcept; + + BYTE unusedBit(size_t index) const noexcept; + BYTE level(size_t index) const noexcept; + + virtual void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + BYTE mLevelBuffer[kMaxLevelCount] {}; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::StringHeaderExtension + // + + struct StringHeaderExtension : public HeaderExtension + { + static const size_t kMaxStringLength {0xFF}; + + StringHeaderExtension(const HeaderExtension &header) noexcept; + StringHeaderExtension( + BYTE id, + const char *str + ) noexcept; + + const char *str() const noexcept; + + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + BYTE mStringBuffer[kMaxStringLength+sizeof(char)] {}; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::NumberHeaderExtension + // + + struct NumberHeaderExtension : public HeaderExtension + { + static const size_t kMaxNumberByteLength {0xFF}; + + NumberHeaderExtension(const HeaderExtension &header) noexcept; + NumberHeaderExtension( + BYTE id, + const BYTE *number, + size_t lengthInBytes + ) noexcept; + NumberHeaderExtension( + BYTE id, + const char *valueInBase10 + ) noexcept(false); // throws InvalidParameters + + const BYTE *number() const noexcept; + size_t length() const noexcept; + + String str() const noexcept; + + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + BYTE mNumberBuffer[kMaxNumberByteLength] {}; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::MidHeaderExtension + // + + struct MidHeaderExtension : public StringHeaderExtension + { + // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-23#section-14.3 + + static const size_t kMaxMidLength = kMaxStringLength; + + MidHeaderExtension(const HeaderExtension &header) noexcept : StringHeaderExtension(header) {} + MidHeaderExtension( + BYTE id, + const char *mid + ) noexcept : StringHeaderExtension(id, mid) {} + + const char *mid() const noexcept {return str();} + + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::RidHeaderExtension + // + + struct RidHeaderExtension : public StringHeaderExtension + { + // https://tools.ietf.org/html/draft-pthatcher-mmusic-rid-00 + + static const size_t kMaxMidLength = kMaxStringLength; + + RidHeaderExtension(const HeaderExtension &header) noexcept : StringHeaderExtension(header) {} + RidHeaderExtension( + BYTE id, + const char *rid + ) noexcept : StringHeaderExtension(id, rid) {} + + const char *rid() const noexcept {return str();} + + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::VideoOrientationHeaderExtension + // + + struct VideoOrientationHeaderExtension : public HeaderExtension + { + struct Clockwise {}; + struct CounterClockwise {}; + + VideoOrientationHeaderExtension(const HeaderExtension &header) noexcept; + VideoOrientationHeaderExtension(const VideoOrientation6HeaderExtension &) noexcept; + VideoOrientationHeaderExtension( + const Clockwise &, + bool frontFacingCamera, // true = front facing, false = backfacing + bool flip, // horizontal left-right flip (mirro) + UINT orientation + ) noexcept; + VideoOrientationHeaderExtension( + const CounterClockwise &, + bool frontFacingCamera, // true = front facing, false = backfacing + bool flip, // horizontal left-right flip (mirro) + UINT orientation + ) noexcept; + + bool frontFacing() const noexcept; + bool backFacing() const noexcept; + bool flip() const noexcept; + virtual UINT degreesClockwise() const noexcept; + virtual UINT degreesCounterClockwise() const noexcept; + + virtual void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; + + public: + BYTE mEncoded[1] {}; + }; + + //----------------------------------------------------------------------- + // + // RTPPacket::VideoOrientationHeaderExtension + // + + struct VideoOrientation6HeaderExtension : public VideoOrientationHeaderExtension + { + VideoOrientation6HeaderExtension(const HeaderExtension &header) noexcept; + VideoOrientation6HeaderExtension( + const Clockwise &, + bool frontFacingCamera, // true = front facing, false = backfacing + bool flip, // horizontal left-right flip (mirro) + UINT orientation + ) noexcept; + VideoOrientation6HeaderExtension( + const CounterClockwise &, + bool frontFacingCamera, // true = front facing, false = backfacing + bool flip, // horizontal left-right flip (mirro) + UINT orientation + ) noexcept; + + virtual UINT degreesClockwise() const noexcept override; + virtual UINT degreesCounterClockwise() const noexcept override; + + public: + }; + + public: + //----------------------------------------------------------------------- + // + // (public) + // + + RTPPacket( + const make_private &, + MediaChannelID mediaChannelID + ) noexcept; + ~RTPPacket() noexcept; + + static RTPPacketPtr create( + const RTPPacket &packet, + MediaChannelID mediaChannelID = 0 + ) noexcept; + static RTPPacketPtr create(const CreationParams ¶ms) noexcept; + static RTPPacketPtr create( + const BYTE *buffer, + size_t bufferLengthInBytes, + MediaChannelID mediaChannelID = 0 + ) noexcept; + static RTPPacketPtr create( + const SecureByteBlock &buffer, + MediaChannelID mediaChannelID = 0 + ) noexcept; + static RTPPacketPtr create( + SecureByteBlockPtr buffer, + MediaChannelID mediaChannelID = 0 + ) noexcept; // NOTE: exclusive ownership of buffer is taken / assumed + + MediaChannelID mediaChannelID() const noexcept {return mMediaChannelID;} + + const BYTE *ptr() const noexcept; + size_t size() const noexcept; + SecureByteBlockPtr buffer() const noexcept; + + BYTE version() const noexcept {return mVersion;} + size_t padding() const noexcept {return mPadding;} + size_t cc() const noexcept {return static_cast(mCC);} + bool m() const noexcept {return mM;} + BYTE pt() const noexcept {return mPT;} + WORD sequenceNumber() const noexcept {return mSequenceNumber;} + DWORD timestamp() const noexcept {return mTimestamp;} + DWORD ssrc() const noexcept {return mSSRC;} + + size_t headerSize() noexcept {return mHeaderSize;} + size_t headerExtensionSize() noexcept {return mHeaderExtensionSize;} + size_t payloadSize() noexcept {return mPayloadSize;} + + DWORD getCSRC(size_t index) const noexcept; + const BYTE *payload() const noexcept; + size_t payloadSize() const noexcept {return mPayloadSize;} + + size_t totalHeaderExtensions() const noexcept {return mTotalHeaderExtensions;} + HeaderExtension *firstHeaderExtension() const noexcept {return mHeaderExtensions;} + HeaderExtension *getHeaderExtensionAtIndex(size_t index) const noexcept; + BYTE headerExtensionAppBits() const noexcept {return mHeaderExtensionAppBits;} + + size_t headerExtensionPrepaddedSize() const noexcept {return mHeaderExtensionPrepaddedSize;} + const BYTE *headerExtensionParseStopped() const noexcept {return mHeaderExtensionParseStoppedPos;} + size_t headerExtensionParseStoppedSize() const noexcept {return mHeaderExtensionParseStoppedSize;} + + void changeHeaderExtensions(HeaderExtension *firstExtension) noexcept(false); // throws InvalidState + + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept; + + protected: + //----------------------------------------------------------------------- + // + // (internal) + // + + bool parse() noexcept; + + void writeHeaderExtensions( + HeaderExtension *firstExtension, + bool twoByteHeader + ) noexcept; + void generate(const RTPPacket ¶ms) noexcept; + void generate(const CreationParams ¶ms) noexcept(false); // throws InvalidState + + public: + SecureByteBlockPtr mBuffer; + + MediaChannelID mMediaChannelID {}; + + BYTE mVersion {}; + size_t mPadding {}; + BYTE mCC {}; + bool mM {}; + BYTE mPT {}; + WORD mSequenceNumber {}; + DWORD mTimestamp {}; + DWORD mSSRC {}; + + size_t mHeaderSize {}; + size_t mHeaderExtensionSize {}; + size_t mPayloadSize {}; + + size_t mTotalHeaderExtensions {}; + HeaderExtension *mHeaderExtensions {}; + BYTE mHeaderExtensionAppBits {}; + + size_t mHeaderExtensionPrepaddedSize {}; + const BYTE *mHeaderExtensionParseStoppedPos {}; + size_t mHeaderExtensionParseStoppedSize {}; + }; +} + diff --git a/ortc/adapter/IHelper.h b/ortc/adapter/IHelper.h index 09f66af6..c8fd941c 100644 --- a/ortc/adapter/IHelper.h +++ b/ortc/adapter/IHelper.h @@ -47,9 +47,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IHelper - #pragma mark + // + // IHelper + // interaction IHelper : public ortc::IHelper { @@ -82,8 +82,8 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtension, RTPHeaderExtension); ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionParameters, RTPHeaderExtensionParameters); - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionsList, RTPHeaderExtensionsList); - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionParametersList, RTPHeaderExtensionParametersList); + //ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionsList, RTPHeaderExtensionsList); + //ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionParametersList, RTPHeaderExtensionParametersList); ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::FECMechanism, RTPFECMechanism); ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::FECMechanismList, RTPFECMechanismList); @@ -91,7 +91,7 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::RTCPFeedback, RTPRTCPFeedback); ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::RTCPFeedbackList, RTPRTCPFeedbackList); - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::CodecParametersList, RTPCodecParametersList); + //ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::CodecParametersList, RTPCodecParametersList); typedef IRTPTypes::CodecKinds RTPCodecKinds; @@ -105,141 +105,141 @@ namespace ortc IDPreference_Last = IDPreference_Remote, }; - static const char *toString(IDPreferences pref); - static bool useLocal(IDPreferences pref) { return pref == IDPreference_Local; } - static bool useRemote(IDPreferences pref) { return pref == IDPreference_Remote; } - static IRTPTypes::SSRCType getRandomSSRC(); + static const char *toString(IDPreferences pref) noexcept; + static bool useLocal(IDPreferences pref) noexcept { return pref == IDPreference_Local; } + static bool useRemote(IDPreferences pref) noexcept { return pref == IDPreference_Remote; } + static IRTPTypes::SSRCType getRandomSSRC() noexcept; static SSRCType peekNextSSRC( IMediaStreamTrackTypes::Kinds kind, SSRCQueue &audioSSRCQueue, SSRCQueue &videoSSRCQueue - ); + ) noexcept; static SSRCType getNextSSRC( IMediaStreamTrackTypes::Kinds kind, SSRCQueue &audioSSRCQueue, SSRCQueue &videoSSRCQueue - ); + ) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (conversion) - #pragma mark + // + // Negotiation (conversion) + // - static RTPParametersPtr capabilitiesToParameters(const RTPCapabilities &capabilities); - static RTPCapabilitiesPtr parametersToCapabilities(const RTPParameters ¶meters); + static RTPParametersPtr capabilitiesToParameters(const RTPCapabilities &capabilities) noexcept; + static RTPCapabilitiesPtr parametersToCapabilities(const RTPParameters ¶meters) noexcept; - static RTPCodecParametersListPtr capabilitiesToParameters(const RTPCodecCapabilitiesList &capabiliites); - static RTPCodecCapabilitiesListPtr parametersToCapabilities(const RTPCodecParametersList ¶meters); + static RTPCodecParametersListPtr capabilitiesToParameters(const RTPCodecCapabilitiesList &capabiliites) noexcept; + static RTPCodecCapabilitiesListPtr parametersToCapabilities(const RTPCodecParametersList ¶meters) noexcept; - static RTPCodecParametersPtr capabilitiesToParameters(const RTPCodecCapability &capabilities); - static RTPCodecCapabilityPtr parametersToCapabilities(const RTPCodecParameters ¶meters); + static RTPCodecParametersPtr capabilitiesToParameters(const RTPCodecCapability &capabilities) noexcept; + static RTPCodecCapabilityPtr parametersToCapabilities(const RTPCodecParameters ¶meters) noexcept; - static RTPOpusCodecParametersPtr opusCodecCapabilityParametersToParameters(const RTPOpusCodecCapabilityParameters &capabilityParameters); - static RTPOpusCodecCapabilityParametersPtr opusCodecParametersToCapabilityParameters(const RTPOpusCodecParameters ¶meters); + static RTPOpusCodecParametersPtr opusCodecCapabilityParametersToParameters(const RTPOpusCodecCapabilityParameters &capabilityParameters) noexcept; + static RTPOpusCodecCapabilityParametersPtr opusCodecParametersToCapabilityParameters(const RTPOpusCodecParameters ¶meters) noexcept; - static RTPVP8CodecParametersPtr vp8CodecCapabilityParametersToParameters(const RTPVP8CodecCapabilityParameters &capabilityParameters); - static RTPVP8CodecCapabilityParametersPtr vp8CodecParametersToCapabilityParameters(const RTPVP8CodecParameters ¶meters); + static RTPVP8CodecParametersPtr vp8CodecCapabilityParametersToParameters(const RTPVP8CodecCapabilityParameters &capabilityParameters) noexcept; + static RTPVP8CodecCapabilityParametersPtr vp8CodecParametersToCapabilityParameters(const RTPVP8CodecParameters ¶meters) noexcept; - static RTPH264CodecParametersPtr h264CodecCapabilityParametersToParameters(const RTPH264CodecCapabilityParameters &capabilityParameters); - static RTPH264CodecCapabilityParametersPtr h264CodecParametersToCapabilityParameters(const RTPH264CodecParameters ¶meters); + static RTPH264CodecParametersPtr h264CodecCapabilityParametersToParameters(const RTPH264CodecCapabilityParameters &capabilityParameters) noexcept; + static RTPH264CodecCapabilityParametersPtr h264CodecParametersToCapabilityParameters(const RTPH264CodecParameters ¶meters) noexcept; - static RTPRTXCodecParametersPtr rtxCodecCapabilityParametersToParameters(const RTPRTXCodecCapabilityParameters &capabilityParameters); - static RTPRTXCodecCapabilityParametersPtr rtxCodecParametersToCapabilityParameters(const RTPRTXCodecParameters ¶meters); + static RTPRTXCodecParametersPtr rtxCodecCapabilityParametersToParameters(const RTPRTXCodecCapabilityParameters &capabilityParameters) noexcept; + static RTPRTXCodecCapabilityParametersPtr rtxCodecParametersToCapabilityParameters(const RTPRTXCodecParameters ¶meters) noexcept; - static RTPFlexFECCodecParametersPtr flexFECCodecCapabilityParametersToParameters(const RTPFlexFECCodecCapabilityParameters &capabilityParameters); - static RTPFlexFECCodecCapabilityParametersPtr flexFECCodecParametersToCapabilityParameters(const RTPFlexFECCodecParameters ¶meters); + static RTPFlexFECCodecParametersPtr flexFECCodecCapabilityParametersToParameters(const RTPFlexFECCodecCapabilityParameters &capabilityParameters) noexcept; + static RTPFlexFECCodecCapabilityParametersPtr flexFECCodecParametersToCapabilityParameters(const RTPFlexFECCodecParameters ¶meters) noexcept; - static RTPHeaderExtensionParametersListPtr capabilitiesToParameters(const RTPHeaderExtensionsList &capabilities); - static RTPHeaderExtensionsListPtr parametersToCapabilities(const RTPHeaderExtensionParametersList ¶meters); + static RTPHeaderExtensionParametersListPtr capabilitiesToParameters(const RTPHeaderExtensionsList &capabilities) noexcept; + static RTPHeaderExtensionsListPtr parametersToCapabilities(const RTPHeaderExtensionParametersList ¶meters) noexcept; - static RTPHeaderExtensionParametersPtr capabilitiesToParameters(const RTPHeaderExtension &capabilities); - static RTPHeaderExtensionPtr parametersToCapabilities(const RTPHeaderExtensionParameters ¶meters); + static RTPHeaderExtensionParametersPtr capabilitiesToParameters(const RTPHeaderExtension &capabilities) noexcept; + static RTPHeaderExtensionPtr parametersToCapabilities(const RTPHeaderExtensionParameters ¶meters) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (unions) - #pragma mark + // + // Negotiation (unions) + // static RTPCapabilitiesPtr createUnion( const RTPCapabilities &localCapabilities, const RTPCapabilities &remoteCapabilities, IDPreferences preference - ); + ) noexcept; static RTPCodecCapabilitiesListPtr createUnion( const RTPCodecCapabilitiesList &local, const RTPCodecCapabilitiesList &remote, IDPreferences preference - ); + ) noexcept; static RTPHeaderExtensionsListPtr createUnion( const RTPHeaderExtensionsList &local, const RTPHeaderExtensionsList &remote, IDPreferences preference - ); + ) noexcept; static RTPFECMechanismListPtr createUnion( const RTPFECMechanismList &local, const RTPFECMechanismList &remote, IDPreferences preference - ); + ) noexcept; static RTPRTCPFeedbackListPtr createUnion( const RTPRTCPFeedbackList &local, const RTPRTCPFeedbackList &remote, IDPreferences preference - ); + ) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (filter) - #pragma mark + // + // Negotiation (filter) + // static RTPParametersPtr filterParameters( const RTPParameters ¶meters, const RTPCapabilities &capabilities - ); + ) noexcept; static RTPCodecParametersListPtr filterParameters( const RTPCodecParametersList &codecParameters, const RTPCodecCapabilitiesList &codecCapabilities - ); + ) noexcept; static RTPHeaderExtensionParametersListPtr filterParameters( const RTPHeaderExtensionParametersList &headerParameters, const RTPHeaderExtensionsList &headerCapabilities - ); + ) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (validation) - #pragma mark + // + // Negotiation (validation) + // static bool isCompatible( const RTPCapabilities &capabilities, const RTPParameters ¶meters - ); + ) noexcept; static bool isCompatible( const RTPCapabilities &existingCapabilities, const RTPCapabilities &proposedCapabilities - ); + ) noexcept; - static bool hasSupportedMediaCodec(const RTPCapabilities &capabilities); - static bool hasSupportedMediaCodec(const RTPParameters ¶meters); + static bool hasSupportedMediaCodec(const RTPCapabilities &capabilities) noexcept; + static bool hasSupportedMediaCodec(const RTPParameters ¶meters) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (fill) - #pragma mark + // + // Negotiation (fill) + // struct FillParametersOptions { FillParametersOptions( SSRCQueue &audioQueue, SSRCQueue &videoQueue - ) : mAudioSSRCQueue(&audioQueue), mVideoSSRCQueue(&videoQueue) {} + ) noexcept : mAudioSSRCQueue(&audioQueue), mVideoSSRCQueue(&videoQueue) {} SSRCQueue *mAudioSSRCQueue {}; SSRCQueue *mVideoSSRCQueue {}; @@ -249,7 +249,7 @@ namespace ortc RTPParameters &ioParameters, const RTPCapabilities &capabilities, FillParametersOptions *options = NULL - ); + ) noexcept; }; } } diff --git a/ortc/adapter/IMediaStream.h b/ortc/adapter/IMediaStream.h index 6b309978..50045b87 100644 --- a/ortc/adapter/IMediaStream.h +++ b/ortc/adapter/IMediaStream.h @@ -42,9 +42,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTypes - #pragma mark + // + // IMediaStreamTypes + // interaction IMediaStreamTypes { @@ -56,9 +56,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStream - #pragma mark + // + // IMediaStream + // interface IMediaStream : public IMediaStreamTypes, public IStatsProvider @@ -66,40 +66,40 @@ namespace ortc static IMediaStreamPtr create( IMediaStreamDelegatePtr delegate, IMediaStreamPtr stream = IMediaStreamPtr() - ); + ) noexcept; static IMediaStreamPtr create( IMediaStreamDelegatePtr delegate, const MediaStreamTrackList &tracks - ); + ) noexcept; - static ElementPtr toDebug(IMediaStreamPtr stream); + static ElementPtr toDebug(IMediaStreamPtr stream) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IMediaStreamSubscriptionPtr subscribe(IMediaStreamDelegatePtr delegate) = 0; + virtual IMediaStreamSubscriptionPtr subscribe(IMediaStreamDelegatePtr delegate) noexcept = 0; - virtual String id() const = 0; - virtual bool active() const = 0; + virtual String id() const noexcept = 0; + virtual bool active() const noexcept = 0; - virtual MediaStreamTrackListPtr getAudioTracks() const = 0; - virtual MediaStreamTrackListPtr getVideoTracks() const = 0; - virtual MediaStreamTrackListPtr getTracks() const = 0; - virtual IMediaStreamTrackPtr getTrackByID(const char *id) const = 0; - virtual size_t size() const = 0; + virtual MediaStreamTrackListPtr getAudioTracks() const noexcept = 0; + virtual MediaStreamTrackListPtr getVideoTracks() const noexcept = 0; + virtual MediaStreamTrackListPtr getTracks() const noexcept = 0; + virtual IMediaStreamTrackPtr getTrackByID(const char *id) const noexcept = 0; + virtual size_t size() const noexcept = 0; - virtual void addTrack(IMediaStreamTrackPtr track) = 0; - virtual void removeTrack(IMediaStreamTrackPtr track) = 0; + virtual void addTrack(IMediaStreamTrackPtr track) noexcept = 0; + virtual void removeTrack(IMediaStreamTrackPtr track) noexcept = 0; - virtual IMediaStreamPtr clone() const = 0; + virtual IMediaStreamPtr clone() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamDelegate - #pragma mark + // + // IMediaStreamDelegate + // interface IMediaStreamDelegate { @@ -117,17 +117,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionSubscription - #pragma mark + // + // IPeerConnectionSubscription + // interaction IMediaStreamSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } } @@ -136,14 +136,14 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::adapter::IMediaStreamDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::adapter::IMediaStreamPtr, IMediaStreamPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) -ZS_DECLARE_PROXY_METHOD_2(onMediaStreamAddTrack, IMediaStreamPtr, IMediaStreamTrackPtr) -ZS_DECLARE_PROXY_METHOD_2(onMediaStreamRemoveTrack, IMediaStreamPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamAddTrack, IMediaStreamPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamRemoveTrack, IMediaStreamPtr, IMediaStreamTrackPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::adapter::IMediaStreamDelegate, ortc::adapter::IMediaStreamSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::adapter::IMediaStreamPtr, IMediaStreamPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onMediaStreamAddTrack, IMediaStreamPtr, IMediaStreamTrackPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onMediaStreamRemoveTrack, IMediaStreamPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamAddTrack, IMediaStreamPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamRemoveTrack, IMediaStreamPtr, IMediaStreamTrackPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/adapter/IPeerConnection.h b/ortc/adapter/IPeerConnection.h index effe67f3..19aa5d19 100644 --- a/ortc/adapter/IPeerConnection.h +++ b/ortc/adapter/IPeerConnection.h @@ -48,9 +48,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes - #pragma mark + // + // IPeerConnectionTypes + // interaction IPeerConnectionTypes { @@ -90,7 +90,7 @@ namespace ortc BundlePolicy_Last = BundlePolicy_MaxBundle, }; - static const char *toString(BundlePolicies policy); + static const char *toString(BundlePolicies policy) noexcept; enum RTCPMuxPolicies { @@ -102,7 +102,7 @@ namespace ortc RTCPMuxPolicy_Last = RTCPMuxPolicy_Require, }; - static const char *toString(RTCPMuxPolicies policy); + static const char *toString(RTCPMuxPolicies policy) noexcept; enum SignalingModes { @@ -114,12 +114,12 @@ namespace ortc SignalingMode_Last = SignalingMode_SDP, }; - static const char *toString(SignalingModes mode); - static SignalingModes toSignalingMode(const char *mode); + static const char *toString(SignalingModes mode) noexcept; + static SignalingModes toSignalingMode(const char *mode) noexcept(false); static bool isCompatible( SignalingModes mode, ISessionDescriptionTypes::SignalingTypes signalingType - ); + ) noexcept; enum SignalingStates { @@ -135,7 +135,7 @@ namespace ortc SignalingState_Last = SignalingState_Closed, }; - static const char *toString(SignalingStates state); + static const char *toString(SignalingStates state) noexcept; enum PeerConnectionStates { @@ -151,7 +151,7 @@ namespace ortc PeerConnectionState_Last = PeerConnectionState_Closed, }; - static const char *toString(PeerConnectionStates state); + static const char *toString(PeerConnectionStates state) noexcept; struct Configuration { @@ -167,33 +167,33 @@ namespace ortc ISCTPTransportTypes::SocketOptions mSCTPSocketOptions; - Configuration() {} - Configuration(const Configuration &op2); - ElementPtr toDebug() const; + Configuration() noexcept {} + Configuration(const Configuration &op2) noexcept; + ElementPtr toDebug() const noexcept; }; struct OfferAnswerOptions { bool mVoiceActivityDetection {true}; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct OfferOptions : public OfferAnswerOptions { bool mICERestart {false}; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct AnswerOptions : public OfferAnswerOptions { - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct CapabilityOptions : public OfferAnswerOptions { - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct MediaStreamTrackConfiguration @@ -201,12 +201,12 @@ namespace ortc IRTPTypes::CapabilitiesPtr mCapabilities; IRTPTypes::ParametersPtr mParameters; - MediaStreamTrackConfiguration() {} - MediaStreamTrackConfiguration(const MediaStreamTrackConfiguration &op2); + MediaStreamTrackConfiguration() noexcept {} + MediaStreamTrackConfiguration(const MediaStreamTrackConfiguration &op2) noexcept; - MediaStreamTrackConfiguration &operator=(const MediaStreamTrackConfiguration &op2); + MediaStreamTrackConfiguration &operator=(const MediaStreamTrackConfiguration &op2) noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct ICECandidateErrorEvent @@ -223,7 +223,7 @@ namespace ortc Optional mErrorCode; String mErrorText; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct MediaStreamTrackEvent @@ -234,7 +234,7 @@ namespace ortc IMediaStreamTrackPtr mTrack; MediaStreamList mMediaStreams; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; }; @@ -243,9 +243,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnection - #pragma mark + // + // IPeerConnection + // interface IPeerConnection : public IPeerConnectionTypes, public IStatsProvider @@ -253,64 +253,66 @@ namespace ortc static IPeerConnectionPtr create( IPeerConnectionDelegatePtr delegate, const Optional &configuration = Optional() - ); + ) noexcept; - virtual IPeerConnectionSubscriptionPtr subscribe(IPeerConnectionDelegatePtr delegate) = 0; + virtual PUID getID() const noexcept = 0; - virtual PromiseWithDescriptionPtr createOffer(const Optional &configuration = Optional()) = 0; - virtual PromiseWithDescriptionPtr createAnswer(const Optional &configuration = Optional()) = 0; + virtual IPeerConnectionSubscriptionPtr subscribe(IPeerConnectionDelegatePtr delegate) noexcept = 0; - virtual PromiseWithDescriptionPtr createCapabilities(const Optional &configuration = Optional()) = 0; + virtual PromiseWithDescriptionPtr createOffer(const Optional &configuration = Optional()) noexcept = 0; + virtual PromiseWithDescriptionPtr createAnswer(const Optional &configuration = Optional()) noexcept = 0; - virtual PromisePtr setLocalDescription(ISessionDescriptionPtr description) = 0; + virtual PromiseWithDescriptionPtr createCapabilities(const Optional &configuration = Optional()) noexcept = 0; - virtual ISessionDescriptionPtr localDescription() const = 0; - virtual ISessionDescriptionPtr currentDescription() const = 0; - virtual ISessionDescriptionPtr pendingDescription() const = 0; + virtual PromisePtr setLocalDescription(ISessionDescriptionPtr description) noexcept = 0; - virtual PromisePtr setRemoteDescription(ISessionDescriptionPtr description) = 0; - virtual ISessionDescriptionPtr remoteDescription() const = 0; - virtual ISessionDescriptionPtr currentRemoteDescription() const = 0; - virtual ISessionDescriptionPtr pendingRemoteDescription() const = 0; - virtual void addICECandidate(const ICECandidate &candidate) = 0; + virtual ISessionDescriptionPtr localDescription() const noexcept = 0; + virtual ISessionDescriptionPtr currentDescription() const noexcept = 0; + virtual ISessionDescriptionPtr pendingDescription() const noexcept = 0; - virtual SignalingStates signalingState() const = 0; - virtual ICEGatheringStates iceGatheringState() const = 0; - virtual ICEConnectionStates iceConnectionState() const = 0; - virtual PeerConnectionStates connectionState() const = 0; - virtual bool canTrickleCandidates() const = 0; + virtual PromisePtr setRemoteDescription(ISessionDescriptionPtr description) noexcept = 0; + virtual ISessionDescriptionPtr remoteDescription() const noexcept = 0; + virtual ISessionDescriptionPtr currentRemoteDescription() const noexcept = 0; + virtual ISessionDescriptionPtr pendingRemoteDescription() const noexcept = 0; + virtual void addICECandidate(const ICECandidate &candidate) noexcept = 0; - static ServerListPtr getDefaultIceServers(); + virtual SignalingStates signalingState() const noexcept = 0; + virtual ICEGatheringStates iceGatheringState() const noexcept = 0; + virtual ICEConnectionStates iceConnectionState() const noexcept = 0; + virtual PeerConnectionStates connectionState() const noexcept = 0; + virtual bool canTrickleCandidates() const noexcept = 0; - virtual ConfigurationPtr getConfiguration() const = 0; - virtual void setConfiguration(const Configuration &configuration) = 0; + static ServerListPtr getDefaultIceServers() noexcept; - virtual void close() = 0; + virtual ConfigurationPtr getConfiguration() const noexcept = 0; + virtual void setConfiguration(const Configuration &configuration) noexcept = 0; - virtual SenderListPtr getSenders() const = 0; - virtual ReceiverListPtr getReceivers() const = 0; + virtual void close() noexcept = 0; + + virtual SenderListPtr getSenders() const noexcept = 0; + virtual ReceiverListPtr getReceivers() const noexcept = 0; virtual PromiseWithSenderPtr addTrack( IMediaStreamTrackPtr track, const MediaStreamTrackConfiguration &configuration = MediaStreamTrackConfiguration() - ) = 0; + ) noexcept = 0; virtual PromiseWithSenderPtr addTrack( IMediaStreamTrackPtr track, const MediaStreamList &mediaStreams, const MediaStreamTrackConfiguration &configuration = MediaStreamTrackConfiguration() - ) = 0; + ) noexcept = 0; - virtual void removeTrack(IRTPSenderPtr sender) = 0; + virtual void removeTrack(IRTPSenderPtr sender) noexcept = 0; - virtual PromiseWithDataChannelPtr createDataChannel(const IDataChannelTypes::Parameters ¶meters) = 0; + virtual PromiseWithDataChannelPtr createDataChannel(const IDataChannelTypes::Parameters ¶meters) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionDelegate - #pragma mark + // + // IPeerConnectionDelegate + // interface IPeerConnectionDelegate { @@ -369,17 +371,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionSubscription - #pragma mark + // + // IPeerConnectionSubscription + // interaction IPeerConnectionSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } } @@ -394,16 +396,16 @@ ZS_DECLARE_PROXY_TYPEDEF(ortc::adapter::IPeerConnectionTypes::SignalingStates, S ZS_DECLARE_PROXY_TYPEDEF(ortc::adapter::IPeerConnectionTypes::PeerConnectionStates, PeerConnectionStates) ZS_DECLARE_PROXY_TYPEDEF(ortc::adapter::IPeerConnectionTypes::MediaStreamTrackEventPtr, MediaStreamTrackEventPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IDataChannelPtr, IDataChannelPtr) -ZS_DECLARE_PROXY_METHOD_1(onPeerConnectionNegotiationNeeded, IPeerConnectionPtr) -ZS_DECLARE_PROXY_METHOD_3(onPeerConnectionIceCandidate, IPeerConnectionPtr, ICECandidatePtr, const char *) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionIceCandidateError, IPeerConnectionPtr, ICECandidateErrorEventPtr) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionSignalingStateChange, IPeerConnectionPtr, SignalingStates) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionICEGatheringStateChange, IPeerConnectionPtr, ICEGatheringStates) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionICEConnectionStateChange, IPeerConnectionPtr, ICEConnectionStates) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionConnectionStateChange, IPeerConnectionPtr, PeerConnectionStates) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionTrack, IPeerConnectionPtr, MediaStreamTrackEventPtr) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionTrackGone, IPeerConnectionPtr, MediaStreamTrackEventPtr) -ZS_DECLARE_PROXY_METHOD_2(onPeerConnectionDataChannel, IPeerConnectionPtr, IDataChannelPtr) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionNegotiationNeeded, IPeerConnectionPtr) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionIceCandidate, IPeerConnectionPtr, ICECandidatePtr, const char *) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionIceCandidateError, IPeerConnectionPtr, ICECandidateErrorEventPtr) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionSignalingStateChange, IPeerConnectionPtr, SignalingStates) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionICEGatheringStateChange, IPeerConnectionPtr, ICEGatheringStates) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionICEConnectionStateChange, IPeerConnectionPtr, ICEConnectionStates) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionConnectionStateChange, IPeerConnectionPtr, PeerConnectionStates) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionTrack, IPeerConnectionPtr, MediaStreamTrackEventPtr) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionTrackGone, IPeerConnectionPtr, MediaStreamTrackEventPtr) +ZS_DECLARE_PROXY_METHOD(onPeerConnectionDataChannel, IPeerConnectionPtr, IDataChannelPtr) ZS_DECLARE_PROXY_END() @@ -416,14 +418,14 @@ ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::adapter::IPeerConnectionTypes::ICEC ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::adapter::IPeerConnectionTypes::PeerConnectionStates, PeerConnectionStates) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::adapter::IPeerConnectionTypes::MediaStreamTrackEventPtr, MediaStreamTrackEventPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IDataChannelPtr, IDataChannelPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_1(onPeerConnectionNegotiationNeeded, IPeerConnectionPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_3(onPeerConnectionIceCandidate, IPeerConnectionPtr, ICECandidatePtr, const char *) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionIceCandidateError, IPeerConnectionPtr, ICECandidateErrorEventPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionSignalingStateChange, IPeerConnectionPtr, SignalingStates) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionICEGatheringStateChange, IPeerConnectionPtr, ICEGatheringStates) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionICEConnectionStateChange, IPeerConnectionPtr, ICEConnectionStates) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionConnectionStateChange, IPeerConnectionPtr, PeerConnectionStates) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionTrack, IPeerConnectionPtr, MediaStreamTrackEventPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionTrackGone, IPeerConnectionPtr, MediaStreamTrackEventPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onPeerConnectionDataChannel, IPeerConnectionPtr, IDataChannelPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionNegotiationNeeded, IPeerConnectionPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionIceCandidate, IPeerConnectionPtr, ICECandidatePtr, const char *) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionIceCandidateError, IPeerConnectionPtr, ICECandidateErrorEventPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionSignalingStateChange, IPeerConnectionPtr, SignalingStates) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionICEGatheringStateChange, IPeerConnectionPtr, ICEGatheringStates) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionICEConnectionStateChange, IPeerConnectionPtr, ICEConnectionStates) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionConnectionStateChange, IPeerConnectionPtr, PeerConnectionStates) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionTrack, IPeerConnectionPtr, MediaStreamTrackEventPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionTrackGone, IPeerConnectionPtr, MediaStreamTrackEventPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onPeerConnectionDataChannel, IPeerConnectionPtr, IDataChannelPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/adapter/ISessionDescription.h b/ortc/adapter/ISessionDescription.h index e8c59a30..2c88895d 100644 --- a/ortc/adapter/ISessionDescription.h +++ b/ortc/adapter/ISessionDescription.h @@ -50,9 +50,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes - #pragma mark + // + // ISessionDescriptionTypes + // interaction ISessionDescriptionTypes { @@ -99,8 +99,8 @@ namespace ortc SignalingType_Last = SignalingType_SDPRollback, }; - static const char *toString(SignalingTypes type); - static SignalingTypes toSignalingType(const char *type); + static const char *toString(SignalingTypes type) noexcept; + static SignalingTypes toSignalingType(const char *type) noexcept(false); enum MediaTypes { @@ -116,9 +116,9 @@ namespace ortc MediaType_Last = MediaType_Application, }; - static const char *toString(MediaTypes mediaType); - static MediaTypes toMediaType(const char *mediaType); - static Optional toMediaStreamTrackKind(MediaTypes mediaType); + static const char *toString(MediaTypes mediaType) noexcept; + static MediaTypes toMediaType(const char *mediaType) noexcept; + static Optional toMediaStreamTrackKind(MediaTypes mediaType) noexcept; enum MediaDirections { @@ -132,8 +132,8 @@ namespace ortc MediaDirection_Last = MediaDirection_Inactive, }; - static const char *toString(MediaDirections mediaDirection); - static MediaDirections toMediaDirection(const char *mediaDirection); + static const char *toString(MediaDirections mediaDirection) noexcept; + static MediaDirections toMediaDirection(const char *mediaDirection) noexcept(false); struct ConnectionData { @@ -146,29 +146,29 @@ namespace ortc String mAddrType; String mConnectionAddress; - Details() {} - Details(const Details &op2) { (*this) = op2; } - Details(ElementPtr rootEl); + Details() noexcept {} + Details(const Details &op2) noexcept { (*this) = op2; } + Details(ElementPtr rootEl) noexcept; - static DetailsPtr create(ElementPtr rootEl) { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } - ElementPtr createElement(const char *objectName = "details") const; + static DetailsPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } + ElementPtr createElement(const char *objectName = "details") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; DetailsPtr mRTP; DetailsPtr mRTCP; - ConnectionData() {} - ConnectionData(const ConnectionData &op2); - ConnectionData(ElementPtr); + ConnectionData() noexcept {} + ConnectionData(const ConnectionData &op2) noexcept; + ConnectionData(ElementPtr) noexcept; - static ConnectionDataPtr create(ElementPtr rootEl) { if (!rootEl) return ConnectionDataPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "connectionData") const; + static ConnectionDataPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return ConnectionDataPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "connectionData") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; struct Transport @@ -183,17 +183,17 @@ namespace ortc ICECandidateList mICECandidates; bool mEndOfCandidates {false}; - Parameters() {} - Parameters(const Parameters &op2); - Parameters(ElementPtr rootEl); + Parameters() noexcept {} + Parameters(const Parameters &op2) noexcept; + Parameters(ElementPtr rootEl) noexcept; - Parameters &operator=(const Parameters &op2) = delete; + Parameters &operator=(const Parameters &op2) noexcept = delete; - static ParametersPtr create(ElementPtr rootEl) { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName) const; + static ParametersPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return ParametersPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName) const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; TransportID mID; @@ -201,17 +201,17 @@ namespace ortc ParametersPtr mRTCP; bool mUseMux {true}; - Transport() {} - Transport(const Transport &op2); - Transport(ElementPtr rootEl); + Transport() noexcept {} + Transport(const Transport &op2) noexcept; + Transport(ElementPtr rootEl) noexcept; - Transport &operator=(const Transport &op2) = delete; + Transport &operator=(const Transport &op2) noexcept = delete; - static TransportPtr create(ElementPtr rootEl) { if (!rootEl) return TransportPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "transport") const; + static TransportPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return TransportPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "transport") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; struct MediaLine : public Any @@ -228,17 +228,17 @@ namespace ortc ConnectionDataPtr mConnectionData; MediaDirections mMediaDirection {MediaDirection_SendReceive}; - Details() {} - Details(const Details &op2); - Details(ElementPtr rootEl); + Details() noexcept {} + Details(const Details &op2) noexcept; + Details(ElementPtr rootEl) noexcept; - Details &operator=(const Details &op2) = delete; + Details &operator=(const Details &op2) noexcept = delete; - static DetailsPtr create(ElementPtr rootEl) { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } - ElementPtr createElement(const char *objectName = "details") const; + static DetailsPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } + ElementPtr createElement(const char *objectName = "details") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; MediaLineID mID; @@ -248,15 +248,15 @@ namespace ortc DetailsPtr mDetails; protected: - MediaLine() {} - MediaLine(const MediaLine &op2); - MediaLine(ElementPtr rootEl); + MediaLine() noexcept {} + MediaLine(const MediaLine &op2) noexcept; + MediaLine(ElementPtr rootEl) noexcept; - MediaLine &operator=(const MediaLine &op2) = delete; + MediaLine &operator=(const MediaLine &op2) noexcept = delete; - ElementPtr createElement(const char *objectName) const; - ElementPtr toDebug() const; - String hash() const; + ElementPtr createElement(const char *objectName) const noexcept; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; struct RTPMediaLine : public MediaLine @@ -264,17 +264,17 @@ namespace ortc RTPCapabilitiesPtr mSenderCapabilities; RTPCapabilitiesPtr mReceiverCapabilities; - RTPMediaLine() {} - RTPMediaLine(const RTPMediaLine &op2); - RTPMediaLine(ElementPtr rootEl); + RTPMediaLine() noexcept {} + RTPMediaLine(const RTPMediaLine &op2) noexcept; + RTPMediaLine(ElementPtr rootEl) noexcept; - RTPMediaLine &operator=(const RTPMediaLine &op2) = delete; + RTPMediaLine &operator=(const RTPMediaLine &op2) noexcept = delete; - static RTPMediaLinePtr create(ElementPtr rootEl) { if (!rootEl) return RTPMediaLinePtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "rtpMediaLine") const; + static RTPMediaLinePtr create(ElementPtr rootEl) noexcept { if (!rootEl) return RTPMediaLinePtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "rtpMediaLine") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; struct SCTPMediaLine : public MediaLine @@ -282,17 +282,17 @@ namespace ortc SCTPCapabilitiesPtr mCapabilities; Optional mPort; - SCTPMediaLine() {} - SCTPMediaLine(const SCTPMediaLine &op2); - SCTPMediaLine(ElementPtr rootEl); + SCTPMediaLine() noexcept {} + SCTPMediaLine(const SCTPMediaLine &op2) noexcept; + SCTPMediaLine(ElementPtr rootEl) noexcept; - SCTPMediaLine &operator=(const SCTPMediaLine &op2) = delete; + SCTPMediaLine &operator=(const SCTPMediaLine &op2) noexcept = delete; - static SCTPMediaLinePtr create(ElementPtr rootEl) { if (!rootEl) return SCTPMediaLinePtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "sctpMediaLine") const; + static SCTPMediaLinePtr create(ElementPtr rootEl) noexcept { if (!rootEl) return SCTPMediaLinePtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "sctpMediaLine") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; struct RTPSender @@ -303,17 +303,17 @@ namespace ortc { Optional mInternalRTPMediaLineIndex; - Details() {} - Details(const Details &op2); - Details(ElementPtr rootEl); + Details() noexcept {} + Details(const Details &op2) noexcept; + Details(ElementPtr rootEl) noexcept; - Details &operator=(const Details &op2) = delete; + Details &operator=(const Details &op2) noexcept = delete; - static DetailsPtr create(ElementPtr rootEl) { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } - ElementPtr createElement(const char *objectName = "details") const; + static DetailsPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } + ElementPtr createElement(const char *objectName = "details") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; SenderID mID; @@ -323,17 +323,17 @@ namespace ortc String mMediaStreamTrackID; MediaStreamSet mMediaStreamIDs; - RTPSender() {} - RTPSender(const RTPSender &op2); - RTPSender(ElementPtr rootEL); + RTPSender() noexcept {} + RTPSender(const RTPSender &op2) noexcept; + RTPSender(ElementPtr rootEL) noexcept; - RTPSender &operator=(const RTPSender &op2) = delete; + RTPSender &operator=(const RTPSender &op2) noexcept = delete; - static RTPSenderPtr create(ElementPtr rootEl) { if (!rootEl) return RTPSenderPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "rtpSender") const; + static RTPSenderPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return RTPSenderPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "rtpSender") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; struct ICECandidate @@ -342,21 +342,21 @@ namespace ortc Optional mMLineIndex; IICETypes::GatherCandidatePtr mCandidate; - ICECandidate() {} - ICECandidate(const ICECandidate &op2); + ICECandidate() noexcept {} + ICECandidate(const ICECandidate &op2) noexcept; - ICECandidate &operator=(const ICECandidate &op2) = delete; + ICECandidate &operator=(const ICECandidate &op2) noexcept = delete; - static ICECandidatePtr create(ElementPtr rootEl); - ElementPtr createElement(const char *objectName = "iceCandidate") const; + static ICECandidatePtr create(ElementPtr rootEl) noexcept; + ElementPtr createElement(const char *objectName = "iceCandidate") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; - static ICECandidatePtr createFromSDP(ElementPtr rootEl); - static ICECandidatePtr createFromSDP(const char *value); - String toSDP() const; - ElementPtr toJSON() const; + static ICECandidatePtr createFromJSON(ElementPtr rootEl) noexcept { return create(rootEl); } + static ICECandidatePtr createFromSDP(const char *value) noexcept; + String toSDP() const noexcept; + ElementPtr toJSON() const noexcept; }; struct Description @@ -374,17 +374,17 @@ namespace ortc QWORD mEndTime {}; ConnectionDataPtr mConnectionData; // optional; can be null; - Details() {} - Details(const Details &op2); - Details(ElementPtr rootEl); + Details() noexcept {} + Details(const Details &op2) noexcept; + Details(ElementPtr rootEl) noexcept; - Details &operator=(const Details &op2) = delete; + Details &operator=(const Details &op2) noexcept = delete; - static DetailsPtr create(ElementPtr rootEl) { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } - ElementPtr createElement(const char *objectName = "details") const; + static DetailsPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return DetailsPtr(); return make_shared
(rootEl); } + ElementPtr createElement(const char *objectName = "details") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; DetailsPtr mDetails; // optional; can be null; @@ -394,17 +394,17 @@ namespace ortc SCTPMediaList mSCTPMediaLines; RTPSenderList mRTPSenders; - Description() {} - Description(const Description &op2); - Description(ElementPtr rootEl); + Description() noexcept {} + Description(const Description &op2) noexcept; + Description(ElementPtr rootEl) noexcept; - Description &operator=(const Description &op2) = delete; + Description &operator=(const Description &op2) noexcept = delete; - static DescriptionPtr create(ElementPtr rootEl) { if (!rootEl) return DescriptionPtr(); return make_shared(rootEl); } - ElementPtr createElement(const char *objectName = "session") const; + static DescriptionPtr create(ElementPtr rootEl) noexcept { if (!rootEl) return DescriptionPtr(); return make_shared(rootEl); } + ElementPtr createElement(const char *objectName = "session") const noexcept; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; }; @@ -412,9 +412,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescription - #pragma mark + // + // ISessionDescription + // interface ISessionDescription : public ISessionDescriptionTypes, public Any @@ -422,19 +422,19 @@ namespace ortc static ISessionDescriptionPtr create( SignalingTypes type, const char *description - ); + ) noexcept; static ISessionDescriptionPtr create( SignalingTypes type, const Description &description - ); + ) noexcept; - static ElementPtr toDebug(ISessionDescriptionPtr object); + static ElementPtr toDebug(ISessionDescriptionPtr object) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual SignalingTypes type() const = 0; - virtual DescriptionPtr description() const = 0; - virtual SignalingDescription formattedDescription() const = 0; + virtual SignalingTypes type() const noexcept = 0; + virtual DescriptionPtr description() const noexcept = 0; + virtual SignalingDescription formattedDescription() const noexcept = 0; }; } } diff --git a/ortc/adapter/cpp/ortc_adapter_Helper.cpp b/ortc/adapter/cpp/ortc_adapter_Helper.cpp index 3ecf45ba..fdef611a 100644 --- a/ortc/adapter/cpp/ortc_adapter_Helper.cpp +++ b/ortc/adapter/cpp/ortc_adapter_Helper.cpp @@ -42,8 +42,10 @@ #include //#include +//#define USE_TEMPORAL_LAYERS +//#define USE_SPATIAL_LAYERS -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -57,14 +59,14 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helper - #pragma mark + // + // Helper + // } // namespace internal //------------------------------------------------------------------------- - const char *IHelper::toString(IDPreferences pref) + const char *IHelper::toString(IDPreferences pref) noexcept { switch (pref) { @@ -75,7 +77,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPTypes::SSRCType IHelper::getRandomSSRC() + IRTPTypes::SSRCType IHelper::getRandomSSRC() noexcept { auto random = IHelper::random(sizeof(IRTPTypes::SSRCType)); IRTPTypes::SSRCType tempSSRC{}; @@ -88,7 +90,7 @@ namespace ortc IMediaStreamTrackTypes::Kinds kind, SSRCQueue &audioSSRCQueue, SSRCQueue &videoSSRCQueue - ) + ) noexcept { SSRCQueue *ssrcQueue = NULL; @@ -98,7 +100,7 @@ namespace ortc case ortc::IMediaStreamTrackTypes::Kind_Video: ssrcQueue = &videoSSRCQueue; break; } - ZS_THROW_INVALID_ASSUMPTION_IF(!ssrcQueue); + ZS_ASSERT(ssrcQueue); if (ssrcQueue->size() > 0) return ssrcQueue->front(); @@ -112,7 +114,7 @@ namespace ortc IMediaStreamTrackTypes::Kinds kind, SSRCQueue &audioSSRCQueue, SSRCQueue &videoSSRCQueue - ) + ) noexcept { auto result = peekNextSSRC(kind, audioSSRCQueue, videoSSRCQueue); switch (kind) @@ -128,12 +130,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (conversion) - #pragma mark + // + // Negotiation (conversion) + // //------------------------------------------------------------------------- - IHelper::RTPParametersPtr IHelper::capabilitiesToParameters(const RTPCapabilities &capabilities) + IHelper::RTPParametersPtr IHelper::capabilitiesToParameters(const RTPCapabilities &capabilities) noexcept { auto result = make_shared(); @@ -145,7 +147,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPCapabilitiesPtr IHelper::parametersToCapabilities(const RTPParameters ¶meters) + IHelper::RTPCapabilitiesPtr IHelper::parametersToCapabilities(const RTPParameters ¶meters) noexcept { auto result = make_shared(); @@ -231,7 +233,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPCodecParametersListPtr IHelper::capabilitiesToParameters(const RTPCodecCapabilitiesList &capabiliites) + IHelper::RTPCodecParametersListPtr IHelper::capabilitiesToParameters(const RTPCodecCapabilitiesList &capabiliites) noexcept { auto result = make_shared(); @@ -245,7 +247,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPCodecCapabilitiesListPtr IHelper::parametersToCapabilities(const RTPCodecParametersList ¶meters) + IHelper::RTPCodecCapabilitiesListPtr IHelper::parametersToCapabilities(const RTPCodecParametersList ¶meters) noexcept { auto result = make_shared(); @@ -259,7 +261,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPCodecParametersPtr IHelper::capabilitiesToParameters(const RTPCodecCapability &capabilities) + IHelper::RTPCodecParametersPtr IHelper::capabilitiesToParameters(const RTPCodecCapability &capabilities) noexcept { auto result = make_shared(); @@ -339,7 +341,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPCodecCapabilityPtr IHelper::parametersToCapabilities(const RTPCodecParameters ¶meters) + IHelper::RTPCodecCapabilityPtr IHelper::parametersToCapabilities(const RTPCodecParameters ¶meters) noexcept { auto result = make_shared(); @@ -370,8 +372,6 @@ namespace ortc result->mRTCPFeedback = parameters.mRTCPFeedback; if (parameters.mParameters) { - auto supportedCodec = IRTPTypes::toSupportedCodec(parameters.mName); - switch (supportedCodec) { case IRTPTypes::SupportedCodec_Unknown: break; @@ -437,7 +437,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPOpusCodecParametersPtr IHelper::opusCodecCapabilityParametersToParameters(const RTPOpusCodecCapabilityParameters &capabilityParameters) + IHelper::RTPOpusCodecParametersPtr IHelper::opusCodecCapabilityParametersToParameters(const RTPOpusCodecCapabilityParameters &capabilityParameters) noexcept { auto result = make_shared(); @@ -454,7 +454,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPOpusCodecCapabilityParametersPtr IHelper::opusCodecParametersToCapabilityParameters(const RTPOpusCodecParameters ¶meters) + IHelper::RTPOpusCodecCapabilityParametersPtr IHelper::opusCodecParametersToCapabilityParameters(const RTPOpusCodecParameters ¶meters) noexcept { auto result = make_shared(); @@ -471,55 +471,55 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPVP8CodecParametersPtr IHelper::vp8CodecCapabilityParametersToParameters(const RTPVP8CodecCapabilityParameters &capabilityParameters) + IHelper::RTPVP8CodecParametersPtr IHelper::vp8CodecCapabilityParametersToParameters(const RTPVP8CodecCapabilityParameters &capabilityParameters) noexcept { return make_shared(capabilityParameters); } //------------------------------------------------------------------------- - IHelper::RTPVP8CodecCapabilityParametersPtr IHelper::vp8CodecParametersToCapabilityParameters(const RTPVP8CodecParameters ¶meters) + IHelper::RTPVP8CodecCapabilityParametersPtr IHelper::vp8CodecParametersToCapabilityParameters(const RTPVP8CodecParameters ¶meters) noexcept { return make_shared(parameters); } //------------------------------------------------------------------------- - IHelper::RTPH264CodecParametersPtr IHelper::h264CodecCapabilityParametersToParameters(const RTPH264CodecCapabilityParameters &capabilityParameters) + IHelper::RTPH264CodecParametersPtr IHelper::h264CodecCapabilityParametersToParameters(const RTPH264CodecCapabilityParameters &capabilityParameters) noexcept { return make_shared(capabilityParameters); } //------------------------------------------------------------------------- - IHelper::RTPH264CodecCapabilityParametersPtr IHelper::h264CodecParametersToCapabilityParameters(const RTPH264CodecParameters ¶meters) + IHelper::RTPH264CodecCapabilityParametersPtr IHelper::h264CodecParametersToCapabilityParameters(const RTPH264CodecParameters ¶meters) noexcept { return make_shared(parameters); } //------------------------------------------------------------------------- - IHelper::RTPRTXCodecParametersPtr IHelper::rtxCodecCapabilityParametersToParameters(const RTPRTXCodecCapabilityParameters &capabilityParameters) + IHelper::RTPRTXCodecParametersPtr IHelper::rtxCodecCapabilityParametersToParameters(const RTPRTXCodecCapabilityParameters &capabilityParameters) noexcept { return make_shared(capabilityParameters); } //------------------------------------------------------------------------- - IHelper::RTPRTXCodecCapabilityParametersPtr IHelper::rtxCodecParametersToCapabilityParameters(const RTPRTXCodecParameters ¶meters) + IHelper::RTPRTXCodecCapabilityParametersPtr IHelper::rtxCodecParametersToCapabilityParameters(const RTPRTXCodecParameters ¶meters) noexcept { return make_shared(parameters); } //------------------------------------------------------------------------- - IHelper::RTPFlexFECCodecParametersPtr IHelper::flexFECCodecCapabilityParametersToParameters(const RTPFlexFECCodecCapabilityParameters &capabilityParameters) + IHelper::RTPFlexFECCodecParametersPtr IHelper::flexFECCodecCapabilityParametersToParameters(const RTPFlexFECCodecCapabilityParameters &capabilityParameters) noexcept { return make_shared(capabilityParameters); } //------------------------------------------------------------------------- - IHelper::RTPFlexFECCodecCapabilityParametersPtr IHelper::flexFECCodecParametersToCapabilityParameters(const RTPFlexFECCodecParameters ¶meters) + IHelper::RTPFlexFECCodecCapabilityParametersPtr IHelper::flexFECCodecParametersToCapabilityParameters(const RTPFlexFECCodecParameters ¶meters) noexcept { return make_shared(parameters); } //------------------------------------------------------------------------- - IHelper::RTPHeaderExtensionParametersListPtr IHelper::capabilitiesToParameters(const RTPHeaderExtensionsList &capabilities) + IHelper::RTPHeaderExtensionParametersListPtr IHelper::capabilitiesToParameters(const RTPHeaderExtensionsList &capabilities) noexcept { auto result = make_shared(); @@ -532,7 +532,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPHeaderExtensionsListPtr IHelper::parametersToCapabilities(const RTPHeaderExtensionParametersList ¶meters) + IHelper::RTPHeaderExtensionsListPtr IHelper::parametersToCapabilities(const RTPHeaderExtensionParametersList ¶meters) noexcept { auto result = make_shared(); @@ -545,7 +545,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPHeaderExtensionParametersPtr IHelper::capabilitiesToParameters(const RTPHeaderExtension &capabilities) + IHelper::RTPHeaderExtensionParametersPtr IHelper::capabilitiesToParameters(const RTPHeaderExtension &capabilities) noexcept { auto result = make_shared(); @@ -557,7 +557,7 @@ namespace ortc } //------------------------------------------------------------------------- - IHelper::RTPHeaderExtensionPtr IHelper::parametersToCapabilities(const RTPHeaderExtensionParameters ¶meters) + IHelper::RTPHeaderExtensionPtr IHelper::parametersToCapabilities(const RTPHeaderExtensionParameters ¶meters) noexcept { auto result = make_shared(); @@ -572,16 +572,16 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (unions) - #pragma mark + // + // Negotiation (unions) + // //------------------------------------------------------------------------- IHelper::RTPCapabilitiesPtr IHelper::createUnion( const RTPCapabilities &localCapabilities, const RTPCapabilities &remoteCapabilities, IDPreferences preference - ) + ) noexcept { auto result = make_shared(); result->mCodecs = *createUnion(localCapabilities.mCodecs, remoteCapabilities.mCodecs, preference); @@ -594,7 +594,7 @@ namespace ortc static const IRTPTypes::CodecCapability *findCodecByPayloadType( const IRTPTypes::CodecCapabilitiesList &codecs, IRTPTypes::PayloadType payloadType - ) + ) noexcept { for (auto iter = codecs.begin(); iter != codecs.end(); ++iter) { auto &codec = (*iter); @@ -609,7 +609,7 @@ namespace ortc static const IRTPTypes::CodecParameters *findCodecByPayloadType( const IRTPTypes::CodecParametersList &codecs, IRTPTypes::PayloadType payloadType - ) + ) noexcept { for (auto iter = codecs.begin(); iter != codecs.end(); ++iter) { auto &codec = (*iter); @@ -625,7 +625,7 @@ namespace ortc const IRTPTypes::CodecCapability &primaryCodec, const IRTPTypes::CodecCapability &secondaryCodec, bool &outExact - ) + ) noexcept { outExact = true; @@ -658,7 +658,7 @@ namespace ortc const IRTPTypes::CodecParameters &primaryCodec, const IRTPTypes::CodecCapability &secondaryCodec, bool &outExact - ) + ) noexcept { outExact = true; @@ -705,7 +705,7 @@ namespace ortc const IRTPTypes::CodecCapabilitiesList &secondaryList, bool &outExact, bool &outIsRTX - ) + ) noexcept { outIsRTX = false; outExact = false; @@ -783,7 +783,7 @@ namespace ortc const IRTPTypes::CodecCapabilitiesList &secondaryList, bool &outExact, bool &outIsRTX - ) + ) noexcept { outIsRTX = false; outExact = false; @@ -858,7 +858,7 @@ namespace ortc const RTPCodecCapabilitiesList &local, const RTPCodecCapabilitiesList &remote, IDPreferences preference - ) + ) noexcept { auto result = make_shared(); @@ -869,8 +869,6 @@ namespace ortc for (auto iterPrimary = primaryList.begin(); iterPrimary != primaryList.end(); ++iterPrimary) { auto &primaryCodec = (*iterPrimary); - auto supportedType = IRTPTypes::toSupportedCodec(primaryCodec.mName); - const RTPCodecCapability *foundSecondaryExact = nullptr; const RTPCodecCapability *foundSecondaryInexact = nullptr; @@ -933,7 +931,7 @@ namespace ortc const RTPHeaderExtensionsList &local, const RTPHeaderExtensionsList &remote, IDPreferences preference - ) + ) noexcept { auto result = make_shared(); for (auto iterLocal = local.begin(); iterLocal != local.end(); ++iterLocal) { @@ -957,7 +955,7 @@ namespace ortc const RTPFECMechanismList &local, const RTPFECMechanismList &remote, IDPreferences preference - ) + ) noexcept { auto result = make_shared(); for (auto iterLocal = local.begin(); iterLocal != local.end(); ++iterLocal) { @@ -981,7 +979,7 @@ namespace ortc const RTPRTCPFeedbackList &local, const RTPRTCPFeedbackList &remote, IDPreferences preference - ) + ) noexcept { auto result = make_shared(); for (auto iterLocal = local.begin(); iterLocal != local.end(); ++iterLocal) { @@ -1006,15 +1004,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (filter) - #pragma mark + // + // Negotiation (filter) + // //------------------------------------------------------------------------- IHelper::RTPParametersPtr IHelper::filterParameters( const RTPParameters ¶meters, const RTPCapabilities &capabilities - ) + ) noexcept { auto result = make_shared(parameters); @@ -1030,9 +1028,7 @@ namespace ortc // disallow codec payload type being used that is no longer present encoding.mCodecPayloadType = Optional(); - -#define TODO_FILTER_RTX_FEC 1 -#define TODO_FILTER_RTX_FEC 2 +#pragma ZS_BUILD_NOTE("TODO","filter rtx fec") } return result; @@ -1042,15 +1038,13 @@ namespace ortc IHelper::RTPCodecParametersListPtr IHelper::filterParameters( const RTPCodecParametersList &codecParameters, const RTPCodecCapabilitiesList &codecCapabilities - ) + ) noexcept { auto result = make_shared(); for (auto iterCodecParams = codecParameters.begin(); iterCodecParams != codecParameters.end(); ++iterCodecParams) { auto &codecParam = (*iterCodecParams); - auto supportedType = IRTPTypes::toSupportedCodec(codecParam.mName); - const RTPCodecCapability *foundSecondaryExact = nullptr; const RTPCodecCapability *foundSecondaryInexact = nullptr; @@ -1101,7 +1095,7 @@ namespace ortc IHelper::RTPHeaderExtensionParametersListPtr IHelper::filterParameters( const RTPHeaderExtensionParametersList &headerParameters, const RTPHeaderExtensionsList &headerCapabilities - ) + ) noexcept { auto result = make_shared(); @@ -1130,15 +1124,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (validation) - #pragma mark + // + // Negotiation (validation) + // //------------------------------------------------------------------------- bool IHelper::isCompatible( const RTPCapabilities &capabilities, const RTPParameters ¶meters - ) + ) noexcept { for (auto iterOuter = parameters.mCodecs.begin(); iterOuter != parameters.mCodecs.end(); ++iterOuter) { auto &codecOuter = *(iterOuter); @@ -1191,7 +1185,7 @@ namespace ortc bool IHelper::isCompatible( const RTPCapabilities &existingCapabilities, const RTPCapabilities &proposedCapabilities - ) + ) noexcept { for (auto iterOuter = proposedCapabilities.mCodecs.begin(); iterOuter != proposedCapabilities.mCodecs.end(); ++iterOuter) { auto &codecOuter = *(iterOuter); @@ -1234,7 +1228,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool isMediaCodec(const String &codecName) + static bool isMediaCodec(const String &codecName) noexcept { auto supportedCodec = IRTPTypes::toSupportedCodec(codecName); auto codecKind = IRTPTypes::getCodecKind(supportedCodec); @@ -1255,7 +1249,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool IHelper::hasSupportedMediaCodec(const RTPCapabilities &capabilities) + bool IHelper::hasSupportedMediaCodec(const RTPCapabilities &capabilities) noexcept { for (auto iterOuter = capabilities.mCodecs.begin(); iterOuter != capabilities.mCodecs.end(); ++iterOuter) { auto &codec = *(iterOuter); @@ -1265,7 +1259,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool IHelper::hasSupportedMediaCodec(const RTPParameters ¶meters) + bool IHelper::hasSupportedMediaCodec(const RTPParameters ¶meters) noexcept { for (auto iterOuter = parameters.mCodecs.begin(); iterOuter != parameters.mCodecs.end(); ++iterOuter) { auto &codec = *(iterOuter); @@ -1278,16 +1272,16 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Negotiation (fill) - #pragma mark + // + // Negotiation (fill) + // //------------------------------------------------------------------------- void IHelper::fillParameters( RTPParameters ¶meters, const RTPCapabilities &capabilities, FillParametersOptions *options - ) + ) noexcept { if (!parameters.mRTCP.mCName.hasData()) { parameters.mRTCP.mCName = string(zsLib::createUUID()); @@ -1345,7 +1339,46 @@ namespace ortc } } } +#ifdef USE_TEMPORAL_LAYERS + auto kind = UseRTPTypesHelper::getCodecsKind(parameters); + if (kind == ortc::IMediaStreamTrackTypes::Kind_Video) { + encoding.mEncodingID = "1"; + encoding.mFramerateScale = 0.25; + } +#endif +#ifdef USE_SPATIAL_LAYERS + auto kind = UseRTPTypesHelper::getCodecsKind(parameters); + if (kind == ortc::IMediaStreamTrackTypes::Kind_Video) { + encoding.mEncodingID = "1"; + encoding.mResolutionScale = 0.5; + } +#endif parameters.mEncodings.push_back(encoding); +#ifdef USE_TEMPORAL_LAYERS + if (kind == ortc::IMediaStreamTrackTypes::Kind_Video) { + IRTPTypes::EncodingParameters encoding; + encoding.mActive = true; + encoding.mEncodingID = "2"; + encoding.mFramerateScale = 0.5; + encoding.mDependencyEncodingIDs.push_back("1"); + parameters.mEncodings.push_back(encoding); + encoding.mActive = true; + encoding.mEncodingID = "3"; + encoding.mFramerateScale = 1.0; + encoding.mDependencyEncodingIDs.push_back("2"); + parameters.mEncodings.push_back(encoding); + } +#endif +#ifdef USE_SPATIAL_LAYERS + if (kind == ortc::IMediaStreamTrackTypes::Kind_Video) { + IRTPTypes::EncodingParameters encoding; + encoding.mActive = true; + encoding.mEncodingID = "2"; + encoding.mResolutionScale = 1.0; + encoding.mDependencyEncodingIDs.push_back("1"); + parameters.mEncodings.push_back(encoding); + } +#endif } } diff --git a/ortc/adapter/cpp/ortc_adapter_MediaStream.cpp b/ortc/adapter/cpp/ortc_adapter_MediaStream.cpp index 8bf34d86..17f29f24 100644 --- a/ortc/adapter/cpp/ortc_adapter_MediaStream.cpp +++ b/ortc/adapter/cpp/ortc_adapter_MediaStream.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include @@ -38,10 +40,11 @@ #include +#include #include #include -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter); } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter); } } namespace ortc { @@ -59,11 +62,11 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamForPeerConnection - #pragma mark + // + // IMediaStreamForPeerConnection + // - IMediaStreamForPeerConnection::ForPeerConnectionPtr IMediaStreamForPeerConnection::create(const char *id) + IMediaStreamForPeerConnection::ForPeerConnectionPtr IMediaStreamForPeerConnection::create(const char *id) noexcept { return internal::IMediaStreamFactory::singleton().create(id); } @@ -72,9 +75,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream - #pragma mark + // + // MediaStream + // //------------------------------------------------------------------------- MediaStream::MediaStream( @@ -83,7 +86,7 @@ namespace ortc IMediaStreamDelegatePtr delegate, const UseMediaStreamTrackList &tracks, const char *id - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), mMSID(NULL == id ? UseServicesHelper::randomString(36) : String(id)), @@ -111,12 +114,12 @@ namespace ortc } //------------------------------------------------------------------------- - void MediaStream::init() + void MediaStream::init() noexcept { } //------------------------------------------------------------------------- - MediaStream::~MediaStream() + MediaStream::~MediaStream() noexcept { mThisWeak.reset(); @@ -124,13 +127,13 @@ namespace ortc } //------------------------------------------------------------------------- - MediaStreamPtr MediaStream::convert(IMediaStreamPtr object) + MediaStreamPtr MediaStream::convert(IMediaStreamPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStream, object); } //------------------------------------------------------------------------- - MediaStreamPtr MediaStream::convert(ForPeerConnectionPtr object) + MediaStreamPtr MediaStream::convert(ForPeerConnectionPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStream, object); } @@ -139,12 +142,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => IMediaStream - #pragma mark + // + // MediaStream => IMediaStream + // //----------------------------------------------------------------------- - ElementPtr MediaStream::toDebug(IMediaStreamPtr object) + ElementPtr MediaStream::toDebug(IMediaStreamPtr object) noexcept { if (!object) return ElementPtr(); return MediaStream::convert(object)->toDebug(); @@ -154,7 +157,7 @@ namespace ortc MediaStreamPtr MediaStream::create( IMediaStreamDelegatePtr delegate, IMediaStreamPtr stream - ) + ) noexcept { UseMediaStreamTrackList tempTracks; @@ -175,13 +178,13 @@ namespace ortc MediaStreamPtr MediaStream::create( IMediaStreamDelegatePtr delegate, const MediaStreamTrackList &tracks - ) + ) noexcept { UseMediaStreamTrackList tempTracks; for (auto iter = tracks.begin(); iter != tracks.end(); ++iter) { auto track = (*iter); - ORTC_THROW_INVALID_PARAMETERS_IF(nullptr == track); + ZS_ASSERT(nullptr != track); tempTracks.push_back(MediaStreamTrack::convert(track)); } @@ -192,7 +195,7 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamSubscriptionPtr MediaStream::subscribe(IMediaStreamDelegatePtr originalDelegate) + IMediaStreamSubscriptionPtr MediaStream::subscribe(IMediaStreamDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to media stream")); @@ -206,8 +209,7 @@ namespace ortc if (delegate) { auto pThis = mThisWeak.lock(); -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 1 -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 2 +#pragma ZS_BUILD_NOTE("TODO","Fire any missed events") } if (isShutdown()) { @@ -218,13 +220,13 @@ namespace ortc } //----------------------------------------------------------------------- - String MediaStream::id() const + String MediaStream::id() const noexcept { return mMSID; } //----------------------------------------------------------------------- - bool MediaStream::active() const + bool MediaStream::active() const noexcept { AutoRecursiveLock lock(*this); @@ -237,7 +239,7 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamTypes::MediaStreamTrackListPtr MediaStream::getAudioTracks() const + IMediaStreamTypes::MediaStreamTrackListPtr MediaStream::getAudioTracks() const noexcept { auto result = make_shared(); @@ -259,7 +261,7 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamTypes::MediaStreamTrackListPtr MediaStream::getVideoTracks() const + IMediaStreamTypes::MediaStreamTrackListPtr MediaStream::getVideoTracks() const noexcept { auto result = make_shared(); @@ -281,7 +283,7 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamTypes::MediaStreamTrackListPtr MediaStream::getTracks() const + IMediaStreamTypes::MediaStreamTrackListPtr MediaStream::getTracks() const noexcept { auto result = make_shared(); @@ -296,7 +298,7 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamTrackPtr MediaStream::getTrackByID(const char *id) const + IMediaStreamTrackPtr MediaStream::getTrackByID(const char *id) const noexcept { String idStr(id); @@ -312,27 +314,28 @@ namespace ortc } //----------------------------------------------------------------------- - size_t MediaStream::size() const + size_t MediaStream::size() const noexcept { AutoRecursiveLock lock(*this); return mTracks.size(); } //----------------------------------------------------------------------- - void MediaStream::addTrack(IMediaStreamTrackPtr track) + void MediaStream::addTrack(IMediaStreamTrackPtr track) noexcept { - ORTC_THROW_INVALID_PARAMETERS_IF(!track); + ZS_ASSERT(track); AutoRecursiveLock lock(*this); auto result = getTrackByID(track->id()); if (nullptr != result) { - ZS_LOG_WARNING(Debug, log("already added track (not added again)") + IMediaStreamTrack::toDebug(track)); + ZS_EVENTING_TRACE_OBJECT_PTR(Detail, track, "already added track (not added again)"); + ZS_LOG_WARNING(Debug, log("already added track (not added again)")); return; } mTracks.push_back(MediaStreamTrack::convert(track)); } //----------------------------------------------------------------------- - void MediaStream::removeTrack(IMediaStreamTrackPtr track) + void MediaStream::removeTrack(IMediaStreamTrackPtr track) noexcept { if (!track) return; @@ -351,10 +354,10 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamPtr MediaStream::clone() const + IMediaStreamPtr MediaStream::clone() const noexcept { auto tracks = getTracks(); - ZS_THROW_INVALID_ASSUMPTION_IF(nullptr == tracks); + ZS_ASSERT(nullptr != tracks); return MediaStream::create(IMediaStreamDelegatePtr(), *tracks); } @@ -362,12 +365,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => ForPeerConnection - #pragma mark + // + // MediaStream => ForPeerConnection + // //----------------------------------------------------------------------- - MediaStream::PromiseWithStatsReportPtr MediaStream::getStats(const StatsTypeSet &stats) const + MediaStream::PromiseWithStatsReportPtr MediaStream::getStats(const StatsTypeSet &stats) const noexcept { UseStatsReport::PromiseWithStatsReportList promises; @@ -388,12 +391,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => ForPeerConnection - #pragma mark + // + // MediaStream => ForPeerConnection + // //----------------------------------------------------------------------- - MediaStreamPtr MediaStream::create(const char *id) + MediaStreamPtr MediaStream::create(const char *id) noexcept { MediaStreamPtr pThis(make_shared(make_private{}, UseORTC::queueORTC(), IMediaStreamDelegatePtr(), UseMediaStreamTrackList(), id)); pThis->mThisWeak = pThis; @@ -402,7 +405,7 @@ namespace ortc } //----------------------------------------------------------------------- - void MediaStream::notifyAddTrack(IMediaStreamTrackPtr track) + void MediaStream::notifyAddTrack(IMediaStreamTrackPtr track) noexcept { AutoRecursiveLock lock(*this); auto totalTracks = mTracks.size(); @@ -413,7 +416,7 @@ namespace ortc } //----------------------------------------------------------------------- - void MediaStream::notifyRemoveTrack(IMediaStreamTrackPtr track) + void MediaStream::notifyRemoveTrack(IMediaStreamTrackPtr track) noexcept { AutoRecursiveLock lock(*this); auto totalTracks = mTracks.size(); @@ -428,12 +431,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => (internal) - #pragma mark + // + // MediaStream => (internal) + // //----------------------------------------------------------------------- - Log::Params MediaStream::log(const char *message) const + Log::Params MediaStream::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::adapter::MediaStream"); UseServicesHelper::debugAppend(objectEl, "id", mID); @@ -441,13 +444,13 @@ namespace ortc } //----------------------------------------------------------------------- - Log::Params MediaStream::debug(const char *message) const + Log::Params MediaStream::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //----------------------------------------------------------------------- - ElementPtr MediaStream::toDebug() const + ElementPtr MediaStream::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -468,12 +471,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamFactory - #pragma mark + // + // IMediaStreamFactory + // //------------------------------------------------------------------------- - IMediaStreamFactory &IMediaStreamFactory::singleton() + IMediaStreamFactory &IMediaStreamFactory::singleton() noexcept { return MediaStreamFactory::singleton(); } @@ -482,7 +485,7 @@ namespace ortc MediaStreamPtr IMediaStreamFactory::create( IMediaStreamDelegatePtr delegate, IMediaStreamPtr stream - ) + ) noexcept { if (this) {} return internal::MediaStream::create(delegate, stream); @@ -492,14 +495,14 @@ namespace ortc MediaStreamPtr IMediaStreamFactory::create( IMediaStreamDelegatePtr delegate, const MediaStreamTrackList &tracks - ) + ) noexcept { if (this) {} return internal::MediaStream::create(delegate, tracks); } //------------------------------------------------------------------------- - MediaStreamPtr IMediaStreamFactory::create(const char *id) + MediaStreamPtr IMediaStreamFactory::create(const char *id) noexcept { if (this) {} return internal::MediaStream::create(id); @@ -511,12 +514,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream - #pragma mark + // + // MediaStream + // //------------------------------------------------------------------------- - ElementPtr IMediaStream::toDebug(IMediaStreamPtr stream) + ElementPtr IMediaStream::toDebug(IMediaStreamPtr stream) noexcept { return internal::MediaStream::toDebug(stream); } @@ -525,7 +528,7 @@ namespace ortc IMediaStreamPtr IMediaStream::create( IMediaStreamDelegatePtr delegate, IMediaStreamPtr stream - ) + ) noexcept { return internal::IMediaStreamFactory::singleton().create(delegate, stream); } @@ -534,7 +537,7 @@ namespace ortc IMediaStreamPtr IMediaStream::create( IMediaStreamDelegatePtr delegate, const MediaStreamTrackList &tracks - ) + ) noexcept { return internal::IMediaStreamFactory::singleton().create(delegate, tracks); } diff --git a/ortc/adapter/cpp/ortc_adapter_PeerConnection.cpp b/ortc/adapter/cpp/ortc_adapter_PeerConnection.cpp index 8e1c1072..d5c820da 100644 --- a/ortc/adapter/cpp/ortc_adapter_PeerConnection.cpp +++ b/ortc/adapter/cpp/ortc_adapter_PeerConnection.cpp @@ -29,8 +29,11 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include +#include #include #include @@ -52,7 +55,7 @@ #pragma warning(3 : 4062) #endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -71,18 +74,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::TransportInfo::Details - #pragma mark + // + // PeerConnection::TransportInfo::Details + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::TransportInfo::Details::toDebug() const + ElementPtr PeerConnection::TransportInfo::Details::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::TransportInfo::Details"); UseServicesHelper::debugAppend(resultEl, "ice gatherer", mGatherer ? mGatherer->getID() : 0); UseServicesHelper::debugAppend(resultEl, "ice transort", mTransport ? mTransport->getID() : 0); - UseServicesHelper::debugAppend(resultEl, "end of candidates", mRTPEndOfCandidates); + UseServicesHelper::debugAppend(resultEl, "end of candidates", mICEEndOfCandidates); UseServicesHelper::debugAppend(resultEl, "dtls transport", mDTLSTransport ? mDTLSTransport->getID() : 0); UseServicesHelper::debugAppend(resultEl, "srtp/sdes transport", mSRTPSDESTransport ? mSRTPSDESTransport->getID() : 0); @@ -93,12 +96,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::TransportInfo - #pragma mark + // + // PeerConnection::TransportInfo + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::TransportInfo::toDebug() const + ElementPtr PeerConnection::TransportInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::TransportInfo"); @@ -122,12 +125,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::MediaLineInfo - #pragma mark + // + // PeerConnection::MediaLineInfo + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::MediaLineInfo::toDebug() const + ElementPtr PeerConnection::MediaLineInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::MediaLineInfo"); @@ -144,12 +147,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::RTPMediaLineInfo - #pragma mark + // + // PeerConnection::RTPMediaLineInfo + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::RTPMediaLineInfo::toDebug() const + ElementPtr PeerConnection::RTPMediaLineInfo::toDebug() const noexcept { ElementPtr resultEl = MediaLineInfo::toDebug(); resultEl->setValue("ortc::adapter::PeerConnection::RTPMediaLineInfo"); @@ -168,12 +171,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::SCTPMediaLineInfo - #pragma mark + // + // PeerConnection::SCTPMediaLineInfo + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::SCTPMediaLineInfo::toDebug() const + ElementPtr PeerConnection::SCTPMediaLineInfo::toDebug() const noexcept { ElementPtr resultEl = MediaLineInfo::toDebug(); resultEl->setValue("ortc::adapter::PeerConnection::SCTPMediaLineInfo"); @@ -188,12 +191,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::SenderInfo - #pragma mark + // + // PeerConnection::SenderInfo + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::SenderInfo::toDebug() const + ElementPtr PeerConnection::SenderInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::SenderInfo"); @@ -212,12 +215,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::SenderInfo - #pragma mark + // + // PeerConnection::SenderInfo + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::ReceiverInfo::toDebug() const + ElementPtr PeerConnection::ReceiverInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::ReceiverInfo"); @@ -235,12 +238,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::PendingMethod - #pragma mark + // + // PeerConnection::PendingMethod + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::PendingMethod::toDebug() const + ElementPtr PeerConnection::PendingMethod::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::PendingMethod"); @@ -267,12 +270,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::PendingAddTrack - #pragma mark + // + // PeerConnection::PendingAddTrack + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::PendingAddTrack::toDebug() const + ElementPtr PeerConnection::PendingAddTrack::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::PendingAddTrack"); @@ -290,12 +293,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection::PendingAddDataChannel - #pragma mark + // + // PeerConnection::PendingAddDataChannel + // //----------------------------------------------------------------------- - ElementPtr PeerConnection::PendingAddDataChannel::toDebug() const + ElementPtr PeerConnection::PendingAddDataChannel::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::PeerConnection::PendingAddDataChannel"); @@ -309,9 +312,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection - #pragma mark + // + // PeerConnection + // //----------------------------------------------------------------------- PeerConnection::PeerConnection( @@ -319,9 +322,9 @@ namespace ortc IMessageQueuePtr queue, IPeerConnectionDelegatePtr delegate, const Optional &configuration - ) : - SharedRecursiveLock(SharedRecursiveLock::create()), - MessageQueueAssociator(queue) + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) { if (configuration.hasValue()) { mConfiguration = configuration.value(); @@ -333,7 +336,7 @@ namespace ortc } //----------------------------------------------------------------------- - PeerConnection::~PeerConnection() + PeerConnection::~PeerConnection() noexcept { mThisWeak.reset(); ZS_LOG_DEBUG(log("destroyed")); @@ -341,7 +344,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::init() + void PeerConnection::init() noexcept { AutoRecursiveLock lock(*this); @@ -353,7 +356,7 @@ namespace ortc } //----------------------------------------------------------------------- - const char *PeerConnection::toString(InternalStates state) + const char *PeerConnection::toString(InternalStates state) noexcept { switch (state) { @@ -366,7 +369,7 @@ namespace ortc } //----------------------------------------------------------------------- - const char *PeerConnection::toString(NegotiationStates state) + const char *PeerConnection::toString(NegotiationStates state) noexcept { switch (state) { @@ -380,7 +383,7 @@ namespace ortc } //----------------------------------------------------------------------- - const char *PeerConnection::toString(PendingMethods method) + const char *PeerConnection::toString(PendingMethods method) noexcept { switch (method) { @@ -394,7 +397,7 @@ namespace ortc } //----------------------------------------------------------------------- - PeerConnectionPtr PeerConnection::convert(IPeerConnectionPtr object) + PeerConnectionPtr PeerConnection::convert(IPeerConnectionPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(PeerConnection, object); } @@ -403,15 +406,15 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IPeerConnection - #pragma mark + // + // PeerConnection => IPeerConnection + // //----------------------------------------------------------------------- PeerConnectionPtr PeerConnection::create( IPeerConnectionDelegatePtr delegate, const Optional &configuration - ) + ) noexcept { auto pThis = make_shared(make_private{}, UseORTC::queueORTC(), delegate, configuration); pThis->mThisWeak = pThis; @@ -420,7 +423,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionSubscriptionPtr PeerConnection::subscribe(IPeerConnectionDelegatePtr originalDelegate) + IPeerConnectionSubscriptionPtr PeerConnection::subscribe(IPeerConnectionDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to peer connection")); @@ -433,9 +436,7 @@ namespace ortc if (delegate) { auto pThis = mThisWeak.lock(); - -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 1 -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 2 +#pragma ZS_BUILD_NOTE("TODO","Fire any missed events") if (SignalingState_First != mLastSignalingState) { delegate->onPeerConnectionSignalingStateChange(pThis, mLastSignalingState); @@ -463,7 +464,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::PromiseWithDescriptionPtr PeerConnection::createOffer(const Optional &configuration) + IPeerConnectionTypes::PromiseWithDescriptionPtr PeerConnection::createOffer(const Optional &configuration) noexcept { AutoRecursiveLock lock(*this); @@ -502,7 +503,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::PromiseWithDescriptionPtr PeerConnection::createAnswer(const Optional &configuration) + IPeerConnectionTypes::PromiseWithDescriptionPtr PeerConnection::createAnswer(const Optional &configuration) noexcept { AutoRecursiveLock lock(*this); @@ -541,7 +542,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::PromiseWithDescriptionPtr PeerConnection::createCapabilities(const Optional &configuration) + IPeerConnectionTypes::PromiseWithDescriptionPtr PeerConnection::createCapabilities(const Optional &configuration) noexcept { AutoRecursiveLock lock(*this); @@ -566,7 +567,7 @@ namespace ortc } //----------------------------------------------------------------------- - PromisePtr PeerConnection::setLocalDescription(ISessionDescriptionPtr description) + PromisePtr PeerConnection::setLocalDescription(ISessionDescriptionPtr description) noexcept { AutoRecursiveLock lock(*this); @@ -616,7 +617,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionPtr PeerConnection::localDescription() const + ISessionDescriptionPtr PeerConnection::localDescription() const noexcept { AutoRecursiveLock lock(*this); if (mPendingLocalDescription) return mPendingLocalDescription; @@ -624,23 +625,23 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionPtr PeerConnection::currentDescription() const + ISessionDescriptionPtr PeerConnection::currentDescription() const noexcept { AutoRecursiveLock lock(*this); return mLocalDescription; } //----------------------------------------------------------------------- - ISessionDescriptionPtr PeerConnection::pendingDescription() const + ISessionDescriptionPtr PeerConnection::pendingDescription() const noexcept { AutoRecursiveLock lock(*this); return mPendingRemoteDescription; } //----------------------------------------------------------------------- - PromisePtr PeerConnection::setRemoteDescription(ISessionDescriptionPtr description) + PromisePtr PeerConnection::setRemoteDescription(ISessionDescriptionPtr description) noexcept { - ORTC_THROW_INVALID_PARAMETERS_IF(!description); + ZS_ASSERT(description); AutoRecursiveLock lock(*this); @@ -690,7 +691,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionPtr PeerConnection::remoteDescription() const + ISessionDescriptionPtr PeerConnection::remoteDescription() const noexcept { AutoRecursiveLock lock(*this); if (mPendingRemoteDescription) return mPendingRemoteDescription; @@ -698,21 +699,21 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionPtr PeerConnection::currentRemoteDescription() const + ISessionDescriptionPtr PeerConnection::currentRemoteDescription() const noexcept { AutoRecursiveLock lock(*this); return mRemoteDescription; } //----------------------------------------------------------------------- - ISessionDescriptionPtr PeerConnection::pendingRemoteDescription() const + ISessionDescriptionPtr PeerConnection::pendingRemoteDescription() const noexcept { AutoRecursiveLock lock(*this); return mPendingRemoteDescription; } //----------------------------------------------------------------------- - void PeerConnection::addICECandidate(const ICECandidate &candidate) + void PeerConnection::addICECandidate(const ICECandidate &candidate) noexcept { AutoRecursiveLock lock(*this); if (isStopped()) { @@ -725,54 +726,54 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::SignalingStates PeerConnection::signalingState() const + IPeerConnectionTypes::SignalingStates PeerConnection::signalingState() const noexcept { AutoRecursiveLock lock(*this); return mLastSignalingState; } //----------------------------------------------------------------------- - IPeerConnectionTypes::ICEGatheringStates PeerConnection::iceGatheringState() const + IPeerConnectionTypes::ICEGatheringStates PeerConnection::iceGatheringState() const noexcept { AutoRecursiveLock lock(*this); return mLastICEGatheringStates; } //----------------------------------------------------------------------- - IPeerConnectionTypes::ICEConnectionStates PeerConnection::iceConnectionState() const + IPeerConnectionTypes::ICEConnectionStates PeerConnection::iceConnectionState() const noexcept { AutoRecursiveLock lock(*this); return mLastICEConnectionState; } //----------------------------------------------------------------------- - IPeerConnectionTypes::PeerConnectionStates PeerConnection::connectionState() const + IPeerConnectionTypes::PeerConnectionStates PeerConnection::connectionState() const noexcept { AutoRecursiveLock lock(*this); return mLastPeerConnectionState; } //----------------------------------------------------------------------- - bool PeerConnection::canTrickleCandidates() const + bool PeerConnection::canTrickleCandidates() const noexcept { return true; } //----------------------------------------------------------------------- - IPeerConnectionTypes::ServerListPtr PeerConnection::getDefaultIceServers() + IPeerConnectionTypes::ServerListPtr PeerConnection::getDefaultIceServers() noexcept { return make_shared(); } //----------------------------------------------------------------------- - IPeerConnectionTypes::ConfigurationPtr PeerConnection::getConfiguration() const + IPeerConnectionTypes::ConfigurationPtr PeerConnection::getConfiguration() const noexcept { AutoRecursiveLock lock(*this); return make_shared(mConfiguration); } //----------------------------------------------------------------------- - void PeerConnection::setConfiguration(const Configuration &configuration) + void PeerConnection::setConfiguration(const Configuration &configuration) noexcept { AutoRecursiveLock lock(*this); @@ -782,13 +783,11 @@ namespace ortc if (mConfiguration.mCertificates.size() < 1) { mConfiguration.mCertificates = oldConfiguration.mCertificates; } - -#define TODO_SET_CONFIGURATION 1 -#define TODO_SET_CONFIGURATION 2 +#pragma ZS_BUILD_NOTE("TODO","set configuration") } //----------------------------------------------------------------------- - void PeerConnection::close() + void PeerConnection::close() noexcept { ZS_LOG_DEBUG(log("close called")); @@ -797,7 +796,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::SenderListPtr PeerConnection::getSenders() const + IPeerConnectionTypes::SenderListPtr PeerConnection::getSenders() const noexcept { auto result = make_shared(); @@ -823,7 +822,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::ReceiverListPtr PeerConnection::getReceivers() const + IPeerConnectionTypes::ReceiverListPtr PeerConnection::getReceivers() const noexcept { auto result = make_shared(); @@ -852,7 +851,7 @@ namespace ortc IPeerConnectionTypes::PromiseWithSenderPtr PeerConnection::addTrack( IMediaStreamTrackPtr track, const MediaStreamTrackConfiguration &inConfiguration - ) + ) noexcept { MediaStreamList mediaStreams; return addTrack(track, mediaStreams, inConfiguration); @@ -863,9 +862,9 @@ namespace ortc IMediaStreamTrackPtr track, const MediaStreamList &mediaStreams, const MediaStreamTrackConfiguration &inConfiguration - ) + ) noexcept { - ORTC_THROW_INVALID_PARAMETERS_IF(!track); + ZS_ASSERT(track); auto configuration = make_shared(inConfiguration); @@ -900,9 +899,9 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::removeTrack(IRTPSenderPtr sender) + void PeerConnection::removeTrack(IRTPSenderPtr sender) noexcept { - ORTC_THROW_INVALID_PARAMETERS_IF(!sender); + ZS_ASSERT(sender); AutoRecursiveLock lock(*this); if (isStopped()) { @@ -917,7 +916,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::PromiseWithDataChannelPtr PeerConnection::createDataChannel(const IDataChannelTypes::Parameters &inParameters) + IPeerConnectionTypes::PromiseWithDataChannelPtr PeerConnection::createDataChannel(const IDataChannelTypes::Parameters &inParameters) noexcept { auto parameters = make_shared(inParameters); @@ -946,12 +945,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IStatsProvider - #pragma mark + // + // PeerConnection => IStatsProvider + // //----------------------------------------------------------------------- - PeerConnection::PromiseWithStatsReportPtr PeerConnection::getStats(const StatsTypeSet &stats) const + PeerConnection::PromiseWithStatsReportPtr PeerConnection::getStats(const StatsTypeSet &stats) const noexcept { auto promise = PromiseWithStatsReport::create(UseORTC::queueDelegate()); @@ -964,9 +963,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IPeerConnectionAsyncDelegate - #pragma mark + // + // PeerConnection => IPeerConnectionAsyncDelegate + // //----------------------------------------------------------------------- void PeerConnection::onProvideStats(PromiseWithStatsReportPtr promise, StatsTypeSet stats) @@ -1023,9 +1022,9 @@ namespace ortc auto &info = *((*iter).second); if (stats.hasStatType(IStatsReportTypes::StatsType_DataChannel)) { - for (auto iter = info.mDataChannels.begin(); iter != info.mDataChannels.end(); ++iter) + for (auto iterChannel = info.mDataChannels.begin(); iterChannel != info.mDataChannels.end(); ++iterChannel) { - auto dataChannelInfo = (*iter).second; + auto dataChannelInfo = (*iterChannel).second; promises.push_back(dataChannelInfo->mDataChannel->getStats(stats)); } } @@ -1098,9 +1097,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IICEGathererDelegate - #pragma mark + // + // PeerConnection => IICEGathererDelegate + // //----------------------------------------------------------------------- void PeerConnection::onICEGathererStateChange( @@ -1237,9 +1236,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IICETransportDelegate - #pragma mark + // + // PeerConnection => IICETransportDelegate + // //----------------------------------------------------------------------- void PeerConnection::onICETransportStateChange( @@ -1281,9 +1280,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IDTLSTransportDelegate - #pragma mark + // + // PeerConnection => IDTLSTransportDelegate + // //----------------------------------------------------------------------- void PeerConnection::onDTLSTransportStateChange( @@ -1310,15 +1309,15 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISRTPSDESTransportDelegate - #pragma mark + // + // PeerConnection => ISRTPSDESTransportDelegate + // //----------------------------------------------------------------------- void PeerConnection::onSRTPSDESTransportLifetimeRemaining( ISRTPSDESTransportPtr transport, - ULONG leastLifetimeRemainingPercentageForAllKeys, - ULONG overallLifetimeRemainingPercentage + ULONG /* leastLifetimeRemainingPercentageForAllKeys */, + ULONG /* overallLifetimeRemainingPercentage */ ) { // ignored @@ -1337,9 +1336,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IRTPListenerDelegate - #pragma mark + // + // PeerConnection => IRTPListenerDelegate + // //----------------------------------------------------------------------- void PeerConnection::onRTPListenerUnhandledRTP( @@ -1358,9 +1357,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IRTPSenderDelegate - #pragma mark + // + // PeerConnection => IRTPSenderDelegate + // //----------------------------------------------------------------------- void PeerConnection::onRTPSenderSSRCConflict( @@ -1375,9 +1374,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISCTPTransportDelegate - #pragma mark + // + // PeerConnection => ISCTPTransportDelegate + // //----------------------------------------------------------------------- void PeerConnection::onSCTPTransportStateChange( @@ -1422,9 +1421,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISCTPTransportListenerDelegate - #pragma mark + // + // PeerConnection => ISCTPTransportListenerDelegate + // //----------------------------------------------------------------------- void PeerConnection::onSCTPTransport(ISCTPTransportPtr transport) @@ -1436,9 +1435,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IDataChannelDelegate - #pragma mark + // + // PeerConnection => IDataChannelDelegate + // //----------------------------------------------------------------------- void PeerConnection::onDataChannelStateChange( @@ -1493,9 +1492,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISCTPTransportListenerDelegate - #pragma mark + // + // PeerConnection => ISCTPTransportListenerDelegate + // //----------------------------------------------------------------------- void PeerConnection::onWake() @@ -1512,9 +1511,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IPromiseSettledDelegate - #pragma mark + // + // PeerConnection => IPromiseSettledDelegate + // //----------------------------------------------------------------------- void PeerConnection::onPromiseSettled(PromisePtr promise) @@ -1554,12 +1553,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => (internal) - #pragma mark + // + // PeerConnection => (internal) + // //----------------------------------------------------------------------- - Log::Params PeerConnection::log(const char *message) const + Log::Params PeerConnection::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::adapter::PeerConnection"); UseServicesHelper::debugAppend(objectEl, "id", mID); @@ -1567,13 +1566,13 @@ namespace ortc } //----------------------------------------------------------------------- - Log::Params PeerConnection::debug(const char *message) const + Log::Params PeerConnection::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //----------------------------------------------------------------------- - ElementPtr PeerConnection::toDebug() const + ElementPtr PeerConnection::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1631,7 +1630,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::wake() + void PeerConnection::wake() noexcept { if (mWakeCalled) return; mWakeCalled = true; @@ -1639,7 +1638,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::notifyNegotiationNeeded() + void PeerConnection::notifyNegotiationNeeded() noexcept { if (isStopped()) return; @@ -1649,7 +1648,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::cancel() + void PeerConnection::cancel() noexcept { if (isShutdown()) { ZS_LOG_TRACE(log("already shutdown")); @@ -1749,15 +1748,13 @@ namespace ortc setState(InternalState_Shutdown); - -#define TODO_CANCEL 1 -#define TODO_CANCEL 2 +#pragma ZS_BUILD_NOTE("TODO","cancel") mGracefulShutdownReference.reset(); } //----------------------------------------------------------------------- - void PeerConnection::setError(WORD errorCode, const char *errorReason) + void PeerConnection::setError(WORD errorCode, const char *errorReason) noexcept { String errorReasonStr(errorReason); if (isStopped()) { @@ -1780,7 +1777,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::step() + void PeerConnection::step() noexcept { if (isStopped()) { ZS_LOG_DEBUG(log("step calling cancel")); @@ -1814,7 +1811,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepCertificates() + bool PeerConnection::stepCertificates() noexcept { ZS_LOG_TRACE(log("step - certificates")); @@ -1859,7 +1856,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessRemote() + bool PeerConnection::stepProcessRemote() noexcept { ZS_LOG_TRACE(log("step - process remote")); @@ -1913,7 +1910,7 @@ namespace ortc } case ISessionDescriptionTypes::SignalingType_SDPRollback: { - ZS_THROW_NOT_IMPLEMENTED("rollback not implemented at this time"); + ZS_ASSERT_FAIL("rollback not implemented at this time"); } } break; @@ -1935,7 +1932,7 @@ namespace ortc } case ISessionDescriptionTypes::SignalingType_SDPRollback: { - ZS_THROW_NOT_IMPLEMENTED("rollback not implemented at this time"); + ZS_ASSERT_FAIL("rollback not implemented at this time"); } } break; @@ -1967,7 +1964,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessRemoteTransport(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessRemoteTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mTransports.begin(); iter != description->mTransports.end(); ++iter) { auto &transport = *(*iter); @@ -1979,6 +1976,55 @@ namespace ortc { auto found = mTransports.find(transport.mID); if (found == mTransports.end()) { + + bool foundUsage = false; + + // remote offered - but is it needed? if the remote bundles another transport then this one is not needed + for (auto iterLines = description->mRTPMediaLines.begin(); iterLines != description->mRTPMediaLines.end(); ++iterLines) + { + auto &mediaLine = (*iterLines); + if (mediaLine->mTransportID.hasData()) { + if (mediaLine->mTransportID == transport.mID) foundUsage = true; + + auto foundExistingTransport = mTransports.find(mediaLine->mTransportID); + if (foundExistingTransport != mTransports.end()) continue; + } + + if (mediaLine->mDetails) { + if (mediaLine->mDetails->mPrivateTransportID.hasData()) { + if (transport.mID == mediaLine->mDetails->mPrivateTransportID) { + foundUsage = true; + break; + } + } + } + } + + for (auto iterLines = description->mSCTPMediaLines.begin(); iterLines != description->mSCTPMediaLines.end(); ++iterLines) + { + auto &mediaLine = (*iterLines); + if (mediaLine->mTransportID.hasData()) { + if (mediaLine->mTransportID == transport.mID) foundUsage = true; + + auto foundExistingTransport = mTransports.find(mediaLine->mTransportID); + if (foundExistingTransport != mTransports.end()) continue; + } + + if (mediaLine->mDetails) { + if (mediaLine->mDetails->mPrivateTransportID.hasData()) { + if (transport.mID == mediaLine->mDetails->mPrivateTransportID) { + foundUsage = true; + break; + } + } + } + } + + if (!foundUsage) { + ZS_LOG_DEBUG(log("transport offered but media lines only use bundled usages thus transport offered is not needed") + transportInfo->toDebug()); + continue; + } + // no matching local transport, create one transportInfo = getTransportFromPool(transport.mID); transportInfo->mNegotiationState = NegotiationState_RemoteOffered; @@ -1987,7 +2033,7 @@ namespace ortc } } - ZS_THROW_INVALID_ASSUMPTION_IF(!transportInfo); + ZS_ASSERT(transportInfo); if (NegotiationState_Rejected == transportInfo->mNegotiationState) { ZS_LOG_WARNING(Debug, log("transport was already rejected") + transportInfo->toDebug()); @@ -2076,6 +2122,44 @@ namespace ortc try { // scope: setup ICE { + for (auto iterCandidates = transport.mRTP->mICECandidates.begin(); iterCandidates != transport.mRTP->mICECandidates.end(); ++iterCandidates) + { + auto &candidate = (*iterCandidates); + if (!candidate) continue; + auto hash = candidate->hash(); + if (transportInfo->mRTP.mProcessedICECandidates.end() != transportInfo->mRTP.mProcessedICECandidates.find(hash)) { + transportInfo->mRTP.mProcessedICECandidates.insert(hash); + transportInfo->mRTP.mTransport->addRemoteCandidate(*candidate); + } + } + if (transport.mRTP->mEndOfCandidates) { + if (!transportInfo->mRTP.mICEEndOfCandidates) { + IICEGathererTypes::CandidateComplete complete; + transportInfo->mRTP.mTransport->addRemoteCandidate(complete); + transportInfo->mRTP.mICEEndOfCandidates = true; + } + } + + if (hasRTCPICE) { + for (auto iterCandidates = transport.mRTCP->mICECandidates.begin(); iterCandidates != transport.mRTCP->mICECandidates.end(); ++iterCandidates) + { + auto &candidate = (*iterCandidates); + if (!candidate) continue; + auto hash = candidate->hash(); + if (transportInfo->mRTCP.mProcessedICECandidates.end() != transportInfo->mRTCP.mProcessedICECandidates.find(hash)) { + transportInfo->mRTCP.mProcessedICECandidates.insert(hash); + transportInfo->mRTCP.mTransport->addRemoteCandidate(*candidate); + } + } + if (transport.mRTCP->mEndOfCandidates) { + if (!transportInfo->mRTCP.mICEEndOfCandidates) { + IICEGathererTypes::CandidateComplete complete; + transportInfo->mRTCP.mTransport->addRemoteCandidate(complete); + transportInfo->mRTCP.mICEEndOfCandidates = true; + } + } + } + transportInfo->mRTP.mTransport->start(transportInfo->mRTP.mGatherer, *(transport.mRTP->mICEParameters), options); if (hasRTCPICE) { transportInfo->mRTCP.mTransport->start(transportInfo->mRTCP.mGatherer, *useRTCPICEParams, options); @@ -2122,8 +2206,8 @@ namespace ortc if ((hasRTPSRTP) && (mConfiguration.mNegotiateSRTPSDES)) { if (!(transportInfo->mRTP.mSRTPSDESTransport)) { - ZS_THROW_INVALID_ASSUMPTION_IF(!transportInfo->mRTP.mSRTPSDESParameters); - ZS_THROW_INVALID_ASSUMPTION_IF(transportInfo->mRTP.mSRTPSDESParameters->mCryptoParams.size() < 1); + ZS_ASSERT(transportInfo->mRTP.mSRTPSDESParameters); + ZS_ASSERT(transportInfo->mRTP.mSRTPSDESParameters->mCryptoParams.size() > 0); auto &encodeCryptoParams = *(transportInfo->mRTP.mSRTPSDESParameters->mCryptoParams.begin()); auto &decodeCryptoParams = *(transport.mRTP->mSRTPSDESParameters->mCryptoParams.begin()); @@ -2197,7 +2281,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessRemoteRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessRemoteRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mRTPMediaLines.begin(); iter != description->mRTPMediaLines.end(); ++iter) { @@ -2238,13 +2322,20 @@ namespace ortc } } + if (mediaLine.mDetails) { + switch (mediaLine.mDetails->mMediaDirection) + { + case ISessionDescriptionTypes::MediaDirection_SendReceive: mediaLineInfo->mDirection = ISessionDescriptionTypes::MediaDirection_SendReceive; break; + case ISessionDescriptionTypes::MediaDirection_Inactive: + case ISessionDescriptionTypes::MediaDirection_SendOnly: mediaLineInfo->mDirection = ISessionDescriptionTypes::MediaDirection_ReceiveOnly; break; + case ISessionDescriptionTypes::MediaDirection_ReceiveOnly: mediaLineInfo->mDirection = ISessionDescriptionTypes::MediaDirection_SendOnly; break; + } + } mediaLineInfo->mMediaType = mediaLine.mMediaType; mediaLineInfo->mBundledTransportID = mediaLine.mTransportID; mediaLineInfo->mPrivateTransportID = mediaLine.mDetails ? mediaLine.mDetails->mPrivateTransportID : String(); mediaLineInfo->mRemoteSenderCapabilities = make_shared(*mediaLine.mSenderCapabilities); mediaLineInfo->mRemoteReceiverCapabilities = make_shared(*mediaLine.mReceiverCapabilities); - mediaLineInfo->mBundledTransportID = mediaLine.mTransportID; - mediaLineInfo->mPrivateTransportID = mediaLine.mDetails ? mediaLine.mDetails->mPrivateTransportID : String(); if ((!mediaLineInfo->mRemoteSenderCapabilities) || (!mediaLineInfo->mRemoteReceiverCapabilities)) { @@ -2311,7 +2402,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessRemoteRTPSenders(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessRemoteRTPSenders(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mRTPSenders.begin(); iter != description->mRTPSenders.end(); ++iter) { auto &sender = *(*iter); @@ -2409,16 +2500,26 @@ namespace ortc goto reject_sender; } + IRTPTransportPtr useRtpTransport = (transportInfo->mRTP.mDTLSTransport ? IRTPTransportPtr(transportInfo->mRTP.mDTLSTransport) : IRTPTransportPtr(transportInfo->mRTP.mSRTPSDESTransport)); + IRTCPTransportPtr useRtcpTransport = (transportInfo->mRTP.mDTLSTransport ? IRTCPTransportPtr(transportInfo->mRTCP.mDTLSTransport) : IRTCPTransportPtr(transportInfo->mRTCP.mTransport)); + if (!receiverInfo->mReceiver) { receiverInfo->mReceiver = IRTPReceiver::create( mThisWeak.lock(), IMediaStreamTrackTypes::toKind(mediaLine->mMediaType), - transportInfo->mRTP.mDTLSTransport ? IRTPTransportPtr(transportInfo->mRTP.mDTLSTransport) : IRTPTransportPtr(transportInfo->mRTP.mSRTPSDESTransport), - transportInfo->mRTP.mDTLSTransport ? IRTCPTransportPtr(transportInfo->mRTCP.mDTLSTransport) : IRTCPTransportPtr(transportInfo->mRTCP.mTransport) + useRtpTransport, + useRtcpTransport ); eventReceiver = true; } + auto existingTransport = receiverInfo->mReceiver->transport(); + PUID existingTransportID = (existingTransport ? existingTransport->getID() : 0); + PUID useTransportID = (useRtpTransport ? useRtpTransport->getID() : 0); + if (existingTransportID != useTransportID) { + receiverInfo->mReceiver->setTransport(useRtpTransport, useRtcpTransport); + } + try { fillRTCPSSRC(*filteredParams); receiverInfo->mReceiver->receive(*filteredParams); @@ -2430,7 +2531,6 @@ namespace ortc goto reject_sender; } - auto existingSet = convertToSet(receiverInfo->mMediaStreams); MediaStreamSet added; @@ -2438,8 +2538,8 @@ namespace ortc calculateDelta(*existingSet, sender.mMediaStreamIDs, added, removed); - for (auto iter = added.begin(); iter != added.end(); ++iter) { - auto &id = (*iter); + for (auto iterAdded = added.begin(); iterAdded != added.end(); ++iterAdded) { + auto &id = (*iterAdded); UseMediaStreamPtr stream; @@ -2456,8 +2556,8 @@ namespace ortc stream->notifyAddTrack(receiverInfo->mReceiver->track()); } - for (auto iter = removed.begin(); iter != removed.end(); ++iter) { - auto &id = (*iter); + for (auto iterRemoved = removed.begin(); iterRemoved != removed.end(); ++iterRemoved) { + auto &id = (*iterRemoved); UseMediaStreamPtr stream; @@ -2518,7 +2618,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessRemoteSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessRemoteSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mSCTPMediaLines.begin(); iter != description->mSCTPMediaLines.end(); ++iter) { @@ -2604,6 +2704,7 @@ namespace ortc mediaLineInfo->mSCTPTransport->setOptions(mConfiguration.mSCTPSocketOptions); } } + if (!mediaLineInfo->mRemotePort.hasValue()) { mediaLineInfo->mRemotePort = mediaLine.mPort; mediaLineInfo->mSCTPTransport->start(*mediaLine.mCapabilities, mediaLine.mPort); @@ -2646,7 +2747,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessLocal() + bool PeerConnection::stepProcessLocal() noexcept { ZS_LOG_TRACE(log("step - process local")); @@ -2700,7 +2801,7 @@ namespace ortc } case ISessionDescriptionTypes::SignalingType_SDPRollback: { - ZS_THROW_NOT_IMPLEMENTED("rollback not implemented at this time"); + ZS_ASSERT_FAIL("rollback not implemented at this time"); } } break; @@ -2722,7 +2823,7 @@ namespace ortc } case ISessionDescriptionTypes::SignalingType_SDPRollback: { - ZS_THROW_NOT_IMPLEMENTED("rollback not implemented at this time"); + ZS_ASSERT_FAIL("rollback not implemented at this time"); } } break; @@ -2754,7 +2855,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessLocalTransport(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessLocalTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mTransports.begin(); iter != description->mTransports.end(); ++iter) { auto &transport = *(*iter); @@ -2775,7 +2876,7 @@ namespace ortc goto reject_transport; } - ZS_THROW_INVALID_ASSUMPTION_IF(!transportInfo); + ZS_ASSERT(transportInfo); if (NegotiationState_Rejected == transportInfo->mNegotiationState) { ZS_LOG_WARNING(Debug, log("transport was already rejected") + transportInfo->toDebug()); @@ -2837,7 +2938,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessLocalRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessLocalRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mRTPMediaLines.begin(); iter != description->mRTPMediaLines.end(); ++iter) { @@ -2901,7 +3002,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessLocalRTPSenders(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessLocalRTPSenders(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mRTPSenders.begin(); iter != description->mRTPSenders.end(); ++iter) { auto &sender = *(*iter); @@ -3044,7 +3145,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessLocalSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description) + bool PeerConnection::stepProcessLocalSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept { for (auto iter = description->mSCTPMediaLines.begin(); iter != description->mSCTPMediaLines.end(); ++iter) { @@ -3101,7 +3202,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepAddTracks() + bool PeerConnection::stepAddTracks() noexcept { typedef std::set TransportIDSet; @@ -3147,11 +3248,11 @@ namespace ortc break; } case UseAdapterHelper::IDPreference_Remote: { - ZS_THROW_INVALID_ASSUMPTION_IF(!mediaLine.mRemoteReceiverCapabilities); + ZS_ASSERT(mediaLine.mRemoteReceiverCapabilities); // filter to the remote capabilities and ensure it's compatible auto senderUnion = UseAdapterHelper::createUnion(*(pending->mConfiguration->mCapabilities), (*(mediaLine.mRemoteReceiverCapabilities)), UseAdapterHelper::IDPreference_Remote); - ZS_THROW_INVALID_ASSUMPTION_IF(!senderUnion); + ZS_ASSERT(senderUnion); if (!UseAdapterHelper::isCompatible(*(mediaLine.mRemoteReceiverCapabilities), *senderUnion)) goto not_compatible; if (!UseAdapterHelper::hasSupportedMediaCodec(*senderUnion)) goto not_compatible; @@ -3168,11 +3269,11 @@ namespace ortc break; } case UseAdapterHelper::IDPreference_Remote: { - ZS_THROW_INVALID_ASSUMPTION_IF(!mediaLine.mRemoteReceiverCapabilities); + ZS_ASSERT(mediaLine.mRemoteReceiverCapabilities); // filter to the remote capabilities and ensure it's compatible auto filteredParameters = UseAdapterHelper::filterParameters(*(pending->mConfiguration->mParameters), (*(mediaLine.mRemoteReceiverCapabilities))); - ZS_THROW_INVALID_ASSUMPTION_IF(!filteredParameters); + ZS_ASSERT(filteredParameters); if (!UseAdapterHelper::isCompatible(*(mediaLine.mRemoteReceiverCapabilities), *filteredParameters)) goto not_compatible; if (!UseAdapterHelper::hasSupportedMediaCodec(*filteredParameters)) goto not_compatible; @@ -3237,7 +3338,7 @@ namespace ortc found_compatible: { auto first = compatibleTransports.begin(); - ZS_THROW_INVALID_ASSUMPTION_IF(first == compatibleTransports.end()); + ZS_ASSERT(first != compatibleTransports.end()); auto bundledTransportID = (*first); auto mediaLine = make_shared(); @@ -3294,7 +3395,7 @@ namespace ortc } } - ZS_THROW_INVALID_ASSUMPTION_IF(!mediaLine); + ZS_ASSERT(mediaLine); // With SDP, the sender and the media line must share the same ID, // but JSON signaling uses a unique ID for the sender. @@ -3339,7 +3440,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepAddSCTPTransport() + bool PeerConnection::stepAddSCTPTransport() noexcept { if (mPendingAddDataChannels.size() < 1) { ZS_LOG_TRACE(log("step - add sctp transport - no pending data channels")); @@ -3410,12 +3511,12 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepCreateOfferOrAnswer() + bool PeerConnection::stepCreateOfferOrAnswer() noexcept { ZS_LOG_TRACE(log("step - create offer")); if (mPendingMethods.size() < 1) { - ZS_LOG_TRACE(log("skipping step to creeate offer (no pending methods)")); + ZS_LOG_TRACE(log("skipping step to create offer (no pending methods)")); return true; } @@ -3488,8 +3589,8 @@ namespace ortc transport->mRTCP = make_shared(); // always get end of candidates state before candidates - transport->mRTP->mEndOfCandidates = (IICEGathererTypes::State_Complete == transportInfo->mRTCP.mGatherer->state()); - transport->mRTP->mICECandidates = *convertCandidateList(*(transportInfo->mRTCP.mGatherer->getLocalCandidates())); + transport->mRTCP->mEndOfCandidates = (IICEGathererTypes::State_Complete == transportInfo->mRTCP.mGatherer->state()); + transport->mRTCP->mICECandidates = *convertCandidateList(*(transportInfo->mRTCP.mGatherer->getLocalCandidates())); } transport->mUseMux = true; @@ -3507,6 +3608,7 @@ namespace ortc if ((isSDP) || (mediaInfo->mPrivateTransportID.hasData())) { mediaLine->mDetails = make_shared(); + mediaLine->mDetails->mMediaDirection = mediaInfo->mDirection; mediaLine->mDetails->mPrivateTransportID = mediaInfo->mPrivateTransportID; if (isSDP) { mediaLine->mDetails->mInternalIndex = mediaInfo->mLineIndex; @@ -3517,8 +3619,7 @@ namespace ortc mediaLine->mDetails->mConnectionData->mRTP->mNetType = mediaLine->mDetails->mConnectionData->mRTCP->mNetType = "IN"; mediaLine->mDetails->mConnectionData->mRTP->mAddrType = mediaLine->mDetails->mConnectionData->mRTCP->mAddrType = "IP4"; mediaLine->mDetails->mConnectionData->mRTP->mConnectionAddress = mediaLine->mDetails->mConnectionData->mRTCP->mConnectionAddress = "0.0.0.0"; -#define TODO_FILL_WITH_CANDIDATE_INFO_LATER 1 -#define TODO_FILL_WITH_CANDIDATE_INFO_LATER 2 +#pragma ZS_BUILD_NOTE("TODO","fill with candidates later") } } mediaLine->mSenderCapabilities = make_shared(*mediaInfo->mLocalSenderCapabilities); @@ -3548,8 +3649,7 @@ namespace ortc mediaLine->mDetails->mConnectionData->mRTP->mNetType = mediaLine->mDetails->mConnectionData->mRTCP->mNetType = "IN"; mediaLine->mDetails->mConnectionData->mRTP->mAddrType = mediaLine->mDetails->mConnectionData->mRTCP->mAddrType = "IP4"; mediaLine->mDetails->mConnectionData->mRTP->mConnectionAddress = mediaLine->mDetails->mConnectionData->mRTCP->mConnectionAddress = "0.0.0.0"; -#define TODO_FILL_WITH_CANDIDATE_INFO_LATER 1 -#define TODO_FILL_WITH_CANDIDATE_INFO_LATER 2 +#pragma ZS_BUILD_NOTE("TODO","fill with candidate info later") } } mediaLine->mCapabilities = ISCTPTransport::getCapabilities(); @@ -3591,7 +3691,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepProcessPendingRemoteCandidates() + bool PeerConnection::stepProcessPendingRemoteCandidates() noexcept { ZS_LOG_TRACE(log("step - process pending remote candidates")); @@ -3645,7 +3745,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepFinalizeSenders() + bool PeerConnection::stepFinalizeSenders() noexcept { ZS_LOG_TRACE("step - finalize senders"); @@ -3682,8 +3782,8 @@ namespace ortc continue; } - ZS_THROW_INVALID_ASSUMPTION_IF(!mediaLine->mLocalSenderCapabilities); - ZS_THROW_INVALID_ASSUMPTION_IF(!mediaLine->mRemoteReceiverCapabilities); + ZS_ASSERT(mediaLine->mLocalSenderCapabilities); + ZS_ASSERT(mediaLine->mRemoteReceiverCapabilities); auto capsUnion = UseAdapterHelper::createUnion(*mediaLine->mLocalSenderCapabilities, *mediaLine->mRemoteReceiverCapabilities, mediaLine->mIDPreference); if (!senderInfo->mParameters) { @@ -3756,7 +3856,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepFinalizeDataChannels() + bool PeerConnection::stepFinalizeDataChannels() noexcept { SCTPMediaLineInfoPtr mediaLine; bool rejectAll = false; @@ -3837,7 +3937,7 @@ namespace ortc static void figureOutState( Optional &ioState, IICEGathererPtr gatherer - ) + ) noexcept { if (!gatherer) return; @@ -3866,7 +3966,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepFixGathererState() + bool PeerConnection::stepFixGathererState() noexcept { ZS_LOG_TRACE("step - fix gatherer state"); @@ -3894,7 +3994,7 @@ namespace ortc static void figureOutState( size_t *stateArray, IICETransportPtr transport - ) + ) noexcept { if (!transport) return; @@ -3906,7 +4006,7 @@ namespace ortc static void figureOutState( size_t *stateArray, IDTLSTransportPtr transport - ) + ) noexcept { if (!transport) return; @@ -3918,7 +4018,7 @@ namespace ortc static void figureOutState( size_t *stateArray, ISRTPSDESTransportPtr transport - ) + ) noexcept { if (!transport) return; @@ -3927,7 +4027,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool PeerConnection::stepFixTransportState() + bool PeerConnection::stepFixTransportState() noexcept { ZS_LOG_TRACE("step - fix gatherer state"); @@ -3936,6 +4036,15 @@ namespace ortc for (auto iter = mTransports.begin(); iter != mTransports.end(); ++iter) { auto &transportInfo = (*iter).second; + + switch (transportInfo->mNegotiationState) + { + case NegotiationState_PendingOffer: + case NegotiationState_Agreed: + case NegotiationState_LocalOffered: + case NegotiationState_RemoteOffered: break; + case NegotiationState_Rejected: continue; + } figureOutState(iceTransportStateCount, transportInfo->mRTP.mTransport); figureOutState(iceTransportStateCount, transportInfo->mRTCP.mTransport); @@ -4031,9 +4140,9 @@ namespace ortc (0 == iceTransportStateCount[IICETransportTypes::State_Failed]) && (0 == dtlsTranportStateCount[IDTLSTransportTypes::State_Failed]) && (0 == iceTransportStateCount[IICETransportTypes::State_Disconnected]) && - ((0 > iceTransportStateCount[IICETransportTypes::State_Closed]) || - (0 > dtlsTranportStateCount[IDTLSTransportTypes::State_Closed]))) { - peerConnectionState = IPeerConnectionTypes::PeerConnectionState_New; + ((iceTransportStateCount[IICETransportTypes::State_Closed] > 0) || + (dtlsTranportStateCount[IDTLSTransportTypes::State_Closed] > 0))) { + peerConnectionState = IPeerConnectionTypes::PeerConnectionState_Closed; } if (((iceTransportStateCount[IICETransportTypes::State_Checking] > 0) || @@ -4079,7 +4188,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::setState(InternalStates state) + void PeerConnection::setState(InternalStates state) noexcept { if (state == mState) return; @@ -4089,7 +4198,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::setState(SignalingStates state) + void PeerConnection::setState(SignalingStates state) noexcept { if (state == mLastSignalingState) return; @@ -4104,7 +4213,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::setState(ICEGatheringStates state) + void PeerConnection::setState(ICEGatheringStates state) noexcept { if (state == mLastICEGatheringStates) return; @@ -4119,7 +4228,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::setState(ICEConnectionStates state) + void PeerConnection::setState(ICEConnectionStates state) noexcept { if (state == mLastICEConnectionState) return; @@ -4134,7 +4243,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::setState(PeerConnectionStates state) + void PeerConnection::setState(PeerConnectionStates state) noexcept { if (state == mLastPeerConnectionState) return; @@ -4152,7 +4261,7 @@ namespace ortc void PeerConnection::addCandidateToTransport( TransportInfo &transport, ICECandidatePtr candidate - ) + ) noexcept { { if (!candidate->mCandidate) { @@ -4179,7 +4288,7 @@ namespace ortc } //----------------------------------------------------------------------- - PeerConnection::TransportInfoPtr PeerConnection::getTransportFromPool(const char *useID) + PeerConnection::TransportInfoPtr PeerConnection::getTransportFromPool(const char *useID) noexcept { String useIDStr(useID); @@ -4198,7 +4307,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::addToTransportPool() + void PeerConnection::addToTransportPool() noexcept { TransportInfoPtr info(make_shared()); @@ -4220,7 +4329,7 @@ namespace ortc } //----------------------------------------------------------------------- - String PeerConnection::registerNewID(size_t length) + String PeerConnection::registerNewID(size_t length) noexcept { size_t tries = 0; @@ -4245,7 +4354,7 @@ namespace ortc } //----------------------------------------------------------------------- - String PeerConnection::registerIDUsage(const char *idStr) + String PeerConnection::registerIDUsage(const char *idStr) noexcept { String str(idStr); @@ -4261,7 +4370,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::unregisterID(const char *idStr) + void PeerConnection::unregisterID(const char *idStr) noexcept { String str(idStr); @@ -4278,7 +4387,7 @@ namespace ortc } //----------------------------------------------------------------------- - WORD PeerConnection::registerNewLocalPort() + WORD PeerConnection::registerNewLocalPort() noexcept { auto capabilities = ISCTPTransport::getCapabilities(); WORD startingPort = capabilities->mMinPort; @@ -4305,7 +4414,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::flushLocalPending(ISessionDescriptionPtr description) + void PeerConnection::flushLocalPending(ISessionDescriptionPtr description) noexcept { if (!mPendingLocalDescription) return; if (!description) return; @@ -4315,7 +4424,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::flushRemotePending(ISessionDescriptionPtr description) + void PeerConnection::flushRemotePending(ISessionDescriptionPtr description) noexcept { if (!mPendingRemoteDescription) return; if (!description) return; @@ -4325,7 +4434,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(TransportInfo &transportInfo) + void PeerConnection::close(TransportInfo &transportInfo) noexcept { close(transportInfo.mRTCP); close(transportInfo.mRTP); @@ -4334,7 +4443,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(TransportInfo::Details &details) + void PeerConnection::close(TransportInfo::Details &details) noexcept { if (details.mSRTPSDESTransport) { details.mSRTPSDESTransport->stop(); @@ -4355,14 +4464,14 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(RTPMediaLineInfo &mediaLineInfo) + void PeerConnection::close(RTPMediaLineInfo &mediaLineInfo) noexcept { mediaLineInfo.mNegotiationState = NegotiationState_Rejected; unregisterID(mediaLineInfo.mID); } //----------------------------------------------------------------------- - void PeerConnection::close(SCTPMediaLineInfo &mediaLineInfo) + void PeerConnection::close(SCTPMediaLineInfo &mediaLineInfo) noexcept { for (auto iter_doNotUse = mediaLineInfo.mDataChannels.begin(); iter_doNotUse != mediaLineInfo.mDataChannels.end(); ) { @@ -4391,7 +4500,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(SenderInfo &senderInfo) + void PeerConnection::close(SenderInfo &senderInfo) noexcept { clearSSRCs(senderInfo); @@ -4421,7 +4530,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(ReceiverInfo &receiverInfo) + void PeerConnection::close(ReceiverInfo &receiverInfo) noexcept { if (receiverInfo.mReceiver) { for (auto iter = receiverInfo.mMediaStreams.begin(); iter != receiverInfo.mMediaStreams.end(); ++iter) { @@ -4444,7 +4553,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(PendingMethod &pending) + void PeerConnection::close(PendingMethod &pending) noexcept { if (pending.mPromise) { pending.mPromise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "connection is closing")); @@ -4453,7 +4562,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(PendingAddTrack &pending) + void PeerConnection::close(PendingAddTrack &pending) noexcept { if (pending.mPromise) { pending.mPromise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "connection is closing")); @@ -4462,7 +4571,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::close(PendingAddDataChannel &pending) + void PeerConnection::close(PendingAddDataChannel &pending) noexcept { if (pending.mPromise) { pending.mPromise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "connection is closing")); @@ -4471,7 +4580,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::insertSSRCs(SenderInfo &senderInfo) + void PeerConnection::insertSSRCs(SenderInfo &senderInfo) noexcept { if (!senderInfo.mParameters) return; @@ -4493,7 +4602,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::clearSSRCs(SenderInfo &senderInfo) + void PeerConnection::clearSSRCs(SenderInfo &senderInfo) noexcept { if (!senderInfo.mParameters) return; @@ -4508,7 +4617,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::clearSSRC(SSRCType ssrc) + void PeerConnection::clearSSRC(SSRCType ssrc) noexcept { { auto found = mAudioSenderSSRCs.find(ssrc); @@ -4525,7 +4634,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::fillRTCPSSRC(IRTPTypes::Parameters &receiverParameters) + void PeerConnection::fillRTCPSSRC(IRTPTypes::Parameters &receiverParameters) noexcept { auto kind = UseRTPTypesHelper::getCodecsKind(receiverParameters); if (!kind.hasValue()) return; @@ -4556,7 +4665,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::purgeNonReferencedAndEmptyStreams() + void PeerConnection::purgeNonReferencedAndEmptyStreams() noexcept { for (auto iter_doNotUse = mMediaStreams.begin(); iter_doNotUse != mMediaStreams.end(); ) { auto current = iter_doNotUse; @@ -4565,14 +4674,14 @@ namespace ortc auto &stream = (*current).second; if (stream->size() > 0) continue; - if (!stream.unique()) continue; + if (stream.use_count() > 1) continue; mMediaStreams.erase(current); } } //----------------------------------------------------------------------- - Optional PeerConnection::getNextHighestMLineIndex() const + Optional PeerConnection::getNextHighestMLineIndex() const noexcept { Optional result; @@ -4613,7 +4722,7 @@ namespace ortc } //----------------------------------------------------------------------- - void PeerConnection::moveAddedTracksToPending() + void PeerConnection::moveAddedTracksToPending() noexcept { for (auto iter = mAddedPendingAddTracks.begin(); iter != mAddedPendingAddTracks.end(); ++iter) { auto &pending = (*iter); @@ -4626,7 +4735,7 @@ namespace ortc void PeerConnection::processStats( PromiseWithStatsReportPtr collectionPromise, PromiseWithStatsReportPtr resolvePromise - ) + ) noexcept { IStatsReportPtr report; @@ -4659,7 +4768,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::MediaStreamListPtr PeerConnection::convertToList(const UseMediaStreamMap &useStreams) + IPeerConnectionTypes::MediaStreamListPtr PeerConnection::convertToList(const UseMediaStreamMap &useStreams) noexcept { auto result = make_shared(); for (auto iter = useStreams.begin(); iter != useStreams.end(); ++iter) { @@ -4671,7 +4780,7 @@ namespace ortc } //----------------------------------------------------------------------- - PeerConnection::UseMediaStreamMapPtr PeerConnection::convertToMap(const MediaStreamList &mediaStreams) + PeerConnection::UseMediaStreamMapPtr PeerConnection::convertToMap(const MediaStreamList &mediaStreams) noexcept { auto result = make_shared(); for (auto iter = mediaStreams.begin(); iter != mediaStreams.end(); ++iter) { @@ -4683,7 +4792,7 @@ namespace ortc } //----------------------------------------------------------------------- - IPeerConnectionTypes::MediaStreamSetPtr PeerConnection::convertToSet(const UseMediaStreamMap &useStreams) + IPeerConnectionTypes::MediaStreamSetPtr PeerConnection::convertToSet(const UseMediaStreamMap &useStreams) noexcept { auto result = make_shared(); @@ -4697,7 +4806,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionTypes::ICECandidateListPtr PeerConnection::convertCandidateList(IICETypes::CandidateList &source) + ISessionDescriptionTypes::ICECandidateListPtr PeerConnection::convertCandidateList(IICETypes::CandidateList &source) noexcept { auto result = make_shared(); @@ -4714,7 +4823,7 @@ namespace ortc const MediaStreamSet &newSet, MediaStreamSet &outAdded, MediaStreamSet &outRemoved - ) + ) noexcept { outAdded.clear(); @@ -4738,7 +4847,7 @@ namespace ortc IDTLSTransportTypes::ParametersPtr PeerConnection::getDTLSParameters( const TransportInfo &transportInfo, IICETypes::Components component - ) + ) noexcept { // scope: get parameters from active dtls transport { @@ -4778,12 +4887,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionFactory - #pragma mark + // + // IPeerConnectionFactory + // //------------------------------------------------------------------------- - IPeerConnectionFactory &IPeerConnectionFactory::singleton() + IPeerConnectionFactory &IPeerConnectionFactory::singleton() noexcept { return PeerConnectionFactory::singleton(); } @@ -4792,14 +4901,14 @@ namespace ortc PeerConnectionPtr IPeerConnectionFactory::create( IPeerConnectionDelegatePtr delegate, const Optional &configuration - ) + ) noexcept { if (this) {} return internal::PeerConnection::create(delegate, configuration); } //------------------------------------------------------------------------- - IPeerConnectionTypes::ServerListPtr IPeerConnectionFactory::getDefaultIceServers() + IPeerConnectionTypes::ServerListPtr IPeerConnectionFactory::getDefaultIceServers() noexcept { if (this) {} return internal::PeerConnection::getDefaultIceServers(); @@ -4812,12 +4921,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes - #pragma mark + // + // IPeerConnectionTypes + // //------------------------------------------------------------------------- - const char *IPeerConnectionTypes::toString(BundlePolicies policy) + const char *IPeerConnectionTypes::toString(BundlePolicies policy) noexcept { switch (policy) { @@ -4829,7 +4938,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *IPeerConnectionTypes::toString(RTCPMuxPolicies policy) + const char *IPeerConnectionTypes::toString(RTCPMuxPolicies policy) noexcept { switch (policy) { @@ -4840,7 +4949,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *IPeerConnectionTypes::toString(SignalingModes mode) + const char *IPeerConnectionTypes::toString(SignalingModes mode) noexcept { switch (mode) { @@ -4851,21 +4960,21 @@ namespace ortc } //------------------------------------------------------------------------- - IPeerConnectionTypes::SignalingModes IPeerConnectionTypes::toSignalingMode(const char *mode) + IPeerConnectionTypes::SignalingModes IPeerConnectionTypes::toSignalingMode(const char *mode) noexcept(false) { String str(mode); for (SignalingModes index = SignalingMode_First; index <= SignalingMode_Last; index = static_cast(static_cast::type>(index) + 1)) { if (0 == str.compareNoCase(toString(index))) return index; } - ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str) + ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str); } //------------------------------------------------------------------------- bool IPeerConnectionTypes::isCompatible( SignalingModes mode, ISessionDescriptionTypes::SignalingTypes signalingType - ) + ) noexcept { switch (signalingType) { @@ -4879,7 +4988,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *IPeerConnectionTypes::toString(SignalingStates state) + const char *IPeerConnectionTypes::toString(SignalingStates state) noexcept { switch (state) { @@ -4894,7 +5003,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *IPeerConnectionTypes::toString(PeerConnectionStates state) + const char *IPeerConnectionTypes::toString(PeerConnectionStates state) noexcept { switch (state) { @@ -4912,12 +5021,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::Configuration - #pragma mark + // + // IPeerConnectionTypes::Configuration + // //------------------------------------------------------------------------- - IPeerConnection::Configuration::Configuration(const Configuration &op2) : + IPeerConnection::Configuration::Configuration(const Configuration &op2) noexcept : mGatherOptions(op2.mGatherOptions ? make_shared(*op2.mGatherOptions) : IICEGathererTypes::OptionsPtr()), mSignalingMode(op2.mSignalingMode), mBundlePolicy(op2.mBundlePolicy), @@ -4928,7 +5037,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr IPeerConnection::Configuration::toDebug() const + ElementPtr IPeerConnection::Configuration::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::IPeerConnectionTypes::Configuration"); @@ -4948,12 +5057,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::OfferAnswerOptions - #pragma mark + // + // IPeerConnectionTypes::OfferAnswerOptions + // //------------------------------------------------------------------------- - ElementPtr IPeerConnection::OfferAnswerOptions::toDebug() const + ElementPtr IPeerConnection::OfferAnswerOptions::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::IPeerConnectionTypes::OfferAnswerOptions"); UseServicesHelper::debugAppend(resultEl, "voice activity detection", mVoiceActivityDetection); @@ -4965,12 +5074,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::OfferOptions - #pragma mark + // + // IPeerConnectionTypes::OfferOptions + // //------------------------------------------------------------------------- - ElementPtr IPeerConnectionTypes::OfferOptions::toDebug() const + ElementPtr IPeerConnectionTypes::OfferOptions::toDebug() const noexcept { auto resultEl = OfferAnswerOptions::toDebug(); resultEl->setValue("ortc::adapter::IPeerConnectionTypes::OfferAnswerOptions"); @@ -4982,12 +5091,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::OfferOptions - #pragma mark + // + // IPeerConnectionTypes::OfferOptions + // //------------------------------------------------------------------------- - ElementPtr IPeerConnectionTypes::AnswerOptions::toDebug() const + ElementPtr IPeerConnectionTypes::AnswerOptions::toDebug() const noexcept { auto resultEl = OfferAnswerOptions::toDebug(); resultEl->setValue("ortc::adapter::IPeerConnectionTypes::AnswerOptions"); @@ -4998,12 +5107,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::CapabilityOptions - #pragma mark + // + // IPeerConnectionTypes::CapabilityOptions + // //------------------------------------------------------------------------- - ElementPtr IPeerConnectionTypes::CapabilityOptions::toDebug() const + ElementPtr IPeerConnectionTypes::CapabilityOptions::toDebug() const noexcept { auto resultEl = OfferAnswerOptions::toDebug(); resultEl->setValue("ortc::adapter::IPeerConnectionTypes::CapabilityOptions"); @@ -5014,20 +5123,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::MediaStreamTrackConfiguration - #pragma mark + // + // IPeerConnectionTypes::MediaStreamTrackConfiguration + // //------------------------------------------------------------------------- - IPeerConnectionTypes::MediaStreamTrackConfiguration::MediaStreamTrackConfiguration(const MediaStreamTrackConfiguration &op2) : + IPeerConnectionTypes::MediaStreamTrackConfiguration::MediaStreamTrackConfiguration(const MediaStreamTrackConfiguration &op2) noexcept : mCapabilities(op2.mCapabilities ? make_shared(*op2.mCapabilities) : IRTPTypes::CapabilitiesPtr()), mParameters(op2.mParameters ? make_shared(*op2.mParameters) : IRTPTypes::ParametersPtr()) { } //------------------------------------------------------------------------- - ElementPtr IPeerConnectionTypes::MediaStreamTrackConfiguration::toDebug() const + ElementPtr IPeerConnectionTypes::MediaStreamTrackConfiguration::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::IPeerConnectionTypes::MediaStreamTrackConfiguration"); UseServicesHelper::debugAppend(resultEl, mCapabilities ? mCapabilities->toDebug() : ElementPtr()); @@ -5036,7 +5145,7 @@ namespace ortc } //------------------------------------------------------------------------- - IPeerConnectionTypes::MediaStreamTrackConfiguration &IPeerConnectionTypes::MediaStreamTrackConfiguration::operator=(const MediaStreamTrackConfiguration &op2) + IPeerConnectionTypes::MediaStreamTrackConfiguration &IPeerConnectionTypes::MediaStreamTrackConfiguration::operator=(const MediaStreamTrackConfiguration &op2) noexcept { mCapabilities = op2.mCapabilities ? make_shared(*op2.mCapabilities) : IRTPTypes::CapabilitiesPtr(); mParameters = op2.mParameters ? make_shared(*op2.mParameters) : IRTPTypes::ParametersPtr(); @@ -5047,12 +5156,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionTypes::ICECandidateErrorEvent - #pragma mark + // + // IPeerConnectionTypes::ICECandidateErrorEvent + // //------------------------------------------------------------------------- - ElementPtr IPeerConnectionTypes::ICECandidateErrorEvent::toDebug() const + ElementPtr IPeerConnectionTypes::ICECandidateErrorEvent::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::IPeerConnectionTypes::ICECandidateErrorEvent"); UseServicesHelper::debugAppend(resultEl, "mid", mMid); @@ -5064,7 +5173,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr IPeerConnectionTypes::MediaStreamTrackEvent::toDebug() const + ElementPtr IPeerConnectionTypes::MediaStreamTrackEvent::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::IPeerConnectionTypes::MediaStreamTrackEvent"); UseServicesHelper::debugAppend(resultEl, "receiver id", mReceiver ? mReceiver->getID() : 0); @@ -5087,21 +5196,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection - #pragma mark + // + // PeerConnection + // //------------------------------------------------------------------------- IPeerConnectionPtr IPeerConnection::create( IPeerConnectionDelegatePtr delegate, const Optional &configuration - ) + ) noexcept { return internal::IPeerConnectionFactory::singleton().create(delegate, configuration); } //------------------------------------------------------------------------- - IPeerConnection::ServerListPtr IPeerConnection::getDefaultIceServers() + IPeerConnection::ServerListPtr IPeerConnection::getDefaultIceServers() noexcept { return internal::IPeerConnectionFactory::singleton().getDefaultIceServers(); } diff --git a/ortc/adapter/cpp/ortc_adapter_SDPParser.cpp b/ortc/adapter/cpp/ortc_adapter_SDPParser.cpp index 85575323..5032c098 100644 --- a/ortc/adapter/cpp/ortc_adapter_SDPParser.cpp +++ b/ortc/adapter/cpp/ortc_adapter_SDPParser.cpp @@ -50,7 +50,7 @@ #pragma warning(3 : 4062) #endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -65,12 +65,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helpers - #pragma mark + // + // Helpers + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::adapter::SDPParser"); } @@ -79,12 +79,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ISDPTypes - #pragma mark + // + // ISDPTypes + // //----------------------------------------------------------------------- - const char *ISDPTypes::toString(LineTypes type) + const char *ISDPTypes::toString(LineTypes type) noexcept(false) { switch (type) { @@ -103,7 +103,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::LineTypes ISDPTypes::toLineType(const char *type) + ISDPTypes::LineTypes ISDPTypes::toLineType(const char *type) noexcept { String str(type); @@ -128,7 +128,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::LineTypes ISDPTypes::toLineType(const char type) + ISDPTypes::LineTypes ISDPTypes::toLineType(const char type) noexcept { Optional result; @@ -150,7 +150,7 @@ namespace ortc } //----------------------------------------------------------------------- - const char *ISDPTypes::toString(Attributes attribute) + const char *ISDPTypes::toString(Attributes attribute) noexcept { switch (attribute) { @@ -190,11 +190,12 @@ namespace ortc case Attribute_SCTPPort: return "sctp-port"; case Attribute_MaxMessageSize: return "max-message-size"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown attribute"); + ZS_ASSERT_FAIL("unknown attribute"); + return ""; } //----------------------------------------------------------------------- - bool ISDPTypes::requiresValue(Attributes attribute) + bool ISDPTypes::requiresValue(Attributes attribute) noexcept { switch (attribute) { @@ -238,7 +239,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool ISDPTypes::requiresEmptyValue(Attributes attribute) + bool ISDPTypes::requiresEmptyValue(Attributes attribute) noexcept { switch (attribute) { @@ -282,7 +283,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::Attributes ISDPTypes::toAttribute(const char *attribute) + ISDPTypes::Attributes ISDPTypes::toAttribute(const char *attribute) noexcept { String str(attribute); for (Attributes index = Attribute_First; index <= Attribute_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -293,7 +294,7 @@ namespace ortc } //----------------------------------------------------------------------- - const char *ISDPTypes::toString(AttributeLevels level) + const char *ISDPTypes::toString(AttributeLevels level) noexcept { switch (level) { @@ -306,11 +307,12 @@ namespace ortc case AttributeLevel_MediaAndSource: return "media+source"; case AttributeLevel_All: return "all"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown attribute level"); + ZS_ASSERT_FAIL("unknown attribute level"); + return "unknown"; } //----------------------------------------------------------------------- - ISDPTypes::AttributeLevels ISDPTypes::toAttributeLevel(const char *level) + ISDPTypes::AttributeLevels ISDPTypes::toAttributeLevel(const char *level) noexcept(false) { static AttributeLevels check[] = { @@ -332,7 +334,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AttributeLevels ISDPTypes::getAttributeLevel(LineTypes lineType) + ISDPTypes::AttributeLevels ISDPTypes::getAttributeLevel(LineTypes lineType) noexcept { switch (lineType) { @@ -347,11 +349,12 @@ namespace ortc case LineType_m_MediaLine: return AttributeLevel_Session; case LineType_c_ConnectionDataLine: return AttributeLevel_SessionAndMedia; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown line type"); + ZS_ASSERT_FAIL("unknown line type"); + return AttributeLevel_None; } //----------------------------------------------------------------------- - ISDPTypes::AttributeLevels ISDPTypes::getAttributeLevel(Attributes attribute) + ISDPTypes::AttributeLevels ISDPTypes::getAttributeLevel(Attributes attribute) noexcept { switch (attribute) { @@ -363,7 +366,7 @@ namespace ortc case Attribute_MSIDSemantic: return AttributeLevel_Session; case Attribute_ICEUFrag: return AttributeLevel_SessionAndMedia; case Attribute_ICEPwd: return AttributeLevel_SessionAndMedia; - case Attribute_ICEOptions: return AttributeLevel_Session; + case Attribute_ICEOptions: return AttributeLevel_SessionAndMedia; case Attribute_ICELite: return AttributeLevel_Session; case Attribute_Candidate: return AttributeLevel_Media; case Attribute_EndOfCandidates: return AttributeLevel_Media; @@ -391,14 +394,15 @@ namespace ortc case Attribute_SCTPPort: return AttributeLevel_Media; case Attribute_MaxMessageSize: return AttributeLevel_Media; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown attribute"); + ZS_ASSERT_FAIL("unknown attribute"); + return AttributeLevel_None; } //----------------------------------------------------------------------- bool ISDPTypes::supportedAtLevel( AttributeLevels currentLevel, LineTypes lineType - ) + ) noexcept { auto allowedLevels = getAttributeLevel(lineType); return (0 != (allowedLevels & currentLevel)); @@ -408,35 +412,51 @@ namespace ortc bool ISDPTypes::supportedAtLevel( AttributeLevels currentLevel, Attributes attribute - ) + ) noexcept { auto allowedLevels = getAttributeLevel(attribute); return (0 != (allowedLevels & currentLevel)); } //----------------------------------------------------------------------- - const char *ISDPTypes::toString(Locations location) + const char *ISDPTypes::toString(Locations location) noexcept { switch (location) { case Location_Local: return "local"; case Location_Remote: return "remote"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown location"); + ZS_ASSERT_FAIL("unknown location"); + return ""; } //----------------------------------------------------------------------- - ISDPTypes::Locations ISDPTypes::toLocation(const char *location) + ISDPTypes::Locations ISDPTypes::toLocation(const char *location) noexcept(false) { String str(location); for (Locations index = Location_First; index <= Location_Last; index = static_cast(static_cast::type>(index) + 1)) { if (0 == str.compare(toString(index))) return index; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown location"); + ORTC_THROW_INVALID_PARAMETERS("unknown location"); + } + + //----------------------------------------------------------------------- + const char *ISDPTypes::toStringForA(Directions direction) noexcept + { + switch (direction) + { + case Direction_None: return "inactive"; + case Direction_Send: return "sendonly"; + case Direction_Receive: return "recvonly"; + case Direction_SendReceive: return "sendrecv"; + } + + ZS_ASSERT_FAIL("unknown direction"); + return ""; } //----------------------------------------------------------------------- - const char *ISDPTypes::toString(Directions direction) + const char *ISDPTypes::toStringForRID(Directions direction) noexcept { switch (direction) { @@ -446,11 +466,12 @@ namespace ortc case Direction_SendReceive: return "sendrecv"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown direction"); + ZS_ASSERT_FAIL("unknown direction"); + return ""; } //----------------------------------------------------------------------- - ISDPTypes::Directions ISDPTypes::toDirection(const char *direction) + ISDPTypes::Directions ISDPTypes::toDirection(const char *direction) noexcept(false) { static Directions check[] = { @@ -464,7 +485,10 @@ namespace ortc if (str.isEmpty()) return Direction_None; for (size_t index = 0; index <= (sizeof(check)/sizeof(check[0])); ++index) { - if (0 == str.compareNoCase(toString(check[index]))) return check[index]; + if (0 == str.compareNoCase(toStringForA(check[index]))) return check[index]; + } + for (size_t index = 0; index <= (sizeof(check) / sizeof(check[0])); ++index) { + if (0 == str.compareNoCase(toStringForRID(check[index]))) return check[index]; } ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str); @@ -477,7 +501,7 @@ namespace ortc bool allowSend, bool allowReceive, bool allowSendReceive - ) + ) noexcept { if ((!allowNone) && (Direction_None == direction)) return false; @@ -491,7 +515,7 @@ namespace ortc } //----------------------------------------------------------------------- - const char *ISDPTypes::toString(ActorRoles actor) + const char *ISDPTypes::toString(ActorRoles actor) noexcept { switch (actor) { @@ -499,11 +523,12 @@ namespace ortc case ActorRole_Receiver: return "receiver"; case ActorRole_Transceiver: return "transceiver"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown actor role"); + ZS_ASSERT_FAIL("unknown actor role"); + return ""; } //----------------------------------------------------------------------- - ISDPTypes::ActorRoles ISDPTypes::toActorRole(const char *actor) + ISDPTypes::ActorRoles ISDPTypes::toActorRole(const char *actor) noexcept(false) { static ActorRoles check[] = { @@ -526,7 +551,7 @@ namespace ortc ActorRoles actor, Locations location, Directions direction - ) + ) noexcept { switch (actor) { @@ -555,11 +580,12 @@ namespace ortc } } } - ORTC_THROW_NOT_SUPPORTED_ERRROR("role / location was not found"); + ZS_ASSERT_FAIL("role / location was not found"); + return false; } //----------------------------------------------------------------------- - const char *ISDPTypes::toString(ProtocolTypes proto) + const char *ISDPTypes::toString(ProtocolTypes proto) noexcept { switch (proto) { @@ -567,11 +593,12 @@ namespace ortc case ProtocolType_RTP: return "UDP/TLS/RTP/SAVPF"; case ProtocolType_SCTP: return "UDP/DTLS/SCTP"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown protocol type"); + ZS_ASSERT_FAIL("unknown protocol type"); + return ""; } //----------------------------------------------------------------------- - ISDPTypes::ProtocolTypes ISDPTypes::toProtocolType(const char *proto) + ISDPTypes::ProtocolTypes ISDPTypes::toProtocolType(const char *proto) noexcept(false) { String str(proto); IHelper::SplitMap protoSplit; @@ -611,12 +638,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark LineValue types - #pragma mark + // + // LineValue types + // //----------------------------------------------------------------------- - ISDPTypes::VLine::VLine(const char *value) + ISDPTypes::VLine::VLine(const char *value) noexcept(false) { String str(value); str.trim(); @@ -631,7 +658,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::OLine::OLine(const char *value) + ISDPTypes::OLine::OLine(const char *value) noexcept(false) { IHelper::SplitMap split; IHelper::split(String(value), split, " "); @@ -656,7 +683,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::OLine::toString() const + String ISDPTypes::OLine::toString() const noexcept { String result; result.reserve(50); @@ -675,13 +702,13 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::SLine::SLine(const char *value) : + ISDPTypes::SLine::SLine(const char *value) noexcept : mSessionName(value) { } //----------------------------------------------------------------------- - ISDPTypes::BLine::BLine(MLinePtr mline, const char *value) : + ISDPTypes::BLine::BLine(MLinePtr mline, const char *value) noexcept(false) : MediaLine(mline) { String str(value); @@ -700,7 +727,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::TLine::TLine(const char *value) + ISDPTypes::TLine::TLine(const char *value) noexcept(false) { IHelper::SplitMap split; IHelper::split(String(value), split, " "); @@ -720,7 +747,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::MLine::MLine(const char *value) + ISDPTypes::MLine::MLine(const char *value) noexcept(false) { IHelper::SplitMap split; IHelper::split(String(value), split, " "); @@ -762,7 +789,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::MLine::toString() const + String ISDPTypes::MLine::toString() const noexcept { String result; result.append(mMedia); @@ -780,7 +807,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::CLine::CLine(MLinePtr mline, const char *value) : + ISDPTypes::CLine::CLine(MLinePtr mline, const char *value) noexcept(false) : MediaLine(mline) { IHelper::SplitMap split; @@ -794,7 +821,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::CLine::toString() const + String ISDPTypes::CLine::toString() const noexcept { String result; result.append(mNetType.hasData() ? mNetType : String("IN")); @@ -809,12 +836,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ALine types - #pragma mark + // + // ALine types + // //----------------------------------------------------------------------- - ISDPTypes::AGroupLine::AGroupLine(const char *value) + ISDPTypes::AGroupLine::AGroupLine(const char *value) noexcept(false) { IHelper::SplitMap split; IHelper::split(String(value), split, " "); @@ -830,7 +857,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::AGroupLine::toString() const + String ISDPTypes::AGroupLine::toString() const noexcept { if (mSemantic.isEmpty()) return String(); @@ -842,7 +869,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AMSIDLine::AMSIDLine(MLinePtr mline, const char *value) : + ISDPTypes::AMSIDLine::AMSIDLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -858,7 +885,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::AMSIDLine::toString() const + String ISDPTypes::AMSIDLine::toString() const noexcept { String result; result.append("msid:"); @@ -871,7 +898,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AICEUFragLine::AICEUFragLine(MLinePtr mline, const char *value) : + ISDPTypes::AICEUFragLine::AICEUFragLine(MLinePtr mline, const char *value) noexcept : AMediaLine(mline), mICEUFrag(value) { @@ -879,7 +906,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AICEPwdLine::AICEPwdLine(MLinePtr mline, const char *value) : + ISDPTypes::AICEPwdLine::AICEPwdLine(MLinePtr mline, const char *value) noexcept : AMediaLine(mline), mICEPwd(value) { @@ -887,7 +914,8 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AICEOptionsLine::AICEOptionsLine(const char *value) + ISDPTypes::AICEOptionsLine::AICEOptionsLine(MLinePtr mline, const char *value) noexcept(false) : + AMediaLine(mline) { IHelper::SplitMap split; IHelper::split(String(value), split, " "); @@ -896,13 +924,12 @@ namespace ortc ORTC_THROW_INVALID_PARAMETERS_IF(split.size() < 1); for (auto iter = split.begin(); iter != split.end(); ++iter) { - auto &value = (*iter).second; mTags.push_back(value); } } //----------------------------------------------------------------------- - String ISDPTypes::AICEOptionsLine::toString() const + String ISDPTypes::AICEOptionsLine::toString() const noexcept { String result; result.append("ice-options:"); @@ -911,7 +938,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ACandidateLine::ACandidateLine(MLinePtr mline, const char *value) : + ISDPTypes::ACandidateLine::ACandidateLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -953,27 +980,27 @@ namespace ortc if (split.size() > 8) { for (size_t index = 10; index < split.size(); index += 2) { - ExtensionPair value(split[index], split[index + 1]); - if (0 == value.first.compareNoCase("raddr")) { - mRelAddr = value.second; + ExtensionPair valuePair(split[index], split[index + 1]); + if (0 == valuePair.first.compareNoCase("raddr")) { + mRelAddr = valuePair.second; continue; } - if (0 == value.first.compareNoCase("rport")) { + if (0 == valuePair.first.compareNoCase("rport")) { try { - mRelPort = Numeric(value.second); + mRelPort = Numeric(valuePair.second); } catch (const Numeric::ValueOutOfRange &) { ORTC_THROW_INVALID_PARAMETERS("rel port value out of range: " + split[9]); } continue; } - mExtensionPairs.push_back(value); + mExtensionPairs.push_back(valuePair); } } } //----------------------------------------------------------------------- - String ISDPTypes::ACandidateLine::toString() const + String ISDPTypes::ACandidateLine::toString() const noexcept { String result; result.append("candidate:"); @@ -1018,7 +1045,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AFingerprintLine::AFingerprintLine(MLinePtr mline, const char *value) : + ISDPTypes::AFingerprintLine::AFingerprintLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1032,7 +1059,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::AFingerprintLine::toString() const + String ISDPTypes::AFingerprintLine::toString() const noexcept { String result; if (mHashFunc.isEmpty() && mFingerprint.isEmpty()) return result; @@ -1045,7 +1072,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ACryptoLine::ACryptoLine(MLinePtr mline, const char *value) : + ISDPTypes::ACryptoLine::ACryptoLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1085,7 +1112,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ACryptoLine::toString() const + String ISDPTypes::ACryptoLine::toString() const noexcept { String result; result.append("crypto:"); @@ -1124,7 +1151,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ASetupLine::ASetupLine(MLinePtr mline, const char *value) : + ISDPTypes::ASetupLine::ASetupLine(MLinePtr mline, const char *value) noexcept : AMediaLine(mline), mSetup(value) { @@ -1132,7 +1159,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AMIDLine::AMIDLine(MLinePtr mline, const char *value) : + ISDPTypes::AMIDLine::AMIDLine(MLinePtr mline, const char *value) noexcept : AMediaLine(mline), mMID(value) { @@ -1140,7 +1167,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AExtmapLine::AExtmapLine(MLinePtr mline, const char *value) : + ISDPTypes::AExtmapLine::AExtmapLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1174,7 +1201,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::AExtmapLine::toString() const + String ISDPTypes::AExtmapLine::toString() const noexcept { String result; result.append("extmap:"); @@ -1188,7 +1215,7 @@ namespace ortc case Direction_Send: case Direction_Receive: { result.append("/"); - result.append(ISDPTypes::toString(mDirection)); + result.append(ISDPTypes::toStringForA(mDirection)); break; } } @@ -1202,7 +1229,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AMediaDirectionLine::AMediaDirectionLine(MLinePtr mline, const char *value) : + ISDPTypes::AMediaDirectionLine::AMediaDirectionLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { String str(value); @@ -1212,7 +1239,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ARTPMapLine::ARTPMapLine(MLinePtr mline, const char *value) : + ISDPTypes::ARTPMapLine::ARTPMapLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1251,7 +1278,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ARTPMapLine::toString() const + String ISDPTypes::ARTPMapLine::toString() const noexcept { String result; result.append("rtpmap:"); @@ -1268,7 +1295,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AFMTPLine::AFMTPLine(MLinePtr mline, ASSRCLinePtr sourceLine, const char *value) : + ISDPTypes::AFMTPLine::AFMTPLine(MLinePtr mline, ASSRCLinePtr sourceLine, const char *value) noexcept(false): AMediaLine(mline), mSourceLine(sourceLine) { @@ -1293,7 +1320,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::AFMTPLine::toString() const + String ISDPTypes::AFMTPLine::toString() const noexcept { String result; if (mFormatSpecific.size() < 1) return result; @@ -1310,7 +1337,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ARTCPLine::ARTCPLine(MLinePtr mline, const char *value) : + ISDPTypes::ARTCPLine::ARTCPLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1334,7 +1361,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ARTCPLine::toString() const + String ISDPTypes::ARTCPLine::toString() const noexcept { String result; result.append("rtcp:"); @@ -1351,7 +1378,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ARTCPFBLine::ARTCPFBLine(MLinePtr mline, const char *value) : + ISDPTypes::ARTCPFBLine::ARTCPFBLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1379,7 +1406,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ARTCPFBLine::toString() const + String ISDPTypes::ARTCPFBLine::toString() const noexcept { String result; if (mID.isEmpty()) return result; @@ -1400,7 +1427,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::APTimeLine::APTimeLine(MLinePtr mline, const char *value) : + ISDPTypes::APTimeLine::APTimeLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { String str(value); @@ -1412,7 +1439,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AMaxPTimeLine::AMaxPTimeLine(MLinePtr mline, const char *value) : + ISDPTypes::AMaxPTimeLine::AMaxPTimeLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { String str(value); @@ -1424,7 +1451,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ASSRCLine::ASSRCLine(MLinePtr mline, const char *value) : + ISDPTypes::ASSRCLine::ASSRCLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1453,7 +1480,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ASSRCLine::toString() const + String ISDPTypes::ASSRCLine::toString() const noexcept { String result; result.append("ssrc:"); @@ -1471,7 +1498,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ASSRCGroupLine::ASSRCGroupLine(MLinePtr mline, const char *value) : + ISDPTypes::ASSRCGroupLine::ASSRCGroupLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1498,7 +1525,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ASSRCGroupLine::toString() const + String ISDPTypes::ASSRCGroupLine::toString() const noexcept { String result; if (!mSemantics.hasData()) return result; @@ -1516,7 +1543,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ARIDLine::ARIDLine(MLinePtr mline, const char *value) : + ISDPTypes::ARIDLine::ARIDLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1573,7 +1600,7 @@ namespace ortc } //----------------------------------------------------------------------- - String ISDPTypes::ARIDLine::toString() const + String ISDPTypes::ARIDLine::toString() const noexcept { String result; if (!mID.hasData()) return result; @@ -1584,13 +1611,12 @@ namespace ortc case ISDPTypes::Direction_None: case ISDPTypes::Direction_SendReceive: return String(); case ISDPTypes::Direction_Send: - case ISDPTypes::Direction_Receive: result.append(ISDPTypes::toString(mDirection)); break; + case ISDPTypes::Direction_Receive: result.append(ISDPTypes::toStringForRID(mDirection)); break; } bool inserted = false; if (mPayloadTypes.size() > 0) { result.append(" "); result.append("pt="); - bool first = true; for (auto iter = mPayloadTypes.begin(); iter != mPayloadTypes.end(); ++iter) { auto &pt = (*iter); if (inserted) result.append(","); @@ -1618,7 +1644,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ASimulcastLine::ASimulcastLine(MLinePtr mline, const char *value) : + ISDPTypes::ASimulcastLine::ASimulcastLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { IHelper::SplitMap split; @@ -1671,7 +1697,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::ASCTPPortLine::ASCTPPortLine(MLinePtr mline, const char *value) : + ISDPTypes::ASCTPPortLine::ASCTPPortLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { String str(value); @@ -1683,7 +1709,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::AMaxMessageSizeLine::AMaxMessageSizeLine(MLinePtr mline, const char *value) : + ISDPTypes::AMaxMessageSizeLine::AMaxMessageSizeLine(MLinePtr mline, const char *value) noexcept(false) : AMediaLine(mline) { String str(value); diff --git a/ortc/adapter/cpp/ortc_adapter_SDPParser_DescriptionToSDP.cpp b/ortc/adapter/cpp/ortc_adapter_SDPParser_DescriptionToSDP.cpp index 24511d71..f5f384b6 100644 --- a/ortc/adapter/cpp/ortc_adapter_SDPParser_DescriptionToSDP.cpp +++ b/ortc/adapter/cpp/ortc_adapter_SDPParser_DescriptionToSDP.cpp @@ -50,7 +50,7 @@ #pragma warning(3 : 4062) #endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -65,12 +65,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helpers - #pragma mark + // + // Helpers + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::adapter::SDPParser"); } @@ -79,15 +79,15 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SDPParser - #pragma mark + // + // SDPParser + // //----------------------------------------------------------------------- void appendToBundle( ISDPTypes::BundleMap &ioBundle, const ISessionDescription::MediaLine &mediaLine - ) + ) noexcept { if (mediaLine.mID.isEmpty()) return; if (mediaLine.mTransportID.isEmpty()) return; @@ -106,11 +106,12 @@ namespace ortc //----------------------------------------------------------------------- void SDPParser::createSDPSessionLevel( - const GeneratorOptions &options, + ZS_MAYBE_USED() const GeneratorOptions &options, const Description &description, SDP &ioSDP - ) + ) noexcept(false) { + ZS_MAYBE_USED(options); auto &result = ioSDP; result.mOLine = make_shared(Noop{}); result.mSLine = make_shared(Noop{}); @@ -142,7 +143,6 @@ namespace ortc } for (auto iter = bundles.begin(); iter != bundles.end(); ++iter) { - auto &bundleID = (*iter).first; auto &bundleSet = (*iter).second; if (bundleSet.size() < 2) continue; @@ -163,35 +163,51 @@ namespace ortc static void createSDPMediaLineBase( const ISessionDescriptionTypes::Description &description, const ISessionDescriptionTypes::MediaLine &mediaLine, - ISDPTypes::SDP &ioSDP, + ZS_MAYBE_USED() ISDPTypes::SDP &ioSDP, ISDPTypes::MLine &ioMLine - ) + ) noexcept(false) { - auto &result = ioSDP; + ZS_MAYBE_USED(ioSDP); auto &mline = ioMLine; ORTC_THROW_INVALID_PARAMETERS_IF(!mediaLine.mDetails); + bool foundPort = false; + mline.mMedia = mediaLine.mMediaType; mline.mPort = 9; mline.mProtoStr = mediaLine.mDetails->mProtocol; mline.mProto = ISDPTypes::toProtocolType(mline.mProtoStr); - // figure out the port based upon the associated transport's ICE candidates - for (auto iter = description.mTransports.begin(); iter != description.mTransports.end(); ++iter) { - auto &transport = *(*iter); - if (0 != transport.mID.compareNoCase(mediaLine.mTransportID)) continue; + if (mediaLine.mDetails) { + if (mediaLine.mDetails->mConnectionData) { + if (mediaLine.mDetails->mConnectionData->mRTP) { + if (mediaLine.mDetails->mConnectionData->mRTP->mPort.hasValue()) { + mline.mPort = mediaLine.mDetails->mConnectionData->mRTP->mPort.value(); + foundPort = true; + } + } + } + } - if (!transport.mRTP) break; - if (transport.mRTP->mICECandidates.size() < 1) break; + if (!foundPort) { + // figure out the port based upon the associated transport's ICE candidates + for (auto iter = description.mTransports.begin(); iter != description.mTransports.end(); ++iter) { + auto &transport = *(*iter); + if (0 != transport.mID.compareNoCase(mediaLine.mTransportID)) continue; - for (auto iterCandidate = transport.mRTP->mICECandidates.begin(); iterCandidate != transport.mRTP->mICECandidates.end(); ++iterCandidate) { - auto &candidate = *(*iterCandidate); - if (IICETypes::CandidateType_Host != candidate.mCandidateType) continue; - mline.mPort = candidate.mPort; - } + if (!transport.mRTP) break; + if (transport.mRTP->mICECandidates.size() < 1) break; - if (9 != mline.mPort) break; + for (auto iterCandidate = transport.mRTP->mICECandidates.begin(); iterCandidate != transport.mRTP->mICECandidates.end(); ++iterCandidate) { + auto &candidate = *(*iterCandidate); + if (IICETypes::CandidateType_Host != candidate.mCandidateType) continue; + mline.mPort = candidate.mPort; + break; + } + + if (9 != mline.mPort) break; + } } } @@ -201,9 +217,8 @@ namespace ortc const ISessionDescriptionTypes::RTPMediaLine &mediaLine, ISDPTypes::SDP &ioSDP, ISDPTypes::MLine &ioMLine - ) + ) noexcept(false) { - auto &result = ioSDP; auto &mline = ioMLine; createSDPMediaLineBase(description, mediaLine, ioSDP, ioMLine); @@ -224,9 +239,8 @@ namespace ortc const ISessionDescriptionTypes::SCTPMediaLine &mediaLine, ISDPTypes::SDP &ioSDP, ISDPTypes::MLine &ioMLine - ) + ) noexcept { - auto &result = ioSDP; auto &mline = ioMLine; createSDPMediaLineBase(description, mediaLine, ioSDP, ioMLine); @@ -238,10 +252,11 @@ namespace ortc static void figureOutBundle( const ISessionDescriptionTypes::Description &description, const ISessionDescriptionTypes::MediaLine &mediaLine, - ISDPTypes::SDP &ioSDP, + ZS_MAYBE_USED() ISDPTypes::SDP &ioSDP, ISessionDescriptionTypes::TransportPtr &outAnnounceTransport - ) + ) noexcept(false) { + ZS_MAYBE_USED(ioSDP); ORTC_THROW_INVALID_PARAMETERS_IF(!mediaLine.mDetails); String searchTransport = mediaLine.mDetails->mPrivateTransportID; @@ -285,7 +300,7 @@ namespace ortc } //----------------------------------------------------------------------- - static ISDPTypes::ACandidateLinePtr fillCandidate(const IICETypes::Candidate &candidate) + static ISDPTypes::ACandidateLinePtr fillCandidate(const IICETypes::Candidate &candidate) noexcept { auto aCandidate = make_shared(Noop{}); aCandidate->mFoundation = candidate.mFoundation; @@ -313,12 +328,14 @@ namespace ortc //----------------------------------------------------------------------- static void fillCandidates( - const ISessionDescriptionTypes::MediaLine &mediaLine, - const ISessionDescriptionTypes::Transport &transport, + ZS_MAYBE_USED() const ISessionDescriptionTypes::MediaLine &mediaLine, + ZS_MAYBE_USED() const ISessionDescriptionTypes::Transport &transport, ISDPTypes::MLine &ioMLine, const ISessionDescriptionTypes::ICECandidateList &candidates - ) + ) noexcept { + ZS_MAYBE_USED(mediaLine); + ZS_MAYBE_USED(transport); auto &mline = ioMLine; for (auto iter = candidates.begin(); iter != candidates.end(); ++iter) { @@ -332,7 +349,7 @@ namespace ortc const ISessionDescriptionTypes::MediaLine &mediaLine, const ISessionDescriptionTypes::Transport &transport, ISDPTypes::MLine &ioMLine - ) + ) noexcept { auto &mline = ioMLine; @@ -362,7 +379,7 @@ namespace ortc const ISessionDescriptionTypes::MediaLine &mediaLine, ISDPTypes::SDP &ioSDP, ISDPTypes::MLine &ioMLine - ) + ) noexcept(false) { auto &result = ioSDP; auto &mline = ioMLine; @@ -464,7 +481,7 @@ namespace ortc static void fillFormat( const IRTPTypes::OpusCodecCapabilityParameters &source, ISDPTypes::AFMTPLine &result - ) + ) noexcept { if (source.mMaxPlaybackRate.hasValue()) { result.mFormatSpecific.push_back(String("maxplaybackrate=") + string(source.mMaxPlaybackRate.value()) + ";"); @@ -496,7 +513,7 @@ namespace ortc static void fillFormat( const IRTPTypes::VP8CodecCapabilityParameters &source, ISDPTypes::AFMTPLine &result - ) + ) noexcept { if (source.mMaxFR.hasValue()) { result.mFormatSpecific.push_back(String("max-fr=") + string(source.mMaxFR.value()) + ";"); @@ -510,7 +527,7 @@ namespace ortc static void fillFormat( const IRTPTypes::H264CodecCapabilityParameters &source, ISDPTypes::AFMTPLine &result - ) + ) noexcept { if (source.mProfileLevelID.hasValue()) { result.mFormatSpecific.push_back(String("profile-level-id=") + string(source.mProfileLevelID.value()) + ";"); @@ -543,7 +560,7 @@ namespace ortc static void fillFormat( const IRTPTypes::RTXCodecCapabilityParameters &source, ISDPTypes::AFMTPLine &result - ) + ) noexcept { if (Milliseconds() != source.mRTXTime) { result.mFormatSpecific.push_back(String("apt=") + string(source.mApt) + ";rtx-time=" + string(source.mRTXTime.count()) + ";"); @@ -556,7 +573,7 @@ namespace ortc static void fillFormat( const IRTPTypes::FlexFECCodecCapabilityParameters &source, ISDPTypes::AFMTPLine &result - ) + ) noexcept { if (source.mL.hasValue()) { result.mFormatSpecific.push_back(String("L:") + string(source.mL.value()) + ";"); @@ -576,7 +593,7 @@ namespace ortc static ISDPTypes::AFMTPLinePtr fillFormat( const IRTPTypes::CodecCapability &codec, ISDPTypes::PayloadType pt - ) + ) noexcept { if (!codec.mParameters) return nullptr; @@ -645,14 +662,16 @@ namespace ortc //----------------------------------------------------------------------- static void fillRTPMediaLine( - const SDPParser::GeneratorOptions &options, - const ISessionDescriptionTypes::Description &description, + ZS_MAYBE_USED() const SDPParser::GeneratorOptions &options, + ZS_MAYBE_USED() const ISessionDescriptionTypes::Description &description, const ISessionDescriptionTypes::RTPMediaLine &mediaLine, - ISDPTypes::SDP &ioSDP, + ZS_MAYBE_USED() ISDPTypes::SDP &ioSDP, ISDPTypes::MLine &ioMLine - ) + ) noexcept { - auto &result = ioSDP; + ZS_MAYBE_USED(options); + ZS_MAYBE_USED(description); + ZS_MAYBE_USED(ioSDP); auto &mline = ioMLine; if (mediaLine.mReceiverCapabilities) { @@ -708,7 +727,7 @@ namespace ortc ISDPTypes::MLine &mline, ISDPTypes::SSRCType ssrc, const String &cname - ) + ) noexcept { if (!cname.hasData()) return; @@ -725,7 +744,7 @@ namespace ortc ISDPTypes::SSRCType mainSSRC, ISDPTypes::SSRCType relatedSSRC, const String &cname - ) + ) noexcept { auto ssrcFID = make_shared(Noop{}); ssrcFID->mSemantics = String(groupSemantic); @@ -740,7 +759,7 @@ namespace ortc const GeneratorOptions &options, const Description &description, SDP &ioSDP - ) + ) noexcept(false) { auto &result = ioSDP; @@ -838,8 +857,7 @@ namespace ortc } } -#define NOTE_THIS_IS_FOR_LEGACY_REMOVE_WHEN_POSSIBLE 1 -#define NOTE_THIS_IS_FOR_LEGACY_REMOVE_WHEN_POSSIBLE 2 +#pragma ZS_BUILD_NOTE("TODO","This is legacy - remove when possible") // NOTE: LEGACY SUPPORT ONLY auto ssrcLabel = make_shared(Noop{}); @@ -918,7 +936,7 @@ namespace ortc ISDPTypes::SDPPtr SDPParser::createSDP( const GeneratorOptions &options, const Description &description - ) + ) noexcept(false) { SDPPtr result(make_shared()); @@ -933,7 +951,7 @@ namespace ortc } //----------------------------------------------------------------------- - String SDPParser::getCandidateSDP(const IICETypes::Candidate &candidate) + String SDPParser::getCandidateSDP(const IICETypes::Candidate &candidate) noexcept { auto result = internal::fillCandidate(candidate); if (!result) { diff --git a/ortc/adapter/cpp/ortc_adapter_SDPParser_GenerateSDP.cpp b/ortc/adapter/cpp/ortc_adapter_SDPParser_GenerateSDP.cpp index ded6ce9b..03e16a36 100644 --- a/ortc/adapter/cpp/ortc_adapter_SDPParser_GenerateSDP.cpp +++ b/ortc/adapter/cpp/ortc_adapter_SDPParser_GenerateSDP.cpp @@ -46,11 +46,11 @@ #include -#ifdef _MSC_VER -#pragma warning(3 : 4062) -#endif //_MSC_VER +//#ifdef _MSC_VER +//#pragma warning(3 : 4062) +//#endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -65,25 +65,25 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helpers - #pragma mark + // + // Helpers + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::adapter::SDPParser"); } //----------------------------------------------------------------------- - static String eol() + static String eol() noexcept { static String result("\r\n"); return result; } //----------------------------------------------------------------------- - static void appendLine(String &ioResult, const char *line) + static void appendLine(String &ioResult, const char *line) noexcept { if (NULL == line) return; if ('\0' == *line) return; @@ -92,7 +92,7 @@ namespace ortc } //----------------------------------------------------------------------- - static void appendLine(String &ioResult, const String &line) + static void appendLine(String &ioResult, const String &line) noexcept { if (line.isEmpty()) return; ioResult.append(line); @@ -100,7 +100,7 @@ namespace ortc } //----------------------------------------------------------------------- - static void appendLine(String &ioResult, char letter, const char *line) + static void appendLine(String &ioResult, char letter, const char *line) noexcept { if (NULL == line) return; if ('\0' == *line) return; @@ -116,7 +116,7 @@ namespace ortc } //----------------------------------------------------------------------- - static void appendLine(String &ioResult, char letter, const String &line) + static void appendLine(String &ioResult, char letter, const String &line) noexcept { if (line.isEmpty()) return; @@ -134,15 +134,15 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SDPParser - #pragma mark + // + // SDPParser + // //----------------------------------------------------------------------- void SDPParser::generateSessionLevel( const SDP &sdp, String &ioResult - ) + ) noexcept { appendLine(ioResult, 'v', "0"); appendLine(ioResult, 'o', ISDPTypes::OLine::toString(sdp.mOLine)); @@ -151,7 +151,7 @@ namespace ortc appendLine(ioResult, 'c', ISDPTypes::CLine::toString(sdp.mCLine)); if (sdp.mMediaDirection.hasValue()) { - appendLine(ioResult, 'a', ISDPTypes::toString(sdp.mMediaDirection.value())); + appendLine(ioResult, 'a', ISDPTypes::toStringForA(sdp.mMediaDirection.value())); } if ((sdp.mICELite.hasValue()) && @@ -179,7 +179,7 @@ namespace ortc void SDPParser::generateMediaLevel( const SDP &sdp, String &ioResult - ) + ) noexcept { for (auto iter = sdp.mMLines.begin(); iter != sdp.mMLines.end(); ++iter) { auto mline = *(*iter); @@ -202,7 +202,7 @@ namespace ortc appendLine(ioResult, 'a', ISDPTypes::AMaxMessageSizeLine::toString(mline.mAMaxMessageSize)); if (mline.mMediaDirection.hasValue()) { - appendLine(ioResult, 'a', ISDPTypes::toString(mline.mMediaDirection.value())); + appendLine(ioResult, 'a', ISDPTypes::toStringForA(mline.mMediaDirection.value())); } if ((mline.mRTCPMux.hasValue()) && (mline.mRTCPMux.value())) { @@ -270,7 +270,7 @@ namespace ortc } //----------------------------------------------------------------------- - String SDPParser::generate(const SDP &sdp) + String SDPParser::generate(const SDP &sdp) noexcept(false) { String result; result.reserve(2500); diff --git a/ortc/adapter/cpp/ortc_adapter_SDPParser_ParseSDP.cpp b/ortc/adapter/cpp/ortc_adapter_SDPParser_ParseSDP.cpp index ddebeb68..d6590dee 100644 --- a/ortc/adapter/cpp/ortc_adapter_SDPParser_ParseSDP.cpp +++ b/ortc/adapter/cpp/ortc_adapter_SDPParser_ParseSDP.cpp @@ -48,7 +48,7 @@ #pragma warning(3 : 4062) #endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -63,12 +63,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helpers - #pragma mark + // + // Helpers + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::adapter::SDPParser"); } @@ -77,12 +77,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SDPParser - #pragma mark + // + // SDPParser + // //----------------------------------------------------------------------- - void SDPParser::parseLines(SDP &sdp) + void SDPParser::parseLines(SDP &sdp) noexcept(false) { char *pos = sdp.mRawBuffer.get(); @@ -127,7 +127,7 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::parseAttributes(SDP &sdp) + void SDPParser::parseAttributes(SDP &sdp) noexcept(false) { for (auto iter = sdp.mLineInfos.begin(); iter != sdp.mLineInfos.end(); ++iter) { @@ -203,7 +203,7 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::validateAttributeLevels(SDP &sdp) + void SDPParser::validateAttributeLevels(SDP &sdp) noexcept(false) { auto currentLevel = AttributeLevel_Session; @@ -276,10 +276,8 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::parseLinesDetails(SDP &sdp) + void SDPParser::parseLinesDetails(SDP &sdp) noexcept(false) { - AttributeLevels currentLevel = AttributeLevel_Session; - MLinePtr currentMLine; ASSRCLinePtr currentSourceLine; @@ -336,7 +334,7 @@ namespace ortc case Attribute_MSIDSemantic: info.mLineValue = make_shared(info.mValue); break; case Attribute_ICEUFrag: info.mLineValue = make_shared(currentMLine, info.mValue); break; case Attribute_ICEPwd: info.mLineValue = make_shared(currentMLine, info.mValue); break; - case Attribute_ICEOptions: info.mLineValue = make_shared(info.mValue); break; + case Attribute_ICEOptions: info.mLineValue = make_shared(currentMLine, info.mValue); break; case Attribute_ICELite: break; // session level flag; struct not needed case Attribute_Candidate: info.mLineValue = make_shared(currentMLine, info.mValue); break; case Attribute_EndOfCandidates: info.mLineValue = make_shared(currentMLine); break; @@ -368,7 +366,7 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::processFlagAttributes(SDP &sdp) + void SDPParser::processFlagAttributes(SDP &sdp) noexcept(false) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { @@ -460,7 +458,7 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::processSessionLevelValues(SDP &sdp) + void SDPParser::processSessionLevelValues(SDP &sdp) noexcept(false) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { @@ -586,7 +584,7 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::processMediaLevelValues(SDP &sdp) + void SDPParser::processMediaLevelValues(SDP &sdp) noexcept(false) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { @@ -761,7 +759,7 @@ namespace ortc } //----------------------------------------------------------------------- - void SDPParser::processSourceLevelValues(SDP &sdp) + void SDPParser::processSourceLevelValues(SDP &sdp) noexcept(false) { for (auto iter_doNotUse = sdp.mLineInfos.begin(); iter_doNotUse != sdp.mLineInfos.end(); ) { @@ -849,7 +847,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISDPTypes::SDPPtr SDPParser::parse(const char *blob) + ISDPTypes::SDPPtr SDPParser::parse(const char *blob) noexcept(false) { if (!blob) return SDPPtr(); diff --git a/ortc/adapter/cpp/ortc_adapter_SDPParser_SDPToDescription.cpp b/ortc/adapter/cpp/ortc_adapter_SDPParser_SDPToDescription.cpp index c35445fe..1784ace2 100644 --- a/ortc/adapter/cpp/ortc_adapter_SDPParser_SDPToDescription.cpp +++ b/ortc/adapter/cpp/ortc_adapter_SDPParser_SDPToDescription.cpp @@ -50,7 +50,7 @@ #pragma warning(3 : 4062) #endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -67,18 +67,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helpers - #pragma mark + // + // Helpers + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::adapter::SDPParser"); } //----------------------------------------------------------------------- - static String createTransportIDFromIndex(size_t index) + static String createTransportIDFromIndex(size_t index) noexcept { auto hasher = IHasher::sha1(); hasher->update("transport_index:"); @@ -87,7 +87,7 @@ namespace ortc } //----------------------------------------------------------------------- - static String createMediaLineIDFromIndex(size_t index) + static String createMediaLineIDFromIndex(size_t index) noexcept { auto hasher = IHasher::sha1(); hasher->update("media_line_index:"); @@ -96,7 +96,7 @@ namespace ortc } //----------------------------------------------------------------------- - static String createSenderIDFromIndex(size_t index) + static String createSenderIDFromIndex(size_t index) noexcept { auto hasher = IHasher::sha1(); hasher->update("sender_index:"); @@ -108,15 +108,15 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SDPParser - #pragma mark + // + // SDPParser + // //----------------------------------------------------------------------- void SDPParser::createDescriptionDetails( const SDP &sdp, Description &ioDescription - ) + ) noexcept { bool needsDetails = ((bool)sdp.mOLine) || ((bool)sdp.mSLine) || @@ -161,7 +161,7 @@ namespace ortc } //----------------------------------------------------------------------- - static IDTLSTransportTypes::Roles toDtlsRole(const char *setup) + static IDTLSTransportTypes::Roles toDtlsRole(const char *setup) noexcept { String str(setup); @@ -190,7 +190,7 @@ namespace ortc static void convertCrypto( const ISDPTypes::ACryptoLineList &inCryptoLines, ISRTPSDESTransportTypes::Parameters &outCrypto - ) + ) noexcept(false) { for (auto iter = inCryptoLines.begin(); iter != inCryptoLines.end(); ++iter) { auto &acrypto = *(*iter); @@ -245,7 +245,7 @@ namespace ortc static void convertDTLSFingerprints( const ISDPTypes::AFingerprintLineList &inFingerprintLines, IDTLSTransportTypes::Parameters &outParameters - ) + ) noexcept { for (auto iter = inFingerprintLines.begin(); iter != inFingerprintLines.end(); ++iter) { @@ -258,7 +258,7 @@ namespace ortc } //----------------------------------------------------------------------- - static IICETypes::CandidatePtr convertCandidate(const ISDPTypes::ACandidateLine &acandidate) + static IICETypes::CandidatePtr convertCandidate(const ISDPTypes::ACandidateLine &acandidate) noexcept(false) { auto candidate = make_shared(); @@ -307,14 +307,14 @@ namespace ortc const ISDPTypes::ACandidateLineList &inCandidateLines, ISessionDescriptionTypes::ICECandidateList &outRTPCandidates, ISessionDescriptionTypes::Transport::ParametersPtr &ioRTCPTransport - ) + ) noexcept { for (auto iter = inCandidateLines.begin(); iter != inCandidateLines.end(); ++iter) { auto &acandidate = *(*iter); auto candidate = convertCandidate(acandidate); - if (0 == acandidate.mComponentID) { + if (acandidate.mComponentID < 2) { outRTPCandidates.push_back(candidate); } else { if (!ioRTCPTransport) { @@ -329,7 +329,7 @@ namespace ortc void SDPParser::createTransports( const SDP &sdp, Description &ioDescription - ) + ) noexcept { size_t index = 0; @@ -383,7 +383,7 @@ namespace ortc } //----------------------------------------------------------------------- - static ISessionDescriptionTypes::MediaDirections toDirection(ISDPTypes::Directions direction) + static ISessionDescriptionTypes::MediaDirections toDirection(ISDPTypes::Directions direction) noexcept(false) { switch (direction) { @@ -402,7 +402,7 @@ namespace ortc const ISDPTypes::MLine &mline, ISessionDescriptionTypes::Description &description, ISessionDescriptionTypes::MediaLine &mediaLine - ) + ) noexcept { mediaLine.mDetails = make_shared(); mediaLine.mDetails->mInternalIndex = index; @@ -473,7 +473,7 @@ namespace ortc bool found = false; for (auto iter = description.mTransports.begin(); iter != description.mTransports.end(); ++iter) { auto &transport = *(*iter); - if (transport.mID != foundBundleID) continue; + if (transport.mID != searchForTransportID) continue; mediaLine.mTransportID = foundBundleID; found = true; } @@ -493,7 +493,7 @@ namespace ortc static void fixIntoCodecSpecificList( const ISDPTypes::StringList &formatSpecificList, ISDPTypes::KeyValueList &outKeyValues - ) + ) noexcept(false) { String params = IHelper::combine(formatSpecificList, ";"); @@ -523,7 +523,7 @@ namespace ortc IRTPTypes::SupportedCodecs supportedCodec, IRTPTypes::CodecCapability &codecCapability, const ISDPTypes::AFMTPLine &format - ) + ) noexcept(false) { switch (supportedCodec) { case IRTPTypes::SupportedCodec_Unknown: return; @@ -794,15 +794,19 @@ namespace ortc //----------------------------------------------------------------------- bool fillCapabilities( - ISDPTypes::Locations location, - const ISDPTypes::SDP &sdp, + ZS_MAYBE_USED() ISDPTypes::Locations location, + ZS_MAYBE_USED() const ISDPTypes::SDP &sdp, const ISDPTypes::MLine &mline, - ISessionDescriptionTypes::Description &description, - ISessionDescriptionTypes::MediaLine &mediaLine, + ZS_MAYBE_USED() ISessionDescriptionTypes::Description &description, + ZS_MAYBE_USED() ISessionDescriptionTypes::MediaLine &mediaLine, IRTPTypes::Capabilities &senderCapabilities, IRTPTypes::Capabilities &receiverCapabilities - ) + ) noexcept(false) { + ZS_MAYBE_USED(location); + ZS_MAYBE_USED(sdp); + ZS_MAYBE_USED(description); + ZS_MAYBE_USED(mediaLine); auto matchCodecKind = IRTPTypes::toCodecKind(mline.mMedia); if ((IRTPTypes::CodecKind_Audio != matchCodecKind) && (IRTPTypes::CodecKind_Video != matchCodecKind)) { @@ -857,7 +861,6 @@ namespace ortc if (!rtpMap) { auto reservedType = IRTPTypes::toReservedCodec(pt); auto supportedType = IRTPTypes::toSupportedCodec(reservedType); - auto codecKind = IRTPTypes::getCodecKind(supportedType); if (IRTPTypes::SupportedCodec_Unknown == supportedType) { ZS_LOG_WARNING(Debug, internal::slog("codec payload type is not understood") + ZS_PARAM("payload type", pt)); @@ -965,7 +968,7 @@ namespace ortc Locations location, const SDP &sdp, Description &ioDescription - ) + ) noexcept { size_t index = 0; @@ -994,11 +997,12 @@ namespace ortc //----------------------------------------------------------------------- void SDPParser::createSCTPMediaLines( - Locations location, + ZS_MAYBE_USED() Locations location, const SDP &sdp, Description &ioDescription - ) + ) noexcept { + ZS_MAYBE_USED(location); size_t index = 0; for (auto iter = sdp.mMLines.begin(); iter != sdp.mMLines.end(); ++iter, ++index) @@ -1031,7 +1035,7 @@ namespace ortc static void fillREDFormatParameters( const ISDPTypes::MLine &mline, IRTPTypes::Parameters ¶meters - ) + ) noexcept(false) { String redStr(IRTPTypes::toString(IRTPTypes::SupportedCodec_RED)); for (auto iterCodec = parameters.mCodecs.begin(); iterCodec != parameters.mCodecs.end(); ++iterCodec) { @@ -1068,11 +1072,12 @@ namespace ortc //----------------------------------------------------------------------- static void fillStreamIDs( - const ISDPTypes::SDP &sdp, + ZS_MAYBE_USED() const ISDPTypes::SDP &sdp, const ISDPTypes::MLine &mline, ISessionDescriptionTypes::RTPSender &sender - ) + ) noexcept { + ZS_MAYBE_USED(sdp); // scope: first check for MSID lines { for (auto iter = mline.mAMSIDLines.begin(); iter != mline.mAMSIDLines.end(); ++iter) { @@ -1116,11 +1121,12 @@ namespace ortc //----------------------------------------------------------------------- void SDPParser::createRTPSenderLines( - Locations location, + ZS_MAYBE_USED() Locations location, const SDP &sdp, Description &ioDescription - ) + ) noexcept(false) { + ZS_MAYBE_USED(location); size_t index = 0; for (auto iter = sdp.mMLines.begin(); iter != sdp.mMLines.end(); ++iter, ++index) @@ -1165,8 +1171,7 @@ namespace ortc fillREDFormatParameters(mline, *sender->mParameters); fillStreamIDs(sdp, mline, *sender); -#define TODO_FIX_FOR_SIMULCAST_SDP_WHEN_SPECIFICATION_IS_MORE_SETTLED 1 -#define TODO_FIX_FOR_SIMULCAST_SDP_WHEN_SPECIFICATION_IS_MORE_SETTLED 2 +#pragma ZS_BUILD_NOTE("TODO","Fix for simulcast sdp when spec settled") IRTPTypes::EncodingParameters encoding; @@ -1214,7 +1219,7 @@ namespace ortc ISDPTypes::DescriptionPtr SDPParser::createDescription( Locations location, const SDP &sdp - ) + ) noexcept(false) { DescriptionPtr result(make_shared()); @@ -1232,7 +1237,7 @@ namespace ortc } //----------------------------------------------------------------------- - IICETypes::GatherCandidatePtr SDPParser::getCandidateFromSDP(const char *candidate) + IICETypes::GatherCandidatePtr SDPParser::getCandidateFromSDP(const char *candidate) noexcept { String str(candidate); @@ -1268,7 +1273,6 @@ namespace ortc return result; } catch(const InvalidParameters &) { ZS_LOG_WARNING(Debug, internal::slog("unable to convert to candidate") + ZS_PARAM("candidate", str)); - return result; } return result; diff --git a/ortc/adapter/cpp/ortc_adapter_SessionDescription.cpp b/ortc/adapter/cpp/ortc_adapter_SessionDescription.cpp index 9d98bfd0..e672df71 100644 --- a/ortc/adapter/cpp/ortc_adapter_SessionDescription.cpp +++ b/ortc/adapter/cpp/ortc_adapter_SessionDescription.cpp @@ -44,11 +44,11 @@ #include -#ifdef _MSC_VER -#pragma warning(3 : 4062) -#endif //_MSC_VER +//#ifdef _MSC_VER +//#pragma warning(3 : 4062) +//#endif //_MSC_VER -namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(ortclib_adapter) } } +namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_adapter) } } namespace ortc { @@ -65,12 +65,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Helpers - #pragma mark + // + // Helpers + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::adapter::ISessionDescriptionTypes"); } @@ -79,9 +79,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription - #pragma mark + // + // SessionDescription + // //----------------------------------------------------------------------- SessionDescription::SessionDescription( @@ -89,7 +89,7 @@ namespace ortc SignalingTypes type, const char *descriptionStr, const Description *description - ) : + ) noexcept : SharedRecursiveLock(SharedRecursiveLock::create()), mType(type), mDescription(description ? make_shared(*description) : DescriptionPtr()), @@ -98,12 +98,12 @@ namespace ortc } //----------------------------------------------------------------------- - void SessionDescription::init() + void SessionDescription::init() noexcept { } //----------------------------------------------------------------------- - SessionDescriptionPtr SessionDescription::convert(ISessionDescriptionPtr object) + SessionDescriptionPtr SessionDescription::convert(ISessionDescriptionPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SessionDescription, object); } @@ -112,12 +112,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription => ISessionDescription - #pragma mark + // + // SessionDescription => ISessionDescription + // //----------------------------------------------------------------------- - ElementPtr SessionDescription::toDebug(ISessionDescriptionPtr object) + ElementPtr SessionDescription::toDebug(ISessionDescriptionPtr object) noexcept { if (!object) return ElementPtr(); return convert(object)->toDebug(); @@ -127,7 +127,7 @@ namespace ortc SessionDescriptionPtr SessionDescription::create( SignalingTypes type, const char *description - ) + ) noexcept { auto pThis(make_shared(make_private{}, type, description, nullptr)); pThis->mThisWeak = pThis; @@ -139,7 +139,7 @@ namespace ortc SessionDescriptionPtr SessionDescription::create( SignalingTypes type, const Description &description - ) + ) noexcept { auto pThis(make_shared(make_private{}, type, nullptr, &description)); pThis->mThisWeak = pThis; @@ -148,13 +148,13 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionTypes::SignalingTypes SessionDescription::type() const + ISessionDescriptionTypes::SignalingTypes SessionDescription::type() const noexcept { return mType; } //----------------------------------------------------------------------- - ISessionDescriptionTypes::DescriptionPtr SessionDescription::description() const + ISessionDescriptionTypes::DescriptionPtr SessionDescription::description() const noexcept { AutoRecursiveLock lock(*this); @@ -185,7 +185,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISessionDescriptionTypes::SignalingDescription SessionDescription::formattedDescription() const + ISessionDescriptionTypes::SignalingDescription SessionDescription::formattedDescription() const noexcept { AutoRecursiveLock lock(*this); if (mFormattedString.isEmpty()) { @@ -224,12 +224,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription => (internal) - #pragma mark + // + // SessionDescription => (internal) + // //----------------------------------------------------------------------- - ElementPtr SessionDescription::toDebug() const + ElementPtr SessionDescription::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::adapter::internal::SessionDescription"); @@ -251,12 +251,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamFactory - #pragma mark + // + // IMediaStreamFactory + // //----------------------------------------------------------------------- - ISessionDescriptionFactory &ISessionDescriptionFactory::singleton() + ISessionDescriptionFactory &ISessionDescriptionFactory::singleton() noexcept { return SessionDescriptionFactory::singleton(); } @@ -265,7 +265,7 @@ namespace ortc SessionDescriptionPtr ISessionDescriptionFactory::create( SignalingTypes type, const char *description - ) + ) noexcept { if (this) {} return internal::SessionDescription::create(type, description); @@ -275,7 +275,7 @@ namespace ortc SessionDescriptionPtr ISessionDescriptionFactory::create( SignalingTypes type, const Description &description - ) + ) noexcept { if (this) {} return internal::SessionDescription::create(type, description); @@ -287,12 +287,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes - #pragma mark + // + // ISessionDescriptionTypes + // //------------------------------------------------------------------------- - const char *ISessionDescriptionTypes::toString(SignalingTypes type) + const char *ISessionDescriptionTypes::toString(SignalingTypes type) noexcept { switch (type) { @@ -302,11 +302,12 @@ namespace ortc case SignalingType_SDPAnswer: return "answer"; case SignalingType_SDPRollback: return "rollback"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown signaling type"); + ZS_ASSERT_FAIL("unknown signaling type"); + return "unknown"; } //------------------------------------------------------------------------- - ISessionDescriptionTypes::SignalingTypes ISessionDescriptionTypes::toSignalingType(const char *type) + ISessionDescriptionTypes::SignalingTypes ISessionDescriptionTypes::toSignalingType(const char *type) noexcept(false) { String str(type); for (SignalingTypes index = SignalingType_First; index <= SignalingType_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -317,7 +318,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *ISessionDescriptionTypes::toString(MediaTypes mediaType) + const char *ISessionDescriptionTypes::toString(MediaTypes mediaType) noexcept { switch (mediaType) { @@ -327,11 +328,12 @@ namespace ortc case MediaType_Text: return "text"; case MediaType_Application: return "application"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown media type"); + ZS_ASSERT_FAIL("unknown media type"); + return "unknown"; } //------------------------------------------------------------------------- - ISessionDescriptionTypes::MediaTypes ISessionDescriptionTypes::toMediaType(const char *mediaType) + ISessionDescriptionTypes::MediaTypes ISessionDescriptionTypes::toMediaType(const char *mediaType) noexcept { String str(mediaType); for (MediaTypes index = MediaType_First; index <= MediaType_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -341,7 +343,7 @@ namespace ortc } //------------------------------------------------------------------------- - Optional ISessionDescriptionTypes::toMediaStreamTrackKind(MediaTypes mediaType) + Optional ISessionDescriptionTypes::toMediaStreamTrackKind(MediaTypes mediaType) noexcept { switch (mediaType) { @@ -355,7 +357,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *ISessionDescriptionTypes::toString(MediaDirections mediaDirection) + const char *ISessionDescriptionTypes::toString(MediaDirections mediaDirection) noexcept { switch (mediaDirection) { @@ -364,11 +366,12 @@ namespace ortc case MediaDirection_ReceiveOnly: return "recvonly"; case MediaDirection_Inactive: return "inactive"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("unknown media direction"); + ZS_ASSERT_FAIL("unknown media direction"); + return "unknown"; } //------------------------------------------------------------------------- - ISessionDescriptionTypes::MediaDirections ISessionDescriptionTypes::toMediaDirection(const char *mediaDirection) + ISessionDescriptionTypes::MediaDirections ISessionDescriptionTypes::toMediaDirection(const char *mediaDirection) noexcept(false) { String str(mediaDirection); for (MediaDirections index = MediaDirection_First; index <= MediaDirection_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -382,26 +385,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::ConnectionData - #pragma mark + // + // ISessionDescriptionTypes::ConnectionData + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::ConnectionData::ConnectionData(const ConnectionData &op2) + ISessionDescriptionTypes::ConnectionData::ConnectionData(const ConnectionData &op2) noexcept { mRTP = (op2.mRTP ? make_shared
(*op2.mRTP) : DetailsPtr()); mRTCP = (op2.mRTCP ? make_shared
(*op2.mRTCP) : DetailsPtr()); } //------------------------------------------------------------------------- - ISessionDescriptionTypes::ConnectionData::ConnectionData(ElementPtr rootEl) + ISessionDescriptionTypes::ConnectionData::ConnectionData(ElementPtr rootEl) noexcept { mRTP = Details::create(rootEl->findFirstChildElement("rtp")); mRTCP = Details::create(rootEl->findFirstChildElement("rtcp")); } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ConnectionData::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::ConnectionData::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -414,13 +417,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ConnectionData::toDebug() const + ElementPtr ISessionDescriptionTypes::ConnectionData::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::ConnectionData"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::ConnectionData::hash() const + String ISessionDescriptionTypes::ConnectionData::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -438,12 +441,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::ConnectionData::Details - #pragma mark + // + // ISessionDescriptionTypes::ConnectionData::Details + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::ConnectionData::Details::Details(ElementPtr rootEl) + ISessionDescriptionTypes::ConnectionData::Details::Details(ElementPtr rootEl) noexcept { IHelper::getElementValue(rootEl, "ortc::adapter::ISessionDescriptionTypes::ConnectionData::Details", "port", mPort); IHelper::getElementValue(rootEl, "ortc::adapter::ISessionDescriptionTypes::ConnectionData::Details", "netType", mNetType); @@ -452,7 +455,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ConnectionData::Details::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::ConnectionData::Details::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -467,13 +470,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ConnectionData::Details::toDebug() const + ElementPtr ISessionDescriptionTypes::ConnectionData::Details::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::ConnectionData::Details"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::ConnectionData::Details::hash() const + String ISessionDescriptionTypes::ConnectionData::Details::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -495,12 +498,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::Transport - #pragma mark + // + // ISessionDescriptionTypes::Transport + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::Transport::Transport(const Transport &op2) : + ISessionDescriptionTypes::Transport::Transport(const Transport &op2) noexcept : mID(op2.mID) { mRTP = (op2.mRTP ? make_shared(*op2.mRTP) : ParametersPtr()); @@ -508,8 +511,8 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::Transport::Transport(ElementPtr rootEl) - { + ISessionDescriptionTypes::Transport::Transport(ElementPtr rootEl) noexcept + { IHelper::getElementValue(rootEl, "ortc::adapter::ISessionDescriptionTypes::Transport", "id", mID); mRTP = Parameters::create(rootEl->findFirstChildElement("rtp")); mRTCP = Parameters::create(rootEl->findFirstChildElement("rtcp")); @@ -517,7 +520,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Transport::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::Transport::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -533,13 +536,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Transport::toDebug() const + ElementPtr ISessionDescriptionTypes::Transport::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::Transport"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::Transport::hash() const + String ISessionDescriptionTypes::Transport::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -561,12 +564,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::Transport::Parameters - #pragma mark + // + // ISessionDescriptionTypes::Transport::Parameters + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::Transport::Parameters::Parameters(const Parameters &op2) : + ISessionDescriptionTypes::Transport::Parameters::Parameters(const Parameters &op2) noexcept : mEndOfCandidates(op2.mEndOfCandidates) { mICEParameters = (op2.mICEParameters ? make_shared(*op2.mICEParameters) : ICETransportParametersPtr()); @@ -582,7 +585,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::Transport::Parameters::Parameters(ElementPtr rootEl) + ISessionDescriptionTypes::Transport::Parameters::Parameters(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -612,7 +615,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Transport::Parameters::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::Transport::Parameters::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -643,13 +646,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Transport::Parameters::toDebug() const + ElementPtr ISessionDescriptionTypes::Transport::Parameters::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::Transport:Parameters"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::Transport::Parameters::hash() const + String ISessionDescriptionTypes::Transport::Parameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -677,12 +680,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::MediaLine - #pragma mark + // + // ISessionDescriptionTypes::MediaLine + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::MediaLine::MediaLine(const MediaLine &op2) : + ISessionDescriptionTypes::MediaLine::MediaLine(const MediaLine &op2) noexcept : mID(op2.mID), mTransportID(op2.mTransportID), mMediaType(op2.mMediaType) @@ -691,7 +694,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::MediaLine::MediaLine(ElementPtr rootEl) + ISessionDescriptionTypes::MediaLine::MediaLine(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -702,7 +705,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::MediaLine::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::MediaLine::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -717,13 +720,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::MediaLine::toDebug() const + ElementPtr ISessionDescriptionTypes::MediaLine::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::MediaLine"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::MediaLine::hash() const + String ISessionDescriptionTypes::MediaLine::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -745,12 +748,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::MediaLine::Details - #pragma mark + // + // ISessionDescriptionTypes::MediaLine::Details + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::MediaLine::Details::Details(const Details &op2) : + ISessionDescriptionTypes::MediaLine::Details::Details(const Details &op2) noexcept : mInternalIndex(op2.mInternalIndex), mPrivateTransportID(op2.mPrivateTransportID), mProtocol(op2.mProtocol), @@ -760,7 +763,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::MediaLine::Details::Details(ElementPtr rootEl) + ISessionDescriptionTypes::MediaLine::Details::Details(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -780,7 +783,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::MediaLine::Details::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::MediaLine::Details::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -796,13 +799,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::MediaLine::Details::toDebug() const + ElementPtr ISessionDescriptionTypes::MediaLine::Details::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::MediaLine::Details"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::MediaLine::Details::hash() const + String ISessionDescriptionTypes::MediaLine::Details::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -826,12 +829,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::RTPMediaLine - #pragma mark + // + // ISessionDescriptionTypes::RTPMediaLine + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::RTPMediaLine::RTPMediaLine(const RTPMediaLine &op2) : + ISessionDescriptionTypes::RTPMediaLine::RTPMediaLine(const RTPMediaLine &op2) noexcept : MediaLine(op2) { mSenderCapabilities = (op2.mSenderCapabilities ? make_shared(*op2.mSenderCapabilities) : RTPCapabilitiesPtr()); @@ -839,7 +842,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::RTPMediaLine::RTPMediaLine(ElementPtr rootEl) : + ISessionDescriptionTypes::RTPMediaLine::RTPMediaLine(ElementPtr rootEl) noexcept : MediaLine(rootEl) { mSenderCapabilities = RTPCapabilities::create(rootEl->findFirstChildElement("senderCapabilities")); @@ -847,7 +850,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::RTPMediaLine::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::RTPMediaLine::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "rtpMediaLine"; @@ -862,13 +865,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::RTPMediaLine::toDebug() const + ElementPtr ISessionDescriptionTypes::RTPMediaLine::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::RTPMediaLine"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::RTPMediaLine::hash() const + String ISessionDescriptionTypes::RTPMediaLine::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -888,12 +891,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::SCTPMediaLine - #pragma mark + // + // ISessionDescriptionTypes::SCTPMediaLine + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::SCTPMediaLine::SCTPMediaLine(const SCTPMediaLine &op2) : + ISessionDescriptionTypes::SCTPMediaLine::SCTPMediaLine(const SCTPMediaLine &op2) noexcept : MediaLine(op2), mPort(op2.mPort) { @@ -901,7 +904,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::SCTPMediaLine::SCTPMediaLine(ElementPtr rootEl) : + ISessionDescriptionTypes::SCTPMediaLine::SCTPMediaLine(ElementPtr rootEl) noexcept : MediaLine(rootEl) { if (!rootEl) return; @@ -911,7 +914,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::SCTPMediaLine::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::SCTPMediaLine::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "sctpMediaLine"; @@ -926,13 +929,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::SCTPMediaLine::toDebug() const + ElementPtr ISessionDescriptionTypes::SCTPMediaLine::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::SCTPMediaLine"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::SCTPMediaLine::hash() const + String ISessionDescriptionTypes::SCTPMediaLine::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -952,12 +955,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::RTPSender - #pragma mark + // + // ISessionDescriptionTypes::RTPSender + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::RTPSender::RTPSender(const RTPSender &op2) : + ISessionDescriptionTypes::RTPSender::RTPSender(const RTPSender &op2) noexcept : mID(op2.mID), mRTPMediaLineID(op2.mRTPMediaLineID), mMediaStreamTrackID(op2.mMediaStreamTrackID), @@ -968,7 +971,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::RTPSender::RTPSender(ElementPtr rootEl) + ISessionDescriptionTypes::RTPSender::RTPSender(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -995,7 +998,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::RTPSender::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::RTPSender::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "rtpSender"; @@ -1029,13 +1032,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::RTPSender::toDebug() const + ElementPtr ISessionDescriptionTypes::RTPSender::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::RTPSender"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::RTPSender::hash() const + String ISessionDescriptionTypes::RTPSender::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1067,18 +1070,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::RTPSender::Details - #pragma mark + // + // ISessionDescriptionTypes::RTPSender::Details + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::RTPSender::Details::Details(const Details &op2) : + ISessionDescriptionTypes::RTPSender::Details::Details(const Details &op2) noexcept : mInternalRTPMediaLineIndex(op2.mInternalRTPMediaLineIndex) { } //------------------------------------------------------------------------- - ISessionDescriptionTypes::RTPSender::Details::Details(ElementPtr rootEl) + ISessionDescriptionTypes::RTPSender::Details::Details(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -1086,7 +1089,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::RTPSender::Details::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::RTPSender::Details::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "details"; @@ -1100,13 +1103,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::RTPSender::Details::toDebug() const + ElementPtr ISessionDescriptionTypes::RTPSender::Details::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::RTPSender::Details"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::RTPSender::Details::hash() const + String ISessionDescriptionTypes::RTPSender::Details::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1123,12 +1126,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::ICECandidate - #pragma mark + // + // ISessionDescriptionTypes::ICECandidate + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::ICECandidate::ICECandidate(const ICECandidate &op2) : + ISessionDescriptionTypes::ICECandidate::ICECandidate(const ICECandidate &op2) noexcept : mMid(op2.mMid), mMLineIndex(op2.mMLineIndex) { @@ -1149,7 +1152,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::ICECandidatePtr ISessionDescriptionTypes::ICECandidate::create(ElementPtr rootEl) + ISessionDescriptionTypes::ICECandidatePtr ISessionDescriptionTypes::ICECandidate::create(ElementPtr rootEl) noexcept { if (!rootEl) return ICECandidatePtr(); @@ -1181,7 +1184,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ICECandidate::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::ICECandidate::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "iceCandidate"; @@ -1211,13 +1214,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ICECandidate::toDebug() const + ElementPtr ISessionDescriptionTypes::ICECandidate::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::ICECandidate"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::ICECandidate::hash() const + String ISessionDescriptionTypes::ICECandidate::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1247,7 +1250,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::ICECandidatePtr ISessionDescriptionTypes::ICECandidate::createFromSDP(const char *value) + ISessionDescriptionTypes::ICECandidatePtr ISessionDescriptionTypes::ICECandidate::createFromSDP(const char *value) noexcept { String str(value); @@ -1258,7 +1261,7 @@ namespace ortc } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::ICECandidate::toSDP() const + String ISessionDescriptionTypes::ICECandidate::toSDP() const noexcept { { auto candidateComplete = ZS_DYNAMIC_PTR_CAST(IICETypes::CandidateComplete, mCandidate); @@ -1277,7 +1280,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::ICECandidate::toJSON() const + ElementPtr ISessionDescriptionTypes::ICECandidate::toJSON() const noexcept { return createElement(); } @@ -1286,12 +1289,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::Description - #pragma mark + // + // ISessionDescriptionTypes::Description + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::Description::Description(const Description &op2) : + ISessionDescriptionTypes::Description::Description(const Description &op2) noexcept : mDetails(op2.mDetails ? make_shared
(*op2.mDetails) : DetailsPtr()) { for (auto iter = op2.mTransports.begin(); iter != op2.mTransports.end(); ++iter) @@ -1321,7 +1324,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::Description::Description(ElementPtr rootEl) + ISessionDescriptionTypes::Description::Description(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -1389,7 +1392,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Description::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::Description::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "session"; @@ -1447,13 +1450,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Description::toDebug() const + ElementPtr ISessionDescriptionTypes::Description::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::Description"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::Description::hash() const + String ISessionDescriptionTypes::Description::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1503,12 +1506,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescriptionTypes::Description::Details - #pragma mark + // + // ISessionDescriptionTypes::Description::Details + // //------------------------------------------------------------------------- - ISessionDescriptionTypes::Description::Description::Details::Details(const Details &op2) : + ISessionDescriptionTypes::Description::Description::Details::Details(const Details &op2) noexcept : mUsername(op2.mUsername), mSessionID(op2.mSessionID), mSessionVersion(op2.mSessionVersion), @@ -1521,7 +1524,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISessionDescriptionTypes::Description::Details::Details(ElementPtr rootEl) + ISessionDescriptionTypes::Description::Details::Details(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -1547,7 +1550,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Description::Details::createElement(const char *objectName) const + ElementPtr ISessionDescriptionTypes::Description::Details::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "details"; @@ -1572,13 +1575,13 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISessionDescriptionTypes::Description::Details::toDebug() const + ElementPtr ISessionDescriptionTypes::Description::Details::toDebug() const noexcept { return createElement("ortc::adapter::ISessionDescriptionTypes::Description::Details"); } //------------------------------------------------------------------------- - String ISessionDescriptionTypes::Description::Details::hash() const + String ISessionDescriptionTypes::Description::Details::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1612,15 +1615,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISessionDescription - #pragma mark + // + // ISessionDescription + // //------------------------------------------------------------------------- ISessionDescriptionPtr ISessionDescription::create( SignalingTypes type, const char *description - ) + ) noexcept { return internal::ISessionDescriptionFactory::singleton().create(type, description); } @@ -1629,13 +1632,13 @@ namespace ortc ISessionDescriptionPtr ISessionDescription::create( SignalingTypes type, const Description &description - ) + ) noexcept { return internal::ISessionDescriptionFactory::singleton().create(type, description); } //------------------------------------------------------------------------- - ElementPtr ISessionDescription::toDebug(ISessionDescriptionPtr object) + ElementPtr ISessionDescription::toDebug(ISessionDescriptionPtr object) noexcept { return internal::SessionDescription::toDebug(object); } diff --git a/ortc/adapter/cpp/ortc_adapter_adapter.cpp b/ortc/adapter/cpp/ortc_adapter_adapter.cpp index f6acc9b5..3d533d81 100644 --- a/ortc/adapter/cpp/ortc_adapter_adapter.cpp +++ b/ortc/adapter/cpp/ortc_adapter_adapter.cpp @@ -41,7 +41,7 @@ //#include -namespace ortc { namespace adapter { ZS_IMPLEMENT_SUBSYSTEM(ortclib_adapter); } } +namespace ortc { namespace adapter { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_adapter); } } namespace ortc { diff --git a/ortc/adapter/internal/ortc_adapter_Helper.h b/ortc/adapter/internal/ortc_adapter_Helper.h index 91e733d6..00e20032 100644 --- a/ortc/adapter/internal/ortc_adapter_Helper.h +++ b/ortc/adapter/internal/ortc_adapter_Helper.h @@ -45,9 +45,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Helper - #pragma mark + // + // Helper + // class Helper : public IHelper { diff --git a/ortc/adapter/internal/ortc_adapter_MediaStream.h b/ortc/adapter/internal/ortc_adapter_MediaStream.h index 4abd1065..8ea9dce8 100644 --- a/ortc/adapter/internal/ortc_adapter_MediaStream.h +++ b/ortc/adapter/internal/ortc_adapter_MediaStream.h @@ -52,23 +52,23 @@ namespace ortc { ZS_DECLARE_TYPEDEF_PTR(IMediaStreamForPeerConnection, ForPeerConnection); - static ForPeerConnectionPtr create(const char *id); + static ForPeerConnectionPtr create(const char *id) noexcept; - virtual String id() const = 0; + virtual String id() const noexcept = 0; - virtual size_t size() const = 0; + virtual size_t size() const noexcept = 0; - virtual void notifyAddTrack(IMediaStreamTrackPtr track) = 0; - virtual void notifyRemoveTrack(IMediaStreamTrackPtr track) = 0; + virtual void notifyAddTrack(IMediaStreamTrackPtr track) noexcept = 0; + virtual void notifyRemoveTrack(IMediaStreamTrackPtr track) noexcept = 0; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream - #pragma mark + // + // MediaStream + // class MediaStream : public Noop, public MessageQueueAssociator, @@ -93,103 +93,103 @@ namespace ortc IMediaStreamDelegatePtr delegate, const UseMediaStreamTrackList &tracks, const char *id = NULL - ); + ) noexcept; - ~MediaStream(); + ~MediaStream() noexcept; - static MediaStreamPtr convert(IMediaStreamPtr object); - static MediaStreamPtr convert(ForPeerConnectionPtr object); + static MediaStreamPtr convert(IMediaStreamPtr object) noexcept; + static MediaStreamPtr convert(ForPeerConnectionPtr object) noexcept; protected: - MediaStream(Noop) : + MediaStream(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => IMediaStream - #pragma mark + // + // MediaStream => IMediaStream + // - static ElementPtr toDebug(IMediaStreamPtr object); + static ElementPtr toDebug(IMediaStreamPtr object) noexcept; static MediaStreamPtr create( IMediaStreamDelegatePtr delegate, IMediaStreamPtr stream - ); + ) noexcept; static MediaStreamPtr create( IMediaStreamDelegatePtr delegate, const MediaStreamTrackList &tracks - ); + ) noexcept; - virtual PUID getID() const override { return mID; } + PUID getID() const noexcept override { return mID; } - virtual IMediaStreamSubscriptionPtr subscribe(IMediaStreamDelegatePtr delegate) override; + IMediaStreamSubscriptionPtr subscribe(IMediaStreamDelegatePtr delegate) noexcept override; - virtual String id() const override; - virtual bool active() const override; + String id() const noexcept override; + bool active() const noexcept override; - virtual MediaStreamTrackListPtr getAudioTracks() const override; - virtual MediaStreamTrackListPtr getVideoTracks() const override; - virtual MediaStreamTrackListPtr getTracks() const override; - virtual IMediaStreamTrackPtr getTrackByID(const char *id) const override; - virtual size_t size() const override; + MediaStreamTrackListPtr getAudioTracks() const noexcept override; + MediaStreamTrackListPtr getVideoTracks() const noexcept override; + MediaStreamTrackListPtr getTracks() const noexcept override; + IMediaStreamTrackPtr getTrackByID(const char *id) const noexcept override; + size_t size() const noexcept override; - virtual void addTrack(IMediaStreamTrackPtr track) override; - virtual void removeTrack(IMediaStreamTrackPtr track) override; + void addTrack(IMediaStreamTrackPtr track) noexcept override; + void removeTrack(IMediaStreamTrackPtr track) noexcept override; - virtual IMediaStreamPtr clone() const override; + IMediaStreamPtr clone() const noexcept override; //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => IStatsProvider - #pragma mark + // + // MediaStream => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => ForPeerConnection - #pragma mark + // + // MediaStream => ForPeerConnection + // - static MediaStreamPtr create(const char *id); + static MediaStreamPtr create(const char *id) noexcept; - // (duplicate) virtual String id() const = 0; + // (duplicate) virtual String id() const noexcept= 0; - // (duplicate) virtual size_t size() const = 0; + // (duplicate) virtual size_t size() const noexcept= 0; - virtual void notifyAddTrack(IMediaStreamTrackPtr track) override; - virtual void notifyRemoveTrack(IMediaStreamTrackPtr track) override; + virtual void notifyAddTrack(IMediaStreamTrackPtr track) noexcept override; + virtual void notifyRemoveTrack(IMediaStreamTrackPtr track) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => (internal) - #pragma mark + // + // MediaStream => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShutdown() const { return false; } + bool isShutdown() const noexcept { return false; } protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStream => (data) - #pragma mark + // + // MediaStream => (data) + // AutoPUID mID; String mMSID; @@ -206,24 +206,24 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamFactory - #pragma mark + // + // IMediaStreamFactory + // interaction IMediaStreamFactory { - static IMediaStreamFactory &singleton(); + static IMediaStreamFactory &singleton() noexcept; typedef IMediaStreamTypes::MediaStreamTrackList MediaStreamTrackList; virtual MediaStreamPtr create( IMediaStreamDelegatePtr delegate, IMediaStreamPtr stream - ); + ) noexcept; virtual MediaStreamPtr create( IMediaStreamDelegatePtr delegate, const MediaStreamTrackList &tracks - ); - virtual MediaStreamPtr create(const char *id); + ) noexcept; + virtual MediaStreamPtr create(const char *id) noexcept; }; class MediaStreamFactory : public IFactory {}; diff --git a/ortc/adapter/internal/ortc_adapter_PeerConnection.h b/ortc/adapter/internal/ortc_adapter_PeerConnection.h index 75e28e36..bfaa9ba4 100644 --- a/ortc/adapter/internal/ortc_adapter_PeerConnection.h +++ b/ortc/adapter/internal/ortc_adapter_PeerConnection.h @@ -59,9 +59,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionAsyncDelegate - #pragma mark + // + // IPeerConnectionAsyncDelegate + // interaction IPeerConnectionAsyncDelegate { @@ -75,9 +75,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection - #pragma mark + // + // PeerConnection + // class PeerConnection : public Noop, public MessageQueueAssociator, @@ -117,7 +117,7 @@ namespace ortc InternalState_Last = InternalState_Shutdown }; - static const char *toString(InternalStates state); + static const char *toString(InternalStates state) noexcept; enum NegotiationStates { @@ -132,7 +132,7 @@ namespace ortc NegotiationState_Last = NegotiationState_Rejected, }; - static const char *toString(NegotiationStates state); + static const char *toString(NegotiationStates state) noexcept; enum PendingMethods { @@ -147,7 +147,7 @@ namespace ortc PendingMethod_Last = PendingMethod_SetRemoteDescription, }; - static const char *toString(PendingMethods method); + static const char *toString(PendingMethods method) noexcept; typedef String TransportID; typedef String MediaLineID; @@ -179,19 +179,22 @@ namespace ortc typedef std::map DataChannelMap; ZS_DECLARE_PTR(DataChannelMap); + typedef std::set HashSet; + struct TransportInfo { struct Details { IICEGathererPtr mGatherer; IICETransportPtr mTransport; - bool mRTPEndOfCandidates {false}; + HashSet mProcessedICECandidates; + bool mICEEndOfCandidates {false}; IDTLSTransportPtr mDTLSTransport; ISRTPSDESTransportPtr mSRTPSDESTransport; ISRTPSDESTransportTypes::ParametersPtr mSRTPSDESParameters; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; TransportID mID; @@ -203,7 +206,7 @@ namespace ortc Details mRTCP; CertificateList mCertificates; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct MediaLineInfo @@ -216,20 +219,22 @@ namespace ortc NegotiationStates mNegotiationState {NegotiationState_First}; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct RTPMediaLineInfo : public MediaLineInfo { String mMediaType; + ISessionDescriptionTypes::MediaDirections mDirection {ISessionDescriptionTypes::MediaDirection_SendReceive}; + IHelper::IDPreferences mIDPreference {IHelper::IDPreference_First}; IRTPTypes::CapabilitiesPtr mLocalSenderCapabilities; IRTPTypes::CapabilitiesPtr mLocalReceiverCapabilities; IRTPTypes::CapabilitiesPtr mRemoteSenderCapabilities; IRTPTypes::CapabilitiesPtr mRemoteReceiverCapabilities; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct SCTPMediaLineInfo : public MediaLineInfo @@ -241,7 +246,7 @@ namespace ortc ISCTPTransportPtr mSCTPTransport; DataChannelMap mDataChannels; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct SenderInfo @@ -259,7 +264,7 @@ namespace ortc IRTPSenderPtr mSender; IRTPTypes::ParametersPtr mParameters; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct ReceiverInfo @@ -273,7 +278,7 @@ namespace ortc IRTPReceiverPtr mReceiver; UseMediaStreamMap mMediaStreams; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct DataChannelInfo @@ -296,11 +301,11 @@ namespace ortc PendingMethod( PendingMethods method, PromisePtr promise - ) : + ) noexcept : mMethod(method), mPromise(promise) {} - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct PendingAddTrack @@ -310,7 +315,7 @@ namespace ortc UseMediaStreamMap mMediaStreams; MediaStreamTrackConfigurationPtr mConfiguration; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct PendingAddDataChannel @@ -318,7 +323,7 @@ namespace ortc PromiseWithDataChannelPtr mPromise; IDataChannelTypes::ParametersPtr mParameters; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map TransportInfoMap; @@ -348,374 +353,376 @@ namespace ortc IMessageQueuePtr queue, IPeerConnectionDelegatePtr delegate, const Optional &configuration - ); + ) noexcept; - ~PeerConnection(); + ~PeerConnection() noexcept; public: PeerConnection( const Noop &, IMessageQueuePtr queue - ) : - SharedRecursiveLock(SharedRecursiveLock::create()), - MessageQueueAssociator(queue) {} + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; - static PeerConnectionPtr convert(IPeerConnectionPtr object); + static PeerConnectionPtr convert(IPeerConnectionPtr object) noexcept; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IPeerConnection - #pragma mark + // + // PeerConnection => IPeerConnection + // static PeerConnectionPtr create( IPeerConnectionDelegatePtr delegate, const Optional &configuration = Optional() - ); + ) noexcept; + + virtual PUID getID() const noexcept override { return mID; } - virtual IPeerConnectionSubscriptionPtr subscribe(IPeerConnectionDelegatePtr delegate) override; + IPeerConnectionSubscriptionPtr subscribe(IPeerConnectionDelegatePtr delegate) noexcept override; - virtual PromiseWithDescriptionPtr createOffer(const Optional &configuration = Optional()) override; - virtual PromiseWithDescriptionPtr createAnswer(const Optional &configuration = Optional()) override; + PromiseWithDescriptionPtr createOffer(const Optional &configuration = Optional()) noexcept override; + PromiseWithDescriptionPtr createAnswer(const Optional &configuration = Optional()) noexcept override; - virtual PromiseWithDescriptionPtr createCapabilities(const Optional &configuration = Optional()) override; + PromiseWithDescriptionPtr createCapabilities(const Optional &configuration = Optional()) noexcept override; - virtual PromisePtr setLocalDescription(ISessionDescriptionPtr description) override; + PromisePtr setLocalDescription(ISessionDescriptionPtr description) noexcept override; - virtual ISessionDescriptionPtr localDescription() const override; - virtual ISessionDescriptionPtr currentDescription() const override; - virtual ISessionDescriptionPtr pendingDescription() const override; + ISessionDescriptionPtr localDescription() const noexcept override; + ISessionDescriptionPtr currentDescription() const noexcept override; + ISessionDescriptionPtr pendingDescription() const noexcept override; - virtual PromisePtr setRemoteDescription(ISessionDescriptionPtr description) override; - virtual ISessionDescriptionPtr remoteDescription() const override; - virtual ISessionDescriptionPtr currentRemoteDescription() const override; - virtual ISessionDescriptionPtr pendingRemoteDescription() const override; - virtual void addICECandidate(const ICECandidate &candidate) override; + PromisePtr setRemoteDescription(ISessionDescriptionPtr description) noexcept override; + ISessionDescriptionPtr remoteDescription() const noexcept override; + ISessionDescriptionPtr currentRemoteDescription() const noexcept override; + ISessionDescriptionPtr pendingRemoteDescription() const noexcept override; + void addICECandidate(const ICECandidate &candidate) noexcept override; - virtual SignalingStates signalingState() const override; - virtual ICEGatheringStates iceGatheringState() const override; - virtual ICEConnectionStates iceConnectionState() const override; - virtual PeerConnectionStates connectionState() const override; - virtual bool canTrickleCandidates() const override; + SignalingStates signalingState() const noexcept override; + ICEGatheringStates iceGatheringState() const noexcept override; + ICEConnectionStates iceConnectionState() const noexcept override; + PeerConnectionStates connectionState() const noexcept override; + bool canTrickleCandidates() const noexcept override; - static ServerListPtr getDefaultIceServers(); + static ServerListPtr getDefaultIceServers() noexcept; - virtual ConfigurationPtr getConfiguration() const override; - virtual void setConfiguration(const Configuration &configuration) override; + ConfigurationPtr getConfiguration() const noexcept override; + void setConfiguration(const Configuration &configuration) noexcept override; - virtual void close() override; + void close() noexcept override; - virtual SenderListPtr getSenders() const override; - virtual ReceiverListPtr getReceivers() const override; - virtual PromiseWithSenderPtr addTrack( - IMediaStreamTrackPtr track, - const MediaStreamTrackConfiguration &configuration = MediaStreamTrackConfiguration() - ) override; - virtual PromiseWithSenderPtr addTrack( - IMediaStreamTrackPtr track, - const MediaStreamList &mediaStreams, - const MediaStreamTrackConfiguration &configuration = MediaStreamTrackConfiguration() - ) override; + SenderListPtr getSenders() const noexcept override; + ReceiverListPtr getReceivers() const noexcept override; + PromiseWithSenderPtr addTrack( + IMediaStreamTrackPtr track, + const MediaStreamTrackConfiguration &configuration = MediaStreamTrackConfiguration() + ) noexcept override; + PromiseWithSenderPtr addTrack( + IMediaStreamTrackPtr track, + const MediaStreamList &mediaStreams, + const MediaStreamTrackConfiguration &configuration = MediaStreamTrackConfiguration() + ) noexcept override; - virtual void removeTrack(IRTPSenderPtr sender) override; + void removeTrack(IRTPSenderPtr sender) noexcept override; - virtual PromiseWithDataChannelPtr createDataChannel(const IDataChannelTypes::Parameters ¶meters) override; + PromiseWithDataChannelPtr createDataChannel(const IDataChannelTypes::Parameters ¶meters) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IStatsProvider - #pragma mark + // + // PeerConnection => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IPeerConnectionAsyncDelegate - #pragma mark + // + // PeerConnection => IPeerConnectionAsyncDelegate + // - virtual void onProvideStats(PromiseWithStatsReportPtr promise, StatsTypeSet stats) override; + void onProvideStats(PromiseWithStatsReportPtr promise, StatsTypeSet stats) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IICEGathererDelegate - #pragma mark + // + // PeerConnection => IICEGathererDelegate + // + + void onICEGathererStateChange( + IICEGathererPtr gatherer, + IICEGatherer::States state + ) override; - virtual void onICEGathererStateChange( - IICEGathererPtr gatherer, - IICEGatherer::States state - ) override; + void onICEGathererLocalCandidate( + IICEGathererPtr gatherer, + CandidatePtr candidate + ) override; - virtual void onICEGathererLocalCandidate( + void onICEGathererLocalCandidateComplete( IICEGathererPtr gatherer, - CandidatePtr candidate + CandidateCompletePtr candidate ) override; - virtual void onICEGathererLocalCandidateComplete( - IICEGathererPtr gatherer, - CandidateCompletePtr candidate - ) override; - - virtual void onICEGathererLocalCandidateGone( - IICEGathererPtr gatherer, - CandidatePtr candidate - ) override; + void onICEGathererLocalCandidateGone( + IICEGathererPtr gatherer, + CandidatePtr candidate + ) override; - virtual void onICEGathererError( - IICEGathererPtr gatherer, - ErrorEventPtr errorEvent - ) override; + void onICEGathererError( + IICEGathererPtr gatherer, + ErrorEventPtr errorEvent + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IICETransportDelegate - #pragma mark - - virtual void onICETransportStateChange( - IICETransportPtr transport, - IICETransport::States state - ) override; - - virtual void onICETransportCandidatePairAvailable( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; - virtual void onICETransportCandidatePairGone( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; - - virtual void onICETransportCandidatePairChanged( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; + // + // PeerConnection => IICETransportDelegate + // + + void onICETransportStateChange( + IICETransportPtr transport, + IICETransport::States state + ) override; + + void onICETransportCandidatePairAvailable( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; + void onICETransportCandidatePairGone( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; + + void onICETransportCandidatePairChanged( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IDTLSTransportDelegate - #pragma mark + // + // PeerConnection => IDTLSTransportDelegate + // - virtual void onDTLSTransportStateChange( - IDTLSTransportPtr transport, - IDTLSTransport::States state - ) override; + void onDTLSTransportStateChange( + IDTLSTransportPtr transport, + IDTLSTransport::States state + ) override; - virtual void onDTLSTransportError( - IDTLSTransportPtr transport, - ErrorAnyPtr error - ) override; + void onDTLSTransportError( + IDTLSTransportPtr transport, + ErrorAnyPtr error + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISRTPSDESTransportDelegate - #pragma mark + // + // PeerConnection => ISRTPSDESTransportDelegate + // - virtual void onSRTPSDESTransportLifetimeRemaining( - ISRTPSDESTransportPtr transport, - ULONG leastLifetimeRemainingPercentageForAllKeys, - ULONG overallLifetimeRemainingPercentage - ) override; + void onSRTPSDESTransportLifetimeRemaining( + ISRTPSDESTransportPtr transport, + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage + ) override; - virtual void onSRTPSDESTransportError( - ISRTPSDESTransportPtr transport, - ErrorAnyPtr errorCode - ) override; + void onSRTPSDESTransportError( + ISRTPSDESTransportPtr transport, + ErrorAnyPtr errorCode + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IRTPListenerDelegate - #pragma mark - - virtual void onRTPListenerUnhandledRTP( - IRTPListenerPtr listener, - SSRCType ssrc, - PayloadType payloadType, - const char *mid, - const char *rid - ) override; + // + // PeerConnection => IRTPListenerDelegate + // + + void onRTPListenerUnhandledRTP( + IRTPListenerPtr listener, + SSRCType ssrc, + PayloadType payloadType, + const char *mid, + const char *rid + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IRTPSenderDelegate - #pragma mark + // + // PeerConnection => IRTPSenderDelegate + // - virtual void onRTPSenderSSRCConflict( - IRTPSenderPtr sender, - SSRCType ssrc - ) override; + void onRTPSenderSSRCConflict( + IRTPSenderPtr sender, + SSRCType ssrc + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IRTPReceiverDelegate - #pragma mark + // + // PeerConnection => IRTPReceiverDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISCTPTransportDelegate - #pragma mark + // + // PeerConnection => ISCTPTransportDelegate + // - virtual void onSCTPTransportStateChange( - ISCTPTransportPtr transport, - ISCTPTransportTypes::States state - ) override; - virtual void onSCTPTransportDataChannel( - ISCTPTransportPtr transport, - IDataChannelPtr channel - ) override; + void onSCTPTransportStateChange( + ISCTPTransportPtr transport, + ISCTPTransportTypes::States state + ) override; + void onSCTPTransportDataChannel( + ISCTPTransportPtr transport, + IDataChannelPtr channel + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISCTPTransportListenerDelegate - #pragma mark + // + // PeerConnection => ISCTPTransportListenerDelegate + // - virtual void onSCTPTransport(ISCTPTransportPtr transport) override; + void onSCTPTransport(ISCTPTransportPtr transport) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => ISCTPTransportListenerDelegate - #pragma mark - - virtual void onDataChannelStateChange( - IDataChannelPtr channel, - IDataChannelTypes::States state - ) override; - - virtual void onDataChannelError( - IDataChannelPtr channel, - ErrorAnyPtr error - ) override; + // + // PeerConnection => ISCTPTransportListenerDelegate + // + + void onDataChannelStateChange( + IDataChannelPtr channel, + IDataChannelTypes::States state + ) override; + + void onDataChannelError( + IDataChannelPtr channel, + ErrorAnyPtr error + ) override; - virtual void onDataChannelBufferedAmountLow(IDataChannelPtr channel) override; + void onDataChannelBufferedAmountLow(IDataChannelPtr channel) override; - virtual void onDataChannelMessage( - IDataChannelPtr channel, - MessageEventDataPtr data - ) override; + void onDataChannelMessage( + IDataChannelPtr channel, + MessageEventDataPtr data + ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IWakeDelegate - #pragma mark + // + // PeerConnection => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => IPromiseSettledDelegate - #pragma mark + // + // PeerConnection => IPromiseSettledDelegate + // - virtual void onPromiseSettled(PromisePtr promise) override; + void onPromiseSettled(PromisePtr promise) override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - bool isShuttingDown() const { return InternalState_ShuttingDown == mState; } - bool isShutdown() const { return InternalState_Shutdown == mState; } - bool isStopped() const { return isShuttingDown() || isShutdown(); } - - void wake(); - void notifyNegotiationNeeded(); - - void cancel(); - void setError(WORD errorCode, const char *errorReason = NULL); - - void step(); - bool stepCertificates(); - bool stepProcessRemote(); - bool stepProcessRemoteTransport(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessRemoteRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessRemoteRTPSenders(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessRemoteSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessLocal(); - bool stepProcessLocalTransport(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessLocalRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessLocalRTPSenders(ISessionDescriptionTypes::DescriptionPtr description); - bool stepProcessLocalSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description); - bool stepCreateOfferOrAnswer(); - bool stepProcessPendingRemoteCandidates(); - bool stepAddTracks(); - bool stepAddSCTPTransport(); - bool stepFinalizeSenders(); - bool stepFinalizeDataChannels(); - bool stepFixGathererState(); - bool stepFixTransportState(); - - void setState(InternalStates state); - void setState(SignalingStates state); - void setState(ICEGatheringStates state); - void setState(ICEConnectionStates state); - void setState(PeerConnectionStates state); + // + // PeerConnection => (internal) + // + + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; + + bool isShuttingDown() const noexcept { return InternalState_ShuttingDown == mState; } + bool isShutdown() const noexcept { return InternalState_Shutdown == mState; } + bool isStopped() const noexcept { return isShuttingDown() || isShutdown(); } + + void wake() noexcept; + void notifyNegotiationNeeded() noexcept; + + void cancel() noexcept; + void setError(WORD errorCode, const char *errorReason = NULL) noexcept; + + void step() noexcept; + bool stepCertificates() noexcept; + bool stepProcessRemote() noexcept; + bool stepProcessRemoteTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessRemoteRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessRemoteRTPSenders(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessRemoteSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessLocal() noexcept; + bool stepProcessLocalTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessLocalRTPMediaLines(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessLocalRTPSenders(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepProcessLocalSCTPTransport(ISessionDescriptionTypes::DescriptionPtr description) noexcept; + bool stepCreateOfferOrAnswer() noexcept; + bool stepProcessPendingRemoteCandidates() noexcept; + bool stepAddTracks() noexcept; + bool stepAddSCTPTransport() noexcept; + bool stepFinalizeSenders() noexcept; + bool stepFinalizeDataChannels() noexcept; + bool stepFixGathererState() noexcept; + bool stepFixTransportState() noexcept; + + void setState(InternalStates state) noexcept; + void setState(SignalingStates state) noexcept; + void setState(ICEGatheringStates state) noexcept; + void setState(ICEConnectionStates state) noexcept; + void setState(PeerConnectionStates state) noexcept; void addCandidateToTransport( TransportInfo &transport, ICECandidatePtr candidate - ); - - TransportInfoPtr getTransportFromPool(const char *useID = NULL); - void addToTransportPool(); - - String registerNewID(size_t length = 3); - String registerIDUsage(const char *idStr); - void unregisterID(const char *idStr); - WORD registerNewLocalPort(); - - void flushLocalPending(ISessionDescriptionPtr description); - void flushRemotePending(ISessionDescriptionPtr description); - void close(TransportInfo &transportInfo); - void close(TransportInfo::Details &details); - void close(RTPMediaLineInfo &mediaLineInfo); - void close(SCTPMediaLineInfo &mediaLineInfo); - void close(SenderInfo &senderInfo); - void close(ReceiverInfo &receiverInfo); - - void insertSSRCs(SenderInfo &senderInfo); - void clearSSRCs(SenderInfo &senderInfo); - void clearSSRC(SSRCType ssrc); - void fillRTCPSSRC(IRTPTypes::Parameters &ioReceiverParameters); - - void close(PendingMethod &pending); - void close(PendingAddTrack &pending); - void close(PendingAddDataChannel &pending); - - void purgeNonReferencedAndEmptyStreams(); - Optional getNextHighestMLineIndex() const; - - void moveAddedTracksToPending(); + ) noexcept; + + TransportInfoPtr getTransportFromPool(const char *useID = NULL) noexcept; + void addToTransportPool() noexcept; + + String registerNewID(size_t length = 3) noexcept; + String registerIDUsage(const char *idStr) noexcept; + void unregisterID(const char *idStr) noexcept; + WORD registerNewLocalPort() noexcept; + + void flushLocalPending(ISessionDescriptionPtr description) noexcept; + void flushRemotePending(ISessionDescriptionPtr description) noexcept; + void close(TransportInfo &transportInfo) noexcept; + void close(TransportInfo::Details &details) noexcept; + void close(RTPMediaLineInfo &mediaLineInfo) noexcept; + void close(SCTPMediaLineInfo &mediaLineInfo) noexcept; + void close(SenderInfo &senderInfo) noexcept; + void close(ReceiverInfo &receiverInfo) noexcept; + + void insertSSRCs(SenderInfo &senderInfo) noexcept; + void clearSSRCs(SenderInfo &senderInfo) noexcept; + void clearSSRC(SSRCType ssrc) noexcept; + void fillRTCPSSRC(IRTPTypes::Parameters &ioReceiverParameters) noexcept; + + void close(PendingMethod &pending) noexcept; + void close(PendingAddTrack &pending) noexcept; + void close(PendingAddDataChannel &pending) noexcept; + + void purgeNonReferencedAndEmptyStreams() noexcept; + Optional getNextHighestMLineIndex() const noexcept; + + void moveAddedTracksToPending() noexcept; void processStats( PromiseWithStatsReportPtr collectionPromise, PromiseWithStatsReportPtr resolvePromise - ); + ) noexcept; - static MediaStreamListPtr convertToList(const UseMediaStreamMap &useStreams); - static UseMediaStreamMapPtr convertToMap(const MediaStreamList &mediaStreams); - static MediaStreamSetPtr convertToSet(const UseMediaStreamMap &useStreams); - static ISessionDescriptionTypes::ICECandidateListPtr convertCandidateList(IICETypes::CandidateList &source); + static MediaStreamListPtr convertToList(const UseMediaStreamMap &useStreams) noexcept; + static UseMediaStreamMapPtr convertToMap(const MediaStreamList &mediaStreams) noexcept; + static MediaStreamSetPtr convertToSet(const UseMediaStreamMap &useStreams) noexcept; + static ISessionDescriptionTypes::ICECandidateListPtr convertCandidateList(IICETypes::CandidateList &source) noexcept; static void calculateDelta( const MediaStreamSet &existingSet, const MediaStreamSet &newSet, MediaStreamSet &outAdded, MediaStreamSet &outRemoved - ); + ) noexcept; static IDTLSTransportTypes::ParametersPtr getDTLSParameters( const TransportInfo &transportInfo, IICETypes::Components component - ); + ) noexcept; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark PeerConnection => (data) - #pragma mark + // + // PeerConnection => (data) + // AutoPUID mID; PeerConnectionWeakPtr mThisWeak; @@ -781,23 +788,23 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IPeerConnectionFactory - #pragma mark + // + // IPeerConnectionFactory + // interaction IPeerConnectionFactory { typedef IPeerConnectionTypes::Configuration Configuration; typedef IPeerConnectionTypes::ServerListPtr ServerListPtr; - static IPeerConnectionFactory &singleton(); + static IPeerConnectionFactory &singleton() noexcept; virtual PeerConnectionPtr create( IPeerConnectionDelegatePtr delegate, const Optional &configuration = Optional() - ); + ) noexcept; - virtual ServerListPtr getDefaultIceServers(); + virtual ServerListPtr getDefaultIceServers() noexcept; }; class PeerConnectionFactory : public IFactory {}; @@ -810,6 +817,6 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::adapter::internal::IPeerConnectionAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProviderTypes::PromiseWithStatsReportPtr, PromiseWithStatsReportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProviderTypes::StatsTypeSet, StatsTypeSet) -ZS_DECLARE_PROXY_METHOD_2(onProvideStats, PromiseWithStatsReportPtr, StatsTypeSet) +ZS_DECLARE_PROXY_METHOD(onProvideStats, PromiseWithStatsReportPtr, StatsTypeSet) ZS_DECLARE_PROXY_END() diff --git a/ortc/adapter/internal/ortc_adapter_SDPParser.h b/ortc/adapter/internal/ortc_adapter_SDPParser.h index 56e37942..a6e3f51c 100644 --- a/ortc/adapter/internal/ortc_adapter_SDPParser.h +++ b/ortc/adapter/internal/ortc_adapter_SDPParser.h @@ -44,9 +44,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ISDPTypes - #pragma mark + // + // ISDPTypes + // interaction ISDPTypes { @@ -137,9 +137,9 @@ namespace ortc LineType_c_ConnectionDataLine = 'c', }; - static const char *toString(LineTypes type); - static LineTypes toLineType(const char *type); - static LineTypes toLineType(const char type); + static const char *toString(LineTypes type) noexcept(false); + static LineTypes toLineType(const char *type) noexcept; + static LineTypes toLineType(const char type) noexcept; enum Attributes { @@ -184,11 +184,11 @@ namespace ortc Attribute_Last = Attribute_MaxMessageSize, }; - static const char *toString(Attributes attribute); - static Attributes toAttribute(const char *attribute); + static const char *toString(Attributes attribute) noexcept; + static Attributes toAttribute(const char *attribute) noexcept; - static bool requiresValue(Attributes attribute); - static bool requiresEmptyValue(Attributes attribute); + static bool requiresValue(Attributes attribute) noexcept; + static bool requiresEmptyValue(Attributes attribute) noexcept; enum AttributeLevels { @@ -203,20 +203,20 @@ namespace ortc AttributeLevel_All = AttributeLevel_Session | AttributeLevel_Media | AttributeLevel_Source, }; - static const char *toString(AttributeLevels level); - static AttributeLevels toAttributeLevel(const char *level); + static const char *toString(AttributeLevels level) noexcept; + static AttributeLevels toAttributeLevel(const char *level) noexcept(false); - static AttributeLevels getAttributeLevel(LineTypes lineType); - static AttributeLevels getAttributeLevel(Attributes attribute); + static AttributeLevels getAttributeLevel(LineTypes lineType) noexcept; + static AttributeLevels getAttributeLevel(Attributes attribute) noexcept; static bool supportedAtLevel( AttributeLevels currentLevel, LineTypes lineType - ); + ) noexcept; static bool supportedAtLevel( AttributeLevels currentLevel, Attributes attribute - ); + ) noexcept; enum Locations { @@ -228,8 +228,8 @@ namespace ortc Location_Last = Location_Remote, }; - static const char *toString(Locations location); - static Locations toLocation(const char *location); + static const char *toString(Locations location) noexcept; + static Locations toLocation(const char *location) noexcept(false); enum Directions { @@ -240,15 +240,16 @@ namespace ortc Direction_SendReceive = Direction_Send | Direction_Receive, }; - static const char *toString(Directions direction); - static Directions toDirection(const char *direction); + static const char *toStringForA(Directions direction) noexcept; + static const char *toStringForRID(Directions direction) noexcept; + static Directions toDirection(const char *direction) noexcept(false); static bool isValid( Directions direction, bool allowNone, bool allowSend, bool allowReceive, bool allowSendReceive - ); + ) noexcept; enum ActorRoles { @@ -257,14 +258,14 @@ namespace ortc ActorRole_Transceiver = ActorRole_Sender | ActorRole_Receiver, }; - static const char *toString(ActorRoles actor); - static ActorRoles toActorRole(const char *actor); + static const char *toString(ActorRoles actor) noexcept; + static ActorRoles toActorRole(const char *actor) noexcept(false); static bool isApplicable( ActorRoles actor, Locations location, Directions direction - ); + ) noexcept; enum ProtocolTypes { @@ -278,8 +279,8 @@ namespace ortc ProtocolType_Last = ProtocolType_SCTP, }; - static const char *toString(ProtocolTypes proto); - static ProtocolTypes toProtocolType(const char *proto); + static const char *toString(ProtocolTypes proto) noexcept; + static ProtocolTypes toProtocolType(const char *proto) noexcept(false); //--------------------------------------------------------------------- //--------------------------------------------------------------------- @@ -294,7 +295,7 @@ namespace ortc { MLinePtr mMLine; - MediaLine(MLinePtr mline) : mMLine(mline) {} + MediaLine(MLinePtr mline) noexcept : mMLine(mline) {} }; // https://tools.ietf.org/html/rfc4566#section-5.1 @@ -302,7 +303,7 @@ namespace ortc { ULONGLONG mVersion {}; - VLine(const char *value); + VLine(const char *value) noexcept(false); }; // https://tools.ietf.org/html/rfc4566#section-5.2 @@ -315,10 +316,10 @@ namespace ortc String mAddrType; String mUnicastAddress; - OLine(const Noop &) {} - OLine(const char *value); - String toString() const; - static String toString(const OLinePtr &line) { if (!line) return String(); return line->toString(); } + OLine(const Noop &) noexcept {} + OLine(const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const OLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-5.3 @@ -326,10 +327,10 @@ namespace ortc { String mSessionName; - SLine(const Noop &) {} - SLine(const char *value); - String toString() const { return mSessionName.hasData() ? mSessionName : String("-"); } - static String toString(const SLinePtr &line) { if (!line) return String("-"); return line->toString(); } + SLine(const Noop &) noexcept {} + SLine(const char *value) noexcept; + String toString() const noexcept { return mSessionName.hasData() ? mSessionName : String("-"); } + static String toString(const SLinePtr &line) noexcept { if (!line) return String("-"); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-5.8 @@ -338,7 +339,7 @@ namespace ortc String mBWType; ULONGLONG mBandwidth {}; - BLine(MLinePtr mline, const char *value); + BLine(MLinePtr mline, const char *value) noexcept(false); }; // https://tools.ietf.org/html/rfc4566#section-5.9 @@ -347,10 +348,10 @@ namespace ortc QWORD mStartTime {}; QWORD mEndTime {}; - TLine(const Noop &) {} - TLine(const char *value); - String toString() const { return string(mStartTime) + " " + string(mEndTime); } - static String toString(const TLinePtr &line) { if (!line) return String(); return line->toString(); } + TLine(const Noop &) noexcept {} + TLine(const char *value) noexcept(false); + String toString() const noexcept { return string(mStartTime) + " " + string(mEndTime); } + static String toString(const TLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-5.14 @@ -397,10 +398,10 @@ namespace ortc ASSRCGroupLineList mASSRCGroupLines; ARIDLineList mARIDLines; - MLine(const Noop &) {} - MLine(const char *value); - String toString() const; - static String toString(const MLinePtr &line) { if (!line) return String(); return line->toString(); } + MLine(const Noop &) noexcept {} + MLine(const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const MLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-5.7 @@ -410,10 +411,10 @@ namespace ortc String mAddrType; String mConnectionAddress; - CLine(const Noop &) : MediaLine(nullptr) {} - CLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const CLinePtr &line) { if (!line) return String(); return line->toString(); } + CLine(const Noop &) noexcept : MediaLine(nullptr) {} + CLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const CLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; //--------------------------------------------------------------------- @@ -430,12 +431,12 @@ namespace ortc { MLinePtr mMLine; - AMediaLine(MLinePtr mline) : mMLine(mline) {} + AMediaLine(MLinePtr mline) noexcept : mMLine(mline) {} }; struct AMediaFlagLine : public AMediaLine { - AMediaFlagLine(MLinePtr mline) : AMediaLine(mline) {} + AMediaFlagLine(MLinePtr mline) noexcept : AMediaLine(mline) {} }; // https://tools.ietf.org/html/rfc5888#section-5 @@ -444,10 +445,10 @@ namespace ortc String mSemantic; StringList mIdentificationTags; - AGroupLine(const Noop &) {} - AGroupLine(const char *value); - String toString() const; - static String toString(const AGroupLinePtr &line) { if (!line) return String(); return line->toString(); } + AGroupLine(const Noop &) noexcept {} + AGroupLine(const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const AGroupLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/draft-ietf-mmusic-msid-13#section-2 @@ -456,17 +457,17 @@ namespace ortc String mID; String mAppData; - AMSIDLine(const Noop &) : AMediaLine(nullptr) {} - AMSIDLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const AMSIDLinePtr &line) { if (!line) return String(); return line->toString(); } + AMSIDLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AMSIDLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const AMSIDLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/draft-ietf-mmusic-msid-13#appendix-B.5 // a=msid-semantic: WMS CESG4hDt2y4kkEizBkB4vbj7GQpC6hF7XTLR struct AMSIDSemanticLine : public AGroupLine { - AMSIDSemanticLine(const char *value) : AGroupLine(value) {} + AMSIDSemanticLine(const char *value) noexcept : AGroupLine(value) {} }; // https://tools.ietf.org/html/rfc5245#section-15.4 @@ -474,10 +475,10 @@ namespace ortc { String mICEUFrag; - AICEUFragLine(const Noop &) : AMediaLine(nullptr) {} - AICEUFragLine(MLinePtr mline, const char *value); - String toString() const { return "ice-ufrag:" + mICEUFrag; } - static String toString(const AICEUFragLinePtr &line) { if (!line) return String(); return line->toString(); } + AICEUFragLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AICEUFragLine(MLinePtr mline, const char *value) noexcept; + String toString() const noexcept { return "ice-ufrag:" + mICEUFrag; } + static String toString(const AICEUFragLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5245#section-15.4 @@ -485,21 +486,21 @@ namespace ortc { String mICEPwd; - AICEPwdLine(const Noop &) : AMediaLine(nullptr) {} - AICEPwdLine(MLinePtr mline, const char *value); - String toString() const { return "ice-pwd:" + mICEPwd; } - static String toString(const AICEPwdLinePtr &line) { if (!line) return String(); return line->toString(); } + AICEPwdLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AICEPwdLine(MLinePtr mline, const char *value) noexcept; + String toString() const noexcept { return "ice-pwd:" + mICEPwd; } + static String toString(const AICEPwdLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5245#section-15.5 - struct AICEOptionsLine : public ALine + struct AICEOptionsLine : public AMediaLine { StringList mTags; - AICEOptionsLine(const Noop &) {} - AICEOptionsLine(const char *value); - String toString() const; - static String toString(const AICEOptionsLinePtr &line) { if (!line) return String(); return line->toString(); } + AICEOptionsLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AICEOptionsLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const AICEOptionsLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5245#section-15.1 @@ -523,10 +524,10 @@ namespace ortc ExtensionPairList mExtensionPairs; - ACandidateLine(const Noop &) : AMediaLine(nullptr) {} - ACandidateLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ACandidateLinePtr &line) { if (!line) return String(); return line->toString(); } + ACandidateLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ACandidateLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ACandidateLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4572#section-5 @@ -535,10 +536,10 @@ namespace ortc String mHashFunc; String mFingerprint; - AFingerprintLine(const Noop &) : AMediaLine(nullptr) {} - AFingerprintLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const AFingerprintLinePtr &line) { if (!line) return String(); return line->toString(); } + AFingerprintLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AFingerprintLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const AFingerprintLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4568#section-9.1 @@ -554,10 +555,10 @@ namespace ortc KeyParamList mKeyParams; StringList mSessionParams; - ACryptoLine(const Noop &) : AMediaLine(nullptr) {} - ACryptoLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ACryptoLinePtr &line) { if (!line) return String(); return line->toString(); } + ACryptoLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ACryptoLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ACryptoLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4145#section-4 @@ -566,10 +567,10 @@ namespace ortc { String mSetup; - ASetupLine(const Noop &) : AMediaLine(nullptr) {} - ASetupLine(MLinePtr mline, const char *value); - String toString() const { return "setup:" + mSetup; } - static String toString(const ASetupLinePtr &line) { if (!line) return String(); return line->toString(); } + ASetupLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ASetupLine(MLinePtr mline, const char *value) noexcept; + String toString() const noexcept { return "setup:" + mSetup; } + static String toString(const ASetupLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5888#section-9.1 @@ -577,10 +578,10 @@ namespace ortc { String mMID; - AMIDLine(const Noop &) : AMediaLine(nullptr) {} - AMIDLine(MLinePtr mline, const char *value); - String toString() const { return "mid:" + mMID; } - static String toString(const AMIDLinePtr &line) { if (!line) return String(); return line->toString(); } + AMIDLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AMIDLine(MLinePtr mline, const char *value) noexcept; + String toString() const noexcept { return "mid:" + mMID; } + static String toString(const AMIDLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5285#section-7 @@ -591,10 +592,10 @@ namespace ortc String mURI; String mExtensionAttributes; - AExtmapLine(const Noop &) : AMediaLine(nullptr) {} - AExtmapLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const AExtmapLinePtr &line) { if (!line) return String(); return line->toString(); } + AExtmapLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AExtmapLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const AExtmapLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-6 @@ -602,7 +603,7 @@ namespace ortc { Directions mDirection {Direction_None}; - AMediaDirectionLine(MLinePtr mline, const char *value); + AMediaDirectionLine(MLinePtr mline, const char *value) noexcept(false); }; // https://tools.ietf.org/html/rfc4566#section-6 @@ -613,10 +614,10 @@ namespace ortc ULONG mClockRate {}; Optional mEncodingParameters; - ARTPMapLine(const Noop &) : AMediaLine(nullptr) {} - ARTPMapLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ARTPMapLinePtr &line) { if (!line) return String(); return line->toString(); } + ARTPMapLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ARTPMapLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ARTPMapLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-6 @@ -629,10 +630,10 @@ namespace ortc String mFormatStr; StringList mFormatSpecific; - AFMTPLine(const Noop &) : AMediaLine(nullptr) {} - AFMTPLine(MLinePtr mline, ASSRCLinePtr sourceLine, const char *value); - String toString() const; - static String toString(const AFMTPLinePtr &line) { if (!line) return String(); return line->toString(); } + AFMTPLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AFMTPLine(MLinePtr mline, ASSRCLinePtr sourceLine, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const AFMTPLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc3605#section-2.1 @@ -643,10 +644,10 @@ namespace ortc String mAddrType; String mConnectionAddress; - ARTCPLine(const Noop &) : AMediaLine(nullptr) {} - ARTCPLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ARTCPLinePtr &line) { if (!line) return String(); return line->toString(); } + ARTCPLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ARTCPLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ARTCPLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4585#section-4.2 @@ -657,10 +658,10 @@ namespace ortc String mParam1; String mParam2; - ARTCPFBLine(const Noop &) : AMediaLine(nullptr) {} - ARTCPFBLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ARTCPFBLinePtr &line) { if (!line) return String(); return line->toString(); } + ARTCPFBLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ARTCPFBLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ARTCPFBLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-6 @@ -668,10 +669,10 @@ namespace ortc { Milliseconds mPTime {}; - APTimeLine(const Noop &) : AMediaLine(nullptr) {} - APTimeLine(MLinePtr mline, const char *value); - String toString() const { return "ptime:" + string(mPTime.count()); } - static String toString(const APTimeLinePtr &line) { if (!line) return String(); return line->toString(); } + APTimeLine(const Noop &) noexcept : AMediaLine(nullptr) {} + APTimeLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept { return "ptime:" + string(mPTime.count()); } + static String toString(const APTimeLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc4566#section-6 @@ -679,10 +680,10 @@ namespace ortc { Milliseconds mMaxPTime {}; - AMaxPTimeLine(const Noop &) : AMediaLine(nullptr) {} - AMaxPTimeLine(MLinePtr mline, const char *value); - String toString() const { return "maxptime:" + string(mMaxPTime.count()); } - static String toString(const AMaxPTimeLinePtr &line) { if (!line) return String(); return line->toString(); } + AMaxPTimeLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AMaxPTimeLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept { return "maxptime:" + string(mMaxPTime.count()); } + static String toString(const AMaxPTimeLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5576#section-4.1 @@ -694,10 +695,10 @@ namespace ortc AFMTPLineList mAFMTPLines; - ASSRCLine(const Noop &) : AMediaLine(nullptr) {} - ASSRCLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ASSRCLinePtr &line) { if (!line) return String(); return line->toString(); } + ASSRCLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ASSRCLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ASSRCLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/rfc5576#section-4.2 @@ -706,10 +707,10 @@ namespace ortc String mSemantics; SSRCList mSSRCs; - ASSRCGroupLine(const Noop &) : AMediaLine(nullptr) {} - ASSRCGroupLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ASSRCGroupLinePtr &line) { if (!line) return String(); return line->toString(); } + ASSRCGroupLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ASSRCGroupLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ASSRCGroupLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/draft-ietf-mmusic-rid-05#section-10 @@ -725,10 +726,10 @@ namespace ortc PayloadTypeList mPayloadTypes; RIDParamList mParams; - ARIDLine(const Noop &) : AMediaLine(nullptr) {} - ARIDLine(MLinePtr mline, const char *value); - String toString() const; - static String toString(const ARIDLinePtr &line) { if (!line) return String(); return line->toString(); } + ARIDLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ARIDLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept; + static String toString(const ARIDLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-04#section-6.1 @@ -751,7 +752,7 @@ namespace ortc SCValueList mValues; - ASimulcastLine(MLinePtr mline, const char *value); + ASimulcastLine(MLinePtr mline, const char *value) noexcept(false); }; // https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-16#section-5.2 @@ -759,10 +760,10 @@ namespace ortc { WORD mPort {}; - ASCTPPortLine(const Noop &) : AMediaLine(nullptr) {} - ASCTPPortLine(MLinePtr mline, const char *value); - String toString() const { return "sctp-port:" +string(mPort); } - static String toString(const ASCTPPortLinePtr &line) { if (!line) return String(); return line->toString(); } + ASCTPPortLine(const Noop &) noexcept : AMediaLine(nullptr) {} + ASCTPPortLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept { return "sctp-port:" +string(mPort); } + static String toString(const ASCTPPortLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; // https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-16#section-6.2 @@ -770,10 +771,10 @@ namespace ortc { size_t mMaxMessageSize {}; - AMaxMessageSizeLine(const Noop &) : AMediaLine(nullptr) {} - AMaxMessageSizeLine(MLinePtr mline, const char *value); - String toString() const { return "max-message-size:" + string(mMaxMessageSize); } - static String toString(const AMaxMessageSizeLinePtr &line) { if (!line) return String(); return line->toString(); } + AMaxMessageSizeLine(const Noop &) noexcept : AMediaLine(nullptr) {} + AMaxMessageSizeLine(MLinePtr mline, const char *value) noexcept(false); + String toString() const noexcept { return "max-message-size:" + string(mMaxMessageSize); } + static String toString(const AMaxMessageSizeLinePtr &line) noexcept { if (!line) return String(); return line->toString(); } }; //--------------------------------------------------------------------- @@ -790,7 +791,7 @@ namespace ortc LineValuePtr mLineValue; - ElementPtr toDebug(); + ElementPtr toDebug() noexcept; }; struct SDP @@ -829,9 +830,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SDPParser - #pragma mark + // + // SDPParser + // class SDPParser : public ISDPTypes { @@ -843,75 +844,75 @@ namespace ortc }; protected: - static void parseLines(SDP &sdp); - static void parseAttributes(SDP &sdp); - static void validateAttributeLevels(SDP &sdp); - static void parseLinesDetails(SDP &sdp); - static void processFlagAttributes(SDP &sdp); - static void processSessionLevelValues(SDP &sdp); - static void processMediaLevelValues(SDP &sdp); - static void processSourceLevelValues(SDP &sdp); + static void parseLines(SDP &sdp) noexcept(false); + static void parseAttributes(SDP &sdp) noexcept(false); + static void validateAttributeLevels(SDP &sdp) noexcept(false); + static void parseLinesDetails(SDP &sdp) noexcept(false); + static void processFlagAttributes(SDP &sdp) noexcept(false); + static void processSessionLevelValues(SDP &sdp) noexcept(false); + static void processMediaLevelValues(SDP &sdp) noexcept(false); + static void processSourceLevelValues(SDP &sdp) noexcept(false); static void createDescriptionDetails( const SDP &sdp, Description &ioDescription - ); + ) noexcept; static void createTransports( const SDP &sdp, Description &ioDescription - ); + ) noexcept; static void createRTPMediaLines( Locations location, const SDP &sdp, Description &ioDescription - ); + ) noexcept; static void createSCTPMediaLines( Locations location, const SDP &sdp, Description &ioDescription - ); + ) noexcept; static void createRTPSenderLines( Locations location, const SDP &sdp, Description &ioDescription - ); + ) noexcept(false); static void createSDPSessionLevel( const GeneratorOptions &options, const Description &description, SDP &ioSDP - ); + ) noexcept(false); static void createSDPMediaLevel( const GeneratorOptions &options, const Description &description, SDP &ioSDP - ); + ) noexcept(false); static void generateSessionLevel( const SDP &sdp, String &ioResult - ); + ) noexcept; static void generateMediaLevel( const SDP &sdp, String &ioResult - ); + ) noexcept; public: - static SDPPtr parse(const char *blob); - static String generate(const SDP &sdp); + static SDPPtr parse(const char *blob) noexcept(false); + static String generate(const SDP &sdp) noexcept(false); static SDPPtr createSDP( const GeneratorOptions &options, const Description &description - ); + ) noexcept(false); static DescriptionPtr createDescription( Locations location, const SDP &sdp - ); + ) noexcept(false); - static String getCandidateSDP(const IICETypes::Candidate &candidate); - static IICETypes::GatherCandidatePtr getCandidateFromSDP(const char *candidate); + static String getCandidateSDP(const IICETypes::Candidate &candidate) noexcept; + static IICETypes::GatherCandidatePtr getCandidateFromSDP(const char *candidate) noexcept; }; } } diff --git a/ortc/adapter/internal/ortc_adapter_SessionDescription.h b/ortc/adapter/internal/ortc_adapter_SessionDescription.h index 4d16487e..7849f47c 100644 --- a/ortc/adapter/internal/ortc_adapter_SessionDescription.h +++ b/ortc/adapter/internal/ortc_adapter_SessionDescription.h @@ -49,9 +49,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription - #pragma mark + // + // SessionDescription + // class SessionDescription : public SharedRecursiveLock, public ISessionDescription @@ -59,7 +59,7 @@ namespace ortc protected: struct make_private {}; - void init(); + void init() noexcept; public: SessionDescription( @@ -67,45 +67,45 @@ namespace ortc SignalingTypes type, const char *descriptionStr, const Description *description - ); + ) noexcept; - static SessionDescriptionPtr convert(ISessionDescriptionPtr object); + static SessionDescriptionPtr convert(ISessionDescriptionPtr object) noexcept; //--------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription => ISessionDescription - #pragma mark + // + // SessionDescription => ISessionDescription + // - static ElementPtr toDebug(ISessionDescriptionPtr object); + static ElementPtr toDebug(ISessionDescriptionPtr object) noexcept; static SessionDescriptionPtr create( SignalingTypes type, const char *description - ); + ) noexcept; static SessionDescriptionPtr create( SignalingTypes type, const Description &description - ); + ) noexcept; - virtual PUID getID() const override { return mID; } + PUID getID() const noexcept override { return mID; } - virtual SignalingTypes type() const override; - virtual DescriptionPtr description() const override; - virtual SignalingDescription formattedDescription() const override; + SignalingTypes type() const noexcept override; + DescriptionPtr description() const noexcept override; + SignalingDescription formattedDescription() const noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription => (internal) - #pragma mark + // + // SessionDescription => (internal) + // - virtual ElementPtr toDebug() const; + virtual ElementPtr toDebug() const noexcept; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark SessionDescription => (data) - #pragma mark + // + // SessionDescription => (data) + // AutoPUID mID; SessionDescriptionWeakPtr mThisWeak; @@ -121,25 +121,25 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamFactory - #pragma mark + // + // IMediaStreamFactory + // interaction ISessionDescriptionFactory { typedef ISessionDescriptionTypes::SignalingTypes SignalingTypes; ZS_DECLARE_TYPEDEF_PTR(ISessionDescriptionTypes::Description, Description); - static ISessionDescriptionFactory &singleton(); + static ISessionDescriptionFactory &singleton() noexcept; virtual SessionDescriptionPtr create( SignalingTypes type, const char *description - ); + ) noexcept; virtual SessionDescriptionPtr create( SignalingTypes type, const Description &description - ); + ) noexcept; }; class SessionDescriptionFactory : public IFactory {}; diff --git a/ortc/adapter/internal/types.h b/ortc/adapter/internal/types.h index 3290535d..784bc6e1 100644 --- a/ortc/adapter/internal/types.h +++ b/ortc/adapter/internal/types.h @@ -65,9 +65,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark (forwards) - #pragma mark + // + // (forwards) + // ZS_DECLARE_INTERACTION_PTR(ISDPParser); diff --git a/ortc/adapter/types.h b/ortc/adapter/types.h index 1be4f820..7213c298 100644 --- a/ortc/adapter/types.h +++ b/ortc/adapter/types.h @@ -33,6 +33,9 @@ #include +#define __STRUCT__ struct +#define interface __STRUCT__ + namespace ortc { namespace adapter diff --git a/ortc/cpp/ifaddrs-android.cc b/ortc/cpp/ifaddrs-android.cc index dba7b7a8..d05226fe 100644 --- a/ortc/cpp/ifaddrs-android.cc +++ b/ortc/cpp/ifaddrs-android.cc @@ -51,7 +51,7 @@ namespace { const int kMaxReadSize = 4096; }; -int set_ifname(struct ifaddrs* ifaddr, int interface) { +int set_ifname(struct ifaddrs* ifaddr, int interface) noexcept { char buf[IFNAMSIZ] = {0}; char* name = if_indextoname(interface, buf); if (name == NULL) { @@ -62,7 +62,7 @@ int set_ifname(struct ifaddrs* ifaddr, int interface) { return 0; } -int set_flags(struct ifaddrs* ifaddr) { +int set_flags(struct ifaddrs* ifaddr) noexcept { int fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { return -1; @@ -80,7 +80,7 @@ int set_flags(struct ifaddrs* ifaddr) { } int set_addresses(struct ifaddrs* ifaddr, ifaddrmsg* msg, void* data, - size_t len) { + size_t len) noexcept { if (msg->ifa_family == AF_INET) { sockaddr_in* sa = new sockaddr_in; sa->sin_family = AF_INET; @@ -98,7 +98,7 @@ int set_addresses(struct ifaddrs* ifaddr, ifaddrmsg* msg, void* data, return 0; } -int make_prefixes(struct ifaddrs* ifaddr, int family, int prefixlen) { +int make_prefixes(struct ifaddrs* ifaddr, int family, int prefixlen) noexcept { char* prefix = NULL; if (family == AF_INET) { sockaddr_in* mask = new sockaddr_in; @@ -131,7 +131,7 @@ int make_prefixes(struct ifaddrs* ifaddr, int family, int prefixlen) { } int populate_ifaddrs(struct ifaddrs* ifaddr, ifaddrmsg* msg, void* bytes, - size_t len) { + size_t len) noexcept { if (set_ifname(ifaddr, msg->ifa_index) != 0) { return -1; } @@ -147,7 +147,7 @@ int populate_ifaddrs(struct ifaddrs* ifaddr, ifaddrmsg* msg, void* bytes, return 0; } -int getifaddrs(struct ifaddrs** result) { +int getifaddrs(struct ifaddrs** result) noexcept { int fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (fd < 0) { return -1; @@ -221,7 +221,7 @@ int getifaddrs(struct ifaddrs** result) { return -1; } -void freeifaddrs(struct ifaddrs* addrs) { +void freeifaddrs(struct ifaddrs* addrs) noexcept { struct ifaddrs* last = NULL; struct ifaddrs* cursor = addrs; while (cursor) { diff --git a/ortc/cpp/ortc.cpp b/ortc/cpp/ortc.cpp index a0383c17..07d39dfb 100644 --- a/ortc/cpp/ortc.cpp +++ b/ortc/cpp/ortc.cpp @@ -29,48 +29,53 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include + +#include + #include #include -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_webrtc) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_dtlstransport) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_icegatherer) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_icegatherer_router) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_icetransport) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_icetransport_controller) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_mediadevices) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_mediastreamtrack) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_rtp_rtcp_packet) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_rtplistener) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_rtpmediaengine) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_rtpreceiver) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_rtpsender) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_rtptypes) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_sctp_datachannel) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_srtp) } -namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(ortclib_stats) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_webrtc) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_dtls_transport) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_ice_gatherer) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_ice_gatherer_router) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_ice_transport) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_ice_transport_controller) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_media_devices) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_media_engine) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_media_stream_track) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_rtp_rtcp_packet) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_rtp_listener) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_rtp_receiver) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_rtp_sender) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_rtp_types) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_sctp_data_channel) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_srtp) } +namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_stats) } ZS_EVENTING_EXCLUSIVE(OrtcLib); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_webrtc, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_dtlstransport, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_icegatherer, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_icegatherer_router, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_icetransport, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_icetransport_controller, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_mediadevices, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_mediastreamtrack, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_rtp_rtcp_packet, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_rtplistener, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_rtpmediaengine, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_rtpreceiver, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_rtpsender, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_rtptypes, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_sctp_datachannel, Debug); -ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(ortclib_srtp, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_webrtc, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_dtlstransport, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_ice_gatherer, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_ice_gatherer_router, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_ice_transport, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_ice_transport_controller, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_media_devices, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_media_engine, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_media_stream_track, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_rtp_rtcp_packet, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_rtp_listener, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_rtp_receiver, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_rtp_sender, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_rtp_types, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_sctp_data_channel, Debug); +ZS_EVENTING_SUBSYSTEM_DEFAULT_LEVEL(org_ortc_srtp, Debug); ZS_EVENTING_EXCLUSIVE(x); ZS_EVENTING_EXCLUSIVE(OrtcLibStatsReport); @@ -83,8 +88,85 @@ namespace ortc { void initSubsystems() { - ZS_GET_SUBSYSTEM_LOG_LEVEL(ZS_GET_OTHER_SUBSYSTEM(ortc, ortclib)); - ZS_GET_SUBSYSTEM_LOG_LEVEL(ZS_GET_OTHER_SUBSYSTEM(ortc, ortclib_webrtc)); + ZS_GET_SUBSYSTEM_LOG_LEVEL(ZS_GET_OTHER_SUBSYSTEM(ortc, org_ortc)); + ZS_GET_SUBSYSTEM_LOG_LEVEL(ZS_GET_OTHER_SUBSYSTEM(ortc, org_ortc_webrtc)); } } } + +ZS_DECLARE_TEAR_AWAY_IMPLEMENT(ortc::IDataChannel, ortc::internal::DataChannel::TearAwayData) +ZS_DECLARE_TEAR_AWAY_IMPLEMENT(ortc::IRTPListener, ortc::internal::RTPListener::TearAwayData) +ZS_DECLARE_TEAR_AWAY_IMPLEMENT(ortc::ISCTPTransport, ortc::internal::SCTPTransport::TearAwayData) + +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IDataChannelDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IDTLSTransportDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IDTMFSenderDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IICEGathererDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IICETransportDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IMediaDevicesDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IMediaStreamTrackDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IRTPListenerDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IRTPReceiverDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::IRTPSenderDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::ISCTPTransportDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::ISCTPTransportListenerDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::ISRTPSDESTransportDelegate) + +ZS_DECLARE_PROXY_IMPLEMENT(ortc::adapter::IPeerConnectionDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::adapter::IMediaStreamDelegate) + +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IDataChannelAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IDTLSTransportAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IGathererAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IICETransportAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::ITransportControllerAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IMediaDeviceCaptureDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IMediaDeviceRenderDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IMediaDevicesAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IMediaStreamTrackAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPDecoderDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPDecoderAysncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPEncoderAysncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPEncoderDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPListenerAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPReceiverChannelAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPSenderAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::IRTPSenderChannelAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::ISCTPTransportForDataChannelDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::ISecureTransportDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::ISRTPSDESTransportAsyncDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::ISRTPTransportDelegate) +ZS_DECLARE_PROXY_IMPLEMENT(ortc::internal::ISCTPTransportAsyncDelegate) + +ZS_DECLARE_PROXY_IMPLEMENT(ortc::adapter::internal::IPeerConnectionAsyncDelegate) + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IDTLSTransportDelegate, ortc::IDTLSTransportSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IDTMFSenderDelegate, ortc::IDTMFSenderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IDataChannelDelegate, ortc::IDataChannelSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IICEGathererDelegate, ortc::IICEGathererSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IICETransportDelegate, ortc::IICETransportSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IMediaDevicesDelegate, ortc::IMediaDevicesSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IMediaStreamTrackDelegate, ortc::IMediaStreamTrackSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IMediaElementDelegate, ortc::IMediaElementSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IMediaStreamTrackAsyncMediaDelegate, ortc::IMediaStreamTrackMediaSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IMediaStreamTrackSyncMediaDelegate, ortc::IMediaStreamTrackMediaSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IMediaStreamTrackSelectorDelegate, ortc::IMediaStreamTrackSelectorSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IRTPListenerDelegate, ortc::IRTPListenerSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IRTPReceiverDelegate, ortc::IRTPReceiverSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::IRTPSenderDelegate, ortc::IRTPSenderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::ISCTPTransportDelegate, ortc::ISCTPTransportSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::ISCTPTransportListenerDelegate, ortc::ISCTPTransportListenerSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::ISRTPSDESTransportDelegate, ortc::ISRTPSDESTransportSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::adapter::IMediaStreamDelegate, ortc::adapter::IMediaStreamSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::adapter::IPeerConnectionDelegate, ortc::adapter::IPeerConnectionSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::IMediaDeviceCaptureDelegate, ortc::internal::IMediaDeviceCaptureSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::IMediaDeviceRenderDelegate, ortc::internal::IMediaDeviceRenderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::IMediaStreamTrackRTPDelegate, ortc::internal::IMediaStreamTrackRTPSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::IMediaStreamTrackMonitorDelegate, ortc::internal::IMediaStreamTrackMonitorSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::IRTPDecoderDelegate, ortc::internal::IRTPDecoderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::IRTPEncoderDelegate, ortc::internal::IRTPEncoderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::ISRTPTransportDelegate, ortc::internal::ISRTPTransportSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::ISecureTransportDelegate, ortc::internal::ISecureTransportSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(ortc::internal::ISCTPTransportForDataChannelDelegate, ortc::internal::ISCTPTransportForDataChannelSubscription) + + diff --git a/ortc/cpp/ortc.events.json b/ortc/cpp/ortc.events.json index 429ced3a..7277e26b 100644 --- a/ortc/cpp/ortc.events.json +++ b/ortc/cpp/ortc.events.json @@ -73,14 +73,25 @@ "ortc_ICETransportController.cpp", "ortc_ORTC.cpp", "ortc_RTPListener.cpp", - "ortc_RTPMediaEngine.cpp", + "ortc_MediaEngine.cpp", + "ortc_MediaDeviceCaptureAudio.cpp", + "ortc_MediaDeviceCaptureVideo.cpp", + "ortc_MediaDeviceRenderAudio.cpp", + "ortc_MediaStreamTrack.cpp", + "ortc_MediaStreamTrackMonitor.cpp", + "ortc_RTPEncoderAudio.cpp", + "ortc_RTPEncoderVideo.cpp", + "ortc_RTPDecoderAudio.cpp", + "ortc_RTPDecoderVideo.cpp", "ortc_RTPReceiver.cpp", "ortc_RTPReceiverChannel.cpp", "ortc_RTPSender.cpp", "ortc_RTPSenderChannel.cpp", "ortc_SCTPTransport.cpp", "ortc_SCTPTransportListener.cpp", - "ortc_SRTPTransport.cpp" + "ortc_SRTPTransport.cpp", + "ortc_RTPPacket.cpp", + "ortc_RTCPPacket.cpp" ] }, "channels": { @@ -137,10 +148,19 @@ "name": "IceTransportController" }, { - "name": "RtpListener" + "name": "MediaEngine" + }, + { + "name": "MediaStreamTrackMonitor" + }, + { + "name": "RtpPacket" + }, + { + "name": "RtcpPacket" }, { - "name": "RtpMediaEngine" + "name": "RtpListener" }, { "name": "RtpReceiver", @@ -208,6 +228,15 @@ { "name": "Deliver" }, + { + "name": "Parse" + }, + { + "name": "Install" + }, + { + "name": "Remove" + }, { "name": "Event" }, diff --git a/ortc/cpp/ortc_Capabilities.cpp b/ortc/cpp/ortc_Capabilities.cpp index b1d5a83f..5e0b2a6d 100644 --- a/ortc/cpp/ortc_Capabilities.cpp +++ b/ortc/cpp/ortc_Capabilities.cpp @@ -46,7 +46,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -58,7 +58,7 @@ namespace ortc using zsLib::Log; //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::ICapabilities"); } @@ -67,15 +67,15 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityBool - #pragma mark + // + // ICapabilities::CapabilityBool + // //--------------------------------------------------------------------------- ICapabilities::CapabilityBoolean::CapabilityBoolean( ElementPtr elem, const char *objectName - ) + ) noexcept { if (!elem) return; @@ -99,7 +99,7 @@ namespace ortc ElementPtr ICapabilities::CapabilityBoolean::createElement( const char *objectName, const char *objectValueName - ) const + ) const noexcept { ElementPtr outerEl = Element::create(objectName); @@ -114,7 +114,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ICapabilities::CapabilityBoolean::toDebug() const + ElementPtr ICapabilities::CapabilityBoolean::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICapabilities::CapabilityBoolean"); @@ -128,7 +128,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String ICapabilities::CapabilityBoolean::hash() const + String ICapabilities::CapabilityBoolean::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -147,13 +147,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityLong - #pragma mark + // + // ICapabilities::CapabilityLong + // //--------------------------------------------------------------------------- - ICapabilities::CapabilityLong::CapabilityLong(ElementPtr elem) + ICapabilities::CapabilityLong::CapabilityLong(ElementPtr elem) noexcept { if (!elem) return; @@ -185,7 +185,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ICapabilities::CapabilityLong::createElement(const char *objectName) const + ElementPtr ICapabilities::CapabilityLong::createElement(const char *objectName) const noexcept { if (mMin == mMax) { return IHelper::createElementWithNumber(objectName, string(mMin)); @@ -200,7 +200,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ICapabilities::CapabilityLong::toDebug() const + ElementPtr ICapabilities::CapabilityLong::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICapabilities::CapabilityLong"); @@ -215,7 +215,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String ICapabilities::CapabilityLong::hash() const + String ICapabilities::CapabilityLong::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -232,12 +232,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityDouble - #pragma mark + // + // ICapabilities::CapabilityDouble + // //--------------------------------------------------------------------------- - ICapabilities::CapabilityDouble::CapabilityDouble(ElementPtr elem) + ICapabilities::CapabilityDouble::CapabilityDouble(ElementPtr elem) noexcept { if (!elem) return; @@ -269,7 +269,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ICapabilities::CapabilityDouble::createElement(const char *objectName) const + ElementPtr ICapabilities::CapabilityDouble::createElement(const char *objectName) const noexcept { if (mMin == mMax) { return IHelper::createElementWithNumber(objectName, string(mMin)); @@ -283,7 +283,7 @@ namespace ortc return outerEl; } //--------------------------------------------------------------------------- - ElementPtr ICapabilities::CapabilityDouble::toDebug() const + ElementPtr ICapabilities::CapabilityDouble::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICapabilities::CapabilityDouble"); @@ -298,7 +298,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String ICapabilities::CapabilityDouble::hash() const + String ICapabilities::CapabilityDouble::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -316,16 +316,16 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICapabilities::CapabilityString - #pragma mark + // + // ICapabilities::CapabilityString + // //--------------------------------------------------------------------------- ICapabilities::CapabilityString::CapabilityString( ElementPtr elem, const char *objectName - ) + ) noexcept { if (!elem) return; @@ -343,7 +343,7 @@ namespace ortc ElementPtr ICapabilities::CapabilityString::createElement( const char *objectName, const char *objectValueName - ) const + ) const noexcept { ElementPtr outerEl = Element::create(objectName); @@ -361,7 +361,7 @@ namespace ortc //--------------------------------------------------------------------------- - ElementPtr ICapabilities::CapabilityString::toDebug() const + ElementPtr ICapabilities::CapabilityString::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICapabilities::CapabilityString"); @@ -375,7 +375,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String ICapabilities::CapabilityString::hash() const + String ICapabilities::CapabilityString::hash() const noexcept { auto hasher = IHasher::sha1(); diff --git a/ortc/cpp/ortc_Certificate.cpp b/ortc/cpp/ortc_Certificate.cpp index 1d9318c4..e0037f05 100644 --- a/ortc/cpp/ortc_Certificate.cpp +++ b/ortc/cpp/ortc_Certificate.cpp @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include @@ -57,7 +57,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -99,18 +99,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::Certificate"); } //------------------------------------------------------------------------- - static String toStringAlgorithm(ElementPtr keygenAlgorithm) + static String toStringAlgorithm(ElementPtr keygenAlgorithm) noexcept { if (!keygenAlgorithm) return String(); @@ -132,7 +132,7 @@ namespace ortc } //------------------------------------------------------------------------- - static const char **getHashAlgorithms() + static const char **getHashAlgorithms() noexcept { static const char *algorithms[] = { DIGEST_SHA_256, // put default to use first @@ -147,7 +147,7 @@ namespace ortc } //------------------------------------------------------------------------- - static ElementPtr toAlgorithmElement(const char *inAlgorithmIdentifier) + static ElementPtr toAlgorithmElement(const char *inAlgorithmIdentifier) noexcept { String algorithmIdentifier(inAlgorithmIdentifier); if (!algorithmIdentifier.isEmpty()) { @@ -189,28 +189,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark CertificateSettingsDefaults - #pragma mark + // + // CertificateSettingsDefaults + // class CertificateSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~CertificateSettingsDefaults() + ~CertificateSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static CertificateSettingsDefaultsPtr singleton() + static CertificateSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static CertificateSettingsDefaultsPtr create() + static CertificateSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -218,7 +218,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + void notifySettingsApplyDefaults() noexcept override { // which algorithm to use by default ISettings::setString(ORTC_SETTING_CERTIFICATE_DEFAULT_KEY_NAME, "RSASSA-PKCS1-v1_5"); @@ -292,7 +292,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installCertificateSettingsDefaults() + void installCertificateSettingsDefaults() noexcept { CertificateSettingsDefaults::singleton(); } @@ -301,12 +301,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForSettings - #pragma mark + // + // IICETransportForSettings + // //------------------------------------------------------------------------- - ElementPtr ICertificateForDTLSTransport::toDebug(ForDTLSTransportPtr certificate) + ElementPtr ICertificateForDTLSTransport::toDebug(ForDTLSTransportPtr certificate) noexcept { if (!certificate) return ElementPtr(); return (ZS_DYNAMIC_PTR_CAST(Certificate, certificate))->toDebug(); @@ -316,15 +316,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificateForDTLSTransport - #pragma mark + // + // ICertificateForDTLSTransport + // //------------------------------------------------------------------------- SecureByteBlockPtr ICertificateForDTLSTransport::getDigest( const String &algorithm, CertificateObjectType certificate - ) + ) noexcept { return Certificate::getDigest(algorithm, certificate); } @@ -333,22 +333,22 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate - #pragma mark + // + // Certificate + // //------------------------------------------------------------------------- Certificate::Certificate( const make_private &, IMessageQueuePtr queue, ElementPtr keygenAlgorithm - ) : + ) noexcept(false) : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), mKeygenAlgorithm(keygenAlgorithm ? keygenAlgorithm->clone()->toElement() : ElementPtr()), mName(ISettings::getString(ORTC_SETTING_CERTIFICATE_DEFAULT_KEY_NAME)), - mHash(ISettings::getString(ORTC_SETTING_CERTIFICATE_DEFAULT_HASH)), mNamedCurve(ISettings::getString(ORTC_SETTING_CERTIFICATE_DEFAULT_KEY_NAMED_CURVE)), + mHash(ISettings::getString(ORTC_SETTING_CERTIFICATE_DEFAULT_HASH)), mKeyLength(ISettings::getUInt(ORTC_SETTING_CERTIFICATE_DEFAULT_KEY_LENGTH_IN_BITS)), mRandomBits(ISettings::getUInt(ORTC_SETTING_CERTIFICATE_DEFAULT_SERIAL_RANDOM_BITS)), mPublicExponentLength(ISettings::getString(ORTC_SETTING_CERTIFICATE_DEFAULT_PUBLIC_EXPONENT)), @@ -462,8 +462,7 @@ namespace ortc } } -#define TODO_SUPPORT_ELIPTICAL_CURVE 1 -#define TODO_SUPPORT_ELIPTICAL_CURVE 2 +#pragma ZS_BUILD_NOTE("TODO", "Support eliptical curve") ORTC_THROW_NOT_SUPPORTED_ERROR_IF(0 != mName.compareNoCase("RSASSA-PKCS1-v1_5")) ORTC_THROW_NOT_SUPPORTED_ERROR_IF(mNamedCurve.hasData()) // not supported at this time (sorry) @@ -502,7 +501,7 @@ namespace ortc } //------------------------------------------------------------------------- - void Certificate::init() + void Certificate::init() noexcept { AutoRecursiveLock lock(*this); @@ -515,7 +514,7 @@ namespace ortc } //------------------------------------------------------------------------- - Certificate::~Certificate() + Certificate::~Certificate() noexcept { if (isNoop()) return; @@ -527,13 +526,13 @@ namespace ortc } //------------------------------------------------------------------------- - CertificatePtr Certificate::convert(ICertificatePtr object) + CertificatePtr Certificate::convert(ICertificatePtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(Certificate, object); } //------------------------------------------------------------------------- - CertificatePtr Certificate::convert(ForDTLSTransportPtr object) + CertificatePtr Certificate::convert(ForDTLSTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(Certificate, object); } @@ -542,19 +541,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => ICertificate - #pragma mark + // + // Certificate => ICertificate + // //------------------------------------------------------------------------- - ElementPtr Certificate::toDebug(CertificatePtr certificate) + ElementPtr Certificate::toDebug(CertificatePtr certificate) noexcept { if (!certificate) return ElementPtr(); return certificate->toDebug(); } //------------------------------------------------------------------------- - ICertificateTypes::PromiseWithCertificatePtr Certificate::generateCertificate(ElementPtr keygenAlgorithm) throw (NotSupportedError) + ICertificateTypes::PromiseWithCertificatePtr Certificate::generateCertificate(ElementPtr keygenAlgorithm) noexcept(false) { CertificatePtr pThis(make_shared(make_private {}, IORTCForInternal::queueCertificateGeneration(), keygenAlgorithm)); pThis->mThisWeak = pThis; @@ -567,13 +566,13 @@ namespace ortc } //------------------------------------------------------------------------- - Time Certificate::expires() const + Time Certificate::expires() const noexcept { return mExpires; } //------------------------------------------------------------------------- - ICertificateTypes::FingerprintPtr Certificate::fingerprint() const + ICertificateTypes::FingerprintPtr Certificate::fingerprint() const noexcept { AutoRecursiveLock lock(*this); @@ -631,26 +630,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => ICertificateForDTLSTransport - #pragma mark + // + // Certificate => ICertificateForDTLSTransport + // //------------------------------------------------------------------------- - Certificate::KeyPairType Certificate::getKeyPair() const + Certificate::KeyPairType Certificate::getKeyPair() const noexcept { AutoRecursiveLock lock(*this); return mKeyPair; } //------------------------------------------------------------------------- - Certificate::CertificateObjectType Certificate::getCertificate() const + Certificate::CertificateObjectType Certificate::getCertificate() const noexcept { AutoRecursiveLock lock(*this); return mCertificate; } //------------------------------------------------------------------------- - SecureByteBlockPtr Certificate::getDigest(const String &algorithm) const + SecureByteBlockPtr Certificate::getDigest(const String &algorithm) const noexcept { return getDigest(algorithm, mCertificate); } @@ -659,7 +658,7 @@ namespace ortc SecureByteBlockPtr Certificate::getDigest( const String &algorithm, CertificateObjectType certificate - ) + ) noexcept { if (!certificate) return SecureByteBlockPtr(); @@ -674,7 +673,7 @@ namespace ortc X509_digest(certificate, md, digest, &n); - ZS_THROW_INVALID_ASSUMPTION_IF(n > sizeof(digest)) + ZS_ASSERT(n <= sizeof(digest)); SecureByteBlockPtr buffer(make_shared(n)); @@ -687,12 +686,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => IStatsProvider - #pragma mark + // + // Certificate => IStatsProvider + // //------------------------------------------------------------------------- - Certificate::PromiseWithStatsReportPtr Certificate::getStats(const StatsTypeSet &stats) const + Certificate::PromiseWithStatsReportPtr Certificate::getStats(const StatsTypeSet &stats) const noexcept { if (!stats.hasStatType(IStatsReportTypes::StatsType_Certificate)) { return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); @@ -709,9 +708,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => IWakeDelegate - #pragma mark + // + // Certificate => IWakeDelegate + // //------------------------------------------------------------------------- void Certificate::onWake() @@ -799,12 +798,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => (internal) - #pragma mark + // + // Certificate => (internal) + // //------------------------------------------------------------------------- - Log::Params Certificate::log(const char *message) const + Log::Params Certificate::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::Certificate"); IHelper::debugAppend(objectEl, "id", mID); @@ -812,13 +811,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params Certificate::debug(const char *message) const + Log::Params Certificate::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr Certificate::toDebug() const + ElementPtr Certificate::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -845,7 +844,7 @@ namespace ortc } //------------------------------------------------------------------------- - void Certificate::cancel() + void Certificate::cancel() noexcept { //....................................................................... // final cleanup @@ -869,7 +868,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool Certificate::resolveStatPromises() + bool Certificate::resolveStatPromises() noexcept { PromiseWithStatsReportPtr promise; @@ -877,12 +876,11 @@ namespace ortc AutoRecursiveLock lock(*this); if (mPendingStats.size() < 1) return false; - PromiseWithStatsReportPtr promise = mPendingStats.front(); + promise = mPendingStats.front(); mPendingStats.pop_front(); } -#define TODO_DEFINE_STATS 1 -#define TODO_DEFINE_STATS 2 +#pragma ZS_BUILD_NOTE("TODO","Define stats") // no stats at this time promise->reject(); @@ -890,7 +888,7 @@ namespace ortc } //------------------------------------------------------------------------- - evp_pkey_st* Certificate::MakeKey() + evp_pkey_st* Certificate::MakeKey() noexcept { ZS_LOG_DEBUG(log("Making key pair")) // RSA_generate_key is deprecated. Use _ex version. @@ -909,7 +907,7 @@ namespace ortc ZS_LOG_ERROR(Detail, log("failed to convert to BN") + ZS_PARAM("input", finalInBase10)) return NULL; } - ZS_THROW_INVALID_ASSUMPTION_IF(NULL == exponent) + ZS_ASSERT(NULL != exponent); } else { exponent = BN_new(); } @@ -934,7 +932,7 @@ namespace ortc //------------------------------------------------------------------------- // Generate a self-signed certificate, with the public key from the // given key pair. Caller is responsible for freeing the returned object. - X509* Certificate::MakeCertificate(EVP_PKEY* pkey) + X509* Certificate::MakeCertificate(EVP_PKEY* pkey) noexcept { ZS_LOG_DEBUG(log("Making certificate")) X509* x509 = NULL; @@ -999,12 +997,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate::Digest - #pragma mark + // + // Certificate::Digest + // //------------------------------------------------------------------------- - Certificate::Digest::Digest(const String &algorithm) { + Certificate::Digest::Digest(const String &algorithm) noexcept { EVP_MD_CTX_init(&ctx_); if (GetDigestEVP(algorithm, &md_)) { EVP_DigestInit_ex(&ctx_, md_, NULL); @@ -1014,12 +1012,12 @@ namespace ortc } //------------------------------------------------------------------------- - Certificate::Digest::~Digest() { + Certificate::Digest::~Digest() noexcept { EVP_MD_CTX_cleanup(&ctx_); } //------------------------------------------------------------------------- - size_t Certificate::Digest::Size() const { + size_t Certificate::Digest::Size() const noexcept { if (!md_) { return 0; } @@ -1027,7 +1025,7 @@ namespace ortc } //------------------------------------------------------------------------- - void Certificate::Digest::Update(const void* buf, size_t len) { + void Certificate::Digest::Update(const void* buf, size_t len) noexcept { if (!md_) { return; } @@ -1035,14 +1033,14 @@ namespace ortc } //------------------------------------------------------------------------- - size_t Certificate::Digest::Finish(void* buf, size_t len) { + size_t Certificate::Digest::Finish(void* buf, size_t len) noexcept { if (!md_ || len < Size()) { return 0; } unsigned int md_len; EVP_DigestFinal_ex(&ctx_, static_cast(buf), &md_len); EVP_DigestInit_ex(&ctx_, md_, NULL); // prepare for future Update()s - ZS_THROW_INVALID_ASSUMPTION_IF(md_len != Size()) + ZS_ASSERT(md_len == Size()); return md_len; } @@ -1050,7 +1048,7 @@ namespace ortc bool Certificate::Digest::GetDigestEVP( const String &algorithm, const EVP_MD** mdp - ) { + ) noexcept { const EVP_MD* md; if (algorithm == DIGEST_MD5) { md = EVP_md5(); @@ -1069,7 +1067,7 @@ namespace ortc } // Can't happen - ZS_THROW_INVALID_ASSUMPTION_IF(EVP_MD_size(md) < 16) + ZS_ASSERT(EVP_MD_size(md) >= 16); *mdp = md; return true; } @@ -1078,9 +1076,10 @@ namespace ortc bool Certificate::Digest::GetDigestName( const EVP_MD* md, String* algorithm - ) { - ZS_THROW_INVALID_ARGUMENT_IF(NULL == md); - ZS_THROW_INVALID_ARGUMENT_IF(NULL == algorithm); + ) noexcept + { + ZS_ASSERT(NULL != md); + ZS_ASSERT(NULL != algorithm); int md_type = EVP_MD_type(md); if (md_type == NID_md5) { @@ -1107,7 +1106,7 @@ namespace ortc bool Certificate::Digest::GetDigestSize( const String &algorithm, size_t* length - ) + ) noexcept { const EVP_MD *md; if (!GetDigestEVP(algorithm, &md)) @@ -1121,18 +1120,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificateFactory - #pragma mark + // + // ICertificateFactory + // //------------------------------------------------------------------------- - ICertificateFactory &ICertificateFactory::singleton() + ICertificateFactory &ICertificateFactory::singleton() noexcept { return CertificateFactory::singleton(); } //------------------------------------------------------------------------- - ICertificateFactory::PromiseWithCertificatePtr ICertificateFactory::generateCertificate(ElementPtr keygenAlgorithm) throw (NotSupportedError) + ICertificateFactory::PromiseWithCertificatePtr ICertificateFactory::generateCertificate(ElementPtr keygenAlgorithm) noexcept(false) { if (this) {} return internal::Certificate::generateCertificate(keygenAlgorithm); @@ -1144,20 +1143,20 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificateTypes - #pragma mark + // + // ICertificateTypes + // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificateTypes::Fingerprint - #pragma mark + // + // ICertificateTypes::Fingerprint + // //--------------------------------------------------------------------------- - ICertificateTypes::Fingerprint::Fingerprint(ElementPtr elem) + ICertificateTypes::Fingerprint::Fingerprint(ElementPtr elem) noexcept { if (!elem) return; @@ -1166,7 +1165,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ICertificateTypes::Fingerprint::createElement(const char *objectName) const + ElementPtr ICertificateTypes::Fingerprint::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1178,7 +1177,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ICertificateTypes::Fingerprint::toDebug() const + ElementPtr ICertificateTypes::Fingerprint::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICertificateTypes::Fingerprint"); @@ -1189,7 +1188,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String ICertificateTypes::Fingerprint::hash() const + String ICertificateTypes::Fingerprint::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1205,30 +1204,30 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificate - #pragma mark + // + // ICertificate + // //--------------------------------------------------------------------------- - ElementPtr ICertificate::toDebug(ICertificatePtr transport) + ElementPtr ICertificate::toDebug(ICertificatePtr transport) noexcept { return internal::Certificate::toDebug(internal::Certificate::convert(transport)); } //--------------------------------------------------------------------------- - ICertificatePtr ICertificate::convert(AnyPtr any) + ICertificatePtr ICertificate::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(ICertificate, any); } //--------------------------------------------------------------------------- - ICertificateTypes::PromiseWithCertificatePtr ICertificate::generateCertificate(ElementPtr algorithm) throw (NotSupportedError) + ICertificateTypes::PromiseWithCertificatePtr ICertificate::generateCertificate(ElementPtr algorithm) noexcept(false) { return internal::ICertificateFactory::singleton().generateCertificate(algorithm); } //--------------------------------------------------------------------------- - ICertificateTypes::PromiseWithCertificatePtr ICertificate::generateCertificate(const char *algorithmIdentifier) throw (NotSupportedError) + ICertificateTypes::PromiseWithCertificatePtr ICertificate::generateCertificate(const char *algorithmIdentifier) noexcept(false) { ElementPtr algorithmObjectEl = internal::toAlgorithmElement(algorithmIdentifier); ORTC_THROW_NOT_SUPPORTED_ERROR_IF(!((bool)algorithmObjectEl)) diff --git a/ortc/cpp/ortc_Constraints.cpp b/ortc/cpp/ortc_Constraints.cpp index 5b529de1..66537680 100644 --- a/ortc/cpp/ortc_Constraints.cpp +++ b/ortc/cpp/ortc_Constraints.cpp @@ -48,7 +48,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -63,13 +63,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints - #pragma mark + // + // IConstraints + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IConstraints"); } @@ -78,13 +78,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainBooleanParameters - #pragma mark + // + // IConstraints::ConstrainBooleanParameters + // //--------------------------------------------------------------------------- - IConstraints::ConstrainBooleanParameters::ConstrainBooleanParameters(ElementPtr elem) + IConstraints::ConstrainBooleanParameters::ConstrainBooleanParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -93,7 +93,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainBooleanParameters::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainBooleanParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -105,7 +105,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainBooleanParameters::toDebug() const + ElementPtr IConstraints::ConstrainBooleanParameters::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainBooleanParameters"); @@ -116,7 +116,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainBooleanParameters::hash() const + String IConstraints::ConstrainBooleanParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -134,12 +134,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainBool - #pragma mark + // + // IConstraints::ConstrainBool + // //--------------------------------------------------------------------------- - IConstraints::ConstrainBoolean::ConstrainBoolean(ElementPtr elem) + IConstraints::ConstrainBoolean::ConstrainBoolean(ElementPtr elem) noexcept { if (!elem) return; @@ -162,7 +162,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainBoolean::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainBoolean::createElement(const char *objectName) const noexcept { if (mParameters.hasValue()) { return mParameters.value().createElement(objectName); @@ -173,7 +173,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainBoolean::toDebug() const + ElementPtr IConstraints::ConstrainBoolean::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainBoolean"); @@ -184,7 +184,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainBoolean::hash() const + String IConstraints::ConstrainBoolean::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -203,12 +203,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainLongRange - #pragma mark + // + // IConstraints::ConstrainLongRange + // //--------------------------------------------------------------------------- - IConstraints::ConstrainLongRange::ConstrainLongRange(ElementPtr elem) + IConstraints::ConstrainLongRange::ConstrainLongRange(ElementPtr elem) noexcept { if (!elem) return; @@ -219,7 +219,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainLongRange::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainLongRange::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -233,7 +233,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainLongRange::toDebug() const + ElementPtr IConstraints::ConstrainLongRange::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainLongRange"); @@ -246,7 +246,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainLongRange::hash() const + String IConstraints::ConstrainLongRange::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -268,12 +268,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainLong - #pragma mark + // + // IConstraints::ConstrainLong + // //--------------------------------------------------------------------------- - IConstraints::ConstrainLong::ConstrainLong(ElementPtr elem) + IConstraints::ConstrainLong::ConstrainLong(ElementPtr elem) noexcept { if (!elem) return; @@ -296,7 +296,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainLong::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainLong::createElement(const char *objectName) const noexcept { if (mRange.hasValue()) { return mRange.value().createElement(objectName); @@ -307,7 +307,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainLong::toDebug() const + ElementPtr IConstraints::ConstrainLong::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainLong"); @@ -318,7 +318,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainLong::hash() const + String IConstraints::ConstrainLong::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -337,13 +337,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainDoubleRange - #pragma mark + // + // IConstraints::ConstrainDoubleRange + // //--------------------------------------------------------------------------- - IConstraints::ConstrainDoubleRange::ConstrainDoubleRange(ElementPtr elem) + IConstraints::ConstrainDoubleRange::ConstrainDoubleRange(ElementPtr elem) noexcept { if (!elem) return; @@ -354,7 +354,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainDoubleRange::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainDoubleRange::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -368,7 +368,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainDoubleRange::toDebug() const + ElementPtr IConstraints::ConstrainDoubleRange::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainDoubleRange"); @@ -381,7 +381,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainDoubleRange::hash() const + String IConstraints::ConstrainDoubleRange::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -403,12 +403,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainDouble - #pragma mark + // + // IConstraints::ConstrainDouble + // //--------------------------------------------------------------------------- - IConstraints::ConstrainDouble::ConstrainDouble(ElementPtr elem) + IConstraints::ConstrainDouble::ConstrainDouble(ElementPtr elem) noexcept { if (!elem) return; @@ -431,7 +431,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainDouble::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainDouble::createElement(const char *objectName) const noexcept { if (mRange.hasValue()) { return mRange.value().createElement(objectName); @@ -442,7 +442,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainDouble::toDebug() const + ElementPtr IConstraints::ConstrainDouble::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainDouble"); @@ -453,7 +453,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainDouble::hash() const + String IConstraints::ConstrainDouble::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -471,15 +471,15 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::StringOrStringList - #pragma mark + // + // IConstraints::StringOrStringList + // //--------------------------------------------------------------------------- IConstraints::StringOrStringList::StringOrStringList( ElementPtr elem, const char *objectValueName - ) + ) noexcept { if (!elem) return; @@ -514,7 +514,7 @@ namespace ortc ElementPtr IConstraints::StringOrStringList::createElement( const char *objectName, const char *objectValueName - ) const + ) const noexcept { if (mValues.hasValue()) { ElementPtr outerEl = Element::create(objectName); @@ -533,7 +533,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::StringOrStringList::toDebug() const + ElementPtr IConstraints::StringOrStringList::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::StringOrStringList"); @@ -552,7 +552,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::StringOrStringList::hash() const + String IConstraints::StringOrStringList::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -577,12 +577,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstrainStringParameters - #pragma mark + // + // IConstraints::ConstrainStringParameters + // //--------------------------------------------------------------------------- - IConstraints::ConstrainStringParameters::ConstrainStringParameters(ElementPtr elem) + IConstraints::ConstrainStringParameters::ConstrainStringParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -598,7 +598,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainStringParameters::createElement(const char *objectName) const + ElementPtr IConstraints::ConstrainStringParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -613,7 +613,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainStringParameters::toDebug() const + ElementPtr IConstraints::ConstrainStringParameters::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstrainStringParameters"); @@ -624,7 +624,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainStringParameters::hash() const + String IConstraints::ConstrainStringParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -642,15 +642,15 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IConstraints::ConstraintString - #pragma mark + // + // IConstraints::ConstraintString + // //--------------------------------------------------------------------------- IConstraints::ConstrainString::ConstrainString( ElementPtr elem, const char *objectValueName - ) + ) noexcept { if (!elem) return; @@ -673,7 +673,7 @@ namespace ortc ElementPtr IConstraints::ConstrainString::createElement( const char *objectName, const char *objectValueName - ) const + ) const noexcept { ElementPtr elem = Element::create(objectName); @@ -686,7 +686,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IConstraints::ConstrainString::toDebug() const + ElementPtr IConstraints::ConstrainString::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IConstraints::ConstraintString"); @@ -697,7 +697,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IConstraints::ConstrainString::hash() const + String IConstraints::ConstrainString::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -710,4 +710,44 @@ namespace ortc return hasher->finalizeAsString(); } + //--------------------------------------------------------------------------- + void IConstraints::ConstrainString::exact(StringList &values) const noexcept + { + if (mValue.hasValue()) { + if (mValue.value().mValue.hasValue()) { + values.push_back(mValue.value().mValue.value()); + return; + } + if (mValue.value().mValues.hasValue()) { + auto &source = mValue.value().mValues.value(); + values.insert(values.end(), source.begin(), source.end()); + return; + } + } + + if (!mParameters.hasValue()) return; + if (!mParameters.value().mExact.hasValue()) return; + if (mParameters.value().mExact.value().mValue.hasValue()) { + values.push_back(mValue.value().mValue.value()); + return; + } + if (!mParameters.value().mExact.value().mValues.hasValue()) return; + auto &source = mParameters.value().mExact.value().mValues.value(); + values.insert(values.end(), source.begin(), source.end()); + } + + //--------------------------------------------------------------------------- + void IConstraints::ConstrainString::ideal(StringList &values) const noexcept + { + if (!mParameters.hasValue()) return; + if (!mParameters.value().mIdeal.hasValue()) return; + if (mParameters.value().mIdeal.value().mValue.hasValue()) { + values.push_back(mValue.value().mValue.value()); + return; + } + if (!mParameters.value().mIdeal.value().mValues.hasValue()) return; + auto &source = mParameters.value().mIdeal.value().mValues.value(); + values.insert(values.end(), source.begin(), source.end()); + } + } diff --git a/ortc/cpp/ortc_DTLSTransport.cpp b/ortc/cpp/ortc_DTLSTransport.cpp index 19fe8a78..8eba23a2 100644 --- a/ortc/cpp/ortc_DTLSTransport.cpp +++ b/ortc/cpp/ortc_DTLSTransport.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -66,13 +68,7 @@ //#include //#include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_dtlstransport) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_dtls_transport) } namespace ortc { @@ -97,9 +93,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // const int SRTP_MASTER_KEY_KEY_LEN = 16; const int SRTP_MASTER_KEY_SALT_LEN = 14; @@ -114,7 +110,7 @@ namespace ortc // Maximum number of pending packets in the queue. Packets are read immediately // after they have been written, so a capacity of "1" is sufficient. - static const size_t kMaxPendingPackets = 1; + //static const size_t kMaxPendingPackets = 1; static bool isDtlsPacket(const BYTE *data, size_t len) { return (len >= kDtlsRecordHeaderLen && (data[0] > 19 && data[0] < 64)); @@ -273,9 +269,9 @@ namespace ortc } //------------------------------------------------------------------------- - static long stream_ctrl(BIO* b, int cmd, long num, void* ptr) { - //RTC_UNUSED(num); - // RTC_UNUSED(ptr); + static long stream_ctrl(BIO* b, int cmd, long num, ZS_MAYBE_USED() void* ptr) { + ZS_MAYBE_USED(num); + ZS_MAYBE_USED(ptr); switch (cmd) { case BIO_CTRL_RESET: @@ -303,28 +299,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransportSettingsDefaults - #pragma mark + // + // DTLSTransportSettingsDefaults + // class DTLSTransportSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~DTLSTransportSettingsDefaults() + ~DTLSTransportSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static DTLSTransportSettingsDefaultsPtr singleton() + static DTLSTransportSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static DTLSTransportSettingsDefaultsPtr create() + static DTLSTransportSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -332,7 +328,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { ISettings::setUInt(ORTC_SETTING_DTLS_TRANSPORT_MAX_PENDING_DTLS_BUFFER, kMaxDtlsPacketLen * 12); @@ -344,7 +340,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installDTLSTransportSettingsDefaults() + void installDTLSTransportSettingsDefaults() noexcept { DTLSTransportSettingsDefaults::singleton(); } @@ -354,18 +350,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IStatsProvider - #pragma mark + // + // DTLSTransport => IStatsProvider + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr DTLSTransport::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr DTLSTransport::getStats(const StatsTypeSet &stats) const noexcept { if (!stats.hasStatType(IStatsReportTypes::StatsType_DTLSTransport)) { return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } -#define TODO_COMPLETE 1 -#define TODO_COMPLETE 2 +#pragma ZS_BUILD_NOTE("TODO", "DTLS needs stats.") return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } @@ -373,9 +368,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport - #pragma mark + // + // DTLSTransport + // //------------------------------------------------------------------------- DTLSTransport::DTLSTransport( @@ -384,10 +379,12 @@ namespace ortc IDTLSTransportDelegatePtr originalDelegate, IICETransportPtr iceTransport, const CertificateList &certificates - ) : + ) noexcept(false) : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mICETransport(ICETransport::convert(iceTransport)), + mSecureTransportSubscriptions(decltype(mSecureTransportSubscriptions)::create()), mComponent(mICETransport->component()), mMaxPendingDTLSBuffer(ISettings::getUInt(ORTC_SETTING_DTLS_TRANSPORT_MAX_PENDING_DTLS_BUFFER)), mMaxPendingRTPPackets(ISettings::getUInt(ORTC_SETTING_DTLS_TRANSPORT_MAX_PENDING_RTP_PACKETS)), @@ -422,7 +419,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::init() + void DTLSTransport::init() noexcept { UseICETransportPtr transport; @@ -437,10 +434,10 @@ namespace ortc } case IICETypes::Component_RTCP: { UseICETransportPtr rtpIceTransport = mICETransport->getRTPTransport(); - ORTC_THROW_INVALID_STATE_IF(!rtpIceTransport) + ZS_ASSERT(rtpIceTransport); auto useSecureTransport = DTLSTransport::convert(rtpIceTransport->getSecureTransport()); - ORTC_THROW_INVALID_STATE_IF(!useSecureTransport) + ZS_ASSERT(useSecureTransport); mRTPListener = useSecureTransport->getListener(); break; @@ -506,7 +503,7 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransport::~DTLSTransport() + DTLSTransport::~DTLSTransport() noexcept { if (isNoop()) return; @@ -518,43 +515,43 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(IDTLSTransportPtr object) + DTLSTransportPtr DTLSTransport::convert(IDTLSTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(ForDataTransportPtr object) + DTLSTransportPtr DTLSTransport::convert(ForDataTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(ForRTPSenderPtr object) + DTLSTransportPtr DTLSTransport::convert(ForRTPSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(ForRTPReceiverPtr object) + DTLSTransportPtr DTLSTransport::convert(ForRTPReceiverPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(ForICETransportPtr object) + DTLSTransportPtr DTLSTransport::convert(ForICETransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(ForSRTPPtr object) + DTLSTransportPtr DTLSTransport::convert(ForSRTPPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(ForRTPListenerPtr object) + DTLSTransportPtr DTLSTransport::convert(ForRTPListenerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransport, object); } @@ -563,12 +560,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IDTLSTransport - #pragma mark + // + // DTLSTransport => IDTLSTransport + // //------------------------------------------------------------------------- - ElementPtr DTLSTransport::toDebug(DTLSTransportPtr transport) + ElementPtr DTLSTransport::toDebug(DTLSTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -579,7 +576,7 @@ namespace ortc IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificates - ) + ) noexcept { DTLSTransportPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, iceTransport, certificates)); pThis->mThisWeak = pThis; @@ -588,7 +585,7 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(IRTPTransportPtr rtpTransport) + DTLSTransportPtr DTLSTransport::convert(IRTPTransportPtr rtpTransport) noexcept { auto transport = ZS_DYNAMIC_PTR_CAST(DTLSTransport, rtpTransport); if (!transport) return transport; @@ -602,7 +599,7 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransportPtr DTLSTransport::convert(IRTCPTransportPtr rtcpTransport) + DTLSTransportPtr DTLSTransport::convert(IRTCPTransportPtr rtcpTransport) noexcept { auto transport = ZS_DYNAMIC_PTR_CAST(DTLSTransport, rtcpTransport); if (!transport) return transport; @@ -616,7 +613,7 @@ namespace ortc } //------------------------------------------------------------------------- - IDTLSTransportSubscriptionPtr DTLSTransport::subscribe(IDTLSTransportDelegatePtr originalDelegate) + IDTLSTransportSubscriptionPtr DTLSTransport::subscribe(IDTLSTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -643,7 +640,7 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransport::CertificateListPtr DTLSTransport::certificates() const + DTLSTransport::CertificateListPtr DTLSTransport::certificates() const noexcept { AutoRecursiveLock lock(*this); CertificateListPtr result(make_shared()); @@ -658,21 +655,21 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportPtr DTLSTransport::transport() const + IICETransportPtr DTLSTransport::transport() const noexcept { AutoRecursiveLock lock(*this); return ICETransport::convert(mICETransport); } //------------------------------------------------------------------------- - IDTLSTransportTypes::States DTLSTransport::state() const + IDTLSTransportTypes::States DTLSTransport::state() const noexcept { AutoRecursiveLock lock(*this); return mCurrentState; } //------------------------------------------------------------------------- - IDTLSTransportTypes::ParametersPtr DTLSTransport::getLocalParameters() const + IDTLSTransportTypes::ParametersPtr DTLSTransport::getLocalParameters() const noexcept { AutoRecursiveLock lock(*this); @@ -681,7 +678,7 @@ namespace ortc } //------------------------------------------------------------------------- - IDTLSTransportTypes::ParametersPtr DTLSTransport::getRemoteParameters() const + IDTLSTransportTypes::ParametersPtr DTLSTransport::getRemoteParameters() const noexcept { AutoRecursiveLock lock(*this); @@ -690,19 +687,15 @@ namespace ortc } //------------------------------------------------------------------------- - IDTLSTransportTypes::SecureByteBlockListPtr DTLSTransport::getRemoteCertificates() const + IDTLSTransportTypes::SecureByteBlockListPtr DTLSTransport::getRemoteCertificates() const noexcept { AutoRecursiveLock lock(*this); -#define TODO_COMPLETE_ONCE_ORTC_SPEC_DEFINES_THIS_PROPERLY 1 -#define TODO_COMPLETE_ONCE_ORTC_SPEC_DEFINES_THIS_PROPERLY 2 +#pragma ZS_BUILD_NOTE("TODO", "Complete once ORTC spec defines this properly") return SecureByteBlockListPtr(); } //------------------------------------------------------------------------- - void DTLSTransport::start(const Parameters &remoteParameters) throw ( - InvalidStateError, - InvalidParameters - ) + void DTLSTransport::start(const Parameters &remoteParameters) noexcept(false) { ZS_EVENTING_3( x, i, Detail, DtlsTransportStart, ol, DtlsTransport, Start, @@ -715,8 +708,7 @@ namespace ortc if ((isShuttingDown()) || (isShutdown())) { -#define WARNING_WHAT_IF_DTLS_ERROR_CAUSED_CLOSE 1 -#define WARNING_WHAT_IF_DTLS_ERROR_CAUSED_CLOSE 2 +#pragma ZS_BUILD_NOTE("CAUTION", "ORTC specification does not clarify what to do if the DTLS transport causes the closure instead of manual programmer closure") ORTC_THROW_INVALID_STATE("already shutting down") } @@ -729,7 +721,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::stop() + void DTLSTransport::stop() noexcept { ZS_EVENTING_1(x, i, Detail, DtlsTransportStop, ol, DtlsTransport, Stop, puid, id, mID); ZS_LOG_DEBUG(log("stop called")) @@ -742,17 +734,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransport - #pragma mark + // + // DTLSTransport => ISecureTransport + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPSender - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPSender + // //------------------------------------------------------------------------- bool DTLSTransport::sendPacket( @@ -760,7 +752,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_EVENTING_5( x, i, Trace, DtlsTransportSendRtpPacket, ol, DtlsTransport, Send, @@ -803,7 +795,7 @@ namespace ortc //------------------------------------------------------------------------- - IICETransportPtr DTLSTransport::getICETransport() const + IICETransportPtr DTLSTransport::getICETransport() const noexcept { AutoRecursiveLock lock(*this); return ICETransport::convert(mICETransport); @@ -813,16 +805,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForICETransport - #pragma mark + // + // DTLSTransport => ISecureTransportForICETransport + // //------------------------------------------------------------------------- void DTLSTransport::notifyAssociateTransportCreated( - IICETypes::Components associatedComponent, - ICETransportPtr assoicated - ) + ZS_MAYBE_USED() IICETypes::Components associatedComponent, + ZS_MAYBE_USED() ICETransportPtr assoicated + ) noexcept { + ZS_MAYBE_USED(associatedComponent); + ZS_MAYBE_USED(assoicated); // ignored since RTP vs RTCP are treated as independent transports } @@ -831,7 +825,7 @@ namespace ortc IICETypes::Components viaTransport, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { bool isDTLSPacket = isDtlsPacket(buffer, bufferLengthInBytes); @@ -852,7 +846,7 @@ namespace ortc PacketQueue decryptedPackets; UseSRTPTransportPtr srtpTransport; - ASSERT(viaTransport == component()); // must be identical + ZS_ASSERT(viaTransport == component()); // must be identical // scope: pre-validation check { @@ -870,7 +864,7 @@ namespace ortc } } - ZS_THROW_BAD_STATE_IF(!mAdapter) + ZS_ASSERT(mAdapter); if (isDTLSPacket) { // Sanity check we're not passing junk that @@ -956,8 +950,7 @@ namespace ortc // WARNING: Forward packet to data channel or RTP listener outside of object lock handle_rtp: { -#define WARNING_HANDLE_SRTP_KEY_LIFETIME_EXHAUSTION 1 -#define WARNING_HANDLE_SRTP_KEY_LIFETIME_EXHAUSTION 2 +#pragma ZS_BUILD_NOTE("CAUTION", "Key exhaustion is possible in SRTP with a very long call but WebRTC does not define how to refresh keys.") ZS_EVENTING_5( x, i, Trace, DtlsTransportForwardingEncryptedPacketToSrtpTransport, ol, DtlsTransport, Deliver, @@ -1016,22 +1009,21 @@ namespace ortc return returnResult; } - ASSERT(false); // cannot reach this point - return false; } //------------------------------------------------------------------------- void DTLSTransport::handleReceivedSTUNPacket( IICETypes::Components viaComponent, STUNPacketPtr packet - ) + ) noexcept { ZS_EVENTING_2( x, i, Trace, DtlsTransportReceivedStunPacket, ol, DtlsTransport, Receive, puid, id, mID, enum, viaComponent, zsLib::to_underlying(viaComponent) ); - packet->trace(__func__); + + ZS_EVENTING_TRACE_OBJECT(Trace, *packet, "dtls received stun packet"); ZS_LOG_TRACE(log("handle receive STUN packet") + packet->toDebug()) @@ -1046,9 +1038,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForSRTPTransport - #pragma mark + // + // DTLSTransport => ISecureTransportForSRTPTransport + // //------------------------------------------------------------------------- bool DTLSTransport::sendEncryptedPacket( @@ -1056,7 +1048,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { UseICETransportPtr transport; @@ -1075,7 +1067,7 @@ namespace ortc return false; } - ASSERT(sendOverICETransport == transport->component()) + ZS_ASSERT(sendOverICETransport == transport->component()) } ZS_EVENTING_6( @@ -1097,7 +1089,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { { AutoRecursiveLock lock(*this); @@ -1128,12 +1120,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForSRTPTransport - #pragma mark + // + // DTLSTransport => ISecureTransportForSRTPTransport + // //------------------------------------------------------------------------- - RTPListenerPtr DTLSTransport::getListener() const + RTPListenerPtr DTLSTransport::getListener() const noexcept { return RTPListener::convert(mRTPListener); } @@ -1142,12 +1134,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForDataTransport - #pragma mark + // + // DTLSTransport => ISecureTransportForDataTransport + // //------------------------------------------------------------------------- - ISecureTransportSubscriptionPtr DTLSTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) + ISecureTransportSubscriptionPtr DTLSTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to secure transport state")) @@ -1173,13 +1165,14 @@ namespace ortc } //------------------------------------------------------------------------- - ISecureTransportTypes::States DTLSTransport::state(ISecureTransportTypes::States ignored) const + ISecureTransportTypes::States DTLSTransport::state(ZS_MAYBE_USED() ISecureTransportTypes::States ignored) const noexcept { + ZS_MAYBE_USED(ignored); return mSecureTransportState; // no lock needed } //------------------------------------------------------------------------- - bool DTLSTransport::isClientRole() const + bool DTLSTransport::isClientRole() const noexcept { AutoRecursiveLock lock(*this); @@ -1195,7 +1188,7 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransport::UseDataTransportPtr DTLSTransport::getDataTransport() const + DTLSTransport::UseDataTransportPtr DTLSTransport::getDataTransport() const noexcept { return mDataTransport; } @@ -1204,7 +1197,7 @@ namespace ortc bool DTLSTransport::sendDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_EVENTING_3( x, i, Trace, DtlsTransportSendDataPacket, ol, DtlsTransport, Send, @@ -1233,7 +1226,7 @@ namespace ortc return false; } - ZS_THROW_BAD_STATE_IF(!mAdapter) + ZS_ASSERT(mAdapter); size_t written {}; int error {}; @@ -1275,9 +1268,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IWakeDelegate - #pragma mark + // + // DTLSTransport => IWakeDelegate + // //------------------------------------------------------------------------- void DTLSTransport::onWake() @@ -1292,9 +1285,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ITimerDelegate - #pragma mark + // + // DTLSTransport => ITimerDelegate + // //------------------------------------------------------------------------- void DTLSTransport::onTimer(ITimerPtr timer) @@ -1316,9 +1309,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IDTLSTransportAsyncDelegate - #pragma mark + // + // DTLSTransport => IDTLSTransportAsyncDelegate + // //------------------------------------------------------------------------- void DTLSTransport::onAdapterSendPacket() @@ -1475,9 +1468,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IICETransportDelegate - #pragma mark + // + // DTLSTransport => IICETransportDelegate + // //------------------------------------------------------------------------- void DTLSTransport::onICETransportStateChange( @@ -1528,9 +1521,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IICETransportDelegate - #pragma mark + // + // DTLSTransport => IICETransportDelegate + // //------------------------------------------------------------------------- void DTLSTransport::onSRTPTransportLifetimeRemaining( @@ -1546,17 +1539,16 @@ namespace ortc ulong, leastLifetimeRemainingPercentageForAllKeys, leastLifetimeRemainingPercentageForAllKeys, ulong, overallLifetimeRemainingPercentage, overallLifetimeRemainingPercentage ); -#define TODO_IN_FUTURE_WHEN_PERCENT_REMAINING_GETS_TOO_LOW_AS_A_CLIENT_RENEGOTIATE_A_NEW_SRTP_KEY 1 -#define TODO_IN_FUTURE_WHEN_PERCENT_REMAINING_GETS_TOO_LOW_AS_A_CLIENT_RENEGOTIATE_A_NEW_SRTP_KEY 2 +#pragma ZS_BUILD_NOTE("TODO","When WebRTC defines how to handle SRTP keying running low do something about it.") } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => friend BIO_ - #pragma mark + // + // DTLSTransport => friend BIO_ + // //------------------------------------------------------------------------- StreamResult DTLSTransport::bioRead( @@ -1564,7 +1556,7 @@ namespace ortc size_t data_len, size_t* read, int* error - ) + ) noexcept { if (NULL != read) *read = 0; @@ -1583,7 +1575,7 @@ namespace ortc size_t data_len, size_t* written, int* error - ) + ) noexcept { if (NULL != written) *written = 0; @@ -1600,15 +1592,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => friend DTLSTransport::Adapter - #pragma mark + // + // DTLSTransport => friend DTLSTransport::Adapter + // //------------------------------------------------------------------------- void DTLSTransport::adapterSendPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_LOG_TRACE(log("adding dtls packet to send to outgoing queue") + ZS_PARAM("buffer length", bufferLengthInBytes)) mPendingOutgoingDTLS.push(make_shared(buffer, bufferLengthInBytes)); @@ -1617,7 +1609,7 @@ namespace ortc } //------------------------------------------------------------------------- - size_t DTLSTransport::adapterReadPacket(BYTE *buffer, size_t bufferLengthInBytes) + size_t DTLSTransport::adapterReadPacket(BYTE *buffer, size_t bufferLengthInBytes) noexcept { size_t currentSize = SafeInt(mPendingIncomingDTLS.CurrentSize()); if (currentSize < 1) return 0; @@ -1630,7 +1622,7 @@ namespace ortc } //------------------------------------------------------------------------- - ITimerPtr DTLSTransport::adapterCreateTimeout(Milliseconds timeout) + ITimerPtr DTLSTransport::adapterCreateTimeout(Milliseconds timeout) noexcept { return ITimer::create(mThisWeak.lock(), zsLib::now() + timeout); } @@ -1639,12 +1631,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => (internal) - #pragma mark + // + // DTLSTransport => (internal) + // //------------------------------------------------------------------------- - Log::Params DTLSTransport::log(const char *message) const + Log::Params DTLSTransport::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::DTLSTransport"); IHelper::debugAppend(objectEl, "id", mID); @@ -1652,13 +1644,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params DTLSTransport::debug(const char *message) const + Log::Params DTLSTransport::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr DTLSTransport::toDebug() const + ElementPtr DTLSTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1707,19 +1699,19 @@ namespace ortc } //------------------------------------------------------------------------- - IICETypes::Components DTLSTransport::component() const + IICETypes::Components DTLSTransport::component() const noexcept { return mComponent; } //------------------------------------------------------------------------- - bool DTLSTransport::isShuttingDown() const + bool DTLSTransport::isShuttingDown() const noexcept { return (bool)mGracefulShutdownReference; } //------------------------------------------------------------------------- - bool DTLSTransport::isShutdown() const + bool DTLSTransport::isShutdown() const noexcept { if (mGracefulShutdownReference) return false; return ((IDTLSTransportTypes::State_Closed == mCurrentState) || @@ -1727,7 +1719,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::step() + void DTLSTransport::step() noexcept { ZS_LOG_DEBUG(debug("step")) @@ -1762,7 +1754,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::stepStartSSL() + bool DTLSTransport::stepStartSSL() noexcept { ZS_EVENTING_1(x, i, Debug, DtlsTransportStep, ol, DtlsTransport, Step, puid, id, mID); @@ -1854,7 +1846,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::stepValidate() + bool DTLSTransport::stepValidate() noexcept { ZS_EVENTING_1(x, i, Debug, DtlsTransportStep, ol, DtlsTransport, Step, puid, id, mID); @@ -1914,7 +1906,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::stepFixState() + bool DTLSTransport::stepFixState() noexcept { ZS_EVENTING_1(x, i, Debug, DtlsTransportStep, ol, DtlsTransport, Step, puid, id, mID); @@ -1957,7 +1949,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::stepNotifyReady() + bool DTLSTransport::stepNotifyReady() noexcept { ZS_EVENTING_1(x, i, Debug, DtlsTransportStep, ol, DtlsTransport, Step, puid, id, mID); @@ -1990,7 +1982,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::cancel() + void DTLSTransport::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, DtlsTransportCancel, ol, DtlsTransport, Cancel, puid, id, mID); @@ -2002,8 +1994,7 @@ namespace ortc setState(ISecureTransport::State_Closed); if (mGracefulShutdownReference) { -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_DTLS_SESSION_IS_SHUTDOWN 1 -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_DTLS_SESSION_IS_SHUTDOWN 2 +#pragma ZS_BUILD_NOTE("TODO","If anything is needed to shutdown DTLS gracefully then do so here.") } //....................................................................... @@ -2028,7 +2019,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::setState(IDTLSTransportTypes::States state) + void DTLSTransport::setState(IDTLSTransportTypes::States state) noexcept { IDTLSTransportTypes::States currentState = mCurrentState; @@ -2063,7 +2054,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::setError(WORD errorCode, const char *inReason) + void DTLSTransport::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -2089,7 +2080,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::setState(ISecureTransportTypes::States state) + void DTLSTransport::setState(ISecureTransportTypes::States state) noexcept { if (state == mSecureTransportState) return; @@ -2109,7 +2100,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::wakeUpIfNeeded() + void DTLSTransport::wakeUpIfNeeded() noexcept { switch ((States)mCurrentState) { case IDTLSTransportTypes::State_New: { @@ -2136,7 +2127,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::setupSRTP() + void DTLSTransport::setupSRTP() noexcept { typedef ISRTPSDESTransportTypes::CryptoParameters CryptoParameters; typedef ISRTPSDESTransportTypes::Parameters Parameters; @@ -2148,8 +2139,8 @@ namespace ortc SRTP_MASTER_KEY_SALT_LEN * 2); if (!mAdapter->exportKeyingMaterial(kDtlsSrtpExporterLabel, NULL, 0, false, dtlsBuffer.BytePtr(), dtlsBuffer.SizeInBytes())) { - ZS_LOG_WARNING(Detail, log("failed to extract DTLS-SRTP keying material")) - ASSERT(false) + ZS_LOG_WARNING(Detail, log("failed to extract DTLS-SRTP keying material")); + ZS_ASSERT_FAIL("failed to extract DTLS-SRTP keying material"); return; } @@ -2228,12 +2219,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportFactory::Adapter - #pragma mark + // + // IDTLSTransportFactory::Adapter + // //------------------------------------------------------------------------- - const char *DTLSTransport::Adapter::toString(StreamState state) + const char *DTLSTransport::Adapter::toString(StreamState state) noexcept { switch (state) { case SS_CLOSED: return "closed"; @@ -2244,7 +2235,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *DTLSTransport::Adapter::toString(SSLRole role) + const char *DTLSTransport::Adapter::toString(SSLRole role) noexcept { switch (role) { case SSL_CLIENT: return "client"; @@ -2254,7 +2245,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *DTLSTransport::Adapter::toString(SSLMode mode) + const char *DTLSTransport::Adapter::toString(SSLMode mode) noexcept { switch (mode) { case SSL_MODE_TLS: return "tls"; @@ -2264,7 +2255,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *DTLSTransport::Adapter::toString(SSLProtocolVersion version) + const char *DTLSTransport::Adapter::toString(SSLProtocolVersion version) noexcept { switch (version) { case SSL_PROTOCOL_TLS_10: return "1.0"; @@ -2275,7 +2266,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *DTLSTransport::Adapter::toString(Validation validation) + const char *DTLSTransport::Adapter::toString(Validation validation) noexcept { switch (validation) { case VALIDATION_NA: return "NA"; @@ -2286,30 +2277,30 @@ namespace ortc } //------------------------------------------------------------------------- - DTLSTransport::Adapter::Adapter(DTLSTransportPtr outer) : + DTLSTransport::Adapter::Adapter(DTLSTransportPtr outer) noexcept : mOuter(outer) { } //------------------------------------------------------------------------- - DTLSTransport::Adapter::~Adapter() + DTLSTransport::Adapter::~Adapter() noexcept { cleanup(); } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::setIdentity(UseCertificatePtr identity) { - ZS_THROW_INVALID_ARGUMENT_IF(!identity) + void DTLSTransport::Adapter::setIdentity(UseCertificatePtr identity) noexcept { + ZS_ASSERT(identity); identity_ = identity; } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::setServerRole(SSLRole role) { + void DTLSTransport::Adapter::setServerRole(SSLRole role) noexcept { role_ = role; } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::getPeerCertificate(X509** cert) const { + bool DTLSTransport::Adapter::getPeerCertificate(X509** cert) const noexcept { if (!peer_certificate_) return false; @@ -2321,10 +2312,10 @@ namespace ortc DTLSTransport::Adapter::Validation DTLSTransport::Adapter::setPeerCertificateDigest( const String &digest_alg, const String &digest_value - ) + ) noexcept { - ASSERT(NULL != peer_certificate_); - ASSERT(ssl_server_name_.empty()); + ZS_ASSERT(NULL != peer_certificate_); + ZS_ASSERT(ssl_server_name_.empty()); SecureByteBlockPtr digest = UseCertificate::getDigest(digest_alg, peer_certificate_); if (!digest) return VALIDATION_NA; @@ -2342,7 +2333,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::getSslCipher(String *cipher) + bool DTLSTransport::Adapter::getSslCipher(String *cipher) noexcept { if (state_ != SSL_CONNECTED) return false; @@ -2370,7 +2361,7 @@ namespace ortc bool use_context, BYTE *result, size_t result_len - ) + ) noexcept { int i = SSL_export_keying_material( ssl_, @@ -2389,7 +2380,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::setDtlsSrtpCiphers(const std::vector &ciphers) + bool DTLSTransport::Adapter::setDtlsSrtpCiphers(const std::vector &ciphers) noexcept { std::string internal_ciphers; @@ -2422,9 +2413,9 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::getDtlsSrtpCipher(String *cipher) + bool DTLSTransport::Adapter::getDtlsSrtpCipher(String *cipher) noexcept { - ASSERT(state_ == SSL_CONNECTED); + ZS_ASSERT(state_ == SSL_CONNECTED); if (state_ != SSL_CONNECTED) return false; const SRTP_PROTECTION_PROFILE *srtp_profile = @@ -2441,33 +2432,33 @@ namespace ortc } } - ASSERT(false); // This should never happen + ZS_ASSERT_FAIL("DTLS / SRTP cipher not found"); // This should never happen return false; } //------------------------------------------------------------------------- - int DTLSTransport::Adapter::startSSLWithServer(const char* server_name) { + int DTLSTransport::Adapter::startSSLWithServer(const char* server_name) noexcept { ssl_server_name_ = String(server_name); - ASSERT(ssl_server_name_.hasData()); + ZS_ASSERT(ssl_server_name_.hasData()); return startSSL(); } //------------------------------------------------------------------------- - int DTLSTransport::Adapter::startSSLWithPeer() { - ASSERT(ssl_server_name_.empty()); + int DTLSTransport::Adapter::startSSLWithPeer() noexcept { + ZS_ASSERT(ssl_server_name_.empty()); // It is permitted to specify peer_certificate_ only later. return startSSL(); } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::setMode(SSLMode mode) { - ASSERT(state_ == SSL_NONE); + void DTLSTransport::Adapter::setMode(SSLMode mode) noexcept { + ZS_ASSERT(state_ == SSL_NONE); ssl_mode_ = mode; } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::setMaxProtocolVersion(SSLProtocolVersion version) { - ASSERT(ssl_ctx_ == NULL); + void DTLSTransport::Adapter::setMaxProtocolVersion(SSLProtocolVersion version) noexcept { + ZS_ASSERT(ssl_ctx_ == NULL); ssl_max_version_ = version; } @@ -2477,12 +2468,12 @@ namespace ortc size_t data_len, size_t *read, int *error - ) + ) noexcept { if (read) *read = 0; if (error) *error = 0; - ZS_LOG_TRACE(log("bio read") + ZS_PARAM("data length", data_len)) + ZS_LOG_TRACE(log("bio read") + ZS_PARAM("data length", data_len)); auto outer = mOuter.lock(); if (!outer) return SR_ERROR; @@ -2509,12 +2500,12 @@ namespace ortc size_t data_len, size_t* written, int* error - ) + ) noexcept { if (written) *written = 0; if (error) *error = 0; - ZS_LOG_TRACE(log("bio write") + ZS_PARAM("data length", data_len)) + ZS_LOG_TRACE(log("bio write") + ZS_PARAM("data length", data_len)); auto outer = mOuter.lock(); if (!outer) return SR_ERROR; @@ -2531,11 +2522,11 @@ namespace ortc size_t data_len, size_t *written, int *error - ) + ) noexcept { if (error) *error = 0; - ZS_LOG_TRACE(log("write") + ZS_PARAM("data length", data_len)) + ZS_LOG_TRACE(log("write") + ZS_PARAM("data length", data_len)); switch (state_) { case SSL_NONE: @@ -2570,7 +2561,7 @@ namespace ortc switch (ssl_error) { case SSL_ERROR_NONE: ZS_LOG_TRACE(log("ssl write success")) - ASSERT(0 < code && static_cast(code) <= data_len); + ZS_ASSERT(0 < code && static_cast(code) <= data_len); if (written) *written = code; return SR_SUCCESS; @@ -2598,9 +2589,9 @@ namespace ortc size_t data_len, size_t* read, int *error - ) + ) noexcept { - ZS_LOG_INSANE(log("read") + ZS_PARAM("data length", data_len)) + ZS_LOG_INSANE(log("read") + ZS_PARAM("data length", data_len)); switch (state_) { case SSL_NONE: @@ -2641,7 +2632,7 @@ namespace ortc switch (ssl_error) { case SSL_ERROR_NONE: ZS_LOG_TRACE(log("ssl read success")) - ASSERT(0 < code && static_cast(code) <= data_len); + ZS_ASSERT(0 < code && static_cast(code) <= data_len); if (read) *read = code; @@ -2650,7 +2641,7 @@ namespace ortc unsigned int pending = SSL_pending(ssl_); if (pending) { - ZS_LOG_WARNING(Trace, log("short DTLS read (thus flushing)")) + ZS_LOG_WARNING(Trace, log("short DTLS read (thus flushing)")); flushInput(pending); if (error) *error = SSE_MSG_TRUNC; @@ -2659,17 +2650,17 @@ namespace ortc } return SR_SUCCESS; case SSL_ERROR_WANT_READ: - ZS_LOG_TRACE(log("ssl read wants read")) + ZS_LOG_TRACE(log("ssl read wants read")); return SR_BLOCK; case SSL_ERROR_WANT_WRITE: - ZS_LOG_TRACE(log("ssl read wants write")) + ZS_LOG_TRACE(log("ssl read wants write")); ssl_read_needs_write_ = true; return SR_BLOCK; case SSL_ERROR_ZERO_RETURN: - ZS_LOG_TRACE(log("remote side closed")) + ZS_LOG_TRACE(log("remote side closed")); return SR_EOS; default: - ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("code", code)) + ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("code", code)); Adapter::error("SSL_read", (ssl_error ? ssl_error : -1), false); if (error) *error = ssl_error_code_; @@ -2679,7 +2670,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::flushInput(unsigned int left) + void DTLSTransport::Adapter::flushInput(unsigned int left) noexcept { unsigned char buf[2048] {}; @@ -2689,28 +2680,28 @@ namespace ortc int code = SSL_read(ssl_, buf, toread); int ssl_error = SSL_get_error(ssl_, code); - ASSERT(ssl_error == SSL_ERROR_NONE); + ZS_ASSERT(ssl_error == SSL_ERROR_NONE); if (ssl_error != SSL_ERROR_NONE) { - ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("code", code)) + ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("code", code)); Adapter::error("SSL_read", (ssl_error ? ssl_error : -1), false); return; } - ZS_LOG_DEBUG(log("flushed") + ZS_PARAM("bytes", code)) + ZS_LOG_DEBUG(log("flushed") + ZS_PARAM("bytes", code)); left -= code; } } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::close() + void DTLSTransport::Adapter::close() noexcept { cleanup(); - ASSERT(state_ == SSL_CLOSED || state_ == SSL_ERROR); + ZS_ASSERT(state_ == SSL_CLOSED || state_ == SSL_ERROR); } //------------------------------------------------------------------------- - DTLSTransport::Adapter::StreamState DTLSTransport::Adapter::getState() const + DTLSTransport::Adapter::StreamState DTLSTransport::Adapter::getState() const noexcept { switch (state_) { case SSL_WAIT: @@ -2726,10 +2717,12 @@ namespace ortc //------------------------------------------------------------------------- void DTLSTransport::Adapter::onEvent( - int events, - int err - ) + ZS_MAYBE_USED() int events, + ZS_MAYBE_USED() int err + ) noexcept { + ZS_MAYBE_USED(events); + ZS_MAYBE_USED(err); #if 0 int events_to_signal = 0; int signal_error = 0; @@ -2785,7 +2778,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *DTLSTransport::Adapter::toString(SSLState state) + const char *DTLSTransport::Adapter::toString(SSLState state) noexcept { switch (state) { case SSL_NONE: return "none"; @@ -2799,8 +2792,8 @@ namespace ortc } //------------------------------------------------------------------------- - int DTLSTransport::Adapter::startSSL() { - ASSERT(state_ == SSL_NONE); + int DTLSTransport::Adapter::startSSL() noexcept { + ZS_ASSERT(state_ == SSL_NONE); state_ = SSL_CONNECTING; if (int err = beginSSL()) { @@ -2812,7 +2805,7 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params DTLSTransport::Adapter::log(const char *message) const + Log::Params DTLSTransport::Adapter::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::DTLSTransport::Adapter"); IHelper::debugAppend(objectEl, "id", mID); @@ -2822,7 +2815,7 @@ namespace ortc //------------------------------------------------------------------------- // This dumps the SSL error stack to the log. - void DTLSTransport::Adapter::logSSLErrors(const String &prefix) + void DTLSTransport::Adapter::logSSLErrors(const String &prefix) noexcept { char error_buf[200] {}; uint32_t err {}; @@ -2833,16 +2826,16 @@ namespace ortc } } //------------------------------------------------------------------------- - int DTLSTransport::Adapter::beginSSL() + int DTLSTransport::Adapter::beginSSL() noexcept { - ASSERT(state_ == SSL_CONNECTING); + ZS_ASSERT(state_ == SSL_CONNECTING); ZS_LOG_DEBUG(log("begin ssl") + ZS_PARAM("server name", (!ssl_server_name_.empty() ? ssl_server_name_ : "with peer"))) BIO *bio = NULL; // First set up the context - ASSERT(ssl_ctx_ == NULL); + ZS_ASSERT(ssl_ctx_ == NULL); ssl_ctx_ = setupSSLContext(); if (!ssl_ctx_) @@ -2880,9 +2873,9 @@ namespace ortc } //------------------------------------------------------------------------- - int DTLSTransport::Adapter::continueSSL() { - ZS_LOG_TRACE(log("continue ssl")) - ASSERT(state_ == SSL_CONNECTING); + int DTLSTransport::Adapter::continueSSL() noexcept { + ZS_LOG_TRACE(log("continue ssl")); + ZS_ASSERT(state_ == SSL_CONNECTING); if (mTimer) { mTimer->cancel(); @@ -2898,7 +2891,7 @@ namespace ortc if (!sslPostConnectionCheck( ssl_, ssl_server_name_.c_str())) { - ZS_LOG_ERROR(Debug, log("TLS post connection check failure")) + ZS_LOG_ERROR(Debug, log("TLS post connection check failure")); return -1; } @@ -2906,7 +2899,7 @@ namespace ortc break; case SSL_ERROR_WANT_READ: { - ZS_LOG_TRACE(log("continue ssl wants read")) + ZS_LOG_TRACE(log("continue ssl wants read")); struct timeval timeout; if (DTLSv1_get_timeout(ssl_, &timeout)) { @@ -2914,7 +2907,7 @@ namespace ortc auto outer = mOuter.lock(); if (!outer) { - ZS_LOG_WARNING(Debug, log("outer gone")) + ZS_LOG_WARNING(Debug, log("outer gone")); return -1; } @@ -2929,12 +2922,12 @@ namespace ortc } case SSL_ERROR_WANT_WRITE: - ZS_LOG_TRACE(log("continue ssl wants write")) + ZS_LOG_TRACE(log("continue ssl wants write")); break; case SSL_ERROR_ZERO_RETURN: default: - ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("code", code)) + ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("code", code)); return (ssl_error != 0) ? ssl_error : -1; } @@ -2946,8 +2939,8 @@ namespace ortc const char* context, int err, bool signal - ) { - ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("context", context) + ZS_PARAM("error", err) + ZS_PARAM("signal", signal)) + ) noexcept { + ZS_LOG_ERROR(Debug, log("error") + ZS_PARAM("context", context) + ZS_PARAM("error", err) + ZS_PARAM("signal", signal)); state_ = SSL_ERROR; ssl_error_code_ = err; @@ -2958,7 +2951,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DTLSTransport::Adapter::cleanup() { + void DTLSTransport::Adapter::cleanup() noexcept { ZS_LOG_DEBUG(log("cleanup")) if (state_ != SSL_ERROR) { @@ -2969,7 +2962,7 @@ namespace ortc if (ssl_) { int ret = SSL_shutdown(ssl_); if (ret < 0) { - ZS_LOG_WARNING(Debug, log("SSL_shutdown failed") + ZS_PARAM("error", SSL_get_error(ssl_, ret))) + ZS_LOG_WARNING(Debug, log("SSL_shutdown failed") + ZS_PARAM("error", SSL_get_error(ssl_, ret))); } SSL_free(ssl_); @@ -2995,22 +2988,22 @@ namespace ortc //------------------------------------------------------------------------- - void DTLSTransport::Adapter::onTimer(ITimerPtr timer) + void DTLSTransport::Adapter::onTimer(ITimerPtr timer) noexcept { if (!mTimer) return; if (timer != mTimer) { - ZS_LOG_WARNING(Trace, log("notified about obselete timer (probably okay)") + ZS_PARAM("timer id", timer->getID())) + ZS_LOG_WARNING(Trace, log("notified about obselete timer (probably okay)") + ZS_PARAM("timer id", timer->getID())); return; } - ZS_LOG_TRACE(log("dtls timeout")) + ZS_LOG_TRACE(log("dtls timeout")); DTLSv1_handle_timeout(ssl_); continueSSL(); } //------------------------------------------------------------------------- - SSL_CTX* DTLSTransport::Adapter::setupSSLContext() + SSL_CTX* DTLSTransport::Adapter::setupSSLContext() noexcept { SSL_CTX *ctx = NULL; @@ -3020,24 +3013,24 @@ namespace ortc if (ctx == NULL) return NULL; - SSL_CTX_set_min_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_VERSION); + SSL_CTX_set_min_proto_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_VERSION); switch (ssl_max_version_) { case SSL_PROTOCOL_TLS_10: - SSL_CTX_set_max_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_VERSION); + SSL_CTX_set_max_proto_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_VERSION); break; case SSL_PROTOCOL_TLS_11: - SSL_CTX_set_max_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_1_VERSION); break; case SSL_PROTOCOL_TLS_12: default: - SSL_CTX_set_max_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION); break; } if (identity_) { if (SSL_CTX_use_certificate(ctx, identity_->getCertificate()) != 1 || SSL_CTX_use_PrivateKey(ctx, identity_->getKeyPair()) != 1) { - ZS_LOG_ERROR(Debug, log("configure key and certificate failure")) + ZS_LOG_ERROR(Debug, log("configure key and certificate failure")); logSSLErrors("Configuring key and certificate"); SSL_CTX_free(ctx); @@ -3076,8 +3069,9 @@ namespace ortc } //------------------------------------------------------------------------- - int DTLSTransport::Adapter::sslVerifyCallback(int ok, X509_STORE_CTX* store) + int DTLSTransport::Adapter::sslVerifyCallback(ZS_MAYBE_USED() int ok, X509_STORE_CTX* store) noexcept { + ZS_MAYBE_USED(ok); // Get our SSL structure from the store SSL* ssl = reinterpret_cast(X509_STORE_CTX_get_ex_data( store, @@ -3094,11 +3088,11 @@ namespace ortc // TODO(jiayl): Verify the chain is a proper chain and report the chain to // |stream->peer_certificate_|, like what NSS does. if (depth > 0) { - ZS_LOG_TRACE(pThis->log("ignored chained certificate at depth") + ZS_PARAM("depth", depth)) + ZS_LOG_TRACE(pThis->log("ignored chained certificate at depth") + ZS_PARAM("depth", depth)); return 1; } - ZS_LOG_TRACE(pThis->log("accepted peer certificate (but will verify fully later)")) + ZS_LOG_TRACE(pThis->log("accepted peer certificate (but will verify fully later)")); // Record the peer's certificate. pThis->peer_certificate_ = cert; @@ -3112,10 +3106,11 @@ namespace ortc //------------------------------------------------------------------------- bool DTLSTransport::Adapter::sslPostConnectionCheck( SSL* ssl, - const char* server_name - ) + ZS_MAYBE_USED() const char* server_name + ) noexcept { - ASSERT(server_name != NULL); + ZS_MAYBE_USED(server_name); + ZS_ASSERT(server_name != NULL); bool ok; #if 0 if (server_name[0] != '\0') { // traditional mode @@ -3129,7 +3124,7 @@ namespace ortc #else { #endif //0 - ASSERT(peer_certificate_ != NULL); + ZS_ASSERT(peer_certificate_ != NULL); // no server name validation ok = true; #if 0 @@ -3148,24 +3143,24 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::haveDtls() { + bool DTLSTransport::Adapter::haveDtls() noexcept { return true; } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::haveDtlsSrtp() + bool DTLSTransport::Adapter::haveDtlsSrtp() noexcept { return true; } //------------------------------------------------------------------------- - bool DTLSTransport::Adapter::haveExporter() + bool DTLSTransport::Adapter::haveExporter() noexcept { return true; } //------------------------------------------------------------------------- - String DTLSTransport::Adapter::getDefaultSslCipher(SSLProtocolVersion version) + String DTLSTransport::Adapter::getDefaultSslCipher(SSLProtocolVersion version) noexcept { switch (version) { case SSL_PROTOCOL_TLS_10: @@ -3182,7 +3177,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr DTLSTransport::Adapter::toDebug() const + ElementPtr DTLSTransport::Adapter::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::DTLSTransport::Adapter"); @@ -3225,12 +3220,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportFactory - #pragma mark + // + // IDTLSTransportFactory + // //------------------------------------------------------------------------- - IDTLSTransportFactory &IDTLSTransportFactory::singleton() + IDTLSTransportFactory &IDTLSTransportFactory::singleton() noexcept { return DTLSTransportFactory::singleton(); } @@ -3240,7 +3235,7 @@ namespace ortc IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificates - ) + ) noexcept { if (this) {} return internal::DTLSTransport::create(delegate, iceTransport, certificates); @@ -3252,12 +3247,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IDTLSTransportTypes"); } @@ -3266,12 +3261,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportTypes::States - #pragma mark + // + // IDTLSTransportTypes::States + // //--------------------------------------------------------------------------- - const char *IDTLSTransportTypes::toString(States state) + const char *IDTLSTransportTypes::toString(States state) noexcept { switch (state) { case State_New: return "new"; @@ -3285,7 +3280,7 @@ namespace ortc //--------------------------------------------------------------------------- - IDTLSTransportTypes::States IDTLSTransportTypes::toState(const char *state) throw (InvalidParameters) + IDTLSTransportTypes::States IDTLSTransportTypes::toState(const char *state) noexcept(false) { String str(state); for (IDTLSTransportTypes::States index = IDTLSTransportTypes::State_First; index <= IDTLSTransportTypes::State_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -3300,12 +3295,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportTypes::Roles - #pragma mark + // + // IDTLSTransportTypes::Roles + // //--------------------------------------------------------------------------- - const char *IDTLSTransportTypes::toString(Roles state) + const char *IDTLSTransportTypes::toString(Roles state) noexcept { switch (state) { case Role_Auto: return "auto"; @@ -3317,7 +3312,7 @@ namespace ortc //--------------------------------------------------------------------------- - IDTLSTransportTypes::Roles IDTLSTransportTypes::toRole(const char *role) throw (InvalidParameters) + IDTLSTransportTypes::Roles IDTLSTransportTypes::toRole(const char *role) noexcept(false) { String str(role); for (IDTLSTransportTypes::Roles index = IDTLSTransportTypes::Role_First; index <= IDTLSTransportTypes::Role_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -3332,12 +3327,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportTypes::Parameters - #pragma mark + // + // IDTLSTransportTypes::Parameters + // //--------------------------------------------------------------------------- - IDTLSTransportTypes::Parameters::Parameters(ElementPtr elem) + IDTLSTransportTypes::Parameters::Parameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3368,7 +3363,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IDTLSTransportTypes::Parameters::createElement(const char *objectName) const + ElementPtr IDTLSTransportTypes::Parameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3392,19 +3387,19 @@ namespace ortc } //--------------------------------------------------------------------------- - IDTLSTransportTypes::ParametersPtr IDTLSTransportTypes::Parameters::convert(AnyPtr any) + IDTLSTransportTypes::ParametersPtr IDTLSTransportTypes::Parameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Parameters, any); } //--------------------------------------------------------------------------- - ElementPtr IDTLSTransportTypes::Parameters::toDebug() const + ElementPtr IDTLSTransportTypes::Parameters::toDebug() const noexcept { return createElement("ortc::IDTLSTransportTypes::Parameters"); } //--------------------------------------------------------------------------- - String IDTLSTransportTypes::Parameters::hash() const + String IDTLSTransportTypes::Parameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3427,24 +3422,24 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransport - #pragma mark + // + // IDTLSTransport + // //--------------------------------------------------------------------------- - ElementPtr IDTLSTransport::toDebug(IDTLSTransportPtr transport) + ElementPtr IDTLSTransport::toDebug(IDTLSTransportPtr transport) noexcept { return internal::DTLSTransport::toDebug(internal::DTLSTransport::convert(transport)); } //--------------------------------------------------------------------------- - IDTLSTransportPtr IDTLSTransport::convert(IRTPTransportPtr rtpTransport) + IDTLSTransportPtr IDTLSTransport::convert(IRTPTransportPtr rtpTransport) noexcept { return internal::DTLSTransport::convert(rtpTransport); } //--------------------------------------------------------------------------- - IDTLSTransportPtr IDTLSTransport::convert(IRTCPTransportPtr rtcpTransport) + IDTLSTransportPtr IDTLSTransport::convert(IRTCPTransportPtr rtcpTransport) noexcept { return internal::DTLSTransport::convert(rtcpTransport); } @@ -3453,10 +3448,9 @@ namespace ortc IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificates - ) + ) noexcept(false) { return internal::IDTLSTransportFactory::singleton().create(delegate, iceTransport, certificates); } - } diff --git a/ortc/cpp/ortc_DTMFSender.cpp b/ortc/cpp/ortc_DTMFSender.cpp index c9721079..d6de3b3f 100644 --- a/ortc/cpp/ortc_DTMFSender.cpp +++ b/ortc/cpp/ortc_DTMFSender.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -48,14 +50,7 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpsender) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_sender) } namespace ortc { @@ -70,36 +65,36 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSenderSettingsDefaults - #pragma mark + // + // DTMFSenderSettingsDefaults + // class DTMFSenderSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~DTMFSenderSettingsDefaults() + ~DTMFSenderSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static DTMFSenderSettingsDefaultsPtr singleton() + static DTMFSenderSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static DTMFSenderSettingsDefaultsPtr create() + static DTMFSenderSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -107,14 +102,14 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { } }; //------------------------------------------------------------------------- - void installDTMFSenderSettingsDefaults() + void installDTMFSenderSettingsDefaults() noexcept { DTMFSenderSettingsDefaults::singleton(); } @@ -124,12 +119,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderForRTPSender - #pragma mark + // + // IDTMFSenderForRTPSender + // //------------------------------------------------------------------------- - ElementPtr IDTMFSenderForRTPSender::toDebug(ForRTPSenderPtr transport) + ElementPtr IDTMFSenderForRTPSender::toDebug(ForRTPSenderPtr transport) noexcept { if (!transport) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(DTMFSender, transport)->toDebug(); @@ -139,9 +134,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender - #pragma mark + // + // DTMFSender + // //------------------------------------------------------------------------- DTMFSender::DTMFSender( @@ -149,9 +144,10 @@ namespace ortc IMessageQueuePtr queue, IDTMFSenderDelegatePtr originalDelegate, IRTPSenderPtr sender - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mRTPSender(RTPSender::convert(sender)) { ZS_LOG_DETAIL(debug("created")) @@ -162,14 +158,14 @@ namespace ortc } //------------------------------------------------------------------------- - void DTMFSender::init() + void DTMFSender::init() noexcept { AutoRecursiveLock lock(*this); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); } //------------------------------------------------------------------------- - DTMFSender::~DTMFSender() + DTMFSender::~DTMFSender() noexcept { if (isNoop()) return; @@ -180,13 +176,13 @@ namespace ortc } //------------------------------------------------------------------------- - DTMFSenderPtr DTMFSender::convert(IDTMFSenderPtr object) + DTMFSenderPtr DTMFSender::convert(IDTMFSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTMFSender, object); } //------------------------------------------------------------------------- - DTMFSenderPtr DTMFSender::convert(ForRTPSenderPtr object) + DTMFSenderPtr DTMFSender::convert(ForRTPSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DTMFSender, object); } @@ -196,12 +192,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSender - #pragma mark + // + // DTMFSender => IDTMFSender + // //------------------------------------------------------------------------- - ElementPtr DTMFSender::toDebug(DTMFSenderPtr transport) + ElementPtr DTMFSender::toDebug(DTMFSenderPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -211,7 +207,7 @@ namespace ortc DTMFSenderPtr DTMFSender::create( IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ) + ) noexcept { DTMFSenderPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, sender)); pThis->mThisWeak = pThis; @@ -220,7 +216,7 @@ namespace ortc } //------------------------------------------------------------------------- - IDTMFSenderSubscriptionPtr DTMFSender::subscribe(IDTMFSenderDelegatePtr originalDelegate) + IDTMFSenderSubscriptionPtr DTMFSender::subscribe(IDTMFSenderDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to dtmf sender")); @@ -244,7 +240,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTMFSender::canInsertDTMF() const + bool DTMFSender::canInsertDTMF() const noexcept { UseRTPSenderPtr sender; @@ -272,10 +268,7 @@ namespace ortc const char *tones, Milliseconds duration, Milliseconds interToneGap - ) throw ( - InvalidStateError, - InvalidCharacterError - ) + ) noexcept(false) { UseRTPSenderPtr sender; @@ -299,13 +292,13 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPSenderPtr DTMFSender::sender() const + IRTPSenderPtr DTMFSender::sender() const noexcept { return RTPSender::convert(mRTPSender.lock()); } //------------------------------------------------------------------------- - String DTMFSender::toneBuffer() const + String DTMFSender::toneBuffer() const noexcept { UseRTPSenderPtr sender; @@ -329,7 +322,7 @@ namespace ortc } //------------------------------------------------------------------------- - Milliseconds DTMFSender::duration() const + Milliseconds DTMFSender::duration() const noexcept { UseRTPSenderPtr sender; @@ -353,7 +346,7 @@ namespace ortc } //------------------------------------------------------------------------- - Milliseconds DTMFSender::interToneGap() const + Milliseconds DTMFSender::interToneGap() const noexcept { UseRTPSenderPtr sender; @@ -380,23 +373,23 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSenderForRTPSender - #pragma mark + // + // DTMFSender => IDTMFSenderForRTPSender + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IWakeDelegate - #pragma mark + // + // DTMFSender => IWakeDelegate + // //------------------------------------------------------------------------- void DTMFSender::onWake() { - ZS_LOG_DEBUG(log("wake")) + ZS_LOG_DEBUG(log("wake")); AutoRecursiveLock lock(*this); step(); @@ -406,9 +399,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSenderDelegate - #pragma mark + // + // DTMFSender => IDTMFSenderDelegate + // //------------------------------------------------------------------------- void DTMFSender::onDTMFSenderToneChanged( @@ -428,21 +421,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSenderAsyncDelegate - #pragma mark + // + // DTMFSender => IDTMFSenderAsyncDelegate + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => (internal) - #pragma mark + // + // DTMFSender => (internal) + // //------------------------------------------------------------------------- - Log::Params DTMFSender::log(const char *message) const + Log::Params DTMFSender::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::DTMFSender"); IHelper::debugAppend(objectEl, "id", mID); @@ -450,13 +443,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params DTMFSender::debug(const char *message) const + Log::Params DTMFSender::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr DTMFSender::toDebug() const + ElementPtr DTMFSender::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -479,27 +472,27 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTMFSender::isShuttingDown() const + bool DTMFSender::isShuttingDown() const noexcept { if (mGracefulShutdownReference) return true; return false; } //------------------------------------------------------------------------- - bool DTMFSender::isShutdown() const + bool DTMFSender::isShutdown() const noexcept { if (mGracefulShutdownReference) return false; return mShutdown; } //------------------------------------------------------------------------- - void DTMFSender::step() + void DTMFSender::step() noexcept { ZS_LOG_DEBUG(debug("step")) if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_LOG_DEBUG(debug("step forwarding to cancel")); cancel(); return; } @@ -523,7 +516,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DTMFSender::stepSubscribeSender() + bool DTMFSender::stepSubscribeSender() noexcept { if (mRTPSenderSubscription) { ZS_LOG_TRACE(log("already subscribed")); @@ -538,11 +531,12 @@ namespace ortc } mRTPSenderSubscription = sender->subscribe(mThisWeak.lock()); + return true; } //------------------------------------------------------------------------- - void DTMFSender::cancel() + void DTMFSender::cancel() noexcept { //....................................................................... // try to gracefully shutdown @@ -552,9 +546,7 @@ namespace ortc if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); if (mGracefulShutdownReference) { -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_SCTP_SESSION_IS_SHUTDOWN 1 -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_SCTP_SESSION_IS_SHUTDOWN 2 - +#pragma ZS_BUILD_NOTE("TODO", "If anything is required to keep DTMF object gracefully alive during shutdown") // grace shutdown process done here return; @@ -581,12 +573,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderFactory - #pragma mark + // + // IDTMFSenderFactory + // //------------------------------------------------------------------------- - IDTMFSenderFactory &IDTMFSenderFactory::singleton() + IDTMFSenderFactory &IDTMFSenderFactory::singleton() noexcept { return DTMFSenderFactory::singleton(); } @@ -595,7 +587,7 @@ namespace ortc DTMFSenderPtr IDTMFSenderFactory::create( IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ) + ) noexcept { if (this) {} return internal::DTMFSender::create(delegate, sender); @@ -608,12 +600,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderTypes - #pragma mark + // + // IDTMFSenderTypes + // //--------------------------------------------------------------------------- - ElementPtr IDTMFSender::toDebug(IDTMFSenderPtr transport) + ElementPtr IDTMFSender::toDebug(IDTMFSenderPtr transport) noexcept { return internal::DTMFSender::toDebug(internal::DTMFSender::convert(transport)); } @@ -622,10 +614,9 @@ namespace ortc IDTMFSenderPtr IDTMFSender::create( IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ) + ) noexcept { return internal::IDTMFSenderFactory::singleton().create(delegate, sender); } - } diff --git a/ortc/cpp/ortc_DataChannel.cpp b/ortc/cpp/ortc_DataChannel.cpp index 6f2a4f71..e925d0f6 100644 --- a/ortc/cpp/ortc_DataChannel.cpp +++ b/ortc/cpp/ortc_DataChannel.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -52,14 +54,7 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_sctp_datachannel) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_sctp_data_channel) } namespace ortc { @@ -83,9 +78,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- // http://tools.ietf.org/html/draft-ietf-rtcweb-data-protocol-09#section-8.2.1 @@ -162,28 +157,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannelSettingsDefaults - #pragma mark + // + // DataChannelSettingsDefaults + // class DataChannelSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~DataChannelSettingsDefaults() + ~DataChannelSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static DataChannelSettingsDefaultsPtr singleton() + static DataChannelSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static DataChannelSettingsDefaultsPtr create() + static DataChannelSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -191,14 +186,14 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { } }; //------------------------------------------------------------------------- - void installDataChannelSettingsDefaults() + void installDataChannelSettingsDefaults() noexcept { DataChannelSettingsDefaults::singleton(); } @@ -207,9 +202,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannelHelper - #pragma mark + // + // DataChannelHelper + // struct DataChannelHelper { @@ -217,7 +212,7 @@ namespace ortc static ControlMessageTypes getControlMessageType( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { if (bufferLengthInBytes < 1) return ControlMessageType_Unknown; BYTE type = 0; @@ -236,12 +231,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelForSCTPTransport - #pragma mark + // + // IDataChannelForSCTPTransport + // //------------------------------------------------------------------------- - ElementPtr IDataChannelForSCTPTransport::toDebug(ForDataTransportPtr transport) + ElementPtr IDataChannelForSCTPTransport::toDebug(ForDataTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(DataChannel, transport)->toDebug(); @@ -251,7 +246,7 @@ namespace ortc IDataChannelForSCTPTransport::ForDataTransportPtr IDataChannelForSCTPTransport::create( UseDataTransportPtr transport, WORD sessionID - ) + ) noexcept { return IDataChannelFactory::singleton().create(transport, sessionID); } @@ -260,9 +255,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel - #pragma mark + // + // DataChannel + // //------------------------------------------------------------------------- DataChannel::DataChannel( @@ -272,18 +267,19 @@ namespace ortc UseDataTransportPtr transport, ParametersPtr params, WORD sessionID - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mDataTransport(transport), - mParameters(params), mIncoming(ORTC_SCTP_INVALID_DATA_CHANNEL_SESSION_ID != sessionID), - mSessionID(ORTC_SCTP_INVALID_DATA_CHANNEL_SESSION_ID == sessionID ? (params->mID.hasValue() ? params->mID.value() : ORTC_SCTP_INVALID_DATA_CHANNEL_SESSION_ID) : sessionID) + mSessionID(ORTC_SCTP_INVALID_DATA_CHANNEL_SESSION_ID == sessionID ? (params->mID.hasValue() ? params->mID.value() : ORTC_SCTP_INVALID_DATA_CHANNEL_SESSION_ID) : sessionID), + mParameters(params) { ZS_EVENTING_5( x, i, Detail, DataChannelCreate, ol, DataChannel, Start, puid, id, mID, - puid, dataTransportId, ((bool)transport) ? transport->getID() : 0, + puid, dataTransportId, ((bool)transport) ? transport->getRealID() : 0, string, parameters, ((bool)mParameters) ? IHelper::toString(mParameters->createElement("params")) : String(), bool, incoming, mIncoming, word, sessionId, mSessionID @@ -298,7 +294,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::init() + void DataChannel::init() noexcept { AutoRecursiveLock lock(*this); auto transport = mDataTransport.lock(); @@ -309,7 +305,7 @@ namespace ortc } //------------------------------------------------------------------------- - DataChannel::~DataChannel() + DataChannel::~DataChannel() noexcept { if (isNoop()) return; @@ -322,14 +318,14 @@ namespace ortc } //------------------------------------------------------------------------- - DataChannelPtr DataChannel::convert(IDataChannelPtr object) + DataChannelPtr DataChannel::convert(IDataChannelPtr object) noexcept { IDataChannelPtr original = IDataChannelTearAway::original(object); return ZS_DYNAMIC_PTR_CAST(DataChannel, original); } //------------------------------------------------------------------------- - DataChannelPtr DataChannel::convert(ForDataTransportPtr object) + DataChannelPtr DataChannel::convert(ForDataTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(DataChannel, object); } @@ -339,12 +335,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannel - #pragma mark + // + // DataChannel => IDataChannel + // //------------------------------------------------------------------------- - ElementPtr DataChannel::toDebug(DataChannelPtr transport) + ElementPtr DataChannel::toDebug(DataChannelPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -355,7 +351,7 @@ namespace ortc IDataChannelDelegatePtr delegate, IDataTransportPtr transport, const Parameters ¶ms - ) + ) noexcept(false) { ORTC_THROW_INVALID_PARAMETERS_IF(!transport); @@ -385,7 +381,7 @@ namespace ortc } //------------------------------------------------------------------------- - IDataChannelSubscriptionPtr DataChannel::subscribe(IDataChannelDelegatePtr originalDelegate) + IDataChannelSubscriptionPtr DataChannel::subscribe(IDataChannelDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -426,13 +422,13 @@ namespace ortc } //------------------------------------------------------------------------- - IDataTransportPtr DataChannel::transport() const + IDataTransportPtr DataChannel::transport() const noexcept { return SCTPTransport::convert(mDataTransport.lock()); } //------------------------------------------------------------------------- - IDataChannelTypes::ParametersPtr DataChannel::parameters() const + IDataChannelTypes::ParametersPtr DataChannel::parameters() const noexcept { AutoRecursiveLock lock(*this); auto params = make_shared(); @@ -441,28 +437,28 @@ namespace ortc } //------------------------------------------------------------------------- - IDataChannelTypes::States DataChannel::readyState() const + IDataChannelTypes::States DataChannel::readyState() const noexcept { AutoRecursiveLock lock(*this); return mCurrentState; } //------------------------------------------------------------------------- - size_t DataChannel::bufferedAmount() const + size_t DataChannel::bufferedAmount() const noexcept { AutoRecursiveLock lock(*this); return mOutgoingBufferFillSize; } //------------------------------------------------------------------------- - size_t DataChannel::bufferedAmountLowThreshold() const + size_t DataChannel::bufferedAmountLowThreshold() const noexcept { AutoRecursiveLock lock(*this); return mBufferedAmountLowThreshold; } //------------------------------------------------------------------------- - void DataChannel::bufferedAmountLowThreshold(size_t value) + void DataChannel::bufferedAmountLowThreshold(size_t value) noexcept { AutoRecursiveLock lock(*this); @@ -483,21 +479,21 @@ namespace ortc } //------------------------------------------------------------------------- - String DataChannel::binaryType() const + String DataChannel::binaryType() const noexcept { AutoRecursiveLock lock(*this); return mBinaryType; } //------------------------------------------------------------------------- - void DataChannel::binaryType(const char *str) + void DataChannel::binaryType(const char *str) noexcept { AutoRecursiveLock lock(*this); mBinaryType = String(str); } //------------------------------------------------------------------------- - void DataChannel::close() + void DataChannel::close() noexcept { ZS_EVENTING_1(x, i, Trace, DataChannelClose, ol, DataChannel, Close, puid, id, mID); @@ -507,7 +503,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::send(const String &data) + void DataChannel::send(const String &data) noexcept { ZS_EVENTING_2(x, i, Trace, DataChannelSendString, ol, DataChannel, Send, puid, id, mID, string, data, data); @@ -520,7 +516,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::send(const SecureByteBlock &data) + void DataChannel::send(const SecureByteBlock &data) noexcept { ZS_EVENTING_3( x, i, Trace, DataChannelSendBinary, ol, DataChannel, Send, @@ -537,7 +533,7 @@ namespace ortc void DataChannel::send( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept(false) { ZS_EVENTING_3( x, i, Trace, DataChannelSendBinary, ol, DataChannel, Send, @@ -555,19 +551,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelForSCTPTransport - #pragma mark + // + // DataChannel => IDataChannelForSCTPTransport + // //------------------------------------------------------------------------- - DataChannel::PromiseWithStatsReportPtr DataChannel::getStats(const StatsTypeSet &stats) const + DataChannel::PromiseWithStatsReportPtr DataChannel::getStats(const StatsTypeSet &stats) const noexcept { if (!stats.hasStatType(IStatsReportTypes::StatsType_DataChannel)) { return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("TODO", "Add data channel stats.") return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } @@ -575,15 +570,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelForSCTPTransport - #pragma mark + // + // DataChannel => IDataChannelForSCTPTransport + // //------------------------------------------------------------------------- DataChannel::ForDataTransportPtr DataChannel::create( UseDataTransportPtr transport, WORD sessionID - ) + ) noexcept { DataChannelPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), IDataChannelDelegatePtr(), transport, ParametersPtr(), sessionID)); pThis->mThisWeak = pThis; @@ -592,7 +587,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::handleSCTPPacket(SCTPPacketIncomingPtr packet) + bool DataChannel::handleSCTPPacket(SCTPPacketIncomingPtr packet) noexcept { ZS_EVENTING_8( x, i, Trace, DataChannelSCTPTransportReceivedIncomingPacket, ol, DataChannel, Receive, @@ -603,7 +598,7 @@ namespace ortc dword, timestamp, packet->mTimestamp, int, flags, packet->mFlags, buffer, packet, ((bool)packet->mBuffer) ? packet->mBuffer->BytePtr() : NULL, - size, size, ((bool)packet->mBuffer) ? packet->mBuffer->SizeInBytes() : static_cast(0) + size, size, ((bool)packet->mBuffer) ? size_t(SafeInt(packet->mBuffer->SizeInBytes())) : 0 ); // scope: obtain whatever data is required inside lock to process SCTP packet @@ -680,7 +675,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::requestShutdown() + void DataChannel::requestShutdown() noexcept { ZS_EVENTING_1(x, i, Trace, DataChannelSCTPTransportRequestShutdown, ol, DataChannel, Close, puid, id, mID); ZS_LOG_TRACE(log("request shutdown")); @@ -688,21 +683,30 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::notifyClosed() + void DataChannel::notifyClosed() noexcept { - ZS_EVENTING_1(x, i, Trace, DataChannelSCTPTransportRequestNotifyClosed, ol, DataChannel, InternalEvent, puid, id, mID); + ZS_EVENTING_1(x, i, Trace, DataChannelSCTPTransportInternalNotifyClosed, ol, DataChannel, InternalEvent, puid, id, mID); ZS_LOG_TRACE(log("notify closed")); IDataChannelAsyncDelegateProxy::create(mThisWeak.lock())->onNotifiedClosed(); } + //------------------------------------------------------------------------- + void DataChannel::notifyRemapFailure() noexcept + { + ZS_EVENTING_1(x, i, Trace, DataChannelSCTPTransportInternalNotifyRemapFailure, ol, DataChannel, InternalEvent, puid, id, mID); + + ZS_LOG_TRACE(log("notify remap failure")); + IDataChannelAsyncDelegateProxy::create(mThisWeak.lock())->onNotifiedRemapFailure(); + } + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => ISCTPTransportForDataChannelDelegate - #pragma mark + // + // DataChannel => ISCTPTransportForDataChannelDelegate + // //------------------------------------------------------------------------- void DataChannel::onSCTPTransportStateChanged() @@ -718,9 +722,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelAsyncDelegate - #pragma mark + // + // DataChannel => IDataChannelAsyncDelegate + // //------------------------------------------------------------------------- void DataChannel::onRequestShutdown() @@ -734,20 +738,34 @@ namespace ortc //------------------------------------------------------------------------- void DataChannel::onNotifiedClosed() { - ZS_LOG_TRACE(log("on notified closed")) + ZS_LOG_TRACE(log("on notified closed")); AutoRecursiveLock lock(*this); mNotifiedClosed = true; cancel(); } + //------------------------------------------------------------------------- + void DataChannel::onNotifiedRemapFailure() + { + ZS_LOG_TRACE(log("on notified remap failure")); + + AutoRecursiveLock lock(*this); + + setError(UseHTTP::HTTPStatusCode_Conflict, "Data channel moved from locally created SCTP transport to remote incoming SCTP transport except incoming transport already has a data channel with the same ID mapped."); + + mNotifiedClosed = true; + cancel(); + } + + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IWakeDelegate - #pragma mark + // + // DataChannel => IWakeDelegate + // //------------------------------------------------------------------------- void DataChannel::onWake() @@ -762,9 +780,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IPromiseSettledDelegate - #pragma mark + // + // DataChannel => IPromiseSettledDelegate + // //------------------------------------------------------------------------- void DataChannel::onPromiseSettled(PromisePtr promise) @@ -778,7 +796,7 @@ namespace ortc if (mSendReady) { if (mSendReady->isRejected()) { RejectReasonPtr reason = mSendReady->reason(); - ZS_THROW_INVALID_ASSUMPTION_IF(!reason); + ZS_ASSERT(reason); ZS_EVENTING_3( x, e, Trace, DataChannelSCTPTransportSendReadyFailure, ol, DataChannel, InternalEvent, @@ -804,21 +822,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelAsyncDelegate - #pragma mark + // + // DataChannel => IDataChannelAsyncDelegate + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => (internal) - #pragma mark + // + // DataChannel => (internal) + // //------------------------------------------------------------------------- - Log::Params DataChannel::log(const char *message) const + Log::Params DataChannel::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::DataChannel"); IHelper::debugAppend(objectEl, "id", mID); @@ -826,13 +844,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params DataChannel::debug(const char *message) const + Log::Params DataChannel::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr DataChannel::toDebug() const + ElementPtr DataChannel::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -846,7 +864,7 @@ namespace ortc IHelper::debugAppend(resultEl, "default subscription", (bool)mDefaultSubscription); auto dataTransport = mDataTransport.lock(); - IHelper::debugAppend(resultEl, "data transport", dataTransport ? dataTransport->getID() : 0); + IHelper::debugAppend(resultEl, "data transport", dataTransport ? dataTransport->getRealID() : 0); IHelper::debugAppend(resultEl, "data transport subscription", (bool)mDataTransportSubscription); IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); @@ -876,25 +894,25 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::isOpen() const + bool DataChannel::isOpen() const noexcept { return State_Open == mCurrentState; } //------------------------------------------------------------------------- - bool DataChannel::isShuttingDown() const + bool DataChannel::isShuttingDown() const noexcept { return State_Closing == mCurrentState; } //------------------------------------------------------------------------- - bool DataChannel::isShutdown() const + bool DataChannel::isShutdown() const noexcept { return State_Closed == mCurrentState; } //------------------------------------------------------------------------- - void DataChannel::step() + void DataChannel::step() noexcept { ZS_LOG_DEBUG(debug("step")) @@ -932,7 +950,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::stepSCTPTransport() + bool DataChannel::stepSCTPTransport() noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelStep, ol, DataChannel, Step, puid, id, mID); @@ -960,7 +978,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::stepIssueConnect() + bool DataChannel::stepIssueConnect() noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelStep, ol, DataChannel, Step, puid, id, mID); @@ -990,7 +1008,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::stepWaitConnectAck() + bool DataChannel::stepWaitConnectAck() noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelStep, ol, DataChannel, Step, puid, id, mID); @@ -1016,7 +1034,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::stepOpen() + bool DataChannel::stepOpen() noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelStep, ol, DataChannel, Step, puid, id, mID); @@ -1025,7 +1043,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::stepSendData(bool onlyControlPackets) + bool DataChannel::stepSendData(bool onlyControlPackets) noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelStep, ol, DataChannel, Step, puid, id, mID); @@ -1067,7 +1085,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::stepDeliveryIncomingPacket() + bool DataChannel::stepDeliveryIncomingPacket() noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelStep, ol, DataChannel, Step, puid, id, mID); @@ -1097,7 +1115,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::cancel() + void DataChannel::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, DataChannelCancel, ol, DataChannel, Cancel, puid, id, mID); @@ -1150,7 +1168,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::setState(States state) + void DataChannel::setState(States state) noexcept { if (state == mCurrentState) return; @@ -1166,7 +1184,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::setError(WORD errorCode, const char *inReason) + void DataChannel::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -1204,7 +1222,7 @@ namespace ortc SCTPPayloadProtocolIdentifier ppid, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { if ((isShuttingDown()) && (isShutdown())) { @@ -1262,9 +1280,9 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::sendControlOpen() + void DataChannel::sendControlOpen() noexcept { - ORTC_THROW_INVALID_STATE_IF(!mParameters) + ZS_ASSERT(mParameters); OpenPacket openPacket; @@ -1340,7 +1358,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::sendControlAck() + void DataChannel::sendControlAck() noexcept { AckPacket ackPacket; @@ -1371,13 +1389,13 @@ namespace ortc bool DataChannel::deliverOutgoing( SCTPPacketOutgoingPtr packet, bool fixPacket - ) + ) noexcept { ZS_LOG_TRACE(log("delivering data") + packet->toDebug()) packet->mSessionID = mSessionID; if (fixPacket) { - ORTC_THROW_INVALID_STATE_IF(!mParameters) + ZS_ASSERT(mParameters); packet->mOrdered = mParameters->mOrdered; packet->mMaxPacketLifetime = mParameters->mMaxPacketLifetime; packet->mMaxRetransmits = mParameters->mMaxRetransmits; @@ -1412,7 +1430,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::handleOpenPacket(SecureByteBlock &buffer) + bool DataChannel::handleOpenPacket(SecureByteBlock &buffer) noexcept { OpenPacket openPacket; @@ -1521,8 +1539,9 @@ namespace ortc } //------------------------------------------------------------------------- - bool DataChannel::handleAckPacket(SecureByteBlock &buffer) + bool DataChannel::handleAckPacket(ZS_MAYBE_USED() SecureByteBlock &buffer) noexcept { + ZS_MAYBE_USED(buffer); ZS_EVENTING_2( x, i, Debug, DataChannelReceivedControlAck, ol, DataChannel, Receive, puid, id, mID, @@ -1546,7 +1565,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::forwardDataPacketAsEvent(const SCTPPacketIncoming &packet) + void DataChannel::forwardDataPacketAsEvent(const SCTPPacketIncoming &packet) noexcept { ZS_DECLARE_TYPEDEF_PTR(IDataChannelDelegate::MessageEventData, MessageEventData) @@ -1599,7 +1618,7 @@ namespace ortc dword, timestamp, packet.mTimestamp, int, flags, packet.mFlags, buffer, packet, ((bool)packet.mBuffer) ? packet.mBuffer->BytePtr() : NULL, - size, size, ((bool)packet.mBuffer) ? SafeInt(packet.mBuffer->SizeInBytes()) : 0 + size, size, ((bool)packet.mBuffer) ? size_t(SafeInt(packet.mBuffer->SizeInBytes())) : 0 ); @@ -1607,7 +1626,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::outgoingPacketAdded(SCTPPacketOutgoingPtr packet) + void DataChannel::outgoingPacketAdded(SCTPPacketOutgoingPtr packet) noexcept { if (!packet) return; if (!packet->mBuffer) return; @@ -1637,7 +1656,7 @@ namespace ortc } //------------------------------------------------------------------------- - void DataChannel::outgoingPacketRemoved(SCTPPacketOutgoingPtr packet) + void DataChannel::outgoingPacketRemoved(SCTPPacketOutgoingPtr packet) noexcept { if (!packet) return; if (!packet->mBuffer) return; @@ -1682,12 +1701,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelFactory - #pragma mark + // + // IDataChannelFactory + // //------------------------------------------------------------------------- - IDataChannelFactory &IDataChannelFactory::singleton() + IDataChannelFactory &IDataChannelFactory::singleton() noexcept { return DataChannelFactory::singleton(); } @@ -1697,7 +1716,7 @@ namespace ortc IDataChannelDelegatePtr delegate, IDataTransportPtr transport, const Parameters ¶ms - ) + ) noexcept(false) { if (this) {} return internal::DataChannel::create(delegate, transport, params); @@ -1707,7 +1726,7 @@ namespace ortc IDataChannelFactory::ForDataTransportPtr IDataChannelFactory::create( UseDataTransportPtr transport, WORD sessionID - ) + ) noexcept { if (this) {} return internal::DataChannel::create(transport, sessionID); @@ -1720,20 +1739,20 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelTypes - #pragma mark + // + // IDataChannelTypes + // //--------------------------------------------------------------------------- - const char *IDataChannelTypes::toString(States state) + const char *IDataChannelTypes::toString(States state) noexcept { switch (state) { case IDataChannelTypes::State_Connecting: return "connecting"; @@ -1742,12 +1761,12 @@ namespace ortc case IDataChannelTypes::State_Closed: return "closed"; } - ASSERT(false) + ZS_ASSERT_FAIL("unknown data channel state."); return "UNDEFINED"; } //--------------------------------------------------------------------------- - Optional IDataChannelTypes::toState(const char *state) + Optional IDataChannelTypes::toState(const char *state) noexcept { String str(state); @@ -1762,12 +1781,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelTypes::Parameters - #pragma mark + // + // IDataChannelTypes::Parameters + // //--------------------------------------------------------------------------- - IDataChannelTypes::Parameters::Parameters(ElementPtr elem) + IDataChannelTypes::Parameters::Parameters(ElementPtr elem) noexcept { if (!elem) return; @@ -1781,7 +1800,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IDataChannelTypes::Parameters::createElement(const char *objectName) const + ElementPtr IDataChannelTypes::Parameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1799,13 +1818,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IDataChannelTypes::Parameters::toDebug() const + ElementPtr IDataChannelTypes::Parameters::toDebug() const noexcept { return createElement("ortc::IDataChannelTypes::Parameters"); } //--------------------------------------------------------------------------- - String IDataChannelTypes::Parameters::hash() const + String IDataChannelTypes::Parameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1831,12 +1850,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelTypes - #pragma mark + // + // IDataChannelTypes + // //--------------------------------------------------------------------------- - ElementPtr IDataChannel::toDebug(IDataChannelPtr transport) + ElementPtr IDataChannel::toDebug(IDataChannelPtr transport) noexcept { return internal::DataChannel::toDebug(internal::DataChannel::convert(transport)); } @@ -1846,7 +1865,7 @@ namespace ortc IDataChannelDelegatePtr delegate, IDataTransportPtr transport, const Parameters ¶ms - ) throw (InvalidParameters, InvalidStateError) + ) noexcept(false) { return internal::IDataChannelFactory::singleton().create(delegate, transport, params); } diff --git a/ortc/cpp/ortc_Helper.cpp b/ortc/cpp/ortc_Helper.cpp index 981ac64f..a096ea51 100644 --- a/ortc/cpp/ortc_Helper.cpp +++ b/ortc/cpp/ortc_Helper.cpp @@ -46,7 +46,7 @@ namespace std { } #endif //_WIN32 -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -61,12 +61,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- - Log::Params Helper::slog(const char *message) + Log::Params Helper::slog(const char *message) noexcept { return Log::Params(message, "ortc::Helper"); } @@ -77,9 +77,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IHelper - #pragma mark + // + // IHelper + // } diff --git a/ortc/cpp/ortc_ICEGatherer.cpp b/ortc/cpp/ortc_ICEGatherer.cpp index 11e2d47a..a0b9ede9 100644 --- a/ortc/cpp/ortc_ICEGatherer.cpp +++ b/ortc/cpp/ortc_ICEGatherer.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -74,7 +76,7 @@ #include #endif //HAVE_NETINIT6_IN6_VAR_H -#ifdef _ANDROID +#ifdef ANDROID #include #else #endif @@ -84,9 +86,9 @@ #pragma comment(lib, "Iphlpapi.lib") #endif //HAVE_IPHLPAPI_H -#ifdef WINRT +#ifdef WINUWP using namespace Windows::Networking::Connectivity; -#endif //WINRT +#endif //WINUWP #ifdef __APPLE__ #include @@ -94,7 +96,7 @@ using namespace Windows::Networking::Connectivity; #define ORTC_ICEGATHERER_TO_ORDER(xInterfaceType, xOrder) ((((ULONG)xInterfaceType)*100)+xOrder) -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_icegatherer) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_ice_gatherer) } namespace ortc { @@ -105,12 +107,12 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(ortc::services::IBackOffTimerPattern, UseBackOffTimerPattern); ZS_DECLARE_TYPEDEF_PTR(ortc::services::ITURNSocket, ITURNSocket); - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::Helper, UseHelper) + ZS_DECLARE_TYPEDEF_PTR(ortc::internal::Helper, UseHelper); using zsLib::Numeric; using zsLib::Log; - ZS_DECLARE_USING_PROXY(zsLib, ISocketDelegate) + ZS_DECLARE_USING_PROXY(zsLib, ISocketDelegate); namespace internal { @@ -120,37 +122,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark helpers - #pragma mark + // + // helpers + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererSettingsDefaults - #pragma mark + // + // ICEGathererSettingsDefaults + // class ICEGathererSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~ICEGathererSettingsDefaults() + ~ICEGathererSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static ICEGathererSettingsDefaultsPtr singleton() + static ICEGathererSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static ICEGathererSettingsDefaultsPtr create() + static ICEGathererSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -158,7 +160,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { ElementPtr rootEl = Element::create("interfaces"); @@ -425,7 +427,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installICEGathererSettingsDefaults() + void installICEGathererSettingsDefaults() noexcept { ICEGathererSettingsDefaults::singleton(); } @@ -435,12 +437,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererForICETransport - #pragma mark + // + // IICEGathererForICETransport + // //------------------------------------------------------------------------- - ElementPtr IICEGathererForICETransport::toDebug(ForICETransportPtr gatherer) + ElementPtr IICEGathererForICETransport::toDebug(ForICETransportPtr gatherer) noexcept { if (!gatherer) return ElementPtr(); return ICEGatherer::convert(gatherer)->toDebug(); @@ -450,12 +452,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer - #pragma mark + // + // ICEGatherer + // //------------------------------------------------------------------------- - const char *ICEGatherer::toString(InternalStates state) + const char *ICEGatherer::toString(InternalStates state) noexcept { switch (state) { case InternalState_Pending: return "Pending"; @@ -468,7 +470,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICEGatherer::States ICEGatherer::toState(InternalStates state) + IICEGatherer::States ICEGatherer::toState(InternalStates state) noexcept { switch (state) { case InternalState_Pending: return IICEGathererTypes::State_New; @@ -481,7 +483,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *ICEGatherer::toString(InterfaceTypes type) + const char *ICEGatherer::toString(InterfaceTypes type) noexcept { switch (type) { case InterfaceType_Unknown: return "unknown"; @@ -496,7 +498,7 @@ namespace ortc } //------------------------------------------------------------------------- - ICEGatherer::InterfaceTypes ICEGatherer::toInterfaceType(const char *type) + ICEGatherer::InterfaceTypes ICEGatherer::toInterfaceType(const char *type) noexcept { static InterfaceTypes types[] = { InterfaceType_Default, @@ -519,7 +521,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *ICEGatherer::toString(AddressFamilies family) + const char *ICEGatherer::toString(AddressFamilies family) noexcept { switch (family) { case AddressFamily_IPv4: return "ipv4"; @@ -529,7 +531,7 @@ namespace ortc } //------------------------------------------------------------------------- - ICEGatherer::AddressFamilies ICEGatherer::toAddressFamily(const char *family) + ICEGatherer::AddressFamilies ICEGatherer::toAddressFamily(const char *family) noexcept { static AddressFamilies families[] = { AddressFamily_IPv4, @@ -548,17 +550,17 @@ namespace ortc } //------------------------------------------------------------------------- - const char *ICEGatherer::toString(PreferenceTypes preference) + const char *ICEGatherer::toString(PreferenceTypes preference) noexcept { switch (preference) { - case AddressFamily_IPv4: return "ipv4"; - case AddressFamily_IPv6: return "ipv6"; + case PreferenceType_Priority: return "priority"; + case PreferenceType_Unfreeze: return "unfreeze"; } return "unknown"; } //------------------------------------------------------------------------- - ICEGatherer::PreferenceTypes ICEGatherer::toPreferenceType(const char *preference) + ICEGatherer::PreferenceTypes ICEGatherer::toPreferenceType(const char *preference) noexcept { static PreferenceTypes preferences[] = { PreferenceType_Priority, @@ -580,24 +582,25 @@ namespace ortc ICEGatherer::ICEGatherer( const make_private &, const ConstructorOptions &options - ) : - SharedRecursiveLock(SharedRecursiveLock::create()), + ) noexcept : MessageQueueAssociator(options.mQueue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mGathererRouter(ICEGathererRouter::create()), + mComponent(options.mComponent), mUsernameFrag(options.mUsernameFragment.hasData() ? options.mUsernameFragment : IHelper::randomString(ISettings::getUInt(ORTC_SETTING_GATHERER_USERNAME_FRAG_LENGTH))), mPassword(options.mPassword.hasData() ? options.mPassword : IHelper::randomString(ISettings::getUInt(ORTC_SETTING_GATHERER_PASSWORD_LENGTH))), - mCreateTCPCandidates(ISettings::getBool(ORTC_SETTING_GATHERER_CREATE_TCP_CANDIDATES)), - mOptions(options.mOptions), - mComponent(options.mComponent), mRTPGatherer(options.mRTPGatherer), + mOptions(options.mOptions), + mCreateTCPCandidates(ISettings::getBool(ORTC_SETTING_GATHERER_CREATE_TCP_CANDIDATES)), + mPortRestriction(RangeSelection::createFromSetting(ORTC_SETTING_GATHERER_PORT_RESTRICTIONS)), mReflexiveInactivityTime(Seconds(ISettings::getUInt(ORTC_SETTING_GATHERER_REFLEXIVE_INACTIVITY_TIMEOUT_IN_SECONDS))), mRelayInactivityTime(Seconds(ISettings::getUInt(ORTC_SETTING_GATHERER_RELAY_INACTIVITY_TIMEOUT_IN_SECONDS))), - mMaxBufferingTime(Seconds(ISettings::getUInt(ORTC_SETTING_GATHERER_MAX_INCOMING_PACKET_BUFFERING_TIME_IN_SECONDS))), - mMaxTotalBuffers(ISettings::getUInt(ORTC_SETTING_GATHERER_MAX_TOTAL_INCOMING_PACKET_BUFFERING)), + mGatherPassiveTCP(ISettings::getBool(ORTC_SETTING_GATHERER_GATHER_PASSIVE_TCP_CANDIDATES)), mMaxTCPBufferingSizePendingConnection(ISettings::getUInt(ORTC_SETTING_GATHERER_MAX_PENDING_OUTGOING_TCP_SOCKET_BUFFERING_IN_BYTES)), mMaxTCPBufferingSizeConnected(ISettings::getUInt(ORTC_SETTING_GATHERER_MAX_CONNECTED_TCP_SOCKET_BUFFERING_IN_BYTES)), - mGatherPassiveTCP(ISettings::getBool(ORTC_SETTING_GATHERER_GATHER_PASSIVE_TCP_CANDIDATES)), - mPortRestriction(RangeSelection::createFromSetting(ORTC_SETTING_GATHERER_PORT_RESTRICTIONS)) + mMaxBufferingTime(Seconds(ISettings::getUInt(ORTC_SETTING_GATHERER_MAX_INCOMING_PACKET_BUFFERING_TIME_IN_SECONDS))), + mMaxTotalBuffers(ISettings::getUInt(ORTC_SETTING_GATHERER_MAX_TOTAL_INCOMING_PACKET_BUFFERING)) { mSTUNPacketParseOptions = STUNPacket::ParseOptions(STUNPacket::RFC_AllowAll, false, "ortc::ICEGatherer", mID); @@ -667,9 +670,9 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::init() + void ICEGatherer::init() noexcept { - ZS_LOG_DETAIL(log("created")) + ZS_LOG_DETAIL(log("created")); AutoRecursiveLock lock(*this); @@ -678,7 +681,7 @@ namespace ortc mCleanUnusedRoutesDuration = Seconds(cleanInSeconds); mCleanUnusedRoutesTimer = ITimer::create(mThisWeak.lock(), mCleanUnusedRoutesDuration); - ZS_LOG_DETAIL(log("setting up timer to clean unsed routes") + ZS_PARAM("clean duration (s)", mCleanUnusedRoutesDuration) + ZS_PARAM("timer", mCleanUnusedRoutesTimer->getID())) + ZS_LOG_DETAIL(log("setting up timer to clean unsed routes") + ZS_PARAM("clean duration (s)", mCleanUnusedRoutesDuration) + ZS_PARAM("timer", mCleanUnusedRoutesTimer->getID())); } // kick start the process @@ -686,22 +689,22 @@ namespace ortc } //------------------------------------------------------------------------- - ICEGatherer::~ICEGatherer() + ICEGatherer::~ICEGatherer() noexcept { mThisWeak.reset(); - ZS_LOG_DETAIL(log("destroyed")) + ZS_LOG_DETAIL(log("destroyed")); cancel(); ZS_EVENTING_1(x, i, Detail, IceGathererDestroy, ol, IceGatherer, Stop, puid, id, mID); } //------------------------------------------------------------------------- - ICEGathererPtr ICEGatherer::convert(IICEGathererPtr object) + ICEGathererPtr ICEGatherer::convert(IICEGathererPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICEGatherer, object); } //------------------------------------------------------------------------- - ICEGathererPtr ICEGatherer::convert(ForICETransportPtr object) + ICEGathererPtr ICEGatherer::convert(ForICETransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICEGatherer, object); } @@ -710,12 +713,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IStatsProvider - #pragma mark + // + // ICEGatherer => IStatsProvider + // //------------------------------------------------------------------------- - ICEGatherer::PromiseWithStatsReportPtr ICEGatherer::getStats(const StatsTypeSet &stats) const + ICEGatherer::PromiseWithStatsReportPtr ICEGatherer::getStats(const StatsTypeSet &stats) const noexcept { if ((!stats.hasStatType(IStatsReportTypes::StatsType_ICEGatherer)) && (!stats.hasStatType(IStatsReportTypes::StatsType_Candidate))) { @@ -738,12 +741,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IICETransport - #pragma mark + // + // ICEGatherer => IICETransport + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::toDebug(ICEGathererPtr gatherer) + ElementPtr ICEGatherer::toDebug(ICEGathererPtr gatherer) noexcept { if (!gatherer) return ElementPtr(); return gatherer->toDebug(); @@ -753,7 +756,7 @@ namespace ortc ICEGathererPtr ICEGatherer::create( IICEGathererDelegatePtr delegate, const Options &options - ) + ) noexcept { ConstructorOptions creationOptions; creationOptions.mQueue = IORTCForInternal::queueORTC(); @@ -767,7 +770,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICEGathererSubscriptionPtr ICEGatherer::subscribe(IICEGathererDelegatePtr originalDelegate) + IICEGathererSubscriptionPtr ICEGatherer::subscribe(IICEGathererDelegatePtr originalDelegate) noexcept { AutoRecursiveLock lock(*this); if (!originalDelegate) return mDefaultSubscription; @@ -788,7 +791,7 @@ namespace ortc for (auto iter = mNotifiedCandidates.begin(); iter != mNotifiedCandidates.end(); ++iter) { auto candidate = (*iter).second.first; - ZS_LOG_DEBUG(log("reporting existing candidate") + ZS_PARAM("subscription", subscription->getID()) + candidate->toDebug()) + ZS_LOG_DEBUG(log("reporting existing candidate") + ZS_PARAM("subscription", subscription->getID()) + candidate->toDebug()); CandidatePtr sendCandidate(make_shared(*candidate)); delegate->onICEGathererLocalCandidate(mThisWeak.lock(), sendCandidate); @@ -816,13 +819,13 @@ namespace ortc } //------------------------------------------------------------------------- - IICETypes::Components ICEGatherer::component() const + IICETypes::Components ICEGatherer::component() const noexcept { return mComponent; } //------------------------------------------------------------------------- - IICEGatherer::States ICEGatherer::state() const + IICEGatherer::States ICEGatherer::state() const noexcept { AutoRecursiveLock lock(*this); auto state = toState(mCurrentState); @@ -831,7 +834,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICEGatherer::ParametersPtr ICEGatherer::getLocalParameters() const + IICEGatherer::ParametersPtr ICEGatherer::getLocalParameters() const noexcept { ParametersPtr result(make_shared()); result->mUseUnfreezePriority = true; @@ -841,7 +844,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICEGathererTypes::CandidateListPtr ICEGatherer::getLocalCandidates() const + IICEGathererTypes::CandidateListPtr ICEGatherer::getLocalCandidates() const noexcept { AutoRecursiveLock lock(*this); @@ -856,7 +859,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICEGathererPtr ICEGatherer::createAssociatedGatherer(IICEGathererDelegatePtr delegate) throw(InvalidStateError) + IICEGathererPtr ICEGatherer::createAssociatedGatherer(IICEGathererDelegatePtr delegate) noexcept(false) { ORTC_THROW_INVALID_STATE_IF(Component_RTCP == mComponent) @@ -865,7 +868,7 @@ namespace ortc { AutoRecursiveLock lock(*this); - ORTC_THROW_INVALID_STATE_IF(mRTCPGatherer.lock()) + ORTC_THROW_INVALID_STATE_IF(mRTCPGatherer.lock()); ConstructorOptions creationOptions; creationOptions.mQueue = IORTCForInternal::queueORTC(); @@ -888,7 +891,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::gather(const Optional &options) + void ICEGatherer::gather(const Optional &options) noexcept { AutoRecursiveLock lock(*this); @@ -916,7 +919,7 @@ namespace ortc break; } case InternalState_Ready: { - ZS_LOG_DETAIL(log("must initiate gathering again")) + ZS_LOG_DETAIL(log("must initiate gathering again")); setState(InternalState_Gathering); break; } @@ -932,9 +935,9 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::close() + void ICEGatherer::close() noexcept { - ZS_LOG_DETAIL(log("close called")) + ZS_LOG_DETAIL(log("close called")); AutoRecursiveLock lock(*this); cancel(); @@ -944,18 +947,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IICEGathererForICETransport - #pragma mark + // + // ICEGatherer => IICEGathererForICETransport + // //------------------------------------------------------------------------- void ICEGatherer::installTransport( ICETransportPtr inTransport, const String &remoteUFrag - ) + ) noexcept { UseICETransportPtr transport = inTransport; - ORTC_THROW_INVALID_PARAMETERS_IF(!transport); + ZS_ASSERT(transport); ZS_EVENTING_3( x, i, Detail, IceGathererInstallIceTransport, ol, IceGatherer, Info, @@ -968,7 +971,7 @@ namespace ortc if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_WARNING(Detail, log("cannot install transport when shutting down / shutdown")) + ZS_LOG_WARNING(Detail, log("cannot install transport when shutting down / shutdown")); return; } @@ -987,7 +990,7 @@ namespace ortc auto previousTransport = previousInstalledTransport->mTransport.lock(); if (transport == previousTransport) { - ZS_LOG_WARNING(Detail, log("already installed transport") + ZS_PARAM("transport", previousInstalledTransport->mTransportID)) + ZS_LOG_WARNING(Detail, log("already installed transport") + ZS_PARAM("transport", previousInstalledTransport->mTransportID)); return; } @@ -1001,7 +1004,7 @@ namespace ortc auto installedTransport = (*current); if (installedTransport->mTransportID != transport->getID()) continue; - ZS_LOG_DEBUG(log("removing pending transport (since now fully installed)") + installedTransport->toDebug()) + ZS_LOG_DEBUG(log("removing pending transport (since now fully installed)") + installedTransport->toDebug()); mPendingTransports.erase(current); break; @@ -1013,7 +1016,7 @@ namespace ortc installedTransport->mTransport = transport; if (remoteUFrag.isEmpty()) { - ZS_LOG_DEBUG(log("transport is added in a pending state") + installedTransport->toDebug()) + ZS_LOG_DEBUG(log("transport is added in a pending state") + installedTransport->toDebug()); mPendingTransports.push_back(installedTransport); goto transport_installed; } @@ -1026,11 +1029,11 @@ namespace ortc auto packet = (*iter); if (packet->mRFrag != remoteUFrag) continue; - ZS_LOG_DEBUG(log("found buffered packet matching installed transport (will attempt to install route for buffered packet)") + ZS_PARAM("remoteUFrag", remoteUFrag) + packet->toDebug() + ZS_PARAM("transport", transport->getID())) + ZS_LOG_DEBUG(log("found buffered packet matching installed transport (will attempt to install route for buffered packet)") + ZS_PARAM("remoteUFrag", remoteUFrag) + packet->toDebug() + ZS_PARAM("transport", transport->getID())); auto installed = installRoute(packet->mRouterRoute, transport); if (!installed) { - ZS_LOG_WARNING(Debug, log("failed to install route for buffered packet") + packet->toDebug() + ZS_PARAM("transport", transport->getID()) + packet->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to install route for buffered packet") + packet->toDebug() + ZS_PARAM("transport", transport->getID()) + packet->toDebug()); } } } @@ -1045,10 +1048,10 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::notifyTransportStateChange(ICETransportPtr inTransport) + void ICEGatherer::notifyTransportStateChange(ICETransportPtr inTransport) noexcept { UseICETransportPtr transport = inTransport; - ORTC_THROW_INVALID_PARAMETERS_IF(!transport); + ZS_ASSERT(transport); ZS_EVENTING_2( x, i, Debug, IceGathererInternalIceTransportStateChangedEvent, ol, IceGatherer, InternalEvent, @@ -1056,7 +1059,7 @@ namespace ortc puid, iceTransportId, transport->getID() ); - ZS_LOG_TRACE(log("notified transport state changed") + ZS_PARAM("transport id", transport->getID())) + ZS_LOG_TRACE(log("notified transport state changed") + ZS_PARAM("transport id", transport->getID())); AutoRecursiveLock lock(*this); mTransportsChanged = true; @@ -1064,7 +1067,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::removeTransport(ICETransport &inTransport) + void ICEGatherer::removeTransport(ICETransport &inTransport) noexcept { UseICETransport &transport = inTransport; @@ -1074,7 +1077,7 @@ namespace ortc puid, iceTransportId, transport.getID() ); - ZS_LOG_TRACE(log("removing transport") + ZS_PARAM("transport id", transport.getID())) + ZS_LOG_TRACE(log("removing transport") + ZS_PARAM("transport id", transport.getID())); AutoRecursiveLock lock(*this); removeAllRelatedRoutes(transport.getID(), UseICETransportPtr()); @@ -1098,7 +1101,7 @@ namespace ortc auto installedTransport = (*current); if (installedTransport->mTransportID == transport.getID()) { - ZS_LOG_DEBUG(log("found pending transport to remove") + installedTransport->toDebug()) + ZS_LOG_DEBUG(log("found pending transport to remove") + installedTransport->toDebug()); mPendingTransports.erase(current); goto transport_removed; @@ -1109,7 +1112,7 @@ namespace ortc did_not_remove: { - ZS_LOG_WARNING(Detail, log("did not find installed transport (okay if shutdown)") + ZS_PARAM("transport id", transport.getID())) + ZS_LOG_WARNING(Detail, log("did not find installed transport (okay if shutdown)") + ZS_PARAM("transport id", transport.getID())); return; } @@ -1121,41 +1124,41 @@ namespace ortc } //------------------------------------------------------------------------- - ICEGatherer::ForICETransportPtr ICEGatherer::getRTCPGatherer() const + ICEGatherer::ForICETransportPtr ICEGatherer::getRTCPGatherer() const noexcept { AutoRecursiveLock lock(*this); return mRTCPGatherer.lock(); } //------------------------------------------------------------------------- - bool ICEGatherer::isContinousGathering() const + bool ICEGatherer::isContinousGathering() const noexcept { AutoRecursiveLock lock(*this); return mOptions.mContinuousGathering; } //------------------------------------------------------------------------- - ICEGathererRouterPtr ICEGatherer::getGathererRouter() const + ICEGathererRouterPtr ICEGatherer::getGathererRouter() const noexcept { return mGathererRouter; } //------------------------------------------------------------------------- - void ICEGatherer::removeRoute(RouterRoutePtr routerRoute) + void ICEGatherer::removeRoute(RouterRoutePtr routerRoute) noexcept { AutoRecursiveLock lock(*this); auto found = mRoutes.find(routerRoute->mID); if (found == mRoutes.end()) { - ZS_LOG_WARNING(Detail, log("route is not found") + routerRoute->toDebug()) + ZS_LOG_WARNING(Detail, log("route is not found") + routerRoute->toDebug()); return; } auto route = (*found).second; - route->trace(__func__, "remove"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "remove route"); - ZS_LOG_DEBUG(log("removing route") + route->toDebug()) + ZS_LOG_DEBUG(log("removing route") + route->toDebug()); mRoutes.erase(found); @@ -1168,7 +1171,7 @@ namespace ortc bool, found, foundQuick != mQuickSearchRoutes.end() ); if (foundQuick == mQuickSearchRoutes.end()) { - ZS_LOG_WARNING(Detail, log("quick route is not found") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("quick route is not found") + route->toDebug()); return; } @@ -1184,7 +1187,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::remoteAllRelatedRoutes(ICETransport &inTransport) + void ICEGatherer::remoteAllRelatedRoutes(ICETransport &inTransport) noexcept { UseICETransport &transport = inTransport; @@ -1196,7 +1199,7 @@ namespace ortc puid, iceTransportId, transportID ); - ZS_LOG_DEBUG(log("removing all related routes") + ZS_PARAMIZE(transportID)) + ZS_LOG_DEBUG(log("removing all related routes") + ZS_PARAMIZE(transportID)); AutoRecursiveLock lock(*this); removeAllRelatedRoutes(transportID, UseICETransportPtr()); @@ -1208,7 +1211,7 @@ namespace ortc RouterRoutePtr routerRoute, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { if (!buffer) return true; if (!bufferSizeInBytes) return true; @@ -1231,7 +1234,7 @@ namespace ortc { auto found = mRoutes.find(routerRoute->mID); if (found == mRoutes.end()) { - ZS_LOG_DEBUG(log("no route found at this time (attempt to install a route)") + routerRoute->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)) + ZS_LOG_DEBUG(log("no route found at this time (attempt to install a route)") + routerRoute->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)); route = installRoute(routerRoute, transport.getForGatherer()); } else { @@ -1241,7 +1244,7 @@ namespace ortc } if (!route) { - ZS_LOG_WARNING(Debug, log("no route found at this time") + routerRoute->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)) + ZS_LOG_WARNING(Debug, log("no route found at this time") + routerRoute->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)); goto send_failed; } @@ -1249,7 +1252,7 @@ namespace ortc if (route->mHostPort) { if (!route->mHostPort->mBoundUDPSocket) { - ZS_LOG_WARNING(Debug, log("no UDP socket found at this time") + route->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)) + ZS_LOG_WARNING(Debug, log("no UDP socket found at this time") + route->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)); goto send_failed; } ZS_EVENTING_7( @@ -1266,7 +1269,7 @@ namespace ortc } if (route->mRelayPort) { if (!route->mRelayPort->mTURNSocket) { - ZS_LOG_WARNING(Debug, log("no turn socket available at this time") + route->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)) + ZS_LOG_WARNING(Debug, log("no turn socket available at this time") + route->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)); goto send_failed; } route->mRelayPort->mLastActivity = route->mLastUsed; @@ -1275,17 +1278,17 @@ namespace ortc } if (route->mTCPPort) { if (!route->mTCPPort->mSocket) { - ZS_LOG_WARNING(Debug, log("no TCP socket found at this time") + route->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)) + ZS_LOG_WARNING(Debug, log("no TCP socket found at this time") + route->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes)); goto send_failed; } auto currentSize = route->mTCPPort->mOutgoingBuffer.CurrentSize(); auto maxSize = (route->mTCPPort->mConnected ? mMaxTCPBufferingSizeConnected : mMaxTCPBufferingSizePendingConnection); - ZS_LOG_INSANE(log("putting packet into TCP buffer for sending") + route->toDebug() + route->mTCPPort->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes) + ZS_PARAM("current buffer size", currentSize) + ZS_PARAM("max size", maxSize)) + ZS_LOG_INSANE(log("putting packet into TCP buffer for sending") + route->toDebug() + route->mTCPPort->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes) + ZS_PARAM("current buffer size", currentSize) + ZS_PARAM("max size", maxSize)); if (currentSize > maxSize) { - ZS_LOG_WARNING(Trace, log("cannot send packet due to TCP buffer overflow") + route->toDebug() + route->mTCPPort->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes) + ZS_PARAM("current buffer size", currentSize) + ZS_PARAM("max size", maxSize)) + ZS_LOG_WARNING(Trace, log("cannot send packet due to TCP buffer overflow") + route->toDebug() + route->mTCPPort->toDebug() + ZS_PARAM("buffer size", bufferSizeInBytes) + ZS_PARAM("current buffer size", currentSize) + ZS_PARAM("max size", maxSize)); return false; } @@ -1306,13 +1309,13 @@ namespace ortc if ((route->mTCPPort->mConnected) && (0 == currentSize) && (route->mTCPPort->mWriteReady)) { - ZS_LOG_INSANE(log("simulate write ready for TCP socket (to ensure packet is sent out straight away)")) + ZS_LOG_INSANE(log("simulate write ready for TCP socket (to ensure packet is sent out straight away)")); ISocketDelegateProxy::create(mThisWeak.lock())->onWriteReady(route->mTCPPort->mSocket); } return true; } - ZS_LOG_WARNING(Debug, log("route does not have any source / destination ports") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("route does not have any source / destination ports") + route->toDebug()); } goto send_failed; @@ -1351,13 +1354,13 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::notifyLikelyReflexiveActivity(RouterRoutePtr routerRoute) + void ICEGatherer::notifyLikelyReflexiveActivity(RouterRoutePtr routerRoute) noexcept { AutoRecursiveLock lock(*this); auto found = mRoutes.find(routerRoute->mID); if (found == mRoutes.end()) { - ZS_LOG_WARNING(Debug, log("no route found at this time (will not attempt to install a route since one should have been present due to recent previous activity)") + routerRoute->toDebug()) + ZS_LOG_WARNING(Debug, log("no route found at this time (will not attempt to install a route since one should have been present due to recent previous activity)") + routerRoute->toDebug()); return; } @@ -1372,7 +1375,7 @@ namespace ortc ); if (!hostPort) { - ZS_LOG_ERROR(Debug, log("there must be a host port on this route") + route->toDebug()) + ZS_LOG_ERROR(Debug, log("there must be a host port on this route") + route->toDebug()); return; } @@ -1386,7 +1389,7 @@ namespace ortc reflexivePort->mLastActivity = now; foundReflexive = true; - ZS_LOG_INSANE(log("activity found on reflexive port") + reflexivePort->toDebug() + hostPort->toDebug()) + ZS_LOG_INSANE(log("activity found on reflexive port") + reflexivePort->toDebug() + hostPort->toDebug()); } if (foundReflexive) return; @@ -1395,7 +1398,7 @@ namespace ortc auto relayPort = (*iter); relayPort->mLastActivity = now; - ZS_LOG_INSANE(log("activity found on relay port") + relayPort->toDebug() + hostPort->toDebug()) + ZS_LOG_INSANE(log("activity found on relay port") + relayPort->toDebug() + hostPort->toDebug()); } } @@ -1403,9 +1406,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IGathererAsyncDelegate - #pragma mark + // + // ICEGatherer => IGathererAsyncDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onNotifyDeliverRouteBufferedPackets( @@ -1422,7 +1425,7 @@ namespace ortc auto found = mRoutes.find(routerRouteID); if (found == mRoutes.end()) { - ZS_LOG_WARNING(Detail, log("route was not found") + ZS_PARAM("router route id", routerRouteID)) + ZS_LOG_WARNING(Detail, log("route was not found") + ZS_PARAM("router route id", routerRouteID)); return; } @@ -1457,12 +1460,12 @@ namespace ortc bool, wasBuffered, true ); - ZS_LOG_TRACE(log("delivering buffered stun packet") + ZS_PARAM("transport", transport->getID()) + bufferedPacket->mSTUNPacket->toDebug()) + ZS_LOG_TRACE(log("delivering buffered stun packet") + ZS_PARAM("transport", transport->getID()) + bufferedPacket->mSTUNPacket->toDebug()); transport->notifyPacket(route->mRouterRoute, bufferedPacket->mSTUNPacket); continue; } - ZS_THROW_INVALID_ASSUMPTION_IF(!bufferedPacket->mBuffer); + ZS_ASSERT(bufferedPacket->mBuffer); ZS_EVENTING_7( x, i, Trace, IceGathererDeliverIceTransportIncomingPacket, ol, IceGatherer, Deliver, @@ -1475,7 +1478,7 @@ namespace ortc size, size, bufferedPacket->mBuffer->SizeInBytes() ); - ZS_LOG_TRACE(log("delivering buffered packet") + ZS_PARAM("transport", transport->getID()) + ZS_PARAM("buffer size", bufferedPacket->mBuffer->SizeInBytes())) + ZS_LOG_TRACE(log("delivering buffered packet") + ZS_PARAM("transport", transport->getID()) + ZS_PARAM("buffer size", bufferedPacket->mBuffer->SizeInBytes())); transport->notifyPacket(route->mRouterRoute, *(bufferedPacket->mBuffer), bufferedPacket->mBuffer->SizeInBytes()); continue; } @@ -1492,9 +1495,7 @@ namespace ortc promise->reject(); return; } - -#define TODO_RESOLVE_STATS_PROMISE_WHEN_STATS_ARE_DEFINED 1 -#define TODO_RESOLVE_STATS_PROMISE_WHEN_STATS_ARE_DEFINED 2 +#pragma ZS_BUILD_NOTE("TODO","Add ICE gatherer stats once stats are defined.") promise->reject(); } @@ -1502,9 +1503,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IWakeDelegate - #pragma mark + // + // ICEGatherer => IWakeDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onWake() @@ -1519,9 +1520,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IDNSDelegate - #pragma mark + // + // ICEGatherer => IDNSDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onLookupCompleted(IDNSQueryPtr query) @@ -1537,9 +1538,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ITimerDelegate - #pragma mark + // + // ICEGatherer => ITimerDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onTimer(ITimerPtr timer) @@ -1588,7 +1589,7 @@ namespace ortc puid, relatedObjectId, 0 ); - ZS_LOG_TRACE(log("recheck IPs now timer fired")) + ZS_LOG_TRACE(log("recheck IPs now timer fired")); mGetLocalIPsNow = true; step(); return; @@ -1602,7 +1603,7 @@ namespace ortc puid, relatedObjectId, 0 ); - ZS_LOG_TRACE(log("cleaning packet buffering")) + ZS_LOG_TRACE(log("cleaning packet buffering")); while (mBufferedPackets.size() > 0) { auto buffer = mBufferedPackets.front(); @@ -1627,15 +1628,15 @@ namespace ortc puid, id, mID, puid, routerRouteId, buffer->mRouterRoute->mID ); - buffer->mSTUNPacket->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Debug, *(buffer->mSTUNPacket), "buffer clean-up"); } - ZS_LOG_TRACE(log("buffering for too long (or too many buffered packets)") + ZS_PARAM("buffer time", (now - buffer->mTimestamp)) + buffer->toDebug()) + ZS_LOG_TRACE(log("buffering for too long (or too many buffered packets)") + ZS_PARAM("buffer time", (now - buffer->mTimestamp)) + buffer->toDebug()); mBufferedPackets.pop_front(); } if (mBufferedPackets.empty()) { - ZS_LOG_TRACE(log("no longer need buffer cleanup timer as all buffers are gone")) + ZS_LOG_TRACE(log("no longer need buffer cleanup timer as all buffers are gone")); mCleanUpBufferingTimer->cancel(); mCleanUpBufferingTimer.reset(); } @@ -1650,7 +1651,7 @@ namespace ortc puid, relatedObjectId, 0 ); - ZS_LOG_DEBUG(log("cleaning unused routes")) + ZS_LOG_DEBUG(log("cleaning unused routes")); for (auto iter_doNotUse = mRoutes.begin(); iter_doNotUse != mRoutes.end();) { auto current = iter_doNotUse; @@ -1658,7 +1659,7 @@ namespace ortc auto route = (*current).second; if (route->mLastUsed + mCleanUnusedRoutesDuration < now) { - ZS_LOG_DEBUG(log("route is no longer in use") + route->toDebug()) + ZS_LOG_DEBUG(log("route is no longer in use") + route->toDebug()); removeRoute(route->mRouterRoute); } } @@ -1680,7 +1681,7 @@ namespace ortc ); { - ZS_LOG_TRACE(log("reflexive inactivity timer fired") + hostPort->toDebug() + reflexivePort->toDebug()) + ZS_LOG_TRACE(log("reflexive inactivity timer fired") + hostPort->toDebug() + reflexivePort->toDebug()); if (reflexivePort->mInactivityTimer) { reflexivePort->mInactivityTimer->cancel(); @@ -1707,7 +1708,7 @@ namespace ortc inactivity_shutdown_reflexive: { - ZS_LOG_DEBUG(log("need to shutdown reflexive port as it is inactive") + reflexivePort->toDebug()) + ZS_LOG_DEBUG(log("need to shutdown reflexive port as it is inactive") + reflexivePort->toDebug()); shutdown(reflexivePort, hostPort); return; @@ -1731,7 +1732,7 @@ namespace ortc ); { - ZS_LOG_TRACE(log("relay inactivity timer fired") + hostPort->toDebug() + relayPort->toDebug()) + ZS_LOG_TRACE(log("relay inactivity timer fired") + hostPort->toDebug() + relayPort->toDebug()); if (relayPort->mInactivityTimer) { relayPort->mInactivityTimer->cancel(); @@ -1741,14 +1742,14 @@ namespace ortc mRelayInactivityTimers.erase(found); if (shouldKeepWarm()) { - ZS_LOG_WARNING(Trace, log("no need to shutdown TURN socket as paths need to be kept warm") + relayPort->toDebug()) + ZS_LOG_WARNING(Trace, log("no need to shutdown TURN socket as paths need to be kept warm") + relayPort->toDebug()); return; } if (Time() == relayPort->mLastActivity) goto inactivity_shutdown_relay; if (relayPort->mLastActivity + mRelayInactivityTime <= now) goto inactivity_shutdown_relay; - ZS_LOG_TRACE(log("no need to shutdown relay port at this time (still active)") + relayPort->toDebug() + ZS_PARAM("now", now)) + ZS_LOG_TRACE(log("no need to shutdown relay port at this time (still active)") + relayPort->toDebug() + ZS_PARAM("now", now)); auto fireAt = relayPort->mLastActivity + mRelayInactivityTime; relayPort->mInactivityTimer = ITimer::create(mThisWeak.lock(), fireAt); @@ -1758,7 +1759,7 @@ namespace ortc inactivity_shutdown_relay: { - ZS_LOG_DEBUG(log("need to shutdown relay port as it is inactive") + relayPort->toDebug()) + ZS_LOG_DEBUG(log("need to shutdown relay port as it is inactive") + relayPort->toDebug()); shutdown(relayPort, hostPort); return; @@ -1772,9 +1773,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ISocketDelegate - #pragma mark + // + // ICEGatherer => ISocketDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onReadReady(SocketPtr socket) @@ -1814,7 +1815,7 @@ namespace ortc puid, id, mID, puid, tcpPortId, tcpPort->mID ); - ZS_LOG_INSANE(log("read found tcp port") + tcpPort->toDebug()) + ZS_LOG_INSANE(log("read found tcp port") + tcpPort->toDebug()); goto found_tcp_socket; } } @@ -1863,7 +1864,7 @@ namespace ortc puid, id, mID, puid, hostPortId, hostPort->mID ); - ZS_LOG_INSANE(log("write found host port") + hostPort->toDebug()) + ZS_LOG_INSANE(log("write found host port") + hostPort->toDebug()); goto found_host_port; } } @@ -1885,14 +1886,14 @@ namespace ortc not_found: { - ZS_LOG_WARNING(Debug, log("socket write ready failed to find associated port") + ZS_PARAM("socket", string(socket))) + ZS_LOG_WARNING(Debug, log("socket write ready failed to find associated port") + ZS_PARAM("socket", string(socket))); } } //------------------------------------------------------------------------- void ICEGatherer::onException(SocketPtr socket) { - ZS_LOG_WARNING(Debug, log("socket exception") + ZS_PARAM("socket", string(socket))) + ZS_LOG_WARNING(Debug, log("socket exception") + ZS_PARAM("socket", string(socket))); HostPortPtr hostPort; TCPPortPtr tcpPort; @@ -1950,7 +1951,7 @@ namespace ortc not_found: { - ZS_LOG_WARNING(Debug, log("socket exception failed to find associated port") + ZS_PARAM("socket", string(socket))) + ZS_LOG_WARNING(Debug, log("socket exception failed to find associated port") + ZS_PARAM("socket", string(socket))); } } @@ -1958,9 +1959,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IBackOffDelegate - #pragma mark + // + // ICEGatherer => IBackOffDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onBackOffTimerStateChanged( @@ -1983,9 +1984,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ISTUNDiscoveryDelegate - #pragma mark + // + // ICEGatherer => ISTUNDiscoveryDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onSTUNDiscoverySendPacket( @@ -2005,25 +2006,25 @@ namespace ortc size, size, packet->SizeInBytes() ); - ZS_LOG_DEBUG(log("stun discovery needs to send packet") + UseSTUNDiscovery::toDebug(discovery) + ZS_PARAM("destination", destination.string()) + ZS_PARAM("packet length", packet->SizeInBytes())) + ZS_LOG_DEBUG(log("stun discovery needs to send packet") + UseSTUNDiscovery::toDebug(discovery) + ZS_PARAM("destination", destination.string()) + ZS_PARAM("packet length", packet->SizeInBytes())); AutoRecursiveLock lock(*this); auto found = mSTUNDiscoveries.find(discovery); if (found == mSTUNDiscoveries.end()) { - ZS_LOG_WARNING(Debug, log("notified about obsolute stun discovery") + UseSTUNDiscovery::toDebug(discovery)) + ZS_LOG_WARNING(Debug, log("notified about obsolute stun discovery") + UseSTUNDiscovery::toDebug(discovery)); return; } auto hostPort = (*found).second.first; if (!hostPort->mBoundUDPSocket) { - ZS_LOG_WARNING(Debug, log("failed to send stun packet as bound udp socket is gone") + hostPort->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to send stun packet as bound udp socket is gone") + hostPort->toDebug()); return; } auto result = sendUDPPacket(hostPort->mBoundUDPSocket, hostPort->mBoundUDPIP, destination, packet->BytePtr(), packet->SizeInBytes()); if (!result) { - ZS_LOG_WARNING(Debug, log("failed to send stun packet on bound socket") + hostPort->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to send stun packet on bound socket") + hostPort->toDebug()); return; } } @@ -2032,11 +2033,11 @@ namespace ortc void ICEGatherer::onSTUNDiscoveryCompleted(ISTUNDiscoveryPtr discovery) { AutoRecursiveLock lock(*this); - ZS_LOG_DEBUG(log("stun discovery complete notification") + UseSTUNDiscovery::toDebug(discovery)) + ZS_LOG_DEBUG(log("stun discovery complete notification") + UseSTUNDiscovery::toDebug(discovery)); auto found = mSTUNDiscoveries.find(discovery); if (found == mSTUNDiscoveries.end()) { - ZS_LOG_WARNING(Debug, log("notified about obsolute stun discovery") + UseSTUNDiscovery::toDebug(discovery)) + ZS_LOG_WARNING(Debug, log("notified about obsolute stun discovery") + UseSTUNDiscovery::toDebug(discovery)); return; } @@ -2060,9 +2061,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ITURNSocketDelegate - #pragma mark + // + // ICEGatherer => ITURNSocketDelegate + // //------------------------------------------------------------------------- void ICEGatherer::onTURNSocketStateChanged( @@ -2078,7 +2079,7 @@ namespace ortc ); AutoRecursiveLock lock(*this); - ZS_LOG_DEBUG(log("turn state changed notification") + UseTURNSocket::toDebug(socket) + ZS_PARAM("state", UseTURNSocket::toString(state))) + ZS_LOG_DEBUG(log("turn state changed notification") + UseTURNSocket::toDebug(socket) + ZS_PARAM("state", UseTURNSocket::toString(state))); HostPortPtr hostPort; @@ -2095,7 +2096,7 @@ namespace ortc if (!hostPort) { // check closing turn sockets auto found = mShutdownTURNSockets.find(socket); if (found == mShutdownTURNSockets.end()) { - ZS_LOG_WARNING(Debug, log("notified about obsolute turn socket") + UseTURNSocket::toDebug(socket)) + ZS_LOG_WARNING(Debug, log("notified about obsolute turn socket") + UseTURNSocket::toDebug(socket)); return; } hostPort = (*found).second.first; @@ -2116,10 +2117,10 @@ namespace ortc IPAddress source, const BYTE *packet, size_t packetLengthInBytes - ) + ) noexcept { - ZS_THROW_INVALID_ARGUMENT_IF(!packet); - ZS_THROW_INVALID_ARGUMENT_IF(0 == packetLengthInBytes); + ZS_ASSERT(packet); + ZS_ASSERT(0 != packetLengthInBytes); ZS_EVENTING_5( x, i, Trace, IceGathererTurnSocketReceivedPacket, ol, IceGatherer, Receive, @@ -2135,7 +2136,7 @@ namespace ortc { AutoRecursiveLock lock(*this); - ZS_LOG_DEBUG(log("turn received incoming packet") + UseTURNSocket::toDebug(socket) + ZS_PARAM("packet length", packetLengthInBytes)) + ZS_LOG_DEBUG(log("turn received incoming packet") + UseTURNSocket::toDebug(socket) + ZS_PARAM("packet length", packetLengthInBytes)); HostPortPtr hostPort; RelayPortPtr relayPort; @@ -2154,7 +2155,7 @@ namespace ortc if (!hostPort) { // check closing turn sockets auto found = mShutdownTURNSockets.find(socket); if (found == mShutdownTURNSockets.end()) { - ZS_LOG_WARNING(Debug, log("notified about obsolute turn socket") + UseTURNSocket::toDebug(socket)) + ZS_LOG_WARNING(Debug, log("notified about obsolute turn socket") + UseTURNSocket::toDebug(socket)); return; } hostPort = (*found).second.first; @@ -2169,12 +2170,12 @@ namespace ortc fixSTUNParserOptions(stunPacket); if (closingSocket) { - ZS_LOG_WARNING(Detail, log("turn socket is closing (thus cannot handle incoming packet)") + hostPort->toDebug() + relayPort->toDebug()) + ZS_LOG_WARNING(Detail, log("turn socket is closing (thus cannot handle incoming packet)") + hostPort->toDebug() + relayPort->toDebug()); goto unhandled_packet; } if (!localCandidate) { - ZS_LOG_WARNING(Detail, log("local relay candidate is gone (thus cannot handle incoming packet)") + hostPort->toDebug() + relayPort->toDebug()) + ZS_LOG_WARNING(Detail, log("local relay candidate is gone (thus cannot handle incoming packet)") + hostPort->toDebug() + relayPort->toDebug()); goto unhandled_packet; } @@ -2187,7 +2188,7 @@ namespace ortc { if (stunPacket) { if (ISTUNRequester::handleSTUNPacket(source, stunPacket)) { - ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", source.string()) + stunPacket->toDebug()) + ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", source.string()) + stunPacket->toDebug()); return; } } @@ -2197,13 +2198,13 @@ namespace ortc found_stun_packet: { if (ISTUNRequester::handleSTUNPacket(source, stunPacket)) { - ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", source.string()) + stunPacket->toDebug()) + ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", source.string()) + stunPacket->toDebug()); return; } auto response = handleIncomingPacket(localCandidate, source, stunPacket); if (response) { - ZS_LOG_TRACE(log("sending response packet") + localCandidate->toDebug() + ZS_PARAM("to", source.string()) + ZS_PARAM("packet length", response->SizeInBytes())) + ZS_LOG_TRACE(log("sending response packet") + localCandidate->toDebug() + ZS_PARAM("to", source.string()) + ZS_PARAM("packet length", response->SizeInBytes())); socket->sendPacket(source, *response, response->SizeInBytes()); } return; @@ -2221,10 +2222,10 @@ namespace ortc IPAddress destination, const BYTE *packet, size_t packetLengthInBytes - ) + ) noexcept { - ZS_THROW_INVALID_ARGUMENT_IF(!packet); - ZS_THROW_INVALID_ARGUMENT_IF(0 == packetLengthInBytes); + ZS_ASSERT(packet); + ZS_ASSERT(0 != packetLengthInBytes); ZS_EVENTING_5( x, i, Trace, IceGathererTurnSocketSendPacket, ol, IceGatherer, Send, @@ -2252,20 +2253,20 @@ namespace ortc if (!hostPort) { // check closing turn sockets auto found = mShutdownTURNSockets.find(socket); if (found == mShutdownTURNSockets.end()) { - ZS_LOG_WARNING(Debug, log("notified about obsolute turn socket") + UseTURNSocket::toDebug(socket)) + ZS_LOG_WARNING(Debug, log("notified about obsolute turn socket") + UseTURNSocket::toDebug(socket)); return false; } hostPort = (*found).second.first; } if (!hostPort->mBoundUDPSocket) { - ZS_LOG_WARNING(Debug, log("failed to send stun packet as bound udp socket is gone") + hostPort->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to send stun packet as bound udp socket is gone") + hostPort->toDebug()); return false; } auto result = sendUDPPacket(hostPort->mBoundUDPSocket, hostPort->mBoundUDPIP, destination, packet, packetLengthInBytes); if (!result) { - ZS_LOG_WARNING(Debug, log("failed to send stun packet on bound socket") + hostPort->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to send stun packet on bound socket") + hostPort->toDebug()); return false; } return true; @@ -2285,12 +2286,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => (internal) - #pragma mark + // + // ICEGatherer => (internal) + // //------------------------------------------------------------------------- - Log::Params ICEGatherer::log(const char *message) const + Log::Params ICEGatherer::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ICEGatherer"); IHelper::debugAppend(objectEl, "id", mID); @@ -2298,20 +2299,20 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ICEGatherer::slog(const char *message) + Log::Params ICEGatherer::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::ICEGatherer"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params ICEGatherer::debug(const char *message) const + Log::Params ICEGatherer::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr ICEGatherer::toDebug() const + ElementPtr ICEGatherer::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -2410,39 +2411,39 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::isComplete() const + bool ICEGatherer::isComplete() const noexcept { AutoRecursiveLock lock(*this); return State_Complete == toState(mCurrentState); } //------------------------------------------------------------------------- - bool ICEGatherer::isShuttingDown() const + bool ICEGatherer::isShuttingDown() const noexcept { AutoRecursiveLock lock(*this); return InternalState_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool ICEGatherer::isShutdown() const + bool ICEGatherer::isShutdown() const noexcept { AutoRecursiveLock lock(*this); return InternalState_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void ICEGatherer::step() + void ICEGatherer::step() noexcept { if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_TRACE(log("step - shutting down (thus calling cancel)")) + ZS_LOG_TRACE(log("step - shutting down (thus calling cancel)")); cancel(); return; } ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); - ZS_LOG_DEBUG(debug("step")) + ZS_LOG_DEBUG(debug("step")); // do not start gathering process until gather is called if (InternalState_Pending == mCurrentState) goto done; @@ -2472,22 +2473,22 @@ namespace ortc } done: - ZS_LOG_TRACE(debug("step complete")) + ZS_LOG_TRACE(debug("step complete")); } //------------------------------------------------------------------------- - bool ICEGatherer::stepRecheckIPTimer() + bool ICEGatherer::stepRecheckIPTimer() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (Seconds() == mRecheckIPsDuration) { - ZS_LOG_TRACE(log("do not need a recheck IP timer")) + ZS_LOG_TRACE(log("do not need a recheck IP timer")); return true; } if ((isComplete()) && (!mOptions.mContinuousGathering)) { - ZS_LOG_TRACE(log("do not need to recheck IPs since already complete")) + ZS_LOG_TRACE(log("do not need to recheck IPs since already complete")); if (mRecheckIPsTimer) { mRecheckIPsTimer->cancel(); @@ -2497,41 +2498,41 @@ namespace ortc } if (mRecheckIPsTimer) { - ZS_LOG_TRACE(log("already have a recheck IP timer")) + ZS_LOG_TRACE(log("already have a recheck IP timer")); return true; } - ZS_LOG_DEBUG(log("creating a recheck ip timer") + ZS_PARAM("recheck duration (s)", mRecheckIPsDuration)) + ZS_LOG_DEBUG(log("creating a recheck ip timer") + ZS_PARAM("recheck duration (s)", mRecheckIPsDuration)); mRecheckIPsTimer = ITimer::create(mThisWeak.lock(), mRecheckIPsDuration); return true; } //------------------------------------------------------------------------- - bool ICEGatherer::stepCalculateOptionsHash() + bool ICEGatherer::stepCalculateOptionsHash() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (mOptionsHash.hasData()) { - ZS_LOG_TRACE(log("options hash already calculated")) + ZS_LOG_TRACE(log("options hash already calculated")); return true; } mOptionsHash = mOptions.hash(); - ZS_LOG_DEBUG(log("step options hash") + ZS_PARAMIZE(mOptionsHash)) + ZS_LOG_DEBUG(log("step options hash") + ZS_PARAMIZE(mOptionsHash)); return true; } //------------------------------------------------------------------------- - bool ICEGatherer::stepResolveHostIPs() + bool ICEGatherer::stepResolveHostIPs() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); - ZS_LOG_TRACE(log("step resolve local IPs")) + ZS_LOG_TRACE(log("step resolve local IPs")); if ((mPendingHostIPs.size() < 1) && (mResolveHostIPQueries.size() < 1)) { - ZS_LOG_TRACE(log("nothing to resolve at this time")) + ZS_LOG_TRACE(log("nothing to resolve at this time")); return true; } @@ -2543,16 +2544,16 @@ namespace ortc HostIPSorter::QueryData query; query.mOriginalData = data; - ZS_THROW_INVALID_ASSUMPTION_IF(!data) + ZS_ASSERT(data); if (data->mHostName.isEmpty()) { - ZS_LOG_TRACE(log("no host name to resolve (attempt to add pre-resolved)")) + ZS_LOG_TRACE(log("no host name to resolve (attempt to add pre-resolved)")); goto add_if_valid; } query.mQuery = IDNS::lookupAorAAAA(mThisWeak.lock(), data->mHostName); if (!query.mQuery) { - ZS_LOG_TRACE(log("did not create DNS query (attempt to add pre-resolved)")) + ZS_LOG_TRACE(log("did not create DNS query (attempt to add pre-resolved)")); goto add_if_valid; } @@ -2592,12 +2593,12 @@ namespace ortc HostIPSorter::QueryData &query = (*current).second; if (!query.mQuery) { - ZS_LOG_TRACE(log("query previously resolved") + ZS_PARAM("query id", id)) + ZS_LOG_TRACE(log("query previously resolved") + ZS_PARAM("query id", id)); continue; } if (!query.mQuery->isComplete()) { - ZS_LOG_TRACE(log("still waiting for DNS to resolve") + ZS_PARAM("query id", id)) + ZS_LOG_TRACE(log("still waiting for DNS to resolve") + ZS_PARAM("query id", id)); continue; } @@ -2657,7 +2658,7 @@ namespace ortc already_added: { - ZS_LOG_WARNING(Trace, log("found duplicate resolved IP (thus ignoring)") + ZS_PARAM("ip", ip.string())) + ZS_LOG_WARNING(Trace, log("found duplicate resolved IP (thus ignoring)") + ZS_PARAM("ip", ip.string())); continue; } @@ -2689,14 +2690,14 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepGetHostIPs() + bool ICEGatherer::stepGetHostIPs() noexcept { typedef HostIPSorter::DataList DataList; ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (!mGetLocalIPsNow) { - ZS_LOG_TRACE(log("no need to check host IPs at this moment")) + ZS_LOG_TRACE(log("no need to check host IPs at this moment")); return true; } @@ -2705,29 +2706,29 @@ namespace ortc mResolvedHostIPs.clear(); - stepGetHostIPs_WinRT(); + stepGetHostIPs_WinUWP(); stepGetHostIPs_Win32(); stepGetHostIPs_ifaddr(); if (mPendingHostIPs.size() > 0) { - ZS_LOG_TRACE(log("not all host IPs resolved") + ZS_PARAM("pending size", mPendingHostIPs.size())) + ZS_LOG_TRACE(log("not all host IPs resolved") + ZS_PARAM("pending size", mPendingHostIPs.size())); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); return false; } - ZS_LOG_TRACE(log("all host IPs resolved") + ZS_PARAM("size", mResolvedHostIPs.size())) + ZS_LOG_TRACE(log("all host IPs resolved") + ZS_PARAM("size", mResolvedHostIPs.size())); return true; } //------------------------------------------------------------------------- - void ICEGatherer::stepGetHostIPs_WinRT() + void ICEGatherer::stepGetHostIPs_WinUWP() noexcept { -#if defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#if defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); // http://stackoverflow.com/questions/10336521/query-local-ip-address - // Use WinRT GetHostNames to search for IP addresses + // Use WinUWP GetHostNames to search for IP addresses { typedef std::map HostNameMap; typedef std::list ConnectionProfileList; @@ -2741,7 +2742,7 @@ namespace ortc for (auto iter = connectionProfiles->First(); iter->HasCurrent; iter->MoveNext()) { auto profile = iter->Current; if (nullptr == profile) { - ZS_LOG_WARNING(Trace, log("found null profile")) + ZS_LOG_WARNING(Trace, log("found null profile")); continue; } profiles.push_back(profile); @@ -2749,7 +2750,7 @@ namespace ortc ConnectionProfile ^current = NetworkInformation::GetInternetConnectionProfile(); if (current) { - ZS_LOG_INSANE("found current profile") + ZS_LOG_INSANE("found current profile"); profiles.push_back(current); } } @@ -2792,11 +2793,11 @@ namespace ortc auto profile = (*profileIter); auto adapter = profile->NetworkAdapter; if (nullptr == adapter) { - ZS_LOG_WARNING(Insane, log("found null adapter")) + ZS_LOG_WARNING(Insane, log("found null adapter")); continue; } if (adapter->NetworkAdapterId != hostNetworkAdapter->NetworkAdapterId) { - ZS_LOG_INSANE(log("adapter does not match host adapter")) + ZS_LOG_INSANE(log("adapter does not match host adapter")); continue; } // match found @@ -2815,7 +2816,7 @@ namespace ortc IPAddress temp(useName); ip = temp; } catch(IPAddress::Exceptions::ParseError &) { - ZS_LOG_TRACE(log("name failed to resolve as IP") + ZS_PARAM("name", useName)) + ZS_LOG_TRACE(log("name failed to resolve as IP") + ZS_PARAM("name", useName)); } if (ip.isAddressEmpty()) continue; @@ -2847,11 +2848,11 @@ namespace ortc } } } -#endif //defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#endif //defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) } //------------------------------------------------------------------------- - void ICEGatherer::stepGetHostIPs_Win32() + void ICEGatherer::stepGetHostIPs_Win32() noexcept { #ifdef HAVE_GETADAPTERADDRESSES ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); @@ -2871,12 +2872,12 @@ namespace ortc { ULONG flags = GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_MULTICAST; - DWORD dwSize = 0; + //DWORD dwSize = 0; DWORD dwRetVal = 0; ULONG family = AF_UNSPEC; - LPVOID lpMsgBuf = NULL; + //LPVOID lpMsgBuf = NULL; PIP_ADAPTER_ADDRESSES pAddresses = NULL; @@ -2896,7 +2897,7 @@ namespace ortc do { pAddresses = (IP_ADAPTER_ADDRESSES *) MALLOC(outBufLen); - ZS_THROW_BAD_STATE_IF(NULL == pAddresses) + ZS_ASSERT(NULL != pAddresses); dwRetVal = GetAdaptersAddresses(family, flags, NULL, pAddresses, &outBufLen); @@ -2915,9 +2916,10 @@ namespace ortc // discover information about the adapter { switch (pCurrAddresses->OperStatus) { - case IfOperStatusDown: goto next_address; - case IfOperStatusNotPresent: goto next_address; - case IfOperStatusLowerLayerDown: goto next_address; + case IfOperStatusDown: goto next_address; + case IfOperStatusNotPresent: goto next_address; + case IfOperStatusLowerLayerDown: goto next_address; + default: break; } IPAddress ip; @@ -2977,7 +2979,7 @@ namespace ortc } } } else { - ZS_LOG_WARNING(Detail, log("failed to obtain IP address information") + ZS_PARAMIZE(dwRetVal)) + ZS_LOG_WARNING(Detail, log("failed to obtain IP address information") + ZS_PARAMIZE(dwRetVal)); } FREE(pAddresses); @@ -3030,7 +3032,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::stepGetHostIPs_ifaddr() + void ICEGatherer::stepGetHostIPs_ifaddr() noexcept { #ifdef HAVE_GETIFADDRS ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); @@ -3087,24 +3089,24 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepCalculateHostsHash() + bool ICEGatherer::stepCalculateHostsHash() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (mHostsHash.hasData()) { - ZS_LOG_TRACE(log("host hash already calculated")) + ZS_LOG_TRACE(log("host hash already calculated")); return true; } HostIPSorter::sort(mResolvedHostIPs); - ZS_LOG_DEBUG(log("--- GATHERING HOST IPs: START ---")) + ZS_LOG_DEBUG(log("--- GATHERING HOST IPs: START ---")); auto hasher = IHasher::sha1(); for (auto iter = mResolvedHostIPs.begin(); iter != mResolvedHostIPs.end(); ++iter) { auto data = (*iter); - ZS_LOG_DEBUG(log("found host IP") + ZS_PARAM("ip", data->mIP.string())) + ZS_LOG_DEBUG(log("found host IP") + ZS_PARAM("ip", data->mIP.string())); hasher->update(data->mIP.string()); hasher->update(":"); @@ -3112,36 +3114,36 @@ namespace ortc mHostsHash = hasher->finalizeAsString(); - ZS_LOG_DEBUG(log("--- GATHERING HOST IPs: END ---") + ZS_PARAM("hash", mHostsHash)) + ZS_LOG_DEBUG(log("--- GATHERING HOST IPs: END ---") + ZS_PARAM("hash", mHostsHash)); return true; } //------------------------------------------------------------------------- - bool ICEGatherer::stepFixHostPorts() + bool ICEGatherer::stepFixHostPorts() noexcept { typedef std::map IPDataMap; ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (mHostsHash == mLastFixedHostPortsHostsHash) { - ZS_LOG_TRACE(log("host ports have not changed (thus no need to fix hosts)")) + ZS_LOG_TRACE(log("host ports have not changed (thus no need to fix hosts)")); return true; } - ZS_LOG_DEBUG(log("host ports has changed") + ZS_PARAMIZE(mHostsHash) + ZS_PARAMIZE(mLastFixedHostPortsHostsHash)) + ZS_LOG_DEBUG(log("host ports has changed") + ZS_PARAMIZE(mHostsHash) + ZS_PARAMIZE(mLastFixedHostPortsHostsHash)); IPDataMap useHosts; for (auto iterResolved = mResolvedHostIPs.begin(); iterResolved != mResolvedHostIPs.end(); ++iterResolved) { auto hostData = (*iterResolved); if (!needsHostPort(hostData)) { - ZS_LOG_TRACE(log("resolved host ip will not be used (filtered out entirely)") + hostData->toDebug()) + ZS_LOG_TRACE(log("resolved host ip will not be used (filtered out entirely)") + hostData->toDebug()); continue; } - ZS_LOG_TRACE(log("resolved IP can be used") + hostData->toDebug()) + ZS_LOG_TRACE(log("resolved IP can be used") + hostData->toDebug()); useHosts[hostData->mIP] = hostData; } - ZS_LOG_DEBUG(log("discovered all hosts that must be bound") + ZS_PARAM("total", useHosts.size())) + ZS_LOG_DEBUG(log("discovered all hosts that must be bound") + ZS_PARAM("total", useHosts.size())); // first shutdown any host ports which are now gone for (auto iter_doNotUse = mHostPorts.begin(); iter_doNotUse != mHostPorts.end();) { @@ -3157,18 +3159,18 @@ namespace ortc continue; // this host is still in use } - ZS_LOG_TRACE(log("host IP needs to be shutdown since host IP is no longer in used") + hostPort->toDebug()) + ZS_LOG_TRACE(log("host IP needs to be shutdown since host IP is no longer in used") + hostPort->toDebug()); shutdown(hostPort); } - ZS_LOG_DEBUG(log("host ports remaining active (after shutting down unused hosts)") + ZS_PARAM("total", mHostPorts.size())) + ZS_LOG_DEBUG(log("host ports remaining active (after shutting down unused hosts)") + ZS_PARAM("total", mHostPorts.size())); // set up missing host ports for (auto iter = useHosts.begin(); iter != useHosts.end(); ++iter) { auto hostData = (*iter).second; auto found = mHostPorts.find(hostData->mIP); if (found != mHostPorts.end()) { - ZS_LOG_TRACE(log("already have host port information") + hostData->toDebug()) + ZS_LOG_TRACE(log("already have host port information") + hostData->toDebug()); continue; } @@ -3186,14 +3188,14 @@ namespace ortc mHostPorts[hostData->mIP] = hostPort; } - ZS_LOG_DEBUG(log("total hosts now set up") + ZS_PARAM("total", mHostPorts.size())) + ZS_LOG_DEBUG(log("total hosts now set up") + ZS_PARAM("total", mHostPorts.size())); mLastFixedHostPortsHostsHash = mHostsHash; return true; } //------------------------------------------------------------------------- - bool ICEGatherer::stepBindHostPorts() + bool ICEGatherer::stepBindHostPorts() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); @@ -3239,7 +3241,7 @@ namespace ortc string, protocolType, IICETypes::toString(IICETypes::Protocol_UDP) ); - ZS_LOG_DEBUG(log("successfully bound UDP socket") + hostPort->toDebug()) + ZS_LOG_DEBUG(log("successfully bound UDP socket") + hostPort->toDebug()); hostPort->mBindUDPBackOffTimer->cancel(); hostPort->mBindUDPBackOffTimer.reset(); @@ -3257,10 +3259,10 @@ namespace ortc ); hostPort->mBindUDPBackOffTimer->notifyAttemptFailed(); - ZS_LOG_WARNING(Debug, log("failed to bind UDP socket") + hostPort->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to bind UDP socket") + hostPort->toDebug()); } } else { - ZS_LOG_WARNING(Trace, log("not ready to retry binding UDP just yet") + hostPort->toDebug()) + ZS_LOG_WARNING(Trace, log("not ready to retry binding UDP just yet") + hostPort->toDebug()); } } else { addCandidate(*(hostPort->mHostData), hostPort->mBoundUDPIP, hostPort->mCandidateUDP); @@ -3288,7 +3290,7 @@ namespace ortc string, hostIp, bindIP.string(), string, protocolType, IICETypes::toString(IICETypes::Protocol_TCP) ); - ZS_LOG_DEBUG(log("successfully bound TCP socket") + ZS_PARAM("bind ip", bindIP.string())) + ZS_LOG_DEBUG(log("successfully bound TCP socket") + ZS_PARAM("bind ip", bindIP.string())); hostPort->mBindTCPBackOffTimer->cancel(); hostPort->mBindTCPBackOffTimer.reset(); @@ -3310,10 +3312,10 @@ namespace ortc string, protocolType, IICETypes::toString(IICETypes::Protocol_TCP) ); hostPort->mBindTCPBackOffTimer->notifyAttemptFailed(); - ZS_LOG_WARNING(Debug, log("failed to bind TCP socket") + hostPort->toDebug() + ZS_PARAM("bind ip", bindIP.string())) + ZS_LOG_WARNING(Debug, log("failed to bind TCP socket") + hostPort->toDebug() + ZS_PARAM("bind ip", bindIP.string())); } } else { - ZS_LOG_WARNING(Trace, log("not ready to retry binding TCP just yet") + hostPort->toDebug()) + ZS_LOG_WARNING(Trace, log("not ready to retry binding TCP just yet") + hostPort->toDebug()); } } else { addCandidate(*(hostPort->mHostData), hostPort->mBoundTCPIP, hostPort->mCandidateTCPPassive); @@ -3340,19 +3342,19 @@ namespace ortc host_not_bound: { - ZS_LOG_WARNING(Trace, log("failed to bind udp / tcp socket") + hostPort->toDebug()) + ZS_LOG_WARNING(Trace, log("failed to bind udp / tcp socket") + hostPort->toDebug()); allBound = false; continue; } host_port_max_bind_failures_reached: { - ZS_LOG_TRACE(log("host port bind reach maximum failures") + hostPort->toDebug()) + ZS_LOG_TRACE(log("host port bind reach maximum failures") + hostPort->toDebug()); hostPort->mBoundOptionsHash = mOptionsHash; continue; } host_bound: { - ZS_LOG_TRACE(log("bound udp / tcp socket") + hostPort->toDebug()) + ZS_LOG_TRACE(log("bound udp / tcp socket") + hostPort->toDebug()); hostPort->mBoundOptionsHash = mOptionsHash; continue; } @@ -3361,23 +3363,23 @@ namespace ortc if (allBound) { mLastBoundHostPortsHostHash = mHostsHash; - ZS_LOG_DEBUG(log("all sockets have been bound (or reached maximum attempt failures)")) + ZS_LOG_DEBUG(log("all sockets have been bound (or reached maximum attempt failures)")); return true; } - ZS_LOG_WARNING(Debug, log("not all sockets bound")) + ZS_LOG_WARNING(Debug, log("not all sockets bound")); // allow creation of reflexive and relay candidates (even though not everything was bound) return true; } //------------------------------------------------------------------------- - bool ICEGatherer::stepCheckTransportsNeedWarmth() + bool ICEGatherer::stepCheckTransportsNeedWarmth() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (!mTransportsChanged) { - ZS_LOG_TRACE(log("transport information has not changed")) + ZS_LOG_TRACE(log("transport information has not changed")); return true; } @@ -3401,7 +3403,7 @@ namespace ortc mTransportsStillNeedsCandidates = transport->needsMoreCandidates(); if (mTransportsStillNeedsCandidates) { - ZS_LOG_TRACE(log("found at least one transport needing more candidates") + installedTransport->toDebug()) + ZS_LOG_TRACE(log("found at least one transport needing more candidates") + installedTransport->toDebug()); goto check_if_changed; } } @@ -3421,18 +3423,18 @@ namespace ortc mTransportsStillNeedsCandidates = transport->needsMoreCandidates(); if (mTransportsStillNeedsCandidates) { - ZS_LOG_TRACE(log("found at least one transport needing more candidates") + installedTransport->toDebug()) + ZS_LOG_TRACE(log("found at least one transport needing more candidates") + installedTransport->toDebug()); goto check_if_changed; } } - ZS_LOG_TRACE(log("did not find any transports needing candidates at this time")) + ZS_LOG_TRACE(log("did not find any transports needing candidates at this time")); goto check_if_changed; check_if_changed: { if (wasNeedingMoreCandidates == mTransportsStillNeedsCandidates) { - ZS_LOG_TRACE(log("no change in need for candidates") + ZS_PARAM("needing more candidates", mTransportsStillNeedsCandidates)) + ZS_LOG_TRACE(log("no change in need for candidates") + ZS_PARAM("needing more candidates", mTransportsStillNeedsCandidates)); return true; } @@ -3443,12 +3445,12 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepWarmUpAfterInterfaceBinding() + bool ICEGatherer::stepWarmUpAfterInterfaceBinding() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (mWarmUpAfterNewInterfaceBindingHostsHash == mHostsHash) { - ZS_LOG_TRACE(log("no new interfaces to bind")) + ZS_LOG_TRACE(log("no new interfaces to bind")); return true; } @@ -3460,7 +3462,7 @@ namespace ortc if ((isComplete()) && (!mOptions.mContinuousGathering)) { - ZS_LOG_TRACE(log("already complete so cannot warm up after interface binding")) + ZS_LOG_TRACE(log("already complete so cannot warm up after interface binding")); return true; } @@ -3478,7 +3480,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepSetupReflexive() + bool ICEGatherer::stepSetupReflexive() noexcept { typedef std::map HashMap; @@ -3488,18 +3490,18 @@ namespace ortc if ((!keepWarm) && (!shouldWarmUpAfterInterfaceBinding())) { - ZS_LOG_TRACE(log("no reflexive candidates should be setup at this time (not being kept warm)")) + ZS_LOG_TRACE(log("no reflexive candidates should be setup at this time (not being kept warm)")); return true; } if (mHostsHash == mLastReflexiveHostsHash) { - ZS_LOG_TRACE(log("hosts have not changed (thus no need to setup reflexive ports)")) + ZS_LOG_TRACE(log("hosts have not changed (thus no need to setup reflexive ports)")); return true; } if ((isComplete()) && (!mOptions.mContinuousGathering)) { - ZS_LOG_TRACE(log("will not setup reflexive because already complete")) + ZS_LOG_TRACE(log("will not setup reflexive because already complete")); return true; } @@ -3509,7 +3511,7 @@ namespace ortc auto hostPort = (*iter).second; if (!hostPort->mBoundUDPSocket) { - ZS_LOG_WARNING(Trace, log("cannot setup reflexive until local socket is bound") + hostPort->toDebug()) + ZS_LOG_WARNING(Trace, log("cannot setup reflexive until local socket is bound") + hostPort->toDebug()); allSetup = false; continue; } @@ -3518,12 +3520,12 @@ namespace ortc if (hostPort->mHostData->mIP.isIPv4()) { if (0 != (hostPort->mHostData->mFilterPolicy & FilterPolicy_NoIPv4Srflx)) { - ZS_LOG_TRACE(log("filtering out IPv4 server reflexive (thus do not setup)")) + ZS_LOG_TRACE(log("filtering out IPv4 server reflexive (thus do not setup)")); filterOut = true; } } else { if (0 != (hostPort->mHostData->mFilterPolicy & FilterPolicy_NoIPv6Srflx)) { - ZS_LOG_TRACE(log("filtering out IPv6 server reflexive (thus do not setup)")) + ZS_LOG_TRACE(log("filtering out IPv6 server reflexive (thus do not setup)")); filterOut = true; } } @@ -3535,7 +3537,7 @@ namespace ortc auto reflexivePort = (*currentReflex); - ZS_LOG_TRACE(log("shutting down reflexive port (since being filtered)") + reflexivePort->toDebug()) + ZS_LOG_TRACE(log("shutting down reflexive port (since being filtered)") + reflexivePort->toDebug()); shutdown(reflexivePort, hostPort); } hostPort->mReflexivePorts.clear(); @@ -3545,7 +3547,7 @@ namespace ortc bool hostPortSetup = true; if (hostPort->mReflexiveOptionsHash == mOptionsHash) { - ZS_LOG_TRACE(log("already setup reflexive candidates") + hostPort->toDebug()) + ZS_LOG_TRACE(log("already setup reflexive candidates") + hostPort->toDebug()); continue; } @@ -3583,7 +3585,7 @@ namespace ortc { if (!keepWarm) { if (!hostPort->mWarmUpAfterBinding) { - ZS_LOG_TRACE(log("host port does not need reflexive candidates to be warmed up at this time") + hostPort->toDebug() + server.toDebug()) + ZS_LOG_TRACE(log("host port does not need reflexive candidates to be warmed up at this time") + hostPort->toDebug() + server.toDebug()); continue; } } @@ -3607,7 +3609,7 @@ namespace ortc reflexivePort->mOptionsHash = mOptionsHash; if (!reflexivePort->mSTUNDiscovery) { - ZS_LOG_DEBUG(log("setting up stun discovery") + server.toDebug()) + ZS_LOG_DEBUG(log("setting up stun discovery") + server.toDebug()); Seconds keepAliveTime {}; @@ -3627,13 +3629,13 @@ namespace ortc options.mKeepWarmPingTime = keepAliveTime; reflexivePort->mSTUNDiscovery = UseSTUNDiscovery::create(IHelper::getServiceQueue(), mThisWeak.lock(), options); - ZS_THROW_UNEXPECTED_ERROR_IF(!reflexivePort->mSTUNDiscovery) + ZS_ASSERT(reflexivePort->mSTUNDiscovery); mSTUNDiscoveries[reflexivePort->mSTUNDiscovery] = HostAndReflexivePortPair(hostPort, reflexivePort); } if (!reflexivePort->mSTUNDiscovery->isComplete()) { - ZS_LOG_TRACE(log("still waiting for stun discovery to complete")) + ZS_LOG_TRACE(log("still waiting for stun discovery to complete")); hostPortSetup = allSetup = false; continue; } @@ -3646,18 +3648,18 @@ namespace ortc } if (ip.isAddressEmpty()) { - ZS_LOG_WARNING(Debug, log("failed to obtain server reflexive address") + hostPort->toDebug() + server.toDebug()) + ZS_LOG_WARNING(Debug, log("failed to obtain server reflexive address") + hostPort->toDebug() + server.toDebug()); continue; } if (reflexivePort->mCandidate) { if (reflexivePort->mCandidate->ip() == ip) { - ZS_LOG_TRACE(log("candidate did not change") + reflexivePort->mCandidate->toDebug()) + ZS_LOG_TRACE(log("candidate did not change") + reflexivePort->mCandidate->toDebug()); continue; } - ZS_LOG_WARNING(Debug, log("reflexive address has changed") + hostPort->toDebug() + server.toDebug() + ZS_PARAM("new ip", ip.string()) + reflexivePort->mCandidate->toDebug()) + ZS_LOG_WARNING(Debug, log("reflexive address has changed") + hostPort->toDebug() + server.toDebug() + ZS_PARAM("new ip", ip.string()) + reflexivePort->mCandidate->toDebug()); removeCandidate(reflexivePort->mCandidate); } @@ -3671,12 +3673,12 @@ namespace ortc reflexivePort->mCandidate = createCandidate(hostPort->mHostData, IICETypes::CandidateType_Srflex, hostPort->mBoundUDPIP, hostPort->mBoundUDPIP, ip, server); - ZS_LOG_DEBUG(log("found reflexive candidate") + reflexivePort->mCandidate->toDebug()) + ZS_LOG_DEBUG(log("found reflexive candidate") + reflexivePort->mCandidate->toDebug()); continue; } } - ZS_LOG_TRACE(log("scan through reflexive ports for servers no longer in use")) + ZS_LOG_TRACE(log("scan through reflexive ports for servers no longer in use")); for (auto iterReflex_doNotUse = hostPort->mReflexivePorts.begin(); iterReflex_doNotUse != hostPort->mReflexivePorts.end(); ) { auto currentReflex = iterReflex_doNotUse; @@ -3688,7 +3690,7 @@ namespace ortc auto found = foundServers.find(hash); if (found != foundServers.end()) continue; - ZS_LOG_DEBUG(log("reflexive server no longer required (thus shutting down)") + reflexivePort->mServer.toDebug()) + ZS_LOG_DEBUG(log("reflexive server no longer required (thus shutting down)") + reflexivePort->mServer.toDebug()); shutdown(reflexivePort, hostPort); } @@ -3699,7 +3701,7 @@ namespace ortc } if (allSetup) { - ZS_LOG_DEBUG(log("all reflexive candidates are prepared (or failed)")) + ZS_LOG_DEBUG(log("all reflexive candidates are prepared (or failed)")); mLastReflexiveHostsHash = mHostsHash; } @@ -3707,18 +3709,18 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepTearDownReflexive() + bool ICEGatherer::stepTearDownReflexive() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if ((shouldKeepWarm()) || (shouldWarmUpAfterInterfaceBinding())) { - ZS_LOG_TRACE(log("no reflexive candidates should be torn down at this time (being kept warm)")) + ZS_LOG_TRACE(log("no reflexive candidates should be torn down at this time (being kept warm)")); return true; } if (mHostsHash == mLastReflexiveHostsHash) { - ZS_LOG_TRACE(log("hosts have not changed (thus no need to tear down reflexive ports)")) + ZS_LOG_TRACE(log("hosts have not changed (thus no need to tear down reflexive ports)")); return true; } @@ -3750,14 +3752,14 @@ namespace ortc wait_until_inactive: { - ZS_LOG_TRACE(log("reflexive port still active thus cannot shutdown") + reflexivePort->toDebug()) + ZS_LOG_TRACE(log("reflexive port still active thus cannot shutdown") + reflexivePort->toDebug()); allHostDone = allDone = false; continue; } shutdown_reflexive: { - ZS_LOG_DEBUG(log("reflexive port no longer being kept warm (and is currently inactive)") + reflexivePort->toDebug()) + ZS_LOG_DEBUG(log("reflexive port no longer being kept warm (and is currently inactive)") + reflexivePort->toDebug()); shutdown(reflexivePort, hostPort); } @@ -3769,7 +3771,7 @@ namespace ortc } if (allDone) { - ZS_LOG_DEBUG(log("all reflexive candidates are torn down (no longer being kept warm)")) + ZS_LOG_DEBUG(log("all reflexive candidates are torn down (no longer being kept warm)")); mLastReflexiveHostsHash = mHostsHash; } @@ -3777,7 +3779,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepSetupRelay() + bool ICEGatherer::stepSetupRelay() noexcept { typedef std::map HashMap; @@ -3787,18 +3789,18 @@ namespace ortc if ((!keepWarm) && (!shouldWarmUpAfterInterfaceBinding())) { - ZS_LOG_TRACE(log("no relay candidates should be setup at this time (not being kept warm)")) + ZS_LOG_TRACE(log("no relay candidates should be setup at this time (not being kept warm)")); return true; } if (mHostsHash == mLastRelayHostsHash) { - ZS_LOG_TRACE(log("hosts have not changed (thus no need to setup relay ports)")) + ZS_LOG_TRACE(log("hosts have not changed (thus no need to setup relay ports)")); return true; } if ((isComplete()) && (!mOptions.mContinuousGathering)) { - ZS_LOG_TRACE(log("will not setup reflexive because already complete")) + ZS_LOG_TRACE(log("will not setup reflexive because already complete")); return true; } @@ -3810,7 +3812,7 @@ namespace ortc auto hostPort = (*iter).second; if (!hostPort->mBoundUDPSocket) { - ZS_LOG_WARNING(Trace, log("cannot setup relay until local socket is bound")) + ZS_LOG_WARNING(Trace, log("cannot setup relay until local socket is bound")); allSetup = false; continue; } @@ -3819,12 +3821,12 @@ namespace ortc if (hostPort->mHostData->mIP.isIPv4()) { if (0 != (hostPort->mHostData->mFilterPolicy & FilterPolicy_NoIPv4Relay)) { - ZS_LOG_TRACE(log("filtering out IPv4 relay (thus do not setup)")) + ZS_LOG_TRACE(log("filtering out IPv4 relay (thus do not setup)")); filterOut = true; } } else { if (0 != (hostPort->mHostData->mFilterPolicy & FilterPolicy_NoIPv6Relay)) { - ZS_LOG_TRACE(log("filtering out IPv6 relay (thus do not setup)")) + ZS_LOG_TRACE(log("filtering out IPv6 relay (thus do not setup)")); filterOut = true; } } @@ -3836,7 +3838,7 @@ namespace ortc auto relayPort = (*currentRelay); - ZS_LOG_TRACE(log("shutting down relay port (since being filtered)") + relayPort->toDebug()) + ZS_LOG_TRACE(log("shutting down relay port (since being filtered)") + relayPort->toDebug()); shutdown(relayPort, hostPort); } hostPort->mRelayPorts.clear(); @@ -3846,7 +3848,7 @@ namespace ortc bool hostPortSetup = true; if (hostPort->mRelayOptionsHash == mOptionsHash) { - ZS_LOG_TRACE(log("already setup relay candidates") + hostPort->toDebug()) + ZS_LOG_TRACE(log("already setup relay candidates") + hostPort->toDebug()); continue; } @@ -3884,7 +3886,7 @@ namespace ortc { if (!keepWarm) { if (!hostPort->mWarmUpAfterBinding) { - ZS_LOG_TRACE(log("no need to set up relay port at this time") + hostPort->toDebug() + server.toDebug()) + ZS_LOG_TRACE(log("no need to set up relay port at this time") + hostPort->toDebug() + server.toDebug()); continue; } } @@ -3910,7 +3912,7 @@ namespace ortc relayPort->mOptionsHash = mOptionsHash; if (!relayPort->mTURNSocket) { - ZS_LOG_DEBUG(log("setting up turn socket") + server.toDebug() + hostPort->toDebug()) + ZS_LOG_DEBUG(log("setting up turn socket") + server.toDebug() + hostPort->toDebug()); UseDNS::SRVLookupTypes lookup = (UseDNS::SRVLookupTypes)(UseDNS::SRVLookupType_AutoLookupA | UseDNS::SRVLookupType_FallbackToALookup); if (hostPort->mBoundUDPIP.isIPv6()) { @@ -3925,9 +3927,9 @@ namespace ortc options.mUseChannelBinding = true; relayPort->mTURNSocket = UseTURNSocket::create(IHelper::getServiceQueue(), mThisWeak.lock(), options); - ZS_THROW_UNEXPECTED_ERROR_IF(!relayPort->mTURNSocket); + ZS_ASSERT(relayPort->mTURNSocket); - ZS_LOG_DEBUG(log("turn socket created") + ZS_PARAM("turn socket", relayPort->mTURNSocket->getID()) + ZS_PARAM("source ip", hostPort->mBoundUDPIP.string()) + hostPort->toDebug()) + ZS_LOG_DEBUG(log("turn socket created") + ZS_PARAM("turn socket", relayPort->mTURNSocket->getID()) + ZS_PARAM("source ip", hostPort->mBoundUDPIP.string()) + hostPort->toDebug()); mTURNSockets[relayPort->mTURNSocket] = HostAndRelayPortPair(hostPort, relayPort); } @@ -3936,12 +3938,12 @@ namespace ortc switch (relayPort->mTURNSocket->getState()) { case UseTURNSocket::TURNSocketState_Pending: { - ZS_LOG_TRACE(log("still waiting for TURN socket to be ready") + relayPort->toDebug()) + ZS_LOG_TRACE(log("still waiting for TURN socket to be ready") + relayPort->toDebug()); ready = hostPortSetup = allSetup = false; break; } case UseTURNSocket::TURNSocketState_Ready: { - ZS_LOG_TRACE(log("TURN socket is ready") + relayPort->toDebug()) + ZS_LOG_TRACE(log("TURN socket is ready") + relayPort->toDebug()); if (Time() == relayPort->mLastActivity) { relayPort->mLastActivity = now; } @@ -3953,7 +3955,7 @@ namespace ortc } case UseTURNSocket::TURNSocketState_ShuttingDown: case UseTURNSocket::TURNSocketState_Shutdown: { - ZS_LOG_WARNING(Trace, log("TURN socket is shutdown") + relayPort->toDebug()) + ZS_LOG_WARNING(Trace, log("TURN socket is shutdown") + relayPort->toDebug()); ready = false; if (!relayPort->mServerResponseIP.isAddressEmpty()) { auto found = hostPort->mIPToRelayPortMapping.find(relayPort->mServerResponseIP); @@ -3980,35 +3982,35 @@ namespace ortc IPAddress mappedIP = relayPort->mTURNSocket->getReflectedIP(); if (relayPort->mReflexiveCandidate) { - ZS_LOG_TRACE(log("already have reflexive candidate") + relayPort->mReflexiveCandidate->toDebug()) + ZS_LOG_TRACE(log("already have reflexive candidate") + relayPort->mReflexiveCandidate->toDebug()); addCandidate(*(hostPort->mHostData), hostPort->mBoundUDPIP, relayPort->mReflexiveCandidate); } if (relayPort->mRelayCandidate) { - ZS_LOG_TRACE(log("already have candidate") + relayPort->mRelayCandidate->toDebug()) + ZS_LOG_TRACE(log("already have candidate") + relayPort->mRelayCandidate->toDebug()); addCandidate(*(hostPort->mHostData), hostPort->mBoundUDPIP, relayPort->mRelayCandidate); } if (relayIP.isAddressEmpty()) { - ZS_LOG_WARNING(Debug, log("failed to obtain server relay address") + hostPort->toDebug() + server.toDebug()) + ZS_LOG_WARNING(Debug, log("failed to obtain server relay address") + hostPort->toDebug() + server.toDebug()); continue; } if (mappedIP.isAddressEmpty()) { - ZS_LOG_WARNING(Debug, log("failed to obtain server relay mapped address") + hostPort->toDebug() + server.toDebug()) + ZS_LOG_WARNING(Debug, log("failed to obtain server relay mapped address") + hostPort->toDebug() + server.toDebug()); continue; } if (relayPort->mRelayCandidate) { if (relayPort->mRelayCandidate->ip() != relayIP) { - ZS_LOG_WARNING(Debug, log("relay address has changed") + hostPort->toDebug() + server.toDebug() + ZS_PARAM("new ip", relayIP.string()) + relayPort->mRelayCandidate->toDebug()) + ZS_LOG_WARNING(Debug, log("relay address has changed") + hostPort->toDebug() + server.toDebug() + ZS_PARAM("new ip", relayIP.string()) + relayPort->mRelayCandidate->toDebug()); removeCandidate(relayPort->mRelayCandidate); relayPort->mRelayCandidate.reset(); } } if (relayPort->mReflexiveCandidate) { if (relayPort->mReflexiveCandidate->ip() != mappedIP) { - ZS_LOG_WARNING(Debug, log("relay reflexive address has changed") + hostPort->toDebug() + server.toDebug() + ZS_PARAM("new ip", mappedIP.string()) + relayPort->mReflexiveCandidate->toDebug()) + ZS_LOG_WARNING(Debug, log("relay reflexive address has changed") + hostPort->toDebug() + server.toDebug() + ZS_PARAM("new ip", mappedIP.string()) + relayPort->mReflexiveCandidate->toDebug()); removeCandidate(relayPort->mReflexiveCandidate); relayPort->mReflexiveCandidate.reset(); } @@ -4040,7 +4042,7 @@ namespace ortc } } - ZS_LOG_TRACE(log("scan through relay ports for servers no longer in use")) + ZS_LOG_TRACE(log("scan through relay ports for servers no longer in use")); for (auto iterRelay_doNotUse = hostPort->mRelayPorts.begin(); iterRelay_doNotUse != hostPort->mRelayPorts.end(); ) { auto currentRelay = iterRelay_doNotUse; @@ -4052,7 +4054,7 @@ namespace ortc auto found = foundServers.find(hash); if (found != foundServers.end()) continue; - ZS_LOG_DEBUG(log("relay server no longer required (thus shutting down)") + relayPort->mServer.toDebug()) + ZS_LOG_DEBUG(log("relay server no longer required (thus shutting down)") + relayPort->mServer.toDebug()); shutdown(relayPort, hostPort); } @@ -4063,7 +4065,7 @@ namespace ortc } if (allSetup) { - ZS_LOG_DEBUG(log("all relay candidates are prepared (or failed)")) + ZS_LOG_DEBUG(log("all relay candidates are prepared (or failed)")); mLastRelayHostsHash = mHostsHash; } @@ -4071,18 +4073,18 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepTearDownRelay() + bool ICEGatherer::stepTearDownRelay() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if ((shouldKeepWarm()) || (shouldWarmUpAfterInterfaceBinding())) { - ZS_LOG_TRACE(log("no relay candidates should be torn down at this time (being kept warm)")) + ZS_LOG_TRACE(log("no relay candidates should be torn down at this time (being kept warm)")); return true; } if (mHostsHash == mLastRelayHostsHash) { - ZS_LOG_TRACE(log("hosts have not changed (thus no need to tear down relay ports)")) + ZS_LOG_TRACE(log("hosts have not changed (thus no need to tear down relay ports)")); return true; } @@ -4107,20 +4109,20 @@ namespace ortc Time fireAt = relayPort->mLastActivity + mRelayInactivityTime; relayPort->mInactivityTimer = ITimer::create(mThisWeak.lock(), fireAt); mRelayInactivityTimers[relayPort->mInactivityTimer] = HostAndRelayPortPair(hostPort, relayPort); - ZS_LOG_TRACE(log("setup relay inactivity timeout") + ZS_PARAMIZE(fireAt) + relayPort->toDebug()) + ZS_LOG_TRACE(log("setup relay inactivity timeout") + ZS_PARAMIZE(fireAt) + relayPort->toDebug()); } goto wait_until_inactive; wait_until_inactive: { - ZS_LOG_TRACE(log("relay port still active thus cannot shutdown") + relayPort->toDebug()) + ZS_LOG_TRACE(log("relay port still active thus cannot shutdown") + relayPort->toDebug()); allHostDone = allDone = false; continue; } shutdown_relay: { - ZS_LOG_DEBUG(log("relay port no longer being kept warm (and is currently inactive)") + relayPort->toDebug()) + ZS_LOG_DEBUG(log("relay port no longer being kept warm (and is currently inactive)") + relayPort->toDebug()); shutdown(relayPort, hostPort); } } @@ -4131,7 +4133,7 @@ namespace ortc } if (allDone) { - ZS_LOG_DEBUG(log("all reflexive candidates are torn down (no longer being kept warm)")) + ZS_LOG_DEBUG(log("all reflexive candidates are torn down (no longer being kept warm)")); mLastRelayHostsHash = mHostsHash; } @@ -4139,12 +4141,12 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::stepCleanPendingShutdownTURNSockets() + bool ICEGatherer::stepCleanPendingShutdownTURNSockets() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if (mShutdownTURNSockets.size() < 1) { - ZS_LOG_TRACE(log("no turn sockets pending shutdown")) + ZS_LOG_TRACE(log("no turn sockets pending shutdown")); return true; } @@ -4160,74 +4162,74 @@ namespace ortc // check to see if it's still possible for the turn socket ot shutdown if (!hostPort->mBoundUDPSocket) { - ZS_LOG_WARNING(Debug, log("performing hard shutdown on turn socket") + ZS_PARAM("turn socket", turnSocket->getID()) + hostPort->toDebug()) + ZS_LOG_WARNING(Debug, log("performing hard shutdown on turn socket") + ZS_PARAM("turn socket", turnSocket->getID()) + hostPort->toDebug()); goto remove_turn_socket; } goto still_pending; remove_turn_socket: { - ZS_LOG_TRACE(log("removing shutdown turn socket") + ZS_PARAM("turn socket", turnSocket->getID()) + hostPort->toDebug()) + ZS_LOG_TRACE(log("removing shutdown turn socket") + ZS_PARAM("turn socket", turnSocket->getID()) + hostPort->toDebug()); mShutdownTURNSockets.erase(currentShutdown); continue; } still_pending: { - ZS_LOG_DEBUG(log("waiting for turn socket to shutdown") + ZS_PARAM("turn socket", turnSocket->getID()) + hostPort->toDebug()) + ZS_LOG_DEBUG(log("waiting for turn socket to shutdown") + ZS_PARAM("turn socket", turnSocket->getID()) + hostPort->toDebug()); continue; } } if (mShutdownTURNSockets.size() < 1) { - ZS_LOG_DEBUG(log("all turn sockets are not shutdown")) + ZS_LOG_DEBUG(log("all turn sockets are not shutdown")); } return true; } //------------------------------------------------------------------------- - bool ICEGatherer::stepCheckIfReady() + bool ICEGatherer::stepCheckIfReady() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererStep, ol, IceGatherer, Step, puid, id, mID); if ((isComplete()) && (!mOptions.mContinuousGathering)) { - ZS_LOG_TRACE(log("gathering must be complete because it was complete before (and not in continuous gathering mode)")) + ZS_LOG_TRACE(log("gathering must be complete because it was complete before (and not in continuous gathering mode)")); return true; } if (mHostsHash != mLastFixedHostPortsHostsHash) { - ZS_LOG_TRACE(log("still waiting to fix host ports")) + ZS_LOG_TRACE(log("still waiting to fix host ports")); return false; } if (mHostsHash != mLastBoundHostPortsHostHash) { - ZS_LOG_TRACE(log("still waiting to bind host ports")) + ZS_LOG_TRACE(log("still waiting to bind host ports")); return false; } if (mHostsHash != mLastReflexiveHostsHash) { - ZS_LOG_TRACE(log("still waiting for reflexive ports to gather")) + ZS_LOG_TRACE(log("still waiting for reflexive ports to gather")); return false; } if (mHostsHash != mLastRelayHostsHash) { - ZS_LOG_TRACE(log("still waiting for relay ports to gather")) + ZS_LOG_TRACE(log("still waiting for relay ports to gather")); return false; } - ZS_LOG_TRACE(log("gathering appears to be complete")) + ZS_LOG_TRACE(log("gathering appears to be complete")); return true; } //------------------------------------------------------------------------- - void ICEGatherer::cancel() + void ICEGatherer::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, IceGathererCancel, ol, IceGatherer, Cancel, puid, id, mID); if (isShutdown()) { - ZS_LOG_TRACE(log("already shutdown")) + ZS_LOG_TRACE(log("already shutdown")); return; } @@ -4273,12 +4275,12 @@ namespace ortc stepCleanPendingShutdownTURNSockets(); if (mShutdownTURNSockets.size() > 0) { - ZS_LOG_DEBUG(log("still waiting for some turn sockets to shutdown") + ZS_PARAM("total", mShutdownTURNSockets.size())) + ZS_LOG_DEBUG(log("still waiting for some turn sockets to shutdown") + ZS_PARAM("total", mShutdownTURNSockets.size())); return; } } - ZS_LOG_TRACE(log("cancel complete")) + ZS_LOG_TRACE(log("cancel complete")); setState(InternalState_Shutdown); @@ -4377,11 +4379,11 @@ namespace ortc mGracefulShutdownReference.reset(); - ZS_LOG_DETAIL(log("shutdown complete")) + ZS_LOG_DETAIL(log("shutdown complete")); } //------------------------------------------------------------------------- - void ICEGatherer::setState(InternalStates state) + void ICEGatherer::setState(InternalStates state) noexcept { if (state == mCurrentState) return; @@ -4408,13 +4410,13 @@ namespace ortc mSubscriptions.delegate()->onICEGathererLocalCandidateComplete(pThis, complete); } - ZS_LOG_TRACE(log("reporting state change to delegates") + ZS_PARAM("new state", IICEGathererTypes::toString(newState)) + ZS_PARAM("old state", IICEGathererTypes::toString(oldState))) + ZS_LOG_TRACE(log("reporting state change to delegates") + ZS_PARAM("new state", IICEGathererTypes::toString(newState)) + ZS_PARAM("old state", IICEGathererTypes::toString(oldState))); mSubscriptions.delegate()->onICEGathererStateChange(pThis, newState); } } //------------------------------------------------------------------------- - void ICEGatherer::setError(WORD error, const char *reason) + void ICEGatherer::setError(WORD error, const char *reason) noexcept { if (0 == error) return; if (0 != mLastError) return; @@ -4430,7 +4432,7 @@ namespace ortc string, reason, mLastErrorReason ); - ZS_LOG_WARNING(Detail, log("error set") + ZS_PARAMIZE(mLastError) + ZS_PARAMIZE(mLastErrorReason)) + ZS_LOG_WARNING(Detail, log("error set") + ZS_PARAMIZE(mLastError) + ZS_PARAMIZE(mLastErrorReason)); auto pThis = mThisWeak.lock(); if (pThis) { @@ -4439,7 +4441,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::hasSTUNServers() + bool ICEGatherer::hasSTUNServers() noexcept { if (mOptionsHash == mHasSTUNServersOptionsHash) { return mHasSTUNServers; @@ -4451,7 +4453,7 @@ namespace ortc for (auto iter = mOptions.mICEServers.begin(); iter != mOptions.mICEServers.end(); ++iter) { auto server = (*iter); if (isServerType(server, "stun:")) { - ZS_LOG_TRACE(log("found stun server") + server.toDebug()) + ZS_LOG_TRACE(log("found stun server") + server.toDebug()); mHasSTUNServers = true; return mHasSTUNServers; } @@ -4460,7 +4462,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::hasTURNServers() + bool ICEGatherer::hasTURNServers() noexcept { if (mOptionsHash == mHasTURNServersOptionsHash) { return mHasTURNServers; @@ -4472,7 +4474,7 @@ namespace ortc for (auto iter = mOptions.mICEServers.begin(); iter != mOptions.mICEServers.end(); ++iter) { auto server = (*iter); if (isServerType(server, "turn:")) { - ZS_LOG_TRACE(log("found turn server") + server.toDebug()) + ZS_LOG_TRACE(log("found turn server") + server.toDebug()); mHasTURNServers = true; return mHasTURNServers; } @@ -4484,23 +4486,23 @@ namespace ortc bool ICEGatherer::isServerType( const Server &server, const char *urlPrefix - ) const + ) const noexcept { size_t length = strlen(urlPrefix); if (server.mURLs.size() < 1) { - ZS_LOG_INSANE(log("server is not of url search type (no URLs found)") + server.toDebug() + ZS_PARAMIZE(urlPrefix)) + ZS_LOG_INSANE(log("server is not of url search type (no URLs found)") + server.toDebug() + ZS_PARAMIZE(urlPrefix)); return false; } for (auto iterURLs = server.mURLs.begin(); iterURLs != server.mURLs.end(); ++iterURLs) { const String &url = (*iterURLs); if (0 != url.compare(0, length, urlPrefix)) { - ZS_LOG_INSANE(log("server is not of url search type") + server.toDebug() + ZS_PARAMIZE(url) + ZS_PARAMIZE(urlPrefix)) + ZS_LOG_INSANE(log("server is not of url search type") + server.toDebug() + ZS_PARAMIZE(url) + ZS_PARAMIZE(urlPrefix)); return false; } - ZS_LOG_INSANE(log("found server of url search type") + server.toDebug() + ZS_PARAMIZE(url) + ZS_PARAMIZE(urlPrefix)) + ZS_LOG_INSANE(log("found server of url search type") + server.toDebug() + ZS_PARAMIZE(url) + ZS_PARAMIZE(urlPrefix)); } return true; @@ -4510,7 +4512,7 @@ namespace ortc IICEGathererTypes::StringList ICEGatherer::createDNSLookupString( const Server &server, const char *urlPrefix - ) const + ) const noexcept { size_t length = strlen(urlPrefix); @@ -4537,31 +4539,31 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::needsHostPort(HostIPSorter::DataPtr hostData) + bool ICEGatherer::needsHostPort(HostIPSorter::DataPtr hostData) noexcept { auto policy = hostData->mFilterPolicy; if (hostData->mIP.isIPv4()) { if (0 == (FilterPolicy_NoIPv4Host & policy)) { - ZS_LOG_TRACE(log("host port needed because peer host ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because peer host ports are not filtered")); return true; } if (0 == (FilterPolicy_NoIPv4Prflx & policy)) { - ZS_LOG_TRACE(log("host port needed because peer reflexive ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because peer reflexive ports are not filtered")); return true; } if (0 == (FilterPolicy_NoIPv4Srflx & policy)) { if (hasSTUNServers()) { - ZS_LOG_TRACE(log("host port needed because server reflexive ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because server reflexive ports are not filtered")); return true; } } if (0 == (FilterPolicy_NoIPv4Relay & policy)) { if (hasTURNServers()) { - ZS_LOG_TRACE(log("host port needed because relay ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because relay ports are not filtered")); return true; } } - ZS_LOG_TRACE(log("IPv4 host is being filtered") + hostData->toDebug()) + ZS_LOG_TRACE(log("IPv4 host is being filtered") + hostData->toDebug()); return false; } if (hostData->mIP.isIPv6()) { @@ -4571,37 +4573,37 @@ namespace ortc (hostData->mIP.isTeredoTunnel()) || (hostData->mInterfaceType == InterfaceType_Tunnel)) { if (0 != (FilterPolicy_NoIPv6Tunnel & policy)) { - ZS_LOG_TRACE(log("host port is not needed because peer host does not allow IPv6 tunnel address")) + ZS_LOG_TRACE(log("host port is not needed because peer host does not allow IPv6 tunnel address")); return false; } } if (!hostData->mIsTemporaryIP) { if (0 != (FilterPolicy_NoIPv6Permanent & policy)) { - ZS_LOG_TRACE(log("host port is not needed because permanent IP addresses are not allowed")) + ZS_LOG_TRACE(log("host port is not needed because permanent IP addresses are not allowed")); return false; } } if (0 == (FilterPolicy_NoIPv6Host & policy)) { - ZS_LOG_TRACE(log("host port needed because peer host ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because peer host ports are not filtered")); return true; } if (0 == (FilterPolicy_NoIPv6Prflx & policy)) { - ZS_LOG_TRACE(log("host port needed because peer reflexive ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because peer reflexive ports are not filtered")); return true; } if (0 == (FilterPolicy_NoIPv6Srflx & policy)) { if (hasSTUNServers()) { - ZS_LOG_TRACE(log("host port needed because server reflexive ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because server reflexive ports are not filtered")); return true; } } if (0 == (FilterPolicy_NoIPv6Relay & policy)) { if (hasTURNServers()) { - ZS_LOG_TRACE(log("host port needed because relay ports are not filtered")) + ZS_LOG_TRACE(log("host port needed because relay ports are not filtered")); return true; } } - ZS_LOG_TRACE(log("IPv4 host is being filtered") + hostData->toDebug()) + ZS_LOG_TRACE(log("IPv4 host is being filtered") + hostData->toDebug()); return false; } @@ -4609,11 +4611,11 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::shutdown(HostPortPtr hostPort) + void ICEGatherer::shutdown(HostPortPtr hostPort) noexcept { if (!hostPort) return; - ZS_LOG_TRACE(log("shutting down host port") + hostPort->toDebug()) + ZS_LOG_TRACE(log("shutting down host port") + hostPort->toDebug()); // scope: shutdown reflexive ports { @@ -4672,7 +4674,7 @@ namespace ortc try { hostPort->mBoundUDPSocket->close(); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_ERROR(Detail, log("failed to close udp socket") + ZS_PARAM("error", error.errorCode())) + ZS_LOG_ERROR(Detail, log("failed to close udp socket") + ZS_PARAM("error", error.errorCode())); } hostPort->mBoundUDPSocket.reset(); } @@ -4685,7 +4687,7 @@ namespace ortc try { hostPort->mBoundTCPSocket->close(); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_ERROR(Detail, log("failed to close tcp socket") + ZS_PARAM("error", error.errorCode())) + ZS_LOG_ERROR(Detail, log("failed to close tcp socket") + ZS_PARAM("error", error.errorCode())); } hostPort->mBoundTCPSocket.reset(); } @@ -4707,7 +4709,7 @@ namespace ortc string, hostPortIp, hostPort->mHostData->mIP.string() ); - ZS_LOG_TRACE(log("found host port to remote") + compareHostPort->toDebug()) + ZS_LOG_TRACE(log("found host port to remote") + compareHostPort->toDebug()); mHostPorts.erase(current); break; } @@ -4719,7 +4721,7 @@ namespace ortc auto route = (*current).second; if (route->mHostPort == hostPort) { - ZS_LOG_TRACE(log("route is mapped to closed host port (thus route must be closed)") + route->toDebug()) + ZS_LOG_TRACE(log("route is mapped to closed host port (thus route must be closed)") + route->toDebug()); removeRoute(route->mRouterRoute); } } @@ -4729,7 +4731,7 @@ namespace ortc void ICEGatherer::shutdown( ReflexivePortPtr reflexivePort, HostPortPtr ownerHostPort - ) + ) noexcept { if (!reflexivePort) return; @@ -4740,7 +4742,7 @@ namespace ortc string, firstServerUrl, reflexivePort->mServer.mURLs.size() > 0 ? reflexivePort->mServer.mURLs.front() : String() ); - ZS_LOG_TRACE(log("shutting down reflexive port") + reflexivePort->toDebug()) + ZS_LOG_TRACE(log("shutting down reflexive port") + reflexivePort->toDebug()); // scope: remote from host port { @@ -4752,7 +4754,7 @@ namespace ortc auto compareReflexivePort = (*current); if (compareReflexivePort != reflexivePort) continue; - ZS_LOG_TRACE(log("found relay port to remove from host port") + compareReflexivePort->toDebug()) + ZS_LOG_TRACE(log("found relay port to remove from host port") + compareReflexivePort->toDebug()); ownerHostPort->mReflexivePorts.erase(current); break; } @@ -4784,11 +4786,11 @@ namespace ortc void ICEGatherer::shutdown( RelayPortPtr relayPort, HostPortPtr ownerHostPort - ) + ) noexcept { if (!relayPort) return; - ZS_THROW_INVALID_ARGUMENT_IF(!ownerHostPort); + ZS_ASSERT(ownerHostPort); ZS_EVENTING_3( x, i, Debug, IceGathererRelayPortDestroy, ol, IceGatherer, Stop, @@ -4797,7 +4799,7 @@ namespace ortc string, firstServerUrl, relayPort->mServer.mURLs.size() > 0 ? relayPort->mServer.mURLs.front() : String() ); - ZS_LOG_TRACE(log("shutting down relay port") + relayPort->toDebug()) + ZS_LOG_TRACE(log("shutting down relay port") + relayPort->toDebug()); // scope: remote from host port { @@ -4809,7 +4811,7 @@ namespace ortc auto compareRelayPort = (*current); if (compareRelayPort != relayPort) continue; - ZS_LOG_TRACE(log("found relay port to remove from host port") + compareRelayPort->toDebug()) + ZS_LOG_TRACE(log("found relay port to remove from host port") + compareRelayPort->toDebug()); ownerHostPort->mRelayPorts.erase(current); break; } @@ -4853,7 +4855,7 @@ namespace ortc auto route = (*current).second; if (route->mRelayPort == relayPort) { - ZS_LOG_TRACE(log("route is mapped to closed relay port (thus route must be closed)") + route->toDebug()) + ZS_LOG_TRACE(log("route is mapped to closed relay port (thus route must be closed)") + route->toDebug()); removeRoute(route->mRouterRoute); } } @@ -4863,7 +4865,7 @@ namespace ortc void ICEGatherer::shutdown( TCPPortPtr tcpPort, HostPortPtr ownerHostPort - ) + ) noexcept { if (!tcpPort) return; @@ -4903,7 +4905,7 @@ namespace ortc try { tcpPort->mSocket->close(); } catch (Socket::Exceptions::Unspecified &error) { - ZS_LOG_ERROR(Detail, log("failed to close tcp port socket") + ZS_PARAM("error", error.errorCode())) + ZS_LOG_ERROR(Detail, log("failed to close tcp port socket") + ZS_PARAM("error", error.errorCode())); } tcpPort->mSocket.reset(); @@ -4918,7 +4920,7 @@ namespace ortc auto route = (*current).second; if (route->mTCPPort == tcpPort) { - ZS_LOG_TRACE(log("route is mapped to closed tcp socket (thus route must be closed)") + route->toDebug()) + ZS_LOG_TRACE(log("route is mapped to closed tcp socket (thus route must be closed)") + route->toDebug()); removeRoute(route->mRouterRoute); } } @@ -4931,7 +4933,7 @@ namespace ortc bool firstAttempt, IPAddress &ioBindIP, IICETypes::Protocols protocol - ) + ) noexcept { ZS_LOG_DEBUG(log("attempting to bind to IP") + ZS_PARAM("ip", ioBindIP.string())); @@ -4950,14 +4952,14 @@ namespace ortc if (firstAttempt) { // only bind using the default port in the first attempt ioBindIP.setPort(mDefaultPort); - ZS_LOG_DEBUG(log("will attempt to bind to default port") + ZS_PARAM("ip address", ioBindIP.string())) + ZS_LOG_DEBUG(log("will attempt to bind to default port") + ZS_PARAM("ip address", ioBindIP.string())); } else { - ZS_LOG_WARNING(Debug, log("will not attempt to rebind to default port") + ZS_PARAM("ip address", ioBindIP.string())) + ZS_LOG_WARNING(Debug, log("will not attempt to rebind to default port") + ZS_PARAM("ip address", ioBindIP.string())); } } else if (!firstAttempt) { WORD selectedPort = mPortRestriction.getRandomPosition(IHelper::random(0, 0xFFFF)); ioBindIP.setPort(selectedPort); - ZS_LOG_DEBUG(log("will attempt to bind to chosen port") + ZS_PARAM("ip address", ioBindIP.string())) + ZS_LOG_DEBUG(log("will attempt to bind to chosen port") + ZS_PARAM("ip address", ioBindIP.string())); } socket->bind(ioBindIP); @@ -4982,11 +4984,11 @@ namespace ortc ZS_THROW_CUSTOM_PROPERTIES_1(Socket::Exceptions::Unspecified, 0, String("OS port selection was within denied port range: " + string(bindPort))); } mDefaultPort = bindPort; - ZS_LOG_TRACE(log("selected default bind port") + ZS_PARAMIZE(mDefaultPort)) + ZS_LOG_TRACE(log("selected default bind port") + ZS_PARAMIZE(mDefaultPort)); } - ZS_THROW_CUSTOM_PROPERTIES_1_IF(Socket::Exceptions::Unspecified, 0 == bindPort, 0) + ZS_THROW_CUSTOM_PROPERTIES_1_IF(Socket::Exceptions::Unspecified, 0 == bindPort, 0); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_ERROR(Detail, log("bind error") + ZS_PARAM("error", error.errorCode())) + ZS_LOG_ERROR(Detail, log("bind error") + ZS_PARAM("error", error.errorCode())); socket.reset(); goto bind_failure; } @@ -4996,10 +4998,10 @@ namespace ortc case IICETypes::Protocol_TCP: { if (mGatherPassiveTCP) { try { - ZS_LOG_DEBUG(log("attemping to listen for incoming socket connections")) + ZS_LOG_DEBUG(log("attemping to listen for incoming socket connections")); socket->listen(); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_ERROR(Detail, log("listen error") + ZS_PARAM("error", error.errorCode())) + ZS_LOG_ERROR(Detail, log("listen error") + ZS_PARAM("error", error.errorCode())); socket.reset(); goto bind_failure; } @@ -5012,7 +5014,7 @@ namespace ortc bind_success: { - ZS_LOG_DEBUG(log("bind successful") + ZS_PARAM("bind ip", ioBindIP.string())) + ZS_LOG_DEBUG(log("bind successful") + ZS_PARAM("bind ip", ioBindIP.string())); outSocket = socket; outSocketDelegate = socketDelegate; return; @@ -5020,7 +5022,7 @@ namespace ortc bind_failure: { - ZS_LOG_WARNING(Debug, log("bind failure") + ZS_PARAM("bind ip", ioBindIP.string())) + ZS_LOG_WARNING(Debug, log("bind failure") + ZS_PARAM("bind ip", ioBindIP.string())); } } @@ -5031,7 +5033,7 @@ namespace ortc const IPAddress &boundIP, IICETypes::Protocols protocol, IICETypes::TCPCandidateTypes tcpType - ) + ) noexcept { CandidatePtr candidate(make_shared()); @@ -5085,7 +5087,7 @@ namespace ortc const IPAddress &relatedIP, const IPAddress &boundIP, const Server &server - ) + ) noexcept { IICETypes::Protocols protocol = IICETypes::Protocol_UDP; @@ -5143,12 +5145,12 @@ namespace ortc const HostIPSorter::Data &hostData, const IPAddress &ip, CandidatePtr candidate - ) + ) noexcept { if (!candidate) return; if (candidate->mCandidateType == IICETypes::CandidateType_Prflx) { - ZS_LOG_TRACE(log("must filter out peer reflexive candidates as they do not get notified")) + ZS_LOG_TRACE(log("must filter out peer reflexive candidates as they do not get notified")); return; } @@ -5173,7 +5175,7 @@ namespace ortc word, relatedPort, candidate->mRelatedPort ); - ZS_LOG_TRACE(log("this candidate is filtered") + candidate->toDebug()) + ZS_LOG_TRACE(log("this candidate is filtered") + candidate->toDebug()); return; } @@ -5185,7 +5187,7 @@ namespace ortc String notifyHash = candidate->hash(false); if (mLocalCandidates.find(localHash) != mLocalCandidates.end()) { - ZS_LOG_TRACE(log("canadidate already added") + candidate->toDebug()) + ZS_LOG_TRACE(log("canadidate already added") + candidate->toDebug()); return; } @@ -5216,7 +5218,7 @@ namespace ortc mLocalCandidates[localHash] = CandidatePair(candidate, notifyHash); if (!isUnique) { - ZS_LOG_TRACE(log("similar candidate already notified (thus do not notify of this candidate)") + candidate->toDebug()) + ZS_LOG_TRACE(log("similar candidate already notified (thus do not notify of this candidate)") + candidate->toDebug()); return; } @@ -5228,12 +5230,12 @@ namespace ortc CandidatePtr sendCandidate(make_shared(*candidate)); - ZS_LOG_DEBUG(log("notify local candidate") + candidate->toDebug()) + ZS_LOG_DEBUG(log("notify local candidate") + candidate->toDebug()); mSubscriptions.delegate()->onICEGathererLocalCandidate(mThisWeak.lock(), sendCandidate); } //------------------------------------------------------------------------- - void ICEGatherer::removeCandidate(CandidatePtr candidate) + void ICEGatherer::removeCandidate(CandidatePtr candidate) noexcept { if (!candidate) return; @@ -5242,7 +5244,7 @@ namespace ortc auto foundLocal = mLocalCandidates.find(localHash); if (foundLocal == mLocalCandidates.end()) { - ZS_LOG_WARNING(Debug, log("local candidate is not found (might have been filtered or was peer reflexive)") + candidate->toDebug()) + ZS_LOG_WARNING(Debug, log("local candidate is not found (might have been filtered or was peer reflexive)") + candidate->toDebug()); return; } @@ -5270,20 +5272,20 @@ namespace ortc auto foundUnique = mNotifiedCandidates.find(notifyHash); if (foundUnique == mNotifiedCandidates.end()) { - ZS_LOG_WARNING(Debug, log("unique candidate is not found") + candidate->toDebug()) + ZS_LOG_WARNING(Debug, log("unique candidate is not found") + candidate->toDebug()); return; } const String &previousLocalHash = (*foundUnique).second.second; if (previousLocalHash != localHash) { - ZS_LOG_TRACE(log("candidate being removed was not notified candidate") + candidate->toDebug()) + ZS_LOG_TRACE(log("candidate being removed was not notified candidate") + candidate->toDebug()); return; } CandidatePtr previousCandidate = (*foundUnique).second.first; - ZS_LOG_DEBUG(log("notify candidate gone") + previousCandidate->toDebug()) + ZS_LOG_DEBUG(log("notify candidate gone") + previousCandidate->toDebug()); CandidatePtr sendCandidate(make_shared(*previousCandidate)); auto pThis = mThisWeak.lock(); @@ -5305,17 +5307,17 @@ namespace ortc setState(InternalState_Gathering); } - CandidatePtr sendCandidate(make_shared(*otherCandidate)); + CandidatePtr sendNotifyCandidate(make_shared(*otherCandidate)); - ZS_LOG_DEBUG(log("notify replacement local candidate") + otherCandidate->toDebug()) + ZS_LOG_DEBUG(log("notify replacement local candidate") + otherCandidate->toDebug()); if (pThis) { - mSubscriptions.delegate()->onICEGathererLocalCandidate(mThisWeak.lock(), sendCandidate); + mSubscriptions.delegate()->onICEGathererLocalCandidate(mThisWeak.lock(), sendNotifyCandidate); } return; } } - ZS_LOG_TRACE(log("no replacement local candidate found")) + ZS_LOG_TRACE(log("no replacement local candidate found")); } //------------------------------------------------------------------------- @@ -5323,7 +5325,7 @@ namespace ortc FilterPolicies policy, const IPAddress &ip, const Candidate &candidate - ) const + ) const noexcept { switch (candidate.mCandidateType) { case IICETypes::CandidateType_Host: { @@ -5375,7 +5377,7 @@ namespace ortc bool ICEGatherer::read( HostPortPtr hostPort, SocketPtr socket - ) + ) noexcept { UseTURNSocketPtr turnSocket; STUNPacketPtr stunPacket; @@ -5401,9 +5403,9 @@ namespace ortc if (0 == totalRead) { if (wouldBlock) { - ZS_LOG_INSANE(log("socket read would block") + ZS_PARAM("socket", string(socket))) + ZS_LOG_INSANE(log("socket read would block") + ZS_PARAM("socket", string(socket))); } else { - ZS_LOG_WARNING(Debug, log("failed to read any data from socket") + ZS_PARAM("socket", string(socket))) + ZS_LOG_WARNING(Debug, log("failed to read any data from socket") + ZS_PARAM("socket", string(socket))); } return false; } @@ -5438,7 +5440,7 @@ namespace ortc // this is not a relay socket, see if there is a route localCandidate = hostPort->mCandidateUDP; if (!localCandidate) { - ZS_LOG_WARNING(Trace, log("did not find local candidate")) + ZS_LOG_WARNING(Trace, log("did not find local candidate")); goto unknown_handler; } goto handle_incoming; @@ -5446,8 +5448,8 @@ namespace ortc if (hostPort->mBoundTCPSocket == socket) { if (mGatherPassiveTCP) { - ZS_THROW_INVALID_ASSUMPTION_IF(!hostPort->mCandidateTCPPassive) - ZS_LOG_DEBUG(log("notified of incoming TCP connection") + hostPort->toDebug()) + ZS_ASSERT(hostPort->mCandidateTCPPassive); + ZS_LOG_DEBUG(log("notified of incoming TCP connection") + hostPort->toDebug()); TCPPortPtr tcpPort(make_shared()); tcpPort->mConnected = true; @@ -5458,12 +5460,12 @@ namespace ortc bool wouldBlock = false; tcpPort->mSocket = socket->accept(tcpPort->mRemoteIP, &wouldBlock); if (wouldBlock) { - ZS_LOG_INSANE(log("no more sockets to accept") + tcpPort->toDebug()) + ZS_LOG_INSANE(log("no more sockets to accept") + tcpPort->toDebug()); return false; } localAddress = socket->getLocalAddress(); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_WARNING(Detail, log("failed to accept incoming TCP connection") + ZS_PARAM("error", error.errorCode())) + ZS_LOG_WARNING(Detail, log("failed to accept incoming TCP connection") + ZS_PARAM("error", error.errorCode())); return false; } @@ -5485,7 +5487,7 @@ namespace ortc mTCPCandidateToTCPPorts[tcpPort->mCandidate] = tcpPort; - ZS_LOG_DEBUG(log("incoming connection ready") + hostPort->toDebug() + tcpPort->toDebug()) + ZS_LOG_DEBUG(log("incoming connection ready") + hostPort->toDebug() + tcpPort->toDebug()); return true; } } @@ -5497,7 +5499,7 @@ namespace ortc { if (stunPacket) { if (ISTUNRequester::handleSTUNPacket(fromIP, stunPacket)) { - ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); return true; } } @@ -5517,16 +5519,16 @@ namespace ortc if (stunPacket) { if (ISTUNRequester::handleSTUNPacket(fromIP, stunPacket)) { - ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); return true; } - ZS_LOG_INSANE(log("forwarding stun packet to turn socket") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_INSANE(log("forwarding stun packet to turn socket") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); turnSocket->handleSTUNPacket(fromIP, stunPacket); return true; } - ZS_LOG_INSANE(log("forwarding turn channel data to turn socket") + ZS_PARAM("from ip", fromIP.string()) + ZS_PARAM("total", totalRead)) + ZS_LOG_INSANE(log("forwarding turn channel data to turn socket") + ZS_PARAM("from ip", fromIP.string()) + ZS_PARAM("total", totalRead)); turnSocket->handleChannelData(fromIP, &(readBuffer[0]), totalRead); return true; } @@ -5535,11 +5537,11 @@ namespace ortc { if (stunPacket) { if (ISTUNRequester::handleSTUNPacket(fromIP, stunPacket)) { - ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); return true; } - ZS_LOG_INSANE(log("handling incoming stun packet") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_INSANE(log("handling incoming stun packet") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); auto response = handleIncomingPacket(localCandidate, fromIP, stunPacket); if (response) { AutoRecursiveLock lock(*this); @@ -5547,15 +5549,15 @@ namespace ortc if (hostPort->mBoundUDPSocket) { auto result = sendUDPPacket(socket, hostPort->mBoundUDPIP, fromIP, *response, response->SizeInBytes()); if (!result) { - ZS_LOG_WARNING(Debug, log("failed to send response packet to stun request") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to send response packet to stun request") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); } } else { - ZS_LOG_WARNING(Debug, log("cannot send response as socket is gone") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()) + ZS_LOG_WARNING(Debug, log("cannot send response as socket is gone") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + stunPacket->toDebug()); } } return true; } - ZS_LOG_INSANE(log("handling incoming packet") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + ZS_PARAM("total", totalRead)) + ZS_LOG_INSANE(log("handling incoming packet") + localCandidate->toDebug() + ZS_PARAM("from ip", fromIP.string()) + ZS_PARAM("total", totalRead)); handleIncomingPacket(localCandidate, fromIP, &(readBuffer[0]), totalRead); return true; } @@ -5563,10 +5565,11 @@ namespace ortc //------------------------------------------------------------------------- void ICEGatherer::read( - HostPort &hostPort, + ZS_MAYBE_USED() HostPort &hostPort, TCPPort &tcpPort - ) + ) noexcept { + ZS_MAYBE_USED(hostPort); BufferedPacketList packets; CandidatePtr localCandidate; @@ -5646,7 +5649,7 @@ namespace ortc nothing_more_to_parse: { - ZS_LOG_INSANE(log("nothing more to parse at this time") + ZS_PARAM("packets found", packets.size()) + tcpPort.toDebug()) + ZS_LOG_INSANE(log("nothing more to parse at this time") + ZS_PARAM("packets found", packets.size()) + tcpPort.toDebug()); } } } @@ -5658,17 +5661,17 @@ namespace ortc if (packet->mSTUNPacket) { if (ISTUNRequester::handleSTUNPacket(fromIP, packet->mSTUNPacket)) { - ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + packet->mSTUNPacket->toDebug()) + ZS_LOG_TRACE(log("handled by stun requester") + ZS_PARAM("from ip", fromIP.string()) + packet->mSTUNPacket->toDebug()); continue; } - ZS_LOG_TRACE(log("handling incoming TCP stun packet") + packet->toDebug() + packet->mSTUNPacket->toDebug()) + ZS_LOG_TRACE(log("handling incoming TCP stun packet") + packet->toDebug() + packet->mSTUNPacket->toDebug()); auto response = handleIncomingPacket(localCandidate, fromIP, packet->mSTUNPacket); if (response) { AutoRecursiveLock lock(*this); if (tcpPort.mSocket) { - ZS_LOG_TRACE(log("sending packet response by putting into TCP send queue") + tcpPort.toDebug()) + ZS_LOG_TRACE(log("sending packet response by putting into TCP send queue") + tcpPort.toDebug()); // put the buffer at the end of the queue CryptoPP::word16 packeSize = ((CryptoPP::word16)(response->SizeInBytes())); @@ -5677,17 +5680,17 @@ namespace ortc tcpPort.mOutgoingBuffer.Put(*response, response->SizeInBytes()); if ((tcpPort.mConnected) && (tcpPort.mWriteReady)) { - ZS_LOG_INSANE(log("simulate TCP write ready to force the packet to send immediately")) + ZS_LOG_INSANE(log("simulate TCP write ready to force the packet to send immediately")); ISocketDelegateProxy::create(mThisWeak.lock())->onWriteReady(tcpPort.mSocket); } } else { - ZS_LOG_WARNING(Debug, log("socket is now gone thus response cannot be sent") + tcpPort.toDebug() + ZS_PARAM("from ip", fromIP.string()) + packet->mSTUNPacket->toDebug()) + ZS_LOG_WARNING(Debug, log("socket is now gone thus response cannot be sent") + tcpPort.toDebug() + ZS_PARAM("from ip", fromIP.string()) + packet->mSTUNPacket->toDebug()); } } continue; } - ZS_LOG_INSANE(log("handling incoming TCP packet") + packet->toDebug()) + ZS_LOG_INSANE(log("handling incoming TCP packet") + packet->toDebug()); handleIncomingPacket(localCandidate, fromIP, *(packet->mBuffer), packet->mBuffer->SizeInBytes()); } } @@ -5697,7 +5700,7 @@ namespace ortc void ICEGatherer::write( HostPort &hostPort, SocketPtr socket - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -5718,7 +5721,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::writeIfTCPPort(SocketPtr socket) + bool ICEGatherer::writeIfTCPPort(SocketPtr socket) noexcept { auto found = mTCPPorts.find(socket); if (found == mTCPPorts.end()) return false; @@ -5732,7 +5735,7 @@ namespace ortc ); if (!tcpPort.mSocket) { - ZS_LOG_WARNING(Detail, log("tcp port was closed during write notification") + tcpPort.toDebug()) + ZS_LOG_WARNING(Detail, log("tcp port was closed during write notification") + tcpPort.toDebug()); return true; } @@ -5773,7 +5776,7 @@ namespace ortc size, size, sent ); - ZS_LOG_INSANE(log("sent TCP data to remote party") + tcpPort.toDebug() + ZS_PARAM("sent", sent)) + ZS_LOG_INSANE(log("sent TCP data to remote party") + tcpPort.toDebug() + ZS_PARAM("sent", sent)); // consume the amount sent from the pending queue (and try sending more) tcpPort.mOutgoingBuffer.Skip(sent); @@ -5801,14 +5804,14 @@ namespace ortc void ICEGatherer::close( HostPortPtr hostPort, SocketPtr socket - ) + ) noexcept { - ZS_THROW_INVALID_ARGUMENT_IF(!hostPort) + ZS_ASSERT(hostPort); AutoRecursiveLock lock(*this); if ((hostPort->mBoundUDPSocket != socket) && (hostPort->mBoundTCPSocket != socket)) { - ZS_LOG_WARNING(Detail, log("socket was not found on host port") + hostPort->toDebug() + ZS_PARAM("socket", string(socket))) + ZS_LOG_WARNING(Detail, log("socket was not found on host port") + hostPort->toDebug() + ZS_PARAM("socket", string(socket))); return; } @@ -5826,7 +5829,7 @@ namespace ortc CandidatePtr &candidate1 = (hostPort->mBoundUDPSocket == socket ? hostPort->mCandidateUDP : hostPort->mCandidateTCPPassive); CandidatePtr &candidate2 = (hostPort->mBoundUDPSocket == socket ? ingored : hostPort->mCandidateTCPActive); - ZS_LOG_WARNING(Detail, log("bound UDP or TCP socket unexpectedly closed") + hostPort->toDebug() + ZS_PARAM("socket", string(socket))) + ZS_LOG_WARNING(Detail, log("bound UDP or TCP socket unexpectedly closed") + hostPort->toDebug() + ZS_PARAM("socket", string(socket))); auto found = mHostPortSockets.find(socket); if (found != mHostPortSockets.end()) { @@ -5836,7 +5839,7 @@ namespace ortc try { socket->close(); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_ERROR(Detail, log("unable to close socket") + ZS_PARAM("error", error.errorCode()) + hostPort->toDebug()) + ZS_LOG_ERROR(Detail, log("unable to close socket") + ZS_PARAM("error", error.errorCode()) + hostPort->toDebug()); } socket.reset(); @@ -5863,13 +5866,13 @@ namespace ortc void ICEGatherer::close( TCPPortPtr tcpPort, HostPortPtr ownerHostPort - ) + ) noexcept { - ZS_THROW_INVALID_ARGUMENT_IF(!tcpPort) - ZS_THROW_INVALID_ARGUMENT_IF(!ownerHostPort) + ZS_ASSERT(tcpPort); + ZS_ASSERT(ownerHostPort); AutoRecursiveLock lock(*this); - ZS_LOG_DEBUG(log("tcp port is closing") + tcpPort->toDebug()) + ZS_LOG_DEBUG(log("tcp port is closing") + tcpPort->toDebug()); shutdown(tcpPort, ownerHostPort); } @@ -5878,7 +5881,7 @@ namespace ortc CandidatePtr localCandidate, const IPAddress &remoteIP, STUNPacketPtr stunPacket - ) + ) noexcept { RoutePtr route; RouterRoutePtr routerRoute; @@ -5896,10 +5899,10 @@ namespace ortc // scope: search for existing route { - auto route = installRoute(localCandidate, remoteIP, UseICETransportPtr()); - if (route) { - routerRoute = route->mRouterRoute; - transport = route->mTransport.lock(); + auto routeInstalled = installRoute(localCandidate, remoteIP, UseICETransportPtr()); + if (routeInstalled) { + routerRoute = routeInstalled->mRouterRoute; + transport = routeInstalled->mTransport.lock(); if (transport) goto found_transport; } @@ -5912,7 +5915,7 @@ namespace ortc auto pos = username.find(':'); if (pos == String::npos) { - ZS_LOG_WARNING(Debug, log("stun packet does not contain a proper username") + stunPacket->toDebug()) + ZS_LOG_WARNING(Debug, log("stun packet does not contain a proper username") + stunPacket->toDebug()); goto stun_failed_validation; } @@ -5920,7 +5923,7 @@ namespace ortc rFrag = username.substr(pos+1); if (lFrag != mUsernameFrag) { - ZS_LOG_WARNING(Debug, log("stun packet does not contain expected username") + ZS_PARAM("expecting", mUsernameFrag) + stunPacket->toDebug()) + ZS_LOG_WARNING(Debug, log("stun packet does not contain expected username") + ZS_PARAM("expecting", mUsernameFrag) + stunPacket->toDebug()); goto stun_failed_validation; } @@ -5943,18 +5946,18 @@ namespace ortc auto installedTransport = (*found).second; transport = installedTransport->mTransport.lock(); if (!transport) { - ZS_LOG_WARNING(Debug, log("transport is now gone") + ZS_PARAM("transport id", installedTransport->mTransportID) + stunPacket->toDebug()) + ZS_LOG_WARNING(Debug, log("transport is now gone") + ZS_PARAM("transport id", installedTransport->mTransportID) + stunPacket->toDebug()); mInstalledTransports.erase(found); goto buffer_data_now; } route = installRoute(localCandidate, remoteIP, transport); if (!route) { - ZS_LOG_WARNING(Debug, log("failed to install route thus must buffer data") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("transport", transport->getID())) + ZS_LOG_WARNING(Debug, log("failed to install route thus must buffer data") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("transport", transport->getID())); goto buffer_data_now; } - ZS_LOG_DEBUG(log("installed new route") + route->toDebug()) + ZS_LOG_DEBUG(log("installed new route") + route->toDebug()); routerRoute = route->mRouterRoute; goto found_transport; } @@ -5973,7 +5976,7 @@ namespace ortc puid, routerRouteId, routerRoute->mID, bool, wasBuffered, false ); - stunPacket->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *stunPacket, "forwarding packet to transport"); transport->notifyPacket(routerRoute, stunPacket); return SecureByteBlockPtr(); } @@ -5995,8 +5998,8 @@ namespace ortc puid, routerRouteId, routerRoute ? routerRoute->mID : static_cast(0) ); - ZS_LOG_ERROR(Debug, log("candidate password integrity failed") + ZS_PARAM("request", stunPacket->toDebug()) + ZS_PARAM("reply", response->toDebug())) - response->trace(__func__); + ZS_LOG_ERROR(Debug, log("candidate password integrity failed") + ZS_PARAM("request", stunPacket->toDebug()) + ZS_PARAM("reply", response->toDebug())); + ZS_EVENTING_TRACE_OBJECT(Debug, *response, "candidate password integrity check failed"); return response->packetize(STUNPacket::RFC_5245_ICE); } @@ -6006,7 +6009,7 @@ namespace ortc routerRoute = mGathererRouter->findRoute(localCandidate, remoteIP, true); } if (!routerRoute) { - ZS_LOG_WARNING(Detail, log("unable to create router route (thus must ignore incoming packet)") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + stunPacket->toDebug()) + ZS_LOG_WARNING(Detail, log("unable to create router route (thus must ignore incoming packet)") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + stunPacket->toDebug()); return SecureByteBlockPtr(); } @@ -6023,9 +6026,9 @@ namespace ortc puid, id, mID, puid, routerRouteId, routerRoute->mID ); - stunPacket->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *stunPacket, "buffering packet where no transport is installed"); - ZS_LOG_TRACE(log("buffering stun packet until ice transport installed to handle packet") + packet->toDebug()) + ZS_LOG_TRACE(log("buffering stun packet until ice transport installed to handle packet") + packet->toDebug()); mBufferedPackets.push_back(packet); if (!mCleanUpBufferingTimer) { @@ -6041,7 +6044,7 @@ namespace ortc const IPAddress &remoteIP, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { RoutePtr route; RouterRoutePtr routerRoute; @@ -6087,7 +6090,7 @@ namespace ortc routerRoute = mGathererRouter->findRoute(localCandidate, remoteIP, true); } if (!routerRoute) { - ZS_LOG_WARNING(Detail, log("unable to create router route (thus must ignore incoming packet)") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("size", bufferSizeInBytes)) + ZS_LOG_WARNING(Detail, log("unable to create router route (thus must ignore incoming packet)") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("size", bufferSizeInBytes)); return; } @@ -6108,7 +6111,7 @@ namespace ortc size, size, bufferSizeInBytes ); - ZS_LOG_TRACE(log("buffering packet until ice transport installed to handle packet") + packet->toDebug()) + ZS_LOG_TRACE(log("buffering packet until ice transport installed to handle packet") + packet->toDebug()); mBufferedPackets.push_back(packet); if (!mCleanUpBufferingTimer) { @@ -6118,7 +6121,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICETypes::CandidatePtr ICEGatherer::findSentFromLocalCandidate(RouterRoutePtr routerRoute) + IICETypes::CandidatePtr ICEGatherer::findSentFromLocalCandidate(RouterRoutePtr routerRoute) noexcept { CandidatePtr result; @@ -6192,9 +6195,9 @@ namespace ortc done: { if (result) { - ZS_LOG_TRACE(log("sent from local candidate found") + result->toDebug() + routerRoute->toDebug()) + ZS_LOG_TRACE(log("sent from local candidate found") + result->toDebug() + routerRoute->toDebug()); } else { - ZS_LOG_WARNING(Detail, log("no sent from local candidate found for router route") + routerRoute->toDebug()) + ZS_LOG_WARNING(Detail, log("no sent from local candidate found for router route") + routerRoute->toDebug()); } } @@ -6205,7 +6208,7 @@ namespace ortc ICEGatherer::RoutePtr ICEGatherer::installRoute( RouterRoutePtr routerRoute, UseICETransportPtr transport - ) + ) noexcept { RoutePtr route; @@ -6228,7 +6231,7 @@ namespace ortc remove_existing_route: { - ZS_LOG_WARNING(Debug, log("previous route must be removed") + route->toDebug() + routerRoute->toDebug() + ZS_PARAM("transport id", transport ? transport->getID() : 0)) + ZS_LOG_WARNING(Debug, log("previous route must be removed") + route->toDebug() + routerRoute->toDebug() + ZS_PARAM("transport id", transport ? transport->getID() : 0)); removeRoute(route->mRouterRoute); goto install_new_route; } @@ -6237,7 +6240,7 @@ namespace ortc { CandidatePtr sentFromLocalCandidate = findSentFromLocalCandidate(routerRoute); if (!sentFromLocalCandidate) { - ZS_LOG_WARNING(Detail, log("unable to find local candidate for router route") + routerRoute->toDebug()) + ZS_LOG_WARNING(Detail, log("unable to find local candidate for router route") + routerRoute->toDebug()); return RoutePtr(); } return installRoute(sentFromLocalCandidate, routerRoute->mRemoteIP, transport); @@ -6249,7 +6252,7 @@ namespace ortc CandidatePtr sentFromLocalCandidate, const IPAddress &remoteIP, UseICETransportPtr transport - ) + ) noexcept { LocalCandidateRemoteIPPair search(sentFromLocalCandidate, remoteIP); @@ -6282,7 +6285,7 @@ namespace ortc remove_existing_route: { - ZS_LOG_WARNING(Debug, log("previous route must be removed") + route->toDebug() + ZS_PARAM("transport id", transport ? transport->getID() : 0)) + ZS_LOG_WARNING(Debug, log("previous route must be removed") + route->toDebug() + ZS_PARAM("transport id", transport ? transport->getID() : 0)); removeRoute(route->mRouterRoute); goto create_new_route; } @@ -6290,7 +6293,7 @@ namespace ortc create_new_route: { if (!transport) { - ZS_LOG_WARNING(Trace, log("transport to install was not found")) + ZS_LOG_WARNING(Trace, log("transport to install was not found")); return RoutePtr(); } @@ -6302,7 +6305,7 @@ namespace ortc route->mTransportID = transport->getID(); route->mTransport = transport; - ZS_LOG_DEBUG(log("installing new route") + route->toDebug()) + ZS_LOG_DEBUG(log("installing new route") + route->toDebug()); // scope: figure out how to route outgoing packets { @@ -6329,8 +6332,8 @@ namespace ortc if ((hostPort->mCandidateTCPPassive == sentFromLocalCandidate) || (hostPort->mCandidateTCPActive == sentFromLocalCandidate)) { // search for an incoming or outgoing TCP connection that satisfies the requirement - for (auto iter = hostPort->mTCPPorts.begin(); iter != hostPort->mTCPPorts.end(); ++iter) { - auto tcpPort = (*iter).second.second; + for (auto iterTcpPorts = hostPort->mTCPPorts.begin(); iterTcpPorts != hostPort->mTCPPorts.end(); ++iterTcpPorts) { + auto tcpPort = (*iterTcpPorts).second.second; auto tcpPortTransport = tcpPort->mTransport.lock(); if (tcpPort->mRemoteIP != remoteIP) continue; // must be connecting to/from same remote location @@ -6349,7 +6352,7 @@ namespace ortc goto resolved_local_candidate; } - ZS_LOG_DEBUG(log("no existing TCP ports found that can satisfy this route") + sentFromLocalCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("transport", transport->getID())) + ZS_LOG_DEBUG(log("no existing TCP ports found that can satisfy this route") + sentFromLocalCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("transport", transport->getID())); TCPPortPtr tcpPort(make_shared()); @@ -6382,7 +6385,7 @@ namespace ortc tcpPort->mSocket->setDelegate(tcpPort->mSocketDelegateHolder); tcpPort->mSocket->connect(remoteIP, &woudlBlock); } catch(Socket::Exceptions::Unspecified &error) { - ZS_LOG_WARNING(Detail, log("failed to create an outgoing TCP connection") + ZS_PARAM("error", error.errorCode()) + ZS_PARAM("local ip", localIP.string()) + ZS_PARAM("remote ip", remoteIP.string())) + ZS_LOG_WARNING(Detail, log("failed to create an outgoing TCP connection") + ZS_PARAM("error", error.errorCode()) + ZS_PARAM("local ip", localIP.string()) + ZS_PARAM("remote ip", remoteIP.string())); tcpPort->mSocket.reset(); goto failed_resolve_local_candidate; } @@ -6393,7 +6396,7 @@ namespace ortc mTCPPorts[tcpPort->mSocket] = HostAndTCPPortPair(hostPort, tcpPort); mTCPCandidateToTCPPorts[tcpPort->mCandidate] = tcpPort; - ZS_LOG_DEBUG(log("created outgoing TCP connection for use in route") + tcpPort->toDebug() + route->toDebug()) + ZS_LOG_DEBUG(log("created outgoing TCP connection for use in route") + tcpPort->toDebug() + route->toDebug()); goto resolved_local_candidate; } @@ -6439,23 +6442,23 @@ namespace ortc route->mRouterRoute = mGathererRouter->findRoute(route->mLocalCandidate, remoteIP, true); if (!route->mRouterRoute) { - ZS_LOG_WARNING(Detail, log("failed to create router route") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("failed to create router route") + route->toDebug()); return RoutePtr(); } removeRoute(route->mRouterRoute); if (!transport) { - ZS_LOG_WARNING(Detail, log("transport to install route was not found")) + ZS_LOG_WARNING(Detail, log("transport to install route was not found")); goto failed_resolve_local_candidate; } - route->trace(__func__, "install route"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "install route"); ZS_LOG_TRACE(log("installing route") + route->toDebug()); ZS_EVENTING_4( - x, i, Debug, IceGathererInstallQuickRoute, ol, IceGatherer, Receive, + x, i, Debug, IceGathererInstallQuickRoute, ol, IceGatherer, Install, puid, id, mID, pointer, candidate, search.first.get(), string, ip, search.second.string(), @@ -6471,16 +6474,14 @@ namespace ortc failed_resolve_local_candidate: { - ZS_LOG_WARNING(Detail, log("failed to find any local candidate to route packets") + sentFromLocalCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("transport", transport->getID())) + ZS_LOG_WARNING(Detail, log("failed to find any local candidate to route packets") + sentFromLocalCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("transport", transport->getID())); return RoutePtr(); } } - - return route; } //----------------------------------------------------------------------- - void ICEGatherer::fix(STUNPacketPtr stun) const + void ICEGatherer::fix(STUNPacketPtr stun) const noexcept { stun->mLogObject = "ortc::ICEGatherer"; stun->mLogObjectID = mID; @@ -6490,7 +6491,7 @@ namespace ortc void ICEGatherer::removeAllRelatedRoutes( TransportID transportID, UseICETransportPtr transportIfAvailable - ) + ) noexcept { for (auto iter_doNotUse = mQuickSearchRoutes.begin(); iter_doNotUse != mQuickSearchRoutes.end();) { @@ -6508,7 +6509,7 @@ namespace ortc puid, routeId, route->mID ); - ZS_LOG_WARNING(Detail, log("need to remove route because of unbinding previous transport") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("need to remove route because of unbinding previous transport") + route->toDebug()); mQuickSearchRoutes.erase(current); } @@ -6521,9 +6522,9 @@ namespace ortc auto route = (*current).second; if (route->mTransportID != transportID) continue; - route->trace(__func__, "remove all related"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "need to remove route because of unbinding previous transport"); - ZS_LOG_WARNING(Detail, log("need to remove route because of unbinding previous transport") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("need to remove route because of unbinding previous transport") + route->toDebug()); mRoutes.erase(current); } @@ -6536,7 +6537,7 @@ namespace ortc const IPAddress &remoteIP, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { if (!socket) return false; if (!buffer) return true; @@ -6555,7 +6556,7 @@ namespace ortc ); auto sent = socket->sendTo(remoteIP, buffer, bufferSizeInBytes, &wouldBlock); - ZS_LOG_INSANE(log("packet sent") + ZS_PARAM("socket", string(socket)) + ZS_PARAM("to", remoteIP.string()) + ZS_PARAM("from", boundIP.string()) + ZS_PARAM("size", bufferSizeInBytes)) + ZS_LOG_INSANE(log("packet sent") + ZS_PARAM("socket", string(socket)) + ZS_PARAM("to", remoteIP.string()) + ZS_PARAM("from", boundIP.string()) + ZS_PARAM("size", bufferSizeInBytes)); if (sent == bufferSizeInBytes) return true; } catch(Socket::Exceptions::Unspecified &error) { @@ -6564,12 +6565,12 @@ namespace ortc return false; } - ZS_LOG_WARNING(Trace, log("could not send packet at this time") + ZS_PARAM("socket", string(socket)) + ZS_PARAM("to", remoteIP.string()) + ZS_PARAM("from", boundIP.string()) + ZS_PARAM("size", bufferSizeInBytes)) + ZS_LOG_WARNING(Trace, log("could not send packet at this time") + ZS_PARAM("socket", string(socket)) + ZS_PARAM("to", remoteIP.string()) + ZS_PARAM("from", boundIP.string()) + ZS_PARAM("size", bufferSizeInBytes)); return false; } //------------------------------------------------------------------------- - bool ICEGatherer::shouldKeepWarm() const + bool ICEGatherer::shouldKeepWarm() const noexcept { if (mKeepWarmSinceJustCreated) return true; if (mTransportsStillNeedsCandidates) return true; @@ -6577,14 +6578,14 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::shouldWarmUpAfterInterfaceBinding() const + bool ICEGatherer::shouldWarmUpAfterInterfaceBinding() const noexcept { if (Time() != mWarmUpAfterNewInterfaceBindingUntil) return true; return false; } //------------------------------------------------------------------------- - void ICEGatherer::fixSTUNParserOptions(const STUNPacketPtr &packet) + void ICEGatherer::fixSTUNParserOptions(const STUNPacketPtr &packet) noexcept { if (mSTUNPacketParseOptions.mBindResponseRequiresUsernameAttribute) return; // already "fixed" broken ICE @@ -6600,15 +6601,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::HostIPSorter - #pragma mark + // + // ICEGatherer::HostIPSorter + // //------------------------------------------------------------------------- - bool ICEGatherer::HostIPSorter::compareLocalIPs(const DataPtr &pData1, const DataPtr &pData2) + bool ICEGatherer::HostIPSorter::compareLocalIPs(const DataPtr &pData1, const DataPtr &pData2) noexcept { - ZS_THROW_INVALID_ARGUMENT_IF(!pData1) - ZS_THROW_INVALID_ARGUMENT_IF(!pData2) + ZS_ASSERT(pData1); + ZS_ASSERT(pData2); const Data &data1 = (*pData1); const Data &data2 = (*pData2); @@ -6643,7 +6644,7 @@ namespace ortc ICEGatherer::HostIPSorter::DataPtr ICEGatherer::HostIPSorter::prepare( const IPAddress &ip, const Options &options - ) + ) noexcept { DataPtr data(make_shared()); data->mIP = ip; @@ -6658,7 +6659,7 @@ namespace ortc const char *hostName, const IPAddress &ip, const Options &options - ) + ) noexcept { DataPtr data(make_shared()); data->mHostName = String(hostName); @@ -6676,7 +6677,7 @@ namespace ortc const IPAddress &ip, const InterfaceMappingList &prefs, const Options &options - ) + ) noexcept { DataPtr data(make_shared()); data->mInterfaceName = String(interfaceName); @@ -6695,7 +6696,7 @@ namespace ortc ULONG metric, const InterfaceMappingList &prefs, const Options &options - ) + ) noexcept { DataPtr data(make_shared()); data->mInterfaceName = String(interfaceName); @@ -6713,7 +6714,7 @@ namespace ortc const IPAddress &ip, const InterfaceMappingList &prefs, const Options &options - ) + ) noexcept { DataPtr data(make_shared()); data->mInterfaceName = String(interfaceName); @@ -6727,7 +6728,7 @@ namespace ortc void ICEGatherer::HostIPSorter::fixMapping( Data &ioData, const InterfaceMappingList &prefs - ) + ) noexcept { for (int loop = 0; loop < 2; ++loop) { const String &useValue = (0 == loop ? ioData.mInterfaceName : ioData.mInterfaceDescription); @@ -6751,7 +6752,7 @@ namespace ortc ioData.mIndex = Numeric(numStr); goto number_found; } catch(const Numeric::ValueOutOfRange &) { - ZS_LOG_WARNING(Detail, slog("number failed to convert") + ZS_PARAM("number", numStr) + ioData.toDebug()) + ZS_LOG_WARNING(Detail, slog("number failed to convert") + ZS_PARAM("number", numStr) + ioData.toDebug()); } } } @@ -6762,13 +6763,13 @@ namespace ortc const InterfaceNameMappingInfo &info = (*iter); if (info.mInterfaceNameRegularExpression.isEmpty()) { - ZS_LOG_WARNING(Detail, slog("invalid regular expression") + info.toDebug()) + ZS_LOG_WARNING(Detail, slog("invalid regular expression") + info.toDebug()); continue; } if ((ioData.mInterfaceName.isEmpty()) && (ioData.mInterfaceDescription.isEmpty())) { - ZS_LOG_TRACE(slog("no interface information found") + ioData.toDebug()) + ZS_LOG_TRACE(slog("no interface information found") + ioData.toDebug()); } String exp = info.mInterfaceNameRegularExpression; @@ -6792,7 +6793,7 @@ namespace ortc found_match: { - ZS_LOG_TRACE(slog("fixed mapping interface type to ip") + ioData.toDebug() + info.toDebug()) + ZS_LOG_TRACE(slog("fixed mapping interface type to ip") + ioData.toDebug() + info.toDebug()); ioData.mOrderIndex = info.mOrderIndex; if (InterfaceType_Unknown == ioData.mInterfaceType) { @@ -6819,23 +6820,23 @@ namespace ortc void ICEGatherer::HostIPSorter::fixPolicy( Data &ioData, const Options &options - ) + ) noexcept { FilterPolicies defaultPolicy = FilterPolicy_None; for (auto iter = options.mInterfacePolicies.begin(); iter != options.mInterfacePolicies.end(); ++iter) { auto interfacePolicy = (*iter); InterfaceTypes interfaceType = toInterfaceType(interfacePolicy.mInterfaceType); if (InterfaceType_Unknown == interfaceType) { - ZS_LOG_WARNING(Debug, slog("interface type is not understood") + interfacePolicy.toDebug()) + ZS_LOG_WARNING(Debug, slog("interface type is not understood") + interfacePolicy.toDebug()); continue; } if (InterfaceType_Default == interfaceType) { - ZS_LOG_TRACE(slog("found default filter policy") + interfacePolicy.toDebug()) + ZS_LOG_TRACE(slog("found default filter policy") + interfacePolicy.toDebug()); defaultPolicy = interfacePolicy.mGatherPolicy; continue; } if (interfaceType == ioData.mInterfaceType) { - ZS_LOG_TRACE(slog("found exact interface policy") + interfacePolicy.toDebug()) + ZS_LOG_TRACE(slog("found exact interface policy") + interfacePolicy.toDebug()); ioData.mFilterPolicy = interfacePolicy.mGatherPolicy; return; } @@ -6844,7 +6845,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::HostIPSorter::sort(DataList &ioDataList) + void ICEGatherer::HostIPSorter::sort(DataList &ioDataList) noexcept { ioDataList.sort(HostIPSorter::compareLocalIPs); } @@ -6853,12 +6854,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::HostIPSorter::Data - #pragma mark + // + // ICEGatherer::HostIPSorter::Data + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::HostIPSorter::Data::toDebug() const + ElementPtr ICEGatherer::HostIPSorter::Data::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::HostIPSorter::Data"); @@ -6881,12 +6882,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::HostIPSorter::InterfaceNameMappingInfo - #pragma mark + // + // ICEGatherer::HostIPSorter::InterfaceNameMappingInfo + // //------------------------------------------------------------------------- - ICEGatherer::HostIPSorter::InterfaceNameMappingInfo ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::create(ElementPtr el) + ICEGatherer::HostIPSorter::InterfaceNameMappingInfo ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::create(ElementPtr el) noexcept { InterfaceNameMappingInfo info; @@ -6898,14 +6899,14 @@ namespace ortc try { info.mOrderIndex = Numeric(order); } catch(const Numeric::ValueOutOfRange &) { - ZS_LOG_WARNING(Detail, slog("failed to convert expression") + ZS_PARAMIZE(order)) + ZS_LOG_WARNING(Detail, slog("failed to convert expression") + ZS_PARAMIZE(order)); } return info; } //------------------------------------------------------------------------- - ElementPtr ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::createElement(const char *objectName) const + ElementPtr ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -6922,7 +6923,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::hasData() const + bool ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::hasData() const noexcept { return ((mInterfaceNameRegularExpression.hasData()) || (InterfaceType_Unknown != mInterfaceType) || @@ -6930,7 +6931,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::toDebug() const + ElementPtr ICEGatherer::HostIPSorter::InterfaceNameMappingInfo::toDebug() const noexcept { return createElement("ortc::ICEGatherer::HostIPSorter::InterfaceNameMappingInfo"); } @@ -6939,12 +6940,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::ReflexivePort - #pragma mark + // + // ICEGatherer::ReflexivePort + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::ReflexivePort::toDebug() const + ElementPtr ICEGatherer::ReflexivePort::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::ReflexivePort"); @@ -6966,12 +6967,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::RelayPort - #pragma mark + // + // ICEGatherer::RelayPort + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::RelayPort::toDebug() const + ElementPtr ICEGatherer::RelayPort::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::RelayPort"); @@ -6994,12 +6995,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::HostPort - #pragma mark + // + // ICEGatherer::HostPort + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::HostPort::toDebug() const + ElementPtr ICEGatherer::HostPort::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::HostPort"); @@ -7038,12 +7039,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::TCPPort - #pragma mark + // + // ICEGatherer::TCPPort + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::TCPPort::toDebug() const + ElementPtr ICEGatherer::TCPPort::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::TCPPort"); @@ -7069,12 +7070,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::BufferedPacket - #pragma mark + // + // ICEGatherer::BufferedPacket + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::BufferedPacket::toDebug() const + ElementPtr ICEGatherer::BufferedPacket::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::BufferedPacket"); @@ -7094,16 +7095,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::Route - #pragma mark + // + // ICEGatherer::Route + // //------------------------------------------------------------------------- - void ICEGatherer::Route::trace(const char *function, const char *message) const + void ICEGatherer::Route::trace( + const char *function, + const char *message + ) const noexcept { if (mLocalCandidate) { ZS_EVENTING_20( - x, i, Trace, IceGathererRouteTrace, ol, IceGatherer, Info, + x, i, Basic, IceGathererRouteTrace, ol, IceGatherer, Info, puid, routeId, mID, string, callingMethod, function, string, message, message, @@ -7128,7 +7132,7 @@ namespace ortc } else { ZS_EVENTING_20( - x, i, Trace, IceGathererRouteTrace, ol, IceGatherer, Info, + x, i, Basic, IceGathererRouteTrace, ol, IceGatherer, Info, puid, routeId, mID, string, callingMethod, function, string, message, message, @@ -7156,7 +7160,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ICEGatherer::Route::toDebug() const + ElementPtr ICEGatherer::Route::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::Route"); @@ -7182,12 +7186,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::InstalledTransport - #pragma mark + // + // ICEGatherer::InstalledTransport + // //------------------------------------------------------------------------- - ElementPtr ICEGatherer::InstalledTransport::toDebug() const + ElementPtr ICEGatherer::InstalledTransport::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::InstalledTransport"); @@ -7202,18 +7206,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::Preference - #pragma mark + // + // ICEGatherer::Preference + // //------------------------------------------------------------------------- - ICEGatherer::Preference::Preference() : + ICEGatherer::Preference::Preference() noexcept : Preference(PreferenceType_Priority) { } //------------------------------------------------------------------------- - ICEGatherer::Preference::Preference(PreferenceTypes type) : + ICEGatherer::Preference::Preference(PreferenceTypes type) noexcept : mType(type) { mCandidateTypePreferences = new DWORD[IICETypes::CandidateType_Last+1] {}; @@ -7274,7 +7278,7 @@ namespace ortc } //------------------------------------------------------------------------- - ICEGatherer::Preference::~Preference() + ICEGatherer::Preference::~Preference() noexcept { delete [] mCandidateTypePreferences; delete [] mProtocolTypePreferences; @@ -7288,7 +7292,7 @@ namespace ortc const char * &outProtocolType, const char * &outInterfaceType, const char * &outAddressFamily - ) const + ) const noexcept { switch (mType) { case PreferenceType_Priority: { @@ -7309,7 +7313,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGatherer::Preference::load() + void ICEGatherer::Preference::load() noexcept { const char *candidateTypeStr = NULL; const char *protocolTypeStr = NULL; @@ -7328,7 +7332,7 @@ namespace ortc dword, preferenceValue, mCandidateTypePreferences[loop] ); - ZS_LOG_DEBUG(log("candidate type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("candidate type", IICETypes::toString(static_cast(loop))) + ZS_PARAM("preference", mCandidateTypePreferences[loop])) + ZS_LOG_DEBUG(log("candidate type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("candidate type", IICETypes::toString(static_cast(loop))) + ZS_PARAM("preference", mCandidateTypePreferences[loop])); } for (auto loop = zsLib::to_underlying(IICETypes::Protocol_First); loop <= IICETypes::Protocol_Last; ++loop) { mProtocolTypePreferences[loop] = static_cast(ISettings::getUInt((String(protocolTypeStr) + IICETypes::toString(static_cast(loop))).c_str())); @@ -7340,7 +7344,7 @@ namespace ortc string, subPreferenceType, IICETypes::toString(static_cast(loop)), dword, preferenceValue, mProtocolTypePreferences[loop] ); - ZS_LOG_DEBUG(log("protocol type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("protocol", IICETypes::toString(static_cast(loop))) + ZS_PARAM("preference", mProtocolTypePreferences[loop])) + ZS_LOG_DEBUG(log("protocol type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("protocol", IICETypes::toString(static_cast(loop))) + ZS_PARAM("preference", mProtocolTypePreferences[loop])); } for (auto loop = zsLib::to_underlying(ICEGatherer::InterfaceType_First); loop <= ICEGatherer::InterfaceType_Last; ++loop) { mInterfaceTypePreferences[loop] = static_cast(ISettings::getUInt((String(interfaceTypeStr) + ICEGatherer::toString(static_cast(loop))).c_str())); @@ -7352,7 +7356,7 @@ namespace ortc string, subPreferenceType, ICEGatherer::toString(static_cast(loop)), dword, preferenceValue, mInterfaceTypePreferences[loop] ); - ZS_LOG_DEBUG(log("interface type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("interface type", ICEGatherer::toString(static_cast(loop))) + ZS_PARAM("preference", mInterfaceTypePreferences[loop])) + ZS_LOG_DEBUG(log("interface type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("interface type", ICEGatherer::toString(static_cast(loop))) + ZS_PARAM("preference", mInterfaceTypePreferences[loop])); } for (auto loop = zsLib::to_underlying(ICEGatherer::AddressFamily_First); loop <= ICEGatherer::AddressFamily_Last; ++loop) { mAddressFamilyPreferences[loop] = static_cast(ISettings::getUInt((String(addressFamilyStr) + ICEGatherer::toString(static_cast(loop))).c_str())); @@ -7364,12 +7368,12 @@ namespace ortc string, subPreferenceType, ICEGatherer::toString(static_cast(loop)), dword, preferenceValue, mAddressFamilyPreferences[loop] ); - ZS_LOG_DEBUG(log("address family type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("address family", ICEGatherer::toString(static_cast(loop))) + ZS_PARAM("preference", mAddressFamilyPreferences[loop])) + ZS_LOG_DEBUG(log("address family type preference") + ZS_PARAM("type", ICEGatherer::toString(mType)) + ZS_PARAM("address family", ICEGatherer::toString(static_cast(loop))) + ZS_PARAM("preference", mAddressFamilyPreferences[loop])); } } //------------------------------------------------------------------------- - void ICEGatherer::Preference::save() const + void ICEGatherer::Preference::save() const noexcept { const char *candidateTypeStr = NULL; const char *protocolTypeStr = NULL; @@ -7392,7 +7396,7 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ICEGatherer::Preference::log(const char *message) const + Log::Params ICEGatherer::Preference::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ICEGatherer::Preference"); IHelper::debugAppend(objectEl, "id", mOuterObjectID); @@ -7400,7 +7404,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ICEGatherer::Preference::toDebug() const + ElementPtr ICEGatherer::Preference::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICEGatherer::Preference"); @@ -7440,12 +7444,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererFactory - #pragma mark + // + // IICEGathererFactory + // //------------------------------------------------------------------------- - IICEGathererFactory &IICEGathererFactory::singleton() + IICEGathererFactory &IICEGathererFactory::singleton() noexcept { return ICEGathererFactory::singleton(); } @@ -7454,7 +7458,7 @@ namespace ortc ICEGathererPtr IICEGathererFactory::create( IICEGathererDelegatePtr delegate, const IICEGathererTypes::Options &options - ) + ) noexcept { if (this) {} return internal::ICEGatherer::create(delegate, options); @@ -7466,12 +7470,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IICEGathererTypes"); } @@ -7480,12 +7484,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::States - #pragma mark + // + // IICEGathererTypes::States + // //--------------------------------------------------------------------------- - const char *IICEGathererTypes::toString(States state) + const char *IICEGathererTypes::toString(States state) noexcept { switch (state) { case State_New: return "new"; @@ -7497,13 +7501,13 @@ namespace ortc } //--------------------------------------------------------------------------- - IICEGathererTypes::States IICEGathererTypes::toState(const char *state) throw (InvalidParameters) + IICEGathererTypes::States IICEGathererTypes::toState(const char *state) noexcept(false) { String stateStr(state); for (IICEGathererTypes::States index = IICEGathererTypes::State_First; index <= IICEGathererTypes::State_Last; index = static_cast(static_cast::type>(index) + 1)) { if (0 == stateStr.compareNoCase(IICEGathererTypes::toString(index))) return index; } - ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + stateStr) + ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + stateStr); return IICEGathererTypes::State_First; } @@ -7511,9 +7515,9 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::FilterPolicies - #pragma mark + // + // IICEGathererTypes::FilterPolicies + // namespace internal { @@ -7521,9 +7525,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark PolicyBitInfo - #pragma mark + // + // PolicyBitInfo + // struct PolicyBitInfo { @@ -7531,7 +7535,7 @@ namespace ortc const char *mPolicyStr; //----------------------------------------------------------------------- - static PolicyBitInfo *getInfos() { + static PolicyBitInfo *getInfos() noexcept { static PolicyBitInfo filterInfos[] { {IICEGathererTypes::FilterPolicy_NoIPv4Host, "NoIPv4Host"}, {IICEGathererTypes::FilterPolicy_NoIPv4Srflx, "NoIPv4Srflx"}, @@ -7563,7 +7567,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IICEGathererTypes::toString(FilterPolicies policies) + String IICEGathererTypes::toString(FilterPolicies policies) noexcept { typedef std::list PolicyList; @@ -7604,7 +7608,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICEGathererTypes::FilterPolicies IICEGathererTypes::toPolicy(const char *filters) + IICEGathererTypes::FilterPolicies IICEGathererTypes::toPolicy(const char *filters) noexcept { String policyStr(filters); @@ -7632,12 +7636,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::CredentialType - #pragma mark + // + // IICEGathererTypes::CredentialType + // //--------------------------------------------------------------------------- - const char *IICEGathererTypes::toString(CredentialTypes type) + const char *IICEGathererTypes::toString(CredentialTypes type) noexcept { switch (type) { case CredentialType_Password: return "password"; @@ -7647,13 +7651,13 @@ namespace ortc } //--------------------------------------------------------------------------- - IICEGathererTypes::CredentialTypes IICEGathererTypes::toCredentialType(const char *type) throw (InvalidParameters) + IICEGathererTypes::CredentialTypes IICEGathererTypes::toCredentialType(const char *type) noexcept(false) { String typeStr(type); for (IICEGathererTypes::CredentialTypes index = IICEGathererTypes::CredentialType_First; index <= IICEGathererTypes::CredentialType_Last; index = static_cast(static_cast::type>(index) + 1)) { if (0 == typeStr.compareNoCase(IICEGathererTypes::toString(index))) return index; } - ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + typeStr) + ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + typeStr); return IICEGathererTypes::CredentialType_First; } @@ -7661,12 +7665,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::Options - #pragma mark + // + // IICEGathererTypes::Options + // //--------------------------------------------------------------------------- - IICEGathererTypes::Options::Options(ElementPtr elem) + IICEGathererTypes::Options::Options(ElementPtr elem) noexcept { if (!elem) return; @@ -7720,7 +7724,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::Options::createElement(const char *objectName) const + ElementPtr IICEGathererTypes::Options::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -7755,13 +7759,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::Options::toDebug() const + ElementPtr IICEGathererTypes::Options::toDebug() const noexcept { return createElement("ortc::IICEGathererTypes::Options"); } //--------------------------------------------------------------------------- - String IICEGathererTypes::Options::hash() const + String IICEGathererTypes::Options::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -7785,12 +7789,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::Server - #pragma mark + // + // IICEGathererTypes::Server + // //--------------------------------------------------------------------------- - IICEGathererTypes::Server::Server(ElementPtr elem) + IICEGathererTypes::Server::Server(ElementPtr elem) noexcept { if (!elem) return; @@ -7824,7 +7828,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::Server::createElement(const char *objectName) const + ElementPtr IICEGathererTypes::Server::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -7859,13 +7863,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::Server::toDebug() const + ElementPtr IICEGathererTypes::Server::toDebug() const noexcept { return createElement("ortc::IICEGathererTypes::Server"); } //--------------------------------------------------------------------------- - String IICEGathererTypes::Server::hash() const + String IICEGathererTypes::Server::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -7889,12 +7893,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::InterfacePolicy - #pragma mark + // + // IICEGathererTypes::InterfacePolicy + // //--------------------------------------------------------------------------- - IICEGathererTypes::InterfacePolicy::InterfacePolicy(ElementPtr elem) + IICEGathererTypes::InterfacePolicy::InterfacePolicy(ElementPtr elem) noexcept { if (!elem) return; @@ -7914,7 +7918,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::InterfacePolicy::createElement(const char *objectName) const + ElementPtr IICEGathererTypes::InterfacePolicy::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -7927,13 +7931,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::InterfacePolicy::toDebug() const + ElementPtr IICEGathererTypes::InterfacePolicy::toDebug() const noexcept { return createElement("ortc::IICEGathererTypes::InterfacePolicy"); } //--------------------------------------------------------------------------- - String IICEGathererTypes::InterfacePolicy::hash() const + String IICEGathererTypes::InterfacePolicy::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -7948,12 +7952,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererTypes::ErrorEvent - #pragma mark + // + // IICEGathererTypes::ErrorEvent + // //--------------------------------------------------------------------------- - IICEGathererTypes::ErrorEvent::ErrorEvent(ElementPtr elem) + IICEGathererTypes::ErrorEvent::ErrorEvent(ElementPtr elem) noexcept { if (!elem) return; @@ -7973,7 +7977,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::ErrorEvent::createElement(const char *objectName) const + ElementPtr IICEGathererTypes::ErrorEvent::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -7992,13 +7996,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICEGathererTypes::ErrorEvent::toDebug() const + ElementPtr IICEGathererTypes::ErrorEvent::toDebug() const noexcept { return createElement("ortc::IICEGathererTypes::ErrorEvent"); } //--------------------------------------------------------------------------- - String IICEGathererTypes::ErrorEvent::hash() const + String IICEGathererTypes::ErrorEvent::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -8020,12 +8024,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGatherer - #pragma mark + // + // IICEGatherer + // //--------------------------------------------------------------------------- - ElementPtr IICEGatherer::toDebug(IICEGathererPtr gatherer) + ElementPtr IICEGatherer::toDebug(IICEGathererPtr gatherer) noexcept { return internal::ICEGatherer::toDebug(internal::ICEGatherer::convert(gatherer)); } @@ -8034,7 +8038,7 @@ namespace ortc IICEGathererPtr IICEGatherer::create( IICEGathererDelegatePtr delegate, const Options &options - ) + ) noexcept { return internal::IICEGathererFactory::singleton().create(delegate, options); } diff --git a/ortc/cpp/ortc_ICEGathererRouter.cpp b/ortc/cpp/ortc_ICEGathererRouter.cpp index 2df3212e..29064a2a 100644 --- a/ortc/cpp/ortc_ICEGathererRouter.cpp +++ b/ortc/cpp/ortc_ICEGathererRouter.cpp @@ -40,47 +40,47 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_icegatherer_router) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_ice_gatherer_router) } namespace ortc { namespace internal { - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper) + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererRouter - #pragma mark + // + // IICEGathererRouter + // //------------------------------------------------------------------------- ICEGathererRouter::ICEGathererRouter( const make_private &, IMessageQueuePtr queue - ) : + ) noexcept : SharedRecursiveLock(SharedRecursiveLock::create()), MessageQueueAssociator(queue) { //IceGathererRouterCreate(__func__, mID); ZS_EVENTING_1(x, i, Detail, IceGathererRouterCreate, ol, IceGathererRouter, Start, puid, id, mID); - ZS_LOG_BASIC(log("created")) + ZS_LOG_BASIC(log("created")); } //------------------------------------------------------------------------- - void ICEGathererRouter::init() + void ICEGathererRouter::init() noexcept { AutoRecursiveLock lock(*this); mTimer = ITimer::create(mThisWeak.lock(), Seconds(30)); } //------------------------------------------------------------------------- - ICEGathererRouter::~ICEGathererRouter() + ICEGathererRouter::~ICEGathererRouter() noexcept { mThisWeak.reset(); - ZS_LOG_BASIC(log("destroyed")) + ZS_LOG_BASIC(log("destroyed")); cancel(); //IceGathererRouterDestroy(__func__, mID); ZS_EVENTING_1(x, i, Detail, IceGathererRouterDestroy, ol, IceGathererRouter, Stop, puid, id, mID); @@ -90,19 +90,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererRouter => (friends) - #pragma mark + // + // IICEGathererRouter => (friends) + // //------------------------------------------------------------------------- - ElementPtr ICEGathererRouter::toDebug(ICEGathererRouterPtr router) + ElementPtr ICEGathererRouter::toDebug(ICEGathererRouterPtr router) noexcept { if (!router) return ElementPtr(); return router->toDebug(); } //------------------------------------------------------------------------- - ICEGathererRouterPtr ICEGathererRouter::create() + ICEGathererRouterPtr ICEGathererRouter::create() noexcept { ICEGathererRouterPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC())); pThis->mThisWeak = pThis; @@ -115,7 +115,7 @@ namespace ortc CandidatePtr localCandidate, const IPAddress &remoteIP, bool createRouteIfNeeded - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -139,8 +139,8 @@ namespace ortc string, remoteIp, remoteIP.string() ); - route->trace(__func__, "found"); - ZS_LOG_TRACE(log("route found") + route->toDebug() + ZS_PARAM("create route", createRouteIfNeeded)) + ZS_EVENTING_TRACE_OBJECT(Insane, *route, "found route"); + ZS_LOG_TRACE(log("route found") + route->toDebug() + ZS_PARAM("create route", createRouteIfNeeded)); return route; } @@ -155,7 +155,7 @@ namespace ortc string, remoteIp, remoteIP.string() ); - ZS_LOG_WARNING(Debug, log("route was previously found but is now gone") + (localCandidate ? localCandidate->toDebug() : ElementPtr()) + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("create route", createRouteIfNeeded)) + ZS_LOG_WARNING(Debug, log("route was previously found but is now gone") + (localCandidate ? localCandidate->toDebug() : ElementPtr()) + ZS_PARAM("remote ip", remoteIP.string()) + ZS_PARAM("create route", createRouteIfNeeded)); mRoutes.erase(found); } @@ -171,7 +171,7 @@ namespace ortc string, remoteIp, remoteIP.string() ); - ZS_LOG_WARNING(Trace, log("route does not exist") + (localCandidate ? localCandidate->toDebug() : ElementPtr()) + ZS_PARAM("remote ip", remoteIP.string())) + ZS_LOG_WARNING(Trace, log("route does not exist") + (localCandidate ? localCandidate->toDebug() : ElementPtr()) + ZS_PARAM("remote ip", remoteIP.string())); return RoutePtr(); } @@ -189,11 +189,11 @@ namespace ortc word, localCandidatePort, ((bool)localCandidate) ? localCandidate->mPort : static_cast(0), string, remoteIp, remoteIP.string() ); - route->trace(__func__, "created"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "route created"); mRoutes[search] = route; - ZS_LOG_DEBUG(log("route created") + route->toDebug()) + ZS_LOG_DEBUG(log("route created") + route->toDebug()); return route; } @@ -202,9 +202,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererRouter => (friends) - #pragma mark + // + // IICEGathererRouter => (friends) + // //------------------------------------------------------------------------- void ICEGathererRouter::onTimer(ITimerPtr timer) @@ -224,7 +224,6 @@ namespace ortc auto remoteIP = ((*current).first).second; if (route) { - //IceGathererRouterInternalEvent(__func__, mID, "keep", candidateHash, NULL, 0, remoteIP.string()); ZS_EVENTING_6( x, i, Trace, IceGathererRouterInternalEvent, ol, IceGathererRouter, InternalEvent, puid, id, mID, @@ -234,12 +233,11 @@ namespace ortc word, localCandidatePort, 0, string, remoteIp, remoteIP.string() ); - route->trace(__func__, "keep"); + ZS_EVENTING_TRACE_OBJECT(Insane, *route, "route still in use (not pruning)"); ZS_LOG_TRACE(log("route still in use") + ZS_PARAM("candidate hash", candidateHash) + ZS_PARAM("remote ip", remoteIP.string())) continue; } - //IceGathererRouterInternalEvent(__func__, mID, "prune", candidateHash, NULL, 0, remoteIP.string()); ZS_EVENTING_6( x, i, Trace, IceGathererRouterInternalEvent, ol, IceGathererRouter, InternalEvent, puid, id, mID, @@ -259,12 +257,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererRouter => (internals) - #pragma mark + // + // IICEGathererRouter => (internals) + // //------------------------------------------------------------------------- - Log::Params ICEGathererRouter::log(const char *message) const + Log::Params ICEGathererRouter::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ICEGathererRouter"); UseServicesHelper::debugAppend(objectEl, "id", mID); @@ -272,20 +270,20 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ICEGathererRouter::slog(const char *message) + Log::Params ICEGathererRouter::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::ICEGathererRouter"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params ICEGathererRouter::debug(const char *message) const + Log::Params ICEGathererRouter::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr ICEGathererRouter::toDebug() const + ElementPtr ICEGathererRouter::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -301,7 +299,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICEGathererRouter::cancel() + void ICEGathererRouter::cancel() noexcept { //IceGathererRouterCancel(__func__, mID); ZS_EVENTING_1(x, i, Trace, IceGathererRouterCancel, ol, IceGathererRouter, Cancel, puid, id, mID); @@ -318,39 +316,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererRouter::Route - #pragma mark + // + // IICEGathererRouter::Route + // //------------------------------------------------------------------------- void ICEGathererRouter::Route::trace( const char *function, const char *message - ) const + ) const noexcept { if (mLocalCandidate) { - /* - IceGathererRouterRouteTrace( - __func__, - function, - message, - mID, - mLocalCandidate->mInterfaceType, - mLocalCandidate->mFoundation, - mLocalCandidate->mPriority, - mLocalCandidate->mUnfreezePriority, - IICETypes::toString(mLocalCandidate->mProtocol), - mLocalCandidate->mIP, - mLocalCandidate->mPort, - IICETypes::toString(mLocalCandidate->mCandidateType), - IICETypes::toString(mLocalCandidate->mTCPType), - mLocalCandidate->mRelatedAddress, - mLocalCandidate->mRelatedPort, - mRemoteIP.string() - ); - */ ZS_EVENTING_15( - x, i, Trace, IceGathererRouterRouteTrace, ol, IceGathererRouter, Info, + x, i, Basic, IceGathererRouterRouteTrace, ol, IceGathererRouter, Info, puid, routeId, mID, string, callingMethod, function, string, message, message, @@ -368,28 +346,8 @@ namespace ortc string, remoteIp, mRemoteIP.string() ); } else { - /* - EventWriteOrtcIceGathererRouterRouteTrace( - __func__, - function, - message, - mID, - NULL, - NULL, - 0, - 0, - NULL, - NULL, - 0, - NULL, - NULL, - NULL, - 0, - mRemoteIP.string() - ); - */ ZS_EVENTING_15( - x, i, Trace, IceGathererRouterRouteTrace, ol, IceGathererRouter, Info, + x, i, Basic, IceGathererRouterRouteTrace, ol, IceGathererRouter, Info, puid, routeId, mID, string, callingMethod, function, string, message, message, @@ -410,7 +368,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ICEGathererRouter::Route::toDebug() const + ElementPtr ICEGathererRouter::Route::toDebug() const noexcept { ElementPtr objectEl = Element::create("ortc::ICEGathererRouter::Route"); UseServicesHelper::debugAppend(objectEl, "id", mID); diff --git a/ortc/cpp/ortc_ICETransport.cpp b/ortc/cpp/ortc_ICETransport.cpp index 152a4716..c3ce0b7e 100644 --- a/ortc/cpp/ortc_ICETransport.cpp +++ b/ortc/cpp/ortc_ICETransport.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -54,7 +56,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_icetransport) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_ice_transport) } namespace ortc { @@ -75,12 +77,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- - static QWORD getMaxQWORD() + static QWORD getMaxQWORD() noexcept { QWORD maxQword {}; memset(&maxQword, 0xFF, sizeof(maxQword)); @@ -88,7 +90,7 @@ namespace ortc } //------------------------------------------------------------------------- - static Time getLatest(const Time &time1, const Time &time2) + static Time getLatest(const Time &time1, const Time &time2) noexcept { if (Time() == time1) return time2; if (Time() == time2) return time1; @@ -97,7 +99,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool isMagnitudeFaster(const Microseconds &fastestThusFar, const Microseconds &newSpeed) + static bool isMagnitudeFaster(const Microseconds &fastestThusFar, const Microseconds &newSpeed) noexcept { if (Microseconds() == newSpeed) return false; if (newSpeed >= fastestThusFar) return false; // cannot be a magnide faster if equal or slower @@ -115,28 +117,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportSettingsDefaults - #pragma mark + // + // ICETransportSettingsDefaults + // class ICETransportSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~ICETransportSettingsDefaults() + ~ICETransportSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static ICETransportSettingsDefaultsPtr singleton() + static ICETransportSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static ICETransportSettingsDefaultsPtr create() + static ICETransportSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -144,7 +146,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { ISettings::setUInt(ORTC_SETTING_ICE_TRANSPORT_MAX_CANDIDATE_PAIRS_TO_TEST, 100); @@ -167,7 +169,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installICETransportSettingsDefaults() + void installICETransportSettingsDefaults() noexcept { ICETransportSettingsDefaults::singleton(); } @@ -177,20 +179,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForICEGatherer - #pragma mark + // + // IICETransportForICEGatherer + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForICETransportContoller - #pragma mark + // + // IICETransportForICETransportContoller + // //------------------------------------------------------------------------- - ElementPtr IICETransportForICETransportContoller::toDebug(ForTransportContollerPtr transport) + ElementPtr IICETransportForICETransportContoller::toDebug(ForTransportContollerPtr transport) noexcept { if (!transport) return ElementPtr(); return ICETransport::convert(transport)->toDebug(); @@ -200,17 +202,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForSecureTransport - #pragma mark + // + // IICETransportForSecureTransport + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport - #pragma mark + // + // ICETransport + // //------------------------------------------------------------------------- ICETransport::ICETransport( @@ -218,10 +220,12 @@ namespace ortc IMessageQueuePtr queue, IICETransportDelegatePtr originalDelegate, UseICEGathererPtr gatherer - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mGatherer(ICEGatherer::convert(gatherer)), + mLegalRoutesComputeQueue(IORTCForInternal::queueORTC()), mRouteStateTracker(make_shared(mID)), mNoPacketsReceivedRecheckTime(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_NO_PACKETS_RECEVIED_RECHECK_CANDIDATES_IN_SECONDS)), mExpireRouteTime(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_EXPIRE_ROUTE_IN_SECONDS)), @@ -229,14 +233,13 @@ namespace ortc mBlacklistConsent(ISettings::getBool(ORTC_SETTING_ICE_TRANSPORT_BLACKLIST_AFTER_CONSENT_REMOVAL)), mKeepWarmTimeBase(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_KEEP_WARM_TIME_BASE_IN_MILLISECONDS)), mKeepWarmTimeRandomizedAddTime(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_KEEP_WARM_TIME_RANDOMIZED_ADD_TIME_IN_MILLISECONDS)), - mMaxBufferedPackets(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_MAX_BUFFERED_FOR_SECURE_TRANSPORT)), - mLegalRoutesComputeQueue(IORTCForInternal::queueORTC()) + mMaxBufferedPackets(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_MAX_BUFFERED_FOR_SECURE_TRANSPORT)) { ZS_LOG_BASIC(debug("created")); if (mGatherer) { mGathererRouter = mGatherer->getGathererRouter(); - ZS_THROW_INVALID_ASSUMPTION_IF(!mGathererRouter) + ZS_ASSERT(mGathererRouter); } if (originalDelegate) { @@ -263,7 +266,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::init() + void ICETransport::init() noexcept { AutoRecursiveLock lock(*this); @@ -286,50 +289,50 @@ namespace ortc } //------------------------------------------------------------------------- - ICETransport::~ICETransport() + ICETransport::~ICETransport() noexcept { if (isNoop()) return; mThisWeak.reset(); - ZS_LOG_BASIC(log("destroyed")) + ZS_LOG_BASIC(log("destroyed")); cancel(); ZS_EVENTING_1(x, i, Detail, IceTransportDestroy, ol, IceTransport, Stop, puid, id, mID); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::convert(IICETransportPtr object) + ICETransportPtr ICETransport::convert(IICETransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransport, object); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::convert(IRTCPTransportPtr object) + ICETransportPtr ICETransport::convert(IRTCPTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransport, object); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::convert(ForICEGathererPtr object) + ICETransportPtr ICETransport::convert(ForICEGathererPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransport, object); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::convert(ForTransportContollerPtr object) + ICETransportPtr ICETransport::convert(ForTransportContollerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransport, object); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::convert(ForSecureTransportPtr object) + ICETransportPtr ICETransport::convert(ForSecureTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransport, object); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::convert(ForDataTransportPtr object) + ICETransportPtr ICETransport::convert(ForDataTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransport, object); } @@ -338,12 +341,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IStatsProvider - #pragma mark + // + // ICETransport => IStatsProvider + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr ICETransport::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr ICETransport::getStats(const StatsTypeSet &stats) const noexcept { if ((!stats.hasStatType(IStatsReportTypes::StatsType_ICETransport)) && (!stats.hasStatType(IStatsReportTypes::StatsType_LocalCandidate)) && @@ -372,12 +375,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransport - #pragma mark + // + // ICETransport => IICETransport + // //------------------------------------------------------------------------- - ElementPtr ICETransport::toDebug(ICETransportPtr transport) + ElementPtr ICETransport::toDebug(ICETransportPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -387,12 +390,12 @@ namespace ortc ICETransportPtr ICETransport::create( IICETransportDelegatePtr delegate, IICEGathererPtr inGatherer - ) + ) noexcept(false) { UseICEGathererPtr gatherer = ICEGatherer::convert(inGatherer); if (gatherer) { - ORTC_THROW_INVALID_PARAMETERS_IF(Component_RTCP == gatherer->component()) - ORTC_THROW_INVALID_PARAMETERS_IF(IICEGatherer::State_Closed == gatherer->state()) + ORTC_THROW_INVALID_PARAMETERS_IF(Component_RTCP == gatherer->component()); + ORTC_THROW_INVALID_PARAMETERS_IF(IICEGatherer::State_Closed == gatherer->state()); } ICETransportPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, gatherer)); @@ -402,9 +405,9 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportSubscriptionPtr ICETransport::subscribe(IICETransportDelegatePtr originalDelegate) + IICETransportSubscriptionPtr ICETransport::subscribe(IICETransportDelegatePtr originalDelegate) noexcept { - ZS_LOG_DETAIL(log("subscribing to transport state")) + ZS_LOG_DETAIL(log("subscribing to transport state")); AutoRecursiveLock lock(*this); if (!originalDelegate) return mDefaultSubscription; @@ -443,38 +446,38 @@ namespace ortc } //------------------------------------------------------------------------- - IICEGathererPtr ICETransport::iceGatherer() const + IICEGathererPtr ICETransport::iceGatherer() const noexcept { AutoRecursiveLock lock(*this); - ZS_LOG_TRACE(log("get gatherer") + ZS_PARAM("gatherer", mGatherer ? mGatherer->getID() : 0)) + ZS_LOG_TRACE(log("get gatherer") + ZS_PARAM("gatherer", mGatherer ? mGatherer->getID() : 0)); return ICEGatherer::convert(mGatherer); } //------------------------------------------------------------------------- - IICETransportTypes::Roles ICETransport::role() const + IICETransportTypes::Roles ICETransport::role() const noexcept { AutoRecursiveLock lock(*this); - ZS_LOG_TRACE(log("get role") + ZS_PARAM("role", IICETypes::toString(mOptions.mRole))) + ZS_LOG_TRACE(log("get role") + ZS_PARAM("role", IICETypes::toString(mOptions.mRole))); return mOptions.mRole; } //------------------------------------------------------------------------- - IICETypes::Components ICETransport::component() const + IICETypes::Components ICETransport::component() const noexcept { - ZS_LOG_TRACE(log("get component") + ZS_PARAM("component", IICETypes::toString(mComponent))) + ZS_LOG_TRACE(log("get component") + ZS_PARAM("component", IICETypes::toString(mComponent))); return mComponent; } //------------------------------------------------------------------------- - IICETransportTypes::States ICETransport::state() const + IICETransportTypes::States ICETransport::state() const noexcept { AutoRecursiveLock lock(*this); - ZS_LOG_TRACE(log("get state") + ZS_PARAM("state", IICETransport::toString(mCurrentState))) + ZS_LOG_TRACE(log("get state") + ZS_PARAM("state", IICETransport::toString(mCurrentState))); return mCurrentState; } //------------------------------------------------------------------------- - IICETypes::CandidateListPtr ICETransport::getRemoteCandidates() const + IICETypes::CandidateListPtr ICETransport::getRemoteCandidates() const noexcept { AutoRecursiveLock lock(*this); @@ -488,7 +491,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportTypes::CandidatePairPtr ICETransport::getSelectedCandidatePair() const + IICETransportTypes::CandidatePairPtr ICETransport::getSelectedCandidatePair() const noexcept { AutoRecursiveLock lock(*this); @@ -507,7 +510,7 @@ namespace ortc IICEGathererPtr inGatherer, const Parameters &remoteParameters, Optional options - ) throw (InvalidParameters) + ) noexcept(false) { UseICEGathererPtr gatherer = ICEGatherer::convert(inGatherer); @@ -524,7 +527,7 @@ namespace ortc AutoRecursiveLock lock(*this); - ORTC_THROW_INVALID_STATE_IF(isShuttingDown() || isShutdown()) + ORTC_THROW_INVALID_STATE_IF(isShuttingDown() || isShutdown()); if (options.hasValue()) { mOptionsHash = options.mType.hash(); @@ -552,12 +555,12 @@ namespace ortc ); if (oldParamHash.hasData()) { - ZS_LOG_DETAIL(log("remote ufrag has changed thus must flush out all remote candidates")) + ZS_LOG_DETAIL(log("remote ufrag has changed thus must flush out all remote candidates")); mRemoteCandidates.clear(); } if (gatherer != mGatherer) { - ZS_LOG_DETAIL(log("local gatherer has changed thus must flush out all local candidates")) + ZS_LOG_DETAIL(log("local gatherer has changed thus must flush out all local candidates")); if (mGathererSubscription) { mGathererSubscription->cancel(); mGathererSubscription.reset(); @@ -568,7 +571,7 @@ namespace ortc mGatherer = gatherer; mGathererRouter = gatherer->getGathererRouter(); - ZS_THROW_INVALID_ASSUMPTION_IF(!mGathererRouter) + ZS_ASSERT(mGathererRouter); mGatherer->installTransport(pThis, String()); mGathererSubscription = mGatherer->subscribe(pThis); @@ -597,16 +600,16 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::stop() + void ICETransport::stop() noexcept { - ZS_LOG_DETAIL(log("stop called")) + ZS_LOG_DETAIL(log("stop called")); AutoRecursiveLock lock(*this); cancel(); } //------------------------------------------------------------------------- - IICETransportTypes::ParametersPtr ICETransport::getRemoteParameters() const + IICETransportTypes::ParametersPtr ICETransport::getRemoteParameters() const noexcept { AutoRecursiveLock lock(*this); @@ -623,7 +626,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportPtr ICETransport::createAssociatedTransport(IICETransportDelegatePtr delegate) throw (InvalidStateError) + IICETransportPtr ICETransport::createAssociatedTransport(IICETransportDelegatePtr delegate) noexcept(false) { ICETransportPtr pThis; UseSecureTransportPtr secureTransport; @@ -633,13 +636,13 @@ namespace ortc UseICEGathererPtr rtcpGatherer; - ORTC_THROW_INVALID_STATE_IF(isShuttingDown() || isShutdown()) - ORTC_THROW_INVALID_STATE_IF(IICETypes::Component_RTCP == mComponent) + ORTC_THROW_INVALID_STATE_IF(isShuttingDown() || isShutdown()); + ORTC_THROW_INVALID_STATE_IF(IICETypes::Component_RTCP == mComponent); if (mGatherer) { rtcpGatherer = mGatherer->getRTCPGatherer(); - ORTC_THROW_INVALID_PARAMETERS_IF(Component_RTCP != rtcpGatherer->component()) - ORTC_THROW_INVALID_PARAMETERS_IF(IICEGatherer::State_Closed == rtcpGatherer->state()) + ORTC_THROW_INVALID_PARAMETERS_IF(Component_RTCP != rtcpGatherer->component()); + ORTC_THROW_INVALID_PARAMETERS_IF(IICEGatherer::State_Closed == rtcpGatherer->state()); } pThis = make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, rtcpGatherer); @@ -665,7 +668,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::addRemoteCandidate(const GatherCandidate &remoteCandidate) throw (InvalidStateError, InvalidParameters) + void ICETransport::addRemoteCandidate(const GatherCandidate &remoteCandidate) noexcept(false) { AutoRecursiveLock lock(*this); @@ -700,15 +703,15 @@ namespace ortc if (found != mRemoteCandidates.end()) { if (mRemoteCandidatesComplete) { - ZS_LOG_WARNING(Detail, log("told to add candidate that is already added (but no longer at end of remote candidates)") + tempCandidate->toDebug()) + ZS_LOG_WARNING(Detail, log("told to add candidate that is already added (but no longer at end of remote candidates)") + tempCandidate->toDebug()); mRemoteCandidatesComplete = false; goto changed; } - ZS_LOG_WARNING(Detail, log("told to add candidate that is already added") + tempCandidate->toDebug()) + ZS_LOG_WARNING(Detail, log("told to add candidate that is already added") + tempCandidate->toDebug()); return; } - ZS_LOG_DEBUG(log("adding remote candidate") + tempCandidate->toDebug()) + ZS_LOG_DEBUG(log("adding remote candidate") + tempCandidate->toDebug()); CandidatePtr candidate(make_shared(*tempCandidate)); mRemoteCandidates[hash] = candidate; @@ -730,12 +733,12 @@ namespace ortc goto changed; } - ZS_LOG_WARNING(Debug, log("end of remote candidates indicated (but already handled)")) + ZS_LOG_WARNING(Debug, log("end of remote candidates indicated (but already handled)")); return; } } - ZS_LOG_WARNING(Detail, log("remote candidate type is not understood (thus cannot add)")) + ZS_LOG_WARNING(Detail, log("remote candidate type is not understood (thus cannot add)")); return; changed: @@ -747,11 +750,11 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setRemoteCandidates(const CandidateList &remoteCandidates) throw (InvalidStateError, InvalidParameters) + void ICETransport::setRemoteCandidates(const CandidateList &remoteCandidates) noexcept(false) { AutoRecursiveLock lock(*this); - ORTC_THROW_INVALID_STATE_IF(isShuttingDown() || isShutdown()) + ORTC_THROW_INVALID_STATE_IF(isShuttingDown() || isShutdown()); bool changed = mRemoteCandidatesComplete; // if was at end of remote candidates then it must have changed @@ -832,17 +835,17 @@ namespace ortc ); if (found != mRemoteCandidates.end()) { - ZS_LOG_TRACE(log("already have remote candidate") + candidate->toDebug()) + ZS_LOG_TRACE(log("already have remote candidate") + candidate->toDebug()); continue; } - ZS_LOG_DEBUG(log("adding remote candidate") + candidate->toDebug()) + ZS_LOG_DEBUG(log("adding remote candidate") + candidate->toDebug()); mRemoteCandidates[hash] = candidate; changed = true; } if (!changed) { - ZS_LOG_WARNING(Debug, log("set remote candidates has not changed any remote candidates")) + ZS_LOG_WARNING(Debug, log("set remote candidates has not changed any remote candidates")); return; } @@ -851,7 +854,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeRemoteCandidate(const GatherCandidate &remoteCandidate) throw (InvalidStateError, InvalidParameters) + void ICETransport::removeRemoteCandidate(const GatherCandidate &remoteCandidate) noexcept(false) { AutoRecursiveLock lock(*this); @@ -885,11 +888,11 @@ namespace ortc ); if (found == mRemoteCandidates.end()) { - ZS_LOG_WARNING(Detail, log("told to remove candidate that is already removed") + tempCandidate->toDebug()) + ZS_LOG_WARNING(Detail, log("told to remove candidate that is already removed") + tempCandidate->toDebug()); return; } - ZS_LOG_DEBUG(log("removing remote candidate") + tempCandidate->toDebug()) + ZS_LOG_DEBUG(log("removing remote candidate") + tempCandidate->toDebug()); mRemoteCandidates.erase(found); goto changed; @@ -905,17 +908,17 @@ namespace ortc ORTC_THROW_INVALID_PARAMETERS_IF(tempCandidateComplete->mComponent != mComponent); if (mRemoteCandidatesComplete) { - ZS_LOG_DEBUG(log("end of remote candidates no longer indicated")) + ZS_LOG_DEBUG(log("end of remote candidates no longer indicated")); mRemoteCandidatesComplete = false; goto changed; } - ZS_LOG_WARNING(Debug, log("end of remote candidates no longer indicated (but was not already indicated thus no change happened)")) + ZS_LOG_WARNING(Debug, log("end of remote candidates no longer indicated (but was not already indicated thus no change happened)")); return; } } - ZS_LOG_WARNING(Detail, log("remote candidate type is not understood (thus cannot remove)")) + ZS_LOG_WARNING(Detail, log("remote candidate type is not understood (thus cannot remove)")); return; changed: @@ -930,7 +933,7 @@ namespace ortc void ICETransport::keepWarm( const CandidatePair &candidatePair, bool keepWarm - ) throw (InvalidStateError) + ) noexcept(false) { AutoRecursiveLock lock(*this); @@ -948,7 +951,7 @@ namespace ortc bool, keepWarm, keepWarm ); - ZS_LOG_DETAIL(log("did not find any route to keep warm") + candidatePair.toDebug() + ZS_PARAMIZE(hash)) + ZS_LOG_DETAIL(log("did not find any route to keep warm") + candidatePair.toDebug() + ZS_PARAMIZE(hash)); return; } @@ -963,8 +966,8 @@ namespace ortc bool, keepWarm, keepWarm ); - route->trace(__func__, "keepp warm blacklisted"); - ZS_LOG_WARNING(Detail, log("cannot keep warm as route is blacklisted") + route->toDebug()) + ZS_EVENTING_TRACE_OBJECT(Detail, *route, "keep warm blacklisted"); + ZS_LOG_WARNING(Detail, log("cannot keep warm as route is blacklisted") + route->toDebug()); return; } @@ -976,9 +979,8 @@ namespace ortc bool, keepWarm, keepWarm ); - route->trace(__func__, "keep warm"); - - ZS_LOG_DETAIL(log("route found for keep warm") + route->toDebug() + ZS_PARAMIZE(keepWarm) + ZS_PARAMIZE(hash)) + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route found for keep warm"); + ZS_LOG_DETAIL(log("route found for keep warm") + route->toDebug() + ZS_PARAMIZE(keepWarm) + ZS_PARAMIZE(hash)); route->mKeepWarm = keepWarm; @@ -989,12 +991,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForICEGatherer - #pragma mark + // + // ICETransport => IICETransportForICEGatherer + // //------------------------------------------------------------------------- - ICETransport::ForICEGathererPtr ICETransport::getForGatherer() const + ICETransport::ForICEGathererPtr ICETransport::getForGatherer() const noexcept { return mThisWeak.lock(); } @@ -1003,21 +1005,21 @@ namespace ortc void ICETransport::notifyPacket( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) + ) noexcept { ZS_EVENTING_2( x, i, Trace, IceTransportReceivedStunPacketFromGatherer, ol, IceTransport, Receive, puid, id, mID, puid, routerRouteId, routerRoute->mID ); - routerRoute->trace(__func__, "received stun packet"); - packet->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *routerRoute, "received stun packet"); + ZS_EVENTING_TRACE_OBJECT(Trace, *packet, "received stun packet"); { AutoRecursiveLock lock(*this); if (!mGatherer) { - ZS_LOG_WARNING(Debug, log("notify packet but no gatherer is attached") + routerRoute->toDebug() + packet->toDebug()) + ZS_LOG_WARNING(Debug, log("notify packet but no gatherer is attached") + routerRoute->toDebug() + packet->toDebug()); return; } @@ -1036,14 +1038,14 @@ namespace ortc } if (handleSwitchRolesAndConflict(routerRoute, packet)) { - ZS_LOG_DEBUG(log("role conflict handled") + packet->toDebug()) + ZS_LOG_DEBUG(log("role conflict handled") + packet->toDebug()); return; } auto route = findOrCreateMissingRoute(routerRoute, packet); if (!route) { - ZS_LOG_WARNING(Detail, log("route is not found that can handle this packet (thus ignoring packet)") + packet->toDebug()) + ZS_LOG_WARNING(Detail, log("route is not found that can handle this packet (thus ignoring packet)") + packet->toDebug()); return; } @@ -1052,38 +1054,38 @@ namespace ortc if (mBlacklistConsent) { if (Time() != route->mLastReceivedCheck) { if (route->mLastReceivedCheck + mExpireRouteTime < mLastReceivedPacket) { - ZS_LOG_DETAIL(log("consent on candidate has to be removed since too long since last consent granted") + route->toDebug()) + ZS_LOG_DETAIL(log("consent on candidate has to be removed since too long since last consent granted") + route->toDebug()); auto response = createErrorResponse(packet, STUNPacket::ErrorCode_Unauthorized); - ZS_LOG_WARNING(Detail, log("returning unauthorized error to remote party (as route is blacklisted)") + routerRoute->toDebug() + response->toDebug()) + ZS_LOG_WARNING(Detail, log("returning unauthorized error to remote party (as route is blacklisted)") + routerRoute->toDebug() + response->toDebug()); sendPacket(routerRoute, response); setBlacklisted(route); - route->trace(__func__, "blacklist response to stun binding request"); - response->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "blacklist response to stun binding request"); + ZS_EVENTING_TRACE_OBJECT(Debug, *response, "blacklist response to stun binding request"); return; } } } if (route->isBlacklisted()) { - ZS_LOG_DETAIL(log("consent on candidate has already been removed (blacklisted)") + route->toDebug()) + ZS_LOG_DETAIL(log("consent on candidate has already been removed (blacklisted)") + route->toDebug()); auto response = createErrorResponse(packet, STUNPacket::ErrorCode_Unauthorized); - ZS_LOG_WARNING(Debug, log("returning conflict error to remote party") + routerRoute->toDebug() + response->toDebug()) + ZS_LOG_WARNING(Debug, log("returning conflict error to remote party") + routerRoute->toDebug() + response->toDebug()); sendPacket(routerRoute, response); - route->trace(__func__, "blacklist response to stun binding request"); - response->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "returning conflict error to remote party"); + ZS_EVENTING_TRACE_OBJECT(Debug, *response, "returning conflict error to remote party"); return; } route->mLastReceivedCheck = mLastReceivedPacket; if (Time() == route->mLastReceivedResponse) { if (route->mOutgoingCheck) { - ZS_LOG_DEBUG(log("forcing a trigger check response immediately") + route->toDebug()) - route->trace(__func__, "activate trigger check"); + ZS_LOG_DEBUG(log("forcing a trigger check response immediately") + route->toDebug()); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "activate trigger check"); route->mOutgoingCheck->retryRequestNow(); } } @@ -1094,8 +1096,8 @@ namespace ortc (route->isFailed()) || (route->isIgnored())) { if (mRemoteParameters.mUsernameFragment.hasData()) { - ZS_LOG_DETAIL(log("going to activate candidate pair because of incoming request") + route->toDebug()) - route->trace(__func__, "activate route (due to incoming request)"); + ZS_LOG_DETAIL(log("going to activate candidate pair because of incoming request") + route->toDebug()); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "activate route (due to incoming request)"); setInProgress(route); } else { mNextActivationCausesAllRoutesThatReceivedChecksToActivate = true; @@ -1104,10 +1106,10 @@ namespace ortc auto response = createBindResponse(packet, route); - route->trace(__func__, "create response to stun binding request"); - response->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "create response to stun binding request"); + ZS_EVENTING_TRACE_OBJECT(Trace, *response, "create response to stun binding request"); - ZS_LOG_TRACE(log("sending binding response to remote party") + route->toDebug() + response->toDebug()) + ZS_LOG_TRACE(log("sending binding response to remote party") + route->toDebug() + response->toDebug()); sendPacket(routerRoute, response); if (IICETypes::Role_Controlled == mOptions.mRole) { @@ -1143,8 +1145,8 @@ namespace ortc mLastReceivedUseCandidate = mLastReceivedPacket; if (previousRoute != mActiveRoute) { - mActiveRoute->trace(__func__, reason); - ZS_LOG_DEBUG(log("controlling side indicates to use this route") + mActiveRoute->toDebug()) + ZS_EVENTING_TRACE_OBJECT(Trace, *mActiveRoute, reason); + ZS_LOG_DEBUG(log("controlling side indicates to use this route") + mActiveRoute->toDebug()); wakeUp(); } } @@ -1165,7 +1167,7 @@ namespace ortc RouterRoutePtr routerRoute, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { ZS_EVENTING_4( x, i, Trace, IceTransportReceivedPacketFromGatherer, ol, IceTransport, Receive, @@ -1182,15 +1184,16 @@ namespace ortc auto found = mGathererRoutes.find(routerRoute->mID); if (found == mGathererRoutes.end()) { - ZS_LOG_WARNING(Detail, log("route was not found") + routerRoute->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)) + ZS_LOG_WARNING(Detail, log("route was not found") + routerRoute->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)); + ZS_EVENTING_TRACE_OBJECT(Debug, *routerRoute, "route was not found"); return; } auto route = (*found).second; if (route->isBlacklisted()) { - ZS_LOG_WARNING(Debug, log("no consent given on this route") + route->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)) - route->trace(__func__, "ignoring incoming packet (route was blacklisted)"); + ZS_LOG_WARNING(Debug, log("no consent given on this route") + route->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "ignoring incoming packet (route was blacklisted)"); return; } @@ -1199,14 +1202,14 @@ namespace ortc updateAfterPacket(route); if (!mActiveRoute) { - ZS_LOG_WARNING(Debug, log("no active route chosen (thus must ignore packet)") + route->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)) - route->trace(__func__, "ignoring incoming packet (no route was chosen)"); + ZS_LOG_WARNING(Debug, log("no active route chosen (thus must ignore packet)") + route->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "ignoring incoming packet (no route was chosen)"); return; } transport = mSecureTransport.lock(); if (!transport) { - ZS_LOG_WARNING(Debug, log("no secure transport attached (packet is being buffered)")) + ZS_LOG_WARNING(Debug, log("no secure transport attached (packet is being buffered)")); mMustBufferPackets = true; } @@ -1263,7 +1266,7 @@ namespace ortc AutoRecursiveLock lock(*this); transport = mSecureTransportOld.lock(); if (!transport) { - ZS_LOG_WARNING(Debug, log("no older transport available to send packet") + routerRoute->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)) + ZS_LOG_WARNING(Debug, log("no older transport available to send packet") + routerRoute->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)); return; } } @@ -1282,14 +1285,14 @@ namespace ortc auto oldTransportID = transport->getID(); mSecureTransportOld.reset(); - ZS_LOG_DEBUG(log("old transport did not handle packet either (thus disposing of old transport)") + ZS_PARAM("old transport id", oldTransportID) + routerRoute->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)) + ZS_LOG_DEBUG(log("old transport did not handle packet either (thus disposing of old transport)") + ZS_PARAM("old transport id", oldTransportID) + routerRoute->toDebug() + ZS_PARAMIZE(bufferSizeInBytes)); return; } } } //------------------------------------------------------------------------- - bool ICETransport::needsMoreCandidates() const + bool ICETransport::needsMoreCandidates() const noexcept { bool needMoreCandidates = mNeedsMoreCandidates; ZS_LOG_TRACE(log("needs more candidates") + ZS_PARAM("need", needMoreCandidates)) @@ -1300,12 +1303,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForICETransportContoller - #pragma mark + // + // ICETransport => IICETransportForICETransportContoller + // //------------------------------------------------------------------------- - void ICETransport::notifyControllerAttached(ICETransportControllerPtr inController) + void ICETransport::notifyControllerAttached(ICETransportControllerPtr inController) noexcept { UseICETransportControllerPtr controller = inController; @@ -1322,19 +1325,19 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::notifyControllerDetached(ICETransportController &inController) + void ICETransport::notifyControllerDetached(ICETransportController &inController) noexcept { UseICETransportController &controller = inController; AutoRecursiveLock lock(*this); - ZS_THROW_INVALID_ASSUMPTION_IF(IICETypes::Component_RTCP == mComponent) + ZS_ASSERT(IICETypes::Component_RTCP != mComponent); UseICETransportControllerPtr currentController = mTransportController.lock(); if (currentController) { if (currentController->getID() != controller.getID()) { - ZS_LOG_WARNING(Trace, log("notified about controller detachment for obsolete ice transport controller")) + ZS_LOG_WARNING(Trace, log("notified about controller detachment for obsolete ice transport controller")); return; } } @@ -1357,7 +1360,7 @@ namespace ortc if (!route->isFrozen()) continue; - ZS_LOG_WARNING(Debug, log("frozen dependency needs to be removed") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("frozen dependency needs to be removed") + route->toDebug()); setPending(route); } } @@ -1367,12 +1370,12 @@ namespace ortc const String &localFoundation, const String &remoteFoundation, PromisePtr promise - ) + ) noexcept { AutoRecursiveLock lock(*this); if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_WARNING(Detail, log("cannot attach promise to foundation when shutting down/shutdown")) + ZS_LOG_WARNING(Detail, log("cannot attach promise to foundation when shutting down/shutdown")); return false; } @@ -1380,19 +1383,19 @@ namespace ortc auto found = mFoundationRoutes.find(foundation); if (found == mFoundationRoutes.end()) { - ZS_LOG_TRACE(log("no route found with this foundation") + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)) + ZS_LOG_TRACE(log("no route found with this foundation") + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)); return false; } RouteMap &routes = (*found).second; - ZS_THROW_BAD_STATE_IF(0 == routes.size()) + ZS_ASSERT(0 != routes.size()); if (routes.size() == 1) { auto foundRoute = routes.begin(); auto route = (*foundRoute).second; - ZS_LOG_DEBUG(log("installing dependency promise") + route->toDebug() + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)) + ZS_LOG_DEBUG(log("installing dependency promise") + route->toDebug() + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)); route->mDependentPromises.push_back(promise); @@ -1414,7 +1417,7 @@ namespace ortc PromisePtr tempPromise(Promise::create(getAssociatedMessageQueue())); promises.push_back(tempPromise); - ZS_LOG_DEBUG(log("installed dependency race promise") + route->toDebug() + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)) + ZS_LOG_DEBUG(log("installed dependency race promise") + route->toDebug() + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)); route->mDependentPromises.push_back(tempPromise); } @@ -1431,7 +1434,7 @@ namespace ortc string, remoteFoundation, remoteFoundation ); - ZS_LOG_DEBUG(log("installed dependency race promises") + ZS_PARAM("total", promises.size()) + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)) + ZS_LOG_DEBUG(log("installed dependency race promises") + ZS_PARAM("total", promises.size()) + ZS_PARAMIZE(localFoundation) + ZS_PARAMIZE(remoteFoundation)); return true; } @@ -1439,15 +1442,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForSecureTransport - #pragma mark + // + // ICETransport => IICETransportForSecureTransport + // //------------------------------------------------------------------------- void ICETransport::notifyAttached( PUID secureTransportID, UseSecureTransportPtr transport - ) + ) noexcept { ZS_EVENTING_2( x, i, Detail, IceTransportInternalSecureTransportAttachedEvent, ol, IceTransport, InternalEvent, @@ -1455,7 +1458,7 @@ namespace ortc puid, secureTransportId, secureTransportID ); - ZS_LOG_DETAIL(log("notify attached") + ZS_PARAM("secure transport id", secureTransportID)) + ZS_LOG_DETAIL(log("notify attached") + ZS_PARAM("secure transport id", secureTransportID)); AutoRecursiveLock lock(*this); @@ -1463,7 +1466,7 @@ namespace ortc if ((isShutdown()) || (!pThis)) { - ZS_LOG_WARNING(Detail, log("cannot attach secure transport while shutdown")) + ZS_LOG_WARNING(Detail, log("cannot attach secure transport while shutdown")); return; } @@ -1474,7 +1477,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::notifyDetached(PUID secureTransportID) + void ICETransport::notifyDetached(PUID secureTransportID) noexcept { auto pThis = mThisWeak.lock(); if (!pThis) return; @@ -1489,26 +1492,26 @@ namespace ortc } //------------------------------------------------------------------------- - IICETypes::Roles ICETransport::getRole() const + IICETypes::Roles ICETransport::getRole() const noexcept { AutoRecursiveLock lock(*this); return mOptions.mRole; } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::getRTPTransport() const + ICETransportPtr ICETransport::getRTPTransport() const noexcept { return mRTPTransport.lock(); } //------------------------------------------------------------------------- - ICETransportPtr ICETransport::getRTCPTransport() const + ICETransportPtr ICETransport::getRTCPTransport() const noexcept { return mRTCPTransport; } //------------------------------------------------------------------------- - ICETransport::UseSecureTransportPtr ICETransport::getSecureTransport() const + ICETransport::UseSecureTransportPtr ICETransport::getSecureTransport() const noexcept { AutoRecursiveLock lock(*this); return mSecureTransport.lock(); @@ -1518,7 +1521,7 @@ namespace ortc bool ICETransport::sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { ZS_EVENTING_3( x, i, Trace, IceTransportSecureTransportSendPacket, ol, IceTransport, Send, @@ -1534,7 +1537,7 @@ namespace ortc AutoRecursiveLock lock(*this); if (!installGathererRoute(mActiveRoute)) { - ZS_LOG_WARNING(Trace, log("cannot install a gatherer route") + (mActiveRoute ? mActiveRoute->toDebug() : ElementPtr()) + ZS_PARAM("buffer size", bufferSizeInBytes)) + ZS_LOG_WARNING(Trace, log("cannot install a gatherer route") + (mActiveRoute ? mActiveRoute->toDebug() : ElementPtr()) + ZS_PARAM("buffer size", bufferSizeInBytes)); return false; } @@ -1550,7 +1553,7 @@ namespace ortc size, size, bufferSizeInBytes ); - routerRoute->trace(__func__, "gatherer to use this route to send secure packet"); + ZS_EVENTING_TRACE_OBJECT(Insane, *routerRoute, "gatherer to use this route to send secure packet"); return gatherer->sendPacket(*this, routerRoute, buffer, bufferSizeInBytes); } @@ -1558,15 +1561,14 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportAsyncDelegate - #pragma mark + // + // ICETransport => IICETransportAsyncDelegate + // //------------------------------------------------------------------------- void ICETransport::onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise) { -#define TODO_COMPLETE 1 -#define TODO_COMPLETE 2 +#pragma ZS_BUILD_NOTE("TODO","Add ICE transport stats") promise->reject(); } @@ -1583,13 +1585,13 @@ namespace ortc AutoRecursiveLock lock(*this); if (!mGathererRouter) { - ZS_LOG_WARNING(Detail, log("cannot handle packet as no gather is attached") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + stunPacket->toDebug()) + ZS_LOG_WARNING(Detail, log("cannot handle packet as no gather is attached") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + stunPacket->toDebug()); return; } routerRoute = mGathererRouter->findRoute(localCandidate, remoteIP, true); if (!routerRoute) { - ZS_LOG_WARNING(Detail, log("cannot handle packet as no route could be created") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + stunPacket->toDebug()) + ZS_LOG_WARNING(Detail, log("cannot handle packet as no route could be created") + localCandidate->toDebug() + ZS_PARAM("remote ip", remoteIP.string()) + stunPacket->toDebug()); return; } } @@ -1599,10 +1601,10 @@ namespace ortc puid, id, mID, puid, routerRouteId, routerRoute->mID ); - routerRoute->trace(__func__, "retry received stun packet"); - stunPacket->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Insane, *routerRoute, "retry received stun packet"); + ZS_EVENTING_TRACE_OBJECT(Trace, *stunPacket, "retry received stun packet"); - ZS_LOG_TRACE(log("retrying to handle packet again") + routerRoute->toDebug() + stunPacket->toDebug()) + ZS_LOG_TRACE(log("retrying to handle packet again") + routerRoute->toDebug() + stunPacket->toDebug()); // forward packet to be handled on newly established route notifyPacket(routerRoute, stunPacket); @@ -1637,7 +1639,7 @@ namespace ortc AutoRecursiveLock lock(*this); if (secureTransportID != mSecureTransportID) { - ZS_LOG_WARNING(Detail, log("secure transport is not attached") + ZS_PARAM("secure transport id", secureTransportID)) + ZS_LOG_WARNING(Detail, log("secure transport is not attached") + ZS_PARAM("secure transport id", secureTransportID)); return; } @@ -1666,7 +1668,7 @@ namespace ortc transport = mSecureTransport.lock(); if (!transport) { - ZS_LOG_WARNING(Debug, log("secure transport is not attached (thus must still buffer)")) + ZS_LOG_WARNING(Debug, log("secure transport is not attached (thus must still buffer)")); return; } @@ -1700,7 +1702,7 @@ namespace ortc } if (!oldTransport) { - ZS_LOG_WARNING(Debug, log("no older transport available to send packet (thus discarding packet)") + ZS_PARAM("packet size", deliverPacket->SizeInBytes())) + ZS_LOG_WARNING(Debug, log("no older transport available to send packet (thus discarding packet)") + ZS_PARAM("packet size", deliverPacket->SizeInBytes())); goto deliver_next; } @@ -1719,7 +1721,7 @@ namespace ortc auto oldTransportID = transport->getID(); mSecureTransportOld.reset(); - ZS_LOG_DEBUG(log("old transport did not handle packet either (thus disposing of old transport)") + ZS_PARAM("old transport id", oldTransportID) + ZS_PARAMIZE(deliverPacket->SizeInBytes())) + ZS_LOG_DEBUG(log("old transport did not handle packet either (thus disposing of old transport)") + ZS_PARAM("old transport id", oldTransportID) + ZS_PARAMIZE(deliverPacket->SizeInBytes())); } goto deliver_next; } @@ -1749,9 +1751,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IWakeDelegate - #pragma mark + // + // ICETransport => IWakeDelegate + // //------------------------------------------------------------------------- void ICETransport::onWake() @@ -1769,9 +1771,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => ITimerDelegate - #pragma mark + // + // ICETransport => ITimerDelegate + // //------------------------------------------------------------------------- void ICETransport::onTimer(ITimerPtr timer) @@ -1854,9 +1856,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IPromiseSettledDelegate - #pragma mark + // + // ICETransport => IPromiseSettledDelegate + // //------------------------------------------------------------------------- void ICETransport::onPromiseSettled(PromisePtr promise) @@ -1865,7 +1867,7 @@ namespace ortc auto found = mFrozen.find(promise); if (found == mFrozen.end()) { - ZS_LOG_WARNING(Debug, log("did not find any routes frozen upon promise")) + ZS_LOG_WARNING(Debug, log("did not find any routes frozen upon promise")); return; } @@ -1877,30 +1879,30 @@ namespace ortc puid, routeId, route->mID ); - route->trace(__func__, "unfrozen promise settled"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "unfrozen promise settled"); mFrozen.erase(found); route->mFrozenPromise.reset(); if (!route->isFrozen()) { - ZS_LOG_WARNING(Debug, log("route was not frozen (thus don't unfreeze)") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("route was not frozen (thus don't unfreeze)") + route->toDebug()); return; } if (promise->isResolved()) { - ZS_LOG_DEBUG(log("activating route now") + route->toDebug()) + ZS_LOG_DEBUG(log("activating route now") + route->toDebug()); setInProgress(route); return; } ReasonNoMoreRelationshipPtr reason = promise->reason(); if (reason) { - ZS_LOG_DEBUG(log("activating route now (relationship to other frozen transport severed prematurely)") + route->toDebug()) + ZS_LOG_DEBUG(log("activating route now (relationship to other frozen transport severed prematurely)") + route->toDebug()); setInProgress(route); return; } - ZS_LOG_WARNING(Debug, log("failing route with same foundation that failed in other transport")) + ZS_LOG_WARNING(Debug, log("failing route with same foundation that failed in other transport")); setFailed(route); } @@ -1908,9 +1910,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICEGathererDelegate - #pragma mark + // + // ICETransport => IICEGathererDelegate + // //------------------------------------------------------------------------- void ICETransport::onICEGathererStateChange( @@ -1926,7 +1928,7 @@ namespace ortc ); AutoRecursiveLock lock(*this); - ZS_LOG_TRACE(log("ice gatherer state changed") + ZS_PARAM("gather id", gatherer->getID()) + ZS_PARAM("state", IICEGatherer::toString(state))) + ZS_LOG_TRACE(log("ice gatherer state changed") + ZS_PARAM("gather id", gatherer->getID()) + ZS_PARAM("state", IICEGatherer::toString(state))); wakeUp(); } @@ -1959,7 +1961,7 @@ namespace ortc AutoRecursiveLock lock(*this); if (gatherer != mGatherer) { - ZS_LOG_WARNING(Debug, log("notified about candidate on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + candidate->toDebug()) + ZS_LOG_WARNING(Debug, log("notified about candidate on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + candidate->toDebug()); return; } @@ -1969,7 +1971,7 @@ namespace ortc auto found = mLocalCandidates.find(hash); if (found != mLocalCandidates.end()) { - ZS_LOG_DEBUG(log("local candidate is already known (thus ignoring)") + candidate->toDebug()) + ZS_LOG_DEBUG(log("local candidate is already known (thus ignoring)") + candidate->toDebug()); goto check_recalculate; } @@ -1983,7 +1985,7 @@ namespace ortc mLegalRoutesDirty = true; shouldRecalculate = true; - ZS_LOG_DEBUG(log("found new local candidate") + candidate->toDebug()) + ZS_LOG_DEBUG(log("found new local candidate") + candidate->toDebug()); goto check_recalculate; @@ -2011,21 +2013,21 @@ namespace ortc enum, component, candidate->mComponent ); - ZS_THROW_INVALID_ASSUMPTION_IF(candidate->mComponent != mComponent); + ZS_ASSERT(candidate->mComponent == mComponent); AutoRecursiveLock lock(*this); if (gatherer != mGatherer) { - ZS_LOG_WARNING(Debug, log("notified about candidate on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + candidate->toDebug()) + ZS_LOG_WARNING(Debug, log("notified about candidate on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + candidate->toDebug()); return; } if (mLocalCandidatesComplete) { - ZS_LOG_TRACE(log("already notified end of local candidates")) + ZS_LOG_TRACE(log("already notified end of local candidates")); return; } - ZS_LOG_DEBUG(log("end of local candidates found") + candidate->toDebug()) + ZS_LOG_DEBUG(log("end of local candidates found") + candidate->toDebug()); mLocalCandidatesComplete = true; mLegalRoutesDirty = true; @@ -2062,7 +2064,7 @@ namespace ortc AutoRecursiveLock lock(*this); if (gatherer != mGatherer) { - ZS_LOG_WARNING(Debug, log("notified about candidate on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + candidate->toDebug()) + ZS_LOG_WARNING(Debug, log("notified about candidate on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + candidate->toDebug()); return; } @@ -2070,11 +2072,11 @@ namespace ortc auto found = mLocalCandidates.find(hash); if (found == mLocalCandidates.end()) { - ZS_LOG_WARNING(Debug, log("notified local candidate gone that was never known") + candidate->toDebug()) + ZS_LOG_WARNING(Debug, log("notified local candidate gone that was never known") + candidate->toDebug()); return; } - ZS_LOG_DEBUG(log("local candidate is now gone") + candidate->toDebug()) + ZS_LOG_DEBUG(log("local candidate is now gone") + candidate->toDebug()); mLocalCandidates.erase(found); mLegalRoutesDirty = true; @@ -2093,20 +2095,20 @@ namespace ortc AutoRecursiveLock lock(*this); if (gatherer != mGatherer) { - ZS_LOG_WARNING(Debug, log("notified about error on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + errorEvent->toDebug()) + ZS_LOG_WARNING(Debug, log("notified about error on non-associated gatherer") + ZS_PARAM("gatherer", gatherer->getID()) + errorEvent->toDebug()); return; } - ZS_LOG_WARNING(Detail, log("notified gatherer has encountered an error") + errorEvent->toDebug()) + ZS_LOG_WARNING(Detail, log("notified gatherer has encountered an error") + errorEvent->toDebug()); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => ISTUNRequesterDelegate - #pragma mark + // + // ICETransport => ISTUNRequesterDelegate + // //------------------------------------------------------------------------- void ICETransport::onSTUNRequesterSendPacket( @@ -2124,7 +2126,7 @@ namespace ortc size, size, packet->SizeInBytes() ); - ZS_THROW_INVALID_ARGUMENT_IF(!packet); + ZS_ASSERT(packet); RouterRoutePtr routerRoute; UseICEGathererPtr gatherer; @@ -2133,7 +2135,7 @@ namespace ortc AutoRecursiveLock lock(*this); if (!mGatherer) { - ZS_LOG_WARNING(Trace, log("no gatherer attached thus cannot send stun request") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())) + ZS_LOG_WARNING(Trace, log("no gatherer attached thus cannot send stun request") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())); return; } @@ -2146,7 +2148,7 @@ namespace ortc route = mUseCandidateRoute; goto setup_route; } - ZS_LOG_WARNING(Trace, log("no active route thus cannot sent use candidate request") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())) + ZS_LOG_WARNING(Trace, log("no active route thus cannot sent use candidate request") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())); return; } @@ -2158,7 +2160,7 @@ namespace ortc } } - ZS_LOG_WARNING(Trace, log("stun requester is not found (thus ignoring request to send packet)") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())) + ZS_LOG_WARNING(Trace, log("stun requester is not found (thus ignoring request to send packet)") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())); return; setup_route: @@ -2171,11 +2173,11 @@ namespace ortc } if (!routerRoute) { - ZS_LOG_WARNING(Trace, log("cannot send packet as no route set") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())) + ZS_LOG_WARNING(Trace, log("cannot send packet as no route set") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes())); return; } - ZS_LOG_TRACE(log("sending stun packet") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes()) + routerRoute->toDebug()) + ZS_LOG_TRACE(log("sending stun packet") + ZS_PARAM("stun requester", requester->getID()) + ZS_PARAM("destination ip", destination.string()) + ZS_PARAM("packet size", packet->SizeInBytes()) + routerRoute->toDebug()); gatherer->sendPacket(*this, routerRoute, packet->BytePtr(), packet->SizeInBytes()); } @@ -2184,7 +2186,7 @@ namespace ortc ISTUNRequesterPtr requester, IPAddress fromIPAddress, STUNPacketPtr response - ) + ) noexcept { ZS_EVENTING_3( x, i, Trace, IceTransportInternalStunRequesterReceivedResponse, ol, IceTransport, Receive, @@ -2192,12 +2194,12 @@ namespace ortc puid, stunReuqesterId, requester->getID(), string, fromIpAddress, fromIPAddress.string() ); - response->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *response, "ice transport response received"); AutoRecursiveLock lock(*this); if (!mGatherer) { - ZS_LOG_WARNING(Debug, log("cannot handle stun response when no gatherer is associated")) + ZS_LOG_WARNING(Debug, log("cannot handle stun response when no gatherer is associated")); return false; } @@ -2214,7 +2216,7 @@ namespace ortc } { - ZS_LOG_WARNING(Debug, log("response to request must be from obsolete request") + ZS_PARAM("request id", requester->getID())) + ZS_LOG_WARNING(Debug, log("response to request must be from obsolete request") + ZS_PARAM("request id", requester->getID())); return false; } @@ -2232,7 +2234,7 @@ namespace ortc string, ip, ip.string() ); - ZS_LOG_WARNING(Detail, log("response ip does not match sent ip") + ZS_PARAM("from ip", fromIPAddress.string()) + ZS_PARAM("sent ip", ip.string())) + ZS_LOG_WARNING(Detail, log("response ip does not match sent ip") + ZS_PARAM("from ip", fromIPAddress.string()) + ZS_PARAM("sent ip", ip.string())); mOutgoingChecks[requester] = route; // put it back since it's not valid return false; } @@ -2245,7 +2247,7 @@ namespace ortc if (STUNPacket::Class_ErrorResponse == response->mClass) { if (STUNPacket::ErrorCode_RoleConflict == response->mErrorCode) { // role conflict occured - ZS_LOG_WARNING(Detail, log("role conflict detected") + response->toDebug()) + ZS_LOG_WARNING(Detail, log("role conflict detected") + response->toDebug()); bool changed = false; @@ -2273,7 +2275,7 @@ namespace ortc return true; } - ZS_LOG_WARNING(Debug, log("error response received to ice binding request and candidate is now being blacklisted (as consent was rejected)") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("error response received to ice binding request and candidate is now being blacklisted (as consent was rejected)") + route->toDebug()); setBlacklisted(route); return true; } @@ -2286,18 +2288,18 @@ namespace ortc auto previousValue = route->mLastRoundTripMeasurement; route->mLastRoundTripMeasurement = zsLib::toMicroseconds(getLatest(mLastReceivedPacket, route->mLastRoundTripCheck) - route->mLastRoundTripCheck); - ZS_LOG_TRACE(log("updated route round trip time") + route->toDebug()) + ZS_LOG_TRACE(log("updated route round trip time") + route->toDebug()); if (Microseconds() != previousValue) { auto largest = previousValue > route->mLastRoundTripMeasurement ? previousValue : route->mLastRoundTripMeasurement; auto smallest = previousValue < route->mLastRoundTripMeasurement ? previousValue : route->mLastRoundTripMeasurement; if (isMagnitudeFaster(largest, smallest)) { - ZS_LOG_TRACE(log("magnitude difference in route measurement (pick route again)") + ZS_PARAM("previous", previousValue) + route->toDebug()) + ZS_LOG_TRACE(log("magnitude difference in route measurement (pick route again)") + ZS_PARAM("previous", previousValue) + route->toDebug()); mForcePickRouteAgain = true; wakeUp(); } } else { - ZS_LOG_TRACE(log("first time a round trip measurement has happened (pick route again)") + route->toDebug()) + ZS_LOG_TRACE(log("first time a round trip measurement has happened (pick route again)") + route->toDebug()); mForcePickRouteAgain = true; wakeUp(); } @@ -2327,7 +2329,7 @@ namespace ortc route->mNextKeepWarm = ITimer::create(pThis, zsLib::now() + mKeepWarmTimeBase + Milliseconds(IHelper::random(0, static_cast(mKeepWarmTimeRandomizedAddTime.count())))); mNextKeepWarmTimers[route->mNextKeepWarm] = route; - ZS_LOG_TRACE(log("installed keep warm timer") + route->toDebug()) + ZS_LOG_TRACE(log("installed keep warm timer") + route->toDebug()); } updateAfterPacket(route); @@ -2346,7 +2348,7 @@ namespace ortc AutoRecursiveLock lock(*this); if (mUseCandidateRequest == requester) { - ZS_LOG_WARNING(Detail, log("failed to select route to use") + (mUseCandidateRoute ? mUseCandidateRoute->toDebug() : ElementPtr())) + ZS_LOG_WARNING(Detail, log("failed to select route to use") + (mUseCandidateRoute ? mUseCandidateRoute->toDebug() : ElementPtr())); mUseCandidateRequest->cancel(); mUseCandidateRequest.reset(); wakeUp(); @@ -2355,16 +2357,16 @@ namespace ortc auto found = mOutgoingChecks.find(requester); if (found == mOutgoingChecks.end()) { - ZS_LOG_WARNING(Debug, log("timeout for an obsolete STUN requester") + ZS_PARAM("request id", requester->getID())) + ZS_LOG_WARNING(Debug, log("timeout for an obsolete STUN requester") + ZS_PARAM("request id", requester->getID())); return; } auto route = (*found).second; - ZS_LOG_WARNING(Debug, log("route has failed due to timeout") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("route has failed due to timeout") + route->toDebug()); if (route->isSucceeded()) { if (mBlacklistConsent) { - ZS_LOG_WARNING(Detail, log("route was successful but is now blacklisted from future attempts") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route was successful but is now blacklisted from future attempts") + route->toDebug()); setBlacklisted(route); return; } @@ -2376,12 +2378,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => (internal) - #pragma mark + // + // ICETransport => (internal) + // //------------------------------------------------------------------------- - Log::Params ICETransport::log(const char *message) const + Log::Params ICETransport::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ICETransport"); IHelper::debugAppend(objectEl, "id", mID); @@ -2389,13 +2391,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ICETransport::debug(const char *message) const + Log::Params ICETransport::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr ICETransport::toDebug() const + ElementPtr ICETransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -2497,33 +2499,33 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::isShuttingDown() const + bool ICETransport::isShuttingDown() const noexcept { return (bool)mGracefulShutdownReference; } //------------------------------------------------------------------------- - bool ICETransport::isShutdown() const + bool ICETransport::isShutdown() const noexcept { if (mGracefulShutdownReference) return false; return IICETransportTypes::State_Closed == mCurrentState; } //------------------------------------------------------------------------- - bool ICETransport::isContinousGathering() const + bool ICETransport::isContinousGathering() const noexcept { if (mGatherer) return mGatherer->isContinousGathering(); return false; } //------------------------------------------------------------------------- - void ICETransport::step() + void ICETransport::step() noexcept { - ZS_LOG_DEBUG(debug("step")) + ZS_LOG_DEBUG(debug("step")); if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_LOG_DEBUG(debug("step forwarding to cancel")); cancel(); return; } @@ -2547,7 +2549,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepCalculateLegalPairs() + bool ICETransport::stepCalculateLegalPairs() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); @@ -2643,7 +2645,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepProcessLegalPairs(CandidatePairMap &pairings) + bool ICETransport::stepProcessLegalPairs(CandidatePairMap &pairings) noexcept { ZS_LOG_DEBUG(log("processing legal pairs")); @@ -2673,8 +2675,8 @@ namespace ortc auto foundLocal = mLocalCandidates.find(localCandidateHash); if (foundLocal == mLocalCandidates.end()) { - ZS_LOG_WARNING(Debug, log("local candidate is gone (thus pairing must be trimmed)")) - goto shutdown_route; + ZS_LOG_WARNING(Debug, log("local candidate is gone (thus pairing must be trimmed)")); + goto shutdown_route; } goto check_route_state; @@ -2698,14 +2700,14 @@ namespace ortc keep_route: { - ZS_LOG_TRACE(log("peer reflexive route still in valid state (thus still legal)") + route->toDebug()) + ZS_LOG_TRACE(log("peer reflexive route still in valid state (thus still legal)") + route->toDebug()); continue; } shutdown_route: { - ZS_LOG_WARNING(Debug, log("route no longer valid (no candidate pairing found or peer reflexive no longer valid)") + route->toDebug()) - shutdown(route); + ZS_LOG_WARNING(Debug, log("route no longer valid (no candidate pairing found or peer reflexive no longer valid)") + route->toDebug()); + shutdown(route); continue; } } @@ -2719,7 +2721,7 @@ namespace ortc route->mCandidatePair = candidatePair; route->mCandidatePairHash = hash; - route->trace(__func__, "new legal route"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "new legal route"); ZS_LOG_DEBUG(log("found new legal route") + route->toDebug()); mLegalRoutes[hash] = route; @@ -2732,21 +2734,21 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepPendingActivation() + bool ICETransport::stepPendingActivation() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (0 == mRouteStateTracker->count(Route::State_New)) { - ZS_LOG_TRACE(log("no routes pending activation")) + ZS_LOG_TRACE(log("no routes pending activation")); return true; } if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot activate any pending candidates as remote username is not set")) + ZS_LOG_TRACE(log("cannot activate any pending candidates as remote username is not set")); return true; } - ZS_LOG_DEBUG(log("calculating pending activation")) + ZS_LOG_DEBUG(log("calculating pending activation")); for (auto iter = mLegalRoutes.begin(); iter != mLegalRoutes.end(); ++iter) { @@ -2758,36 +2760,36 @@ namespace ortc auto found = mPendingActivation.find(route->mPendingPriority); if (found != mPendingActivation.end()) { if ((*found).second == route) { - ZS_LOG_TRACE(log("route is already pending activation") + route->toDebug()) + ZS_LOG_TRACE(log("route is already pending activation") + route->toDebug()); continue; } route->mPendingPriority = 0; } - ZS_LOG_DEBUG(log("route is now pending activation") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now pending activation") + route->toDebug()); setPending(route); } - ZS_LOG_DEBUG(log("pending activation is now calculated") + ZS_PARAM("total pending", mRouteStateTracker->count(Route::State_Pending))) + ZS_LOG_DEBUG(log("pending activation is now calculated") + ZS_PARAM("total pending", mRouteStateTracker->count(Route::State_Pending))); return true; } //------------------------------------------------------------------------- - bool ICETransport::stepActivationTimer() + bool ICETransport::stepActivationTimer() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); auto now = zsLib::now(); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot activate any candidates as remote username is not set")) + ZS_LOG_TRACE(log("cannot activate any candidates as remote username is not set")); goto no_activation_timer; } if (isContinousGathering()) { if (Time() != mLastReceivedPacket) { if (mLastReceivedPacket + mNoPacketsReceivedRecheckTime < now) { - ZS_LOG_TRACE(log("needs activation timer as no remote packet has been received for a while")) + ZS_LOG_TRACE(log("needs activation timer as no remote packet has been received for a while")); goto need_activation_timer; } } @@ -2795,24 +2797,24 @@ namespace ortc if ((isComplete()) || (isDisconnected()) || (isFailed())) { - ZS_LOG_TRACE(log("no activation timer needed (nothing more to test)")) + ZS_LOG_TRACE(log("no activation timer needed (nothing more to test)")); goto no_activation_timer; } } if (mPendingActivation.size() > 0) { - ZS_LOG_TRACE(log("need activation timer as routes are pending activation")) + ZS_LOG_TRACE(log("need activation timer as routes are pending activation")); goto need_activation_timer; } - ZS_LOG_TRACE(log("no activation timer needed at this time")) + ZS_LOG_TRACE(log("no activation timer needed at this time")); goto no_activation_timer; no_activation_timer: { if (mActivationTimer) { - ZS_LOG_DEBUG(log("no longer need activation timer")) + ZS_LOG_DEBUG(log("no longer need activation timer")); mActivationTimer->cancel(); mActivationTimer.reset(); } @@ -2823,7 +2825,7 @@ namespace ortc { if (!mActivationTimer) { auto duration = Milliseconds(ISettings::getUInt(ORTC_SETTING_ICE_TRANSPORT_ACTIVATION_TIMER_IN_MILLISECONDS)); - ZS_LOG_DEBUG(log("creating activation timer") + ZS_PARAM("duration (ms)", duration)) + ZS_LOG_DEBUG(log("creating activation timer") + ZS_PARAM("duration (ms)", duration)); mActivationTimer = ITimer::create(mThisWeak.lock(), duration); } } @@ -2831,22 +2833,22 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepPickRoute() + bool ICETransport::stepPickRoute() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot pick a route as no remote username is set")) + ZS_LOG_TRACE(log("cannot pick a route as no remote username is set")); return true; } if ((!hasWarmRoutesChanged()) && (!mForcePickRouteAgain)) { - ZS_LOG_TRACE(log("warm routes have not changed (thus no need to pick another route)")) + ZS_LOG_TRACE(log("warm routes have not changed (thus no need to pick another route)")); return true; } if (Role_Controlled == mOptions.mRole) { - ZS_LOG_TRACE(log("cannot choose route as in controlled role") + mOptions.toDebug()) + ZS_LOG_TRACE(log("cannot choose route as in controlled role") + mOptions.toDebug()); return true; } @@ -2865,7 +2867,7 @@ namespace ortc auto preference = route->getPreference(Role_Controlling == mOptions.mRole); if (!chosenRoute) { - ZS_LOG_TRACE(log("no route chosen thus must pick this route") + route->toDebug()) + ZS_LOG_TRACE(log("no route chosen thus must pick this route") + route->toDebug()); goto chose_this_route; } @@ -2873,13 +2875,13 @@ namespace ortc { auto lastRemoteActivity = getLastRemoteActivity(route); if (Time() == lastRemoteActivity) { - ZS_LOG_WARNING(Trace, log("will not consider this route because of inactivity") + route->toDebug()) + ZS_LOG_WARNING(Trace, log("will not consider this route because of inactivity") + route->toDebug()); continue; } // if after double the no packets arrival window activity hasn't happened then do not consider this route as active anymore if (lastRemoteActivity + mNoPacketsReceivedRecheckTime + mNoPacketsReceivedRecheckTime < now) { - ZS_LOG_WARNING(Trace, log("will not consider this route because of recent inactivity") + ZS_PARAM("difference", (now - lastRemoteActivity)) + route->toDebug()) + ZS_LOG_WARNING(Trace, log("will not consider this route because of recent inactivity") + ZS_PARAM("difference", (now - lastRemoteActivity)) + route->toDebug()); continue; } } @@ -2887,12 +2889,12 @@ namespace ortc if (Microseconds() != fastestRoutePicked) { if (Microseconds() != route->mLastRoundTripMeasurement) { if (isMagnitudeFaster(fastestRoutePicked, route->mLastRoundTripMeasurement)) { - ZS_LOG_TRACE(log("route has faster round trip time (thus will pick)") + route->toDebug() + ZS_PARAM("previous speed", fastestRoutePicked)) + ZS_LOG_TRACE(log("route has faster round trip time (thus will pick)") + route->toDebug() + ZS_PARAM("previous speed", fastestRoutePicked)); reason = "route is magnitude faster than previous route"; goto chose_this_route; } - ZS_LOG_INSANE(log("route is not a magnitude faster round trip time (thus will not pick)") + route->toDebug() + ZS_PARAM("previous speed", fastestRoutePicked)) + ZS_LOG_INSANE(log("route is not a magnitude faster round trip time (thus will not pick)") + route->toDebug() + ZS_PARAM("previous speed", fastestRoutePicked)); } } @@ -2909,7 +2911,7 @@ namespace ortc if (mActiveRoute != chosenRoute) { if (!chosenRoute) { - ZS_LOG_TRACE(log("no route to choose (thus cannot choose route at this time)")) + ZS_LOG_TRACE(log("no route to choose (thus cannot choose route at this time)")); return true; } @@ -2920,28 +2922,28 @@ namespace ortc puid, activeRouteId, mActiveRoute->mID ); - mActiveRoute->trace(__func__, reason); - ZS_LOG_DETAIL(log("new route chosen") + mActiveRoute->toDebug()) + ZS_EVENTING_TRACE_OBJECT(Debug, *mActiveRoute, reason); + ZS_LOG_DETAIL(log("new route chosen") + mActiveRoute->toDebug()); mSubscriptions.delegate()->onICETransportCandidatePairChanged(mThisWeak.lock(), cloneCandidatePair(mActiveRoute)); } else { - ZS_LOG_TRACE(log("no change in preferred route")) + ZS_LOG_TRACE(log("no change in preferred route")); } return true; } //------------------------------------------------------------------------- - bool ICETransport::stepUseCandidate() + bool ICETransport::stepUseCandidate() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot use candidate as remote username is not set")) + ZS_LOG_TRACE(log("cannot use candidate as remote username is not set")); return true; } if (IICETypes::Role_Controlling != mOptions.mRole) { - ZS_LOG_TRACE(log("not in controlling role that cannot force candidate selection") + mOptions.toDebug()) + ZS_LOG_TRACE(log("not in controlling role that cannot force candidate selection") + mOptions.toDebug()); return true; } @@ -2951,7 +2953,7 @@ namespace ortc } if (mActiveRoute == mUseCandidateRoute) { - ZS_LOG_TRACE(log("active route is already nominated (or no route to nominate)") + (mActiveRoute ? mActiveRoute->toDebug() : ElementPtr())) + ZS_LOG_TRACE(log("active route is already nominated (or no route to nominate)") + (mActiveRoute ? mActiveRoute->toDebug() : ElementPtr())); return true; } @@ -2961,25 +2963,25 @@ namespace ortc } if (Time() == mActiveRoute->mLastReceivedResponse) { - ZS_LOG_TRACE(log("cannot nominate candidate because a response was not received yet") + mActiveRoute->toDebug()) + ZS_LOG_TRACE(log("cannot nominate candidate because a response was not received yet") + mActiveRoute->toDebug()); return true; } if (State_Completed != mCurrentState) { - ZS_LOG_TRACE(log("cannot nominate candidate because state is not completed yet") + ZS_PARAM("state", toString(mCurrentState))) + ZS_LOG_TRACE(log("cannot nominate candidate because state is not completed yet") + ZS_PARAM("state", toString(mCurrentState))); return true; } if (mUseCandidateRequest) { - ZS_LOG_DEBUG(log("removing previous use candidate")) + ZS_LOG_DEBUG(log("removing previous use candidate")); mUseCandidateRequest->cancel(); mUseCandidateRequest.reset(); } - ZS_LOG_DEBUG(log("nominating candidate") + mActiveRoute->toDebug()) + ZS_LOG_DEBUG(log("nominating candidate") + mActiveRoute->toDebug()); mUseCandidateRoute = mActiveRoute; - mUseCandidateRoute->trace(__func__, "nominate candidate"); + ZS_EVENTING_TRACE_OBJECT(Debug, *mUseCandidateRoute, "nominate candidate"); mUseCandidateRequest = createBindRequest(mUseCandidateRoute, true); @@ -2987,12 +2989,12 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepDewarmRoutes() + bool ICETransport::stepDewarmRoutes() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot dewarm as remote username is not set")) + ZS_LOG_TRACE(log("cannot dewarm as remote username is not set")); return true; } @@ -3006,25 +3008,25 @@ namespace ortc auto route = (*current).second; if (route == mActiveRoute) { - ZS_LOG_INSANE(log("must keep active route warm") + route->toDebug()) + ZS_LOG_INSANE(log("must keep active route warm") + route->toDebug()); continue; } if (Time() != route->mLastReceivedCheck) { if (route->mLastReceivedCheck + mExpireRouteTime > now) { - ZS_LOG_INSANE(log("have received check (thus do not expire)") + route->toDebug() + ZS_PARAM("expire (s)", mExpireRouteTime)) + ZS_LOG_INSANE(log("have received check (thus do not expire)") + route->toDebug() + ZS_PARAM("expire (s)", mExpireRouteTime)); continue; } } if (route->mLastReceivedResponse + mExpireRouteTime > now) { - ZS_LOG_INSANE(log("have received responce to check (thus do not expire)") + route->toDebug() + ZS_PARAM("expire (s)", mExpireRouteTime)) + ZS_LOG_INSANE(log("have received responce to check (thus do not expire)") + route->toDebug() + ZS_PARAM("expire (s)", mExpireRouteTime)); continue; } - route->trace(__func__, "dewarm"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route cannot be kept warm any longer (expired)"); - ZS_LOG_DEBUG(log("route cannot be kept warm any longer (expired)") + ZS_PARAM("difference", (now - route->mLastReceivedResponse)) + route->toDebug() + ZS_PARAM("expires (s)", mExpireRouteTime)) + ZS_LOG_DEBUG(log("route cannot be kept warm any longer (expired)") + ZS_PARAM("difference", (now - route->mLastReceivedResponse)) + route->toDebug() + ZS_PARAM("expires (s)", mExpireRouteTime)); if (mBlacklistConsent) { setBlacklisted(route); @@ -3037,17 +3039,17 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepKeepWarmRoutes() + bool ICETransport::stepKeepWarmRoutes() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot warm routes as remote username is not set")) + ZS_LOG_TRACE(log("cannot warm routes as remote username is not set")); return true; } if (!mActiveRoute) { - ZS_LOG_TRACE(log("cannot warm routes until an active route is picked")) + ZS_LOG_TRACE(log("cannot warm routes until an active route is picked")); return true; } @@ -3067,20 +3069,20 @@ namespace ortc must_keep_warm: { - ZS_LOG_INSANE(log("route must be kept warm") + route->toDebug()) + ZS_LOG_INSANE(log("route must be kept warm") + route->toDebug()); if (route->mOutgoingCheck) { - ZS_LOG_INSANE(log("already have outgoing check (thus do not need timer)") + route->toDebug()) + ZS_LOG_INSANE(log("already have outgoing check (thus do not need timer)") + route->toDebug()); continue; } if (route->mNextKeepWarm) { - ZS_LOG_INSANE(log("already have next keep warm timer (thus do not need timer)") + route->toDebug()) + ZS_LOG_INSANE(log("already have next keep warm timer (thus do not need timer)") + route->toDebug()); continue; } - route->trace(__func__, "keep warm"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "installing keep warm timer"); - ZS_LOG_DEBUG(log("installing keep warm timer") + route->toDebug()) + ZS_LOG_DEBUG(log("installing keep warm timer") + route->toDebug()); route->mNextKeepWarm = ITimer::create(mThisWeak.lock(), zsLib::now() + mKeepWarmTimeBase + Milliseconds(IHelper::random(0, static_cast(mKeepWarmTimeRandomizedAddTime.count())))); mNextKeepWarmTimers[route->mNextKeepWarm] = route; @@ -3088,7 +3090,7 @@ namespace ortc } do_not_keep_warm: { - ZS_LOG_INSANE(log("route does not need to be kept warm") + route->toDebug()) + ZS_LOG_INSANE(log("route does not need to be kept warm") + route->toDebug()); continue; } } @@ -3097,79 +3099,79 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepExpireRouteTimer() + bool ICETransport::stepExpireRouteTimer() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot expire routes as remote username is not set")) + ZS_LOG_TRACE(log("cannot expire routes as remote username is not set")); return true; } if (!hasWarmRoutesChanged()) { - ZS_LOG_TRACE(log("warm routes have not changed thus nothing to do")) + ZS_LOG_TRACE(log("warm routes have not changed thus nothing to do")); return true; } if ((mWarmRoutes.size() < 1) && (!mActiveRoute)) { if (!mExpireRouteTimer) { - ZS_LOG_TRACE(log("no expire route timer to shutdown (timer is not needed)")) + ZS_LOG_TRACE(log("no expire route timer to shutdown (timer is not needed)")); return true; } - ZS_LOG_DEBUG(log("shutting down expire route timer (as no warm routes to shutdown)")) + ZS_LOG_DEBUG(log("shutting down expire route timer (as no warm routes to shutdown)")); mExpireRouteTimer->cancel(); mExpireRouteTimer.reset(); return true; } if (mExpireRouteTimer) { - ZS_LOG_TRACE(log("already have an expire route timer (thus no need to setup again)")) + ZS_LOG_TRACE(log("already have an expire route timer (thus no need to setup again)")); return true; } - ZS_LOG_DEBUG(log("setting up expire route timer") + ZS_PARAM("expire (s)", mExpireRouteTime)) + ZS_LOG_DEBUG(log("setting up expire route timer") + ZS_PARAM("expire (s)", mExpireRouteTime)); mExpireRouteTimer = ITimer::create(mThisWeak.lock(), mExpireRouteTime); return true; } //------------------------------------------------------------------------- - bool ICETransport::stepLastReceivedPacketTimer() + bool ICETransport::stepLastReceivedPacketTimer() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if (mRemoteParameters.mUsernameFragment.isEmpty()) { - ZS_LOG_TRACE(log("cannot have last packet received timer as remote username is not set")) + ZS_LOG_TRACE(log("cannot have last packet received timer as remote username is not set")); return true; } if (!hasWarmRoutesChanged()) { - ZS_LOG_TRACE(log("warm routes have not changed thus nothing to do")) + ZS_LOG_TRACE(log("warm routes have not changed thus nothing to do")); return true; } if (isContinousGathering()) { - ZS_LOG_TRACE(log("always need last received packet timer for continuous gathering")) + ZS_LOG_TRACE(log("always need last received packet timer for continuous gathering")); goto needs_last_received_packet_timer; } if (mWarmRoutes.size() > 1) { - ZS_LOG_TRACE(log("since more than one route warm - it is possible to resolve via an alternative warm candidate")) + ZS_LOG_TRACE(log("since more than one route warm - it is possible to resolve via an alternative warm candidate")); goto needs_last_received_packet_timer; } - ZS_LOG_TRACE(log("no need to have last received packet timer when no alternative route is possible")) + ZS_LOG_TRACE(log("no need to have last received packet timer when no alternative route is possible")); goto do_not_need_last_received_packet_timer; do_not_need_last_received_packet_timer: { if (!mLastReceivedPacketTimer) { - ZS_LOG_TRACE(log("last received packet timer is already gone")) + ZS_LOG_TRACE(log("last received packet timer is already gone")); return true; } - ZS_LOG_DEBUG(log("removing last received packet timer (no longer needed)")) + ZS_LOG_DEBUG(log("removing last received packet timer (no longer needed)")); mLastReceivedPacketTimer->cancel(); mLastReceivedPacketTimer.reset(); return true; @@ -3178,11 +3180,11 @@ namespace ortc needs_last_received_packet_timer: { if (mLastReceivedPacketTimer) { - ZS_LOG_TRACE(log("already have last received packet timer")) + ZS_LOG_TRACE(log("already have last received packet timer")); return true; } - ZS_LOG_DEBUG(log("setting up last received packet timer") + ZS_PARAM("no packets received recheck time", mNoPacketsReceivedRecheckTime)) + ZS_LOG_DEBUG(log("setting up last received packet timer") + ZS_PARAM("no packets received recheck time", mNoPacketsReceivedRecheckTime)); mLastReceivedPacketTimer = ITimer::create(mThisWeak.lock(), mNoPacketsReceivedRecheckTime); } @@ -3190,13 +3192,13 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::stepSetCurrentState() + bool ICETransport::stepSetCurrentState() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); if ((mRemoteCandidates.size() < 1) && (!mRemoteCandidatesComplete)) { - ZS_LOG_INSANE(log("state is new (no remote candidates found)") + ZS_PARAM("total remote candidates", mRemoteCandidates.size())) + ZS_LOG_INSANE(log("state is new (no remote candidates found)") + ZS_PARAM("total remote candidates", mRemoteCandidates.size())); setState(IICETransport::State_New); return true; } @@ -3210,7 +3212,7 @@ namespace ortc if (localAndRemoteComplete) { if (pendingChecks) { if (mActiveRoute) { - ZS_LOG_INSANE(debug("state is connected (local and remote complete, pending checks, and active route found)")) + ZS_LOG_INSANE(debug("state is connected (local and remote complete, pending checks, and active route found)")); setState(IICETransport::State_Connected); return true; } @@ -3220,40 +3222,40 @@ namespace ortc } if (mActiveRoute) { - ZS_LOG_INSANE(debug("state is complete (local and remote complete, no pending checks, active route found)")) + ZS_LOG_INSANE(debug("state is complete (local and remote complete, no pending checks, active route found)")); setState(IICETransport::State_Completed); } else { - ZS_LOG_INSANE(debug("state is failed (local and remote complete, no pending checks, no active route found)")) + ZS_LOG_INSANE(debug("state is failed (local and remote complete, no pending checks, no active route found)")); setState(IICETransport::State_Failed); } return true; } if (mActiveRoute) { - ZS_LOG_INSANE(debug("state is connected (not complete, may have pending checks, active route found)")) + ZS_LOG_INSANE(debug("state is connected (not complete, may have pending checks, active route found)")); setState(IICETransport::State_Connected); return true; } if (pendingChecks) { - ZS_LOG_INSANE(debug("state is checking (not complete, has pending checks, no active route found)")) + ZS_LOG_INSANE(debug("state is checking (not complete, has pending checks, no active route found)")); setState(IICETransport::State_Checking); return true; } if (mLocalCandidates.size() < 1) { - ZS_LOG_INSANE(debug("state is checking (not complete, has pending checks, no active route found)")) + ZS_LOG_INSANE(debug("state is checking (not complete, has pending checks, no active route found)")); setState(IICETransport::State_Checking); return true; } - ZS_LOG_INSANE(debug("state is disconnected (not complete, no pending checks, no active route found)")) + ZS_LOG_INSANE(debug("state is disconnected (not complete, no pending checks, no active route found)")); setState(IICETransport::State_Disconnected); return true; } //------------------------------------------------------------------------- - bool ICETransport::stepSetNeedsMoreCandidates() + bool ICETransport::stepSetNeedsMoreCandidates() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportStep, ol, IceTransport, Step, puid, id, mID); @@ -3262,10 +3264,10 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::wakeUp() + void ICETransport::wakeUp() noexcept { if (mWakeUp) { - ZS_LOG_TRACE(log("already requested wake-up")) + ZS_LOG_TRACE(log("already requested wake-up")); return; } @@ -3277,10 +3279,10 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::warmRoutesChanged() + void ICETransport::warmRoutesChanged() noexcept { if (mWarmRoutesChanged > 0) { - ZS_LOG_TRACE(log("already notified warm route changed")) + ZS_LOG_TRACE(log("already notified warm route changed")); return; } @@ -3292,20 +3294,20 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::hasWarmRoutesChanged() + bool ICETransport::hasWarmRoutesChanged() noexcept { return 0 != mWarmRoutesChanged; } //------------------------------------------------------------------------- - void ICETransport::cancel() + void ICETransport::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportCancel, ol, IceTransport, Cancel, puid, id, mID); //....................................................................... // start the shutdown process if (isShutdown()) { - ZS_LOG_WARNING(Trace, log("already shutdown")) + ZS_LOG_WARNING(Trace, log("already shutdown")); return; } @@ -3401,11 +3403,11 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setState(IICETransport::States state) + void ICETransport::setState(IICETransport::States state) noexcept { if (state == mCurrentState) return; - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", IICETransport::toString(state)) + ZS_PARAM("old state", IICETransport::toString(mCurrentState))) + ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", IICETransport::toString(state)) + ZS_PARAM("old state", IICETransport::toString(mCurrentState))); mCurrentState = state; ZS_EVENTING_2(x, i, Debug, IceTransportStateChangedEvent, ol, IceTransport, StateEvent, puid, id, mID, string, state, IICETransport::toString(state)); @@ -3416,7 +3418,7 @@ namespace ortc if ((!mUseCandidateRoute) && (!mOptions.mAggressiveICE) && (IICETypes::Role_Controlling == mOptions.mRole)) { - ZS_LOG_TRACE(log("route nomination is required")) + ZS_LOG_TRACE(log("route nomination is required")); IWakeDelegateProxy::create(pThis)->onWake(); } } @@ -3429,13 +3431,13 @@ namespace ortc } //----------------------------------------------------------------------- - void ICETransport::setError(WORD errorCode, const char *inReason) + void ICETransport::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) + ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)); return; } @@ -3448,37 +3450,37 @@ namespace ortc string, reason, reason ); - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) + ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)); } //----------------------------------------------------------------------- - bool ICETransport::isConnected() const + bool ICETransport::isConnected() const noexcept { return IICETransport::State_Connected == mCurrentState; } //----------------------------------------------------------------------- - bool ICETransport::isComplete() const + bool ICETransport::isComplete() const noexcept { return IICETransport::State_Completed == mCurrentState; } //----------------------------------------------------------------------- - bool ICETransport::isDisconnected() const + bool ICETransport::isDisconnected() const noexcept { return IICETransport::State_Disconnected == mCurrentState; } //----------------------------------------------------------------------- - bool ICETransport::isFailed() const + bool ICETransport::isFailed() const noexcept { return IICETransport::State_Failed == mCurrentState; } //------------------------------------------------------------------------- - void ICETransport::handleExpireRouteTimer() + void ICETransport::handleExpireRouteTimer() noexcept { - ZS_LOG_DEBUG(log("handle expire route timer")) + ZS_LOG_DEBUG(log("handle expire route timer")); auto now = zsLib::now(); @@ -3489,12 +3491,12 @@ namespace ortc auto latest = getLastRemoteActivity(mActiveRoute); if (Time() != latest) { if (latest + mExpireRouteTime < now) { - mActiveRoute->trace(__func__, "expire route"); + ZS_EVENTING_TRACE_OBJECT(Debug, *mActiveRoute, "expire route"); if (mBlacklistConsent) { - ZS_LOG_WARNING(Detail, log("blacklisting consent on active route") + ZS_PARAM("difference", (now - latest)) + mActiveRoute->toDebug()) + ZS_LOG_WARNING(Detail, log("blacklisting consent on active route") + ZS_PARAM("difference", (now - latest)) + mActiveRoute->toDebug()); setBlacklisted(mActiveRoute); } else { - ZS_LOG_WARNING(Detail, log("active route has now failed") + ZS_PARAM("difference", (now - latest)) + mActiveRoute->toDebug()) + ZS_LOG_WARNING(Detail, log("active route has now failed") + ZS_PARAM("difference", (now - latest)) + mActiveRoute->toDebug()); setFailed(mActiveRoute); } @@ -3514,23 +3516,23 @@ namespace ortc auto latest = getLastRemoteActivity(route); - ZS_THROW_INVALID_ASSUMPTION_IF(Time() == latest) + ZS_ASSERT(Time() != latest); if (latest + mExpireRouteTime >= now) { - ZS_LOG_TRACE(log("warm route is still warm") + route->toDebug()) + ZS_LOG_TRACE(log("warm route is still warm") + route->toDebug()); continue; } - route->trace(__func__, "warm route expired"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "warm route expired"); expired = true; mWarmRoutes.erase(current); warmRoutesChanged(); - ZS_LOG_WARNING(Debug, log("warm route no longer is warm") + ZS_PARAM("difference", (now - latest)) + route->toDebug()) + ZS_LOG_WARNING(Debug, log("warm route no longer is warm") + ZS_PARAM("difference", (now - latest)) + route->toDebug()); if (mBlacklistConsent) { - ZS_LOG_WARNING(Detail, log("warm route is blacklisted due to consent removal") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("warm route is blacklisted due to consent removal") + route->toDebug()); setBlacklisted(route); } else { setFailed(route); @@ -3540,14 +3542,14 @@ namespace ortc if (!expired) return; - ZS_LOG_DEBUG(log("at least one route was expired (thus need to recalculate state)")) + ZS_LOG_DEBUG(log("at least one route was expired (thus need to recalculate state)")); step(); } //------------------------------------------------------------------------- - void ICETransport::handleLastReceivedPacket() + void ICETransport::handleLastReceivedPacket() noexcept { - ZS_LOG_DEBUG(log("handle last packet received timer")) + ZS_LOG_DEBUG(log("handle last packet received timer")); auto now = zsLib::now(); @@ -3555,12 +3557,12 @@ namespace ortc if (Time() != mLastReceivedPacket) { if (mLastReceivedPacket + mNoPacketsReceivedRecheckTime > now) { - ZS_LOG_TRACE(log("have received packet inside expecting window") + ZS_PARAMIZE(now) + ZS_PARAMIZE(mLastReceivedPacket) + ZS_PARAM("no packet received window (s)", mNoPacketsReceivedRecheckTime)) + ZS_LOG_TRACE(log("have received packet inside expecting window") + ZS_PARAMIZE(now) + ZS_PARAMIZE(mLastReceivedPacket) + ZS_PARAM("no packet received window (s)", mNoPacketsReceivedRecheckTime)); return; } } - ZS_LOG_WARNING(Debug, log("no packet received inside expected window (thus need to aggressively check for possible active routes)")) + ZS_LOG_WARNING(Debug, log("no packet received inside expected window (thus need to aggressively check for possible active routes)")); forceActive(mActiveRoute); @@ -3571,29 +3573,29 @@ namespace ortc } if (IICETypes::Role_Controlled == mOptions.mRole) { - ZS_LOG_TRACE(log("cannot pick active route because in controlled state")) + ZS_LOG_TRACE(log("cannot pick active route because in controlled state")); return; } auto previousRoute = mActiveRoute; - ZS_LOG_TRACE(log("repick the route (in case it should change)")) + ZS_LOG_TRACE(log("repick the route (in case it should change)")); mForcePickRouteAgain = true; stepPickRoute(); if (previousRoute == mActiveRoute) { - ZS_LOG_TRACE(log("active route did not change")) + ZS_LOG_TRACE(log("active route did not change")); return; } - ZS_LOG_DEBUG(log("active route changed (thus redo state machine)")) + ZS_LOG_DEBUG(log("active route changed (thus redo state machine)")); step(); } //------------------------------------------------------------------------- - void ICETransport::handleActivationTimer() + void ICETransport::handleActivationTimer() noexcept { - ZS_LOG_DEBUG(log("handle last packet received timer")) + ZS_LOG_DEBUG(log("handle last packet received timer")); auto now = zsLib::now(); @@ -3608,20 +3610,20 @@ namespace ortc if (IICETypes::Protocol_TCP == route->mCandidatePair->mLocal->mProtocol) { if (IICETypes::TCPCandidateType_Passive == route->mCandidatePair->mLocal->mTCPType) { - ZS_LOG_TRACE(log("never activate a TCP passive route (since only active connections can open outgoing TCP socket)") + route->toDebug()) + ZS_LOG_TRACE(log("never activate a TCP passive route (since only active connections can open outgoing TCP socket)") + route->toDebug()); continue; } } if (Time() == route->mLastReceivedCheck) continue; - ZS_LOG_DEBUG(log("activating route") + route->toDebug()) + ZS_LOG_DEBUG(log("activating route") + route->toDebug()); didActivate = true; setInProgress(route); if (mPendingActivation.size() < 1) { - ZS_LOG_DEBUG(log("might not need activation timer anymore (thus waking up)")) + ZS_LOG_DEBUG(log("might not need activation timer anymore (thus waking up)")); wakeUp(); } } @@ -3629,7 +3631,7 @@ namespace ortc mNextActivationCausesAllRoutesThatReceivedChecksToActivate = false; if (didActivate) { - ZS_LOG_TRACE(log("did activate at least one route (thus going to check activation timer)")) + ZS_LOG_TRACE(log("did activate at least one route (thus going to check activation timer)")); goto check_activation_timer; } } @@ -3647,7 +3649,7 @@ namespace ortc auto preference = route->getPreference(Role_Controlling == mOptions.mRole); if (activePreference > preference) { - ZS_LOG_TRACE(log("no need to activate this route (since it cannot be used due to lower preference)") + ZS_PARAM("active preference", activePreference) + ZS_PARAM("preference", preference) + ZS_PARAM("route", mActiveRoute->toDebug()) + ZS_PARAM("route", route->toDebug())) + ZS_LOG_TRACE(log("no need to activate this route (since it cannot be used due to lower preference)") + ZS_PARAM("active preference", activePreference) + ZS_PARAM("preference", preference) + ZS_PARAM("route", mActiveRoute->toDebug()) + ZS_PARAM("route", route->toDebug())); goto set_route_ignored; } } @@ -3655,7 +3657,7 @@ namespace ortc if (IICETypes::Protocol_TCP == route->mCandidatePair->mLocal->mProtocol) { if (IICETypes::TCPCandidateType_Passive == route->mCandidatePair->mLocal->mTCPType) { - ZS_LOG_TRACE(log("never activate a TCP passive route (since only active connections can open outgoing TCP socket)") + route->toDebug()) + ZS_LOG_TRACE(log("never activate a TCP passive route (since only active connections can open outgoing TCP socket)") + route->toDebug()); goto set_route_ignored; } } @@ -3666,18 +3668,18 @@ namespace ortc // freeze upon RTP component if (!rtpTransport) { - ZS_LOG_TRACE(log("no ice transport to freeze upon (thus activating now)") + route->toDebug()) + ZS_LOG_TRACE(log("no ice transport to freeze upon (thus activating now)") + route->toDebug()); goto activate_now; } PromisePtr promise = Promise::create(getAssociatedMessageQueue()); bool found = rtpTransport->hasCandidatePairFoundation(route->mCandidatePair->mLocal->mFoundation, route->mCandidatePair->mRemote->mFoundation, promise); if (!found) { - ZS_LOG_TRACE(log("rtp transport does not have an appropriate candidate pair to freeze upon") + route->toDebug()) - goto activate_now; + ZS_LOG_TRACE(log("rtp transport does not have an appropriate candidate pair to freeze upon") + route->toDebug()); + goto activate_now; } - ZS_LOG_TRACE(log("frozen upon base rtp transport (thus will attempt to start something else)") + route->toDebug()) + ZS_LOG_TRACE(log("frozen upon base rtp transport (thus will attempt to start something else)") + route->toDebug()); setFrozen(route, promise); continue; } @@ -3686,7 +3688,7 @@ namespace ortc { auto controller = mTransportController.lock(); if (!controller) { - ZS_LOG_TRACE(log("no ice controller found (thus activating now)") + route->toDebug()) + ZS_LOG_TRACE(log("no ice controller found (thus activating now)") + route->toDebug()); goto activate_now; } @@ -3696,7 +3698,7 @@ namespace ortc promise = controller->notifyWhenUnfrozen(pThis, route->mCandidatePair->mLocal->mFoundation, route->mCandidatePair->mRemote->mFoundation); } if (!promise) { - ZS_LOG_TRACE(log("not frozen upon any other transport") + route->toDebug()) + ZS_LOG_TRACE(log("not frozen upon any other transport") + route->toDebug()); goto activate_now; } @@ -3714,7 +3716,7 @@ namespace ortc activate_now: { - ZS_LOG_DEBUG(log("activating route") + route->toDebug()) + ZS_LOG_DEBUG(log("activating route") + route->toDebug()); setInProgress(route); if (mPendingActivation.size() < 1) { @@ -3726,21 +3728,21 @@ namespace ortc } if (!isContinousGathering()) { - ZS_LOG_TRACE(log("not in continous activation mode (thus cannot activate anthing else)")) + ZS_LOG_TRACE(log("not in continous activation mode (thus cannot activate anthing else)")); goto check_activation_timer; } if (Time() == mLastReceivedPacket) { - ZS_LOG_TRACE(log("no packet received just yet (check if activation timer is needed)")) + ZS_LOG_TRACE(log("no packet received just yet (check if activation timer is needed)")); goto check_activation_timer; } if (mLastReceivedPacket + mNoPacketsReceivedRecheckTime > now) { - ZS_LOG_TRACE(log("packet received recently (thus no need to re-activate anything)") + ZS_PARAM("difference", (now - mLastReceivedPacket))) + ZS_LOG_TRACE(log("packet received recently (thus no need to re-activate anything)") + ZS_PARAM("difference", (now - mLastReceivedPacket))); goto check_activation_timer; } - ZS_LOG_WARNING(Debug, log("packet was not received recently (thus need to re-activate something)") + ZS_PARAM("difference", (now - mLastReceivedPacket))) + ZS_LOG_WARNING(Debug, log("packet was not received recently (thus need to re-activate something)") + ZS_PARAM("difference", (now - mLastReceivedPacket))); // scope: try to activate an old route just in case something can be resolved { @@ -3751,7 +3753,7 @@ namespace ortc if (IICETypes::Protocol_TCP == route->mCandidatePair->mLocal->mProtocol) { if (IICETypes::TCPCandidateType_Passive == route->mCandidatePair->mLocal->mTCPType) { - ZS_LOG_TRACE(log("never activate a TCP passive route (since only active connections can open outgoing TCP socket)") + route->toDebug()) + ZS_LOG_TRACE(log("never activate a TCP passive route (since only active connections can open outgoing TCP socket)") + route->toDebug()); continue; } } @@ -3768,8 +3770,8 @@ namespace ortc activate_previous_route: { - ZS_LOG_DEBUG(log("activating route due to possible failure situation about to happen") + route->toDebug()) - route->trace(__func__, "activate route (due to potential failure condition as no remote activity detected)"); + ZS_LOG_DEBUG(log("activating route due to possible failure situation about to happen") + route->toDebug()); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "activate route (due to potential failure condition as no remote activity detected)"); setInProgress(route); goto check_activation_timer; } @@ -3779,7 +3781,7 @@ namespace ortc // scope: kill activation timer since nothing worked { - ZS_LOG_DEBUG(log("no previous route was activated (thus temporarily disabling activation timer)")) + ZS_LOG_DEBUG(log("no previous route was activated (thus temporarily disabling activation timer)")); if (mActivationTimer) { mActivationTimer->cancel(); @@ -3795,7 +3797,7 @@ namespace ortc } //----------------------------------------------------------------------- - void ICETransport::handleNextKeepWarmTimer(RoutePtr route) + void ICETransport::handleNextKeepWarmTimer(RoutePtr route) noexcept { if (route->mNextKeepWarm) { route->mNextKeepWarm->cancel(); @@ -3803,13 +3805,13 @@ namespace ortc } if (route->mOutgoingCheck) { - ZS_LOG_TRACE(log("already have outgoing check (thus send a retry packet now)")) + ZS_LOG_TRACE(log("already have outgoing check (thus send a retry packet now)")); route->mOutgoingCheck->retryRequestNow(); return; } if (route->isBlacklisted()) { - ZS_LOG_WARNING(Debug, log("route is black listed (thus will not issue check)") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("route is black listed (thus will not issue check)") + route->toDebug()); return; } @@ -3817,11 +3819,11 @@ namespace ortc route->mLastRoundTripCheck = zsLib::now(); mOutgoingChecks[route->mOutgoingCheck] = route; - ZS_LOG_INSANE(log("installed outgoing stun binding keep alive") + route->toDebug()) + ZS_LOG_INSANE(log("installed outgoing stun binding keep alive") + route->toDebug()); } //----------------------------------------------------------------------- - void ICETransport::forceActive(RoutePtr route) + void ICETransport::forceActive(RoutePtr route) noexcept { if (!route) return; if (route->mPrune) return; @@ -3831,7 +3833,7 @@ namespace ortc auto pThis = mThisWeak.lock(); if (!pThis) return; - route->trace(__func__, "forced active"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "forcing route to generate activity"); // install a temporary keep warm timer (to force route activate sooner) route->mNextKeepWarm = ITimer::create(mThisWeak.lock(), zsLib::now() + Milliseconds(IHelper::random(0, static_cast(mKeepWarmTimeRandomizedAddTime.count())))); @@ -3841,11 +3843,11 @@ namespace ortc } //----------------------------------------------------------------------- - void ICETransport::shutdown(RoutePtr route) + void ICETransport::shutdown(RoutePtr route) noexcept { if (!route) return; - route->trace(__func__, "shutdown"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "ice transport shutting down route"); ZS_LOG_TRACE(log("shutting down route") + route->toDebug()) @@ -3865,9 +3867,9 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::pruneAllCandidatePairs(bool keepActiveAlive) + void ICETransport::pruneAllCandidatePairs(bool keepActiveAlive) noexcept { - ZS_LOG_DETAIL(log("pruning all candidate pairs")) + ZS_LOG_DETAIL(log("pruning all candidate pairs")); if (mGatherer) { mGatherer->remoteAllRelatedRoutes(*this); @@ -3896,13 +3898,13 @@ namespace ortc if (keepActiveAlive) { if (mActiveRoute == route) { currentRoute = route; - ZS_LOG_DEBUG(log("remembering previous active route (to keep it alive)") + route->toDebug()) + ZS_LOG_DEBUG(log("remembering previous active route (to keep it alive)") + route->toDebug()); } } route->mGathererRoute.reset(); // reset the route since it's gone - ZS_LOG_DEBUG(log("shutting down route due to complete route pruning") + route->toDebug()) + ZS_LOG_DEBUG(log("shutting down route due to complete route pruning") + route->toDebug()); shutdown(route); } @@ -3916,7 +3918,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportTypes::CandidatePairPtr ICETransport::cloneCandidatePair(RoutePtr route) const + IICETransportTypes::CandidatePairPtr ICETransport::cloneCandidatePair(RoutePtr route) const noexcept { if (!route) return CandidatePairPtr(); @@ -3927,7 +3929,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setPending(RoutePtr route) + void ICETransport::setPending(RoutePtr route) noexcept { switch (route->state()) { case Route::State_New: { @@ -3943,36 +3945,36 @@ namespace ortc goto insert_pending; } case Route::State_Frozen: { - ZS_LOG_DEBUG(log("route is now pending activation again") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now pending activation again") + route->toDebug()); goto insert_pending; } case Route::State_InProgress: { - ZS_LOG_WARNING(Detail, log("route is already in progress (no need to activate again)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is already in progress (no need to activate again)") + route->toDebug()); return; } case Route::State_Succeeded: { - ZS_LOG_DEBUG(log("route was succeeded but is being rechecked again") + route->toDebug()) + ZS_LOG_DEBUG(log("route was succeeded but is being rechecked again") + route->toDebug()); goto insert_pending; } case Route::State_Ignored: { - ZS_LOG_DEBUG(log("route previously ignored but is being rechecked again") + route->toDebug()) + ZS_LOG_DEBUG(log("route previously ignored but is being rechecked again") + route->toDebug()); goto insert_pending; } case Route::State_Failed: { - ZS_LOG_DEBUG(log("route previously failed but is being rechecked again") + route->toDebug()) + ZS_LOG_DEBUG(log("route previously failed but is being rechecked again") + route->toDebug()); goto insert_pending; } case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route cannot be reactivated because its blacklisted") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route cannot be reactivated because its blacklisted") + route->toDebug()); return; } } insert_pending: { - route->trace(__func__, "pending"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route is now being set to the pending state"); - ZS_LOG_DEBUG(log("route is now being set to the pending state") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now being set to the pending state") + route->toDebug()); removeFrozen(route); removeOutgoingCheck(route); @@ -4002,31 +4004,31 @@ namespace ortc void ICETransport::setFrozen( RoutePtr route, PromisePtr promise - ) + ) noexcept { switch (route->state()) { case Route::State_New: { - ZS_LOG_DEBUG(log("route is going from new to frozen") + route->toDebug()) + ZS_LOG_DEBUG(log("route is going from new to frozen") + route->toDebug()); goto freeze; } case Route::State_Pending: { - ZS_LOG_DEBUG(log("route is going from pending to frozen") + route->toDebug()) + ZS_LOG_DEBUG(log("route is going from pending to frozen") + route->toDebug()); goto freeze; } case Route::State_Frozen: { - ZS_LOG_DEBUG(log("route will be frozen again") + route->toDebug()) + ZS_LOG_DEBUG(log("route will be frozen again") + route->toDebug()); goto freeze; } case Route::State_InProgress: { - ZS_LOG_WARNING(Detail, log("route is already in progress (no need to freeze)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is already in progress (no need to freeze)") + route->toDebug()); return; } case Route::State_Succeeded: { - ZS_LOG_DEBUG(log("route was succeeded (no need to freeze)") + route->toDebug()) + ZS_LOG_DEBUG(log("route was succeeded (no need to freeze)") + route->toDebug()); return; } case Route::State_Ignored: { - ZS_LOG_DEBUG(log("route previously ignored (no need to freeze)") + route->toDebug()) + ZS_LOG_DEBUG(log("route previously ignored (no need to freeze)") + route->toDebug()); return; } case Route::State_Failed: { @@ -4034,16 +4036,16 @@ namespace ortc return; } case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route is blacklisted") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is blacklisted") + route->toDebug()); return; } } freeze: { - route->trace(__func__, "frozen"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route is now being frozen"); - ZS_LOG_DEBUG(log("route is now being frozen") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now being frozen") + route->toDebug()); removePendingActivation(route); removeFrozen(route); @@ -4057,39 +4059,39 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setInProgress(RoutePtr route) + void ICETransport::setInProgress(RoutePtr route) noexcept { switch (route->state()) { case Route::State_New: goto in_progress; case Route::State_Pending: goto in_progress; case Route::State_Frozen: goto in_progress; case Route::State_InProgress: { - ZS_LOG_WARNING(Detail, log("route is already in progress (no need to activate again)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is already in progress (no need to activate again)") + route->toDebug()); return; } case Route::State_Succeeded: { - ZS_LOG_DEBUG(log("route was succeeded (but going to activate now again)") + route->toDebug()) + ZS_LOG_DEBUG(log("route was succeeded (but going to activate now again)") + route->toDebug()); goto in_progress; } case Route::State_Ignored: { - ZS_LOG_DEBUG(log("route was ignored (but going to activate again)") + route->toDebug()) + ZS_LOG_DEBUG(log("route was ignored (but going to activate again)") + route->toDebug()); goto in_progress; } case Route::State_Failed: { - ZS_LOG_DEBUG(log("route previously failed (but going to activate again)") + route->toDebug()) + ZS_LOG_DEBUG(log("route previously failed (but going to activate again)") + route->toDebug()); goto in_progress; } case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route is blacklisted") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is blacklisted") + route->toDebug()); return; } } in_progress: { - route->trace(__func__, "in progress"); - - ZS_LOG_DEBUG(log("route is now being set in progress") + route->toDebug()) + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route is now being set in progress"); + + ZS_LOG_DEBUG(log("route is now being set in progress") + route->toDebug()); removePendingActivation(route); removeFrozen(route); @@ -4104,12 +4106,12 @@ namespace ortc route->mLastRoundTripCheck = zsLib::now(); mOutgoingChecks[route->mOutgoingCheck] = route; - ZS_LOG_TRACE(log("route set in progress") + route->toDebug()) + ZS_LOG_TRACE(log("route set in progress") + route->toDebug()); } } //------------------------------------------------------------------------- - void ICETransport::setSucceeded(RoutePtr route) + void ICETransport::setSucceeded(RoutePtr route) noexcept { bool wasSuccessful = route->isSucceeded(); @@ -4122,16 +4124,16 @@ namespace ortc case Route::State_Ignored: goto succeeded; case Route::State_Failed: goto succeeded; case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot succeed)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot succeed)") + route->toDebug()); return; } } succeeded: { - route->trace(__func__, "succeeded"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route is now successful"); - ZS_LOG_DEBUG(log("route is now successful") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now successful") + route->toDebug()); removePendingActivation(route); removeFrozen(route); @@ -4157,7 +4159,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setFailed(RoutePtr route) + void ICETransport::setFailed(RoutePtr route) noexcept { switch (route->state()) { case Route::State_New: goto failed; @@ -4168,16 +4170,16 @@ namespace ortc case Route::State_Ignored: goto failed; case Route::State_Failed: goto failed; case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot fail)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot fail)") + route->toDebug()); return; } } failed: { - route->trace(__func__, "failed"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route is now a failure"); - ZS_LOG_DEBUG(log("route is now a failure") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now a failure") + route->toDebug()); removePendingActivation(route); removeFrozen(route); @@ -4193,7 +4195,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setIgnored(RoutePtr route) + void ICETransport::setIgnored(RoutePtr route) noexcept { switch (route->state()) { case Route::State_New: goto ignored; @@ -4204,16 +4206,16 @@ namespace ortc case Route::State_Ignored: goto ignored; case Route::State_Failed: goto ignored; case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot be ignored)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot be ignored)") + route->toDebug()); return; } } ignored: { - route->trace(__func__, "ignored"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "route is now being ignored"); - ZS_LOG_DEBUG(log("route is now being ignored") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now being ignored") + route->toDebug()); removePendingActivation(route); removeFrozen(route); @@ -4229,7 +4231,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::setBlacklisted(RoutePtr route) + void ICETransport::setBlacklisted(RoutePtr route) noexcept { switch (route->state()) { case Route::State_New: goto blacklist; @@ -4240,16 +4242,16 @@ namespace ortc case Route::State_Ignored: goto blacklist; case Route::State_Failed: goto blacklist; case Route::State_Blacklisted: { - ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot blacklist again)") + route->toDebug()) + ZS_LOG_WARNING(Detail, log("route is blacklisted (and cannot blacklist again)") + route->toDebug()); return; } } blacklist: { - route->trace(__func__, "blacklisted"); + ZS_EVENTING_TRACE_OBJECT(Detail, *route, "route is now blacklisted"); - ZS_LOG_DEBUG(log("route is now blacklisted") + route->toDebug()) + ZS_LOG_DEBUG(log("route is now blacklisted") + route->toDebug()); removePendingActivation(route); removeFrozen(route); @@ -4267,16 +4269,16 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::updateAfterPacket(RoutePtr route) + void ICETransport::updateAfterPacket(RoutePtr route) noexcept { if (route->isBlacklisted()) { - ZS_LOG_WARNING(Trace, log("route cannot be made sucessful because it is blacklisted")) + ZS_LOG_WARNING(Trace, log("route cannot be made sucessful because it is blacklisted")); return; } if (!isContinousGathering()) { if (route->isFailed()) { - ZS_LOG_WARNING(Trace, log("route cannot be made sucessful because it has already failed")) + ZS_LOG_WARNING(Trace, log("route cannot be made sucessful because it has already failed")); return; } } @@ -4298,7 +4300,7 @@ namespace ortc // occuring (where the gatherer would not likely know otherwise). if ((mGatherer) && (route->mGathererRoute)) { - ZS_LOG_INSANE(log("notify gatherer of likely reflexive activity") + route->toDebug()) + ZS_LOG_INSANE(log("notify gatherer of likely reflexive activity") + route->toDebug()); mGatherer->notifyLikelyReflexiveActivity(route->mGathererRoute); } break; @@ -4311,13 +4313,13 @@ namespace ortc if (!mActiveRoute) { if (Time() != route->mLastReceivedResponse) { - ZS_LOG_DEBUG(log("setting route to active since received a response and no other route is available") + route->toDebug()) + ZS_LOG_DEBUG(log("setting route to active since received a response and no other route is available") + route->toDebug()); mActiveRoute = route; - mActiveRoute->trace(__func__, "choosing as active route (as response was received and no other route is available)"); + ZS_EVENTING_TRACE_OBJECT(Debug, *mActiveRoute, "choosing as active route (as response was received and no other route is available)"); } else if (Time() != route->mLastReceivedCheck) { - ZS_LOG_DEBUG(log("setting route to active since received a validated incoming request") + route->toDebug()) + ZS_LOG_DEBUG(log("setting route to active since received a validated incoming request") + route->toDebug()); mActiveRoute = route; - mActiveRoute->trace(__func__, "choosing as active route (as incoming check was received on this route)"); + ZS_EVENTING_TRACE_OBJECT(Debug, *mActiveRoute, "choosing as active route (as incoming check was received on this route)"); } } @@ -4326,10 +4328,10 @@ namespace ortc auto now = zsLib::now(); if (latest + mExpireRouteTime > now) { if (!route->isBlacklisted()) { - ZS_LOG_TRACE(log("consent was granted") + route->toDebug()) + ZS_LOG_TRACE(log("consent was granted") + route->toDebug()); if (route->isSucceeded()) { if (mWarmRoutes.end() == mWarmRoutes.find(route->mCandidatePairHash)) { - ZS_LOG_TRACE(log("need to keep candiate in the warm table since it's been woken up again")) + ZS_LOG_TRACE(log("need to keep candiate in the warm table since it's been woken up again")); setSucceeded(route); } } else { @@ -4341,7 +4343,7 @@ namespace ortc } } } else { - ZS_LOG_WARNING(Trace, log("consent cannot be granted because route is blacklisted") + route->toDebug()) + ZS_LOG_WARNING(Trace, log("consent cannot be granted because route is blacklisted") + route->toDebug()); } } } @@ -4367,7 +4369,7 @@ namespace ortc if (IICETypes::Role_Controlling == mOptions.mRole) { if (Time() != route->mLastReceivedResponse) { if (IICETransport::State_Completed == mCurrentState) { - ZS_LOG_DEBUG(log("need to wake up and check if this route can be nominated")) + ZS_LOG_DEBUG(log("need to wake up and check if this route can be nominated")); wakeUp(); } } @@ -4377,36 +4379,36 @@ namespace ortc } //------------------------------------------------------------------------- - bool ICETransport::installGathererRoute(RoutePtr route) + bool ICETransport::installGathererRoute(RoutePtr route) noexcept { if (!route) { - ZS_LOG_WARNING(Trace, log("not possible to install route as route is null")) + ZS_LOG_WARNING(Trace, log("not possible to install route as route is null")); return false; } if (!mGathererRouter) { - ZS_LOG_WARNING(Trace, log("cannot install gatherer route as gatherer router is not present") + route->toDebug()) + ZS_LOG_WARNING(Trace, log("cannot install gatherer route as gatherer router is not present") + route->toDebug()); return false; } if (route->mGathererRoute) { - ZS_LOG_INSANE(log("gatherer route already installed") + route->toDebug()) + ZS_LOG_INSANE(log("gatherer route already installed") + route->toDebug()); return true; } auto ip = route->mCandidatePair->mRemote->ip(); route->mGathererRoute = mGathererRouter->findRoute(route->mCandidatePair->mLocal, ip, true); if (!route->mGathererRoute) { - ZS_LOG_WARNING(Debug, log("failed to install gatherer route") + route->toDebug()) + ZS_LOG_WARNING(Debug, log("failed to install gatherer route") + route->toDebug()); return false; } - route->trace(__func__, "gatherer route installed"); + ZS_EVENTING_TRACE_OBJECT(Insane, *route, "gatherer route installed"); mGathererRoutes[route->mGathererRoute->mID] = route; return true; } //------------------------------------------------------------------------- - void ICETransport::installFoundation(RoutePtr route) + void ICETransport::installFoundation(RoutePtr route) noexcept { LocalRemoteFoundationPair foundation(route->mCandidatePair->mLocal->mFoundation, route->mCandidatePair->mRemote->mFoundation); @@ -4423,7 +4425,7 @@ namespace ortc size_t, totalRoutes, routes.size() ); - route->trace(__func__, "installed foundation"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "installed foundation"); mFoundationRoutes[foundation] = routes; return; @@ -4445,12 +4447,12 @@ namespace ortc size_t, totalRoutes, routes.size() ); - route->trace(__func__, "installed foundation"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "installed foundation"); } } //------------------------------------------------------------------------- - void ICETransport::removeLegal(RoutePtr route) + void ICETransport::removeLegal(RoutePtr route) noexcept { auto found = mLegalRoutes.find(route->mCandidatePairHash); if (found == mLegalRoutes.end()) return; @@ -4459,7 +4461,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeFoundation(RoutePtr route) + void ICETransport::removeFoundation(RoutePtr route) noexcept { LocalRemoteFoundationPair foundation(route->mCandidatePair->mLocal->mFoundation, route->mCandidatePair->mRemote->mFoundation); @@ -4489,7 +4491,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeFrozen(RoutePtr route) + void ICETransport::removeFrozen(RoutePtr route) noexcept { if (!route->mFrozenPromise) return; @@ -4506,7 +4508,7 @@ namespace ortc RoutePtr route, bool succeeded, AnyPtr reason - ) + ) noexcept { if (route->mDependentPromises.size() < 1) return; @@ -4524,7 +4526,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeActive(RoutePtr route) + void ICETransport::removeActive(RoutePtr route) noexcept { if (route == mActiveRoute) { mActiveRoute.reset(); @@ -4541,7 +4543,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removePendingActivation(RoutePtr route) + void ICETransport::removePendingActivation(RoutePtr route) noexcept { auto found = mPendingActivation.find(route->mPendingPriority); if (found != mPendingActivation.end()) { @@ -4551,7 +4553,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeOutgoingCheck(RoutePtr route) + void ICETransport::removeOutgoingCheck(RoutePtr route) noexcept { if (!route->mOutgoingCheck) return; @@ -4567,7 +4569,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeGathererRoute(RoutePtr route) + void ICETransport::removeGathererRoute(RoutePtr route) noexcept { if (!route->mGathererRoute) return; @@ -4579,12 +4581,12 @@ namespace ortc mGatherer->removeRoute(route->mGathererRoute); } - route->trace(__func__, "removing fatherer route"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "removing gatherer route"); route->mGathererRoute.reset(); } //------------------------------------------------------------------------- - void ICETransport::removeKeepWarmTimer(RoutePtr route) + void ICETransport::removeKeepWarmTimer(RoutePtr route) noexcept { if (!route->mNextKeepWarm) return; @@ -4599,7 +4601,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::removeWarm(RoutePtr route) + void ICETransport::removeWarm(RoutePtr route) noexcept { // scope: remove from warm auto found = mWarmRoutes.find(route->mCandidatePairHash); @@ -4617,7 +4619,7 @@ namespace ortc ICETransport::RoutePtr ICETransport::findRoute( IICETypes::CandidatePtr localCandidate, const IPAddress &inRemoteIP - ) + ) noexcept { if (!localCandidate) return RoutePtr(); @@ -4641,7 +4643,7 @@ namespace ortc IICETypes::CandidatePtr localCandidate, const IPAddress &inRemoteIP, DWORD remotePriority - ) + ) noexcept { if (!localCandidate) return RoutePtr(); @@ -4678,7 +4680,7 @@ namespace ortc } //------------------------------------------------------------------------- - Time ICETransport::getLastRemoteActivity(RoutePtr route) const + Time ICETransport::getLastRemoteActivity(RoutePtr route) const noexcept { if (!route) return Time(); @@ -4691,9 +4693,9 @@ namespace ortc RoutePtr route, bool useCandidate, IBackOffTimerPatternPtr pattern - ) const + ) const noexcept { - ZS_THROW_BAD_STATE_IF(!mGatherer) + ZS_ASSERT(mGatherer); if (IICETypes::Role_Controlling == mOptions.mRole) { useCandidate = mOptions.mAggressiveICE ? true : useCandidate; // force this flag if aggressive mode @@ -4727,7 +4729,8 @@ namespace ortc puid, id, mID, puid, stunRequesterId, ((bool)result) ? result->getID() : 0 ); - route->trace(__func__, "create binding request"); + ZS_EVENTING_TRACE_OBJECT(Debug, *stunPacket, "create binding request"); + ZS_EVENTING_TRACE_OBJECT(Debug, *route, "create binding request"); } return result; @@ -4737,7 +4740,7 @@ namespace ortc STUNPacketPtr ICETransport::createBindResponse( STUNPacketPtr request, RoutePtr route - ) const + ) const noexcept { STUNPacketPtr stunPacket = STUNPacket::createResponse(request); @@ -4752,8 +4755,8 @@ namespace ortc fix(stunPacket); - route->trace(__func__, "create binding response"); - stunPacket->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "create binding response"); + ZS_EVENTING_TRACE_OBJECT(Trace, *stunPacket, "create binding response"); return stunPacket; } @@ -4762,16 +4765,16 @@ namespace ortc STUNPacketPtr ICETransport::createErrorResponse( STUNPacketPtr request, STUNPacket::ErrorCodes error - ) + ) noexcept { STUNPacketPtr response = STUNPacket::createErrorResponse(request); - response->mErrorCode = error; + response->mErrorCode = static_castmErrorCode)>(error); fix(response); return response; } //----------------------------------------------------------------------- - void ICETransport::setRole(STUNPacketPtr packet) const + void ICETransport::setRole(STUNPacketPtr packet) const noexcept { if (IICETypes::Role_Controlling == mOptions.mRole) { packet->mIceControllingIncluded = true; @@ -4786,7 +4789,7 @@ namespace ortc } //----------------------------------------------------------------------- - void ICETransport::fix(STUNPacketPtr stun) const + void ICETransport::fix(STUNPacketPtr stun) const noexcept { stun->mLogObject = "ortc::ICETransport"; stun->mLogObjectID = mID; @@ -4796,10 +4799,10 @@ namespace ortc void ICETransport::sendPacket( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) + ) noexcept { if (!mGatherer) { - ZS_LOG_WARNING(Detail, log("cannot respond as no gatherer is attached") + packet->toDebug()) + ZS_LOG_WARNING(Detail, log("cannot respond as no gatherer is attached") + packet->toDebug()); return; } @@ -4811,7 +4814,7 @@ namespace ortc buffer, packet, packetized->BytePtr(), size, size, packetized->SizeInBytes() ); - packet->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Insane, *packet, "ice transport send packet"); mGatherer->sendPacket(*this, routerRoute, packetized->BytePtr(), packetized->SizeInBytes()); } @@ -4819,11 +4822,11 @@ namespace ortc bool ICETransport::handleSwitchRolesAndConflict( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) + ) noexcept { if (packet->mIceControllingIncluded) { if (IICETypes::Role_Controlled == mOptions.mRole) { - ZS_LOG_TRACE(log("no conflict in role detected")) + ZS_LOG_TRACE(log("no conflict in role detected")); return false; } @@ -4833,7 +4836,7 @@ namespace ortc if (packet->mIceControlledIncluded) { if (IICETypes::Role_Controlling == mOptions.mRole) { - ZS_LOG_TRACE(log("no conflict in role detected")) + ZS_LOG_TRACE(log("no conflict in role detected")); return false; } @@ -4847,8 +4850,8 @@ namespace ortc response->mMappedAddress = routerRoute->mRemoteIP; setRole(response); - routerRoute->trace(__func__, "role conflict detected"); - response->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Debug, *routerRoute, "ice transport role conflict detected"); + ZS_EVENTING_TRACE_OBJECT(Debug, *response, "ice transport role conflict detected"); ZS_LOG_WARNING(Detail, log("returning conflict error to remote party") + routerRoute->toDebug() + response->toDebug()) sendPacket(routerRoute, response); @@ -4885,7 +4888,7 @@ namespace ortc ICETransport::RoutePtr ICETransport::findOrCreateMissingRoute( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) + ) noexcept { RoutePtr route; @@ -4896,7 +4899,7 @@ namespace ortc if (found == mGathererRoutes.end()) goto existing_route_not_found; route = (*found).second; - ZS_LOG_TRACE(log("found existing route to use") + route->toDebug()) + ZS_LOG_TRACE(log("found existing route to use") + route->toDebug()); return route; } @@ -4905,14 +4908,14 @@ namespace ortc // this route probably does not exist route = findRoute(routerRoute->mLocalCandidate, routerRoute->mRemoteIP); if (route) { - ZS_LOG_TRACE(log("adding gatherer route mapping") + route->toDebug() + routerRoute->toDebug()) + ZS_LOG_TRACE(log("adding gatherer route mapping") + route->toDebug() + routerRoute->toDebug()); removeGathererRoute(route); // add to gathering routes route->mGathererRoute = routerRoute; - route->trace(__func__, "added gatherer route"); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "added gatherer route"); mGathererRoutes[route->mGathererRoute->mID] = route; return route; @@ -4934,7 +4937,7 @@ namespace ortc RoutePtr closestRoute = findClosestRoute(routerRoute->mLocalCandidate, routerRoute->mRemoteIP, packet->mPriority); if (closestRoute) { - ZS_LOG_TRACE(log("found candidate close enough to borrow remote properties") + ZS_PARAM("new candidate", remoteCandidate->toDebug()) + ZS_PARAM("close candidate", closestRoute->mCandidatePair->mRemote->toDebug())) + ZS_LOG_TRACE(log("found candidate close enough to borrow remote properties") + ZS_PARAM("new candidate", remoteCandidate->toDebug()) + ZS_PARAM("close candidate", closestRoute->mCandidatePair->mRemote->toDebug())); remoteCandidate->mUnfreezePriority = closestRoute->mCandidatePair->mRemote->mUnfreezePriority; remoteCandidate->mRelatedAddress = closestRoute->mCandidatePair->mRemote->mRelatedAddress; remoteCandidate->mRelatedPort = closestRoute->mCandidatePair->mRemote->mRelatedPort; @@ -4943,7 +4946,7 @@ namespace ortc remoteCandidate->mUnfreezePriority = packet->mPriority; remoteCandidate->mFoundation = remoteCandidate->foundation(); - ZS_LOG_WARNING(Debug, log("did not find close enough candidate to existing candidate (thus creating custom foundation)") + ZS_PARAM("new candidate", remoteCandidate->toDebug())) + ZS_LOG_WARNING(Debug, log("did not find close enough candidate to existing candidate (thus creating custom foundation)") + ZS_PARAM("new candidate", remoteCandidate->toDebug())); } // now have everything needed to create a brand new legal route @@ -4953,8 +4956,8 @@ namespace ortc route->mCandidatePair->mRemote = remoteCandidate; route->mCandidatePairHash = route->mCandidatePair->hash(); - route->trace("added missing route (because of incoming stun packet)"); - packet->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Trace, *route, "ice transport added missing route (because of incoming stun packet)"); + ZS_EVENTING_TRACE_OBJECT(Trace, *packet, "ice transport added missing route (because of incoming stun packet)"); // add as legal routes mLegalRoutes[route->mCandidatePairHash] = route; @@ -4973,7 +4976,7 @@ namespace ortc void ICETransport::handlePassThroughSTUNPacket( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) + ) noexcept { UseSecureTransportPtr transport; @@ -4981,14 +4984,14 @@ namespace ortc AutoRecursiveLock lock(*this); auto found = mGathererRoutes.find(routerRoute->mID); if (found == mGathererRoutes.end()) { - ZS_LOG_WARNING(Detail, log("route was not found") + routerRoute->toDebug() + packet->toDebug()) + ZS_LOG_WARNING(Detail, log("route was not found") + routerRoute->toDebug() + packet->toDebug()); return; } auto route = (*found).second; if (route->isBlacklisted()) { - ZS_LOG_WARNING(Debug, log("no consent given on this route") + route->toDebug() + packet->toDebug()) + ZS_LOG_WARNING(Debug, log("no consent given on this route") + route->toDebug() + packet->toDebug()); return; } @@ -4997,7 +5000,7 @@ namespace ortc updateAfterPacket(route); if (!mActiveRoute) { - ZS_LOG_WARNING(Debug, log("no active route chosen (thus must ignore packet)") + route->toDebug() + packet->toDebug()) + ZS_LOG_WARNING(Debug, log("no active route chosen (thus must ignore packet)") + route->toDebug() + packet->toDebug()); return; } @@ -5008,7 +5011,7 @@ namespace ortc forward_attached_listener: { if (!transport) { - ZS_LOG_WARNING(Debug, log("no secure transport attached (thus stun packet is being discarded)")) + ZS_LOG_WARNING(Debug, log("no secure transport attached (thus stun packet is being discarded)")); return; } @@ -5018,31 +5021,31 @@ namespace ortc puid, secureTransportId, transport->getID() ); - packet->trace(__func__); + ZS_EVENTING_TRACE_OBJECT(Insane, *packet, "ice transport delivering packet"); transport->handleReceivedSTUNPacket(mComponent, packet); } } //------------------------------------------------------------------------- - bool ICETransport::getNeedsMoreCandidates() const + bool ICETransport::getNeedsMoreCandidates() const noexcept { if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_WARNING(Debug, log("do not need more candidate if shutting down")) + ZS_LOG_WARNING(Debug, log("do not need more candidate if shutting down")); return false; } if (isComplete()) { - ZS_LOG_TRACE(log("no need for more candidates as transport is complete")) + ZS_LOG_TRACE(log("no need for more candidates as transport is complete")); return false; } if (isFailed()) { - ZS_LOG_TRACE(log("no need for more candidates as transport is failed")) + ZS_LOG_TRACE(log("no need for more candidates as transport is failed")); return false; } - ZS_LOG_TRACE(log("more candidates are required as transport is not completed or failed")) + ZS_LOG_TRACE(log("more candidates are required as transport is not completed or failed")); return true; } @@ -5050,26 +5053,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport::Route - #pragma mark + // + // ICETransport::Route + // //------------------------------------------------------------------------- - ICETransport::Route::Route(RouteStateTrackerPtr tracker) : + ICETransport::Route::Route(RouteStateTrackerPtr tracker) noexcept : mTracker(tracker) { - ZS_THROW_INVALID_ARGUMENT_IF(!tracker) + ZS_ASSERT(tracker); tracker->inState(mState); } //------------------------------------------------------------------------- - ICETransport::Route::~Route() + ICETransport::Route::~Route() noexcept { mTracker->outState(mState); } //------------------------------------------------------------------------- - const char *ICETransport::Route::toString(States state) + const char *ICETransport::Route::toString(States state) noexcept { switch (state) { case State_New: return "New"; @@ -5085,7 +5088,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ICETransport::Route::toDebug() const + ElementPtr ICETransport::Route::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICETransport::Route"); @@ -5119,7 +5122,7 @@ namespace ortc } //------------------------------------------------------------------------- - QWORD ICETransport::Route::getPreference(bool localIsControlling) const + QWORD ICETransport::Route::getPreference(bool localIsControlling) const noexcept { QWORD localPreference = mCandidatePair->mLocal->mPriority; QWORD remotePreference = mCandidatePair->mRemote->mPriority; @@ -5135,7 +5138,7 @@ namespace ortc QWORD ICETransport::Route::getActivationPriority( bool localIsControlling, bool useUnfreezePreference - ) const + ) const noexcept { QWORD localPreference = (useUnfreezePreference ? mCandidatePair->mLocal->mUnfreezePriority : mCandidatePair->mLocal->mPriority); QWORD remotePreference = (useUnfreezePreference ? mCandidatePair->mRemote->mUnfreezePriority : mCandidatePair->mRemote->mPriority); @@ -5148,13 +5151,13 @@ namespace ortc } //------------------------------------------------------------------------- - ICETransport::Route::States ICETransport::Route::state() const + ICETransport::Route::States ICETransport::Route::state() const noexcept { return mState; } //------------------------------------------------------------------------- - void ICETransport::Route::state(States state) + void ICETransport::Route::state(States state) noexcept { if (state == mState) return; @@ -5166,10 +5169,10 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::Route::trace(const char *function, const char *message) const + void ICETransport::Route::trace(const char *function, const char *message) const noexcept { ZS_EVENTING_COMPACT_41( - x, i, Trace, IceTransportRouteTrace, ol, IceTransport, Info, + x, i, Basic, IceTransportRouteTrace, ol, IceTransport, Info, puid/routeId, mID, string/callingMethod, function, string/message, message, @@ -5215,7 +5218,7 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ICETransport::Route::log(const char *message) const + Log::Params ICETransport::Route::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ICETransport::Route"); IHelper::debugAppend(objectEl, "id", mID); @@ -5226,12 +5229,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport::RouteStateTracker - #pragma mark + // + // ICETransport::RouteStateTracker + // //------------------------------------------------------------------------- - ICETransport::RouteStateTracker::RouteStateTracker(PUID outerObjectID) : + ICETransport::RouteStateTracker::RouteStateTracker(PUID outerObjectID) noexcept : mOuterObjectID(outerObjectID) { mStates[Route::State_New] = 0; @@ -5244,7 +5247,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ICETransport::RouteStateTracker::toDebug() const + ElementPtr ICETransport::RouteStateTracker::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICETransport::RouteStateTracker"); @@ -5261,7 +5264,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::RouteStateTracker::inState(States state) + void ICETransport::RouteStateTracker::inState(States state) noexcept { ++(mStates[state]); ZS_EVENTING_3( @@ -5273,7 +5276,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransport::RouteStateTracker::outState(States state) + void ICETransport::RouteStateTracker::outState(States state) noexcept { --(mStates[state]); ZS_EVENTING_3( @@ -5285,7 +5288,7 @@ namespace ortc } //------------------------------------------------------------------------- - size_t ICETransport::RouteStateTracker::count(States state) + size_t ICETransport::RouteStateTracker::count(States state) noexcept { return (mStates[state]); } @@ -5294,12 +5297,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportFactory - #pragma mark + // + // IICETransportFactory + // //------------------------------------------------------------------------- - IICETransportFactory &IICETransportFactory::singleton() + IICETransportFactory &IICETransportFactory::singleton() noexcept { return ICETransportFactory::singleton(); } @@ -5308,7 +5311,7 @@ namespace ortc ICETransportPtr IICETransportFactory::create( IICETransportDelegatePtr delegate, IICEGathererPtr gatherer - ) + ) noexcept (false) { if (this) {} return internal::ICETransport::create(delegate, gatherer); @@ -5320,12 +5323,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IICETransportTypes"); } @@ -5334,12 +5337,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes::States - #pragma mark + // + // IICETransportTypes::States + // //--------------------------------------------------------------------------- - const char *IICETransportTypes::toString(States state) + const char *IICETransportTypes::toString(States state) noexcept { switch (state) { case State_New: return "new"; @@ -5354,7 +5357,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICETransportTypes::States IICETransportTypes::toState(const char *state) throw (InvalidParameters) + IICETransportTypes::States IICETransportTypes::toState(const char *state) noexcept(false) { String stateStr(state); for (IICETransportTypes::States index = IICETransportTypes::State_First; index <= IICETransportTypes::State_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -5368,13 +5371,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes::CandidatePair - #pragma mark + // + // IICETransportTypes::CandidatePair + // //--------------------------------------------------------------------------- - IICETransportTypes::CandidatePair::CandidatePair(ElementPtr elem) + IICETransportTypes::CandidatePair::CandidatePair(ElementPtr elem) noexcept { if (!elem) return; @@ -5397,7 +5400,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETransportTypes::CandidatePair::createElement(const char *objectName) const + ElementPtr IICETransportTypes::CandidatePair::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -5414,13 +5417,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETransportTypes::CandidatePair::toDebug() const + ElementPtr IICETransportTypes::CandidatePair::toDebug() const noexcept { return createElement("ortc::IICETransport::CandidatePair"); } //--------------------------------------------------------------------------- - String IICETransportTypes::CandidatePair::hash(bool includePriorities) const + String IICETransportTypes::CandidatePair::hash(bool includePriorities) const noexcept { auto hasher = IHasher::sha1(); @@ -5440,13 +5443,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportTypes::Options - #pragma mark + // + // IICETransportTypes::Options + // //--------------------------------------------------------------------------- - IICETransportTypes::Options::Options(ElementPtr elem) + IICETransportTypes::Options::Options(ElementPtr elem) noexcept { if (!elem) return; @@ -5465,7 +5468,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETransportTypes::Options::createElement(const char *objectName) const + ElementPtr IICETransportTypes::Options::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -5478,13 +5481,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETransportTypes::Options::toDebug() const + ElementPtr IICETransportTypes::Options::toDebug() const noexcept { return createElement("ortc::IICETransport::Options"); } //--------------------------------------------------------------------------- - String IICETransportTypes::Options::hash() const + String IICETransportTypes::Options::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -5500,18 +5503,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransport - #pragma mark + // + // IICETransport + // //--------------------------------------------------------------------------- - ElementPtr IICETransport::toDebug(IICETransportPtr transport) + ElementPtr IICETransport::toDebug(IICETransportPtr transport) noexcept { return internal::ICETransport::toDebug(internal::ICETransport::convert(transport)); } //--------------------------------------------------------------------------- - IICETransportPtr IICETransport::convert(IRTCPTransportPtr object) + IICETransportPtr IICETransport::convert(IRTCPTransportPtr object) noexcept { return internal::ICETransport::convert(object); } @@ -5520,7 +5523,7 @@ namespace ortc IICETransportPtr IICETransport::create( IICETransportDelegatePtr delegate, IICEGathererPtr gatherer - ) + ) noexcept(false) { return internal::IICETransportFactory::singleton().create(delegate, gatherer); } diff --git a/ortc/cpp/ortc_ICETransportController.cpp b/ortc/cpp/ortc_ICETransportController.cpp index 5463925d..530dc7b2 100644 --- a/ortc/cpp/ortc_ICETransportController.cpp +++ b/ortc/cpp/ortc_ICETransportController.cpp @@ -46,7 +46,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_icetransport_controller) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_ice_transport_controller) } namespace ortc { @@ -59,20 +59,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportControllerForICETransport - #pragma mark + // + // IICETransportControllerForICETransport + // //------------------------------------------------------------------------- - ElementPtr IICETransportControllerForICETransport::toDebug(ForICETransportPtr transport) + ElementPtr IICETransportControllerForICETransport::toDebug(ForICETransportPtr transport) noexcept { return ICETransportController::toDebug(ICETransportController::convert(transport)); } @@ -81,15 +81,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController - #pragma mark + // + // ICETransportController + // //------------------------------------------------------------------------- ICETransportController::ICETransportController( const make_private &, IMessageQueuePtr queue - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) { @@ -99,12 +99,12 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransportController::init() + void ICETransportController::init() noexcept { } //------------------------------------------------------------------------- - ICETransportController::~ICETransportController() + ICETransportController::~ICETransportController() noexcept { if (isNoop()) return; @@ -115,13 +115,13 @@ namespace ortc } //------------------------------------------------------------------------- - ICETransportControllerPtr ICETransportController::convert(IICETransportControllerPtr object) + ICETransportControllerPtr ICETransportController::convert(IICETransportControllerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransportController, object); } //------------------------------------------------------------------------- - ICETransportControllerPtr ICETransportController::convert(ForICETransportPtr object) + ICETransportControllerPtr ICETransportController::convert(ForICETransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransportController, object); } @@ -130,34 +130,34 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IICETransportController - #pragma mark + // + // ICETransportController => IICETransportController + // //------------------------------------------------------------------------- - ElementPtr ICETransportController::toDebug(ICETransportControllerPtr transport) + ElementPtr ICETransportController::toDebug(ICETransportControllerPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); } //------------------------------------------------------------------------- - ICETransportControllerPtr ICETransportController::create() + ICETransportControllerPtr ICETransportController::create() noexcept { ICETransportControllerPtr pThis(make_shared(make_private{}, IORTCForInternal::queueORTC())); - pThis->mThisWeak.lock(); + pThis->mThisWeak = pThis; pThis->init(); return pThis; } //------------------------------------------------------------------------- - PUID ICETransportController::getID() const + PUID ICETransportController::getID() const noexcept { return mID; } //------------------------------------------------------------------------- - IICETransportController::ICETransportList ICETransportController::getTransports() const + IICETransportController::ICETransportList ICETransportController::getTransports() const noexcept { ICETransportList result; @@ -177,10 +177,7 @@ namespace ortc void ICETransportController::addTransport( IICETransportPtr inTransport, Optional index - ) throw( - InvalidParameters, - InvalidStateError - ) + ) noexcept(false) { UseICETransportPtr transport = ICETransport::convert(inTransport); @@ -246,12 +243,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IStatsProvider - #pragma mark + // + // ICETransportController => IStatsProvider + // //------------------------------------------------------------------------- - ICETransportController::PromiseWithStatsReportPtr ICETransportController::getStats(const StatsTypeSet &stats) const + ICETransportController::PromiseWithStatsReportPtr ICETransportController::getStats(const StatsTypeSet &stats) const noexcept { UseStatsReport::PromiseWithStatsReportList promises; @@ -272,12 +269,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IICETransportControllerForICETransport - #pragma mark + // + // ICETransportController => IICETransportControllerForICETransport + // //------------------------------------------------------------------------- - void ICETransportController::notifyDetached(ICETransportPtr inTransport) + void ICETransportController::notifyDetached(ICETransportPtr inTransport) noexcept { UseICETransportPtr transport = inTransport; @@ -291,7 +288,7 @@ namespace ortc ICETransportPtr transport, const String &localFoundation, const String &remoteFoundation - ) + ) noexcept { PromisePtr promise = Promise::create(IORTCForInternal::queueORTC()); ITransportControllerAsyncDelegateProxy::create(mThisWeak.lock())->onTransportControllerNotifyWhenUnfrozen(promise, transport, localFoundation, remoteFoundation); @@ -302,9 +299,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => ITransportControllerAsyncDelegate - #pragma mark + // + // ICETransportController => ITransportControllerAsyncDelegate + // //------------------------------------------------------------------------- void ICETransportController::onTransportControllerNotifyWhenUnfrozen( @@ -399,9 +396,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IWakeDelegate - #pragma mark + // + // ICETransportController => IWakeDelegate + // //------------------------------------------------------------------------- void ICETransportController::onWake() @@ -417,12 +414,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => (internal) - #pragma mark + // + // ICETransportController => (internal) + // //------------------------------------------------------------------------- - Log::Params ICETransportController::log(const char *message) const + Log::Params ICETransportController::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ICETransportController"); IHelper::debugAppend(objectEl, "id", mID); @@ -430,13 +427,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ICETransportController::debug(const char *message) const + Log::Params ICETransportController::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr ICETransportController::toDebug() const + ElementPtr ICETransportController::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::ICETransportController"); @@ -446,14 +443,14 @@ namespace ortc } //------------------------------------------------------------------------- - void ICETransportController::step() + void ICETransportController::step() noexcept { ZS_LOG_DEBUG(debug("step")); ZS_EVENTING_1(x, i, Debug, IceTransportControllerStep, ol, IceTransportController, Step, puid, id, mID); } //------------------------------------------------------------------------- - void ICETransportController::cancel() + void ICETransportController::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, IceTransportControllerCancel, ol, IceTransportController, Cancel, puid, id, mID); @@ -477,18 +474,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportControllerFactory - #pragma mark + // + // IICETransportControllerFactory + // //------------------------------------------------------------------------- - IICETransportControllerFactory &IICETransportControllerFactory::singleton() + IICETransportControllerFactory &IICETransportControllerFactory::singleton() noexcept { return ICETransportControllerFactory::singleton(); } //------------------------------------------------------------------------- - ICETransportControllerPtr IICETransportControllerFactory::create() + ICETransportControllerPtr IICETransportControllerFactory::create() noexcept { if (this) {} return internal::ICETransportController::create(); @@ -500,26 +497,26 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportControllerTypes - #pragma mark + // + // IICETransportControllerTypes + // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportController - #pragma mark + // + // IICETransportController + // //--------------------------------------------------------------------------- - ElementPtr IICETransportController::toDebug(IICETransportControllerPtr transport) + ElementPtr IICETransportController::toDebug(IICETransportControllerPtr transport) noexcept { return internal::ICETransportController::toDebug(internal::ICETransportController::convert(transport)); } //--------------------------------------------------------------------------- - IICETransportControllerPtr IICETransportController::create() + IICETransportControllerPtr IICETransportController::create() noexcept { return internal::IICETransportControllerFactory::singleton().create(); } diff --git a/ortc/cpp/ortc_ICETypes.cpp b/ortc/cpp/ortc_ICETypes.cpp index 5bb1ba5a..656f1444 100644 --- a/ortc/cpp/ortc_ICETypes.cpp +++ b/ortc/cpp/ortc_ICETypes.cpp @@ -44,7 +44,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -55,7 +55,7 @@ namespace ortc //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IICETypes"); } @@ -64,12 +64,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Roles - #pragma mark + // + // IICETypes::Roles + // //--------------------------------------------------------------------------- - const char *IICETypes::toString(Roles roles) + const char *IICETypes::toString(Roles roles) noexcept { switch (roles) { case Role_Controlling: return "controlling"; @@ -79,7 +79,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICETypes::Roles IICETypes::toRole(const char *role) throw (InvalidParameters) + IICETypes::Roles IICETypes::toRole(const char *role) noexcept(false) { String str(role); for (IICETypes::Roles index = IICETypes::Role_First; index <= IICETypes::Role_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -94,12 +94,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Components - #pragma mark + // + // IICETypes::Components + // //--------------------------------------------------------------------------- - const char *IICETypes::toString(Components component) + const char *IICETypes::toString(Components component) noexcept { switch (component) { case Component_RTP: return "rtp"; @@ -109,7 +109,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICETypes::Components IICETypes::toComponent(const char *component) throw (InvalidParameters) + IICETypes::Components IICETypes::toComponent(const char *component) noexcept(false) { String str(component); for (IICETypes::Components index = IICETypes::Component_First; index <= IICETypes::Component_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -124,12 +124,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Protocols - #pragma mark + // + // IICETypes::Protocols + // //--------------------------------------------------------------------------- - const char *IICETypes::toString(Protocols protocol) + const char *IICETypes::toString(Protocols protocol) noexcept { switch (protocol) { case Protocol_UDP: return "udp"; @@ -139,7 +139,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICETypes::Protocols IICETypes::toProtocol(const char *protocol) throw (InvalidParameters) + IICETypes::Protocols IICETypes::toProtocol(const char *protocol) noexcept(false) { String str(protocol); for (IICETypes::Protocols index = IICETypes::Protocol_First; index <= IICETypes::Protocol_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -154,12 +154,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::CandidateTypes - #pragma mark + // + // IICETypes::CandidateTypes + // //--------------------------------------------------------------------------- - const char *IICETypes::toString(CandidateTypes candidateType) + const char *IICETypes::toString(CandidateTypes candidateType) noexcept { switch (candidateType) { case CandidateType_Host: return "host"; @@ -171,7 +171,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICETypes::CandidateTypes IICETypes::toCandidateType(const char *candidateType) throw (InvalidParameters) + IICETypes::CandidateTypes IICETypes::toCandidateType(const char *candidateType) noexcept(false) { String str(candidateType); for (IICETypes::CandidateTypes index = IICETypes::CandidateType_First; index <= IICETypes::CandidateType_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -186,12 +186,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::TCPCandidateTypes - #pragma mark + // + // IICETypes::TCPCandidateTypes + // //--------------------------------------------------------------------------- - const char *IICETypes::toString(TCPCandidateTypes protocol) + const char *IICETypes::toString(TCPCandidateTypes protocol) noexcept { switch (protocol) { case TCPCandidateType_Active: return "active"; @@ -202,7 +202,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IICETypes::TCPCandidateTypes IICETypes::toTCPCandidateType(const char *tcpCandidateType) throw (InvalidParameters) + IICETypes::TCPCandidateTypes IICETypes::toTCPCandidateType(const char *tcpCandidateType) noexcept(false) { String str(tcpCandidateType); for (IICETypes::TCPCandidateTypes index = IICETypes::TCPCandidateType_First; index <= IICETypes::TCPCandidateType_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -217,12 +217,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::GatherCandidate - #pragma mark + // + // IICETypes::GatherCandidate + // //--------------------------------------------------------------------------- - IICETypes::GatherCandidatePtr IICETypes::GatherCandidate::create(ElementPtr elem) + IICETypes::GatherCandidatePtr IICETypes::GatherCandidate::create(ElementPtr elem) noexcept { if (!elem) return GatherCandidatePtr(); @@ -242,18 +242,34 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Candidate - #pragma mark + // + // IICETypes::Candidate + // //--------------------------------------------------------------------------- - IICETypes::CandidatePtr IICETypes::Candidate::convert(GatherCandidatePtr candidate) + IICETypes::Candidate::Candidate() noexcept + { + } + + //--------------------------------------------------------------------------- + IICETypes::Candidate::Candidate(const Candidate &op2) noexcept + { + (*this) = op2; + } + + //--------------------------------------------------------------------------- + IICETypes::Candidate::~Candidate() noexcept + { + } + + //--------------------------------------------------------------------------- + IICETypes::CandidatePtr IICETypes::Candidate::convert(GatherCandidatePtr candidate) noexcept { return ZS_DYNAMIC_PTR_CAST(Candidate, candidate); } //--------------------------------------------------------------------------- - IICETypes::Candidate::Candidate(ElementPtr elem) + IICETypes::Candidate::Candidate(ElementPtr elem) noexcept { if (!elem) return; @@ -266,7 +282,7 @@ namespace ortc try { std::underlying_type::type converted = Numeric::type>(str); IICETypes::Components component = static_cast(converted); - if ((component >= IICETypes::Component_First) || + if ((component >= IICETypes::Component_First) && (component <= IICETypes::Component_Last)) { mComponent = component; } else { @@ -323,7 +339,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETypes::Candidate::createElement(const char *objectName) const + ElementPtr IICETypes::Candidate::createElement(const char *objectName) const noexcept { if (NULL == objectName) objectName = "candidate"; ElementPtr elem = Element::create(objectName); @@ -347,13 +363,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETypes::Candidate::toDebug() const + ElementPtr IICETypes::Candidate::toDebug() const noexcept { return createElement("ortc::IICETypes::Candidate"); } //--------------------------------------------------------------------------- - String IICETypes::Candidate::hash(bool includePriorities) const + String IICETypes::Candidate::hash(bool includePriorities) const noexcept { auto hasher = IHasher::sha1(); @@ -390,7 +406,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IPAddress IICETypes::Candidate::ip() const + IPAddress IICETypes::Candidate::ip() const noexcept { if (mIP.isEmpty()) return IPAddress(); IPAddress ip(mIP, mPort); @@ -398,7 +414,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IPAddress IICETypes::Candidate::relatedIP() const + IPAddress IICETypes::Candidate::relatedIP() const noexcept { if (mRelatedAddress.isEmpty()) return IPAddress(); IPAddress ip(mRelatedAddress, mRelatedPort); @@ -409,7 +425,7 @@ namespace ortc String IICETypes::Candidate::foundation( const char *relatedServerURL, const char *baseIP - ) const + ) const noexcept { if (mFoundation.hasData()) return mFoundation; @@ -449,18 +465,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Candidate - #pragma mark + // + // IICETypes::Candidate + // //--------------------------------------------------------------------------- - IICETypes::CandidateCompletePtr IICETypes::CandidateComplete::convert(GatherCandidatePtr candidate) + IICETypes::CandidateCompletePtr IICETypes::CandidateComplete::convert(GatherCandidatePtr candidate) noexcept { return ZS_DYNAMIC_PTR_CAST(CandidateComplete, candidate); } //--------------------------------------------------------------------------- - IICETypes::CandidateComplete::CandidateComplete(ElementPtr elem) + IICETypes::CandidateComplete::CandidateComplete(ElementPtr elem) noexcept { if (!elem) return; @@ -470,7 +486,7 @@ namespace ortc try { std::underlying_type::type converted = Numeric::type>(str); IICETypes::Components component = static_cast(converted); - if ((component >= IICETypes::Component_First) || + if ((component >= IICETypes::Component_First) && (component <= IICETypes::Component_Last)) { mComponent = component; } else { @@ -486,7 +502,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETypes::CandidateComplete::createElement(const char *objectName) const + ElementPtr IICETypes::CandidateComplete::createElement(const char *objectName) const noexcept { if (NULL == objectName) objectName = "candidateComplete"; @@ -501,13 +517,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETypes::CandidateComplete::toDebug() const + ElementPtr IICETypes::CandidateComplete::toDebug() const noexcept { return createElement("ortc::IICETypes::CandidateComplete"); } //--------------------------------------------------------------------------- - String IICETypes::CandidateComplete::hash() const + String IICETypes::CandidateComplete::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -523,12 +539,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETypes::Parameters - #pragma mark + // + // IICETypes::Parameters + // //--------------------------------------------------------------------------- - IICETypes::Parameters::Parameters(ElementPtr elem) + IICETypes::Parameters::Parameters(ElementPtr elem) noexcept { if (!elem) return; @@ -539,7 +555,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETypes::Parameters::createElement(const char *objectName) const + ElementPtr IICETypes::Parameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -554,13 +570,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IICETypes::Parameters::toDebug() const + ElementPtr IICETypes::Parameters::toDebug() const noexcept { return createElement("ortc::IICETypes::Parameters"); } //--------------------------------------------------------------------------- - String IICETypes::Parameters::hash() const + String IICETypes::Parameters::hash() const noexcept { auto hasher = IHasher::sha1(); diff --git a/ortc/cpp/ortc_ISecureTransport.cpp b/ortc/cpp/ortc_ISecureTransport.cpp index 5c41d1fc..c5036aa0 100644 --- a/ortc/cpp/ortc_ISecureTransport.cpp +++ b/ortc/cpp/ortc_ISecureTransport.cpp @@ -46,7 +46,14 @@ // //#include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -61,12 +68,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- - static Log::Params secure_slog(const char *message) + static Log::Params secure_slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::ISecureTransport"); return Log::Params(message, objectEl); @@ -76,12 +83,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportTypes - #pragma mark + // + // ISecureTransportTypes + // //------------------------------------------------------------------------- - const char *ISecureTransportTypes::toString(States state) + const char *ISecureTransportTypes::toString(States state) noexcept { switch (state) { case State_Pending: return "Pending"; @@ -96,20 +103,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransport - #pragma mark + // + // ISecureTransport + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForRTPSender - #pragma mark + // + // ISecureTransportForRTPSender + // //------------------------------------------------------------------------- - ElementPtr ISecureTransportForRTPSender::toDebug(ForRTPSenderPtr transport) + ElementPtr ISecureTransportForRTPSender::toDebug(ForRTPSenderPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -133,9 +140,9 @@ namespace ortc IICETypes::Components &outWhenSendingRTCPUseSendOverComponent, ForRTPSenderPtr &outRTPSecureTransport, ForRTPSenderPtr &outRTCPSecureTransport - ) + ) noexcept(false) { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport); outWhenSendingRTPUseSendOverComponent = IICETypes::Component_RTP; outWhenSendingRTCPUseSendOverComponent = IICETypes::Component_RTP; @@ -212,12 +219,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForRTPReceiver - #pragma mark + // + // ISecureTransportForRTPReceiver + // //------------------------------------------------------------------------- - ElementPtr ISecureTransportForRTPReceiver::toDebug(ForRTPReceiverPtr transport) + ElementPtr ISecureTransportForRTPReceiver::toDebug(ForRTPReceiverPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -241,9 +248,9 @@ namespace ortc IICETypes::Components &outWhenReceivingRTCPUseReceiveOverComponent, ForRTPReceiverPtr &outRTPSecureTransport, ForRTPReceiverPtr &outRTCPSecureTransport - ) + ) noexcept(false) { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport); outWhenReceivingRTPUseReceiveOverComponent = IICETypes::Component_RTP; outWhenReceivingRTCPUseReceiveOverComponent = IICETypes::Component_RTP; @@ -319,12 +326,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForSRTPTransport - #pragma mark + // + // ISecureTransportForSRTPTransport + // //------------------------------------------------------------------------- - ElementPtr ISecureTransportForSRTPTransport::toDebug(ForSRTPPtr transport) + ElementPtr ISecureTransportForSRTPTransport::toDebug(ForSRTPPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -344,12 +351,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForICETransport - #pragma mark + // + // ISecureTransportForICETransport + // //------------------------------------------------------------------------- - ElementPtr ISecureTransportForICETransport::toDebug(ForICETransportPtr transport) + ElementPtr ISecureTransportForICETransport::toDebug(ForICETransportPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -369,12 +376,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForRTPListener - #pragma mark + // + // ISecureTransportForRTPListener + // //------------------------------------------------------------------------- - ElementPtr ISecureTransportForRTPListener::toDebug(ForRTPListenerPtr transport) + ElementPtr ISecureTransportForRTPListener::toDebug(ForRTPListenerPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -391,7 +398,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISecureTransportForRTPListener::ForRTPListenerPtr ISecureTransportForRTPListener::convert(IRTPTransportPtr transport) + ISecureTransportForRTPListener::ForRTPListenerPtr ISecureTransportForRTPListener::convert(IRTPTransportPtr transport) noexcept { if (!transport) return ForRTPListenerPtr(); return ZS_DYNAMIC_PTR_CAST(ForRTPListener, transport); @@ -401,12 +408,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForSCTPTransport - #pragma mark + // + // ISecureTransportForSCTPTransport + // //------------------------------------------------------------------------- - ElementPtr ISecureTransportForDataTransport::toDebug(ForDataTransportPtr transport) + ElementPtr ISecureTransportForDataTransport::toDebug(ForDataTransportPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -422,12 +429,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataTransportForSecureTransport - #pragma mark + // + // IDataTransportForSecureTransport + // //------------------------------------------------------------------------- - ElementPtr IDataTransportForSecureTransport::toDebug(ForSecureTransportPtr transport) + ElementPtr IDataTransportForSecureTransport::toDebug(ForSecureTransportPtr transport) noexcept { if (!transport) return ElementPtr(); @@ -440,7 +447,7 @@ namespace ortc } //------------------------------------------------------------------------- - IDataTransportForSecureTransport::ForSecureTransportPtr IDataTransportForSecureTransport::create(UseSecureTransportPtr transport) + IDataTransportForSecureTransport::ForSecureTransportPtr IDataTransportForSecureTransport::create(UseSecureTransportPtr transport) noexcept { if (!transport) return ForSecureTransportPtr(); @@ -449,3 +456,8 @@ namespace ortc } } + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif //__GNUC__ diff --git a/ortc/cpp/ortc_Identity.cpp b/ortc/cpp/ortc_Identity.cpp index a0a78796..815b2631 100644 --- a/ortc/cpp/ortc_Identity.cpp +++ b/ortc/cpp/ortc_Identity.cpp @@ -47,14 +47,7 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -71,37 +64,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IdentitySettingsDefaults - #pragma mark + // + // IdentitySettingsDefaults + // class IdentitySettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~IdentitySettingsDefaults() + ~IdentitySettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static IdentitySettingsDefaultsPtr singleton() + static IdentitySettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static IdentitySettingsDefaultsPtr create() + static IdentitySettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -109,7 +102,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { // ISettings::setUInt(ORTC_SETTING__IDENTITY_, 0); } @@ -117,7 +110,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installIdentitySettingsDefaults() + void installIdentitySettingsDefaults() noexcept { IdentitySettingsDefaults::singleton(); } @@ -126,44 +119,44 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity - #pragma mark + // + // Identity + // //------------------------------------------------------------------------- Identity::Identity( const make_private &, IMessageQueuePtr queue, IDTLSTransportPtr transport - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) { - ZS_LOG_DETAIL(debug("created")) + ZS_LOG_DETAIL(debug("created")); - ZS_THROW_NOT_IMPLEMENTED("identity API in specification is not ready") + ZS_ASSERT_FAIL("identity API in specification is not ready"); } //------------------------------------------------------------------------- - void Identity::init() + void Identity::init() noexcept { AutoRecursiveLock lock(*this); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); } //------------------------------------------------------------------------- - Identity::~Identity() + Identity::~Identity() noexcept { if (isNoop()) return; - ZS_LOG_DETAIL(log("destroyed")) + ZS_LOG_DETAIL(log("destroyed")); mThisWeak.reset(); cancel(); } //------------------------------------------------------------------------- - IdentityPtr Identity::convert(IIdentityPtr object) + IdentityPtr Identity::convert(IIdentityPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(Identity, object); } @@ -172,19 +165,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IIdentity - #pragma mark + // + // Identity => IIdentity + // //------------------------------------------------------------------------- - ElementPtr Identity::toDebug(IdentityPtr object) + ElementPtr Identity::toDebug(IdentityPtr object) noexcept { if (!object) return ElementPtr(); return object->toDebug(); } //------------------------------------------------------------------------- - IdentityPtr Identity::create(IDTLSTransportPtr transport) + IdentityPtr Identity::create(IDTLSTransportPtr transport) noexcept { IdentityPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), transport)); pThis->mThisWeak = pThis; @@ -193,34 +186,38 @@ namespace ortc } //------------------------------------------------------------------------- - IIdentityTypes::AssertionPtr Identity::peerIdentity() const + IIdentityTypes::AssertionPtr Identity::peerIdentity() const noexcept { - ZS_THROW_NOT_IMPLEMENTED("identity API in specification is not ready") + ZS_ASSERT_FAIL("identity API in specification is not ready"); return AssertionPtr(); } //------------------------------------------------------------------------- - IDTLSTransportPtr Identity::transport() const + IDTLSTransportPtr Identity::transport() const noexcept { - ZS_THROW_NOT_IMPLEMENTED("identity API in specification is not ready") + ZS_ASSERT_FAIL("identity API in specification is not ready"); return IDTLSTransportPtr(); } //------------------------------------------------------------------------- IIdentityTypes::PromiseWithResultPtr Identity::getIdentityAssertion( - const char *provider, - const char *protoocl, - const char *username - ) throw (InvalidStateError) + ZS_MAYBE_USED() const char *provider, + ZS_MAYBE_USED() const char *protoocol, + ZS_MAYBE_USED() const char *username + ) noexcept(false) { - ZS_THROW_NOT_IMPLEMENTED("identity API in specification is not ready") + ZS_MAYBE_USED(provider); + ZS_MAYBE_USED(protoocol); + ZS_MAYBE_USED(username); + ZS_ASSERT_FAIL("identity API in specification is not ready") return PromiseWithResultPtr(); } //------------------------------------------------------------------------- - IIdentityTypes::PromiseWithAssertionPtr Identity::setIdentityAssertion(const String &assertion) + IIdentityTypes::PromiseWithAssertionPtr Identity::setIdentityAssertion(ZS_MAYBE_USED() const String &assertion) noexcept { - ZS_THROW_NOT_IMPLEMENTED("identity API in specification is not ready") + ZS_MAYBE_USED(assertion); + ZS_ASSERT_FAIL("identity API in specification is not ready") return PromiseWithAssertionPtr(); } @@ -228,23 +225,23 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IIdentityForRTPSender - #pragma mark + // + // Identity => IIdentityForRTPSender + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IWakeDelegate - #pragma mark + // + // Identity => IWakeDelegate + // //------------------------------------------------------------------------- void Identity::onWake() { - ZS_LOG_DEBUG(log("wake")) + ZS_LOG_DEBUG(log("wake")); AutoRecursiveLock lock(*this); step(); @@ -254,39 +251,38 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => ITimerDelegate - #pragma mark + // + // Identity => ITimerDelegate + // //------------------------------------------------------------------------- void Identity::onTimer(ITimerPtr timer) { - ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) + ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())); AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("NEEDED?","Is a timer needed?") } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IIdentityAsyncDelegate - #pragma mark + // + // Identity => IIdentityAsyncDelegate + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => (internal) - #pragma mark + // + // Identity => (internal) + // //------------------------------------------------------------------------- - Log::Params Identity::log(const char *message) const + Log::Params Identity::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::Identity"); IHelper::debugAppend(objectEl, "id", mID); @@ -294,13 +290,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params Identity::debug(const char *message) const + Log::Params Identity::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr Identity::toDebug() const + ElementPtr Identity::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -316,27 +312,27 @@ namespace ortc } //------------------------------------------------------------------------- - bool Identity::isShuttingDown() const + bool Identity::isShuttingDown() const noexcept { if (mGracefulShutdownReference) return true; return false; } //------------------------------------------------------------------------- - bool Identity::isShutdown() const + bool Identity::isShutdown() const noexcept { if (mGracefulShutdownReference) return false; return mShutdown; } //------------------------------------------------------------------------- - void Identity::step() + void Identity::step() noexcept { ZS_LOG_DEBUG(debug("step")) if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_LOG_DEBUG(debug("step forwarding to cancel")); cancel(); return; } @@ -349,40 +345,39 @@ namespace ortc not_ready: { - ZS_LOG_TRACE(debug("not ready")) + ZS_LOG_TRACE(debug("not ready")); return; } ready: { - ZS_LOG_TRACE(log("ready")) + ZS_LOG_TRACE(log("ready")); } } //------------------------------------------------------------------------- - bool Identity::stepBogusDoSomething() + bool Identity::stepBogusDoSomething() noexcept { if ( /* step already done */ false ) { - ZS_LOG_TRACE(log("already completed do something")) + ZS_LOG_TRACE(log("already completed do something")); return true; } if ( /* cannot do step yet */ false) { - ZS_LOG_DEBUG(log("waiting for XYZ to complete before continuing")) + ZS_LOG_DEBUG(log("waiting for XYZ to complete before continuing")); return false; } - ZS_LOG_DEBUG(log("doing step XYZ")) + ZS_LOG_DEBUG(log("doing step XYZ")); // .... -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("TODO","Do something when identity is a real thing") return true; } //------------------------------------------------------------------------- - void Identity::cancel() + void Identity::cancel() noexcept { //....................................................................... // try to gracefully shutdown @@ -392,8 +387,7 @@ namespace ortc if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); if (mGracefulShutdownReference) { -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_SCTP_SESSION_IS_SHUTDOWN 1 -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_SCTP_SESSION_IS_SHUTDOWN 2 +#pragma ZS_BUILD_NOTE("NEEDED?","Keep object alive if needed during graceful shutdown") // grace shutdown process done here @@ -414,18 +408,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityFactory - #pragma mark + // + // IIdentityFactory + // //------------------------------------------------------------------------- - IIdentityFactory &IIdentityFactory::singleton() + IIdentityFactory &IIdentityFactory::singleton() noexcept { return IdentityFactory::singleton(); } //------------------------------------------------------------------------- - IdentityPtr IIdentityFactory::create(IDTLSTransportPtr transport) + IdentityPtr IIdentityFactory::create(IDTLSTransportPtr transport) noexcept { if (this) {} return internal::Identity::create(transport); @@ -437,12 +431,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes::Result - #pragma mark + // + // IIdentityTypes::Result + // //--------------------------------------------------------------------------- - IIdentityTypes::ResultPtr IIdentityTypes::Result::convert(AnyPtr any) + IIdentityTypes::ResultPtr IIdentityTypes::Result::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Result, any); } @@ -451,12 +445,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes::Result - #pragma mark + // + // IIdentityTypes::Result + // //--------------------------------------------------------------------------- - IIdentityTypes::ErrorPtr IIdentityTypes::Error::convert(AnyPtr any) + IIdentityTypes::ErrorPtr IIdentityTypes::Error::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Error, any); } @@ -465,18 +459,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityTypes - #pragma mark + // + // IIdentityTypes + // //--------------------------------------------------------------------------- - ElementPtr IIdentity::toDebug(IIdentityPtr transport) + ElementPtr IIdentity::toDebug(IIdentityPtr transport) noexcept { return internal::Identity::toDebug(internal::Identity::convert(transport)); } //--------------------------------------------------------------------------- - IIdentityPtr IIdentity::create(IDTLSTransportPtr transport) + IIdentityPtr IIdentity::create(IDTLSTransportPtr transport) noexcept { return internal::IIdentityFactory::singleton().create(transport); } diff --git a/ortc/cpp/ortc_MediaChannelTraceHelper.cpp b/ortc/cpp/ortc_MediaChannelTraceHelper.cpp new file mode 100644 index 00000000..383e5b1c --- /dev/null +++ b/ortc/cpp/ortc_MediaChannelTraceHelper.cpp @@ -0,0 +1,190 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include + +#include +#include +#include + +#include + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_stream_track) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(MediaChannelTraceHelperDefaults); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // (helpers) + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaChannelTraceHelperDefaults + // + + class MediaChannelTraceHelperDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~MediaChannelTraceHelperDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static MediaChannelTraceHelperDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static MediaChannelTraceHelperDefaultsPtr create()noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + ISettings::setUInt(ORTC_SETTING_MEDIA_CHANNEL_TRACE_HELPER_USAGE_INACTIVITY_AGE_PURGE_TIME_IN_SECONDS, 30); + ISettings::setInt(ORTC_SETTING_MEDIA_CHANNEL_TRACE_HELPER_USAGE_INACTIVITY_AGE_CHECK_MODULAS_VALUE, 512); + } + }; + + //------------------------------------------------------------------------- + void installMediaChannelTraceHelperDefaults() noexcept + { + MediaChannelTraceHelperDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaChannelTraceHelper + // + + //------------------------------------------------------------------------- + MediaChannelTraceHelper::MediaChannelTraceHelper(MediaChannelID mediaChannelID) noexcept : + SharedRecursiveLock(SharedRecursiveLock::create()), + selfChannelID_(mediaChannelID), + lastAgeCountTimeAt_(zsLib::now()), + agePurge_(SafeInt(ISettings::getUInt(ORTC_SETTING_MEDIA_CHANNEL_TRACE_HELPER_USAGE_INACTIVITY_AGE_PURGE_TIME_IN_SECONDS))), + ageCheck_(SafeInt(ISettings::getInt(ORTC_SETTING_MEDIA_CHANNEL_TRACE_HELPER_USAGE_INACTIVITY_AGE_CHECK_MODULAS_VALUE))) + { + ZS_ASSERT(ageCheck_ > 1); // assert value is set properly + if (ageCheck_ < 1) ageCheck_ = 1; + } + + //------------------------------------------------------------------------- + MediaChannelTraceHelper::ImmutableMediaChannelTracePtr MediaChannelTraceHelper::trace(ImmutableMediaChannelTracePtr sourceTrace) noexcept + { + ZS_ASSERT((bool)sourceTrace); + uintptr_t handle = reinterpret_cast(sourceTrace.get()); + + int checkCount = (++lastUsageCount_); + bool shouldCheck = (0 == (checkCount % ageCheck_)); + + { + AutoRecursiveLock lock(*this); + auto found = traceSources_.find(handle); + if (found != traceSources_.end()) { + auto &info = (*found).second; + info.lastUsageAt_ = checkCount; + if (shouldCheck) { + ImmutableMediaChannelTracePtr result = info.trace_; + doPurge(); + return result; + } + return info.trace_; + } + + TraceSourceInfo info; + info.lastUsageAt_ = checkCount; + info.trace_ = IMediaStreamTrackTypes::MediaChannelTrace::create(*sourceTrace, selfChannelID_); + traceSources_[handle] = info; + + if (shouldCheck) { + ImmutableMediaChannelTracePtr result = info.trace_; + doPurge(); + return result; + } + return info.trace_; + } + } + + //------------------------------------------------------------------------- + void MediaChannelTraceHelper::doPurge() noexcept + { + auto tick = zsLib::now(); + + if (lastAgeCountTimeAt_ + agePurge_ > tick) return; // not time to purge yet + + if (lastUsageCount_ < 0) lastUsageCount_ = 0; // count roll over prevention + + // setup values to check for next time + lastAgeCountTimeAt_ = tick; + int lastAgeCountValueAtTime = lastAgeCountValueAtTime_; + lastAgeCountValueAtTime_ = lastUsageCount_; + + for (auto iter_doNotUse = traceSources_.begin(); iter_doNotUse != traceSources_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto &info = (*current).second; + if (info.lastUsageAt_ > lastAgeCountValueAtTime) continue; + + traceSources_.erase(current); + } + } + + } // namespace internal +} // namespace ortc diff --git a/ortc/cpp/ortc_MediaDevice.cpp b/ortc/cpp/ortc_MediaDevice.cpp new file mode 100644 index 00000000..455e95ba --- /dev/null +++ b/ortc/cpp/ortc_MediaDevice.cpp @@ -0,0 +1,377 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include + +//#include + +//#include +//#include +//#include +////#include +////#include +////#include +////#include +//#include +//#include +//#include +//#include +//#include +//#include +// +//#include +// +//#include +//#include +// +//#include +//#include +//#include +//#include +//#include +// +//#include +// +//#include +//#include +//#include + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // (helpers) + // + + //------------------------------------------------------------------------- + IMediaStreamTrackTypes::SettingsPtr obtainBestMode( + const std::list &allConstraints, + const std::list &availableModes + ) noexcept + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::StringList, StringList); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraintsPtr, UseTrackConstraints); + ZS_DECLARE_TYPEDEF_PTR(std::list, UseTrackConstraintsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, UseSettings); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ConstraintSet, UseConstraintSet); + + //----------------------------------------------------------------------- + struct ModeInfo + { + UseSettingsPtr settings_; + bool rejected{}; + size_t idealCount_{}; + + static bool containsString( + const StringList &strs, + const String &str + ) noexcept + { + for (auto iter = strs.begin(); iter != strs.end(); ++iter) { auto &value = (*iter); if (value == str) return true; } + return false; + } + + //--------------------------------------------------------------------- + bool innerProcessConstrain( + const IMediaStreamTrackTypes::ConstrainString &constrain, + const Optional &value + ) noexcept + { + StringList exacts; + StringList ideals; + constrain.ideal(ideals); + constrain.exact(exacts); + if (!value.hasValue()) { + return (exacts.size() < 1); + } + if (exacts.size() > 0) { + if (!containsString(exacts, value.value())) return false; + } + if (ideals.size() < 1) return true; + if (!containsString(ideals, value.value())) return true; + ++idealCount_; + return true; + } + + //--------------------------------------------------------------------- + bool processConstrain( + const IMediaStreamTrackTypes::ConstrainString &constrain, + const Optional &value + ) noexcept + { + if (!innerProcessConstrain(constrain, value)) { + rejected = true; + return false; + } + return true; + } + + //--------------------------------------------------------------------- + bool innerProcessConstrain( + const IMediaStreamTrackTypes::ConstrainDouble &constrain, + const Optional &value + ) noexcept + { + if (constrain.mValue.hasValue()) { + if (!value.hasValue()) return false; + return constrain.mValue.value() == value.value(); + } + if (!constrain.mRange.hasValue()) return true; + + auto &values = constrain.mRange.value(); + if (values.mMin.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() < values.mMin.value()) return false; + } + if (values.mMax.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() > values.mMax.value()) return false; + } + if (values.mExact.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() != values.mExact.value()) return false; + } + if (!values.mIdeal.hasValue()) return true; + if (!value.hasValue()) return true; + if (values.mIdeal.value() != value.value()) return true; + ++idealCount_; + return true; + } + + //--------------------------------------------------------------------- + bool processConstrain( + const IMediaStreamTrackTypes::ConstrainDouble &constrain, + const Optional &value + ) noexcept + { + if (!innerProcessConstrain(constrain, value)) { + rejected = true; + return false; + } + return true; + } + + //--------------------------------------------------------------------- + bool innerProcessConstrain( + const IMediaStreamTrackTypes::ConstrainLong &constrain, + const Optional &value + ) noexcept + { + if (constrain.mValue.hasValue()) { + if (!value.hasValue()) return false; + return constrain.mValue.value() == value.value(); + } + if (!constrain.mRange.hasValue()) return true; + + auto &values = constrain.mRange.value(); + if (values.mMin.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() < values.mMin.value()) return false; + } + if (values.mMax.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() > values.mMax.value()) return false; + } + if (values.mExact.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() != values.mExact.value()) return false; + } + if (!values.mIdeal.hasValue()) return true; + if (!value.hasValue()) return true; + if (values.mIdeal.value() != value.value()) return true; + ++idealCount_; + return true; + } + + //--------------------------------------------------------------------- + bool processConstrain( + const IMediaStreamTrackTypes::ConstrainLong &constrain, + const Optional &value + ) noexcept + { + if (!innerProcessConstrain(constrain, value)) { + rejected = true; + return false; + } + return true; + } + + + //--------------------------------------------------------------------- + bool innerProcessConstrain( + const IMediaStreamTrackTypes::ConstrainBoolean &constrain, + const Optional &value + ) noexcept + { + if (constrain.mValue.hasValue()) { + if (!value.hasValue()) return false; + return constrain.mValue.value() == value.value(); + } + if (!constrain.mParameters.hasValue()) return true; + + auto &values = constrain.mParameters.value(); + if (values.mExact.hasValue()) { + if (!value.hasValue()) return false; + if (value.value() != values.mExact.value()) return false; + } + if (!values.mIdeal.hasValue()) return true; + if (!value.hasValue()) return true; + if (values.mIdeal.value() != value.value()) return true; + ++idealCount_; + return true; + } + + //--------------------------------------------------------------------- + bool processConstrain( + const IMediaStreamTrackTypes::ConstrainBoolean &constrain, + const Optional &value + ) noexcept + { + if (!innerProcessConstrain(constrain, value)) { + rejected = true; + return false; + } + return true; + } + //--------------------------------------------------------------------- + bool checkConstrainSet(const UseConstraintSet &constrain) noexcept + { + auto &settings = (*settings_); + + if (!processConstrain(constrain.mWidth, settings.mWidth)) return false; + if (!processConstrain(constrain.mHeight, settings.mHeight)) return false; + if (!processConstrain(constrain.mAspectRatio, settings.mAspectRatio)) return false; + if (!processConstrain(constrain.mFrameRate, settings.mFrameRate)) return false; + if (!processConstrain(constrain.mFacingMode, settings.mFacingMode)) return false; + if (!processConstrain(constrain.mOrientation, settings.mOrientation)) return false; + if (!processConstrain(constrain.mVolume, settings.mVolume)) return false; + if (!processConstrain(constrain.mSampleRate, settings.mSampleRate)) return false; + if (!processConstrain(constrain.mSampleSize, settings.mSampleSize)) return false; + if (!processConstrain(constrain.mEchoCancellation, settings.mEchoCancellation)) return false; + if (!processConstrain(constrain.mLatency, settings.mLatency)) return false; + if (!processConstrain(constrain.mChannelCount, settings.mChannelCount)) return false; + if (!processConstrain(constrain.mDeviceID, settings.mDeviceID)) return false; + if (!processConstrain(constrain.mGroupID, settings.mGroupID)) return false; + if (!processConstrain(constrain.mEncodingFormat, settings.mEncodingFormat)) return false; + + return true; + } + }; + + ZS_DECLARE_TYPEDEF_PTR(std::list, ModeInfoList); + + ModeInfoList outputModes; + for (auto iter = availableModes.begin(); iter != availableModes.end(); ++iter) + { + ModeInfo info; + info.settings_ = (*iter); + outputModes.push_back(info); + } + + for (auto iter = allConstraints.begin(); iter != allConstraints.end(); ++iter) { + auto &constraints = *(*iter); + + for (auto iterMode = outputModes.begin(); iterMode != outputModes.end(); ++iterMode) { + auto &mode = (*iterMode); + if (mode.rejected) continue; + + if (!mode.checkConstrainSet(constraints)) continue; + + for (auto iterAdv = constraints.mAdvanced.begin(); iterAdv != constraints.mAdvanced.end(); ++iterAdv) { + auto &advancedConstraints = *(*iter); + if (!mode.checkConstrainSet(advancedConstraints)) break; + } + } + } + + UseSettingsPtr foundSettings; + size_t mostIdeal {}; + + for (auto iterMode = outputModes.begin(); iterMode != outputModes.end(); ++iterMode) { + auto &mode = (*iterMode); + if (mode.rejected) continue; + + if ((foundSettings) || + (mode.idealCount_ <= mostIdeal)) continue; + + foundSettings = mode.settings_; + mostIdeal = mode.idealCount_; + } + + return foundSettings; + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDevice + // + + //------------------------------------------------------------------------- + const char *IMediaDevice::toString(States state) noexcept + { + switch (state) + { + case State_Pending: return "pending"; + case State_Active: return "active"; + case State_Reinitializing: return "reinitialzing"; + case State_ShuttingDown: return "shutting down"; + case State_Shutdown: return "shutdown"; + } + return "UNKNOWN"; + } + + } // internal namespace + +} + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // __GNUC__ diff --git a/ortc/cpp/ortc_MediaDeviceCapture.cpp b/ortc/cpp/ortc_MediaDeviceCapture.cpp new file mode 100644 index 00000000..5eda814d --- /dev/null +++ b/ortc/cpp/ortc_MediaDeviceCapture.cpp @@ -0,0 +1,118 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include + +#include + +//#include +//#include +//#include +////#include +////#include +////#include +////#include +//#include +//#include +//#include +//#include +//#include +//#include +// +//#include +// +//#include +//#include +// +//#include +//#include +//#include +//#include +//#include +// +//#include +// +//#include +//#include +//#include + + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // (helpers) + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCapture + // + + //------------------------------------------------------------------------- + IMediaDeviceCapture::MediaDeviceCapturePromisePtr IMediaDeviceCapture::create( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCapture, UseEngine); + return UseEngine::createMediaDeviceCapture(repaceExistingDeviceObjectID, kind, constraints, delegate); + } + + } // internal namespace +} + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif //__GNUC__ diff --git a/ortc/cpp/ortc_MediaDeviceCaptureAudio.cpp b/ortc/cpp/ortc_MediaDeviceCaptureAudio.cpp new file mode 100644 index 00000000..9c159cf0 --- /dev/null +++ b/ortc/cpp/ortc_MediaDeviceCaptureAudio.cpp @@ -0,0 +1,1272 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +//#include +//#include +//#include +//#include +////#include +////#include +////#include +////#include +//#include +//#include +#include +#include +#include +#include + +#include +// +//#include +#include +// +#include +//#include +//#include +//#include +//#include +// +//#include +// +//#include + +#if 0 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef WINRT +#include +#endif +#include +#endif //0 + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(MediaDeviceCaptureAudioSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudioSettingsDefaults + // + + class MediaDeviceCaptureAudioSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~MediaDeviceCaptureAudioSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static MediaDeviceCaptureAudioSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static MediaDeviceCaptureAudioSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installMediaDeviceCaptureAudioSettingsDefaults() noexcept + { + MediaDeviceCaptureAudioSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureAudioForMediaEngine + // + + //------------------------------------------------------------------------- + IMediaDeviceCaptureAudioForMediaEngine::ForMediaEnginePtr IMediaDeviceCaptureAudioForMediaEngine::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + return internal::IMediaDeviceCaptureAudioFactory::singleton().create(mediaEngine, deviceID); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::MediaDeviceCaptureAudio( + const make_private &, + IMessageQueuePtr queue, + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + deviceID_(deviceID), + subscribers_(make_shared()) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureAudioCreate, ol, MediaEngine, Start, puid, id, id_, string, deviceID, deviceID_); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::init() noexcept + { + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::~MediaDeviceCaptureAudio() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + MediaDeviceCaptureAudioPtr MediaDeviceCaptureAudio::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueMediaDevices(), mediaEngine, deviceID)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudioPtr MediaDeviceCaptureAudio::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaDeviceCaptureAudio, object); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (for Media) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::notifyMediaStateChanged() noexcept + { + ZS_EVENTING_1(x, i, Debug, MediaDeviceCaptureAudioNotifyMediaStateChanged, ol, MediaEngine, Event, puid, id, id_); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::notifyMediaFailure( + MediaPtr media, + WORD errorCode, + const char *inReason + ) noexcept + { + ZS_EVENTING_2(x, e, Debug, MediaDeviceCaptureAudioNotifyMediaFailure, ol, MediaEngine, Event, puid, id, id_, puid, mediaId, media->getID()); + + auto pThis = thisWeak_.lock(); + String reason(inReason); + postClosure([pThis, media, errorCode, reason] { + AutoRecursiveLock lock(*pThis); + + if (media != pThis->media_) return; + + pThis->setError(errorCode, reason); + pThis->cancel(); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (for MediaSubscribers) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::notifySusbcriberGone() noexcept + { + ZS_EVENTING_1(x, i, Debug, MediaDeviceCaptureAudioNotifySubscriberGone, ol, MediaEngine, Event, puid, id, id_); + + recheckMode_ = true; + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IMediaDeviceForMediaEngine + // + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::isDeviceIdle() noexcept + { + AutoRecursiveLock lock(*this); + + if (isShutdown()) return true; + + if (pendingSubscribers_.size() > 0) return false; + if (subscribers_->size() > 0) return false; + + return true; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::States MediaDeviceCaptureAudio::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IMediaDeviceCaptureForMediaEngine + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::mediaDeviceCaptureSubscribe( + MediaDeviceCapturePromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingSubscriber info; + info.promise_ = promise; + info.repaceExistingDeviceObjectID_ = repaceExistingDeviceObjectID; + info.constraints_ = constraints; + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingSubscribers_.push_back(info); + pThis->step(); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IMediaDeviceCaptureAudioForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::onWake() + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureAudioOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + + if (deviceModesPromise_) { + if (deviceModesPromise_->getID() == promise->getID()) { + if (promise->isRejected()) { + setError(promise); + cancel(); + return; + } + } + } + + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::cancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IMediaDevice::State_ShuttingDown); + + deviceModesPromise_.reset(); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingRequests()) return; + if (!stepShutdownSubscribers()) return; + if (!stepShutdownMedia()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IMediaDevice::State_Shutdown); + + stepShutdownPendingRequests(); + stepShutdownSubscribers(); + stepShutdownMedia(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyDeviceIsIdleOrShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepShutdownPendingRequests() noexcept + { + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending requests"); + + for (auto iter_doNotUse = pendingSubscribers_.begin(); iter_doNotUse != pendingSubscribers_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingSubscribers_.erase(current); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepShutdownSubscribers() noexcept + { + if (subscribers_->size() < 1) return true; + + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "subscribers"); + + for (auto iter_doNotUse = subscribers_->begin(); iter_doNotUse != subscribers_->end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto subscriber = (*current).second; + + subscriber->shutdown(); + } + + // empty the subscriber list + subscribers_ = make_shared(); + + if (media_) { + media_->notifySubscribersChanged(subscribers_); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepShutdownMedia() noexcept + { + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media"); + + if (!media_) return true; + + media_->shutdown(); + bool shutdown = media_->isShutdown(); + if (shutdown) { + media_.reset(); + } + return shutdown; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureAudioStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureAudioStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepMediaReinitializationShutdown()) goto reinitializing; + if (!stepDiscoverModes()) goto not_ready; + if (!stepFigureOutMode()) goto not_ready; + if (!stepWaitForMediaDevice()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + reinitializing: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "reinitializing"); + setState(IMediaDevice::State_Reinitializing); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IMediaDevice::State_Active); + return; + } + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepMediaReinitializationShutdown() noexcept + { + if (!media_) goto no_media_to_shutdown; + + if (media_->isShuttingDown()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "waiting for media shutdown to reinialize"); + return false; + } + + if (media_->isShutdown()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media shutdown"); + media_.reset(); + return true; + } + + no_media_to_shutdown: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no media to shutdown"); + } + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepDiscoverModes() noexcept + { + if (!deviceModesPromise_) { + deviceModesPromise_ = IMediaDevices::enumerateDefaultModes(deviceID_); + + if (!deviceModesPromise_) { + setError(UseHTTP::HTTPStatusCode_ExpectationFailed, (String("unable to discover modes for an audio media device: ") + deviceID_).c_str()); + cancel(); + return false; + } + deviceModesPromise_->thenWeak(thisWeak_.lock()); + } + + if (!deviceModesPromise_->isSettled()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "waiting for device modes to be known"); + return false; + } + + if (deviceModesPromise_->isRejected()) { + setError(deviceModesPromise_); + cancel(); + return false; + } + + auto settingsList = deviceModesPromise_->value(); + + if (!settingsList) { + setError(UseHTTP::HTTPStatusCode_ExpectationFailed, (String("no modes found for audio media device: ") + deviceID_).c_str()); + cancel(); + return false; + } + + ZS_EVENTING_3(x, i, Debug, MediaDeviceCaptureAudioStepModesFound, ol, MediaEngine, Step, + puid, id, id_, + string, deviceId, deviceID_, + size_t, totalModes, settingsList->size()); + + // copy modes to shared pointer list of settings + for (auto iter = settingsList->begin(); iter != settingsList->end(); ++iter) + { + deviceModes_.push_back(make_shared(*iter)); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepFigureOutMode() noexcept + { + { + if (recheckMode_) goto mode_needed; + if (!media_) goto mode_needed; + if (pendingSubscribers_.size() > 0) goto mode_needed; + return true; + } + + mode_needed: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "figure out mode"); + + recheckMode_ = false; + + TrackConstraintsList allConstraints; + + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) + { + auto &info = (*iter); + allConstraints.push_back(info.constraints_); + } + + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + allConstraints.push_back(subscriber->getConstraints()); + } + + auto found = obtainBestMode(allConstraints, deviceModes_); + + bool changed = false; + + MediaSubscriberMapPtr replacement(make_shared()); + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + if (subscriber->isShutdown()) { + changed = true; + continue; + } + (*replacement)[(*iter).first] = subscriber; + } + + if (found) { + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) { + auto &info = (*iter); + auto subscriber = MediaSubscriber::create(getAssociatedMessageQueue(), thisWeak_.lock(), info.constraints_, info.delegate_); + info.promise_->resolve(IMediaDeviceCapturePtr(subscriber)); + subscriber->notifyStateChanged(currentState_); + changed = true; + (*replacement)[subscriber->getID()] = subscriber; + } + } else { + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) { + auto &info = (*iter); + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Conflict, "over constrained")); + } + } + pendingSubscribers_.clear(); + + if (changed) { + subscribers_ = replacement; + if (media_) { + media_->notifySubscribersChanged(subscribers_); + } + } + + if (subscribers_->size() < 1) { + found = UseSettingsPtr(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyDeviceIsIdleOrShutdownStateChanged(); + } + } + + if (found) { + if (found == requiredSettings_) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "optimal device mode has not changed"); + return true; + } + } + + if (isReady()) { + setState(IMediaDevice::State_Reinitializing); + } + + requiredSettings_ = found; + if (media_) { + media_->shutdown(); + } + } + return false; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::stepWaitForMediaDevice() noexcept + { + if (media_->isShutdown()) { + media_.reset(); + } + + if (!media_) { + if (!requiredSettings_) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no media device mode required"); + return false; + } + media_ = Media::create(getAssociatedMessageQueue(), thisWeak_.lock(), deviceID_, requiredSettings_); + media_->notifySubscribersChanged(subscribers_); + } + + if (!media_->isReady()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media device is not ready"); + return false; + } + + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media device is ready"); + return true; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceCaptureAudioSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IMediaDevice::toString(state), string, oldState, IMediaDevice::toString(currentState_)); + + currentState_ = state; + + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + subscriber->notifyStateChanged(currentState_); + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureAudioSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureAudioSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media + // + + //------------------------------------------------------------------------- + const char *MediaDeviceCaptureAudio::Media::toString(MediaStates state) noexcept + { + switch (state) + { + case MediaState_Pending: return "pending"; + case MediaState_Ready: return "ready"; + case MediaState_ShuttingDown: return "shutting down"; + case MediaState_Shutdown: return "shutdown"; + } + return "UNKNOWN"; + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::Media::Media( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + outer_(outer), + deviceID_(deviceID), + settings_(settings), + trace_(MediaChannelTrace::create(id_)) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureAudioMediaCreate, ol, MediaEngine, Start, puid, id, id_, string, deviceID, deviceID_); + + trace_->mKind = IMediaStreamTrackTypes::Kind_Audio; + trace_->mSettings = settings; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::init() noexcept + { + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::Media::~Media() noexcept + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureAudioMediaDestroy, ol, MediaEngine, Stop, puid, id, id_, string, deviceID, deviceID_); + + thisWeak_.reset(); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::MediaPtr MediaDeviceCaptureAudio::Media::create( + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept + { + auto pThis(make_shared(make_private{}, queue, outer, deviceID, settings)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => (for MediaDeviceCaptureAudio) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioMediaShutdown, ol, MediaEngine, Close, puid, id, id_); + + auto pThis = thisWeak_.lock(); + postClosure([pThis] { + AutoRecursiveLock lock(*pThis); + pThis->cancel(); + }); + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::Media::isReady() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_Ready == currentState_; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::Media::isShuttingDown() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_ShuttingDown == currentState_; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::Media::isShutdown() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_Shutdown == currentState_; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::notifySubscribersChanged(MediaSubscriberMapPtr subscribers) noexcept + { + AutoRecursiveLock lock(*this); + subscribers_ = subscribers; + } + + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::onWake() + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioMediaWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::cancel() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioMediaCancel, ol, MediaEngine, Cancel, puid, id, id_); + + if (isShutdown()) return; + + setState(MediaState_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { +#pragma ZS_BUILD_NOTE("NEEDED?","Add graceful shutdown if needed") + } + + setState(MediaState_Shutdown); + +#pragma ZS_BUILD_NOTE("NEEDED?","Hard shutdown of media capture audio") + + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaStateChanged(); + } + + gracefulShutdownReference_.reset(); + outer_.reset(); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureAudioMediaStep, ol, MediaEngine, Step, puid, id, id_); + +#pragma ZS_BUILD_NOTE("TODO","Implement media capture step") + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureAudioMediaStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + // if (!stepDoSomething()) goto return; + + goto ready; + + ready: + { + setState(MediaState_Ready); + } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::setState(MediaStates state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceCaptureAudioMediaSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, toString(state), string, oldState, toString(currentState_)); + + currentState_ = state; + + if (MediaState_Ready == state) { + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaStateChanged(); + } + } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureAudioMediaSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureAudioMediaSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + + auto pThis = thisWeak_.lock(); + if (pThis) { + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaFailure(pThis, lastError_, lastErrorReason_); + } + } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::Media::internalNotifySubscribersOfFrame(AudioFramePtr frame) noexcept + { + MediaSubscriberMapPtr subscribers; + + ZS_EVENTING_1(x, e, Insane, MediaDeviceCaptureAudioMediaNotifySubscribersOfFrame, ol, MediaEngine, InternalEvent, puid, id, id_); + + { + AutoRecursiveLock lock(*this); + subscribers = subscribers_; + } + + if (!subscribers) return; + + for (auto iter = subscribers->begin(); iter != subscribers->end(); ++iter) + { + auto &subscriber = (*iter).second; + subscriber->notifyFrame(trace_, frame); + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber + // + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::MediaSubscriber::MediaSubscriber( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + outer_(outer), + constraints_(constraints), + notifyDelegate_(delegate_), + delegate_(IMediaDeviceCaptureDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureAudioMediaSubscriberCreate, ol, MediaEngine, Start, puid, id, id_, puid, outerId, outer->getID()); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::MediaSubscriber::init() noexcept + { + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudio::MediaSubscriber::~MediaSubscriber() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioMediaSubscriberDestroy, ol, MediaEngine, Stop, puid, id, id_); + + thisWeak_.reset(); + cancel(); + } + + MediaDeviceCaptureAudio::MediaSubscriberPtr MediaDeviceCaptureAudio::MediaSubscriber::create( + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, queue, outer, constraints, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (for MediaDeviceCaptureAudio) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::MediaSubscriber::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureAudioMediaSubscriberShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + outer_.reset(); + cancel(); + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureAudio::MediaSubscriber::isShutdown() const noexcept + { + return IMediaDevice::State_Shutdown == getState(); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::MediaSubscriber::notifyStateChanged(States state) noexcept + { + auto pThis = thisWeak_.lock(); + + postClosure([pThis, state] { + AutoRecursiveLock lock(*pThis); + pThis->setState(state); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (for Media) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::MediaSubscriber::notifyFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept + { + IMediaDeviceCaptureDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + delegate->notifyMediaDeviceCaptureAudioFrame(traceHelper_.trace(trace), frame); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => IMediaDevice + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::MediaSubscriber::cancel() noexcept + { + AutoRecursiveLock lock(*this); + + setState(IMediaDevice::State_ShuttingDown); + + setState(IMediaDevice::State_Shutdown); + + auto outer = outer_.lock(); + if (outer) { + outer->notifySusbcriberGone(); + } + outer_.reset(); + + delegate_.reset(); + notifyDelegate_.reset(); + } + + //------------------------------------------------------------------------- + IMediaDevice::States MediaDeviceCaptureAudio::MediaSubscriber::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return lastReportedState_; + } + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => IMediaDeviceCapture + // + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => IMediaDeviceCaptureAudio + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureAudio::MediaSubscriber::setState(States state) noexcept + { + if (state == lastReportedState_) return; + if (IMediaDevice::State_Shutdown == lastReportedState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceCaptureAudioMediaSubscriberSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IMediaDevice::toString(state), string, oldState, IMediaDevice::toString(lastReportedState_)); + + lastReportedState_ = state; + + auto pThis = thisWeak_.lock(); + if (!pThis) return; + if (!delegate_) return; + + try { + delegate_->onMediaDeviceCaptureStateChanged(pThis, state); + } catch (const IMediaDeviceCaptureDelegateProxy::Exceptions::DelegateGone &) { + delegate_.reset(); + } + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureAudioFactory + // + + //------------------------------------------------------------------------- + IMediaDeviceCaptureAudioFactory &IMediaDeviceCaptureAudioFactory::singleton() noexcept + { + return MediaDeviceCaptureAudioFactory::singleton(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureAudioPtr IMediaDeviceCaptureAudioFactory::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + if (this) {} + return internal::MediaDeviceCaptureAudio::create(mediaEngine, deviceID); + } + + } // internal namespace +} diff --git a/ortc/cpp/ortc_MediaDeviceCaptureVideo.cpp b/ortc/cpp/ortc_MediaDeviceCaptureVideo.cpp new file mode 100644 index 00000000..4ebf5cab --- /dev/null +++ b/ortc/cpp/ortc_MediaDeviceCaptureVideo.cpp @@ -0,0 +1,1277 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +//#include +//#include +//#include +//#include +////#include +////#include +////#include +////#include +//#include +//#include +#include +#include +#include +#include + +#include +// +//#include +#include +// +#include +//#include +//#include +//#include +//#include +// +//#include +// +//#include + +#if 0 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef WINRT +#include +#endif +#include +#endif //0 + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(MediaDeviceCaptureVideoSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideoSettingsDefaults + // + + class MediaDeviceCaptureVideoSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~MediaDeviceCaptureVideoSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static MediaDeviceCaptureVideoSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static MediaDeviceCaptureVideoSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installMediaDeviceCaptureVideoSettingsDefaults() noexcept + { + MediaDeviceCaptureVideoSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureVideoForMediaEngine + // + + //------------------------------------------------------------------------- + IMediaDeviceCaptureVideoForMediaEngine::ForMediaEnginePtr IMediaDeviceCaptureVideoForMediaEngine::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + return internal::IMediaDeviceCaptureVideoFactory::singleton().create(mediaEngine, deviceID); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::MediaDeviceCaptureVideo( + const make_private &, + IMessageQueuePtr queue, + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + deviceID_(deviceID), + subscribers_(make_shared()) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureVideoCreate, ol, MediaEngine, Start, puid, id, id_, string, deviceID, deviceID_); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::init() noexcept + { + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::~MediaDeviceCaptureVideo() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + MediaDeviceCaptureVideoPtr MediaDeviceCaptureVideo::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueMediaDevices(), mediaEngine, deviceID)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideoPtr MediaDeviceCaptureVideo::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaDeviceCaptureVideo, object); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (for Media) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::notifyMediaStateChanged() noexcept + { + ZS_EVENTING_1(x, i, Debug, MediaDeviceCaptureVideoNotifyMediaStateChanged, ol, MediaEngine, Event, puid, id, id_); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::notifyMediaFailure( + MediaPtr media, + WORD errorCode, + const char *inReason + ) noexcept + { + ZS_EVENTING_2(x, e, Debug, MediaDeviceCaptureVideoNotifyMediaFailure, ol, MediaEngine, Event, puid, id, id_, puid, mediaId, media->getID()); + + auto pThis = thisWeak_.lock(); + String reason(inReason); + postClosure([pThis, media, errorCode, reason] { + AutoRecursiveLock lock(*pThis); + + if (media != pThis->media_) return; + + pThis->setError(errorCode, reason); + pThis->cancel(); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (for MediaSubscribers) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::notifySusbcriberGone() noexcept + { + ZS_EVENTING_1(x, i, Debug, MediaDeviceCaptureVideoNotifySubscriberGone, ol, MediaEngine, Event, puid, id, id_); + + recheckMode_ = true; + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IMediaDeviceForMediaEngine + // + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::isDeviceIdle() noexcept + { + AutoRecursiveLock lock(*this); + + if (isShutdown()) return true; + + if (pendingSubscribers_.size() > 0) return false; + if (subscribers_->size() > 0) return false; + + return true; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::States MediaDeviceCaptureVideo::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IMediaDeviceCaptureForMediaEngine + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::mediaDeviceCaptureSubscribe( + MediaDeviceCapturePromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingSubscriber info; + info.promise_ = promise; + info.repaceExistingDeviceObjectID_ = repaceExistingDeviceObjectID; + info.constraints_ = constraints; + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingSubscribers_.push_back(info); + pThis->step(); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IMediaDeviceCaptureVideoForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::onWake() + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureVideoOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + + if (deviceModesPromise_) { + if (deviceModesPromise_->getID() == promise->getID()) { + if (promise->isRejected()) { + setError(promise); + cancel(); + return; + } + } + } + + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::cancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IMediaDevice::State_ShuttingDown); + + deviceModesPromise_.reset(); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingRequests()) return; + if (!stepShutdownSubscribers()) return; + if (!stepShutdownMedia()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IMediaDevice::State_Shutdown); + + stepShutdownPendingRequests(); + stepShutdownSubscribers(); + stepShutdownMedia(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyDeviceIsIdleOrShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepShutdownPendingRequests() noexcept + { + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending requests"); + + for (auto iter_doNotUse = pendingSubscribers_.begin(); iter_doNotUse != pendingSubscribers_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingSubscribers_.erase(current); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepShutdownSubscribers() noexcept + { + if (subscribers_->size() < 1) return true; + + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "subscribers"); + + for (auto iter_doNotUse = subscribers_->begin(); iter_doNotUse != subscribers_->end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto subscriber = (*current).second; + + subscriber->shutdown(); + } + + // empty the subscriber list + subscribers_ = make_shared(); + + if (media_) { + media_->notifySubscribersChanged(subscribers_); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepShutdownMedia() noexcept + { + ZS_EVENTING_2(x, i, Debug, MediaDeviceCaptureVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media"); + + if (!media_) return true; + + media_->shutdown(); + bool shutdown = media_->isShutdown(); + if (shutdown) { + media_.reset(); + } + return shutdown; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureVideoStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureVideoStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepMediaReinitializationShutdown()) goto reinitializing; + if (!stepDiscoverModes()) goto not_ready; + if (!stepFigureOutMode()) goto not_ready; + if (!stepWaitForMediaDevice()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + reinitializing: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "reinitializing"); + setState(IMediaDevice::State_Reinitializing); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IMediaDevice::State_Active); + return; + } + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepMediaReinitializationShutdown() noexcept + { + if (!media_) goto no_media_to_shutdown; + + if (media_->isShuttingDown()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "waiting for media shutdown to reinialize"); + return false; + } + + if (media_->isShutdown()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media shutdown"); + media_.reset(); + return true; + } + + no_media_to_shutdown: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no media to shutdown"); + } + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepDiscoverModes() noexcept + { + if (!deviceModesPromise_) { + deviceModesPromise_ = IMediaDevices::enumerateDefaultModes(deviceID_); + + if (!deviceModesPromise_) { + setError(UseHTTP::HTTPStatusCode_ExpectationFailed, (String("unable to discover modes for an video media device: ") + deviceID_).c_str()); + cancel(); + return false; + } + deviceModesPromise_->thenWeak(thisWeak_.lock()); + } + + if (!deviceModesPromise_->isSettled()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "waiting for device modes to be known"); + return false; + } + + if (deviceModesPromise_->isRejected()) { + setError(deviceModesPromise_); + cancel(); + return false; + } + + auto settingsList = deviceModesPromise_->value(); + + if (!settingsList) { + setError(UseHTTP::HTTPStatusCode_ExpectationFailed, (String("no modes found for video media device: ") + deviceID_).c_str()); + cancel(); + return false; + } + + ZS_EVENTING_3(x, i, Debug, MediaDeviceCaptureVideoStepModesFound, ol, MediaEngine, Step, + puid, id, id_, + string, deviceId, deviceID_, + size_t, totalModes, settingsList->size()); + + // copy modes to shared pointer list of settings + for (auto iter = settingsList->begin(); iter != settingsList->end(); ++iter) + { + deviceModes_.push_back(make_shared(*iter)); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepFigureOutMode() noexcept + { + { + if (recheckMode_) goto mode_needed; + if (!media_) goto mode_needed; + if (pendingSubscribers_.size() > 0) goto mode_needed; + return true; + } + + mode_needed: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "figure out mode"); + + recheckMode_ = false; + + TrackConstraintsList allConstraints; + + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) + { + auto &info = (*iter); + allConstraints.push_back(info.constraints_); + } + + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + allConstraints.push_back(subscriber->getConstraints()); + } + + auto found = obtainBestMode(allConstraints, deviceModes_); + + bool changed = false; + + MediaSubscriberMapPtr replacement(make_shared()); + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + if (subscriber->isShutdown()) { + changed = true; + continue; + } + (*replacement)[(*iter).first] = subscriber; + } + + if (found) { + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) { + auto &info = (*iter); + auto subscriber = MediaSubscriber::create(getAssociatedMessageQueue(), thisWeak_.lock(), info.constraints_, info.delegate_); + info.promise_->resolve(IMediaDeviceCapturePtr(subscriber)); + subscriber->notifyStateChanged(currentState_); + changed = true; + (*replacement)[subscriber->getID()] = subscriber; + } + } else { + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) { + auto &info = (*iter); + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Conflict, "over constrained")); + } + } + pendingSubscribers_.clear(); + + if (changed) { + subscribers_ = replacement; + if (media_) { + media_->notifySubscribersChanged(subscribers_); + } + } + + if (subscribers_->size() < 1) { + found = UseSettingsPtr(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyDeviceIsIdleOrShutdownStateChanged(); + } + } + + if (found) { + if (found == requiredSettings_) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "optimal device mode has not changed"); + return true; + } + } + + if (isReady()) { + setState(IMediaDevice::State_Reinitializing); + } + + requiredSettings_ = found; + if (media_) { + media_->shutdown(); + } + } + return false; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::stepWaitForMediaDevice() noexcept + { + if (media_->isShutdown()) { + media_.reset(); + } + + if (!media_) { + if (!requiredSettings_) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no media device mode required"); + return false; + } + media_ = Media::create(getAssociatedMessageQueue(), thisWeak_.lock(), deviceID_, requiredSettings_); + media_->notifySubscribersChanged(subscribers_); + } + + if (!media_->isReady()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media device is not ready"); + return false; + } + + ZS_EVENTING_2(x, i, Trace, MediaDeviceCaptureVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media device is ready"); + return true; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceCaptureVideoSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IMediaDevice::toString(state), string, oldState, IMediaDevice::toString(currentState_)); + + currentState_ = state; + + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + subscriber->notifyStateChanged(currentState_); + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureVideoSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureVideoSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media + // + + //------------------------------------------------------------------------- + const char *MediaDeviceCaptureVideo::Media::toString(MediaStates state) noexcept + { + switch (state) + { + case MediaState_Pending: return "pending"; + case MediaState_Ready: return "ready"; + case MediaState_ShuttingDown: return "shutting down"; + case MediaState_Shutdown: return "shutdown"; + } + return "UNKNOWN"; + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::Media::Media( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + outer_(outer), + deviceID_(deviceID), + settings_(settings), + trace_(MediaChannelTrace::create(id_)) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureVideoMediaCreate, ol, MediaEngine, Start, puid, id, id_, string, deviceID, deviceID_); + + trace_->mKind = IMediaStreamTrackTypes::Kind_Video; + trace_->mSettings = settings_; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::init() noexcept + { + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::Media::~Media() noexcept + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureVideoMediaDestroy, ol, MediaEngine, Stop, puid, id, id_, string, deviceID, deviceID_); + + thisWeak_.reset(); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::MediaPtr MediaDeviceCaptureVideo::Media::create( + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept + { + auto pThis(make_shared(make_private{}, queue, outer, deviceID, settings)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => (for MediaDeviceCaptureVideo) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoMediaShutdown, ol, MediaEngine, Close, puid, id, id_); + + auto pThis = thisWeak_.lock(); + postClosure([pThis] { + AutoRecursiveLock lock(*pThis); + pThis->cancel(); + }); + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::Media::isReady() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_Ready == currentState_; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::Media::isShuttingDown() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_ShuttingDown == currentState_; + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::Media::isShutdown() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_Shutdown == currentState_; + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::notifySubscribersChanged(MediaSubscriberMapPtr subscribers) noexcept + { + AutoRecursiveLock lock(*this); + subscribers_ = subscribers; + } + + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::onWake() + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoMediaWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::cancel() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoMediaCancel, ol, MediaEngine, Cancel, puid, id, id_); + + if (isShutdown()) return; + + setState(MediaState_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { +#pragma ZS_BUILD_NOTE("NEEDED?","Implement graceful shutdown of media") + } + + setState(MediaState_Shutdown); + +#pragma ZS_BUILD_NOTE("TODO","Implement hard shutdown of media") + + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaStateChanged(); + } + + gracefulShutdownReference_.reset(); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureVideoMediaStep, ol, MediaEngine, Step, puid, id, id_); + +#pragma ZS_BUILD_NOTE("TODO","Implement media step") + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaDeviceCaptureVideoMediaStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + // if (!stepDoSomething()) goto return; + + goto ready; + + ready: + { + setState(MediaState_Ready); + } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::setState(MediaStates state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceCaptureVideoMediaSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, toString(state), string, oldState, toString(currentState_)); + + currentState_ = state; + + if (MediaState_Ready == state) { + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaStateChanged(); + } + } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureVideoMediaSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaDeviceCaptureVideoMediaSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + + auto pThis = thisWeak_.lock(); + if (pThis) { + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaFailure(pThis, lastError_, lastErrorReason_); + } + } + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::Media::internalNotifySubscribersOfFrame(VideoFramePtr frame) noexcept + { + MediaSubscriberMapPtr subscribers; + + ZS_EVENTING_1(x, e, Insane, MediaDeviceCaptureVideoMediaNotifySubscribersOfFrame, ol, MediaEngine, InternalEvent, puid, id, id_); + + { + AutoRecursiveLock lock(*this); + subscribers = subscribers_; + } + + if (!subscribers) return; + + for (auto iter = subscribers->begin(); iter != subscribers->end(); ++iter) + { + auto &subscriber = (*iter).second; + subscriber->notifyFrame(trace_, frame); + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber + // + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::MediaSubscriber::MediaSubscriber( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + outer_(outer), + constraints_(constraints), + notifyDelegate_(delegate_), + delegate_(IMediaDeviceCaptureDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceCaptureVideoMediaSubscriberCreate, ol, MediaEngine, Start, puid, id, id_, puid, outerId, outer->getID()); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::MediaSubscriber::init() noexcept + { + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideo::MediaSubscriber::~MediaSubscriber() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoMediaSubscriberDestroy, ol, MediaEngine, Stop, puid, id, id_); + + thisWeak_.reset(); + cancel(); + } + + MediaDeviceCaptureVideo::MediaSubscriberPtr MediaDeviceCaptureVideo::MediaSubscriber::create( + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, queue, outer, constraints, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (for MediaDeviceCaptureVideo) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::MediaSubscriber::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceCaptureVideoMediaSubscriberShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + //------------------------------------------------------------------------- + bool MediaDeviceCaptureVideo::MediaSubscriber::isShutdown() const noexcept + { + return IMediaDevice::State_Shutdown == getState(); + } + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::MediaSubscriber::notifyStateChanged(States state) noexcept + { + auto pThis = thisWeak_.lock(); + + postClosure([pThis, state] { + AutoRecursiveLock lock(*pThis); + pThis->setState(state); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (for Media) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::MediaSubscriber::notifyFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept + { + IMediaDeviceCaptureDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + delegate->notifyMediaDeviceCaptureVideoFrame(traceHelper_.trace(trace), frame); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => IMediaDevice + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::MediaSubscriber::cancel() noexcept + { + AutoRecursiveLock lock(*this); + + setState(IMediaDevice::State_ShuttingDown); + + setState(IMediaDevice::State_Shutdown); + + auto outer = outer_.lock(); + if (outer) { + outer->notifySusbcriberGone(); + } + + delegate_.reset(); + notifyDelegate_.reset(); + } + + //------------------------------------------------------------------------- + IMediaDevice::States MediaDeviceCaptureVideo::MediaSubscriber::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return lastReportedState_; + } + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => IMediaDeviceCapture + // + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => IMediaDeviceCaptureVideo + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceCaptureVideo::MediaSubscriber::setState(States state) noexcept + { + if (state == lastReportedState_) return; + if (IMediaDevice::State_Shutdown == lastReportedState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceCaptureVideoMediaSubscriberSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IMediaDevice::toString(state), string, oldState, IMediaDevice::toString(lastReportedState_)); + + lastReportedState_ = state; + + auto pThis = thisWeak_.lock(); + if (!pThis) return; + if (!delegate_) return; + + try { + delegate_->onMediaDeviceCaptureStateChanged(pThis, state); + } catch (const IMediaDeviceCaptureDelegateProxy::Exceptions::DelegateGone &) { + delegate_.reset(); + } + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureVideoFactory + // + + //------------------------------------------------------------------------- + IMediaDeviceCaptureVideoFactory &IMediaDeviceCaptureVideoFactory::singleton() noexcept + { + return MediaDeviceCaptureVideoFactory::singleton(); + } + + //------------------------------------------------------------------------- + MediaDeviceCaptureVideoPtr IMediaDeviceCaptureVideoFactory::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + if (this) {} + return internal::MediaDeviceCaptureVideo::create(mediaEngine, deviceID); + } + + } // internal namespace +} diff --git a/ortc/cpp/ortc_MediaDeviceRenderAudio.cpp b/ortc/cpp/ortc_MediaDeviceRenderAudio.cpp new file mode 100644 index 00000000..6691cc59 --- /dev/null +++ b/ortc/cpp/ortc_MediaDeviceRenderAudio.cpp @@ -0,0 +1,1241 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(MediaDeviceRenderAudioSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudioSettingsDefaults + // + + class MediaDeviceRenderAudioSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~MediaDeviceRenderAudioSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static MediaDeviceRenderAudioSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static MediaDeviceRenderAudioSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installMediaDeviceRenderAudioSettingsDefaults() noexcept + { + MediaDeviceRenderAudioSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceRenderAudioForMediaEngine + // + + //------------------------------------------------------------------------- + IMediaDeviceRenderAudioForMediaEngine::ForMediaEnginePtr IMediaDeviceRenderAudioForMediaEngine::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + return internal::IMediaDeviceRenderAudioFactory::singleton().create(mediaEngine, deviceID); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::MediaDeviceRenderAudio( + const make_private &, + IMessageQueuePtr queue, + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + deviceID_(deviceID), + subscribers_(make_shared()) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceRenderAudioCreate, ol, MediaEngine, Start, puid, id, id_, string, deviceID, deviceID_); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::init() noexcept + { + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::~MediaDeviceRenderAudio() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + MediaDeviceRenderAudioPtr MediaDeviceRenderAudio::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueMediaDevices(), mediaEngine, deviceID)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudioPtr MediaDeviceRenderAudio::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaDeviceRenderAudio, object); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (for Media) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::notifyMediaStateChanged() noexcept + { + ZS_EVENTING_1(x, i, Debug, MediaDeviceRenderAudioNotifyMediaStateChanged, ol, MediaEngine, Event, puid, id, id_); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::notifyMediaFailure( + MediaPtr media, + WORD errorCode, + const char *inReason + ) noexcept + { + ZS_EVENTING_2(x, e, Debug, MediaDeviceRenderAudioNotifyMediaFailure, ol, MediaEngine, Event, puid, id, id_, puid, mediaId, media->getID()); + + auto pThis = thisWeak_.lock(); + String reason(inReason); + postClosure([pThis, media, errorCode, reason] { + AutoRecursiveLock lock(*pThis); + + if (media != pThis->media_) return; + + pThis->setError(errorCode, reason); + pThis->cancel(); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (for MediaSubscribers) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::notifySusbcriberGone() noexcept + { + ZS_EVENTING_1(x, i, Debug, MediaDeviceRenderAudioNotifySubscriberGone, ol, MediaEngine, Event, puid, id, id_); + + recheckMode_ = true; + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept + { + MediaPtr media; + + { + AutoRecursiveLock lock(*this); + media = media_; + } + + if (!media) return; + + media->notifyAudioFrame(trace, frame); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IMediaDeviceForMediaEngine + // + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::isDeviceIdle() noexcept + { + AutoRecursiveLock lock(*this); + + if (isShutdown()) return true; + + if (pendingSubscribers_.size() > 0) return false; + if (subscribers_->size() > 0) return false; + + return true; + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::States MediaDeviceRenderAudio::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IMediaDeviceRenderForMediaEngine + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::mediaDeviceRenderSubscribe( + MediaDeviceRenderPromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingSubscriber info; + info.promise_ = promise; + info.repaceExistingDeviceObjectID_ = repaceExistingDeviceObjectID; + info.constraints_ = constraints; + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingSubscribers_.push_back(info); + pThis->step(); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IMediaDeviceRenderAudioForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::onWake() + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceRenderAudioOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + + if (deviceModesPromise_) { + if (deviceModesPromise_->getID() == promise->getID()) { + if (promise->isRejected()) { + setError(promise); + cancel(); + return; + } + } + } + + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::cancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IMediaDevice::State_ShuttingDown); + + deviceModesPromise_.reset(); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, MediaDeviceRenderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingRequests()) return; + if (!stepShutdownSubscribers()) return; + if (!stepShutdownMedia()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IMediaDevice::State_Shutdown); + + stepShutdownPendingRequests(); + stepShutdownSubscribers(); + stepShutdownMedia(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyDeviceIsIdleOrShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepShutdownPendingRequests() noexcept + { + ZS_EVENTING_2(x, i, Debug, MediaDeviceRenderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending requests"); + + for (auto iter_doNotUse = pendingSubscribers_.begin(); iter_doNotUse != pendingSubscribers_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingSubscribers_.erase(current); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepShutdownSubscribers() noexcept + { + if (subscribers_->size() < 1) return true; + + ZS_EVENTING_2(x, i, Debug, MediaDeviceRenderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "subscribers"); + + for (auto iter_doNotUse = subscribers_->begin(); iter_doNotUse != subscribers_->end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto subscriber = (*current).second; + + subscriber->shutdown(); + } + + // empty the subscriber list + subscribers_ = make_shared(); + + if (media_) { + media_->notifySubscribersChanged(subscribers_); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepShutdownMedia() noexcept + { + ZS_EVENTING_2(x, i, Debug, MediaDeviceRenderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media"); + + if (!media_) return true; + + media_->shutdown(); + bool shutdown = media_->isShutdown(); + if (shutdown) { + media_.reset(); + } + return shutdown; + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceRenderAudioStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaDeviceRenderAudioStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepMediaReinitializationShutdown()) goto reinitializing; + if (!stepDiscoverModes()) goto not_ready; + if (!stepFigureOutMode()) goto not_ready; + if (!stepWaitForMediaDevice()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + reinitializing: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "reinitializing"); + setState(IMediaDevice::State_Reinitializing); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IMediaDevice::State_Active); + return; + } + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepMediaReinitializationShutdown() noexcept + { + if (!media_) goto no_media_to_shutdown; + + if (media_->isShuttingDown()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "waiting for media shutdown to reinialize"); + return false; + } + + if (media_->isShutdown()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media shutdown"); + media_.reset(); + return true; + } + + no_media_to_shutdown: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no media to shutdown"); + } + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepDiscoverModes() noexcept + { + if (!deviceModesPromise_) { + deviceModesPromise_ = IMediaDevices::enumerateDefaultModes(deviceID_); + + if (!deviceModesPromise_) { + setError(UseHTTP::HTTPStatusCode_ExpectationFailed, (String("unable to discover modes for an audio media device: ") + deviceID_).c_str()); + cancel(); + return false; + } + deviceModesPromise_->thenWeak(thisWeak_.lock()); + } + + if (!deviceModesPromise_->isSettled()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "waiting for device modes to be known"); + return false; + } + + if (deviceModesPromise_->isRejected()) { + setError(deviceModesPromise_); + cancel(); + return false; + } + + auto settingsList = deviceModesPromise_->value(); + + if (!settingsList) { + setError(UseHTTP::HTTPStatusCode_ExpectationFailed, (String("no modes found for audio media device: ") + deviceID_).c_str()); + cancel(); + return false; + } + + ZS_EVENTING_3(x, i, Debug, MediaDeviceRenderAudioStepModesFound, ol, MediaEngine, Step, + puid, id, id_, + string, deviceId, deviceID_, + size_t, totalModes, settingsList->size()); + + // copy modes to shared pointer list of settings + for (auto iter = settingsList->begin(); iter != settingsList->end(); ++iter) + { + deviceModes_.push_back(make_shared(*iter)); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepFigureOutMode() noexcept + { + { + if (recheckMode_) goto mode_needed; + if (!media_) goto mode_needed; + if (pendingSubscribers_.size() > 0) goto mode_needed; + return true; + } + + mode_needed: + { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "figure out mode"); + + recheckMode_ = false; + + TrackConstraintsList allConstraints; + + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) + { + auto &info = (*iter); + allConstraints.push_back(info.constraints_); + } + + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + allConstraints.push_back(subscriber->getConstraints()); + } + + auto found = obtainBestMode(allConstraints, deviceModes_); + + bool changed = false; + + MediaSubscriberMapPtr replacement(make_shared()); + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + if (subscriber->isShutdown()) { + changed = true; + continue; + } + (*replacement)[(*iter).first] = subscriber; + } + + if (found) { + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) { + auto &info = (*iter); + auto subscriber = MediaSubscriber::create(getAssociatedMessageQueue(), thisWeak_.lock(), info.constraints_, info.delegate_); + info.promise_->resolve(IMediaDeviceRenderPtr(subscriber)); + subscriber->notifyStateChanged(currentState_); + changed = true; + (*replacement)[subscriber->getID()] = subscriber; + } + } else { + for (auto iter = pendingSubscribers_.begin(); iter != pendingSubscribers_.end(); ++iter) { + auto &info = (*iter); + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Conflict, "over constrained")); + } + } + pendingSubscribers_.clear(); + + if (changed) { + subscribers_ = replacement; + if (media_) { + media_->notifySubscribersChanged(subscribers_); + } + } + + if (subscribers_->size() < 1) { + found = UseSettingsPtr(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyDeviceIsIdleOrShutdownStateChanged(); + } + } + + if (found) { + if (found == requiredSettings_) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "optimal device mode has not changed"); + return true; + } + } + + if (isReady()) { + setState(IMediaDevice::State_Reinitializing); + } + + requiredSettings_ = found; + if (media_) { + media_->shutdown(); + } + } + return false; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::stepWaitForMediaDevice() noexcept + { + if (media_->isShutdown()) { + media_.reset(); + } + + if (!media_) { + if (!requiredSettings_) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no media device mode required"); + return false; + } + media_ = Media::create(getAssociatedMessageQueue(), thisWeak_.lock(), deviceID_, requiredSettings_); + media_->notifySubscribersChanged(subscribers_); + } + + if (!media_->isReady()) { + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media device is not ready"); + return false; + } + + ZS_EVENTING_2(x, i, Trace, MediaDeviceRenderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "media device is ready"); + return true; + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceRenderAudioSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IMediaDevice::toString(state), string, oldState, IMediaDevice::toString(currentState_)); + + currentState_ = state; + + for (auto iter = subscribers_->begin(); iter != subscribers_->end(); ++iter) { + auto &subscriber = (*iter).second; + subscriber->notifyStateChanged(currentState_); + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaDeviceRenderAudioSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaDeviceRenderAudioSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media + // + + //------------------------------------------------------------------------- + const char *MediaDeviceRenderAudio::Media::toString(MediaStates state) noexcept + { + switch (state) + { + case MediaState_Pending: return "pending"; + case MediaState_Ready: return "ready"; + case MediaState_ShuttingDown: return "shutting down"; + case MediaState_Shutdown: return "shutdown"; + } + return "UNKNOWN"; + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::Media::Media( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + outer_(outer), + deviceID_(deviceID), + settings_(settings) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceRenderAudioMediaCreate, ol, MediaEngine, Start, puid, id, id_, string, deviceID, deviceID_); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::init() noexcept + { + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::Media::~Media() noexcept + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceRenderAudioMediaDestroy, ol, MediaEngine, Stop, puid, id, id_, string, deviceID, deviceID_); + + thisWeak_.reset(); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::MediaPtr MediaDeviceRenderAudio::Media::create( + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept + { + auto pThis(make_shared(make_private{}, queue, outer, deviceID, settings)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => (for MediaDeviceRenderAudio) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioMediaShutdown, ol, MediaEngine, Close, puid, id, id_); + + auto pThis = thisWeak_.lock(); + postClosure([pThis] { + AutoRecursiveLock lock(*pThis); + pThis->cancel(); + }); + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::Media::isReady() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_Ready == currentState_; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::Media::isShuttingDown() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_ShuttingDown == currentState_; + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::Media::isShutdown() const noexcept + { + AutoRecursiveLock lock(*this); + return MediaState_Shutdown == currentState_; + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::notifySubscribersChanged(MediaSubscriberMapPtr subscribers) noexcept + { + AutoRecursiveLock lock(*this); + subscribers_ = subscribers; + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept + { +#pragma ZS_BUILD_NOTE("TODO","Implement notify audio frame") + } + + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::onWake() + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioMediaWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::cancel() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioMediaCancel, ol, MediaEngine, Cancel, puid, id, id_); + + if (isShutdown()) return; + + setState(MediaState_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { +#pragma ZS_BUILD_NOTE("NEEDED?","Implement graceful shutdown of render audio") + } + + setState(MediaState_Shutdown); + +#pragma ZS_BUILD_NOTE("TODO","Implement hard shutdown of render audio") + + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaStateChanged(); + } + + gracefulShutdownReference_.reset(); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaDeviceRenderAudioMediaStep, ol, MediaEngine, Step, puid, id, id_); + +#pragma ZS_BUILD_NOTE("TODO","Implement render audio step") + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaDeviceRenderAudioMediaStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + // if (!stepDoSomething()) return; + + goto ready; + + ready: + { + setState(MediaState_Ready); + } + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::setState(MediaStates state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceRenderAudioMediaSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, toString(state), string, oldState, toString(currentState_)); + + currentState_ = state; + + if (MediaState_Ready == state) { + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaStateChanged(); + } + } + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::Media::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaDeviceRenderAudioMediaSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaDeviceRenderAudioMediaSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + + auto pThis = thisWeak_.lock(); + if (pThis) { + auto outer = outer_.lock(); + if (outer) { + outer->notifyMediaFailure(pThis, lastError_, lastErrorReason_); + } + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber + // + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::MediaSubscriber::MediaSubscriber( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + outer_(outer), + constraints_(constraints), + notifyDelegate_(delegate_), + delegate_(IMediaDeviceRenderDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_2(x, i, Detail, MediaDeviceRenderAudioMediaSubscriberCreate, ol, MediaEngine, Start, puid, id, id_, puid, outerId, outer->getID()); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::MediaSubscriber::init() noexcept + { + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::MediaSubscriber::~MediaSubscriber() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioMediaSubscriberDestroy, ol, MediaEngine, Stop, puid, id, id_); + + thisWeak_.reset(); + cancel(); + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudio::MediaSubscriberPtr MediaDeviceRenderAudio::MediaSubscriber::create( + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, queue, outer, constraints, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (for MediaDeviceRenderAudio) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::MediaSubscriber::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaDeviceRenderAudioMediaSubscriberShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + //------------------------------------------------------------------------- + bool MediaDeviceRenderAudio::MediaSubscriber::isShutdown() const noexcept + { + return IMediaDevice::State_Shutdown == getState(); + } + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::MediaSubscriber::notifyStateChanged(States state) noexcept + { + auto pThis = thisWeak_.lock(); + + postClosure([pThis, state] { + AutoRecursiveLock lock(*pThis); + pThis->setState(state); + }); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (for Media) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDeviceRender + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDeviceRenderAudio + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::MediaSubscriber::notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept + { + auto outer = outer_.lock(); + if (!outer) return; + + outer->notifyAudioFrame(traceHelper_.trace(trace), frame); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDevice + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::MediaSubscriber::cancel() noexcept + { + AutoRecursiveLock lock(*this); + + setState(IMediaDevice::State_ShuttingDown); + + setState(IMediaDevice::State_Shutdown); + + auto outer = outer_.lock(); + if (outer) { + outer->notifySusbcriberGone(); + } + + delegate_.reset(); + notifyDelegate_.reset(); + } + + //------------------------------------------------------------------------- + IMediaDevice::States MediaDeviceRenderAudio::MediaSubscriber::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return lastReportedState_; + } + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDeviceRender + // + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDeviceRenderAudio + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (internal) + // + + //------------------------------------------------------------------------- + void MediaDeviceRenderAudio::MediaSubscriber::setState(States state) noexcept + { + if (state == lastReportedState_) return; + if (IMediaDevice::State_Shutdown == lastReportedState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaDeviceRenderAudioMediaSubscriberSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IMediaDevice::toString(state), string, oldState, IMediaDevice::toString(lastReportedState_)); + + lastReportedState_ = state; + + auto pThis = thisWeak_.lock(); + if (!pThis) return; + if (!delegate_) return; + + try { + delegate_->onMediaDeviceRenderStateChanged(pThis, state); + } catch (const IMediaDeviceRenderDelegateProxy::Exceptions::DelegateGone &) { + delegate_.reset(); + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceRenderAudioFactory + // + + //------------------------------------------------------------------------- + IMediaDeviceRenderAudioFactory &IMediaDeviceRenderAudioFactory::singleton() noexcept + { + return MediaDeviceRenderAudioFactory::singleton(); + } + + //------------------------------------------------------------------------- + MediaDeviceRenderAudioPtr IMediaDeviceRenderAudioFactory::create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept + { + if (this) {} + return internal::MediaDeviceRenderAudio::create(mediaEngine, deviceID); + } + + } // internal namespace +} diff --git a/ortc/cpp/ortc_MediaDevices.cpp b/ortc/cpp/ortc_MediaDevices.cpp index c0e02a92..5246703e 100644 --- a/ortc/cpp/ortc_MediaDevices.cpp +++ b/ortc/cpp/ortc_MediaDevices.cpp @@ -1,6 +1,6 @@ /* - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -43,22 +45,19 @@ #include #include #include +#include #include #include #include -#include -#include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG +#include +#include +#include +#include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_mediadevices) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_devices) } namespace ortc { @@ -79,37 +78,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevicesSettingsDefaults - #pragma mark + // + // MediaDevicesSettingsDefaults + // class MediaDevicesSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~MediaDevicesSettingsDefaults() + ~MediaDevicesSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static MediaDevicesSettingsDefaultsPtr singleton() + static MediaDevicesSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static MediaDevicesSettingsDefaultsPtr create() + static MediaDevicesSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -117,7 +116,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { // ISettings::setUInt(ORTC_SETTING_MEDIA_DEVICES, 0); } @@ -125,7 +124,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installMediaDevicesSettingsDefaults() + void installMediaDevicesSettingsDefaults() noexcept { MediaDevicesSettingsDefaults::singleton(); } @@ -134,20 +133,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForSettings - #pragma mark + // + // IICETransportForSettings + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices - #pragma mark + // + // MediaDevices + // //--------------------------------------------------------------------------- - const char *MediaDevices::toString(States state) + const char *MediaDevices::toString(States state) noexcept { switch (state) { case State_Pending: return "pending"; @@ -162,22 +161,23 @@ namespace ortc MediaDevices::MediaDevices( const make_private &, IMessageQueuePtr queue - ) : + ) noexcept : MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()) + SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()) { ZS_LOG_DETAIL(debug("created")) } //------------------------------------------------------------------------- - void MediaDevices::init() + void MediaDevices::init() noexcept { AutoRecursiveLock lock(*this); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); } //------------------------------------------------------------------------- - MediaDevices::~MediaDevices() + MediaDevices::~MediaDevices() noexcept { if (isNoop()) return; @@ -188,7 +188,7 @@ namespace ortc } //------------------------------------------------------------------------- - MediaDevicesPtr MediaDevices::create() + MediaDevicesPtr MediaDevices::create() noexcept { MediaDevicesPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC())); pThis->mThisWeak = pThis; @@ -197,7 +197,7 @@ namespace ortc } //------------------------------------------------------------------------- - MediaDevicesPtr MediaDevices::singleton() + MediaDevicesPtr MediaDevices::singleton() noexcept { AutoRecursiveLock lock(*IHelper::getGlobalLock()); static SingletonLazySharedPtr singleton(create()); @@ -213,7 +213,7 @@ namespace ortc } //------------------------------------------------------------------------- - MediaDevicesPtr MediaDevices::convert(IMediaDevicesPtr object) + MediaDevicesPtr MediaDevices::convert(IMediaDevicesPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaDevices, object); } @@ -223,12 +223,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => IMediaDevices - #pragma mark + // + // MediaDevices => IMediaDevices + // //------------------------------------------------------------------------- - ElementPtr MediaDevices::singletonToDebug() + ElementPtr MediaDevices::singletonToDebug() noexcept { MediaDevicesPtr pThis(MediaDevices::singleton()); @@ -239,37 +239,52 @@ namespace ortc } //------------------------------------------------------------------------- - IMediaDevices::SupportedConstraintsPtr MediaDevices::getSupportedConstraints() + IMediaDevices::SupportedConstraintsPtr MediaDevices::getSupportedConstraints() noexcept { SupportedConstraintsPtr result(make_shared()); -#define TODO_IMPLEMENT 1 -#define TODO_IMPLEMENT 2 +#pragma ZS_BUILD_NOTE("TODO","Implement media devices getSupportedConstraints") return result; } //------------------------------------------------------------------------- - IMediaDevicesTypes::PromiseWithDeviceListPtr MediaDevices::enumerateDevices() + IMediaDevicesTypes::PromiseWithDeviceListPtr MediaDevices::enumerateDevices() noexcept { PromiseWithDeviceListPtr promise = PromiseWithDeviceList::create(IORTCForInternal::queueDelegate()); MediaDevicesPtr pThis(MediaDevices::singleton()); if (!pThis) { - ZS_LOG_WARNING(Basic, slog("media devices singleton is gone")) + ZS_LOG_WARNING(Basic, slog("media devices singleton is gone")); promise->reject(); return promise; } IMediaDevicesAsyncDelegateProxy::create(pThis)->onEnumerateDevices(promise); - return promise; } //------------------------------------------------------------------------- - IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr MediaDevices::getUserMedia(const Constraints &constraints) + IMediaDevicesTypes::PromiseWithSettingsListPtr MediaDevices::enumerateDefaultModes(const char *deviceID) noexcept + { + PromiseWithSettingsListPtr promise = PromiseWithSettingsList::create(IORTCForInternal::queueDelegate()); + + MediaDevicesPtr pThis(MediaDevices::singleton()); + + if (!pThis) { + ZS_LOG_WARNING(Basic, slog("media devices singleton is gone")) + promise->reject(); + return promise; + } + + IMediaDevicesAsyncDelegateProxy::create(pThis)->onEnumerateDefaultModes(promise, deviceID); + return promise; + } + + //------------------------------------------------------------------------- + IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr MediaDevices::getUserMedia(const Constraints &constraints) noexcept { PromiseWithMediaStreamTrackListPtr promise = PromiseWithMediaStreamTrackList::create(IORTCForInternal::queueDelegate()); @@ -289,18 +304,16 @@ namespace ortc } //------------------------------------------------------------------------- - IMediaDevicesSubscriptionPtr MediaDevices::subscribe(IMediaDevicesDelegatePtr originalDelegate) + IMediaDevicesSubscriptionPtr MediaDevices::subscribe(IMediaDevicesDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(slog("subscribing to media devices")) auto pThis = singleton(); if (!pThis) { - ZS_DECLARE_STRUCT_PTR(BogusSubscription) - struct BogusSubscription : public IMediaDevicesSubscription { - virtual PUID getID() const override {return mID;} - virtual void cancel() override {} - virtual void background() override {} + virtual PUID getID() const noexcept override {return mID;} + virtual void cancel() noexcept override {} + virtual void background() noexcept override {} AutoPUID mID; }; @@ -316,8 +329,7 @@ namespace ortc IMediaDevicesDelegatePtr delegate = pThis->mSubscriptions.delegate(subscription, true); if (delegate) { -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 1 -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 2 +#pragma ZS_BUILD_NOTE("NEEDED?","Do we need to tell about any missing events?") } if (pThis->isShutdown()) { @@ -331,9 +343,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => IWakeDelegate - #pragma mark + // + // MediaDevices => IWakeDelegate + // //------------------------------------------------------------------------- void MediaDevices::onWake() @@ -348,9 +360,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => ITimerDelegate - #pragma mark + // + // MediaDevices => ITimerDelegate + // //------------------------------------------------------------------------- void MediaDevices::onTimer(ITimerPtr timer) @@ -358,17 +370,16 @@ namespace ortc ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("TODO","Media devices timer (if needed)") } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => IMediaDevicesAsyncDelegate - #pragma mark + // + // MediaDevices => IMediaDevicesAsyncDelegate + // //------------------------------------------------------------------------- void MediaDevices::onEnumerateDevices(PromiseWithDeviceListPtr promise) @@ -377,7 +388,7 @@ namespace ortc DeviceListPtr value(std::make_shared()); - webrtc::VideoCaptureModule::DeviceInfo* info = webrtc::VideoCaptureFactory::CreateDeviceInfo(0); + webrtc::VideoCaptureModule::DeviceInfo* info = webrtc::VideoCaptureFactory::CreateDeviceInfo(); if (!info) { promise->reject(); return; @@ -398,22 +409,27 @@ namespace ortc } delete info; - webrtc::AudioDeviceModule* audioDevice = - webrtc::AudioDeviceModuleImpl::Create(1, webrtc::AudioDeviceModule::kWindowsWasapiAudio); + webrtc::AudioDeviceModule::AudioLayer audioLayer; +#ifdef WINUWP + audioLayer = webrtc::AudioDeviceModule::kWindowsWasapiAudio; +#else + audioLayer = webrtc::AudioDeviceModule::kPlatformDefaultAudio; +#endif + + rtc::scoped_refptr audioDevice = + webrtc::AudioDeviceModule::Create(audioLayer); if (!audioDevice) { promise->reject(); return; } - audioDevice->AddRef(); - audioDevice->Init(); int numMics = audioDevice->RecordingDevices(); for (int index = 0; index < numMics; ++index) { char deviceName[webrtc::kAdmMaxDeviceNameSize]; char deviceGuid[webrtc::kAdmMaxGuidSize]; - if (audioDevice->RecordingDeviceName(index, deviceName, deviceGuid) != -1) { + if (audioDevice->RecordingDeviceName(static_cast(index), deviceName, deviceGuid) != -1) { Device device; device.mKind = DeviceKind_AudioInput; device.mDeviceID = deviceGuid; @@ -426,7 +442,7 @@ namespace ortc for (int index = 0; index < numSpeaks; ++index) { char deviceName[webrtc::kAdmMaxDeviceNameSize]; char deviceGuid[webrtc::kAdmMaxGuidSize]; - if (audioDevice->PlayoutDeviceName(index, deviceName, deviceGuid) != -1) { + if (audioDevice->PlayoutDeviceName(static_cast(index), deviceName, deviceGuid) != -1) { Device device; device.mKind = DeviceKind_AudioOutput; device.mDeviceID = deviceGuid; @@ -440,6 +456,18 @@ namespace ortc promise->resolve(value); } + //------------------------------------------------------------------------- + void MediaDevices::onEnumerateDefaultModes( + PromiseWithSettingsListPtr promise, + ZS_MAYBE_USED() const char *deviceID + ) + { + ZS_MAYBE_USED(deviceID); + AutoRecursiveLock lock(*this); +#pragma ZS_BUILD_NOTE("TODO","Enumerate devices") + promise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_NotImplemented, "method not implemented")); + } + //------------------------------------------------------------------------- void MediaDevices::onGetUserMedia(PromiseWithMediaStreamTrackListPtr promise, ConstraintsPtr constraints) { @@ -449,22 +477,20 @@ namespace ortc if (constraints->mVideo) { - MediaStreamTrackPtr videoTrack = IMediaStreamTrackFactory::singleton().create( + auto videoTrack = IMediaStreamTrackFactory::singleton().createForMediaDevices( IMediaStreamTrackTypes::Kinds::Kind_Video, - false, - constraints->mVideo + *constraints->mVideo ); - value->push_back(videoTrack); + value->push_back(MediaStreamTrack::convert(videoTrack)); } if (constraints->mAudio) { - MediaStreamTrackPtr audioTrack = IMediaStreamTrackFactory::singleton().create( + auto audioTrack = IMediaStreamTrackFactory::singleton().createForMediaDevices( IMediaStreamTrackTypes::Kinds::Kind_Audio, - false, - constraints->mAudio + *constraints->mAudio ); - value->push_back(audioTrack); + value->push_back(MediaStreamTrack::convert(audioTrack)); } promise->resolve(value); @@ -474,12 +500,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => ISingletonManagerDelegate - #pragma mark + // + // MediaDevices => ISingletonManagerDelegate + // //------------------------------------------------------------------------- - void MediaDevices::notifySingletonCleanup() + void MediaDevices::notifySingletonCleanup() noexcept { ZS_LOG_DEBUG(log("notify singleton cleanup")) @@ -491,12 +517,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => (internal) - #pragma mark + // + // MediaDevices => (internal) + // //------------------------------------------------------------------------- - Log::Params MediaDevices::log(const char *message) const + Log::Params MediaDevices::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::MediaDevices"); IHelper::debugAppend(objectEl, "id", mID); @@ -504,20 +530,20 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params MediaDevices::slog(const char *message) + Log::Params MediaDevices::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::MediaDevices"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params MediaDevices::debug(const char *message) const + Log::Params MediaDevices::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr MediaDevices::toDebug() const + ElementPtr MediaDevices::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -538,19 +564,19 @@ namespace ortc } //------------------------------------------------------------------------- - bool MediaDevices::isShuttingDown() const + bool MediaDevices::isShuttingDown() const noexcept { return State_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool MediaDevices::isShutdown() const + bool MediaDevices::isShutdown() const noexcept { return State_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void MediaDevices::step() + void MediaDevices::step() noexcept { ZS_LOG_DEBUG(debug("step")) @@ -580,7 +606,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool MediaDevices::stepBogusDoSomething() + bool MediaDevices::stepBogusDoSomething() noexcept { if ( /* step already done */ false ) { ZS_LOG_TRACE(log("already completed do something")) @@ -595,14 +621,13 @@ namespace ortc ZS_LOG_DEBUG(log("doing step XYZ")) // .... -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("TODO","Implement media devices step") return true; } //------------------------------------------------------------------------- - void MediaDevices::cancel() + void MediaDevices::cancel() noexcept { //....................................................................... // try to gracefully shutdown @@ -612,8 +637,7 @@ namespace ortc if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); if (mGracefulShutdownReference) { -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_SESSION_IS_SHUTDOWN 1 -#define TODO_OBJECT_IS_BEING_KEPT_ALIVE_UNTIL_SESSION_IS_SHUTDOWN 2 +#pragma ZS_BUILD_NOTE("TODO","Implement media devices graceful shutdown") // grace shutdown process done here @@ -632,7 +656,7 @@ namespace ortc } //------------------------------------------------------------------------- - void MediaDevices::setState(States state) + void MediaDevices::setState(States state) noexcept { if (state == mCurrentState) return; @@ -647,7 +671,7 @@ namespace ortc } //------------------------------------------------------------------------- - void MediaDevices::setError(WORD errorCode, const char *inReason) + void MediaDevices::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -670,53 +694,60 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesFactory - #pragma mark + // + // IMediaDevicesFactory + // //------------------------------------------------------------------------- - IMediaDevicesFactory &IMediaDevicesFactory::singleton() + IMediaDevicesFactory &IMediaDevicesFactory::singleton() noexcept { return MediaDevicesFactory::singleton(); } //------------------------------------------------------------------------- - ElementPtr IMediaDevicesFactory::singletonToDebug() + ElementPtr IMediaDevicesFactory::singletonToDebug() noexcept { if (this) {} return internal::MediaDevices::singletonToDebug(); } //------------------------------------------------------------------------- - MediaDevicesPtr IMediaDevicesFactory::create() + MediaDevicesPtr IMediaDevicesFactory::create() noexcept { if (this) {} return internal::MediaDevices::create(); } //------------------------------------------------------------------------- - IMediaDevicesTypes::SupportedConstraintsPtr IMediaDevicesFactory::getSupportedConstraints() + IMediaDevicesTypes::SupportedConstraintsPtr IMediaDevicesFactory::getSupportedConstraints() noexcept { if (this) {} return internal::MediaDevices::getSupportedConstraints(); } //------------------------------------------------------------------------- - IMediaDevicesTypes::PromiseWithDeviceListPtr IMediaDevicesFactory::enumerateDevices() + IMediaDevicesTypes::PromiseWithDeviceListPtr IMediaDevicesFactory::enumerateDevices() noexcept { if (this) {} return internal::MediaDevices::enumerateDevices(); } //------------------------------------------------------------------------- - IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr IMediaDevicesFactory::getUserMedia(const Constraints &constraints) + IMediaDevicesTypes::PromiseWithSettingsListPtr IMediaDevicesFactory::enumerateDefaultModes(const char *deviceID) noexcept + { + if (this) {} + return internal::MediaDevices::enumerateDefaultModes(deviceID); + } + + //------------------------------------------------------------------------- + IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr IMediaDevicesFactory::getUserMedia(const Constraints &constraints) noexcept { if (this) {} return internal::MediaDevices::getUserMedia(constraints); } //------------------------------------------------------------------------- - IMediaDevicesSubscriptionPtr IMediaDevicesFactory::subscribe(IMediaDevicesDelegatePtr delegate) + IMediaDevicesSubscriptionPtr IMediaDevicesFactory::subscribe(IMediaDevicesDelegatePtr delegate) noexcept { if (this) {} return internal::MediaDevices::subscribe(delegate); @@ -728,12 +759,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IMediaDevicesTypes"); } @@ -742,12 +773,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesTypes - #pragma mark + // + // IMediaDevicesTypes + // //--------------------------------------------------------------------------- - const char *IMediaDevicesTypes::toString(DeviceKinds kind) + const char *IMediaDevicesTypes::toString(DeviceKinds kind) noexcept { switch (kind) { case DeviceKind_AudioInput: return "audioinput"; @@ -758,18 +789,18 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaDevicesTypes::DeviceKinds IMediaDevicesTypes::toDeviceKind(const char *deviceKindStr) + IMediaDevicesTypes::DeviceKinds IMediaDevicesTypes::toDeviceKind(const char *deviceKindStr) noexcept(false) { String str(deviceKindStr); for (IMediaDevicesTypes::DeviceKinds index = IMediaDevicesTypes::DeviceKind_First; index <= IMediaDevicesTypes::DeviceKind_Last; index = static_cast(static_cast::type>(index) + 1)) { if (0 == str.compareNoCase(IMediaDevicesTypes::toString(index))) return index; } - ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str) + ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str); return IMediaDevicesTypes::DeviceKind_First; } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::Kinds IMediaDevicesTypes::toKind(DeviceKinds kind) + IMediaStreamTrackTypes::Kinds IMediaDevicesTypes::toKind(DeviceKinds kind) noexcept { switch (kind) { case DeviceKind_AudioInput: return Kind_Audio; @@ -777,12 +808,12 @@ namespace ortc case DeviceKind_VideoInput: return Kind_Video; } - ASSERT(false) + ZS_ASSERT_FAIL("unknown device kind"); return Kind_Audio; } //--------------------------------------------------------------------------- - bool IMediaDevicesTypes::isAudio(DeviceKinds kind) + bool IMediaDevicesTypes::isAudio(DeviceKinds kind) noexcept { switch (kind) { case DeviceKind_AudioInput: return true; @@ -790,12 +821,12 @@ namespace ortc case DeviceKind_VideoInput: return false; } - ASSERT(false) + ZS_ASSERT_FAIL("unknown device kind"); return false; } //--------------------------------------------------------------------------- - bool IMediaDevicesTypes::isVideo(DeviceKinds kind) + bool IMediaDevicesTypes::isVideo(DeviceKinds kind) noexcept { switch (kind) { case DeviceKind_AudioInput: return false; @@ -803,7 +834,7 @@ namespace ortc case DeviceKind_VideoInput: return true; } - ASSERT(false) + ZS_ASSERT_FAIL("unknown device kind"); return false; } @@ -811,13 +842,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesTypes::SupportedConstraints - #pragma mark + // + // IMediaDevicesTypes::SupportedConstraints + // //--------------------------------------------------------------------------- - IMediaDevicesTypes::SupportedConstraints::SupportedConstraints(ElementPtr elem) + IMediaDevicesTypes::SupportedConstraints::SupportedConstraints(ElementPtr elem) noexcept { if (!elem) return; @@ -836,7 +867,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaDevicesTypes::SupportedConstraints::createElement(const char *objectName) const + ElementPtr IMediaDevicesTypes::SupportedConstraints::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -850,6 +881,7 @@ namespace ortc IHelper::adoptElementValue(elem, "sampleSize", mSampleSize); IHelper::adoptElementValue(elem, "echoCancellation", mEchoCancellation); IHelper::adoptElementValue(elem, "latency", mLatency); + IHelper::adoptElementValue(elem, "channelCount", mChannelCount); IHelper::adoptElementValue(elem, "deviceId", mDeviceID); IHelper::adoptElementValue(elem, "groupId", mGroupID); @@ -859,7 +891,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaDevicesTypes::SupportedConstraints::toDebug() const + ElementPtr IMediaDevicesTypes::SupportedConstraints::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaDevicesTypes::SupportedConstraints"); @@ -872,6 +904,7 @@ namespace ortc IHelper::debugAppend(resultEl, "sample rate", mSampleRate); IHelper::debugAppend(resultEl, "echo cancellation", mEchoCancellation); IHelper::debugAppend(resultEl, "latency", mLatency); + IHelper::debugAppend(resultEl, "channel count", mChannelCount); IHelper::debugAppend(resultEl, "device id", mDeviceID); IHelper::debugAppend(resultEl, "group id", mGroupID); @@ -879,7 +912,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IMediaDevicesTypes::SupportedConstraints::hash() const + String IMediaDevicesTypes::SupportedConstraints::hash() const noexcept { auto hasher = IHasher::sha1();; @@ -902,6 +935,8 @@ namespace ortc hasher->update(":"); hasher->update(mLatency); hasher->update(":"); + hasher->update(mChannelCount); + hasher->update(":"); hasher->update(mDeviceID); hasher->update(":"); hasher->update(mGroupID); @@ -913,13 +948,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesTypes::Device - #pragma mark + // + // IMediaDevicesTypes::Device + // //--------------------------------------------------------------------------- - IMediaDevicesTypes::Device::Device(ElementPtr elem) + IMediaDevicesTypes::Device::Device(ElementPtr elem) noexcept { if (!elem) return; @@ -945,7 +980,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaDevicesTypes::Device::createElement(const char *objectName) const + ElementPtr IMediaDevicesTypes::Device::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -963,7 +998,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaDevicesTypes::Device::toDebug() const + ElementPtr IMediaDevicesTypes::Device::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaDevicesTypes::Device"); @@ -977,7 +1012,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IMediaDevicesTypes::Device::hash() const + String IMediaDevicesTypes::Device::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1000,32 +1035,32 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices::MediaStreamTrackList - #pragma mark + // + // IMediaDevices::MediaStreamTrackList + // //--------------------------------------------------------------------------- - IMediaDevices::MediaStreamTrackListPtr IMediaDevices::MediaStreamTrackList::convert(AnyPtr any) + IMediaDevices::MediaStreamTrackListPtr IMediaDevices::MediaStreamTrackList::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrackList, any); } //--------------------------------------------------------------------------- - ElementPtr IMediaDevicesTypes::MediaStreamTrackList::toDebug() const + ElementPtr IMediaDevicesTypes::MediaStreamTrackList::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaDevicesTypes::MediaStreamTrackList"); for (auto iter = begin(); iter != end(); ++iter) { auto &track = (*iter); - IHelper::debugAppend(resultEl, IMediaStreamTrack::toDebug(track)); + ZS_EVENTING_TRACE_OBJECT_PTR(Trace, track, "media stream track list debug"); } return resultEl; } //--------------------------------------------------------------------------- - String IMediaDevicesTypes::MediaStreamTrackList::hash() const + String IMediaDevicesTypes::MediaStreamTrackList::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1045,13 +1080,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices::DeviceList - #pragma mark + // + // IMediaDevices::DeviceList + // //--------------------------------------------------------------------------- - IMediaDevices::DeviceList::DeviceList(ElementPtr elem) + IMediaDevices::DeviceList::DeviceList(ElementPtr elem) noexcept { if (!elem) return; @@ -1064,7 +1099,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaDevices::DeviceList::createElement(const char *objectName) const + ElementPtr IMediaDevices::DeviceList::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1081,13 +1116,13 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaDevices::DeviceListPtr IMediaDevices::DeviceList::convert(AnyPtr any) + IMediaDevices::DeviceListPtr IMediaDevices::DeviceList::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(DeviceList, any); } //--------------------------------------------------------------------------- - ElementPtr IMediaDevicesTypes::DeviceList::toDebug() const + ElementPtr IMediaDevicesTypes::DeviceList::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaDevicesTypes::DeviceList"); @@ -1101,7 +1136,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IMediaDevicesTypes::DeviceList::hash() const + String IMediaDevicesTypes::DeviceList::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1121,36 +1156,42 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevices - #pragma mark + // + // IMediaDevices + // //--------------------------------------------------------------------------- - ElementPtr IMediaDevices::toDebug() + ElementPtr IMediaDevices::toDebug() noexcept { return internal::IMediaDevicesFactory::singleton().singletonToDebug(); } //--------------------------------------------------------------------------- - IMediaDevicesTypes::SupportedConstraintsPtr IMediaDevices::getSupportedConstraints() + IMediaDevicesTypes::SupportedConstraintsPtr IMediaDevices::getSupportedConstraints() noexcept { return internal::IMediaDevicesFactory::singleton().getSupportedConstraints(); } //--------------------------------------------------------------------------- - IMediaDevicesTypes::PromiseWithDeviceListPtr IMediaDevices::enumerateDevices() + IMediaDevicesTypes::PromiseWithDeviceListPtr IMediaDevices::enumerateDevices() noexcept { return internal::IMediaDevicesFactory::singleton().enumerateDevices(); } //--------------------------------------------------------------------------- - IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr IMediaDevices::getUserMedia(const Constraints &constraints) + IMediaDevices::PromiseWithSettingsListPtr IMediaDevices::enumerateDefaultModes(const char *deviceID) noexcept + { + return internal::IMediaDevicesFactory::singleton().enumerateDefaultModes(deviceID); + } + + //--------------------------------------------------------------------------- + IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr IMediaDevices::getUserMedia(const Constraints &constraints) noexcept { return internal::IMediaDevicesFactory::singleton().getUserMedia(constraints); } //--------------------------------------------------------------------------- - IMediaDevicesSubscriptionPtr IMediaDevices::subscribe(IMediaDevicesDelegatePtr delegate) + IMediaDevicesSubscriptionPtr IMediaDevices::subscribe(IMediaDevicesDelegatePtr delegate) noexcept { return internal::IMediaDevicesFactory::singleton().subscribe(delegate); } diff --git a/ortc/cpp/ortc_MediaEngine.cpp b/ortc/cpp/ortc_MediaEngine.cpp new file mode 100644 index 00000000..5ba692ec --- /dev/null +++ b/ortc/cpp/ortc_MediaEngine.cpp @@ -0,0 +1,2063 @@ +/* + + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#if 0 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef WINRT +#include +#endif +#include +#endif //0 + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(MediaEngineSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // (helpers) + // + + // foreward declaration + void webrtcTrace(Log::Severity severity, Log::Level level, const char *message) noexcept; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngineSettingsDefaults + // + + class MediaEngineSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~MediaEngineSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static MediaEngineSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static MediaEngineSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installMediaEngineSettingsDefaults() noexcept + { + MediaEngineSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForORTC + // + + //------------------------------------------------------------------------- + void IMediaEngineForORTC::setLogLevel(Log::Level level) noexcept + { + IMediaEngineFactory::singleton().setLogLevel(level); + } + + //------------------------------------------------------------------------- + void IMediaEngineForORTC::ntpServerTime(const Milliseconds &value) noexcept + { + IMediaEngineFactory::singleton().ntpServerTime(value); + } + + //------------------------------------------------------------------------- + void IMediaEngineForORTC::startMediaTracing() noexcept + { + IMediaEngineFactory::singleton().startMediaTracing(); + } + + //------------------------------------------------------------------------- + void IMediaEngineForORTC::stopMediaTracing() noexcept + { + IMediaEngineFactory::singleton().stopMediaTracing(); + } + + //------------------------------------------------------------------------- + bool IMediaEngineForORTC::isMediaTracing() noexcept + { + return IMediaEngineFactory::singleton().isMediaTracing(); + } + + //------------------------------------------------------------------------- + bool IMediaEngineForORTC::saveMediaTrace(String filename) noexcept + { + return IMediaEngineFactory::singleton().saveMediaTrace(filename); + } + + //------------------------------------------------------------------------- + bool IMediaEngineForORTC::saveMediaTrace(String host, int port) noexcept + { + return IMediaEngineFactory::singleton().saveMediaTrace(host, port); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceCapture + // + + //------------------------------------------------------------------------- + IMediaDeviceCapture::MediaDeviceCapturePromisePtr IMediaEngineForMediaDeviceCapture::createMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + return internal::IMediaEngineFactory::singleton().createMediaDeviceCapture(repaceExistingDeviceObjectID, kind, constraints, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceRender + // + + //------------------------------------------------------------------------- + IMediaEngineForMediaDeviceRender::MediaDeviceRenderPromisePtr IMediaEngineForMediaDeviceRender::createMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept + { + return internal::IMediaEngineFactory::singleton().createMediaDeviceRender(repaceExistingDeviceObjectID, constraints, delegate); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceRenderAudio + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTP + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecode + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoderAudio + // + + //------------------------------------------------------------------------- + IMediaEngineForRTPDecoderAudio::PromiseWithRTPDecoderAudioPtr IMediaEngineForRTPDecoderAudio::createRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + return internal::IMediaEngineFactory::singleton().createRTPDecoderAudio(parameters, delegate); + } + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoderVideo + // + + //------------------------------------------------------------------------- + IMediaEngineForRTPDecoderVideo::PromiseWithRTPDecoderVideoPtr IMediaEngineForRTPDecoderVideo::createRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + return internal::IMediaEngineFactory::singleton().createRTPDecoderVideo(parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoderAudio + // + + //------------------------------------------------------------------------- + IMediaEngineForRTPEncoderAudio::PromiseWithRTPEncoderAudioPtr IMediaEngineForRTPEncoderAudio::createRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + return internal::IMediaEngineFactory::singleton().createRTPEncoderAudio(parameters, delegate); + } + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoderVideo + // + + //------------------------------------------------------------------------- + IMediaEngineForRTPEncoderVideo::PromiseWithRTPEncoderVideoPtr IMediaEngineForRTPEncoderVideo::createRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + return internal::IMediaEngineFactory::singleton().createRTPEncoderVideo(parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //--------------------------------------------------------------------------- + const char *MediaEngine::toString(States state) noexcept + { + switch (state) { + case State_Pending: return "pending"; + case State_WakingUp: return "waking up"; + case State_Ready: return "ready"; + case State_GoingToSleep: return "going to sleep"; + case State_Sleeping: return "sleeping"; + case State_ShuttingDown: return "shutting down"; + case State_Shutdown: return "shutdown"; + } + return "UNDEFINED"; + } + + //------------------------------------------------------------------------- + MediaEngine::MediaEngine( + const make_private &, + IMessageQueuePtr queue + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + //traceCallback_(new WebRtcTraceCallback()), + logSink_(new WebRtcLogSink()) + { + ZS_EVENTING_1(x, i, Detail, MediaEngineCreate, ol, MediaEngine, Start, puid, id, id_); + } + + //------------------------------------------------------------------------- + void MediaEngine::init() noexcept + { + //webrtc::Trace::CreateTrace(); + //webrtc::Trace::SetTraceCallback(traceCallback_.get()); + + auto level = IORTCForInternal::webrtcLogLevel(); + if (level.hasValue()) { + internalSetLogLevel(level); + } + +#if defined(WINUWP) + webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); +#endif + + AutoRecursiveLock lock(*this); + + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + MediaEngine::~MediaEngine() noexcept + { + if (isNoop()) return; + + //webrtc::Trace::SetTraceCallback(nullptr); + //webrtc::Trace::ReturnTrace(); + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, MediaEngineDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + MediaEnginePtr MediaEngine::singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + MediaEnginePtr MediaEngine::create() noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueBlockingMediaStartStopThread())); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForORTCPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForMediaDeviceCapturePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForMediaDeviceCaptureAudioPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForMediaDeviceCaptureVideoPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForMediaDeviceRenderPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForMediaDeviceRenderAudioPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPDecodePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPDecodeAudioPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPDecodeVideoPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPEncodePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPEncodeAudioPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + MediaEnginePtr MediaEngine::convert(ForRTPEncodeVideoPtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(MediaEngine, object); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForORTC + // + + //------------------------------------------------------------------------- + void MediaEngine::internalSetLogLevel(Log::Level level) noexcept + { + //webrtc::TraceLevel traceLevel{ webrtc::kTraceAll }; + rtc::LoggingSeverity rtcLevel{ rtc::LS_INFO }; + + /*switch (level) + { + case Log::Level::None: rtcLevel = rtc::LS_NONE; traceLevel = static_cast(webrtc::kTraceNone); break; + case Log::Level::Basic: rtcLevel = rtc::LS_ERROR; traceLevel = static_cast(webrtc::kTraceCritical | webrtc::kTraceError); break; + case Log::Level::Detail: rtcLevel = rtc::LS_WARNING; traceLevel = static_cast(webrtc::kTraceWarning | webrtc::kTraceError | webrtc::kTraceCritical); break; + case Log::Level::Debug: rtcLevel = rtc::LS_INFO; traceLevel = static_cast(webrtc::kTraceDefault); break; + case Log::Level::Trace: rtcLevel = rtc::LS_VERBOSE; traceLevel = static_cast(webrtc::kTraceDefault | webrtc::kTraceModuleCall | webrtc::kTraceTimer | webrtc::kTraceDebug); break; + case Log::Level::Insane: rtcLevel = rtc::LS_SENSITIVE; traceLevel = static_cast(webrtc::kTraceAll); break; + }*/ + + rtc::LogMessage::RemoveLogToStream(logSink_.get()); + rtc::LogMessage::AddLogToStream(logSink_.get(), rtcLevel); + + //webrtc::Trace::set_level_filter(traceLevel); + } + + //------------------------------------------------------------------------- + void MediaEngine::internalNTPServerTime(ZS_MAYBE_USED() const Milliseconds &value) noexcept + { + ZS_MAYBE_USED(value); +#pragma ZS_BUILD_NOTE("TODO","Implement ntp server time") +#if 0 + rtc::SyncWithNtp(value.count()); +#endif //0 + } + + //------------------------------------------------------------------------- + void MediaEngine::internalStartMediaTracing() noexcept + { + //traceLog_.EnableTraceInternalStorage(); + //traceLog_.StartTracing(); + } + + //------------------------------------------------------------------------- + void MediaEngine::internalStopMediaTracing() noexcept + { + //traceLog_.StopTracing(); + } + + //------------------------------------------------------------------------- + bool MediaEngine::internalIsMediaTracing() noexcept + { + //return traceLog_.IsTracing(); + return false; + } + + //------------------------------------------------------------------------- + bool MediaEngine::internalSaveMediaTrace(ZS_MAYBE_USED() String filename) noexcept + { + ZS_MAYBE_USED(filename); + //return traceLog_.Save(filename); + return false; + } + + //------------------------------------------------------------------------- + bool MediaEngine::internalSaveMediaTrace(ZS_MAYBE_USED() String host, ZS_MAYBE_USED() int port) noexcept + { +#pragma ZS_BUILD_NOTE("TODO","remove ZS_MAYBE_USED when implemented") + ZS_MAYBE_USED(host); + ZS_MAYBE_USED(port); + //return traceLog_.Save(host, port); + return false; + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDevice + // + + //------------------------------------------------------------------------- + void MediaEngine::notifyDeviceIsIdleOrShutdownStateChanged() noexcept + { + checkForIdleDevices_ = true; + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceCapture + // + + //------------------------------------------------------------------------- + MediaEngine::MediaDeviceCapturePromisePtr MediaEngine::innerCreateMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingForMediaDeviceCapture info; + info.repaceExistingDeviceObjectID_ = repaceExistingDeviceObjectID; + info.kind_ = kind; + info.promise_ = MediaDeviceCapturePromise::create(IORTCForInternal::queueDelegate()); + info.constraints_ = TrackConstraints::create(constraints); + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingForMediaDeviceCaptures_.push_back(info); + pThis->step(); + }); + + return info.promise_; + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceCaptureAudio + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceCaptureVideo + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceRender + // + + //------------------------------------------------------------------------- + MediaEngine::MediaDeviceRenderPromisePtr MediaEngine::innerCreateMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingForMediaDeviceRenderInfo info; + info.repaceExistingDeviceObjectID_ = repaceExistingDeviceObjectID; + info.promise_ = MediaDeviceRenderPromise::create(IORTCForInternal::queueDelegate()); + info.constraints_ = TrackConstraints::create(constraints); + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingForMediaDeviceRenders_.push_back(info); + pThis->step(); + }); + + return info.promise_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceRenderAudio + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTP + // + + //------------------------------------------------------------------------- + void MediaEngine::notifyRTPShutdownStateChanged() noexcept + { + checkForShutdownRTP_ = true; + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPDecoder + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPDecoderAudio + // + + //------------------------------------------------------------------------- + MediaEngine::PromiseWithRTPDecoderAudioPtr MediaEngine::innerCreateRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingForRTPDecodeAudio info; + info.promise_ = PromiseWithRTPDecoderAudio::create(IORTCForInternal::queueDelegate()); + info.parameters_ = make_shared(parameters); + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingForRTPDecodeAudios_.push_back(info); + pThis->step(); + }); + + return info.promise_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPDecoderVideo + // + + //------------------------------------------------------------------------- + MediaEngine::PromiseWithRTPDecoderVideoPtr MediaEngine::innerCreateRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingForRTPDecodeVideo info; + info.promise_ = PromiseWithRTPDecoderVideo::create(IORTCForInternal::queueDelegate()); + info.parameters_ = make_shared(parameters); + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingForRTPDecodeVideos_.push_back(info); + pThis->step(); + }); + + return info.promise_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPEncoder + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPEncoderAudio + // + + //------------------------------------------------------------------------- + MediaEngine::PromiseWithRTPEncoderAudioPtr MediaEngine::innerCreateRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingForRTPEncodeAudio info; + info.promise_ = PromiseWithRTPEncoderAudio::create(IORTCForInternal::queueDelegate()); + info.parameters_ = make_shared(parameters); + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingForRTPEncodeAudios_.push_back(info); + pThis->step(); + }); + + return info.promise_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPEncoderVideo + // + + //------------------------------------------------------------------------- + MediaEngine::PromiseWithRTPEncoderVideoPtr MediaEngine::innerCreateRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + auto pThis = thisWeak_.lock(); + + PendingForRTPEncodeVideo info; + info.promise_ = PromiseWithRTPEncoderVideo::create(IORTCForInternal::queueDelegate()); + info.parameters_ = make_shared(parameters); + info.delegate_ = delegate; + + postClosure([pThis, info] { + AutoRecursiveLock lock(*pThis); + pThis->pendingForRTPEncodeVideos_.push_back(info); + pThis->step(); + }); + + return info.promise_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IMediaDevicesDelegate + // + + //------------------------------------------------------------------------- + void MediaEngine::onMediaDevicesChanged() + { + ZS_EVENTING_1(x, i, Trace, MediaEngineOnMediaDevicesChanged, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + refreshDevicesList_ = true; + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IWakeDelegate + // + + //------------------------------------------------------------------------- + void MediaEngine::onWake() + { + ZS_EVENTING_1(x, i, Trace, MediaEngineOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => ITimerDelegate + // + + //------------------------------------------------------------------------- + void MediaEngine::onTimer(ITimerPtr timer) + { + ZS_EVENTING_2(x, i, Trace, MediaEngineOnTimer, ol, MediaEngine, Event, puid, id, id_, puid, timerId, timer->getID()); + + AutoRecursiveLock lock(*this); + // NOTE: ADD IF NEEDED... + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void MediaEngine::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, MediaEngineOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + auto found = pendingPromises_.find(promise->getID()); + if (found != pendingPromises_.end()) { + pendingPromises_.erase(found); + + if (promise->isRejected()) { + setError(promise); + cancel(); + return; + } + } + + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => webrtc::SetupEventTracer + // + +#if defined(WINUWP) + //------------------------------------------------------------------------- + const unsigned char *MediaEngine::GetCategoryGroupEnabled(ZS_MAYBE_USED() const char *categoryGroup) + { + ZS_MAYBE_USED(categoryGroup); + return reinterpret_cast("webrtc"); + } + + //------------------------------------------------------------------------- + void __cdecl MediaEngine::AddTraceEvent( + char phase, + const unsigned char *categoryGroupEnabled, + const char *name, + uint64_t id, + int numArgs, + const char **argNames, + const unsigned char *argTypes, + const uint64_t *argValues, + unsigned char flags + ) + { + auto engine = MediaEngine::singleton(); + if (engine) { + engine->internalAddTraceEvent(phase, categoryGroupEnabled, name, id, + numArgs, argNames, argTypes, argValues, flags); + } + } +#endif //defined(WINUWP) + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine => (internal) + // + +#if defined(WINUWP) + //------------------------------------------------------------------------- + void MediaEngine::internalAddTraceEvent( + ZS_MAYBE_USED() char phase, + ZS_MAYBE_USED() const unsigned char *categoryGroupEnabled, + ZS_MAYBE_USED() const char *name, + ZS_MAYBE_USED() uint64_t id, + ZS_MAYBE_USED() int numArgs, + ZS_MAYBE_USED() const char **argNames, + ZS_MAYBE_USED() const unsigned char *argTypes, + ZS_MAYBE_USED() const uint64_t *argValues, + ZS_MAYBE_USED() unsigned char flags + ) noexcept + { + ZS_MAYBE_USED(phase); + ZS_MAYBE_USED(categoryGroupEnabled); + ZS_MAYBE_USED(name); + ZS_MAYBE_USED(id); + ZS_MAYBE_USED(numArgs); + ZS_MAYBE_USED(argNames); + ZS_MAYBE_USED(argTypes); + ZS_MAYBE_USED(argValues); + ZS_MAYBE_USED(flags); +#pragma ZS_BUILD_NOTE("TODO","traceLog_.Add needs new mapping") + //traceLog_.Add(phase, categoryGroupEnabled, name, id, numArgs, argNames, argTypes, argValues, flags); + } +#endif //defined(WINUWP) + + //------------------------------------------------------------------------- + void MediaEngine::cancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(State_ShuttingDown); + + if (devicesSubscription_) { + devicesSubscription_->cancel(); + devicesSubscription_.reset(); + } + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepPendingPromises()) return; + + if (!stepShutdownPendingRequests()) return; + if (!stepShutdownDevicesAndRTP()) return; + +#pragma ZS_BUILD_NOTE("TODO","implement media engine graceful shutdown") + // return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(State_Shutdown); + stepShutdownDevicesAndRTP(); + +#pragma ZS_BUILD_NOTE("TODO","implement media engine hard shutdown") + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepShutdownPendingRequests() noexcept + { + for (auto iter_doNotUse = pendingForMediaDeviceCaptures_.begin(); iter_doNotUse != pendingForMediaDeviceCaptures_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingForMediaDeviceCaptures_.erase(current); + } + + for (auto iter_doNotUse = pendingForMediaDeviceRenders_.begin(); iter_doNotUse != pendingForMediaDeviceRenders_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingForMediaDeviceRenders_.erase(current); + } + + for (auto iter_doNotUse = pendingForRTPDecodeAudios_.begin(); iter_doNotUse != pendingForRTPDecodeAudios_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingForRTPDecodeAudios_.erase(current); + } + + for (auto iter_doNotUse = pendingForRTPDecodeVideos_.begin(); iter_doNotUse != pendingForRTPDecodeVideos_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingForRTPDecodeVideos_.erase(current); + } + + for (auto iter_doNotUse = pendingForRTPEncodeAudios_.begin(); iter_doNotUse != pendingForRTPEncodeAudios_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingForRTPEncodeAudios_.erase(current); + } + + for (auto iter_doNotUse = pendingForRTPEncodeVideos_.begin(); iter_doNotUse != pendingForRTPEncodeVideos_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto pending = (*current).promise_; + + pending->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + pendingForRTPEncodeVideos_.erase(current); + } + + if (pendingForMediaDeviceCaptures_.size() > 0) return false; + if (pendingForMediaDeviceRenders_.size() > 0) return false; + if (pendingForRTPDecodeAudios_.size() > 0) return false; + if (pendingForRTPDecodeVideos_.size() > 0) return false; + if (pendingForRTPEncodeAudios_.size() > 0) return false; + if (pendingForRTPEncodeVideos_.size() > 0) return false; + + return true; + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepShutdownDevicesAndRTP() noexcept + { + for (auto iter_doNotUse = captureDevices_.begin(); iter_doNotUse != captureDevices_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto device = (*current).second; + + device->shutdown(); + if (!device->isShutdown()) continue; + + captureDevices_.erase(current); + } + + for (auto iter_doNotUse = renderDevices_.begin(); iter_doNotUse != renderDevices_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto device = (*current).second; + + device->shutdown(); + if (!device->isShutdown()) continue; + + renderDevices_.erase(current); + } + + for (auto iter_doNotUse = rtpEncoders_.begin(); iter_doNotUse != rtpEncoders_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto encoder = (*current).second; + + encoder->shutdown(); + if (!encoder->isShutdown()) continue; + + rtpEncoders_.erase(current); + } + + for (auto iter_doNotUse = rtpDecoders_.begin(); iter_doNotUse != rtpDecoders_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto decoder = (*current).second; + + decoder->shutdown(); + if (!decoder->isShutdown()) continue; + + rtpDecoders_.erase(current); + } + + if (captureDevices_.size() > 0) return false; + if (renderDevices_.size() > 0) return false; + + if (rtpEncoders_.size() > 0) return false; + if (rtpDecoders_.size() > 0) return false; + + return true; + } + + //------------------------------------------------------------------------- + void MediaEngine::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, MediaEngineStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, MediaEngineStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepPendingPromises()) return; + if (!stepRefreshDeviceList()) goto not_ready; + + if ((isPending()) || + (isReady()) || + (isSleeping())) { + stepFixState(); + } + + if (isGoingToSleep()) { + if (!stepGoingToSleep1()) goto not_ready; + } + + if (isSleeping()) { + goto sleeping; + } + + if (isWakingUp()) { + if (!stepWakeUp1()) goto not_ready; + } + + if (!stepReady1()) return; + + if (!stepShutdownDevices()) return; + if (!stepShutdownRTP()) return; + if (!stepStartPendingDevices()) return; + if (!stepStartPendingRTP()) return; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + sleeping: + { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "sleeping"); + setState(State_Sleeping); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(State_Ready); + return; + } + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepPendingPromises() noexcept + { + if (pendingPromises_.size() > 0) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "promises are still pending"); + return false; + } + + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no promises are pending"); + return true; + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepRefreshDeviceList() noexcept + { + if (!devicesSubscription_) { + devicesSubscription_ = UseMediaDevices::subscribe(thisWeak_.lock()); + } + + if ((!refreshDevicesList_) && + (!devicesListPromise_)) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "refresh device list skipped (no change notified)"); + return true; + } + + if (devicesListPromise_) { + if (!devicesListPromise_->isSettled()) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "refresh device list still pending"); + return true; + } + + if (devicesListPromise_->isRejected()) { + devicesListPromise_.reset(); + ZS_EVENTING_2(x, w, Debug, MediaEngineStepWarningMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "refresh device list failed"); + return true; + } + + auto deviceList = devicesListPromise_->value(); + mediaDevices_ = deviceList; + } + + if (!refreshDevicesList_) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "refresh device list completed"); + return true; + } + + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "refresh device list"); + + refreshDevicesList_ = false; + + devicesListPromise_ = UseMediaDevices::enumerateDevices(); + if (!devicesListPromise_) { + ZS_EVENTING_2(x, w, Debug, MediaEngineStepWarningMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "failed to enumerate devices"); + return true; + } + + devicesListPromise_->thenWeak(thisWeak_.lock()); + return true; + } + + //------------------------------------------------------------------------- + void MediaEngine::stepFixState() noexcept + { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "fix state"); + + { + if (pendingForMediaDeviceCaptures_.size() > 0) goto need_media; + if (pendingForMediaDeviceRenders_.size() > 0) goto need_media; + if (pendingForRTPDecodeAudios_.size() > 0) goto need_media; + if (pendingForRTPDecodeVideos_.size() > 0) goto need_media; + if (pendingForRTPEncodeAudios_.size() > 0) goto need_media; + if (pendingForRTPEncodeVideos_.size() > 0) goto need_media; + + if (captureDevices_.size() > 0) goto need_media; + if (renderDevices_.size() > 0) goto need_media; + + if (rtpEncoders_.size() > 0) goto need_media; + if (rtpDecoders_.size() > 0) goto need_media; + + goto sleep_now; + } + + need_media: + { + setState(State_WakingUp); + return; + } + + sleep_now: + { + setState(State_GoingToSleep); + return; + } + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepWakeUp1() noexcept + { + if (completedWakeUp1_) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "wake up 1 already completed"); + return true; + } + + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "wake up 1"); + + performAsync(std::bind(&MediaEngine::onStepWakeUp1, this, std::placeholders::_1)); + return false; + } + + //------------------------------------------------------------------------- + void MediaEngine::onStepWakeUp1(PromisePtr promise) + { + // NOT in a lock + + completedWakeUp1_ = true; + promise->resolve(); + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepGoingToSleep1() noexcept + { + if (completedGoingToSleep1_) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "going to sleep 1 already completed"); + return false; + } + + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "going to sleep 1"); + + performAsync(std::bind(&MediaEngine::onStepGoingToSleep1, this, std::placeholders::_1)); + return true; + } + + //------------------------------------------------------------------------- + void MediaEngine::onStepGoingToSleep1(PromisePtr promise) + { + // NOT in a lock + completedGoingToSleep1_ = true; + promise->resolve(); + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepShutdownDevices() noexcept + { + if (!((checkForIdleDevices_) || (shuttingDownIdleDevices_))) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no devices have reported being idle and no devices are in the middle of shutting down"); + return true; + } + + checkForIdleDevices_ = false; + shuttingDownIdleDevices_ = false; + + for (auto iter_doNotUse = captureDevices_.begin(); iter_doNotUse != captureDevices_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto &deviceID = (*current).first; + auto &device = (*current).second; + if (device->isShutdown()) { + ZS_EVENTING_3(x, i, Debug, MediaEngineStepShutdownDevice, ol, MediaEngine, Step, puid, id, id_, string, deviceId, deviceID, string, message, "capture device is reported shutdown"); + captureDevices_.erase(current); + continue; + } + + if (device->isDeviceIdle()) { + ZS_EVENTING_3(x, i, Debug, MediaEngineStepShutdownDevice, ol, MediaEngine, Step, puid, id, id_, string, deviceId, deviceID, string, message, "capture device is idle (requesting shutdown)"); + device->shutdown(); + shuttingDownIdleDevices_ = true; + } + } + + for (auto iter_doNotUse = renderDevices_.begin(); iter_doNotUse != renderDevices_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto &deviceID = (*current).first; + auto &device = (*current).second; + if (device->isShutdown()) { + ZS_EVENTING_3(x, i, Debug, MediaEngineStepShutdownDevice, ol, MediaEngine, Step, puid, id, id_, string, deviceId, deviceID, string, message, "render device is reported shutdown"); + renderDevices_.erase(current); + continue; + } + + if (device->isDeviceIdle()) { + ZS_EVENTING_3(x, i, Debug, MediaEngineStepShutdownDevice, ol, MediaEngine, Step, puid, id, id_, string, deviceId, deviceID, string, message, "render device is idle (requesting shutdown)"); + device->shutdown(); + shuttingDownIdleDevices_ = true; + } + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepShutdownRTP() noexcept + { + if (!checkForShutdownRTP_) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no rtp notified being shutting down"); + return true; + } + + checkForShutdownRTP_ = false; + + for (auto iter_doNotUse = rtpDecoders_.begin(); iter_doNotUse != rtpDecoders_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto decoder = (*current).second; + + if (!decoder->isShutdown()) continue; + rtpDecoders_.erase(current); + } + + for (auto iter_doNotUse = rtpEncoders_.begin(); iter_doNotUse != rtpEncoders_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto encoder = (*current).second; + + if (!encoder->isShutdown()) continue; + rtpEncoders_.erase(current); + } + + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "rtp shutting down"); + return true; + } + + //------------------------------------------------------------------------- + static void getExactDeviceIDs( + const MediaEngine::TrackConstraints &constraints, + MediaEngine::StringList &outValues + ) noexcept + { + constraints.mDeviceID.exact(outValues); + for (auto iter = constraints.mAdvanced.begin(); iter != constraints.mAdvanced.end(); ++iter) { + (*iter)->mDeviceID.exact(outValues); + } + } + + //------------------------------------------------------------------------- + static void getIdealDeviceIDs( + const MediaEngine::TrackConstraints &constraints, + MediaEngine::StringList &outValues + ) noexcept + { + constraints.mDeviceID.ideal(outValues); + for (auto iter = constraints.mAdvanced.begin(); iter != constraints.mAdvanced.end(); ++iter) { + (*iter)->mDeviceID.ideal(outValues); + } + } + + //------------------------------------------------------------------------- + static void getExactGroupIDs( + const MediaEngine::TrackConstraints &constraints, + MediaEngine::StringList &outValues + ) noexcept + { + constraints.mGroupID.exact(outValues); + for (auto iter = constraints.mAdvanced.begin(); iter != constraints.mAdvanced.end(); ++iter) { + (*iter)->mGroupID.exact(outValues); + } + } + + //------------------------------------------------------------------------- + static void getIdealGroupIDs( + const MediaEngine::TrackConstraints &constraints, + MediaEngine::StringList &outValues + ) noexcept + { + constraints.mGroupID.ideal(outValues); + for (auto iter = constraints.mAdvanced.begin(); iter != constraints.mAdvanced.end(); ++iter) { + (*iter)->mGroupID.ideal(outValues); + } + } + + //------------------------------------------------------------------------- + static bool doesListContain(const MediaEngine::StringList &values, const String &value) noexcept + { + for (auto iter = values.begin(); iter != values.end(); ++iter) { + if (value == (*iter)) return true; + } + return false; + } + + //------------------------------------------------------------------------- + static bool findDevice( + bool capture, + MediaEngine::Kinds kind, + const MediaEngine::DeviceList &devices, + const MediaEngine::TrackConstraints &constraints, + String &outUseDeviceID, + String &outUseGroupID + ) noexcept + { + MediaEngine::StringList exactDeviceIDs; + MediaEngine::StringList idealDeviceIDs; + + MediaEngine::StringList exactGroupIDs; + MediaEngine::StringList idealGroupIDs; + + getExactDeviceIDs(constraints, exactDeviceIDs); + getIdealDeviceIDs(constraints, idealDeviceIDs); + + getExactGroupIDs(constraints, exactGroupIDs); + getIdealGroupIDs(constraints, idealGroupIDs); + + for (auto iterDeviceList = devices.begin(); iterDeviceList != devices.end(); ++iterDeviceList) { + auto &device = (*iterDeviceList); + + if (capture) { + switch (kind) { + case IMediaStreamTrackTypes::Kind_Audio: if (IMediaDevicesTypes::DeviceKind_AudioInput != device.mKind) continue; + case IMediaStreamTrackTypes::Kind_Video: if (IMediaDevicesTypes::DeviceKind_VideoInput != device.mKind) continue; + } + } + if (exactDeviceIDs.size() > 0) { + if (!doesListContain(exactDeviceIDs, device.mDeviceID)) continue; + if (exactGroupIDs.size() > 0) { + if (!doesListContain(exactGroupIDs, device.mGroupID)) continue; + } + outUseDeviceID = device.mDeviceID; + outUseGroupID = device.mGroupID; + return true; + } + + if (exactGroupIDs.size() > 0) { + if (!doesListContain(exactGroupIDs, device.mGroupID)) continue; + outUseDeviceID = device.mDeviceID; + outUseGroupID = device.mGroupID; + return true; + } + + if (outUseDeviceID.hasData()) continue; + + if (idealDeviceIDs.size() > 0) { + if (!doesListContain(idealDeviceIDs, device.mDeviceID)) continue; + if (idealGroupIDs.size() > 0) { + if (!doesListContain(idealGroupIDs, device.mGroupID)) continue; + } + outUseDeviceID = device.mDeviceID; + outUseGroupID = device.mGroupID; + continue; + } + + if (idealGroupIDs.size() > 0) { + if (!doesListContain(idealGroupIDs, device.mGroupID)) continue; + outUseDeviceID = device.mDeviceID; + outUseGroupID = device.mGroupID; + continue; + } + + outUseDeviceID = device.mDeviceID; + outUseGroupID = device.mGroupID; + } + return outUseDeviceID.hasData(); + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepStartPendingDevices() noexcept + { + if ((checkForIdleDevices_) || (shuttingDownIdleDevices_) || (devicesListPromise_)) { + ZS_EVENTING_2(x, i, Trace, MediaEngineStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "start pending devices step skipped (cannot start devices while device list is being obtained or when shutting down existing devices)"); + return true; + } + + for (auto iter_doNotUse = pendingForMediaDeviceCaptures_.begin(); iter_doNotUse != pendingForMediaDeviceCaptures_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto &info = (*current); + + if (!mediaDevices_) { + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_NoContent, "no media devices were found connected")); + pendingForMediaDeviceCaptures_.erase(current); + continue; + } + + String useDeviceID; + String useGroupID; + + if (!findDevice(true, info.kind_, *mediaDevices_, *info.constraints_, useDeviceID, useGroupID)) { + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_NotFound, "media capture device was not found")); + pendingForMediaDeviceCaptures_.erase(current); + continue; + } + + UseMediaDeviceCapturePtr useDevice; + + auto found = captureDevices_.find(useDeviceID); + if (found == captureDevices_.end()) { + switch (info.kind_) { + case IMediaStreamTrackTypes::Kind_Audio: useDevice = UseMediaDeviceCaptureAudio::create(thisWeak_.lock(), useDeviceID); break; + case IMediaStreamTrackTypes::Kind_Video: useDevice = UseMediaDeviceCaptureVideo::create(thisWeak_.lock(), useDeviceID); break; + } + captureDevices_[useDeviceID] = useDevice; + } else { + useDevice = (*found).second; + } + + useDevice->mediaDeviceCaptureSubscribe(info.promise_, info.repaceExistingDeviceObjectID_, info.constraints_, info.delegate_); + pendingForMediaDeviceCaptures_.erase(current); + } + + for (auto iter_doNotUse = pendingForMediaDeviceRenders_.begin(); iter_doNotUse != pendingForMediaDeviceRenders_.end(); ) + { + auto current = iter_doNotUse; + ++iter_doNotUse; + + auto &info = (*current); + + if (!mediaDevices_) { + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_NoContent, "no media devices were found connected")); + pendingForMediaDeviceRenders_.erase(current); + continue; + } + + String useDeviceID; + String useGroupID; + + if (!findDevice(false, IMediaStreamTrackTypes::Kind_Audio, *mediaDevices_, *info.constraints_, useDeviceID, useGroupID)) { + info.promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_NotFound, "media render device was not found")); + pendingForMediaDeviceRenders_.erase(current); + continue; + } + + UseMediaDeviceRenderPtr useDevice; + + auto found = renderDevices_.find(useDeviceID); + if (found == renderDevices_.end()) { + useDevice = UseMediaDeviceRenderAudio::create(thisWeak_.lock(), useDeviceID); + renderDevices_[useDeviceID] = useDevice; + } else { + useDevice = (*found).second; + } + + useDevice->mediaDeviceRenderSubscribe(info.promise_, info.repaceExistingDeviceObjectID_, info.constraints_, info.delegate_); + pendingForMediaDeviceRenders_.erase(current); + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepReady1() noexcept + { + //............................... + + bool shouldDoThis = false; + if (shouldDoThis) { + performAsync(std::bind(&MediaEngine::onReady1, this, std::placeholders::_1)); + } + + //............................... + + bool shouldDoThisOtherThing = false; + if (shouldDoThisOtherThing) { + auto pThis = thisWeak_.lock(); + performAsyncClosure([pThis] { /* pThis->doSomethingThatCantFail(); */ }); + } + + //............................... + + bool shouldDoSomethingElseToo = false; + if (shouldDoSomethingElseToo) { + + struct SomeResult : public Any + { + int someResult_ {}; + }; + + auto pThis = thisWeak_.lock(); + auto promise = Promise::create(getAssociatedMessageQueue()); + + /* perform some step that should not be in a lock */ + performAsyncClosure(promise, [pThis, promise] { + /* not in a lock */ + + bool didFail = false; + if (didFail) + { + promise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Conflict, "I didn't like this value")); + } + + auto result = make_shared(); + result->someResult_ = -1; + promise->resolve(result); + }); + + /* complete the step here */ + promise->thenClosure([promise, pThis] { + /* because this is locked no other step will be performed at this time */ + AutoRecursiveLock lock(*pThis); + + if (pThis->isShuttingDown() || pThis->isShutdown()) { + ZS_EVENTING_2(x, w, Debug, MediaEngineStepWarningMessage, ol, MediaEngine, Step, puid, id, pThis->id_, string, message, "will not perform this additional step if shutting down"); + return; + } + + /* ... continue here ... */ + + if (promise->isRejected()) { + pThis->setError(promise); + pThis->cancel(); + return; + } + + auto result = promise->value(); + if (!result) { + } + }); + + } + + return true; + } + + //------------------------------------------------------------------------- + bool MediaEngine::stepStartPendingRTP() noexcept + { + { + for (auto iter = pendingForRTPDecodeAudios_.begin(); iter != pendingForRTPDecodeAudios_.end(); ++iter) + { + auto &info = (*iter); + + auto result = UseRTPDecoderAudio::create(info.promise_, thisWeak_.lock(), info.parameters_, info.delegate_); + rtpDecoders_[result->getID()] = result; + } + pendingForRTPDecodeAudios_.clear(); + } + { + for (auto iter = pendingForRTPDecodeVideos_.begin(); iter != pendingForRTPDecodeVideos_.end(); ++iter) + { + auto &info = (*iter); + + auto result = UseRTPDecoderVideo::create(info.promise_, thisWeak_.lock(), info.parameters_, info.delegate_); + rtpDecoders_[result->getID()] = result; + } + pendingForRTPDecodeVideos_.clear(); + } + { + for (auto iter = pendingForRTPEncodeAudios_.begin(); iter != pendingForRTPEncodeAudios_.end(); ++iter) + { + auto &info = (*iter); + + auto result = UseRTPEncoderAudio::create(info.promise_, thisWeak_.lock(), info.parameters_, info.delegate_); + rtpEncoders_[result->getID()] = result; + } + pendingForRTPEncodeAudios_.clear(); + } + { + for (auto iter = pendingForRTPEncodeVideos_.begin(); iter != pendingForRTPEncodeVideos_.end(); ++iter) + { + auto &info = (*iter); + + auto result = UseRTPEncoderVideo::create(info.promise_, thisWeak_.lock(), info.parameters_, info.delegate_); + rtpEncoders_[result->getID()] = result; + } + pendingForRTPEncodeVideos_.clear(); + } + return true; + } + + //------------------------------------------------------------------------- + void MediaEngine::onReady1(PromisePtr promise) noexcept + { + // NOT in a lock + promise->resolve(); + } + + //------------------------------------------------------------------------- + void MediaEngine::performAsync(std::function func) noexcept + { + auto pThis = thisWeak_.lock(); + + auto promise = Promise::create(getAssociatedMessageQueue()); + promise->thenWeak(pThis); + + pendingPromises_[promise->getID()] = promise; + postClosure([func, promise] { func(promise); }); + } + + //------------------------------------------------------------------------- + void MediaEngine::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, MediaEngineSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, toString(state), string, oldState, toString(currentState_)); + + currentState_ = state; + + // reset wakup states + completedWakeUp1_ = false; + + // reset going to sleep states + completedGoingToSleep1_ = false; + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void MediaEngine::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void MediaEngine::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, MediaEngineSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, MediaEngineSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine::WebRtcTraceCallback + // + + //------------------------------------------------------------------------- + /*void MediaEngine::WebRtcTraceCallback::Print(webrtc::TraceLevel trace, const char* message, int length) + { + static const size_t stripLength = 34; + + Log::Severity severity {Log::Severity::Informational}; + Log::Level level {Log::Level::Basic}; + + switch (trace) + { + case webrtc::kTraceNone: level = Log::Level::None; break; + case webrtc::kTraceStateInfo: level = Log::Level::Debug; break; + case webrtc::kTraceCritical: severity = Log::Severity::Fatal; level = Log::Level::Basic; break; + case webrtc::kTraceError: severity = Log::Severity::Error; level = Log::Level::Basic; break; + case webrtc::kTraceWarning: severity = Log::Severity::Warning; level = Log::Level::Detail; break; + case webrtc::kTraceApiCall: level = Log::Level::Debug; break; + case webrtc::kTraceDefault: level = Log::Level::Debug; break; + case webrtc::kTraceModuleCall: level = Log::Level::Trace; break; + case webrtc::kTraceMemory: level = Log::Level::Trace; break; + case webrtc::kTraceTimer: level = Log::Level::Trace; break; + case webrtc::kTraceStream: level = Log::Level::Insane; break; + case webrtc::kTraceDebug: level = Log::Level::Insane; break; + case webrtc::kTraceInfo: level = Log::Level::Insane; break; + case webrtc::kTraceTerseInfo: level = Log::Level::Insane; break; + case webrtc::kTraceAll: level = Log::Level::Insane; break; + } + + // Skip past boilerplate prefix text + if (length < stripLength) { + std::string msg(message, length); + webrtcTrace(Log::Severity::Error, Log::Level::Basic, (std::string("Malformed webrtc log message: ") + msg).c_str()); + } else { + std::string msg(message + (stripLength-1), length - stripLength); + webrtcTrace(severity, level, msg.c_str()); + } + }*/ + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine::WebRtcTraceCallback + // + + //------------------------------------------------------------------------- + void MediaEngine::WebRtcLogSink::OnLogMessage(const std::string& message) + { + if (message.length() < 1) return; + + bool hasEOL = ('\n' == message[message.length() - 1]); + + std::string msg(message.c_str(), message.length() - (hasEOL ? 1 : 0)); + + webrtcTrace(Log::Severity::Informational, Log::Level::Basic, msg.c_str()); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineFactory + // + + //------------------------------------------------------------------------- + IMediaEngineFactory &IMediaEngineFactory::singleton() noexcept + { + return MediaEngineFactory::singleton(); + } + + //------------------------------------------------------------------------- + MediaEnginePtr IMediaEngineFactory::create() noexcept + { + if (this) {} + return internal::MediaEngine::create(); + } + + //------------------------------------------------------------------------- + void IMediaEngineFactory::setLogLevel(Log::Level level) noexcept + { + if (this) {} + internal::MediaEngine::setLogLevel(level); + } + + //------------------------------------------------------------------------- + void IMediaEngineFactory::ntpServerTime(const Milliseconds &value) noexcept + { + if (this) {} + internal::MediaEngine::ntpServerTime(value); + } + + //------------------------------------------------------------------------- + void IMediaEngineFactory::startMediaTracing() noexcept + { + if (this) {} + return internal::MediaEngine::startMediaTracing(); + } + + //------------------------------------------------------------------------- + void IMediaEngineFactory::stopMediaTracing() noexcept + { + if (this) {} + internal::MediaEngine::stopMediaTracing(); + } + + //------------------------------------------------------------------------- + bool IMediaEngineFactory::isMediaTracing() noexcept + { + if (this) {} + return internal::MediaEngine::isMediaTracing(); + } + + //------------------------------------------------------------------------- + bool IMediaEngineFactory::saveMediaTrace(String filename) noexcept + { + if (this) {} + return internal::MediaEngine::saveMediaTrace(filename); + } + + //------------------------------------------------------------------------- + bool IMediaEngineFactory::saveMediaTrace(String host, int port) noexcept + { + if (this) {} + return internal::MediaEngine::saveMediaTrace(host, port); + } + + //------------------------------------------------------------------------- + IMediaEngineFactory::MediaDeviceCapturePromisePtr IMediaEngineFactory::createMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::MediaEngine::createMediaDeviceCapture(repaceExistingDeviceObjectID, kind, constraints, delegate); + } + + //------------------------------------------------------------------------- + IMediaEngineFactory::MediaDeviceRenderPromisePtr IMediaEngineFactory::createMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::MediaEngine::createMediaDeviceRender(repaceExistingDeviceObjectID, constraints, delegate); + } + + //------------------------------------------------------------------------- + IMediaEngineFactory::PromiseWithRTPDecoderAudioPtr IMediaEngineFactory::createRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::MediaEngine::createRTPDecoderAudio(parameters, delegate); + } + + //------------------------------------------------------------------------- + IMediaEngineFactory::PromiseWithRTPDecoderVideoPtr IMediaEngineFactory::createRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::MediaEngine::createRTPDecoderVideo(parameters, delegate); + } + + //------------------------------------------------------------------------- + IMediaEngineFactory::PromiseWithRTPEncoderAudioPtr IMediaEngineFactory::createRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::MediaEngine::createRTPEncoderAudio(parameters, delegate); + } + + //------------------------------------------------------------------------- + IMediaEngineFactory::PromiseWithRTPEncoderVideoPtr IMediaEngineFactory::createRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::MediaEngine::createRTPEncoderVideo(parameters, delegate); + } + + + } // internal namespace +} diff --git a/ortc/cpp/ortc_MediaStreamTrack.cpp b/ortc/cpp/ortc_MediaStreamTrack.cpp index 96329246..ef9b16be 100644 --- a/ortc/cpp/ortc_MediaStreamTrack.cpp +++ b/ortc/cpp/ortc_MediaStreamTrack.cpp @@ -1,6 +1,6 @@ /* - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + Copyright (c) 2017, Hookflash Inc. / Optical Tone Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,20 +29,17 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include @@ -62,14 +59,9 @@ #include #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_mediastreamtrack) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_stream_track) } namespace ortc { @@ -92,37 +84,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackSettingsDefaults - #pragma mark + // + // MediaStreamTrackSettingsDefaults + // class MediaStreamTrackSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~MediaStreamTrackSettingsDefaults() + ~MediaStreamTrackSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static MediaStreamTrackSettingsDefaultsPtr singleton() + static MediaStreamTrackSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static MediaStreamTrackSettingsDefaultsPtr create() + static MediaStreamTrackSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -130,7 +122,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { // ISettings::setUInt(ORTC_SETTING_MEDIA_STREAM_TRACK_, 0); } @@ -138,184 +130,234 @@ namespace ortc }; //------------------------------------------------------------------------- - void installMediaStreamTrackSettingsDefaults() + void installMediaStreamTrackSettingsDefaults() noexcept { MediaStreamTrackSettingsDefaults::singleton(); } - - + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPReceiver - #pragma mark + // + // IMediaStreamTrack + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStreamTrackChannel + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPReceiver + // //------------------------------------------------------------------------- - MediaStreamTrackPtr IMediaStreamTrackForRTPReceiver::create(Kinds kind) + IMediaStreamTrackForRTPReceiver::ForReceiverPtr IMediaStreamTrackForRTPReceiver::createForReceiver(IMediaStreamTrackTypes::Kinds kind) noexcept { - return internal::IMediaStreamTrackFactory::singleton().create(kind); + return IMediaStreamTrackFactory::singleton().createForReceiver(kind); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack - #pragma mark + // + // IMediaStreamTrackForRTPReceiverChannel + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPSender + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPSenderChannel + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStream + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaStreamTrack + // + + + //------------------------------------------------------------------------- + const char *MediaStreamTrack::toString(MediaStreamTrackTypes type) noexcept + { + switch (type) { + case MediaStreamTrackType_Capture: return "capture"; + case MediaStreamTrackType_Receiver: return "receiver"; + case MediaStreamTrackType_Selector: return "selector"; + } + return "UNDEFINED"; + } + + //------------------------------------------------------------------------- + MediaStreamTrack::MediaStreamTrackTypes MediaStreamTrack::toMediaStreamTrackType(const char *inputStr) noexcept(false) + { + String str(inputStr); + for (MediaStreamTrack::MediaStreamTrackTypes index = MediaStreamTrack::MediaStreamTrackType_First; index <= MediaStreamTrack::MediaStreamTrackType_Last; index = static_cast(static_cast::type>(index) + 1)) { + if (0 == str.compareNoCase(MediaStreamTrack::toString(index))) return index; + } + ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str) + return MediaStreamTrack::MediaStreamTrackType_First; + } //------------------------------------------------------------------------- MediaStreamTrack::MediaStreamTrack( const make_private &, - IMessageQueuePtr queue, - Kinds kind, - bool remote, - TrackConstraintsPtr constraints - ) : - MessageQueueAssociator(queue), + const MediaStreamTrackArguments &args + ) noexcept : + MessageQueueAssociator(args.queue_), SharedRecursiveLock(SharedRecursiveLock::create()), - mTrackID(String(IMediaStreamTrackTypes::toString(kind)) + "_label_" + string(zsLib::createUUID())), - mKind(kind), - mRemote(remote), - mConstraints(constraints) + subscriptions_(decltype(subscriptions_)::create()), + trackId_(String(IMediaStreamTrackTypes::toString(args.kind_)) + "_label_" + string(zsLib::createUUID())), + kind_(args.kind_), + type_(args.type_), + constraints_(args.constraints_) { - ZS_LOG_DETAIL(debug("created")) + ZS_EVENTING_4(x, i, Detail, MediaStreamTrackCreate, ol, MediaEngine, Start, + puid, id, id_, + string, traceId, trackId_, + string, kind, IMediaStreamTrackTypes::toString(kind_), + string, type, MediaStreamTrack::toString(type_) + ); } //------------------------------------------------------------------------- - void MediaStreamTrack::init() + void MediaStreamTrack::init() noexcept { AutoRecursiveLock lock(*this); - mStatsTimer = ITimer::create(mThisWeak.lock(), Seconds(1)); - - mCapabilities = make_shared(); - mSettings = make_shared(); + statsTimer_ = ITimer::create(thisWeak_.lock(), Seconds(1)); + capabilities_ = make_shared(); + settings_ = make_shared(); - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); } //------------------------------------------------------------------------- - MediaStreamTrack::~MediaStreamTrack() + MediaStreamTrack::~MediaStreamTrack() noexcept { if (isNoop()) return; - ZS_LOG_DETAIL(log("destroyed")) - mThisWeak.reset(); + ZS_EVENTING_1(x, i, Detail, MediaStreamTrackDestroy, ol, MediaEngine, Stop, puid, id, id_); - cancel(); - } + thisWeak_.reset(); - //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::create( - Kinds kind, - bool remote, - TrackConstraintsPtr constraints - ) - { - MediaStreamTrackPtr pThis(make_shared(make_private{}, IORTCForInternal::queueORTC(), kind, remote, constraints)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; + cancel(); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(IMediaStreamTrackPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ortc::IMediaStreamTrackPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } - //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderPtr object) - { - return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); - } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderChannelPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(internal::IMediaStreamTrackPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderChannelMediaBasePtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaStreamPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderChannelAudioPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaStreamTrackChannelPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderChannelVideoPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaStreamTrackSubscriberPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaStreamTrackSubscriberMediaPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverChannelPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaStreamTrackSubscriberRTPPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverChannelMediaBasePtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaDevicesPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverChannelAudioPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverChannelVideoPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForReceiverChannelPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaDevicesPtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaEnginePtr object) + MediaStreamTrackPtr MediaStreamTrack::convert(ForSenderChannelPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); } - //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::convert(ForMediaStreamPtr object) - { - return ZS_DYNAMIC_PTR_CAST(MediaStreamTrack, object); - } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrack - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrack + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr MediaStreamTrack::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr MediaStreamTrack::getStats(const StatsTypeSet &stats) const noexcept { if (!stats.hasStatType(IStatsReportTypes::StatsType_Track)) { return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); @@ -324,12 +366,13 @@ namespace ortc if ((isShutdown()) || (isShuttingDown())) { - ZS_LOG_WARNING(Debug, log("can not fetch stats while shutdown / shutting down")); + ZS_EVENTING_2(x, w, Debug, MediaStreamTrackWarning, ol, RtpPacket, Info, puid, id, id_, string, message, "can not fetch stats while shutdown / shutting down"); + return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } PromiseWithStatsReportPtr promise = PromiseWithStatsReport::create(IORTCForInternal::queueDelegate()); - IMediaStreamTrackAsyncDelegateProxy::create(mThisWeak.lock())->onResolveStatsPromise(promise, stats); + IMediaStreamTrackAsyncDelegateProxy::create(thisWeak_.lock())->onResolveStatsPromise(promise, stats); return promise; } @@ -337,387 +380,377 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrack - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrack + // //------------------------------------------------------------------------- - ElementPtr MediaStreamTrack::toDebug(MediaStreamTrackPtr object) - { - if (!object) return ElementPtr(); - return object->toDebug(); - } - - //------------------------------------------------------------------------- - IMediaStreamTrackSubscriptionPtr MediaStreamTrack::subscribe(IMediaStreamTrackDelegatePtr originalDelegate) - { - ZS_LOG_DETAIL(slog("subscribing to media stream track")) + void MediaStreamTrack::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_17(x, i, Basic, MediaStreamTrackTrace, ol, MediaEngine, Info, + puid, id, id_, + string, func, func, + string, message, message, + bool, gracefulShutdownReference, (bool)gracefulShutdownReference_, + string, currentState, ortc::IMediaStreamTrackTypes::toString(currentState_), + word, lastError, lastError_, + string, lastErrorReason, lastErrorReason_, + string, trackId, trackId_, + string, label, label_, + string, kind, ortc::IMediaStreamTrackTypes::toString(kind_), + bool, enabled, enabled_, + bool, muted, muted_, + string, type, MediaStreamTrack::toString(type_), + string, deviceId, deviceId_, + size_t, subscribers, subscribers_ ? subscribers_->size() : 0, + size_t, channels, channels_ ? channels_->size() : 0, + puid, statsTimer, statsTimer_ ? statsTimer_->getID() : 0 + ); + } + + //------------------------------------------------------------------------- + IMediaStreamTrackSubscriptionPtr MediaStreamTrack::subscribe(IMediaStreamTrackDelegatePtr originalDelegate) noexcept + { + ZS_EVENTING_1(x, i, Detail, MediaStreamTrackSubscribe, ol, MediaEngine, Info, puid, id, id_); AutoRecursiveLock lock(*this); if (!originalDelegate) return IMediaStreamTrackSubscriptionPtr(); - IMediaStreamTrackSubscriptionPtr subscription = mSubscriptions.subscribe(originalDelegate, IORTCForInternal::queueDelegate()); + IMediaStreamTrackSubscriptionPtr subscription = subscriptions_.subscribe(originalDelegate, IORTCForInternal::queueDelegate()); - IMediaStreamTrackDelegatePtr delegate = mSubscriptions.delegate(subscription, true); + IMediaStreamTrackDelegatePtr delegate = subscriptions_.delegate(subscription, true); if (delegate) { - auto pThis = mThisWeak.lock(); + auto pThis = thisWeak_.lock(); -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 1 -#define TODO_DO_WE_NEED_TO_TELL_ABOUT_ANY_MISSED_EVENTS 2 +#pragma ZS_BUILD_NOTE("TODO","media stream track notify about missed events") if (isShutdown()) { delegate->onMediaStreamTrackEnded(pThis); } } if (isShutdown()) { - mSubscriptions.clear(); + subscriptions_.clear(); } return subscription; } //------------------------------------------------------------------------- - IMediaStreamTrackTypes::Kinds MediaStreamTrack::kind() const + IMediaStreamTrackTypes::Kinds MediaStreamTrack::kind() const noexcept { - return mKind; + return kind_; } //------------------------------------------------------------------------- - String MediaStreamTrack::id() const + String MediaStreamTrack::id() const noexcept { - return mTrackID; + return trackId_; } //------------------------------------------------------------------------- - String MediaStreamTrack::deviceID() const + String MediaStreamTrack::deviceID() const noexcept { AutoRecursiveLock lock(*this); - return mDeviceID; + return deviceId_; } + //------------------------------------------------------------------------- - String MediaStreamTrack::label() const + String MediaStreamTrack::label() const noexcept { -#define TODO 1 -#define TODO 2 - return String(); + return label_; } //------------------------------------------------------------------------- - bool MediaStreamTrack::enabled() const + bool MediaStreamTrack::enabled() const noexcept { -#define TODO 1 -#define TODO 2 - return false; + AutoRecursiveLock lock(*this); + return enabled_; } //------------------------------------------------------------------------- - void MediaStreamTrack::enabled(bool enabled) + void MediaStreamTrack::enabled(bool enabled) noexcept { -#define TODO 1 -#define TODO 2 + AutoRecursiveLock lock(*this); + enabled_ = enabled; } //------------------------------------------------------------------------- - bool MediaStreamTrack::muted() const + bool MediaStreamTrack::muted() const noexcept { -#define TODO 1 -#define TODO 2 - return false; + AutoRecursiveLock lock(*this); + return muted_; } //------------------------------------------------------------------------- - void MediaStreamTrack::muted(bool muted) + void MediaStreamTrack::muted(bool muted) noexcept { -#define TODO 1 -#define TODO 2 + AutoRecursiveLock lock(*this); + muted_ = muted; } //------------------------------------------------------------------------- - bool MediaStreamTrack::remote() const + bool MediaStreamTrack::remote() const noexcept { - return mRemote; // no lock needed + return type_ == MediaStreamTrackType_Receiver; } //------------------------------------------------------------------------- - IMediaStreamTrackTypes::States MediaStreamTrack::readyState() const + IMediaStreamTrackTypes::States MediaStreamTrack::readyState() const noexcept { -#define TODO 1 -#define TODO 2 - return State_First; + AutoRecursiveLock lock(*this); + return currentState_; } //------------------------------------------------------------------------- - IMediaStreamTrackPtr MediaStreamTrack::clone() const + ortc::IMediaStreamTrackPtr MediaStreamTrack::clone() const noexcept { -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("TODO","media stream track implement clone") return IMediaStreamTrackPtr(); } //------------------------------------------------------------------------- - void MediaStreamTrack::stop() + void MediaStreamTrack::stop() noexcept { AutoRecursiveLock lock(*this); - if (mDeviceResource) - mDeviceResource->stop(); +#pragma ZS_BUILD_NOTE("TODO","media stream track implement stop") } //------------------------------------------------------------------------- - IMediaStreamTrackTypes::CapabilitiesPtr MediaStreamTrack::getCapabilities() const + IMediaStreamTrackTypes::CapabilitiesPtr MediaStreamTrack::getCapabilities() const noexcept { - return mCapabilities; + return capabilities_; } //------------------------------------------------------------------------- - IMediaStreamTrackTypes::TrackConstraintsPtr MediaStreamTrack::getConstraints() const + IMediaStreamTrackTypes::TrackConstraintsPtr MediaStreamTrack::getConstraints() const noexcept { AutoRecursiveLock lock(*this); - return mConstraints; + return constraints_; } //------------------------------------------------------------------------- - IMediaStreamTrackTypes::SettingsPtr MediaStreamTrack::getSettings() const + IMediaStreamTrackTypes::SettingsPtr MediaStreamTrack::getSettings() const noexcept { AutoRecursiveLock lock(*this); - return mSettings; + return settings_; } //------------------------------------------------------------------------- - PromisePtr MediaStreamTrack::applyConstraints(const TrackConstraints &inConstraints) + PromisePtr MediaStreamTrack::applyConstraints(const TrackConstraints &inConstraints) noexcept { PromisePtr promise = Promise::createRejected(IORTCForInternal::queueDelegate()); auto constraints = TrackConstraints::create(inConstraints); - IMediaStreamTrackAsyncDelegateProxy::create(mThisWeak.lock())->onApplyConstraints(promise, constraints); + IMediaStreamTrackAsyncDelegateProxy::create(thisWeak_.lock())->onApplyConstraints(promise, constraints); return promise; } //------------------------------------------------------------------------- - void MediaStreamTrack::setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) + IMediaStreamTrackMediaSubscriptionPtr MediaStreamTrack::subscribeMedia(IMediaStreamTrackSyncMediaDelegatePtr delegate) noexcept { - AutoRecursiveLock lock(*this); - - mVideoRendererCallback = callback; - if (mDeviceResource) - mDeviceResource->setVideoRenderCallback(callback); - } - - //------------------------------------------------------------------------- - void MediaStreamTrack::setH264Rendering(bool h264Rendering) - { - AutoRecursiveLock lock(*this); - - mH264Rendering = h264Rendering; + return IMediaStreamTrackMediaSubscriptionPtr(); } //------------------------------------------------------------------------- - bool MediaStreamTrack::isH264Rendering() + IMediaStreamTrackMediaSubscriptionPtr MediaStreamTrack::subscribeMedia(IMediaStreamTrackAsyncMediaDelegatePtr delegate) noexcept { - AutoRecursiveLock lock(*this); - - return mH264Rendering; + return IMediaStreamTrackMediaSubscriptionPtr(); } + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSender - #pragma mark - - //------------------------------------------------------------------------- - void MediaStreamTrack::setSender(IRTPSenderPtr sender) - { - AutoRecursiveLock lock(*this); - - mSender = RTPSender::convert(sender); - } + // + // MediaStreamTrack => internal::IMediaStreamTrack + // - //------------------------------------------------------------------------- - void MediaStreamTrack::notifyAttachSenderChannel(RTPSenderChannelPtr channel) - { - IMediaStreamTrackAsyncDelegateProxy::create(mThisWeak.lock())->onAttachSenderChannel(channel); - } //------------------------------------------------------------------------- - void MediaStreamTrack::notifyDetachSenderChannel(RTPSenderChannelPtr channel) + IMediaStreamTrackRTPSubscriptionPtr MediaStreamTrack::subscribeRTP( + ZS_MAYBE_USED() const Parameters &rtpEncodingParams, + ZS_MAYBE_USED() IMediaStreamTrackRTPDelegatePtr delegate + ) noexcept { - IMediaStreamTrackAsyncDelegateProxy::create(mThisWeak.lock())->onDetachSenderChannel(channel); + ZS_MAYBE_USED(rtpEncodingParams); + ZS_MAYBE_USED(delegate); +#pragma ZS_BUILD_NOTE("TODO","remove ZS_MAYBE_USED when implemented") + return IMediaStreamTrackRTPSubscriptionPtr(); } + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannel - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForSettings + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannelMediaBase - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaStream + // //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannelAudio - #pragma mark + bool MediaStreamTrack::isEnded() const noexcept + { + AutoRecursiveLock lock(*this); + return isShutdown(); + } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannelVideo - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackChannel + // + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiver - #pragma mark - - //------------------------------------------------------------------------- - MediaStreamTrackPtr MediaStreamTrack::create(Kinds kind) - { - return create(kind, true, TrackConstraintsPtr()); - } - - //------------------------------------------------------------------------- - void MediaStreamTrack::setReceiver(IRTPReceiverPtr receiver) - { - AutoRecursiveLock lock(*this); - - mReceiver = RTPReceiver::convert(receiver); - } - + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSubscriber + // + //------------------------------------------------------------------------- - void MediaStreamTrack::notifyActiveReceiverChannel(RTPReceiverChannelPtr inChannel) + void MediaStreamTrack::notifySubscriberCancelled(UseSubscriberPtr subscriber) noexcept { - IMediaStreamTrackAsyncDelegateProxy::create(mThisWeak.lock())->onSetActiveReceiverChannel(inChannel); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel - #pragma mark - + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSubscriberMedia + // + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelMediaBase - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSubscriberRTP + // + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelAudio - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaDevices + // + //------------------------------------------------------------------------- + MediaStreamTrack::ForMediaDevicesPtr MediaStreamTrack::createForMediaDevices( + IMediaStreamTrackTypes::Kinds kind, + const TrackConstraints &constraints + ) noexcept + { + MediaStreamTrackArguments args; + args.queue_ = IORTCForInternal::queueORTC(); + args.kind_ = kind; + args.type_ = MediaStreamTrackType_Capture; + args.constraints_ = make_shared(constraints); + + MediaStreamTrackPtr pThis(make_shared(make_private{}, args)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelVideo - #pragma mark + //------------------------------------------------------------------------- + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSelector + // //------------------------------------------------------------------------- - void MediaStreamTrack::renderVideoFrame(VideoFramePtr videoFrame) + MediaStreamTrack::ForMediaDevicesPtr MediaStreamTrack::createForMediaStreamTrackSelector(ZS_MAYBE_USED() IMediaStreamTrackTypes::Kinds kind) noexcept { - AutoRecursiveLock lock(*this); - - if (mDeviceResource) mDeviceResource->renderVideoFrame(videoFrame); + ZS_MAYBE_USED(kind); +#pragma ZS_BUILD_NOTE("TODO","Remove ZS_MAYBE_USED once implemented") + return ForMediaDevicesPtr(); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForMediaEngine - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForRTPReceiver + // //------------------------------------------------------------------------- - void MediaStreamTrack::sendCapturedVideoFrame(VideoFramePtr videoFrame) + MediaStreamTrack::ForReceiverPtr MediaStreamTrack::createForReceiver(IMediaStreamTrackTypes::Kinds kind) noexcept { - UseSenderChannelPtr channel; - - { - AutoRecursiveLock lock(*this); - - channel = mSenderChannel.lock(); - } + MediaStreamTrackArguments args; + args.queue_ = IORTCForInternal::queueORTC(); + args.kind_ = kind; + args.type_ = MediaStreamTrackType_Receiver; - if (!channel) return; - - channel->sendVideoFrame(videoFrame); + MediaStreamTrackPtr pThis(make_shared(make_private{}, args)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForMediaDevices - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForMediaEngine - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForRTPSender + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForMediaStream - #pragma mark - - //------------------------------------------------------------------------- - bool MediaStreamTrack::isEnded() const - { - AutoRecursiveLock lock(*this); - return isShutdown(); - } + // + // MediaStreamTrack => IMediaStreamTrackForRTPSenderChannel + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IWakeDelegate - #pragma mark + // + // MediaStreamTrack => IWakeDelegate + // //------------------------------------------------------------------------- void MediaStreamTrack::onWake() { - ZS_LOG_DEBUG(log("wake")) + ZS_EVENTING_1(x, i, Debug, MediaStreamTrackOnWake, ol, MediaEngine, InternalEvent, puid, id, id_); AutoRecursiveLock lock(*this); step(); @@ -727,21 +760,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => ITimerDelegate - #pragma mark + // + // MediaStreamTrack => ITimerDelegate + // //------------------------------------------------------------------------- void MediaStreamTrack::onTimer(ITimerPtr timer) { - ZS_LOG_TRACE(log("timer") + ZS_PARAM("timer id", timer->getID())) + ZS_EVENTING_2(x, i, Debug, MediaStreamTrackOnTimer, ol, MediaEngine, InternalEvent, + puid, id, id_, + puid, timerId, timer->getID() + ); AutoRecursiveLock lock(*this); - - if (mStatsTimer) { - if (mDeviceResource && timer->getID() == mStatsTimer->getID()) { - mDeviceResource->setFrameCount(); - } + if (statsTimer_) { } } @@ -749,14 +781,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IPromiseSettledDelegate - #pragma mark + // + // MediaStreamTrack => IPromiseSettledDelegate + // //------------------------------------------------------------------------- void MediaStreamTrack::onPromiseSettled(PromisePtr promise) { - ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID())) + ZS_EVENTING_2(x, i, Debug, MediaStreamTrackOnPromiseSettled, ol, MediaEngine, InternalEvent, + puid, id, id_, + puid, promiseId, promise->getID() + ); AutoRecursiveLock lock(*this); step(); @@ -766,17 +801,14 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackAsyncDelegate - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackAsyncDelegate + // //------------------------------------------------------------------------- void MediaStreamTrack::onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) { AutoRecursiveLock lock(*this); - - if (mDeviceResource) - mDeviceResource->requestStats(promise, stats); } //------------------------------------------------------------------------- @@ -786,129 +818,38 @@ namespace ortc ) { AutoRecursiveLock lock(*this); - - if (mDeviceResource) - mDeviceResource->updateConstraints(promise, constraints); - } - - //------------------------------------------------------------------------- - void MediaStreamTrack::onSetActiveReceiverChannel(UseReceiverChannelPtr channel) - { - AutoRecursiveLock lock(*this); - - if (!channel) { - ZS_LOG_DEBUG(log("active receiver channel is being removed")) -#define TODO 1 -#define TODO 2 - return; - } - - ZS_LOG_DEBUG(log("setting to active receiver channel") + ZS_PARAM("channel", channel->getID())) - - mReceiverChannel = channel; - -#define TODO 1 -#define TODO 2 } //------------------------------------------------------------------------- - void MediaStreamTrack::onAttachSenderChannel(UseSenderChannelPtr channel) - { - ZS_LOG_DEBUG(log("attaching sender channel") + ZS_PARAM("channel", channel->getID())) - - AutoRecursiveLock lock(*this); - - mSenderChannel = channel; - -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - void MediaStreamTrack::onDetachSenderChannel(UseSenderChannelPtr channel) - { - ZS_LOG_DEBUG(log("detaching sender channel") + ZS_PARAM("channel", channel->getID())) - - AutoRecursiveLock lock(*this); - - mSenderChannel.reset(); - -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => (internal) - #pragma mark - - //------------------------------------------------------------------------- - Log::Params MediaStreamTrack::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::MediaStreamTrack"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - //------------------------------------------------------------------------- - Log::Params MediaStreamTrack::slog(const char *message) - { - ElementPtr objectEl = Element::create("ortc::MediaStreamTrack"); - return Log::Params(message, objectEl); - } - //------------------------------------------------------------------------- - Log::Params MediaStreamTrack::debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - //------------------------------------------------------------------------- - ElementPtr MediaStreamTrack::toDebug() const - { - AutoRecursiveLock lock(*this); - - ElementPtr resultEl = Element::create("ortc::MediaStreamTrack"); - - IHelper::debugAppend(resultEl, "id", mID); - - IHelper::debugAppend(resultEl, "graceful shutdown", (bool)mGracefulShutdownReference); - - IHelper::debugAppend(resultEl, "subscribers", mSubscriptions.size()); - - IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); - - IHelper::debugAppend(resultEl, "error", mLastError); - IHelper::debugAppend(resultEl, "error reason", mLastErrorReason); - - return resultEl; - } + // + // MediaStreamTrack => (internal) + // //------------------------------------------------------------------------- - bool MediaStreamTrack::isShuttingDown() const + bool MediaStreamTrack::isShuttingDown() const noexcept { - if (mGracefulShutdownReference) return true; - return State_Ended == mCurrentState; + if (gracefulShutdownReference_) return true; + return State_Ended == currentState_; } //------------------------------------------------------------------------- - bool MediaStreamTrack::isShutdown() const + bool MediaStreamTrack::isShutdown() const noexcept { - if (mGracefulShutdownReference) return false; - return State_Ended == mCurrentState; + if (gracefulShutdownReference_) return false; + return State_Ended == currentState_; } //------------------------------------------------------------------------- - void MediaStreamTrack::step() + void MediaStreamTrack::step() noexcept { - ZS_LOG_DEBUG(debug("step")) + ZS_EVENTING_1(x, i, Debug, MediaStreamTrackStep, ol, MediaEngine, Step, puid, id, id_); if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_EVENTING_2(x, i, Debug, MediaStreamTrackStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "step forwarding to cancel"); cancel(); return; } @@ -922,121 +863,66 @@ namespace ortc not_ready: { - ZS_LOG_TRACE(debug("not ready")) + ZS_EVENTING_2(x, i, Debug, MediaStreamTrackStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); return; } ready: { - ZS_LOG_TRACE(log("ready")) + ZS_EVENTING_2(x, i, Debug, MediaStreamTrackStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); } } //------------------------------------------------------------------------- - bool MediaStreamTrack::stepDevicePromise() + bool MediaStreamTrack::stepDevicePromise() noexcept { - if (mDeviceResourceLifetimeHolderPromise) { - ZS_LOG_TRACE(log("already setup device promise")) - return true; - } - - mDeviceResourceLifetimeHolderPromise = UseMediaEngine::setupDevice(mThisWeak.lock()); - - mDeviceResourceLifetimeHolderPromise->thenWeak(mThisWeak.lock()); - return true; } //------------------------------------------------------------------------- - bool MediaStreamTrack::stepSetupDevice() + bool MediaStreamTrack::stepSetupDevice() noexcept { - if (mDeviceResource) { - ZS_LOG_TRACE(log("already setup device resource")) - return true; - } - - if (!mDeviceResourceLifetimeHolderPromise->isSettled()) { - ZS_LOG_TRACE(log("waiting for setup device promise to be set up")) - return false; - } - - if (mDeviceResourceLifetimeHolderPromise->isRejected()) { - ZS_LOG_WARNING(Debug, log("media engine rejected device setup")) - cancel(); - return false; - } - - mDeviceResource = ZS_DYNAMIC_PTR_CAST(UseDeviceResource, mDeviceResourceLifetimeHolderPromise->value()); - - if (!mDeviceResource) { - ZS_LOG_WARNING(Detail, log("failed to initialize device resource")) - cancel(); - return false; - } - - if (mVideoRendererCallback) - mDeviceResource->setVideoRenderCallback(mVideoRendererCallback); - - ZS_LOG_DEBUG(log("media device is setup") + ZS_PARAM("device", mDeviceResource->getID())) - return true; } //------------------------------------------------------------------------- - void MediaStreamTrack::cancel() + void MediaStreamTrack::cancel() noexcept { //....................................................................... // try to gracefully shutdown if (isShutdown()) return; - if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); - - if (!mCloseDevicePromise) { - if (mDeviceResource) { - mCloseDevicePromise = mDeviceResource->shutdown(); - mCloseDevicePromise->thenWeak(mGracefulShutdownReference); - } - } - - if (mGracefulShutdownReference) { - if (mCloseDevicePromise) { - if (!mCloseDevicePromise->isSettled()) { - ZS_LOG_DEBUG(log("waiting for close device promise")) - return; - } - } - } + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); //....................................................................... // final cleanup setState(State_Ended); - mSubscriptions.clear(); + subscriptions_.clear(); - if (mStatsTimer) { - mStatsTimer->cancel(); - mStatsTimer.reset(); + if (statsTimer_) { + statsTimer_->cancel(); + statsTimer_.reset(); } - mDeviceResourceLifetimeHolderPromise.reset(); - - mDeviceResource.reset(); - mCloseDevicePromise.reset(); - // make sure to cleanup any final reference to self - mGracefulShutdownReference.reset(); + gracefulShutdownReference_.reset(); } //------------------------------------------------------------------------- - void MediaStreamTrack::setState(States state) + void MediaStreamTrack::setState(States state) noexcept { - if (state == mCurrentState) return; + if (state == currentState_) return; - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) + ZS_EVENTING_3(x, i, Debug, MediaStreamTrackState, ol, MediaEngine, StateEvent, + puid, id, id_, + string, newState, ortc::IMediaStreamTrack::toString(state), + string, oldState, ortc::IMediaStreamTrack::toString(currentState_) + ); - mCurrentState = state; + currentState_ = state; // MediaStreamTrackPtr pThis = mThisWeak.lock(); // if (pThis) { @@ -1045,69 +931,75 @@ namespace ortc } //------------------------------------------------------------------------- - void MediaStreamTrack::setError(WORD errorCode, const char *inReason) + void MediaStreamTrack::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); } - if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) + if (0 != lastError_) { + ZS_EVENTING_3(x, w, Debug, MediaStreamTrackErrorAgain, ol, MediaEngine, ErrorEvent, + puid, id, id_, + word, error, errorCode, + string, reason, reason + ); return; } - mLastError = errorCode; - mLastErrorReason = reason; + lastError_ = errorCode; + lastErrorReason_ = reason; - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) + ZS_EVENTING_3(x, e, Detail, MediaStreamTrackError, ol, MediaEngine, ErrorEvent, + puid, id, id_, + word, error, errorCode, + string, reason, reason + ); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackFactory - #pragma mark + // + // IMediaStreamTrackFactory + // //------------------------------------------------------------------------- - IMediaStreamTrackFactory &IMediaStreamTrackFactory::singleton() + IMediaStreamTrackFactory &IMediaStreamTrackFactory::singleton() noexcept { return MediaStreamTrackFactory::singleton(); } //------------------------------------------------------------------------- - MediaStreamTrackPtr IMediaStreamTrackFactory::create( - IMediaStreamTrackTypes::Kinds kind, - bool remote, - TrackConstraintsPtr constraints - ) - { + IMediaStreamTrackFactory::ForMediaDevicesPtr IMediaStreamTrackFactory::createForMediaDevices( + IMediaStreamTrackTypes::Kinds kind, + const TrackConstraints &constraints + ) noexcept + { if (this) {} - return internal::MediaStreamTrack::create(kind, remote, constraints); + return internal::MediaStreamTrack::createForMediaDevices(kind, constraints); } //------------------------------------------------------------------------- - MediaStreamTrackPtr IMediaStreamTrackFactory::create(IMediaStreamTrackTypes::Kinds kind) + IMediaStreamTrackFactory::ForReceiverPtr IMediaStreamTrackFactory::createForReceiver(IMediaStreamTrackTypes::Kinds kind) noexcept { if (this) {} - return internal::MediaStreamTrack::create(kind); + return internal::MediaStreamTrack::createForReceiver(kind); } - } // internal namespace //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IMediaStreamTrackTypes"); } @@ -1116,12 +1008,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes - #pragma mark + // + // IMediaStreamTrackTypes + // //--------------------------------------------------------------------------- - const char *IMediaStreamTrackTypes::toString(Kinds kind) + const char *IMediaStreamTrackTypes::toString(Kinds kind) noexcept { switch (kind) { case Kind_Audio: return "audio"; @@ -1131,7 +1023,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::Kinds IMediaStreamTrackTypes::toKind(const char *inputStr) + IMediaStreamTrackTypes::Kinds IMediaStreamTrackTypes::toKind(const char *inputStr) noexcept(false) { String str(inputStr); for (IMediaStreamTrackTypes::Kinds index = IMediaStreamTrackTypes::Kind_First; index <= IMediaStreamTrackTypes::Kind_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -1142,7 +1034,7 @@ namespace ortc } //--------------------------------------------------------------------------- - const char *IMediaStreamTrackTypes::toString(States state) + const char *IMediaStreamTrackTypes::toString(States state) noexcept { switch (state) { case State_Live: return "live"; @@ -1152,7 +1044,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::States IMediaStreamTrackTypes::toState(const char *inputStr) + IMediaStreamTrackTypes::States IMediaStreamTrackTypes::toState(const char *inputStr) noexcept(false) { String str(inputStr); for (IMediaStreamTrackTypes::States index = IMediaStreamTrackTypes::State_First; index <= IMediaStreamTrackTypes::State_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -1166,12 +1058,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::Capabilities - #pragma mark + // + // IMediaStreamTrackTypes::Capabilities + // //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::Capabilities::Capabilities(ElementPtr elem) + IMediaStreamTrackTypes::Capabilities::Capabilities(ElementPtr elem) noexcept { if (!elem) return; @@ -1253,7 +1145,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::Capabilities::createElement(const char *objectName) const + ElementPtr IMediaStreamTrackTypes::Capabilities::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1303,32 +1195,32 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::create() + IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::create() noexcept { return make_shared(); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::create(const CapabilitiesPtr &value) + IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::create(const CapabilitiesPtr &value) noexcept { if (!value) return create(); return create(*value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::create(const Capabilities &value) + IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::create(const Capabilities &value) noexcept { return make_shared(value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::convert(AnyPtr any) + IMediaStreamTrackTypes::CapabilitiesPtr IMediaStreamTrackTypes::Capabilities::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Capabilities, any); } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::Capabilities::toDebug() const + ElementPtr IMediaStreamTrackTypes::Capabilities::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaStreamTrackTypes::Capabilities"); @@ -1344,12 +1236,13 @@ namespace ortc IHelper::debugAppend(resultEl, "channel acount", mChannelCount.hasValue() ? mChannelCount.value().toDebug() : ElementPtr()); IHelper::debugAppend(resultEl, "device id", mDeviceID); IHelper::debugAppend(resultEl, "group id", mGroupID); + IHelper::debugAppend(resultEl, "encodingFormat", mEncodingFormat.hasValue() ? mEncodingFormat.value().toDebug() : ElementPtr()); return resultEl; } //--------------------------------------------------------------------------- - String IMediaStreamTrackTypes::Capabilities::hash() const + String IMediaStreamTrackTypes::Capabilities::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1377,6 +1270,8 @@ namespace ortc hasher->update(mDeviceID); hasher->update(":"); hasher->update(mGroupID); + hasher->update(":"); + hasher->update(mEncodingFormat.hasValue() ? mEncodingFormat.value().hash() : String()); return hasher->finalizeAsString(); } @@ -1385,12 +1280,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::Settings - #pragma mark + // + // IMediaStreamTrackTypes::Settings + // //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::Settings::Settings(ElementPtr elem) + IMediaStreamTrackTypes::Settings::Settings(ElementPtr elem) noexcept { if (!elem) return; @@ -1408,10 +1303,11 @@ namespace ortc IHelper::getElementValue(elem, "ortc::IMediaStreamTrackTypes::Settings", "channelCount", mChannelCount); IHelper::getElementValue(elem, "ortc::IMediaStreamTrackTypes::Settings", "deviceId", mDeviceID); IHelper::getElementValue(elem, "ortc::IMediaStreamTrackTypes::Settings", "groupId", mGroupID); + IHelper::getElementValue(elem, "ortc::IMediaStreamTrackTypes::Settings", "encodingFormat", mEncodingFormat); } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::Settings::createElement(const char *objectName) const + ElementPtr IMediaStreamTrackTypes::Settings::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1429,6 +1325,7 @@ namespace ortc IHelper::adoptElementValue(elem, "channelCount", mChannelCount); IHelper::adoptElementValue(elem, "deviceId", mDeviceID); IHelper::adoptElementValue(elem, "groupId", mGroupID); + IHelper::adoptElementValue(elem, "encodingFormat", mEncodingFormat); if (!elem->hasChildren()) return ElementPtr(); @@ -1436,32 +1333,32 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::create() + IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::create() noexcept { return make_shared(); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::create(const SettingsPtr &value) + IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::create(const SettingsPtr &value) noexcept { if (!value) return create(); return create(*value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::create(const Settings &value) + IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::create(const Settings &value) noexcept { return make_shared(value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::convert(AnyPtr any) + IMediaStreamTrackTypes::SettingsPtr IMediaStreamTrackTypes::Settings::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Settings, any); } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::Settings::toDebug() const + ElementPtr IMediaStreamTrackTypes::Settings::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaStreamTrackTypes::Settings"); @@ -1479,12 +1376,13 @@ namespace ortc IHelper::debugAppend(resultEl, "channel count", mChannelCount); IHelper::debugAppend(resultEl, "device id", mDeviceID); IHelper::debugAppend(resultEl, "group id", mGroupID); + IHelper::debugAppend(resultEl, "encoding format", mEncodingFormat); return resultEl; } //--------------------------------------------------------------------------- - String IMediaStreamTrackTypes::Settings::hash() const + String IMediaStreamTrackTypes::Settings::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1517,6 +1415,8 @@ namespace ortc hasher->update(mDeviceID, "bogus99255cc407eaf6f82b33a94ab86f588581df9000"); hasher->update(":"); hasher->update(mGroupID, "bogus99255cc407eaf6f82b33a94ab86f588581df9000"); + hasher->update(":"); + hasher->update(mEncodingFormat, "bogus99255cc407eaf6f82b33a94ab86f588581df9000"); return hasher->finalizeAsString(); } @@ -1525,12 +1425,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::ConstraintSet - #pragma mark + // + // IMediaStreamTrackTypes::ConstraintSet + // //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::ConstraintSet::ConstraintSet(ElementPtr elem) + IMediaStreamTrackTypes::ConstraintSet::ConstraintSet(ElementPtr elem) noexcept { if (!elem) return; @@ -1618,10 +1518,16 @@ namespace ortc mGroupID = ConstrainString(entryEl); } } + { + ElementPtr entryEl = elem->findFirstChildElement("encodingFormat"); + if (entryEl) { + mEncodingFormat = ConstrainString(entryEl); + } + } } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::ConstraintSet::createElement(const char *objectName) const + ElementPtr IMediaStreamTrackTypes::ConstraintSet::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1639,6 +1545,7 @@ namespace ortc elem->adoptAsLastChild(mChannelCount.createElement("channelCount")); elem->adoptAsLastChild(mDeviceID.createElement("deviceId")); elem->adoptAsLastChild(mGroupID.createElement("groupId")); + elem->adoptAsLastChild(mEncodingFormat.createElement("encodingFormat")); if (!elem->hasChildren()) return ElementPtr(); @@ -1646,26 +1553,26 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::ConstraintSetPtr IMediaStreamTrackTypes::ConstraintSet::create() + IMediaStreamTrackTypes::ConstraintSetPtr IMediaStreamTrackTypes::ConstraintSet::create() noexcept { return make_shared(); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::ConstraintSetPtr IMediaStreamTrackTypes::ConstraintSet::create(const ConstraintSetPtr &value) + IMediaStreamTrackTypes::ConstraintSetPtr IMediaStreamTrackTypes::ConstraintSet::create(const ConstraintSetPtr &value) noexcept { if (!value) return create(); return create(*value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes:: ConstraintSetPtr IMediaStreamTrackTypes::ConstraintSet::create(const ConstraintSet &value) + IMediaStreamTrackTypes:: ConstraintSetPtr IMediaStreamTrackTypes::ConstraintSet::create(const ConstraintSet &value) noexcept { return make_shared(value); } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::ConstraintSet::toDebug() const + ElementPtr IMediaStreamTrackTypes::ConstraintSet::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaStreamTrackTypes::ConstraintSet"); @@ -1681,12 +1588,13 @@ namespace ortc IHelper::debugAppend(resultEl, "channel count", mChannelCount.toDebug()); IHelper::debugAppend(resultEl, "device id", mDeviceID.toDebug()); IHelper::debugAppend(resultEl, "group id", mGroupID.toDebug()); + IHelper::debugAppend(resultEl, "encoding format", mEncodingFormat.toDebug()); return resultEl; } //--------------------------------------------------------------------------- - String IMediaStreamTrackTypes::ConstraintSet::hash() const + String IMediaStreamTrackTypes::ConstraintSet::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1715,6 +1623,8 @@ namespace ortc hasher->update(mDeviceID.hash()); hasher->update(":"); hasher->update(mGroupID.hash()); + hasher->update(":"); + hasher->update(mEncodingFormat.hash()); return hasher->finalizeAsString(); } @@ -1723,12 +1633,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::ConstraintSet - #pragma mark + // + // IMediaStreamTrackTypes::ConstraintSet + // //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::TrackConstraints::TrackConstraints(ElementPtr elem) + IMediaStreamTrackTypes::TrackConstraints::TrackConstraints(ElementPtr elem) noexcept { if (!elem) return; @@ -1748,7 +1658,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::TrackConstraints::createElement(const char *objectName) const + ElementPtr IMediaStreamTrackTypes::TrackConstraints::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1770,20 +1680,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::TrackConstraintsPtr IMediaStreamTrackTypes::TrackConstraints::create() + IMediaStreamTrackTypes::TrackConstraintsPtr IMediaStreamTrackTypes::TrackConstraints::create() noexcept { return make_shared(); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::TrackConstraintsPtr IMediaStreamTrackTypes::TrackConstraints::create(const TrackConstraintsPtr &value) + IMediaStreamTrackTypes::TrackConstraintsPtr IMediaStreamTrackTypes::TrackConstraints::create(const TrackConstraintsPtr &value) noexcept { if (!value) return create(); return create(*value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::TrackConstraintsPtr IMediaStreamTrackTypes::TrackConstraints::create(const TrackConstraints &value) + IMediaStreamTrackTypes::TrackConstraintsPtr IMediaStreamTrackTypes::TrackConstraints::create(const TrackConstraints &value) noexcept { auto result = make_shared(); @@ -1796,7 +1706,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::TrackConstraints::toDebug() const + ElementPtr IMediaStreamTrackTypes::TrackConstraints::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaStreamTrackTypes::TrackConstraints"); @@ -1814,7 +1724,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IMediaStreamTrackTypes::TrackConstraints::hash() const + String IMediaStreamTrackTypes::TrackConstraints::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1833,12 +1743,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackTypes::ConstraintSet - #pragma mark + // + // IMediaStreamTrackTypes::ConstraintSet + // //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::Constraints::Constraints(ElementPtr elem) + IMediaStreamTrackTypes::Constraints::Constraints(ElementPtr elem) noexcept { if (!elem) return; @@ -1857,7 +1767,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::Constraints::createElement(const char *objectName) const + ElementPtr IMediaStreamTrackTypes::Constraints::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1874,20 +1784,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::ConstraintsPtr IMediaStreamTrackTypes::Constraints::create() + IMediaStreamTrackTypes::ConstraintsPtr IMediaStreamTrackTypes::Constraints::create() noexcept { return make_shared(); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::ConstraintsPtr IMediaStreamTrackTypes::Constraints::create(const ConstraintsPtr &value) + IMediaStreamTrackTypes::ConstraintsPtr IMediaStreamTrackTypes::Constraints::create(const ConstraintsPtr &value) noexcept { if (!value) return create(); return create(*value); } //--------------------------------------------------------------------------- - IMediaStreamTrackTypes::ConstraintsPtr IMediaStreamTrackTypes::Constraints::create(const Constraints &value) + IMediaStreamTrackTypes::ConstraintsPtr IMediaStreamTrackTypes::Constraints::create(const Constraints &value) noexcept { auto result = make_shared(); result->mVideo = value.mVideo ? TrackConstraints::create(value.mVideo) : TrackConstraintsPtr(); @@ -1896,7 +1806,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrackTypes::Constraints::toDebug() const + ElementPtr IMediaStreamTrackTypes::Constraints::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IMediaStreamTrackTypes::Constraints"); @@ -1907,7 +1817,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IMediaStreamTrackTypes::Constraints::hash() const + String IMediaStreamTrackTypes::Constraints::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1925,18 +1835,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrack - #pragma mark - - //--------------------------------------------------------------------------- - ElementPtr IMediaStreamTrack::toDebug(IMediaStreamTrackPtr object) - { - return internal::MediaStreamTrack::toDebug(internal::MediaStreamTrack::convert(object)); - } + // + // IMediaStreamTrack + // //--------------------------------------------------------------------------- - IMediaStreamTrackPtr IMediaStreamTrack::convert(AnyPtr any) + IMediaStreamTrackPtr IMediaStreamTrack::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(IMediaStreamTrack, any); } diff --git a/ortc/cpp/ortc_RTPReceiverChannelMediaBase.cpp b/ortc/cpp/ortc_MediaStreamTrackMonitor.cpp similarity index 56% rename from ortc/cpp/ortc_RTPReceiverChannelMediaBase.cpp rename to ortc/cpp/ortc_MediaStreamTrackMonitor.cpp index 44986233..cec26abe 100644 --- a/ortc/cpp/ortc_RTPReceiverChannelMediaBase.cpp +++ b/ortc/cpp/ortc_MediaStreamTrackMonitor.cpp @@ -1,6 +1,7 @@ /* - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + Copyright (c) 2017, Hookflash Inc. + Copyright (c) 2017, Optical Tone Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,103 +30,57 @@ */ -#include -#include -#include -#include -#include - -//#include -//#include -//#include - -//#include -//#include -//#include - -//#include - +#ifdef ORTC_USE_ALTERNATIVE_MEDIASTREAMTRACK_MONITOR +#include +#else // ORTC_USE_ALTERNATIVE_MEDIASTREAMTRACK_MONITOR -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG +#include +#include +#include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpreceiver) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_stream_track_monitor) } namespace ortc { -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::ISettings, UseSettings) -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper) -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP) -// -// typedef ortc::services::Hasher SHA1Hasher; - namespace internal { //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark - + // + // (helpers) + // + // foreward declaration + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark + // + // MediaStreamTrackMonitorSettingsDefaults + // //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelMediaBaseForRTPReceiverChannel::toDebug(ForRTPReceiverChannelPtr object) + void installMediaStreamTrackMonitorSettingsDefaults() noexcept { - if (!object) return ElementPtr(); - - { - auto pThis = RTPReceiverChannelAudio::convert(object); - if (pThis) return pThis->toDebug(); - } - - { - auto pThis = RTPReceiverChannelVideo::convert(object); - if (pThis) return pThis->toDebug(); - } - - return ElementPtr(); } - + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark + // + // IMediaStreamTrackMonitor + // - //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelMediaBaseForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) + IMediaStreamTrackMonitorPtr IMediaStreamTrackMonitor::create(ortc::IMediaStreamTrackPtr track) noexcept { - if (!object) return ElementPtr(); - - { - auto pThis = RTPReceiverChannelAudio::convert(object); - if (pThis) return pThis->toDebug(); - } - - { - auto pThis = RTPReceiverChannelVideo::convert(object); - if (pThis) return pThis->toDebug(); - } - - return ElementPtr(); + return IMediaStreamTrackMonitorPtr(); } - - } // internal namespace } + +#endif // ORTC_USE_ALTERNATIVE_MEDIASTREAMTRACK_MONITOR diff --git a/ortc/cpp/ortc_ORTC.cpp b/ortc/cpp/ortc_ORTC.cpp index 82f00afa..1a2a883f 100644 --- a/ortc/cpp/ortc_ORTC.cpp +++ b/ortc/cpp/ortc_ORTC.cpp @@ -30,10 +30,27 @@ */ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#endif //WINUWP + #include #include +#include #include -#include +#include +#include #include #include @@ -44,7 +61,7 @@ #include #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -54,38 +71,41 @@ namespace ortc namespace internal { - ZS_DECLARE_TYPEDEF_PTR(zsLib::IMessageQueueManager, UseMessageQueueManager); ZS_DECLARE_CLASS_PTR(ORTCSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(zsLib::IMessageQueueManager, UseMessageQueueManager); - void initSubsystems(); - void installORTCSettingsDefaults(); - void installCertificateSettingsDefaults(); - void installDataChannelSettingsDefaults(); - void installDTMFSenderSettingsDefaults(); - void installDTLSTransportSettingsDefaults(); - void installICEGathererSettingsDefaults(); - void installICETransportSettingsDefaults(); - void installIdentitySettingsDefaults(); - void installMediaDevicesSettingsDefaults(); - void installMediaStreamTrackSettingsDefaults(); - void installRTPListenerSettingsDefaults(); - void installRTPMediaEngineSettingsDefaults(); - void installRTPReceiverSettingsDefaults(); - void installRTPReceiverChannelAudioSettingsDefaults(); - void installRTPReceiverChannelSettingsDefaults(); - void installRTPReceiverChannelVideoSettingsDefaults(); - void installRTPSenderSettingsDefaults(); - void installRTPSenderChannelSettingsDefaults(); - void installRTPSenderChannelAudioSettingsDefaults(); - void installRTPSenderChannelVideoSettingsDefaults(); - void installStatsReportSettingsDefaults(); - void installSCTPTransportSettingsDefaults(); - void installSCTPTransportListenerSettingsDefaults(); - void installSRTPTransportSettingsDefaults(); - void installSRTPSDESTransportSettingsDefaults(); - - //------------------------------------------------------------------------- - static void installAllDefaults() + void initSubsystems() noexcept; + void installORTCSettingsDefaults() noexcept; + void installCertificateSettingsDefaults() noexcept; + void installDataChannelSettingsDefaults() noexcept; + void installDTMFSenderSettingsDefaults() noexcept; + void installDTLSTransportSettingsDefaults() noexcept; + void installICEGathererSettingsDefaults() noexcept; + void installICETransportSettingsDefaults() noexcept; + void installIdentitySettingsDefaults() noexcept; + void installMediaDevicesSettingsDefaults() noexcept; + void installMediaStreamTrackSettingsDefaults() noexcept; + void installRTPListenerSettingsDefaults() noexcept; + void installMediaChannelTraceHelperDefaults() noexcept; + void installMediaDeviceCaptureAudioSettingsDefaults() noexcept; + void installMediaDeviceCaptureVideoSettingsDefaults() noexcept; + void installRTPDecoderAudioSettingsDefaults() noexcept; + void installRTPDecoderVideoSettingsDefaults() noexcept; + void installRTPEncoderAudioSettingsDefaults() noexcept; + void installRTPEncoderVideoSettingsDefaults() noexcept; + void installMediaEngineSettingsDefaults() noexcept; + void installRTPReceiverSettingsDefaults() noexcept; + void installRTPReceiverChannelSettingsDefaults() noexcept; + void installRTPSenderSettingsDefaults() noexcept; + void installRTPSenderChannelSettingsDefaults() noexcept; + void installStatsReportSettingsDefaults() noexcept; + void installSCTPTransportSettingsDefaults() noexcept; + void installSCTPTransportListenerSettingsDefaults() noexcept; + void installSRTPTransportSettingsDefaults() noexcept; + void installSRTPSDESTransportSettingsDefaults() noexcept; + + //------------------------------------------------------------------------- + static void installAllDefaults()noexcept { installORTCSettingsDefaults(); installCertificateSettingsDefaults(); @@ -96,17 +116,20 @@ namespace ortc installICETransportSettingsDefaults(); installIdentitySettingsDefaults(); installMediaDevicesSettingsDefaults(); + installMediaChannelTraceHelperDefaults(); installMediaStreamTrackSettingsDefaults(); installRTPListenerSettingsDefaults(); - installRTPMediaEngineSettingsDefaults(); + installMediaDeviceCaptureAudioSettingsDefaults(); + installMediaDeviceCaptureVideoSettingsDefaults(); + installRTPDecoderAudioSettingsDefaults(); + installRTPDecoderVideoSettingsDefaults(); + installRTPEncoderAudioSettingsDefaults(); + installRTPEncoderVideoSettingsDefaults(); + installMediaEngineSettingsDefaults(); installRTPReceiverSettingsDefaults(); - installRTPReceiverChannelAudioSettingsDefaults(); installRTPReceiverChannelSettingsDefaults(); - installRTPReceiverChannelVideoSettingsDefaults(); installRTPSenderSettingsDefaults(); installRTPSenderChannelSettingsDefaults(); - installRTPSenderChannelAudioSettingsDefaults(); - installRTPSenderChannelVideoSettingsDefaults(); installStatsReportSettingsDefaults(); installSCTPTransportSettingsDefaults(); installSCTPTransportListenerSettingsDefaults(); @@ -119,28 +142,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ORTCSettingsDefaults - #pragma mark + // + // ORTCSettingsDefaults + // class ORTCSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~ORTCSettingsDefaults() + ~ORTCSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static ORTCSettingsDefaultsPtr singleton() + static ORTCSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static ORTCSettingsDefaultsPtr create() + static ORTCSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -148,17 +171,26 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { + ISettings::setString(ORTC_SETTING_ORTC_QUEUE_MAIN_THREAD_NAME, zsLib::toString(zsLib::ThreadPriority_NormalPriority)); + ISettings::setString(ORTC_SETTING_ORTC_QUEUE_PIPELINE_THREAD_NAME, zsLib::toString(zsLib::ThreadPriority_HighPriority)); + ISettings::setString(ORTC_SETTING_ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME, "normal"); + ISettings::setString(ORTC_SETTING_ORTC_QUEUE_CERTIFICATE_GENERATION_NAME, "low"); + + for (size_t index = 0; index < ORTC_QUEUE_TOTAL_MEDIA_DEVICE_THREADS; ++index) { + ISettings::setString((String(ORTC_SETTING_ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME) + string(index)).c_str(), "higest"); + } + for (size_t index = 0; index < ORTC_QUEUE_TOTAL_RTP_THREADS; ++index) { + ISettings::setString((String(ORTC_SETTING_ORTC_QUEUE_RTP_THREAD_NAME) + string(index)).c_str(), "higest"); + } ISettings::setString(ZSLIB_SETTING_SOCKET_MONITOR_THREAD_PRIORITY, zsLib::toString(zsLib::ThreadPriority_HighPriority)); - ISettings::setString(ORTC_QUEUE_THREAD_MAIN_PRIORITY, zsLib::toString(zsLib::ThreadPriority_NormalPriority)); - ISettings::setString(ORTC_QUEUE_THREAD_PIPELINE_PRIORITY, zsLib::toString(zsLib::ThreadPriority_HighPriority)); } }; //------------------------------------------------------------------------- - void installORTCSettingsDefaults() + void installORTCSettingsDefaults() noexcept { ORTCSettingsDefaults::singleton(); } @@ -167,54 +199,60 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IORTCForInternal - #pragma mark + // + // IORTCForInternal + // //------------------------------------------------------------------------- - void IORTCForInternal::overrideQueueDelegate(IMessageQueuePtr queue) + void IORTCForInternal::overrideQueueDelegate(IMessageQueuePtr queue) noexcept { return (ORTC::singleton())->overrideQueueDelegate(queue); } //------------------------------------------------------------------------- - IMessageQueuePtr IORTCForInternal::queueDelegate() + IMessageQueuePtr IORTCForInternal::queueDelegate() noexcept { return (ORTC::singleton())->queueDelegate(); } //------------------------------------------------------------------------- - IMessageQueuePtr IORTCForInternal::queueORTC() + IMessageQueuePtr IORTCForInternal::queueORTC() noexcept { return (ORTC::singleton())->queueORTC(); } //------------------------------------------------------------------------- - IMessageQueuePtr IORTCForInternal::queueORTCPipeline() + IMessageQueuePtr IORTCForInternal::queueORTCPipeline() noexcept { return (ORTC::singleton())->queueORTCPipeline(); } //------------------------------------------------------------------------- - IMessageQueuePtr IORTCForInternal::queuePacket() + IMessageQueuePtr IORTCForInternal::queueBlockingMediaStartStopThread() noexcept { - return (ORTC::singleton())->queuePacket(); + return (ORTC::singleton())->queueBlockingMediaStartStopThread(); } //------------------------------------------------------------------------- - IMessageQueuePtr IORTCForInternal::queueBlockingMediaStartStopThread() + IMessageQueuePtr IORTCForInternal::queueMediaDevices() noexcept { - return (ORTC::singleton())->queueBlockingMediaStartStopThread(); + return (ORTC::singleton())->queueMediaDevices(); + } + + //------------------------------------------------------------------------- + IMessageQueuePtr IORTCForInternal::queueRTP() noexcept + { + return (ORTC::singleton())->queueRTP(); } //------------------------------------------------------------------------- - IMessageQueuePtr IORTCForInternal::queueCertificateGeneration() + IMessageQueuePtr IORTCForInternal::queueCertificateGeneration() noexcept { return (ORTC::singleton())->queueCertificateGeneration(); } //------------------------------------------------------------------------- - Optional IORTCForInternal::webrtcLogLevel() + Optional IORTCForInternal::webrtcLogLevel() noexcept { return (ORTC::singleton())->webrtcLogLevel(); } @@ -223,12 +261,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ORTC - #pragma mark + // + // ORTC + // //------------------------------------------------------------------------- - ORTC::ORTC(const make_private &) : + ORTC::ORTC(const make_private &) noexcept : SharedRecursiveLock(SharedRecursiveLock::create()) { ZS_EVENTING_EXCLUSIVE(OrtcLib); @@ -248,7 +286,7 @@ namespace ortc } //------------------------------------------------------------------------- - ORTC::~ORTC() + ORTC::~ORTC() noexcept { mThisWeak.reset(); ZS_LOG_DETAIL(log("destroyed")); @@ -272,18 +310,18 @@ namespace ortc } //------------------------------------------------------------------------- - void ORTC::init() + void ORTC::init() noexcept { } //------------------------------------------------------------------------- - ORTCPtr ORTC::convert(IORTCPtr object) + ORTCPtr ORTC::convert(IORTCPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(ORTC, object); } //------------------------------------------------------------------------- - ORTCPtr ORTC::create() + ORTCPtr ORTC::create() noexcept { ORTCPtr pThis(make_shared(make_private{})); pThis->mThisWeak = pThis; @@ -295,12 +333,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ORTC => IORTC - #pragma mark + // + // ORTC => IORTC + // //------------------------------------------------------------------------- - ORTCPtr ORTC::singleton() + ORTCPtr ORTC::singleton() noexcept { AutoRecursiveLock lock(*UseServicesHelper::getGlobalLock()); static SingletonLazySharedPtr singleton(ORTC::create()); @@ -312,7 +350,7 @@ namespace ortc } //------------------------------------------------------------------------- - void ORTC::setup(IMessageQueuePtr defaultDelegateMessageQueue) + void ORTC::setup(IMessageQueuePtr defaultDelegateMessageQueue) noexcept { { AutoRecursiveLock lock(mLock); @@ -323,105 +361,114 @@ namespace ortc } UseServicesHelper::setup(); - installAllDefaults(); - ISettings::applyDefaults(); + internalSetup(); } -#ifdef WINRT +#ifdef WINUWP +#ifdef __cplusplus_winrt //------------------------------------------------------------------------- - void ORTC::setup(Windows::UI::Core::CoreDispatcher ^dispatcher) + void ORTC::setup(Windows::UI::Core::CoreDispatcher ^dispatcher) noexcept { UseServicesHelper::setup(dispatcher); - installAllDefaults(); - ISettings::applyDefaults(); + internalSetup(); + } +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + //------------------------------------------------------------------------- + void ORTC::setup(winrt::Windows::UI::Core::CoreDispatcher dispatcher) noexcept + { + UseServicesHelper::setup(dispatcher); + internalSetup(); } -#endif //WINRT +#endif //CPPWINRT_VERSION +#endif //WINUWP //------------------------------------------------------------------------- - Milliseconds ORTC::ntpServerTime() const + Milliseconds ORTC::ntpServerTime() const noexcept { AutoRecursiveLock(*this); return mNTPServerTime; } //------------------------------------------------------------------------- - void ORTC::ntpServerTime(const Milliseconds &value) + void ORTC::ntpServerTime(const Milliseconds &value) noexcept { { AutoRecursiveLock(*this); mNTPServerTime = value; } - auto totalMilliseconds = value.count(); - IRTPMediaEngineForORTC::ntpServerTime(value); + IMediaEngineForORTC::ntpServerTime(value); } //------------------------------------------------------------------------- - void ORTC::defaultWebrtcLogLevel(Log::Level level) + void ORTC::defaultWebrtcLogLevel(Log::Level level) noexcept { AutoRecursiveLock(*this); mDefaultWebRTCLogLevel = level; } //------------------------------------------------------------------------- - void ORTC::webrtcLogLevel(Log::Level level) + void ORTC::webrtcLogLevel(Log::Level level) noexcept { AutoRecursiveLock(*this); mWebRTCLogLevel = level; } //------------------------------------------------------------------------- - void ORTC::startMediaTracing() + void ORTC::startMediaTracing() noexcept { - IRTPMediaEngineForORTC::startMediaTracing(); + IMediaEngineForORTC::startMediaTracing(); } //------------------------------------------------------------------------- - void ORTC::stopMediaTracing() + void ORTC::stopMediaTracing() noexcept { - IRTPMediaEngineForORTC::stopMediaTracing(); + IMediaEngineForORTC::stopMediaTracing(); } //------------------------------------------------------------------------- - bool ORTC::isMediaTracing() + bool ORTC::isMediaTracing() noexcept { - return IRTPMediaEngineForORTC::isMediaTracing(); + return IMediaEngineForORTC::isMediaTracing(); } //------------------------------------------------------------------------- - bool ORTC::saveMediaTrace(String filename) + bool ORTC::saveMediaTrace(String filename) noexcept { - return IRTPMediaEngineForORTC::saveMediaTrace(filename); + return IMediaEngineForORTC::saveMediaTrace(filename); } //------------------------------------------------------------------------- - bool ORTC::saveMediaTrace(String host, int port) + bool ORTC::saveMediaTrace(String host, int port) noexcept { - return IRTPMediaEngineForORTC::saveMediaTrace(host, port); + return IMediaEngineForORTC::saveMediaTrace(host, port); } //------------------------------------------------------------------------- - bool ORTC::isMRPInstalled() + bool ORTC::isMRPInstalled() noexcept { - return IRTPMediaEngineForORTC::isMRPInstalled(); +#pragma ZS_BUILD_NOTE("TODO","Implment MRP installed") +// return IRTPMediaEngineForORTC::isMRPInstalled(); + return true; } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Stack => IORTCForInternal - #pragma mark + // + // Stack => IORTCForInternal + // //------------------------------------------------------------------------- - void ORTC::overrideQueueDelegate(IMessageQueuePtr queue) + void ORTC::overrideQueueDelegate(IMessageQueuePtr queue) noexcept { AutoRecursiveLock lock(*this); mDelegateQueue = queue; } //------------------------------------------------------------------------- - IMessageQueuePtr ORTC::queueDelegate() const + IMessageQueuePtr ORTC::queueDelegate() const noexcept { AutoRecursiveLock lock(*this); if (!mDelegateQueue) { @@ -431,13 +478,13 @@ namespace ortc } //------------------------------------------------------------------------- - IMessageQueuePtr ORTC::queueORTC() const + IMessageQueuePtr ORTC::queueORTC() const noexcept { AutoRecursiveLock lock(*this); class Once { public: Once() { - zsLib::IMessageQueueManager::registerMessageQueueThreadPriority(ORTC_QUEUE_MAIN_THREAD_NAME, zsLib::threadPriorityFromString(ISettings::getString(ORTC_QUEUE_THREAD_MAIN_PRIORITY))); + zsLib::IMessageQueueManager::registerMessageQueueThreadPriority(ORTC_QUEUE_MAIN_THREAD_NAME, zsLib::threadPriorityFromString(ISettings::getString(ORTC_SETTING_ORTC_QUEUE_MAIN_THREAD_NAME))); } }; static Once once; @@ -445,13 +492,13 @@ namespace ortc } //------------------------------------------------------------------------- - IMessageQueuePtr ORTC::queueORTCPipeline() const + IMessageQueuePtr ORTC::queueORTCPipeline() const noexcept { AutoRecursiveLock lock(*this); class Once { public: Once() { - zsLib::IMessageQueueManager::registerMessageQueueThreadPriority(ORTC_QUEUE_PIPELINE_THREAD_NAME, zsLib::threadPriorityFromString(ISettings::getString(ORTC_QUEUE_THREAD_PIPELINE_PRIORITY))); + zsLib::IMessageQueueManager::registerMessageQueueThreadPriority(ORTC_QUEUE_PIPELINE_THREAD_NAME, zsLib::threadPriorityFromString(ISettings::getString(ORTC_SETTING_ORTC_QUEUE_PIPELINE_THREAD_NAME))); } }; static Once once; @@ -459,32 +506,47 @@ namespace ortc } //------------------------------------------------------------------------- - IMessageQueuePtr ORTC::queuePacket() const + IMessageQueuePtr ORTC::queueBlockingMediaStartStopThread() const noexcept { AutoRecursiveLock lock(*this); + if (!mBlockingMediaStartStopThread) { + mBlockingMediaStartStopThread = UseMessageQueueManager::getMessageQueue(ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME); + } + return mBlockingMediaStartStopThread; + } - size_t index = mNextPacketQueueThread % ORTC_QUEUE_TOTAL_PACKET_THREADS; + //------------------------------------------------------------------------- + IMessageQueuePtr ORTC::queueMediaDevices() const noexcept + { + AutoRecursiveLock lock(*this); - if (!mPacketQueues[index]) { - mPacketQueues[index] = UseMessageQueueManager::getMessageQueue((String(ORTC_QUEUE_PACKET_THREAD_NAME) + string(index)).c_str()); + size_t index = mNextMediaQueueThread % ORTC_QUEUE_TOTAL_MEDIA_DEVICE_THREADS; + + if (!mMediaDeviceQueues[index]) { + mMediaDeviceQueues[index] = UseMessageQueueManager::getMessageQueue((String(ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME) + string(index)).c_str()); } - ++mNextPacketQueueThread; - return mPacketQueues[index]; + ++mNextMediaQueueThread; + return mMediaDeviceQueues[index]; } //------------------------------------------------------------------------- - IMessageQueuePtr ORTC::queueBlockingMediaStartStopThread() const + IMessageQueuePtr ORTC::queueRTP() const noexcept { AutoRecursiveLock lock(*this); - if (!mBlockingMediaStartStopThread) { - mBlockingMediaStartStopThread = UseMessageQueueManager::getMessageQueue(ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME); + + size_t index = mNextRTPQueueThread % ORTC_QUEUE_TOTAL_RTP_THREADS; + + if (!mRTPQueues[index]) { + mRTPQueues[index] = UseMessageQueueManager::getMessageQueue((String(ORTC_QUEUE_RTP_THREAD_NAME) + string(index)).c_str()); } - return mBlockingMediaStartStopThread; + + ++mNextRTPQueueThread; + return mRTPQueues[index]; } //------------------------------------------------------------------------- - IMessageQueuePtr ORTC::queueCertificateGeneration() const + IMessageQueuePtr ORTC::queueCertificateGeneration() const noexcept { AutoRecursiveLock lock(*this); if (!mCertificateGeneration) { @@ -494,7 +556,7 @@ namespace ortc } //------------------------------------------------------------------------- - Optional ORTC::webrtcLogLevel() const + Optional ORTC::webrtcLogLevel() const noexcept { AutoRecursiveLock lock(*this); if (mWebRTCLogLevel.hasValue()) return mWebRTCLogLevel; @@ -505,12 +567,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Stack => (internal) - #pragma mark + // + // Stack => (internal) + // //------------------------------------------------------------------------- - Log::Params ORTC::log(const char *message) const + Log::Params ORTC::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::ORTC"); UseServicesHelper::debugAppend(objectEl, "id", mID); @@ -518,42 +580,76 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params ORTC::slog(const char *message) + Log::Params ORTC::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::ORTC"); return Log::Params(message, objectEl); } + //------------------------------------------------------------------------- + void ORTC::internalSetup() noexcept + { + installAllDefaults(); + ISettings::applyDefaults(); + + UseMessageQueueManager::registerMessageQueueThreadPriority(ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME, zsLib::threadPriorityFromString(ISettings::getString(ORTC_SETTING_ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME))); + UseMessageQueueManager::registerMessageQueueThreadPriority(ORTC_QUEUE_CERTIFICATE_GENERATION_NAME, zsLib::threadPriorityFromString(ISettings::getString(ORTC_SETTING_ORTC_QUEUE_CERTIFICATE_GENERATION_NAME))); + + for (size_t index = 0; index < ORTC_QUEUE_TOTAL_MEDIA_DEVICE_THREADS; ++index) { + UseMessageQueueManager::registerMessageQueueThreadPriority( + (String(ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME) + string(index)).c_str(), + zsLib::threadPriorityFromString(ISettings::getString((String(ORTC_SETTING_ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME) + string(index)).c_str())) + ); + } + for (size_t index = 0; index < ORTC_QUEUE_TOTAL_RTP_THREADS; ++index) { + UseMessageQueueManager::registerMessageQueueThreadPriority( + (String(ORTC_QUEUE_RTP_THREAD_NAME) + string(index)).c_str(), + zsLib::threadPriorityFromString(ISettings::getString((String(ORTC_SETTING_ORTC_QUEUE_RTP_THREAD_NAME) + string(index)).c_str())) + ); + } + } + } // namespace internal //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IORTC - #pragma mark + // + // IORTC + // //--------------------------------------------------------------------------- - void IORTC::setup(IMessageQueuePtr defaultDelegateMessageQueue) + void IORTC::setup(IMessageQueuePtr defaultDelegateMessageQueue) noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return; singleton->setup(defaultDelegateMessageQueue); } +#ifdef WINUWP +#ifdef __cplusplus_winrt + //--------------------------------------------------------------------------- + void IORTC::setup(Windows::UI::Core::CoreDispatcher ^dispatcher) noexcept + { + auto singleton = internal::ORTC::singleton(); + if (!singleton) return; + singleton->setup(dispatcher); + } +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION //--------------------------------------------------------------------------- -#ifdef WINRT - void IORTC::setup(Windows::UI::Core::CoreDispatcher ^dispatcher) + void IORTC::setup(winrt::Windows::UI::Core::CoreDispatcher dispatcher) noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return; singleton->setup(dispatcher); } -#endif //WINRT +#endif //CPPWINRT_VERSION +#endif //WINUWP //------------------------------------------------------------------------- - Milliseconds IORTC::ntpServerTime() + Milliseconds IORTC::ntpServerTime() noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return Milliseconds(); @@ -561,7 +657,7 @@ namespace ortc } //------------------------------------------------------------------------- - void IORTC::ntpServerTime(const Milliseconds &value) + void IORTC::ntpServerTime(const Milliseconds &value) noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return; @@ -569,7 +665,7 @@ namespace ortc } //------------------------------------------------------------------------- - void IORTC::setDefaultLogLevel(Log::Level level) + void IORTC::setDefaultLogLevel(Log::Level level) noexcept { auto singleton = internal::ORTC::singleton(); if (singleton) { @@ -580,7 +676,7 @@ namespace ortc } //------------------------------------------------------------------------- - void IORTC::setLogLevel(const char *componenet, Log::Level level) + void IORTC::setLogLevel(const char *componenet, Log::Level level) noexcept { String str(componenet); @@ -595,19 +691,19 @@ namespace ortc } //------------------------------------------------------------------------- - void IORTC::setDefaultEventingLevel(Log::Level level) + void IORTC::setDefaultEventingLevel(Log::Level level) noexcept { UseServicesLogger::setEventingLevel(level); } //------------------------------------------------------------------------- - void IORTC::setEventingLevel(const char *componenet, Log::Level level) + void IORTC::setEventingLevel(const char *componenet, Log::Level level) noexcept { UseServicesLogger::setEventingLevel(componenet, level); } //------------------------------------------------------------------------- - void IORTC::startMediaTracing() + void IORTC::startMediaTracing() noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return; @@ -615,7 +711,7 @@ namespace ortc } //------------------------------------------------------------------------- - void IORTC::stopMediaTracing() + void IORTC::stopMediaTracing() noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return; @@ -623,7 +719,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool IORTC::isMediaTracing() + bool IORTC::isMediaTracing() noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return false; @@ -631,7 +727,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool IORTC::saveMediaTrace(String filename) + bool IORTC::saveMediaTrace(String filename) noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return false; @@ -639,7 +735,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool IORTC::saveMediaTrace(String host, int port) + bool IORTC::saveMediaTrace(String host, int port) noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return false; @@ -647,7 +743,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool IORTC::isMRPInstalled() + bool IORTC::isMRPInstalled() noexcept { auto singleton = internal::ORTC::singleton(); if (!singleton) return false; diff --git a/ortc/cpp/ortc_RTCPPacket.cpp b/ortc/cpp/ortc_RTCPPacket.cpp index 01936d2a..571bffb1 100644 --- a/ortc/cpp/ortc_RTCPPacket.cpp +++ b/ortc/cpp/ortc_RTCPPacket.cpp @@ -29,7 +29,9 @@ */ -#include +#include +#include + #include #include #include @@ -42,50 +44,47 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - #define RTCP_IS_FLAG_SET(xByte, xBitPos) (0 != ((xByte) & (1 << xBitPos))) #define RTCP_GET_BITS(xByte, xBitPattern, xLowestBit) (((xByte) >> (xLowestBit)) & (xBitPattern)) #define RTCP_PACK_BITS(xByte, xBitPattern, xLowestBit) (((xByte) & (xBitPattern)) << (xLowestBit)) -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtp_rtcp_packet) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_rtcp_packet) } namespace ortc { - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper) + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper); + ZS_DECLARE_TYPEDEF_PTR(ortc::internal::Helper, UseHelper); + ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTPUtils, UseRTPUtils); + + using zsLib::PTRNUMBER; + // ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP) // // typedef ortc::services::Hasher SHA1Hasher; namespace internal { - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::Helper, UseHelper) //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // static const size_t kMinRtcpPacketLen = 4; static const BYTE kRtpVersion = 2; //------------------------------------------------------------------------- - static Log::Params packet_slog(const char *message) + static Log::Params packet_slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::RTCPPacket"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - static size_t alignedSize(size_t size) + static size_t alignedSize(size_t size) noexcept { size_t modulas = size % alignof(std::max_align_t); @@ -93,32 +92,32 @@ namespace ortc } //------------------------------------------------------------------------- - static void advancePos(BYTE * &ioPos, size_t &ioRemaining, size_t length = 1) + static void advancePos(BYTE * &ioPos, size_t &ioRemaining, size_t length = 1) noexcept { - ASSERT(ioRemaining >= length) + ZS_ASSERT(ioRemaining >= length); ioPos += length; ioRemaining -= length; } //------------------------------------------------------------------------- - static void advancePos(const BYTE * &ioPos, size_t &ioRemaining, size_t length = 1) + static void advancePos(const BYTE * &ioPos, size_t &ioRemaining, size_t length = 1) noexcept { - ASSERT(ioRemaining >= length) + ZS_ASSERT(ioRemaining >= length); ioPos += length; ioRemaining -= length; } //------------------------------------------------------------------------- - static void *allocateBuffer(BYTE * &ioAllocationBuffer, size_t &ioRemaining, size_t size) + static void *allocateBuffer(BYTE * &ioAllocationBuffer, size_t &ioRemaining, size_t size) noexcept { size = alignedSize(size); void *result = ioAllocationBuffer; ioAllocationBuffer += size; - ASSERT(ioRemaining >= size) + ZS_ASSERT(ioRemaining >= size); ioRemaining -= size; return result; @@ -128,7 +127,7 @@ namespace ortc static size_t boundarySize( size_t size, size_t alignment = sizeof(DWORD) - ) + ) noexcept { size_t modulus = size % alignment; if (0 == modulus) return size; @@ -139,10 +138,10 @@ namespace ortc static bool throwIfGreaterThanBitsAllow( size_t value, size_t maxBits - ) + ) noexcept(false) { - ASSERT(value <= static_cast(((1 << maxBits)-1))) - ORTC_THROW_INVALID_PARAMETERS_IF(value > static_cast(((1 << maxBits)-1))) + ZS_ASSERT(value <= static_cast(((1 << maxBits) - 1))); + ORTC_THROW_INVALID_PARAMETERS_IF(value > static_cast(((1 << maxBits) - 1))); return true; } @@ -150,5848 +149,6165 @@ namespace ortc static bool throwIfLessThan( size_t size, size_t min - ) + ) noexcept(false) { - ASSERT(size >= min) - ORTC_THROW_INVALID_PARAMETERS_IF(size < min) + ZS_ASSERT(size >= min); + ORTC_THROW_INVALID_PARAMETERS_IF(size < min); return true; } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SenderReport - #pragma mark - - //------------------------------------------------------------------------- - const char *RTCPPacket::Report::ptToString(BYTE pt) - { - switch (pt) { - case SenderReport::kPayloadType: return "SenderReport"; - case ReceiverReport::kPayloadType: return "ReceiverReport"; - case SDES::kPayloadType: return "SDES"; - case Bye::kPayloadType: return "Bye"; - case App::kPayloadType: return "App"; - case TransportLayerFeedbackMessage::kPayloadType: return "TransportLayerFeedbackMessage"; - case PayloadSpecificFeedbackMessage::kPayloadType: return "PayloadSpecificFeedbackMessage"; - case XR::kPayloadType: return "XR"; - default: { - } - } - return "Uknown"; - } - //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SenderReport - #pragma mark + // + // RTCPPacket (writing sizing routines) + // //------------------------------------------------------------------------- - Time RTCPPacket::SenderReport::ntpTimestamp() const + static size_t getPacketSizeSenderReport(const RTCPPacket::SenderReport *report) noexcept(false) { - return RTPUtils::ntpToTime(mNTPTimestampMS, mNTPTimestampLS); + auto rc = report->rc(); + throwIfGreaterThanBitsAllow(rc, 5); + return (sizeof(DWORD)*2) + (sizeof(DWORD)*5) + ((sizeof(DWORD)*6)*rc) + boundarySize(report->extensionSize()); } //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::StringItem - #pragma mark - - //------------------------------------------------------------------------- - const char *RTCPPacket::SDES::Chunk::StringItem::typeToString(BYTE type) + static size_t getPacketSizeReceiverReport(const RTCPPacket::ReceiverReport *report) noexcept(false) { - switch (type) { - case CName::kItemType: return "CName"; - case Name::kItemType: return "Name"; - case Email::kItemType: return "Email"; - case Phone::kItemType: return "Phone"; - case Loc::kItemType: return "Loc"; - case Tool::kItemType: return "Tool"; - case Note::kItemType: return "Note"; - case Priv::kItemType: return "Priv"; - case Mid::kItemType: return "Mid"; - case Rid::kItemType: return "Rid"; - default: { - break; - } - } - return "Unknown"; + auto rc = report->rc(); + throwIfGreaterThanBitsAllow(rc, 5); + return (sizeof(DWORD)*2) + ((sizeof(DWORD)*6)*rc) + boundarySize(report->extensionSize()); } //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk - #pragma mark - - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::CName *RTCPPacket::SDES::Chunk::cNameAtIndex(size_t index) const + static size_t getPacketSizeSDES(const RTCPPacket::SDES *report) noexcept(false) { - ASSERT(index < mCNameCount) - return &(mFirstCName[index]); - } + typedef RTCPPacket::SDES::Chunk Chunk; - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Name *RTCPPacket::SDES::Chunk::nameAtIndex(size_t index) const - { - ASSERT(index < mNameCount) - return &(mFirstName[index]); - } + size_t result = (sizeof(DWORD)); - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Email *RTCPPacket::SDES::Chunk::emailAtIndex(size_t index) const - { - ASSERT(index < mEmailCount) - return &(mFirstEmail[index]); - } + size_t chunkCount = 0; - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Phone *RTCPPacket::SDES::Chunk::phoneAtIndex(size_t index) const - { - ASSERT(index < mPhoneCount) - return &(mFirstPhone[index]); - } + for (Chunk *chunk = report->firstChunk(); NULL != chunk; chunk = chunk->next(), ++chunkCount) + { + size_t chunkSize = sizeof(DWORD); - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Loc *RTCPPacket::SDES::Chunk::locAtIndex(size_t index) const - { - ASSERT(index < mLocCount) - return &(mFirstLoc[index]); - } + for (auto *item = chunk->firstCName(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES CName size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Tool *RTCPPacket::SDES::Chunk::toolAtIndex(size_t index) const - { - ASSERT(index < mToolCount) - return &(mFirstTool[index]); - } + for (auto *item = chunk->firstName(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Name size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Note *RTCPPacket::SDES::Chunk::noteAtIndex(size_t index) const - { - ASSERT(index < mNoteCount) - return &(mFirstNote[index]); - } + for (auto *item = chunk->firstEmail(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Email size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Priv *RTCPPacket::SDES::Chunk::privAtIndex(size_t index) const - { - ASSERT(index < mPrivCount) - return &(mFirstPriv[index]); - } + for (auto *item = chunk->firstPhone(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Phone size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Mid *RTCPPacket::SDES::Chunk::midAtIndex(size_t index) const - { - ASSERT(index < mMidCount) - return &(mFirstMid[index]); - } + for (auto *item = chunk->firstLoc(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Loc size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Rid *RTCPPacket::SDES::Chunk::ridAtIndex(size_t index) const - { - ASSERT(index < mRidCount) - return &(mFirstRid[index]); - } + for (auto *item = chunk->firstTool(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Tool size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES::Chunk::Unknown *RTCPPacket::SDES::Chunk::unknownAtIndex(size_t index) const - { - ASSERT(index < mUnknownCount) - return &(mFirstUnknown[index]); - } + for (auto *item = chunk->firstNote(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Note size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::Bye - #pragma mark + for (auto *item = chunk->firstPriv(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len1 = (NULL != item->mValue ? strlen(item->mValue) : 0); + size_t len2 = (NULL != item->mPrefix ? strlen(item->mPrefix) : 0); - //------------------------------------------------------------------------- - DWORD RTCPPacket::Bye::ssrc(size_t index) const - { - ASSERT(index < sc()) - return mSSRCs[index]; - } + size_t totalLen = len1 + len2; + if (0 != totalLen) ++totalLen; - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::FeedbackMessage - #pragma mark + throwIfGreaterThanBitsAllow(totalLen, 8); + chunkSize += ((sizeof(BYTE))*totalLen); + ZS_LOG_INSANE(packet_slog("get packet SDES Priv size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("prefix len", len2) + ZS_PARAM("prefix", (NULL != item->mPrefix ? item->mPrefix : NULL)) + ZS_PARAM("len", len1) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - const char *RTCPPacket::FeedbackMessage::fmtToString(BYTE pt, BYTE fmt, DWORD subFmt) - { - switch (pt) { - case TransportLayerFeedbackMessage::kPayloadType: { - switch (fmt) { - case TransportLayerFeedbackMessage::GenericNACK::kFmt: return "GenericNACK"; - case TransportLayerFeedbackMessage::TMMBR::kFmt: return "TMMBR"; - case TransportLayerFeedbackMessage::TMMBN::kFmt: return "TMMBN"; - default: break; - } - break; + for (auto *item = chunk->firstMid(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Mid size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) } - case PayloadSpecificFeedbackMessage::kPayloadType: { - switch (fmt) { - case PayloadSpecificFeedbackMessage::PLI::kFmt: return "PLI"; - case PayloadSpecificFeedbackMessage::SLI::kFmt: return "SLI"; - case PayloadSpecificFeedbackMessage::RPSI::kFmt: return "RPSI"; - case PayloadSpecificFeedbackMessage::FIR::kFmt: return "FIR"; - case PayloadSpecificFeedbackMessage::TSTR::kFmt: return "TSTR"; - case PayloadSpecificFeedbackMessage::TSTN::kFmt: return "TSTN"; - case PayloadSpecificFeedbackMessage::VBCM::kFmt: return "VBCM"; - case PayloadSpecificFeedbackMessage::AFB::kFmt: { - const char *tmp = "REMB"; - if (subFmt == *(reinterpret_cast(tmp))) return "REMB"; - return "AFB"; - } - default: break; - } - break; + + for (auto *item = chunk->firstRid(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Rid size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) } - default: { - break; + for (auto *item = chunk->firstUnknown(); NULL != item; item = item->next()) + { + chunkSize += (sizeof(BYTE)*2); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + throwIfGreaterThanBitsAllow(len, 8); + chunkSize += ((sizeof(BYTE))*len); + ZS_LOG_INSANE(packet_slog("get packet SDES Unknown size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) } - } - return "Unknown"; - } - //------------------------------------------------------------------------- - const char *RTCPPacket::FeedbackMessage::fmtToString() const - { - if (PayloadSpecificFeedbackMessage::kPayloadType == mPT) { - if (PayloadSpecificFeedbackMessage::AFB::kFmt == mReportSpecific) { - auto result = reinterpret_cast(this); - const char tmp1[sizeof(DWORD)] {}; - const char *tmp2 = "REMB"; - const char *usingTmp = (result->mHasREMB ? tmp2 : (&(tmp1[0]))); + size_t modulas = chunkSize % sizeof(DWORD); - return fmtToString(mPT, mReportSpecific, *(reinterpret_cast(usingTmp))); + if ((chunkSize == sizeof(DWORD)) || + (0 == modulas)) { + chunkSize += sizeof(DWORD); } - } - return fmtToString(mPT, mReportSpecific); - } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage - #pragma mark - - //------------------------------------------------------------------------- - RTCPPacket::TransportLayerFeedbackMessage::GenericNACK *RTCPPacket::TransportLayerFeedbackMessage::genericNACKAtIndex(size_t index) const - { - ASSERT(index < mGenericNACKCount) - return &(mFirstGenericNACK[index]); - } + result += boundarySize(chunkSize); + } - //------------------------------------------------------------------------- - RTCPPacket::TransportLayerFeedbackMessage::TMMBR *RTCPPacket::TransportLayerFeedbackMessage::tmmbrAtIndex(size_t index) const - { - ASSERT(index < mTMMBRCount) - return &(mFirstTMMBR[index]); + throwIfGreaterThanBitsAllow(chunkCount, 5); + return result; } //------------------------------------------------------------------------- - RTCPPacket::TransportLayerFeedbackMessage::TMMBN *RTCPPacket::TransportLayerFeedbackMessage::tmmbnAtIndex(size_t index) const + static size_t getPacketSizeBye(const RTCPPacket::Bye *report) noexcept(false) { - ASSERT(index < mTMMBNCount) - return &(mFirstTMMBN[index]); - } + auto sc = report->sc(); + throwIfGreaterThanBitsAllow(sc, 5); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::VBCM - #pragma mark + size_t result = (sizeof(DWORD)) + (sizeof(DWORD)*sc); - //------------------------------------------------------------------------- - BYTE RTCPPacket::PayloadSpecificFeedbackMessage::VBCM::zeroBit() const - { - return RTCP_GET_BITS(mControlSpecific, 0x1, 23); - } + if (NULL != report->reasonForLeaving()) { + size_t len = strlen(report->reasonForLeaving()); + if (len > 0) { + throwIfGreaterThanBitsAllow(len, 8); + result += sizeof(BYTE)+(sizeof(BYTE)*len); + } + } - //------------------------------------------------------------------------- - BYTE RTCPPacket::PayloadSpecificFeedbackMessage::VBCM::payloadType() const - { - return RTCP_GET_BITS(mControlSpecific, 0x7F, 16); + return boundarySize(result); } //------------------------------------------------------------------------- - size_t RTCPPacket::PayloadSpecificFeedbackMessage::VBCM::vbcmOctetStringSize() const + static size_t getPacketSizeApp(const RTCPPacket::App *report) noexcept(false) { - return RTCP_GET_BITS(mControlSpecific, 0xFFFF, 0); - } + size_t result = (sizeof(DWORD)*3); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::REMB - #pragma mark + auto dataSize = report->dataSize(); + if (0 != dataSize) { + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == report->mData) + result += dataSize; + } - //------------------------------------------------------------------------- - DWORD RTCPPacket::PayloadSpecificFeedbackMessage::REMB::ssrcAtIndex(size_t index) const - { - ASSERT(index < numSSRC()) - return mSSRCs[index]; + return boundarySize(result); } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage - #pragma mark - + //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::PLI *RTCPPacket::PayloadSpecificFeedbackMessage::pli() const + static size_t getPacketSizeTransportLayerFeedbackMessage(const RTCPPacket::TransportLayerFeedbackMessage *fm) noexcept(false) { - if (PLI::kFmt != fmt()) return NULL; - return const_cast(&mPLI); - } + //typedef RTCPPacket::TransportLayerFeedbackMessage TransportLayerFeedbackMessage; + typedef RTCPPacket::TransportLayerFeedbackMessage::GenericNACK GenericNACK; + typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBR TMMBR; + typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBN TMMBN; - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::SLI *RTCPPacket::PayloadSpecificFeedbackMessage::sliAtIndex(size_t index) const - { - ASSERT(index < mSLICount) - return &(mFirstSLI[index]); - } + size_t result = (sizeof(DWORD)*3); - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::FIR *RTCPPacket::PayloadSpecificFeedbackMessage::firAtIndex(size_t index) const - { - ASSERT(index < mFIRCount) - return &(mFirstFIR[index]); - } - - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::TSTR *RTCPPacket::PayloadSpecificFeedbackMessage::tstrAtIndex(size_t index) const - { - ASSERT(index < mTSTRCount) - return &(mFirstTSTR[index]); - } + switch (fm->fmt()) { + case GenericNACK::kFmt: + { + auto count = fm->genericNACKCount(); + throwIfLessThan(count, 1); + result += ((sizeof(DWORD))*(count)); + break; + } + case TMMBR::kFmt: + { + auto count = fm->tmmbrCount(); + throwIfLessThan(count, 1); + result += ((sizeof(DWORD)*2)*(count)); + break; + } + case TMMBN::kFmt: + { + auto count = fm->tmmbnCount(); + result += ((sizeof(DWORD)*2)*(count)); + break; + } + default: + { + auto fciSize = fm->fciSize(); + if (0 != fciSize) { + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == fm->fci()); + result += fciSize; + } + break; + } + } - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::TSTN *RTCPPacket::PayloadSpecificFeedbackMessage::tstnAtIndex(size_t index) const - { - ASSERT(index < mTSTNCount) - return &(mFirstTSTN[index]); - } + ZS_LOG_INSANE(packet_slog("getting transport layer feedback message packet size") + ZS_PARAM("fmt", fm->fmtToString()) + ZS_PARAM("fmt (number)", fm->reportSpecific()) + ZS_PARAM("size", result)) - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::VBCM *RTCPPacket::PayloadSpecificFeedbackMessage::vbcmAtIndex(size_t index) const - { - ASSERT(index < mVBCMCount) - return &(mFirstVBCM[index]); + return boundarySize(result); } //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::RPSI *RTCPPacket::PayloadSpecificFeedbackMessage::rpsi() const + static size_t getPacketSizePayloadSpecificFeedbackMessage(const RTCPPacket::PayloadSpecificFeedbackMessage *fm) noexcept(false) { - if (RPSI::kFmt != fmt()) return NULL; - return const_cast(&mRPSI); - } + //typedef RTCPPacket::PayloadSpecificFeedbackMessage PayloadSpecificFeedbackMessage; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::PLI PLI; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::SLI SLI; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::RPSI RPSI; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::FIR FIR; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTR TSTR; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTN TSTN; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::VBCM VBCM; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::AFB AFB; + //typedef RTCPPacket::PayloadSpecificFeedbackMessage::REMB REMB; - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::AFB *RTCPPacket::PayloadSpecificFeedbackMessage::afb() const - { - if (AFB::kFmt != fmt()) return NULL; - if (mHasREMB) return NULL; - return const_cast(&mAFB); - } + size_t result = (sizeof(DWORD)*3); - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage::REMB *RTCPPacket::PayloadSpecificFeedbackMessage::remb() const - { - if (REMB::kFmt != fmt()) return NULL; - if (!mHasREMB) return NULL; - return const_cast(&mREMB); - } + switch (fm->fmt()) { + case PLI::kFmt: + { + break; + } + case SLI::kFmt: + { + auto count = fm->sliCount(); + throwIfLessThan(count, 1); + result += (sizeof(DWORD)*(count)); + break; + } + case RPSI::kFmt: + { + auto rpsi = fm->rpsi(); + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == rpsi); + result += sizeof(WORD) + (rpsi->nativeRPSIBitStringSizeInBits()/8); + if (0 != (rpsi->nativeRPSIBitStringSizeInBits()%8)) ++result; + break; + } + case FIR::kFmt: + { + auto count = fm->firCount(); + throwIfLessThan(count, 1); + result += ((sizeof(DWORD)*2)*(count)); + break; + } + case TSTR::kFmt: + { + auto count = fm->tstrCount(); + throwIfLessThan(count, 1); + result += ((sizeof(DWORD)*2)*(count)); + break; + } + case TSTN::kFmt: + { + auto count = fm->tstnCount(); + throwIfLessThan(count, 1); + result += ((sizeof(DWORD)*2)*(count)); + break; + } + case VBCM::kFmt: + { + auto count = fm->vbcmCount(); + throwIfLessThan(count, 1); + for (size_t index = 0; index < count; ++index) + { + auto vbcm = fm->vbcmAtIndex(index); + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == vbcm); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::ReportBlock - #pragma mark + size_t size = (sizeof(DWORD)*2) + (vbcm->vbcmOctetStringSize()*sizeof(BYTE)); + result += boundarySize(size); + } + break; + } + case AFB::kFmt: + { + auto remb = fm->remb(); + if (NULL == remb) { + auto afb = fm->afb(); + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == afb); - //------------------------------------------------------------------------- - const char *RTCPPacket::XR::ReportBlock::blockTypeToString(BYTE blockType) - { - switch (blockType) { - case LossRLEReportBlock::kBlockType: return "LossRLEReportBlock"; - case DuplicateRLEReportBlock::kBlockType: return "DuplicateRLEReportBlock"; - case PacketReceiptTimesReportBlock::kBlockType: return "PacketReceiptTimesReportBlock"; - case ReceiverReferenceTimeReportBlock::kBlockType: return "ReceiverReferenceTimeReportBlock"; - case DLRRReportBlock::kBlockType: return "DLRRReportBlock"; - case StatisticsSummaryReportBlock::kBlockType: return "StatisticsSummaryReportBlock"; - case VoIPMetricsReportBlock::kBlockType: return "VoIPMetricsReportBlock"; - default: { + result += afb->dataSize(); + } else { + result += (sizeof(DWORD)*2); + size_t numSSRCs = remb->numSSRC(); + throwIfGreaterThanBitsAllow(numSSRCs, 8); + throwIfLessThan(numSSRCs, 1); + result += ((sizeof(DWORD))*numSSRCs); + } + break; + } + default: + { + auto fciSize = fm->fciSize(); + if (0 != fciSize) { + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == fm->fci()); + result += fciSize; + } break; } } - return "UnknownReportBlock"; - } + ZS_LOG_INSANE(packet_slog("getting payload specific feedback message packet size") + ZS_PARAM("fmt", fm->fmtToString()) + ZS_PARAM("fmt (number)", fm->reportSpecific()) + ZS_PARAM("size", result)) - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::ReportBlockRange - #pragma mark + return boundarySize(result); + } //------------------------------------------------------------------------- - BYTE RTCPPacket::XR::ReportBlockRange::reserved() const + static size_t getPacketSizeXR(const RTCPPacket::XR *report) noexcept { - return RTCP_GET_BITS(mTypeSpecific, 0xF, 4); + //typedef RTCPPacket::XR XR; + typedef RTCPPacket::XR::ReportBlock ReportBlock; + typedef RTCPPacket::XR::LossRLEReportBlock LossRLEReportBlock; + typedef RTCPPacket::XR::DuplicateRLEReportBlock DuplicateRLEReportBlock; + typedef RTCPPacket::XR::PacketReceiptTimesReportBlock PacketReceiptTimesReportBlock; + typedef RTCPPacket::XR::ReceiverReferenceTimeReportBlock ReceiverReferenceTimeReportBlock; + typedef RTCPPacket::XR::DLRRReportBlock DLRRReportBlock; + typedef RTCPPacket::XR::StatisticsSummaryReportBlock StatisticsSummaryReportBlock; + typedef RTCPPacket::XR::VoIPMetricsReportBlock VoIPMetricsReportBlock; + //typedef RTCPPacket::XR::UnknownReportBlock UnknownReportBlock; + + size_t result = (sizeof(DWORD)*2); + + for (const ReportBlock *reportBlock = report->firstReportBlock(); NULL != reportBlock; reportBlock = reportBlock->next()) + { + size_t preSize = result; + + switch (reportBlock->mBlockType) { + case LossRLEReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + result += (sizeof(DWORD)*3); + result += boundarySize(sizeof(WORD)*(block->chunkCount())); + break; + } + case DuplicateRLEReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + result += (sizeof(DWORD)*3); + result += boundarySize(sizeof(WORD)*(block->chunkCount())); + break; + } + case PacketReceiptTimesReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + result += (sizeof(DWORD)*3); + result += (sizeof(DWORD)*(block->receiptTimeCount())); + break; + } + case ReceiverReferenceTimeReportBlock::kBlockType: + { + result += (sizeof(DWORD)*3); + break; + } + case DLRRReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + result += (sizeof(DWORD)); + result += ((sizeof(DWORD)*3)*(block->subBlockCount())); + break; + } + case StatisticsSummaryReportBlock::kBlockType: + { + result += (sizeof(DWORD)*10); + break; + } + case VoIPMetricsReportBlock::kBlockType: + { + result += (sizeof(DWORD)*9); + break; + } + default: + { + result += (sizeof(DWORD)) + boundarySize(reportBlock->mTypeSpecificContentSize); + } + } + + ZS_LOG_INSANE(packet_slog("XR block packet size") + ZS_PARAM("block type", reportBlock->blockTypeToString()) + ZS_PARAM("block type (number)", reportBlock->blockType()) + ZS_PARAM("size", result - preSize)) + } + + return boundarySize(result); } //------------------------------------------------------------------------- - BYTE RTCPPacket::XR::ReportBlockRange::thinning() const + static void writePacketUnknown(const RTCPPacket::UnknownReport *report, BYTE * &pos, size_t &remaining) noexcept { - return RTCP_GET_BITS(mTypeSpecific, 0xF, 0); - } + //typedef RTCPPacket::UnknownReport UnknownReport; + pos[1] = report->pt(); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::RLEReportBlock - #pragma mark + advancePos(pos, remaining, sizeof(DWORD)); - //------------------------------------------------------------------------- - RTCPPacket::XR::RLEChunk RTCPPacket::XR::RLEReportBlock::chunkAtIndex(size_t index) const - { - ASSERT(index < chunkCount()) - return mChunks[index]; - } + auto size = report->size(); + if (0 == size) return; - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::PacketReceiptTimesReportBlock - #pragma mark + ZS_ASSERT(NULL != report->ptr()); - //------------------------------------------------------------------------- - DWORD RTCPPacket::XR::PacketReceiptTimesReportBlock::receiptTimeAtIndex(size_t index) const - { - ASSERT(index < receiptTimeCount()) - return mReceiptTimes[index]; + memcpy(pos, report->ptr(), size); + + advancePos(pos, remaining, size); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::ReceiverReferenceTimeReportBlock - #pragma mark + // + // RTCPPacket (packet writing routines) + // //------------------------------------------------------------------------- - Time RTCPPacket::XR::ReceiverReferenceTimeReportBlock::ntpTimestamp() const + static void writePacketHeader(const RTCPPacket::Report *report, BYTE * &pos, ZS_MAYBE_USED() size_t &remaining) noexcept { - return RTPUtils::ntpToTime(mNTPTimestampMS, mNTPTimestampLS); - } + ZS_MAYBE_USED(remaining); + ZS_ASSERT(remaining >= sizeof(DWORD)) + ZS_ASSERT(2 == report->version()) - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::DLRRReportBlock - #pragma mark + auto padding = report->padding(); + if (0 != padding) { + ZS_ASSERT(NULL == report->next()) + ZS_ASSERT(throwIfGreaterThanBitsAllow(padding, 8)) + } - //------------------------------------------------------------------------- - RTCPPacket::XR::DLRRReportBlock::SubBlock *RTCPPacket::XR::DLRRReportBlock::subBlockAtIndex(size_t index) const - { - ASSERT(index < subBlockCount()) - return &(mSubBlocks[index]); - } + ZS_ASSERT(throwIfGreaterThanBitsAllow(report->reportSpecific(), 5)) - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::StatisticsSummaryReportBlock - #pragma mark + pos[0] = RTCP_PACK_BITS(report->version(), 0x3, 6) | + ((0 != padding) ? RTCP_PACK_BITS(1, 0x1, 5) : 0) | + RTCP_PACK_BITS(report->reportSpecific(), 0x1F, 0); + pos[1] = report->pt(); + } //------------------------------------------------------------------------- - bool RTCPPacket::XR::StatisticsSummaryReportBlock::lossReportFlag() const + static void writePacketSenderReceiverCommonReport(const RTCPPacket::SenderReceiverCommonReport *report, BYTE * &pos, size_t &remaining) noexcept { - return RTCP_IS_FLAG_SET(mTypeSpecific, 7); - } - - //------------------------------------------------------------------------- - bool RTCPPacket::XR::StatisticsSummaryReportBlock::duplicateReportFlag() const - { - return RTCP_IS_FLAG_SET(mTypeSpecific, 6); - } - - //------------------------------------------------------------------------- - bool RTCPPacket::XR::StatisticsSummaryReportBlock::jitterFlag() const - { - return RTCP_IS_FLAG_SET(mTypeSpecific, 5); - } + //typedef RTCPPacket::SenderReceiverCommonReport SenderReceiverCommonReport; + typedef RTCPPacket::SenderReceiverCommonReport::ReportBlock ReportBlock; - //------------------------------------------------------------------------- - bool RTCPPacket::XR::StatisticsSummaryReportBlock::ttlFlag() const - { - return (1 == RTCP_GET_BITS(mTypeSpecific, 0x3, 3)); - } + size_t count = 0; + for (const ReportBlock *block = report->firstReportBlock(); NULL != block; block = block->next(), ++count) + { + ZS_ASSERT(count < report->rc()); - //------------------------------------------------------------------------- - bool RTCPPacket::XR::StatisticsSummaryReportBlock::hopLimitFlag() const - { - return (2 == RTCP_GET_BITS(mTypeSpecific, 0x3, 3)); - } + UseRTPUtils::setBE32(&(pos[0]), block->ssrc()); + ZS_ASSERT(throwIfGreaterThanBitsAllow(block->cumulativeNumberOfPacketsLost(), 24)); + UseRTPUtils::setBE32(&(pos[4]), block->cumulativeNumberOfPacketsLost()); + pos[4] = block->fractionLost(); + UseRTPUtils::setBE32(&(pos[8]), block->extendedHighestSequenceNumberReceived()); + UseRTPUtils::setBE32(&(pos[12]), block->interarrivalJitter()); + UseRTPUtils::setBE32(&(pos[16]), block->lsr()); + UseRTPUtils::setBE32(&(pos[20]), block->dlsr()); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::VoIPMetricsReportBlock - #pragma mark + advancePos(pos, remaining, sizeof(DWORD)*6); + } - //------------------------------------------------------------------------- - BYTE RTCPPacket::XR::VoIPMetricsReportBlock::plc() const - { - return RTCP_GET_BITS(mRXConfig, 0x3, 6); - } + ZS_ASSERT(count == report->rc()) - //------------------------------------------------------------------------- - BYTE RTCPPacket::XR::VoIPMetricsReportBlock::jba() const - { - return RTCP_GET_BITS(mRXConfig, 0x3, 4); + if (report->extensionSize() > 0) { + ZS_ASSERT(NULL != report->extension()); + memcpy(pos, report->extension(), report->extensionSize()); + advancePos(pos, remaining, boundarySize(report->extensionSize())); + } } - + //------------------------------------------------------------------------- - BYTE RTCPPacket::XR::VoIPMetricsReportBlock::jbRate() const + static void writePacketSenderReport(const RTCPPacket::SenderReport *report, BYTE * &pos, size_t &remaining) noexcept { - return RTCP_GET_BITS(mRXConfig, 0xF, 0); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::RunLength - #pragma mark + typedef RTCPPacket::SenderReport SenderReport; + pos[1] = SenderReport::kPayloadType; - //------------------------------------------------------------------------- - RTCPPacket::XR::RunLength::RunLength(RLEChunk chunk) : - mRunType(RTCP_GET_BITS(chunk, 0x1, 14)), - mRunLength(RTCP_GET_BITS(chunk, 0x3FFF, 0)) - { - } + UseRTPUtils::setBE32(&(pos[4]), report->ssrcOfSender()); + UseRTPUtils::setBE32(&(pos[8]), report->ntpTimestampMS()); + UseRTPUtils::setBE32(&(pos[12]), report->ntpTimestampLS()); + UseRTPUtils::setBE32(&(pos[16]), report->rtpTimestamp()); + UseRTPUtils::setBE32(&(pos[20]), report->senderPacketCount()); + UseRTPUtils::setBE32(&(pos[24]), report->senderOctetCount()); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::BitVector - #pragma mark + advancePos(pos, remaining, sizeof(DWORD)*7); - //------------------------------------------------------------------------- - RTCPPacket::XR::BitVector::BitVector(RLEChunk chunk) : - mBitVector(RTCP_GET_BITS(chunk, 0x7FFF, 0)) - { + writePacketSenderReceiverCommonReport(report, pos, remaining); } //------------------------------------------------------------------------- - BYTE RTCPPacket::XR::BitVector::bitAtIndex(size_t index) const + static void writePacketReceiverReport(const RTCPPacket::ReceiverReport *report, BYTE * &pos, size_t &remaining) noexcept { - ASSERT(index < (sizeof(WORD)*8)) - return (mBitVector >> ((sizeof(WORD)*8)-index-1)) & 0x1; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR - #pragma mark + typedef RTCPPacket::ReceiverReport ReceiverReport; + pos[1] = ReceiverReport::kPayloadType; - //------------------------------------------------------------------------- - RTCPPacket::XR::LossRLEReportBlock *RTCPPacket::XR::lossRLEReportBlockAtIndex(size_t index) const - { - ASSERT(index < mLossRLEReportBlockCount) - return &(mFirstLossRLEReportBlock[index]); - } + UseRTPUtils::setBE32(&(pos[4]), report->ssrcOfPacketSender()); - //------------------------------------------------------------------------- - RTCPPacket::XR::DuplicateRLEReportBlock *RTCPPacket::XR::duplicateRLEReportBlockAtIndex(size_t index) const - { - ASSERT(index < mDuplicateRLEReportBlockCount) - return &(mFirstDuplicateRLEReportBlock[index]); - } + advancePos(pos, remaining, sizeof(DWORD)*2); - //------------------------------------------------------------------------- - RTCPPacket::XR::PacketReceiptTimesReportBlock *RTCPPacket::XR::packetReceiptTimesReportBlockAtIndex(size_t index) const - { - ASSERT(index < mPacketReceiptTimesReportBlockCount) - return &(mFirstPacketReceiptTimesReportBlock[index]); + writePacketSenderReceiverCommonReport(report, pos, remaining); } - + //------------------------------------------------------------------------- - RTCPPacket::XR::ReceiverReferenceTimeReportBlock *RTCPPacket::XR::receiverReferenceTimeReportBlockAtIndex(size_t index) const + static void writePacketSDES(const RTCPPacket::SDES *report, BYTE * &pos, size_t &remaining) noexcept { - ASSERT(index < mReceiverReferenceTimeReportBlockCount) - return &(mFirstReceiverReferenceTimeReportBlock[index]); - } + typedef RTCPPacket::SDES SDES; + typedef RTCPPacket::SDES::Chunk Chunk; - //------------------------------------------------------------------------- - RTCPPacket::XR::DLRRReportBlock *RTCPPacket::XR::dlrrReportBlockAtIndex(size_t index) const - { - ASSERT(index < mDLRRReportBlockCount) - return &(mFirstDLRRReportBlock[index]); - } + pos[1] = SDES::kPayloadType; - //------------------------------------------------------------------------- - RTCPPacket::XR::StatisticsSummaryReportBlock *RTCPPacket::XR::statisticsSummaryReportBlockAtIndex(size_t index) const - { - ASSERT(index < mStatisticsSummaryReportBlockCount) - return &(mFirstStatisticsSummaryReportBlock[index]); - } + advancePos(pos, remaining, sizeof(DWORD)); - //------------------------------------------------------------------------- - RTCPPacket::XR::VoIPMetricsReportBlock *RTCPPacket::XR::voIPMetricsReportBlockAtIndex(size_t index) const - { - ASSERT(index < mVoIPMetricsReportBlockCount) - return &(mFirstVoIPMetricsReportBlock[index]); - } + size_t chunkCount = 0; - //------------------------------------------------------------------------- - RTCPPacket::XR::UnknownReportBlock *RTCPPacket::XR::unknownReportBlockAtIndex(size_t index) const - { - ASSERT(index < mUnknownReportBlockCount) - return &(mFirstUnknownReportBlock[index]); - } + for (Chunk *chunk = report->firstChunk(); NULL != chunk; chunk = chunk->next(), ++chunkCount) + { + UseRTPUtils::setBE32(pos, chunk->ssrc()); + advancePos(pos, remaining, sizeof(DWORD)); - //------------------------------------------------------------------------- - bool RTCPPacket::XR::isRunLengthChunk(RLEChunk chunk) - { - return !RTCP_IS_FLAG_SET(chunk, 15); - } + BYTE *startPos = pos; - //------------------------------------------------------------------------- - bool RTCPPacket::XR::isBitVectorChunk(RLEChunk chunk) - { - return RTCP_IS_FLAG_SET(chunk, 15); - } + for (auto *item = chunk->firstCName(); NULL != item; item = item->next()) + { + pos[0] = Chunk::CName::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket (public) - #pragma mark + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - RTCPPacket::RTCPPacket(const make_private &) - { - } + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES CName") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::~RTCPPacket() - { - } + for (auto *item = chunk->firstName(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Name::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - RTCPPacketPtr RTCPPacket::create(const BYTE *buffer, size_t bufferLengthInBytes) - { - ORTC_THROW_INVALID_PARAMETERS_IF(!buffer) - ORTC_THROW_INVALID_PARAMETERS_IF(0 == bufferLengthInBytes) - return RTCPPacket::create(UseServicesHelper::convertToBuffer(buffer, bufferLengthInBytes)); - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - RTCPPacketPtr RTCPPacket::create(const SecureByteBlock &buffer) - { - return RTCPPacket::create(buffer.BytePtr(), buffer.SizeInBytes()); - } + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Name") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacketPtr RTCPPacket::create(SecureByteBlockPtr buffer) - { - RTCPPacketPtr pThis(make_shared(make_private{})); - pThis->mBuffer = buffer; - if (!pThis->parse()) { - ZS_LOG_WARNING(Debug, pThis->log("packet could not be parsed")) - return RTCPPacketPtr(); - } - return pThis; - } + for (auto *item = chunk->firstEmail(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Email::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - RTCPPacketPtr RTCPPacket::create(const Report *first) - { - size_t allocationSize = getPacketSize(first); - SecureByteBlockPtr temp(make_shared(allocationSize)); + advancePos(pos, remaining, sizeof(WORD)); - BYTE *buffer = temp->BytePtr(); - BYTE *pos = buffer; - writePacket(first, pos, allocationSize); + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Email") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - return create(temp); - } + for (auto *item = chunk->firstPhone(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Phone::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - SecureByteBlockPtr RTCPPacket::generateFrom(const Report *first) - { - size_t allocationSize = getPacketSize(first); - SecureByteBlockPtr temp(make_shared(allocationSize)); + advancePos(pos, remaining, sizeof(WORD)); - BYTE *buffer = temp->BytePtr(); - BYTE *pos = buffer; - writePacket(first, pos, allocationSize); + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Phone") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - return temp; - } + for (auto *item = chunk->firstLoc(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Loc::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - const BYTE *RTCPPacket::ptr() const - { - return mBuffer->BytePtr(); - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - size_t RTCPPacket::size() const - { - return mBuffer->SizeInBytes(); - } + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Loc") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - SecureByteBlockPtr RTCPPacket::buffer() const - { - return mBuffer; - } + for (auto *item = chunk->firstTool(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Tool::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - RTCPPacket::SenderReport *RTCPPacket::senderReportAtIndex(size_t index) const - { - ASSERT(index < mSenderReportCount) - return &(mFirstSenderReport[index]); - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - RTCPPacket::ReceiverReport *RTCPPacket::receiverReportAtIndex(size_t index) const - { - ASSERT(index < mReceiverReportCount) - return &(mFirstReceiverReport[index]); - } + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Tool") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::SDES *RTCPPacket::sdesAtIndex(size_t index) const - { - ASSERT(index < mSDESCount) - return &(mFirstSDES[index]); - } + for (auto *item = chunk->firstNote(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Note::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - RTCPPacket::Bye *RTCPPacket::byeAtIndex(size_t index) const - { - ASSERT(index < mByeCount) - return &(mFirstBye[index]); - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - RTCPPacket::App *RTCPPacket::appAtIndex(size_t index) const - { - ASSERT(index < mAppCount) - return &(mFirstApp[index]); - } + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Note") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - RTCPPacket::TransportLayerFeedbackMessage *RTCPPacket::transportLayerFeedbackReportAtIndex(size_t index) const - { - ASSERT(index < mTransportLayerFeedbackMessageCount) - return &(mFirstTransportLayerFeedbackMessage[index]); - } + for (auto *item = chunk->firstPriv(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Priv::kItemType; + size_t len1 = (NULL != item->mPrefix ? strlen(item->mPrefix) : 0); + size_t len2 = (NULL != item->mValue ? strlen(item->mValue) : 0); + size_t len = len1 + len2; + if (len > 0) ++len; + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - RTCPPacket::PayloadSpecificFeedbackMessage *RTCPPacket::payloadSpecificFeedbackReportAtIndex(size_t index) const - { - ASSERT(index < mPayloadSpecificFeedbackMessageCount) - return &(mFirstPayloadSpecificFeedbackMessage[index]); - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - RTCPPacket::XR *RTCPPacket::xrAtIndex(size_t index) const - { - ASSERT(index < mXRCount) - return &(mFirstXR[index]); - } - - //------------------------------------------------------------------------- - RTCPPacket::UnknownReport *RTCPPacket::unknownAtIndex(size_t index) const - { - ASSERT(index < mUnknownReportCount) - return &(mFirstUnknownReport[index]); - } + if (len > 0) { + pos[0] = static_cast(len1); + advancePos(pos, remaining); + if (len1 > 0) { + memcpy(pos, item->prefix(), len1*sizeof(BYTE)); + advancePos(pos, remaining, len1*sizeof(BYTE)); + } + if (len2 > 0) { + memcpy(pos, item->value(), len2*sizeof(BYTE)); + advancePos(pos, remaining, len2*sizeof(BYTE)); + } + } + ZS_LOG_INSANE(packet_slog("writing SDES Priv") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("prefix len", len1) + ZS_PARAM("prefix", (NULL != item->mPrefix ? item->mPrefix : NULL)) + ZS_PARAM("len", len2) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - static void toDebug( - ElementPtr &subEl, - RTCPPacket::Report *common - ) - { - UseServicesHelper::debugAppend(subEl, "next", NULL != common->next()); - UseServicesHelper::debugAppend(subEl, "ptr", NULL != common->ptr()); - UseServicesHelper::debugAppend(subEl, "size", common->size()); - UseServicesHelper::debugAppend(subEl, "version", common->version()); - UseServicesHelper::debugAppend(subEl, "padding", common->padding()); - UseServicesHelper::debugAppend(subEl, "report specific", common->reportSpecific()); - UseServicesHelper::debugAppend(subEl, "pt", common->pt()); - } + for (auto *item = chunk->firstMid(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Mid::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - //------------------------------------------------------------------------- - static void toDebugSenderReceiverCommonReport( - ElementPtr &subEl, - RTCPPacket::SenderReceiverCommonReport *common - ) - { - internal::toDebug(subEl, common); - UseServicesHelper::debugAppend(subEl, "rc", common->rc()); - UseServicesHelper::debugAppend(subEl, (RTCPPacket::ReceiverReport::kPayloadType != common->pt() ? "ssrc of sender" : "ssrc of packet sender"), common->ssrcOfSender()); - UseServicesHelper::debugAppend(subEl, "extension", (NULL != common->extension())); - UseServicesHelper::debugAppend(subEl, "extension size", common->extensionSize()); - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - static ElementPtr toDebug(RTCPPacket::SenderReceiverCommonReport *common) - { - RTCPPacket::SenderReceiverCommonReport::ReportBlock *block = common->firstReportBlock(); - if (NULL == block) return ElementPtr(); + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Mid report") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - ElementPtr outerEl = Element::create("ReportBlocks"); + for (auto *item = chunk->firstRid(); NULL != item; item = item->next()) + { + pos[0] = Chunk::Rid::kItemType; + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - for (; NULL != block; block = block->next()) { - ElementPtr subEl = Element::create("ReportBlocks"); - UseServicesHelper::debugAppend(subEl, "ssrc", block->ssrc()); - UseServicesHelper::debugAppend(subEl, "fraction lost", block->fractionLost()); - UseServicesHelper::debugAppend(subEl, "cumulative number of packets lost", block->cumulativeNumberOfPacketsLost()); - UseServicesHelper::debugAppend(subEl, "extended highest sequence number received", block->extendedHighestSequenceNumberReceived()); - UseServicesHelper::debugAppend(subEl, "interarrival jitter", block->interarrivalJitter()); - UseServicesHelper::debugAppend(subEl, "lsr", block->lsr()); - UseServicesHelper::debugAppend(subEl, "dlsr", block->dlsr()); - UseServicesHelper::debugAppend(outerEl, subEl); - } - return outerEl; - } + advancePos(pos, remaining, sizeof(WORD)); - //------------------------------------------------------------------------- - static void toDebug( - ElementPtr &subEl, - RTCPPacket::SDES::Chunk::StringItem *common - ) - { - auto type = common->type(); - UseServicesHelper::debugAppend(subEl, "type", type); - if (RTCPPacket::SDES::Chunk::Priv::kItemType == type) { - RTCPPacket::SDES::Chunk::Priv *priv = reinterpret_cast(common); - UseServicesHelper::debugAppend(subEl, "prefix length", priv->prefixLength()); - UseServicesHelper::debugAppend(subEl, "prefix", priv->prefix()); - } - UseServicesHelper::debugAppend(subEl, "length", common->length()); - UseServicesHelper::debugAppend(subEl, "value", common->value()); - } + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Rid report") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - //------------------------------------------------------------------------- - static ElementPtr toDebug( - const char *typeNames, - const char *typeName, - RTCPPacket::SDES::Chunk::StringItem *first - ) - { - if (NULL == first) return ElementPtr(); + for (auto *item = chunk->firstUnknown(); NULL != item; item = item->next()) + { + pos[0] = item->type(); + size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); + pos[1] = static_cast(len); + ZS_ASSERT(throwIfGreaterThanBitsAllow(len, 8)); - RTCPPacket::SDES::Chunk::StringItem *item = first; - bool hasMoreThanOne = (NULL != item ? (NULL != item->mNext) : false); + advancePos(pos, remaining, sizeof(WORD)); - ElementPtr outerEl; + if (len > 0) { + memcpy(pos, item->value(), len*sizeof(BYTE)); + advancePos(pos, remaining, len*sizeof(BYTE)); + } + ZS_LOG_INSANE(packet_slog("writing SDES Unknown") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("type", item->mType) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + } - if (hasMoreThanOne) { - outerEl = Element::create(typeNames); - } + BYTE *endPos = pos; - for (; NULL != item; item = item->mNext) { - ElementPtr subEl = Element::create(typeName); - internal::toDebug(subEl, item); + PTRNUMBER diff = reinterpret_cast(endPos) - reinterpret_cast(startPos); + auto modulas = (diff % sizeof(DWORD)); + if (0 != modulas) { + advancePos(pos, remaining, sizeof(DWORD)-modulas); + } - if (!hasMoreThanOne) { - return subEl; + if ((0 == diff) || + (0 == modulas)) { + // write "empty" chunk + UseRTPUtils::setBE32(pos, 0); + advancePos(pos, remaining, sizeof(DWORD)); } - UseServicesHelper::debugAppend(outerEl, subEl); } - return outerEl; + ZS_ASSERT(throwIfGreaterThanBitsAllow(chunkCount, 5)); } - + //------------------------------------------------------------------------- - static ElementPtr toDebug( - const char *typeNamse, - const char *typeName, - DWORD *ssrcs, - size_t count - ) + static void writePacketBye(const RTCPPacket::Bye *report, BYTE * &pos, size_t &remaining) noexcept { - if (0 == count) return ElementPtr(); + typedef RTCPPacket::Bye Bye; + pos[1] = Bye::kPayloadType; - ElementPtr outerEl = Element::create(typeNamse); + advancePos(pos, remaining, sizeof(DWORD)); - for (size_t index = 0; index < count; ++index) { - UseServicesHelper::debugAppend(outerEl, typeName, ssrcs[index]); + for (size_t index = 0; index < report->sc(); ++index) + { + UseRTPUtils::setBE32(pos, report->ssrc(index)); + advancePos(pos, remaining, sizeof(DWORD)); } - return outerEl; + if (NULL != report->reasonForLeaving()) { + size_t len = strlen(report->reasonForLeaving()); + if (len > 0) { + pos[0] = static_cast(len); + memcpy(&(pos[1]), report->reasonForLeaving(), len*sizeof(BYTE)); + advancePos(pos, remaining, (len*sizeof(BYTE))+sizeof(BYTE)); + } + } } - + //------------------------------------------------------------------------- - static void toDebugFeedbackMessage( - ElementPtr &subEl, - RTCPPacket::FeedbackMessage *common - ) + static void writePacketApp(const RTCPPacket::App *report, BYTE * &pos, size_t &remaining) noexcept { - internal::toDebug(subEl, common); + typedef RTCPPacket::App App; + pos[1] = App::kPayloadType; - UseServicesHelper::debugAppend(subEl, "fmt", common->fmt()); - UseServicesHelper::debugAppend(subEl, "ssrc of packet sender", common->ssrcOfPacketSender()); - UseServicesHelper::debugAppend(subEl, "ssrc of media source", common->ssrcOfMediaSource()); - UseServicesHelper::debugAppend(subEl, "fci", (NULL != common->fci())); - UseServicesHelper::debugAppend(subEl, "fci size", common->fciSize()); - } + UseRTPUtils::setBE32(&(pos[4]), report->ssrc()); + memcpy(&(pos[8]), report->name(), sizeof(DWORD)); - //------------------------------------------------------------------------- - static void toDebug( - ElementPtr &subEl, - RTCPPacket::TransportLayerFeedbackMessage::TMMBRCommon *common - ) - { - UseServicesHelper::debugAppend(subEl, "ssrc", common->ssrc()); - UseServicesHelper::debugAppend(subEl, "mx tbr exp", common->mxTBRExp()); - UseServicesHelper::debugAppend(subEl, "mx tbr mantissa", common->mxTBRMantissa()); - UseServicesHelper::debugAppend(subEl, "measured overhead", common->measuredOverhead()); - } - - //------------------------------------------------------------------------- - static void toDebug( - ElementPtr &subEl, - RTCPPacket::PayloadSpecificFeedbackMessage::CodecControlCommon *common - ) - { - UseServicesHelper::debugAppend(subEl, "ssrc", common->ssrc()); - UseServicesHelper::debugAppend(subEl, "seq nr", common->seqNr()); - UseServicesHelper::debugAppend(subEl, "reserved", common->reserved()); - } + advancePos(pos, remaining, sizeof(DWORD)*3); - //------------------------------------------------------------------------- - static void toDebugReportBlock( - ElementPtr &subEl, - RTCPPacket::XR::ReportBlock *common - ) - { - UseServicesHelper::debugAppend(subEl, "next", (NULL != common->next())); - UseServicesHelper::debugAppend(subEl, "block type", common->blockType()); - UseServicesHelper::debugAppend(subEl, "type specific", common->typeSpecific()); - UseServicesHelper::debugAppend(subEl, "type specific contents", (NULL != common->typeSpecificContents())); - UseServicesHelper::debugAppend(subEl, "type specific contents size", common->typeSpecificContentSize()); + size_t dataSize = report->dataSize(); + if (0 != dataSize) { + memcpy(pos, report->data(), dataSize); + advancePos(pos, remaining, dataSize); + } } //------------------------------------------------------------------------- - static void toDebugReportBlockRange( - ElementPtr &subEl, - RTCPPacket::XR::ReportBlockRange *common - ) + static void writePacketTransportLayerFeedbackMessage(const RTCPPacket::TransportLayerFeedbackMessage *report, BYTE * &pos, size_t &remaining) noexcept { - internal::toDebugReportBlock(subEl, common); - UseServicesHelper::debugAppend(subEl, "reserved", common->reserved()); - UseServicesHelper::debugAppend(subEl, "thinning", common->thinning()); - UseServicesHelper::debugAppend(subEl, "ssrc", common->ssrcOfSource()); - UseServicesHelper::debugAppend(subEl, "begin seq", common->beginSeq()); - UseServicesHelper::debugAppend(subEl, "end seq", common->endSeq()); - } + typedef RTCPPacket::TransportLayerFeedbackMessage TransportLayerFeedbackMessage; + typedef RTCPPacket::TransportLayerFeedbackMessage::GenericNACK GenericNACK; + typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBR TMMBR; + typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBN TMMBN; - //------------------------------------------------------------------------- - static void toDebugRLEReportBlock( - ElementPtr &subEl, - RTCPPacket::XR::RLEReportBlock *common - ) - { - internal::toDebugReportBlockRange(subEl, common); - auto count = common->chunkCount(); + pos[1] = TransportLayerFeedbackMessage::kPayloadType; - if (count < 1) return; + UseRTPUtils::setBE32(&(pos[4]), report->ssrcOfPacketSender()); + UseRTPUtils::setBE32(&(pos[8]), report->ssrcOfMediaSource()); - ElementPtr outerEl = Element::create("chunks"); + advancePos(pos, remaining, sizeof(DWORD)*3); - for (size_t index = 0; index < count; ++index) { - RTCPPacket::XR::RLEChunk chunk = common->chunkAtIndex(index); + switch (report->fmt()) { + case GenericNACK::kFmt: + { + auto count = report->genericNACKCount(); - ElementPtr chunkEl; + for (size_t index = 0; index < count; ++index) + { + auto item = report->genericNACKAtIndex(index); + UseRTPUtils::setBE16(&(pos[0]), item->pid()); + UseRTPUtils::setBE16(&(pos[2]), item->blp()); + advancePos(pos, remaining, sizeof(DWORD)); + } + break; + } + case TMMBR::kFmt: + { + auto count = report->tmmbrCount(); - if (RTCPPacket::XR::isRunLengthChunk(chunk)) { - chunkEl = Element::create("run length"); + for (size_t index = 0; index < count; ++index) + { + auto item = report->tmmbrAtIndex(index); + UseRTPUtils::setBE32(&(pos[0]), item->ssrc()); - RTCPPacket::XR::RunLength rl(chunk); - UseServicesHelper::debugAppend(chunkEl, "run type", string(rl.runType())); - UseServicesHelper::debugAppend(chunkEl, "run length", rl.runLength()); + DWORD merged = RTCP_PACK_BITS(static_cast(item->mxTBRExp()), 0x3F, 26) | + RTCP_PACK_BITS(static_cast(item->mxTBRMantissa()), 0x1FFFF, 9) | + RTCP_PACK_BITS(static_cast(item->measuredOverhead()), 0x1FF, 0); - } else if (RTCPPacket::XR::isBitVectorChunk(chunk)) { - chunkEl = Element::create("bit vector"); + UseRTPUtils::setBE32(&(pos[4]), merged); - String bits; - RTCPPacket::XR::BitVector bv(chunk); - for (int bitPos = 0; bitPos < sizeof(RTCPPacket::XR::RLEChunk); ++bitPos) { - bits += string(bv.bitAtIndex(bitPos)); + advancePos(pos, remaining, sizeof(DWORD)*2); } - UseServicesHelper::debugAppend(chunkEl, "bit vector", bits); - } else { - chunkEl = Element::create("unknown"); - UseServicesHelper::debugAppend(chunkEl, "value", chunk); + break; } + case TMMBN::kFmt: + { + auto count = report->tmmbnCount(); - UseServicesHelper::debugAppend(outerEl, chunkEl); - } - UseServicesHelper::debugAppend(subEl, outerEl); - - } + for (size_t index = 0; index < count; ++index) + { + auto item = report->tmmbnAtIndex(index); + UseRTPUtils::setBE32(&(pos[0]), item->ssrc()); - //------------------------------------------------------------------------- - static ElementPtr toDebugSenderReport(RTCPPacket::SenderReport *sr) - { - ElementPtr subEl = Element::create("SenderReport"); + DWORD merged = RTCP_PACK_BITS(static_cast(item->mxTBRExp()), 0x3F, 26) | + RTCP_PACK_BITS(static_cast(item->mxTBRMantissa()), 0x1FFFF, 9) | + RTCP_PACK_BITS(static_cast(item->measuredOverhead()), 0x1FF, 0); - internal::toDebugSenderReceiverCommonReport(subEl, sr); - UseServicesHelper::debugAppend(subEl, "ntp timestamp ms", sr->ntpTimestampMS()); - UseServicesHelper::debugAppend(subEl, "ntp timestamp ls", sr->ntpTimestampLS()); - UseServicesHelper::debugAppend(subEl, "ntp timestamp", sr->ntpTimestamp()); - UseServicesHelper::debugAppend(subEl, "sender packet count", sr->senderPacketCount()); - UseServicesHelper::debugAppend(subEl, "sender octet count", sr->senderOctetCount()); + UseRTPUtils::setBE32(&(pos[4]), merged); - UseServicesHelper::debugAppend(subEl, internal::toDebug(sr)); + advancePos(pos, remaining, sizeof(DWORD)*2); + } + break; + } + default: + { + auto fciSize = report->fciSize(); + if (0 != fciSize) { + memcpy(pos, report->fci(), report->fciSize()); + advancePos(pos, remaining, report->fciSize()); + } + break; + } + } - UseServicesHelper::debugAppend(subEl, "next sender report", NULL != sr->nextSenderReport()); - return subEl; + ZS_LOG_INSANE(packet_slog("writing transport layer feedback message") + ZS_PARAM("fmt", report->fmtToString()) + ZS_PARAM("fmt (number)", report->reportSpecific())) } - + //------------------------------------------------------------------------- - static ElementPtr toDebugReceiverReport(RTCPPacket::ReceiverReport *rr) + static void writePacketPayloadSpecificFeedbackMessage(const RTCPPacket::PayloadSpecificFeedbackMessage *report, BYTE * &pos, size_t &remaining) noexcept { - ElementPtr subEl = Element::create("ReceiverReport"); - internal::toDebugSenderReceiverCommonReport(subEl, rr); - UseServicesHelper::debugAppend(subEl, internal::toDebug(rr)); - UseServicesHelper::debugAppend(subEl, "next receiver report", NULL != rr->nextReceiverReport()); - return subEl; - } + typedef RTCPPacket::PayloadSpecificFeedbackMessage PayloadSpecificFeedbackMessage; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::PLI PLI; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::SLI SLI; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::RPSI RPSI; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::FIR FIR; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTR TSTR; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTN TSTN; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::VBCM VBCM; + typedef RTCPPacket::PayloadSpecificFeedbackMessage::AFB AFB; + //typedef RTCPPacket::PayloadSpecificFeedbackMessage::REMB REMB; - //------------------------------------------------------------------------- - static ElementPtr toDebugSDES(RTCPPacket::SDES *sdes) - { - ElementPtr subEl = Element::create("SDES"); - internal::toDebug(subEl, sdes); - UseServicesHelper::debugAppend(subEl, "sc", sdes->sc()); + pos[1] = PayloadSpecificFeedbackMessage::kPayloadType; - RTCPPacket::SDES::Chunk *chunk = sdes->firstChunk(); - if (NULL != chunk) { - ElementPtr chunksEl = Element::create("Chunks"); + UseRTPUtils::setBE32(&(pos[4]), report->ssrcOfPacketSender()); + UseRTPUtils::setBE32(&(pos[8]), report->ssrcOfMediaSource()); - for (; NULL != chunk; chunk = chunk->next()) { - ElementPtr chunkEl = Element::create("Chunk"); - UseServicesHelper::debugAppend(chunkEl, "ssrc", chunk->ssrc()); - UseServicesHelper::debugAppend(chunkEl, "count", chunk->count()); - UseServicesHelper::debugAppend(chunkEl, "cname count", chunk->cNameCount()); - UseServicesHelper::debugAppend(chunkEl, "name count", chunk->nameCount()); - UseServicesHelper::debugAppend(chunkEl, "email count", chunk->emailCount()); - UseServicesHelper::debugAppend(chunkEl, "phone count", chunk->phoneCount()); - UseServicesHelper::debugAppend(chunkEl, "loc count", chunk->locCount()); - UseServicesHelper::debugAppend(chunkEl, "tool count", chunk->toolCount()); - UseServicesHelper::debugAppend(chunkEl, "note count", chunk->noteCount()); - UseServicesHelper::debugAppend(chunkEl, "priv count", chunk->privCount()); - UseServicesHelper::debugAppend(chunkEl, "mid count", chunk->midCount()); - UseServicesHelper::debugAppend(chunkEl, "rid count", chunk->ridCount()); - UseServicesHelper::debugAppend(chunkEl, "unknown count", chunk->unknownCount()); - - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("cnames", "cname", chunk->firstCName())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("names", "name", chunk->firstName())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("emails", "email", chunk->firstEmail())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("phones", "phone", chunk->firstPhone())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("locs", "loc", chunk->firstLoc())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("tools", "tool", chunk->firstTool())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("notes", "note", chunk->firstNote())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("privs", "priv", chunk->firstPriv())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("mid", "mid", chunk->firstMid())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("rid", "rid", chunk->firstRid())); - UseServicesHelper::debugAppend(chunkEl, internal::toDebug("unknowns", "unknown", chunk->firstUnknown())); - - UseServicesHelper::debugAppend(chunksEl, chunkEl); - } - - UseServicesHelper::debugAppend(subEl, chunksEl); - } + advancePos(pos, remaining, sizeof(DWORD)*3); - UseServicesHelper::debugAppend(subEl, "next sdes", NULL != sdes->nextSDES()); - return subEl; - } + switch (report->fmt()) { + case PLI::kFmt: + { + break; + } + case SLI::kFmt: + { + auto count = report->sliCount(); - //------------------------------------------------------------------------- - static ElementPtr toDebugBye(RTCPPacket::Bye *bye) - { - ElementPtr subEl = Element::create("Bye"); - internal::toDebug(subEl, bye); + for (size_t index = 0; index < count; ++index) + { + auto item = report->sliAtIndex(index); - UseServicesHelper::debugAppend(subEl, internal::toDebug("ssrcs", "ssrc", bye->mSSRCs, bye->sc())); + DWORD merged = RTCP_PACK_BITS(static_cast(item->first()), 0x1FFF, 19) | + RTCP_PACK_BITS(static_cast(item->number()), 0x1FFF, 6) | + RTCP_PACK_BITS(static_cast(item->pictureID()), 0x3F, 0); - UseServicesHelper::debugAppend(subEl, "reason for leaving", bye->reasonForLeaving()); - UseServicesHelper::debugAppend(subEl, "next bye", NULL != bye->nextBye()); - return subEl; - } + UseRTPUtils::setBE32(&(pos[0]), merged); + advancePos(pos, remaining, sizeof(DWORD)); + } + break; + } + case RPSI::kFmt: + { + auto rpsi = report->rpsi(); - //------------------------------------------------------------------------- - static ElementPtr toDebugApp(RTCPPacket::App *app) - { - ElementPtr subEl = Element::create("App"); - internal::toDebug(subEl, app); + pos[1] = RTCP_PACK_BITS(static_cast(rpsi->zeroBit()), 0x1, 7) | + RTCP_PACK_BITS(static_cast(rpsi->payloadType()), 0x7F, 0); - UseServicesHelper::debugAppend(subEl, "subtype", app->subtype()); - UseServicesHelper::debugAppend(subEl, "ssrc", app->ssrc()); - UseServicesHelper::debugAppend(subEl, "name", app->name()); + auto totalBits = static_cast(rpsi->nativeRPSIBitStringSizeInBits()); - UseServicesHelper::debugAppend(subEl, "data", (NULL != app->data())); - UseServicesHelper::debugAppend(subEl, "name size", app->dataSize()); + size_t byteModulas = (totalBits%8); - UseServicesHelper::debugAppend(subEl, "next app", NULL != app->nextApp()); - return subEl; - } + size_t totalBytes = (totalBits/8) + ((0 != byteModulas) ? 1 : 0); + if (0 != totalBytes) { + memcpy(&(pos[2]), rpsi->nativeRPSIBitString(), totalBytes); + if (0 != byteModulas) { + BYTE &by = (pos[2+totalBytes-1]); + by = by & static_cast(((1 << byteModulas)-1) << (8-byteModulas)); + } + } - //------------------------------------------------------------------------- - static ElementPtr toDebugTransportLayerFeedbackMessage(RTCPPacket::TransportLayerFeedbackMessage *fm) - { - ElementPtr subEl = Element::create("TransportLayerFeedbackMessage"); - internal::toDebugFeedbackMessage(subEl, fm); + size_t totalSizeInBits = (sizeof(WORD)*8)+(totalBits); + auto boundaryModulas = totalSizeInBits % (sizeof(DWORD)*8); - { - auto count = fm->genericNACKCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("GenericNACKs"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("GenericNACK"); - - auto format = fm->genericNACKAtIndex(index); - - UseServicesHelper::debugAppend(formatEl, "pid", format->pid()); - UseServicesHelper::debugAppend(formatEl, "blp", format->blp()); - - UseServicesHelper::debugAppend(formatsEl, formatEl); + if (0 != boundaryModulas) { + pos[0] = static_cast((sizeof(DWORD)*8)-boundaryModulas); + } else { + pos[0] = 0; } - UseServicesHelper::debugAppend(subEl, formatsEl); - } - } - - { - auto count = fm->tmmbrCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("TMMBRs"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("TMMBR"); - - auto format = fm->tmmbrAtIndex(index); - internal::toDebug(formatEl, format); - UseServicesHelper::debugAppend(formatsEl, formatEl); - } - UseServicesHelper::debugAppend(subEl, formatsEl); + advancePos(pos, remaining, sizeof(WORD)+(sizeof(BYTE)*totalBytes)); + break; } - } - - { - auto count = fm->tmmbrCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("TMMBNs"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("TMMBN"); - - auto format = fm->tmmbrAtIndex(index); - internal::toDebug(formatEl, format); + case FIR::kFmt: + { + auto count = report->firCount(); - UseServicesHelper::debugAppend(formatsEl, formatEl); + for (size_t index = 0; index < count; ++index) + { + auto item = report->firAtIndex(index); + UseRTPUtils::setBE32(&(pos[0]), item->ssrc()); + UseRTPUtils::setBE32(&(pos[4]), item->reserved()); + pos[4] = item->seqNr(); + advancePos(pos, remaining, sizeof(DWORD)*2); } - UseServicesHelper::debugAppend(subEl, formatsEl); - } - } - - UseServicesHelper::debugAppend(subEl, "unknown", NULL != fm->unknown()); - - UseServicesHelper::debugAppend(subEl, "next transport layer feedback message", (NULL != fm->nextTransportLayerFeedbackMessage())); - - return subEl; - } - - //------------------------------------------------------------------------- - static ElementPtr toDebugPayloadSpecificFeedbackMessage(RTCPPacket::PayloadSpecificFeedbackMessage *fm) - { - ElementPtr subEl = Element::create("PayloadSpecificFeedbackMessage"); - internal::toDebugFeedbackMessage(subEl, fm); - - { - auto format = fm->pli(); - if (NULL != format) { - ElementPtr formatEl = Element::create("PLI"); - - UseServicesHelper::debugAppend(subEl, formatEl); + break; } - } - - { - auto count = fm->sliCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("SLIs"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("SLI"); + case TSTR::kFmt: + { + auto count = report->tstrCount(); - auto format = fm->sliAtIndex(index); + for (size_t index = 0; index < count; ++index) + { + auto item = report->tstrAtIndex(index); + UseRTPUtils::setBE32(&(pos[0]), item->ssrc()); - UseServicesHelper::debugAppend(formatEl, "first", format->first()); - UseServicesHelper::debugAppend(formatEl, "number", format->number()); - UseServicesHelper::debugAppend(formatEl, "picture id", format->pictureID()); + DWORD merged = RTCP_PACK_BITS(static_cast(item->seqNr()), 0xFF, 24) | + RTCP_PACK_BITS(static_cast(item->reserved()), 0x7FFFF, 5) | + RTCP_PACK_BITS(static_cast(item->index()), 0x1F, 0); - UseServicesHelper::debugAppend(formatsEl, formatEl); + UseRTPUtils::setBE32(&(pos[4]), merged); + advancePos(pos, remaining, sizeof(DWORD)*2); } - UseServicesHelper::debugAppend(subEl, formatsEl); - } - } - - { - auto format = fm->rpsi(); - if (NULL != format) { - ElementPtr formatEl = Element::create("RPSI"); - - UseServicesHelper::debugAppend(formatEl, "zero bit", format->zeroBit()); - UseServicesHelper::debugAppend(formatEl, "payload type", format->payloadType()); - - UseServicesHelper::debugAppend(formatEl, "native rpsi bit string", (NULL != format->nativeRPSIBitString())); - UseServicesHelper::debugAppend(formatEl, "native rpsi bit string size (bits)", format->nativeRPSIBitStringSizeInBits()); - - UseServicesHelper::debugAppend(subEl, formatEl); + break; } - } - - { - auto count = fm->firCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("FIRs"); + case TSTN::kFmt: + { + auto count = report->tstnCount(); - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("FIR"); + for (size_t index = 0; index < count; ++index) + { + auto item = report->tstnAtIndex(index); + UseRTPUtils::setBE32(&(pos[0]), item->ssrc()); - auto format = fm->firAtIndex(index); - internal::toDebug(formatEl, format); + DWORD merged = RTCP_PACK_BITS(static_cast(item->seqNr()), 0xFF, 24) | + RTCP_PACK_BITS(static_cast(item->reserved()), 0x7FFFF, 5) | + RTCP_PACK_BITS(static_cast(item->index()), 0x1F, 0); - UseServicesHelper::debugAppend(formatsEl, formatEl); + UseRTPUtils::setBE32(&(pos[4]), merged); + advancePos(pos, remaining, sizeof(DWORD)*2); } - UseServicesHelper::debugAppend(subEl, formatsEl); + break; } - } + case VBCM::kFmt: + { + auto count = report->vbcmCount(); - { - auto count = fm->tstrCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("TSTRs"); + for (size_t index = 0; index < count; ++index) + { + auto item = report->vbcmAtIndex(index); - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("TSTR"); + UseRTPUtils::setBE32(&(pos[0]), item->ssrc()); - auto format = fm->tstrAtIndex(index); - internal::toDebug(formatEl, format); + pos[4] = item->seqNr(); + pos[5] = RTCP_PACK_BITS(static_cast(item->zeroBit()), 0x1, 7) | + RTCP_PACK_BITS(static_cast(item->payloadType()), 0x7F, 0); - UseServicesHelper::debugAppend(formatEl, "index", format->index()); + auto size = item->vbcmOctetStringSize(); + if (0 != size) { + UseRTPUtils::setBE16(&(pos[6]), static_cast(size)); + memcpy(&(pos[8]), item->vbcmOctetString(), size*sizeof(BYTE)); + } - UseServicesHelper::debugAppend(formatsEl, formatEl); + advancePos(pos, remaining, boundarySize((sizeof(DWORD)*2)+(size*sizeof(BYTE)))); } - UseServicesHelper::debugAppend(subEl, formatsEl); + break; } - } - - { - auto count = fm->tstnCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("TSTNs"); + case AFB::kFmt: + { - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("TSTN"); + auto remb = report->remb(); + if (NULL == remb) { + auto afb = report->afb(); - auto format = fm->tstnAtIndex(index); - internal::toDebug(formatEl, format); + size_t size = afb->dataSize(); + if (0 != size) { + memcpy(pos, afb->data(), size*sizeof(BYTE)); + advancePos(pos, remaining, boundarySize(size*sizeof(BYTE))); + } + } else { + memcpy(pos, "REMB", sizeof(DWORD)); - UseServicesHelper::debugAppend(formatEl, "index", format->index()); + DWORD merged = RTCP_PACK_BITS(static_cast(remb->brExp()), 0x3F, 18) | + RTCP_PACK_BITS(static_cast(remb->brMantissa()), 0x3FFFF, 0); + UseRTPUtils::setBE32(&(pos[4]), merged); + pos[4] = static_cast(remb->numSSRC()); + advancePos(pos, remaining, sizeof(DWORD)*2); - UseServicesHelper::debugAppend(formatsEl, formatEl); + auto count = remb->numSSRC(); + for (size_t index = 0; index < count; ++index) + { + auto ssrc = remb->ssrcAtIndex(index); + UseRTPUtils::setBE32(pos, ssrc); + advancePos(pos, remaining, sizeof(DWORD)); + } } - UseServicesHelper::debugAppend(subEl, formatsEl); + break; } - } - - { - auto count = fm->vbcmCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("VBCMs"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("VBCM"); - - auto format = fm->vbcmAtIndex(index); - internal::toDebug(formatEl, format); - - UseServicesHelper::debugAppend(formatEl, "zero bit", format->zeroBit()); - UseServicesHelper::debugAppend(formatEl, "payload type", format->payloadType()); - - UseServicesHelper::debugAppend(formatEl, "vbcm octet string", (NULL != format->vbcmOctetString())); - UseServicesHelper::debugAppend(formatEl, "vbcm octet string size", format->vbcmOctetStringSize()); - - UseServicesHelper::debugAppend(formatsEl, formatEl); + default: + { + auto fciSize = report->fciSize(); + if (0 != fciSize) { + memcpy(pos, report->fci(), fciSize); + advancePos(pos, remaining, fciSize); } - UseServicesHelper::debugAppend(subEl, formatsEl); - } - } - - { - auto format = fm->afb(); - auto remb = fm->remb(); - - if ((NULL != format) && - (NULL == remb)) { - ElementPtr formatEl = Element::create("AFB"); - - UseServicesHelper::debugAppend(formatEl, "data", (NULL != format->data())); - UseServicesHelper::debugAppend(formatEl, "data size", format->dataSize()); - - UseServicesHelper::debugAppend(subEl, formatEl); - } - } - - { - auto format = fm->remb(); - if (NULL != format) { - ElementPtr formatEl = Element::create("REMB"); - - UseServicesHelper::debugAppend(formatEl, "num ssrc", format->numSSRC()); - UseServicesHelper::debugAppend(formatEl, "br exp", format->brExp()); - UseServicesHelper::debugAppend(formatEl, "br mantissa", format->brMantissa()); - - UseServicesHelper::debugAppend(formatEl, internal::toDebug("ssrcs", "ssrc", format->mSSRCs, format->numSSRC())); - - UseServicesHelper::debugAppend(subEl, formatEl); + break; } } - - UseServicesHelper::debugAppend(subEl, "unknown", NULL != fm->unknown()); - - UseServicesHelper::debugAppend(subEl, "next payload specific feedback message", (NULL != fm->nextPayloadSpecificFeedbackMessage())); - return subEl; + ZS_LOG_INSANE(packet_slog("writing payload specific feedback message") + ZS_PARAM("fmt", report->fmtToString()) + ZS_PARAM("fmt (number)", report->reportSpecific())) } //------------------------------------------------------------------------- - static ElementPtr toDebugXR(RTCPPacket::XR *xr) + static void writePacketXR(const RTCPPacket::XR *report, BYTE * &pos, size_t &remaining) noexcept { - ElementPtr subEl = Element::create("XR"); - internal::toDebug(subEl, xr); + typedef RTCPPacket::XR XR; + typedef RTCPPacket::XR::ReportBlock ReportBlock; + typedef RTCPPacket::XR::LossRLEReportBlock LossRLEReportBlock; + typedef RTCPPacket::XR::DuplicateRLEReportBlock DuplicateRLEReportBlock; + typedef RTCPPacket::XR::PacketReceiptTimesReportBlock PacketReceiptTimesReportBlock; + typedef RTCPPacket::XR::ReceiverReferenceTimeReportBlock ReceiverReferenceTimeReportBlock; + typedef RTCPPacket::XR::DLRRReportBlock DLRRReportBlock; + typedef RTCPPacket::XR::StatisticsSummaryReportBlock StatisticsSummaryReportBlock; + typedef RTCPPacket::XR::VoIPMetricsReportBlock VoIPMetricsReportBlock; + typedef RTCPPacket::XR::UnknownReportBlock UnknownReportBlock; + typedef RTCPPacket::XR::RLEChunk RLEChunk; - UseServicesHelper::debugAppend(subEl, "reserved", xr->reserved()); - UseServicesHelper::debugAppend(subEl, "ssrc", xr->ssrc()); - UseServicesHelper::debugAppend(subEl, "report block count", xr->reportBlockCount()); + pos[1] = XR::kPayloadType; + UseRTPUtils::setBE32(&(pos[4]), report->mSSRC); + + advancePos(pos, remaining, sizeof(DWORD)*2); + for (const ReportBlock *reportBlock = report->firstReportBlock(); NULL != reportBlock; reportBlock = reportBlock->next()) { - auto count = xr->lossRLEReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("LossRLEReportBlocks"); + BYTE *blockStart = pos; - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("LossRLEReportBlock"); + pos[0] = reportBlock->blockType(); + pos[1] = reportBlock->typeSpecific(); - auto format = xr->lossRLEReportBlockAtIndex(index); + advancePos(pos, remaining, sizeof(DWORD)); - internal::toDebugRLEReportBlock(formatEl, format); + switch (reportBlock->mBlockType) { + case LossRLEReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); - UseServicesHelper::debugAppend(formatEl, "next loss rle report block", (NULL != format->nextLossRLE())); + UseRTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); + UseRTPUtils::setBE16(&(pos[4]), block->beginSeq()); + UseRTPUtils::setBE16(&(pos[6]), block->endSeq()); - UseServicesHelper::debugAppend(formatsEl, formatEl); - } - UseServicesHelper::debugAppend(subEl, formatsEl); - } - } + advancePos(pos, remaining, sizeof(DWORD)*2); - { - auto count = xr->duplicateRLEReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("DuplicateRLEReportBlocks"); + size_t chunkCount = block->chunkCount(); + for (size_t index = 0; index < chunkCount; ++index) + { + RLEChunk chunk = block->chunkAtIndex(index); + UseRTPUtils::setBE16(pos, chunk); + advancePos(pos, remaining, sizeof(WORD)); + } + break; + } + case DuplicateRLEReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("DuplicateRLEReportBlock"); + UseRTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); + UseRTPUtils::setBE16(&(pos[4]), block->beginSeq()); + UseRTPUtils::setBE16(&(pos[6]), block->endSeq()); - auto format = xr->duplicateRLEReportBlockAtIndex(index); + advancePos(pos, remaining, sizeof(DWORD)*2); - internal::toDebugRLEReportBlock(formatEl, format); + size_t count = block->chunkCount(); + for (size_t index = 0; index < count; ++index) + { + RLEChunk chunk = block->chunkAtIndex(index); + UseRTPUtils::setBE16(pos, chunk); + advancePos(pos, remaining, sizeof(WORD)); + } + break; + } + case PacketReceiptTimesReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); - UseServicesHelper::debugAppend(formatEl, "next duplicate rle report block", (NULL != format->nextDuplicateRLE())); + UseRTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); + UseRTPUtils::setBE16(&(pos[4]), block->beginSeq()); + UseRTPUtils::setBE16(&(pos[6]), block->endSeq()); - UseServicesHelper::debugAppend(formatsEl, formatEl); - } - UseServicesHelper::debugAppend(subEl, formatsEl); - } - } + advancePos(pos, remaining, sizeof(DWORD)*2); - { - auto count = xr->packetReceiptTimesReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("PacketReceiptTimesReportBlocks"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("PacketReceiptTimesReportBlock"); + size_t count = block->receiptTimeCount(); + for (size_t index = 0; index < count; ++index) + { + DWORD receiptTime = block->receiptTimeAtIndex(index); + UseRTPUtils::setBE32(pos, receiptTime); + advancePos(pos, remaining, sizeof(DWORD)); + } + break; + } + case ReceiverReferenceTimeReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + UseRTPUtils::setBE32(&(pos[0]), block->ntpTimestampMS()); + UseRTPUtils::setBE32(&(pos[4]), block->ntpTimestampLS()); + advancePos(pos, remaining, sizeof(DWORD)*2); + break; + } + case DLRRReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); - auto format = xr->packetReceiptTimesReportBlockAtIndex(index); + size_t count = block->subBlockCount(); + for (size_t index = 0; index < count; ++index) + { + DLRRReportBlock::SubBlock *subBlock = block->subBlockAtIndex(index); + UseRTPUtils::setBE32(&(pos[0]), subBlock->ssrc()); + UseRTPUtils::setBE32(&(pos[4]), subBlock->lrr()); + UseRTPUtils::setBE32(&(pos[8]), subBlock->dlrr()); + advancePos(pos, remaining, sizeof(DWORD)*3); + } + break; + } + case StatisticsSummaryReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + UseRTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); + UseRTPUtils::setBE16(&(pos[4]), block->beginSeq()); + UseRTPUtils::setBE16(&(pos[6]), block->endSeq()); + UseRTPUtils::setBE32(&(pos[8]), block->lostPackets()); + UseRTPUtils::setBE32(&(pos[12]), block->dupPackets()); + UseRTPUtils::setBE32(&(pos[16]), block->minJitter()); + UseRTPUtils::setBE32(&(pos[20]), block->maxJitter()); + UseRTPUtils::setBE32(&(pos[24]), block->meanJitter()); + UseRTPUtils::setBE32(&(pos[28]), block->devJitter()); + pos[32] = block->mMinTTLOrHL; + pos[33] = block->mMaxTTLOrHL; + pos[34] = block->mMeanTTLOrHL; + pos[35] = block->mDevTTLOrHL; + advancePos(pos, remaining, sizeof(DWORD)*9); + break; + } + case VoIPMetricsReportBlock::kBlockType: + { + auto block = reinterpret_cast(reportBlock); + UseRTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); + pos[4] = block->lossRate(); + pos[5] = block->discardRate(); + pos[6] = block->burstDensity(); + pos[7] = block->gapDensity(); + UseRTPUtils::setBE16(&(pos[8]), block->burstDuration()); + UseRTPUtils::setBE16(&(pos[10]), block->gapDuration()); + UseRTPUtils::setBE16(&(pos[12]), block->roundTripDelay()); + UseRTPUtils::setBE16(&(pos[14]), block->endSystemDelay()); + pos[16] = block->signalLevel(); + pos[17] = block->noiseLevel(); + pos[18] = block->rerl(); + pos[19] = block->Gmin(); - internal::toDebugReportBlockRange(formatEl, format); + pos[20] = block->rFactor(); + pos[21] = block->extRFactor(); + pos[22] = block->mosLQ(); + pos[23] = block->mosCQ(); - UseServicesHelper::debugAppend(formatEl, internal::toDebug("receipt times", "receipt time", format->mReceiptTimes, format->receiptTimeCount())); - UseServicesHelper::debugAppend(formatEl, "next packet receipt times report block", (NULL != format->nextPacketReceiptTimesReportBlock())); + pos[24] = block->rxConfig(); + pos[25] = block->mReservedVoIP; + UseRTPUtils::setBE16(&(pos[26]), block->jbNominal()); + UseRTPUtils::setBE16(&(pos[28]), block->jbMaximum()); + UseRTPUtils::setBE16(&(pos[30]), block->jbAbsMax()); + advancePos(pos, remaining, sizeof(DWORD)*8); + break; + } + default: + { + auto block = reinterpret_cast(reportBlock); - UseServicesHelper::debugAppend(formatsEl, formatEl); + auto size = block->typeSpecificContentSize(); + if (0 != size) { + memcpy(pos, block->typeSpecificContents(), size*sizeof(BYTE)); + advancePos(pos, remaining, boundarySize(size*sizeof(BYTE))); + } } - UseServicesHelper::debugAppend(subEl, formatsEl); } - } - - { - auto count = xr->receiverReferenceTimeReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("ReceiverReferenceTimeReportBlocks"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("ReceiverReferenceTimeReportBlock"); - auto format = xr->receiverReferenceTimeReportBlockAtIndex(index); + BYTE *blockEnd = pos; - internal::toDebugReportBlock(formatEl, format); + size_t diff = static_cast(reinterpret_cast(blockEnd) - reinterpret_cast(blockStart)); + auto modulas = diff % sizeof(DWORD); + if (0 != modulas) { + advancePos(pos, remaining, sizeof(DWORD)-modulas); + } - UseServicesHelper::debugAppend(formatEl, "ntp timestamp ms", format->ntpTimestampMS()); - UseServicesHelper::debugAppend(formatEl, "ntp timestamp ls", format->ntpTimestampLS()); - UseServicesHelper::debugAppend(formatEl, "ntp timestamp", format->ntpTimestamp()); - UseServicesHelper::debugAppend(formatEl, "next receiver reference time report block", (NULL != format->nextReceiverReferenceTimeReportBlock())); + diff = boundarySize(diff); + ZS_LOG_INSANE(packet_slog("writing XR block") + ZS_PARAM("block type", reportBlock->blockTypeToString()) + ZS_PARAM("block type (number)", reportBlock->blockType()) + ZS_PARAM("block size", diff)) - UseServicesHelper::debugAppend(formatsEl, formatEl); - } - UseServicesHelper::debugAppend(subEl, formatsEl); - } + UseRTPUtils::setBE16(&(blockStart[2]), static_cast((diff/sizeof(DWORD))-1)); } + } - { - auto count = xr->dlrrReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("DLRRReportBlocks"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("DLRRReportBlock"); + //------------------------------------------------------------------------- + static void traceReport( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::Report *common + ) noexcept + { + ZS_EVENTING_8(x, i, Basic, RTCPPacketTraceReport, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + bool, next, NULL != common->next(), + buffer, buffer, common->ptr(), + size, size, common->size(), + byte, version, common->version(), + size_t, padding, common->padding(), + byte, reportSpecific, common->reportSpecific(), + byte, payloadType, common->pt() + ); + } - auto format = xr->dlrrReportBlockAtIndex(index); + //------------------------------------------------------------------------- + static void traceReportBlocks( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::SenderReceiverCommonReport *common + ) noexcept + { + RTCPPacket::SenderReceiverCommonReport::ReportBlock *block = common->firstReportBlock(); + if (NULL == block) return; - internal::toDebugReportBlock(formatEl, format); + for (; NULL != block; block = block->next()) { + ZS_EVENTING_8(x, i, Basic, RTCPPacketTraceSenderReceiverCommonReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + dword, ssrc, block->ssrc(), + byte, fractionLost, block->fractionLost(), + dword, cumulativeNumberOfPacketsLost, block->cumulativeNumberOfPacketsLost(), + dword, extendedHighestSequenceNumberReceived, block->extendedHighestSequenceNumberReceived(), + dword, interarrivalJitter, block->interarrivalJitter(), + dword, lsr, block->lsr(), + dword, dlsr, block->dlsr() + ); + } + } + + //------------------------------------------------------------------------- + static void traceSenderReceiverCommonReport( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::SenderReceiverCommonReport *common + ) noexcept + { + traceReport(mediaChannelID, common); + ZS_EVENTING_5(x, i, Basic, RTCPPacketTraceSenderReceiverCommonReport, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, ssrcType, (RTCPPacket::ReceiverReport::kPayloadType != common->pt() ? "ssrc of sender" : "ssrc of packet sender"), + dword, ssrc, common->ssrcOfSender(), + buffer, extension, common->extension(), + size, extensionSize, common->extensionSize() + ); + traceReportBlocks(mediaChannelID, common); + } - UseServicesHelper::debugAppend(formatEl, "subblock count", format->subBlockCount()); + //------------------------------------------------------------------------- + static void traceStringItem( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::SDES::Chunk::StringItem *common + ) noexcept + { + auto type = common->type(); - size_t subBlockCount = format->subBlockCount(); - if (subBlockCount > 0) { - ElementPtr subblocksEl = Element::create("SubBlocks"); - for (size_t indexSubBlock = 0; indexSubBlock < subBlockCount; ++indexSubBlock) - { - ElementPtr subblockEl = Element::create("SubBlock"); - auto subBlock = format->subBlockAtIndex(indexSubBlock); - UseServicesHelper::debugAppend(subblockEl, "ssrc", subBlock->ssrc()); - UseServicesHelper::debugAppend(subblockEl, "lrr", subBlock->lrr()); - UseServicesHelper::debugAppend(subblockEl, "dlrr", subBlock->dlrr()); - UseServicesHelper::debugAppend(subblocksEl, subblockEl); - } - UseServicesHelper::debugAppend(formatEl, subblocksEl); - } + if (RTCPPacket::SDES::Chunk::Priv::kItemType == type) { + RTCPPacket::SDES::Chunk::Priv *priv = reinterpret_cast(common); + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceChunkStringItemPriv, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, type, common->type(), + size_t, prefixLength, priv->prefixLength(), + string, prefix, priv->prefix(), + size_t, length, common->length(), + string, value, common->value() + ); + } else { + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceChunkStringItem, ol, RtcpPacket, Parse, + puid, mediaChannelID, mediaChannelID, + byte, type, common->type(), + size_t, length, common->length(), + string, value, common->value() + ); + } + } - UseServicesHelper::debugAppend(formatEl, "next dlrr report block", (NULL != format->nextDLRRReportBlock())); + //------------------------------------------------------------------------- + static void traceStringItemList( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::SDES::Chunk::StringItem *first + ) noexcept + { + if (NULL == first) return; - UseServicesHelper::debugAppend(formatsEl, formatEl); - } - UseServicesHelper::debugAppend(subEl, formatsEl); - } + RTCPPacket::SDES::Chunk::StringItem *item = first; + for (; NULL != item; item = item->mNext) { + traceStringItem(mediaChannelID, item); } + } - { - auto count = xr->statisticsSummaryReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("StatisticsSummaryReportBlocks"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("StatisticsSummaryReportBlock"); + //------------------------------------------------------------------------- + static void traceDWORDs( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + const char *type, + DWORD *values, + size_t count + ) noexcept + { + if (NULL == values) return; - auto format = xr->statisticsSummaryReportBlockAtIndex(index); + for (size_t index = 0; index < count; ++index) { + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceDWORDs, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, type, + size_t, index, index, + dword, value, values[index] + ); + } + } + + //------------------------------------------------------------------------- + static void traceFeedbackMessage( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::FeedbackMessage *common + ) noexcept + { + traceReport(mediaChannelID, common); + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceFeedbackMessage, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, fmt, common->fmt(), + dword, ssrcOfPacketSender, common->ssrcOfPacketSender(), + dword, ssrcOfMediaSource, common->ssrcOfMediaSource(), + buffer, fci, common->fci(), + size, fciSize, common->fciSize() + ); + } + + //------------------------------------------------------------------------- + static void traceTMMBRCommon( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + BYTE fmt, + RTCPPacket::TransportLayerFeedbackMessage::TMMBRCommon *common + ) noexcept + { + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceFeedbackMessageTMMBRCommon, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, fmt, fmt, + dword, ssrc, common->ssrc(), + byte, mxTBRExp, common->mxTBRExp(), + dword, mxTBRMantissa, common->mxTBRMantissa(), + word, measuredOverhead, common->measuredOverhead() + ); + } + + //------------------------------------------------------------------------- + static void traceCodecControlCommon( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + BYTE fmt, + RTCPPacket::PayloadSpecificFeedbackMessage::CodecControlCommon *common + ) noexcept + { + ZS_EVENTING_5(x, i, Basic, RTCPPacketTraceFeedbackMessageCodecControlCommon, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, fmt, fmt, + dword, ssrc, common->ssrc(), + byte, seqNr, common->seqNr(), + dword, reserved, common->reserved() + ); + } - internal::toDebugReportBlockRange(formatEl, format); + //------------------------------------------------------------------------- + static void traceXRReportBlock( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::XR::ReportBlock *common + ) noexcept + { + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceXRReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + bool, next, (NULL != common->next()), + byte, blockType, common->blockType(), + byte, typeSpecific, common->typeSpecific(), + buffer, typeSpecificContents, common->typeSpecificContents(), + size, typeSpecificContentSize, common->typeSpecificContentSize() + ); + } - UseServicesHelper::debugAppend(formatEl, "loss report flag", format->lossReportFlag()); - UseServicesHelper::debugAppend(formatEl, "duplicate report flag", format->duplicateReportFlag()); - UseServicesHelper::debugAppend(formatEl, "jitter report flag", format->jitterFlag()); - UseServicesHelper::debugAppend(formatEl, "ttl flag", format->ttlFlag()); - UseServicesHelper::debugAppend(formatEl, "hop limit flag", format->hopLimitFlag()); + //------------------------------------------------------------------------- + static void traceReportBlockRange( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::XR::ReportBlockRange *common + ) noexcept + { + traceXRReportBlock(mediaChannelID, common); + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceXRReportBlockRange, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, reserved, common->reserved(), + byte, thinning, common->thinning(), + dword, ssrcOfSource, common->ssrcOfSource(), + word, beginSeq, common->beginSeq(), + word, endSeq, common->endSeq() + ); + } - if (format->lossReportFlag()) { - UseServicesHelper::debugAppend(formatEl, "lost packets", format->lostPackets()); - } - if (format->duplicateReportFlag()) { - UseServicesHelper::debugAppend(formatEl, "dup packets", format->dupPackets()); - } + //------------------------------------------------------------------------- + static void traceRLEReportBlock( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::XR::RLEReportBlock *common + ) noexcept + { + traceReportBlockRange(mediaChannelID, common); + auto count = common->chunkCount(); - if (format->jitterFlag()) { - UseServicesHelper::debugAppend(formatEl, "min jitter", format->minJitter()); - UseServicesHelper::debugAppend(formatEl, "max jitter", format->maxJitter()); - UseServicesHelper::debugAppend(formatEl, "mean jitter", format->meanJitter()); - UseServicesHelper::debugAppend(formatEl, "dev jitter", format->devJitter()); - } + if (count < 1) return; - if (format->ttlFlag()) { - UseServicesHelper::debugAppend(formatEl, "min ttl", format->minTTL()); - UseServicesHelper::debugAppend(formatEl, "max ttl", format->maxTTL()); - UseServicesHelper::debugAppend(formatEl, "mean ttl", format->meanTTL()); - UseServicesHelper::debugAppend(formatEl, "dev ttl", format->devTTL()); - } + ElementPtr outerEl = Element::create("chunks"); - if (format->hopLimitFlag()) { - UseServicesHelper::debugAppend(formatEl, "min hop limit", format->minHopLimit()); - UseServicesHelper::debugAppend(formatEl, "max hop limit", format->maxHopLimit()); - UseServicesHelper::debugAppend(formatEl, "mean hop limit", format->meanHopLimit()); - UseServicesHelper::debugAppend(formatEl, "dev hop limit", format->devHopLimit()); - } + for (size_t index = 0; index < count; ++index) { + RTCPPacket::XR::RLEChunk chunk = common->chunkAtIndex(index); - UseServicesHelper::debugAppend(formatEl, "next statistics summary report block", (NULL != format->nextStatisticsSummaryReportBlock())); + ElementPtr chunkEl; - UseServicesHelper::debugAppend(formatsEl, formatEl); - } - UseServicesHelper::debugAppend(subEl, formatsEl); + if (RTCPPacket::XR::isRunLengthChunk(chunk)) { + RTCPPacket::XR::RunLength rl(chunk); + ZS_EVENTING_3(x, i, Basic, RTCPPacketTraceXRRLEReportBlockChunkRunLength, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, runType, rl.runType(), + size_t, runLength, rl.runLength() + ); + } else if (RTCPPacket::XR::isBitVectorChunk(chunk)) { + RTCPPacket::XR::BitVector bv(chunk); + ZS_EVENTING_2(x, i, Basic, RTCPPacketTraceXRRLEReportBlockChunkBitVector, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + word, bitVector, bv.bitVector() + ); + } else { + ZS_EVENTING_2(x, i, Basic, RTCPPacketTraceXRRLEReportBlockChunkUnknown, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + word, chunk, chunk + ); } } + } - { - auto count = xr->voIPMetricsReportBlockCount(); - if (count > 0) { - ElementPtr formatsEl = Element::create("VoIPMetricsReportBlocks"); - - for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("VoIPMetricsReportBlock"); - - auto format = xr->voIPMetricsReportBlockAtIndex(index); - - internal::toDebugReportBlock(formatEl, format); - - UseServicesHelper::debugAppend(formatEl, "ssrc of source", format->ssrcOfSource()); - - UseServicesHelper::debugAppend(formatEl, "loss rate", format->lossRate()); - UseServicesHelper::debugAppend(formatEl, "discard rate", format->discardRate()); - UseServicesHelper::debugAppend(formatEl, "burst density", format->burstDensity()); - UseServicesHelper::debugAppend(formatEl, "gap densitity", format->gapDensity()); - - UseServicesHelper::debugAppend(formatEl, "burst duration", format->burstDuration()); - UseServicesHelper::debugAppend(formatEl, "gap duration", format->gapDuration()); - - UseServicesHelper::debugAppend(formatEl, "round trip delay", format->roundTripDelay()); - UseServicesHelper::debugAppend(formatEl, "end system delay", format->endSystemDelay()); + //------------------------------------------------------------------------- + static void traceSenderReport( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::SenderReport *sr + ) noexcept + { + traceSenderReceiverCommonReport(mediaChannelID, sr); + ZS_EVENTING_7(x, i, Basic, RTCPPacketTraceSenderReport, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + dword, ntpTimestampMS, sr->ntpTimestampMS(), + dword, ntpTimestampLS, sr->ntpTimestampLS(), + string, ntpTimestamp, string(sr->ntpTimestamp()), + dword, senderPacketCount, sr->senderPacketCount(), + dword, senderOctetCount, sr->senderOctetCount(), + bool, nextSenderReport, (NULL != sr->nextSenderReport()) + ); + } - UseServicesHelper::debugAppend(formatEl, "signal level", format->signalLevel()); - UseServicesHelper::debugAppend(formatEl, "noise level", format->noiseLevel()); - UseServicesHelper::debugAppend(formatEl, "rerl", format->rerl()); - UseServicesHelper::debugAppend(formatEl, "Gmin", format->Gmin()); + //------------------------------------------------------------------------- + static void traceReceiverReport( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::ReceiverReport *rr + ) noexcept + { + ElementPtr subEl = Element::create("ReceiverReport"); + traceSenderReceiverCommonReport(mediaChannelID, rr); + ZS_EVENTING_2(x, i, Basic, RTCPPacketTraceReceiverReport, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + bool, nextReceiverReport, (NULL != rr->nextReceiverReport()) + ); + } - UseServicesHelper::debugAppend(formatEl, "r factor", format->rFactor()); - UseServicesHelper::debugAppend(formatEl, "ext r factor", format->extRFactor()); - UseServicesHelper::debugAppend(formatEl, "moslq", format->mosLQ()); - UseServicesHelper::debugAppend(formatEl, "moscq", format->mosCQ()); + //------------------------------------------------------------------------- + static void traceSDES( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::SDES *sdes + ) noexcept + { + traceReport(mediaChannelID, sdes); - UseServicesHelper::debugAppend(formatEl, "rx config", format->rxConfig()); - UseServicesHelper::debugAppend(formatEl, "plc", format->plc()); - UseServicesHelper::debugAppend(formatEl, "jba", format->jba()); - UseServicesHelper::debugAppend(formatEl, "jb rate", format->jbRate()); + ZS_EVENTING_3(x, i, Basic, RTCPPacketTraceSDES, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, sc, sdes->sc(), + bool, nextSDES, (NULL != sdes->nextSDES()) + ); - UseServicesHelper::debugAppend(formatEl, "jb nominal", format->jbNominal()); - UseServicesHelper::debugAppend(formatEl, "jb maximum", format->jbMaximum()); - UseServicesHelper::debugAppend(formatEl, "jb abs max", format->jbAbsMax()); + RTCPPacket::SDES::Chunk *chunk = sdes->firstChunk(); + if (NULL != chunk) { + for (; NULL != chunk; chunk = chunk->next()) { + ZS_EVENTING_14(x, i, Basic, RTCPPacketTraceSDESChunk, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + dword, ssrc, chunk->ssrc(), + size_t, count, chunk->count(), + size_t, cNameCount, chunk->cNameCount(), + size_t, nameCount, chunk->nameCount(), + size_t, emailCount, chunk->emailCount(), + size_t, phoneCount, chunk->phoneCount(), + size_t, locCount, chunk->locCount(), + size_t, toolCount, chunk->toolCount(), + size_t, noteCount, chunk->noteCount(), + size_t, privCount, chunk->privCount(), + size_t, midCount, chunk->midCount(), + size_t, ridCount, chunk->ridCount(), + size_t, unknownCount, chunk->unknownCount() + ); + + traceStringItemList(mediaChannelID, chunk->firstCName()); + traceStringItemList(mediaChannelID, chunk->firstName()); + traceStringItemList(mediaChannelID, chunk->firstEmail()); + traceStringItemList(mediaChannelID, chunk->firstPhone()); + traceStringItemList(mediaChannelID, chunk->firstLoc()); + traceStringItemList(mediaChannelID, chunk->firstTool()); + traceStringItemList(mediaChannelID, chunk->firstNote()); + traceStringItemList(mediaChannelID, chunk->firstPriv()); + traceStringItemList(mediaChannelID, chunk->firstMid()); + traceStringItemList(mediaChannelID, chunk->firstRid()); + traceStringItemList(mediaChannelID, chunk->firstUnknown()); + } + } + } + + //------------------------------------------------------------------------- + static void traceBye( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::Bye *bye + ) noexcept + { + traceReport(mediaChannelID, bye); + ZS_EVENTING_3(x, i, Basic, RTCPPacketTraceBye, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, reasonForLeaving, bye->reasonForLeaving(), + bool, nextBye, (NULL != bye->nextBye()) + ); + traceDWORDs(mediaChannelID, "ssrc", bye->mSSRCs, bye->sc()); + } + + //------------------------------------------------------------------------- + static void traceApp( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::App *app + ) noexcept + { + traceReport(mediaChannelID, app); + ZS_EVENTING_7(x, i, Basic, RTCPPacketTraceApp, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, subtype, app->subtype(), + dword, ssrc, app->ssrc(), + string, name, app->name(), + buffer, data, app->data(), + size, dataSize, app->dataSize(), + bool, nextApp, (NULL != app->nextApp()) + ); + } + + //------------------------------------------------------------------------- + static void traceTransportLayerFeedbackMessage( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::TransportLayerFeedbackMessage *fm + ) noexcept + { + traceFeedbackMessage(mediaChannelID, fm); + + ZS_EVENTING_3(x, i, Basic, RTCPPacketTraceTransportLayerFeedbackMessage, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + bool, unknown, (NULL != fm->unknown()), + bool, nextTransportLayerFeedbackMessage, (NULL != fm->nextTransportLayerFeedbackMessage()) + ); - UseServicesHelper::debugAppend(formatEl, "next voip metrics report block", (NULL != format->nextVoIPMetricsReportBlock())); + { + auto count = fm->genericNACKCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->genericNACKAtIndex(index); - UseServicesHelper::debugAppend(formatsEl, formatEl); + ZS_EVENTING_3(x, i, Basic, RTCPPacketTransportLayerFeedbackMessageGenericNACK, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + word, pid, format->pid(), + word, blp, format->blp() + ); } - UseServicesHelper::debugAppend(subEl, formatsEl); } } { - auto count = xr->unknownReportBlockCount(); + auto count = fm->tmmbrCount(); if (count > 0) { - ElementPtr formatsEl = Element::create("UnknownReportBlocks"); + ElementPtr formatsEl = Element::create("TMMBRs"); for (size_t index = 0; index < count; ++index) { - ElementPtr formatEl = Element::create("UnknownReportBlock"); - - auto format = xr->unknownReportBlockAtIndex(index); - - internal::toDebugReportBlock(formatEl, format); - - UseServicesHelper::debugAppend(formatEl, "next unknown report block", (NULL != format->nextUnknownReportBlock())); + ElementPtr formatEl = Element::create("TMMBR"); - UseServicesHelper::debugAppend(formatsEl, formatEl); + auto format = fm->tmmbrAtIndex(index); + traceTMMBRCommon(mediaChannelID, RTCPPacket::TransportLayerFeedbackMessage::TMMBR::kFmt, format); } - UseServicesHelper::debugAppend(subEl, formatsEl); } } - UseServicesHelper::debugAppend(subEl, "next xr", (NULL != xr->nextXR())); - return subEl; + { + auto count = fm->tmmbrCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->tmmbnAtIndex(index); + traceTMMBRCommon(mediaChannelID, RTCPPacket::TransportLayerFeedbackMessage::TMMBN::kFmt, format); + } + } + } } //------------------------------------------------------------------------- - ElementPtr RTCPPacket::toDebug() const + static void tracePayloadSpecificFeedbackMessage( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::PayloadSpecificFeedbackMessage *fm + ) noexcept { - ElementPtr objectEl = Element::create("ortc::RTCPPacket"); + traceFeedbackMessage(mediaChannelID, fm); + + { + auto format = fm->pli(); + if (NULL != format) { + ZS_EVENTING_1(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessagePLI, ol, RtcpPacket, Info, puid, mediaChannelID, mediaChannelID); + } + } - UseServicesHelper::debugAppend(objectEl, "buffer", mBuffer ? mBuffer->SizeInBytes() : 0); - UseServicesHelper::debugAppend(objectEl, "allocate buffer", mAllocationBuffer ? mAllocationBuffer->SizeInBytes() : 0); + { + auto count = fm->sliCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->sliAtIndex(index); - UseServicesHelper::debugAppend(objectEl, "allocation pos", (NULL != mAllocationPos ? (mAllocationBuffer ? (reinterpret_cast(mAllocationPos) - reinterpret_cast(mAllocationBuffer->BytePtr())) : reinterpret_cast(mAllocationPos)) : 0)); - UseServicesHelper::debugAppend(objectEl, "buffer", mAllocationSize); + ZS_EVENTING_5(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageSLI, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, index, + word, first, format->first(), + word, number, format->number(), + byte, pictureID, format->pictureID() + ); + } + } + } - for (Report *report = mFirst; NULL != report; report = report->next()) { - switch (report->pt()) { - case SenderReport::kPayloadType: - { - SenderReport *sr = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugSenderReport(sr)); - break; + auto format = fm->rpsi(); + if (NULL != format) { + ZS_EVENTING_5(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageRPSI, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, zeroBit, format->zeroBit(), + byte, payloadType, format->payloadType(), + buffer, nativeRPSIBitString, format->nativeRPSIBitString(), + size, nativeRPSIBitStringSizeInBits, (format->nativeRPSIBitStringSizeInBits()/8)+(0 == format->nativeRPSIBitStringSizeInBits()%8 ? 0 : 1) + ); + } + } + + { + auto count = fm->firCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->firAtIndex(index); + traceCodecControlCommon(mediaChannelID, RTCPPacket::PayloadSpecificFeedbackMessage::FIR::kFmt, format); } - case ReceiverReport::kPayloadType: - { - ReceiverReport *rr = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugReceiverReport(rr)); - break; + } + } + + { + auto count = fm->tstrCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->tstrAtIndex(index); + traceCodecControlCommon(mediaChannelID, RTCPPacket::PayloadSpecificFeedbackMessage::TSTR::kFmt, format); + + ZS_EVENTING_4(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageTSTx, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, "TSTR", + size_t, index, index, + byte, formatIndex, format->index() + ); } - case SDES::kPayloadType: - { - SDES *sdes = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugSDES(sdes)); - break; - } - case Bye::kPayloadType: - { - Bye *bye = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugBye(bye)); - break; - } - case App::kPayloadType: - { - App *app = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugApp(app)); - break; - } - case TransportLayerFeedbackMessage::kPayloadType: - { - TransportLayerFeedbackMessage *fm = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugTransportLayerFeedbackMessage(fm)); - break; - } - case PayloadSpecificFeedbackMessage::kPayloadType: - { - PayloadSpecificFeedbackMessage *fm = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugPayloadSpecificFeedbackMessage(fm)); - break; - } - case XR::kPayloadType: - { - XR *xr = static_cast(report); - UseServicesHelper::debugAppend(objectEl, toDebugXR(xr)); - break; - } - default: - { - UnknownReport *unknown = static_cast(report); - - ElementPtr subEl = Element::create("UnknownReport"); - internal::toDebug(subEl, unknown); - - UseServicesHelper::debugAppend(subEl, "next unknown", (NULL != unknown->nextUnknown())); + } + } - UseServicesHelper::debugAppend(objectEl, subEl); - break; + { + auto count = fm->tstnCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->tstnAtIndex(index); + traceCodecControlCommon(mediaChannelID, RTCPPacket::PayloadSpecificFeedbackMessage::TSTN::kFmt, format); + + ZS_EVENTING_4(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageTSTx, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, "TSTN", + size_t, index, index, + byte, formatIndex, format->index() + ); } } } - return objectEl; - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket (internal) - #pragma mark + { + auto count = fm->vbcmCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = fm->vbcmAtIndex(index); + traceCodecControlCommon(mediaChannelID, RTCPPacket::PayloadSpecificFeedbackMessage::TSTN::kFmt, format); + + ZS_EVENTING_6(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageVBCM, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, index, + byte, zeroBit, format->zeroBit(), + byte, payloadType, format->payloadType(), + buffer, vbcmOctetString, format->vbcmOctetString(), + size, vbcmOctetStringSize, format->vbcmOctetStringSize() + ); + } + } + } - //------------------------------------------------------------------------- - Log::Params RTCPPacket::slog(const char *message) - { - return packet_slog(message); - } + { + auto format = fm->afb(); + auto remb = fm->remb(); - //------------------------------------------------------------------------- - Log::Params RTCPPacket::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTCPPacket"); - return Log::Params(message, objectEl); - } + if ((NULL != format) && + (NULL == remb)) { + ZS_EVENTING_3(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageAFB, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + buffer, data, format->data(), + size, dataSize, format->dataSize() + ); + } + } - //------------------------------------------------------------------------- - Log::Params RTCPPacket::debug(const char *message) const - { - return Log::Params(message, toDebug()); + { + auto format = fm->remb(); + if (NULL != format) { + ZS_EVENTING_4(x, i, Basic, RTCPPacketTracePayloadSpecificFeedbackMessageREMB, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, numSSRC, format->numSSRC(), + byte, brExp, format->brExp(), + dword, brMantissa, format->brMantissa() + ); + traceDWORDs(mediaChannelID, "ssrc", format->mSSRCs, format->numSSRC()); + } + } } //------------------------------------------------------------------------- - bool RTCPPacket::parse() + static void traceXR( + IMediaStreamTrackTypes::MediaChannelID mediaChannelID, + RTCPPacket::XR *xr + ) noexcept { - const BYTE *buffer = mBuffer->BytePtr(); - size_t size = mBuffer->SizeInBytes(); - - if (size < kMinRtcpPacketLen) { - ZS_LOG_WARNING(Trace, log("packet length is too short") + ZS_PARAM("length", size)) - return false; - } + traceReport(mediaChannelID, xr); - bool foundPaddingBit = false; + ZS_EVENTING_5(x, i, Basic, RTCPPacketTraceXR, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + byte, numSSRC, xr->reserved(), + dword, ssrc, xr->ssrc(), + size_t, reportBlockCount, xr->reportBlockCount(), + bool, next, xr->nextXR() + ); - // scope: calculate total memory allocation size needed to parse entire RTCP packet { - size_t remaining = size; - const BYTE *pos = buffer; - - while (remaining >= kMinRtcpPacketLen) { - auto version = RTCP_GET_BITS(*pos, 0x3, 6); - if (kRtpVersion != version) { - ZS_LOG_WARNING(Trace, debug("illegal version found") + ZS_PARAM("version", version)) - return false; + auto count = xr->lossRLEReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->lossRLEReportBlockAtIndex(index); + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceXRTypeRLEReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, "LossRLE", + size_t, index, index, + bool, next, (NULL != format->nextLossRLE()) + ); + traceRLEReportBlock(mediaChannelID, format); } + } + } - size_t length = sizeof(DWORD) + (static_cast(RTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD)); - - size_t padding = 0; - - if (RTCP_IS_FLAG_SET(*pos, 5)) { - if (foundPaddingBit) { - ZS_LOG_WARNING(Trace, debug("found illegal second padding bit set in compound RTCP block")) - return false; - } - - padding = buffer[size-1]; + { + auto count = xr->duplicateRLEReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->duplicateRLEReportBlockAtIndex(index); + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceXRTypeRLEReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, "DuplicateRLE", + size_t, index, index, + bool, next, (NULL != format->nextDuplicateRLE()) + ); + traceRLEReportBlock(mediaChannelID, format); } + } + } - if ((sizeof(DWORD) + padding) > length) { - ZS_LOG_WARNING(Trace, debug("malformed padding size in RTCP packet")) - return false; + { + auto count = xr->packetReceiptTimesReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->packetReceiptTimesReportBlockAtIndex(index); + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceXRTypeRLEReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, "PacketReceiptTimes", + size_t, index, index, + bool, next, (NULL != format->nextPacketReceiptTimesReportBlock()) + ); + traceDWORDs(mediaChannelID, "receipt time", format->mReceiptTimes, format->receiptTimeCount()); + traceReportBlockRange(mediaChannelID, format); } + } + } - length -= padding; - - if (remaining < length) { - ZS_LOG_WARNING(Trace, debug("insufficient length remaining for RTCP block") + ZS_PARAM("length", length) + ZS_PARAM("remaining", remaining)) - return false; + { + auto count = xr->receiverReferenceTimeReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->receiverReferenceTimeReportBlockAtIndex(index); + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceXRReceiverReferenceTimeReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, index, + dword, ntpTimestampMS, format->ntpTimestampMS(), + dword, ntpTimestampLS, format->ntpTimestampLS(), + string, ntpTimestamp, string(format->ntpTimestamp()), + bool, next, (NULL != format->nextReceiverReferenceTimeReportBlock()) + ); + traceXRReportBlock(mediaChannelID, format); } + } + } - BYTE reportSpecific = RTCP_GET_BITS(*pos, 0x1F, 0); - - const BYTE *prePos = pos; - BYTE pt = pos[1]; - - advancePos(pos, remaining, sizeof(DWORD)); - - size_t preAllocationSize = mAllocationSize; - - if (!getAllocationSize(static_cast(version), static_cast(padding), reportSpecific, pt, pos, static_cast(length - sizeof(DWORD)))) return false; + { + auto count = xr->dlrrReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->dlrrReportBlockAtIndex(index); + size_t subBlockCount = format->subBlockCount(); - advancePos(pos, remaining, length - sizeof(DWORD)); + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceXRDLRRReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, index, + size_t, subBlockCount, subBlockCount, + bool, next, (NULL != format->nextDLRRReportBlock()) + ); - if (0 != padding) { - advancePos(pos, remaining, padding); + if (subBlockCount > 0) { + for (size_t indexSubBlock = 0; indexSubBlock < subBlockCount; ++indexSubBlock) + { + auto subBlock = format->subBlockAtIndex(indexSubBlock); + ZS_EVENTING_6(x, i, Basic, RTCPPacketTraceXRDLRRReportBlockSubBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, indexSubBlock, + size_t, subBlockCount, subBlockCount, + dword, ssrc, subBlock->ssrc(), + dword, lrr, subBlock->lrr(), + dword, dlrr, subBlock->dlrr() + ); + } + } + traceXRReportBlock(mediaChannelID, format); } + } + } - if (ZS_IS_LOGGING(Insane)) { - ZS_LOG_TRACE(log("report allocation size") + ZS_PARAM("pt", Report::ptToString(pt)) + ZS_PARAM("pt (number)", pt) + ZS_PARAM("consumed", (reinterpret_cast(pos) - reinterpret_cast(prePos))) + ZS_PARAM("allocation size", mAllocationSize - preAllocationSize)) + { + auto count = xr->statisticsSummaryReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->statisticsSummaryReportBlockAtIndex(index); + ZS_EVENTING_22(x, i, Basic, RTCPPacketTraceXRStatisticsSummary, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, index, + bool, lossReportFlag, format->lossReportFlag(), + bool, lrr, format->duplicateReportFlag(), + bool, jitterFlag, format->jitterFlag(), + bool, ttlFlag, format->ttlFlag(), + bool, hopLimitFlag, format->hopLimitFlag(), + dword, lostPackets, format->lossReportFlag() ? format->lostPackets() : 0, + dword, dupPackets, format->duplicateReportFlag() ? format->dupPackets() : 0, + dword, minJitter, format->jitterFlag() ? format->minJitter() : 0, + dword, maxJitter, format->jitterFlag() ? format->maxJitter() : 0, + dword, meanJitter, format->jitterFlag() ? format->meanJitter() : 0, + dword, devJitter, format->jitterFlag() ? format->devJitter() : 0, + byte, minTTL, format->ttlFlag() ? format->minTTL() : static_cast(0), + byte, maxTTL, format->ttlFlag() ? format->maxTTL() : static_cast(0), + byte, meanTTL, format->ttlFlag() ? format->meanTTL() : static_cast(0), + byte, devTTL, format->ttlFlag() ? format->devTTL() : static_cast(0), + byte, minHopLimit, format->hopLimitFlag() ? format->minHopLimit() : static_cast(0), + byte, maxHopLimit, format->hopLimitFlag() ? format->maxHopLimit() : static_cast(0), + byte, meanHopLimit, format->hopLimitFlag() ? format->meanHopLimit() : static_cast(0), + byte, devHopLimit, format->hopLimitFlag() ? format->devHopLimit() : static_cast(0), + bool, next, (NULL != format->nextStatisticsSummaryReportBlock()) + ); + traceReportBlockRange(mediaChannelID, format); } - - ++mCount; } } - if (0 == mAllocationSize) { - ZS_LOG_TRACE(debug("no RTCP packets were processed")) - return true; + { + auto count = xr->voIPMetricsReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->voIPMetricsReportBlockAtIndex(index); + ZS_EVENTING_27(x, i, Basic, RTCPPacketTraceXRVoIPMetricsReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + size_t, index, index, + dword, ssrcOfSource, format->ssrcOfSource(), + byte, lossRate, format->lossRate(), + byte, discardRate, format->discardRate(), + byte, burstDensity, format->burstDensity(), + byte, gapDensity, format->gapDensity(), + word, burstDuration, format->burstDuration(), + word, gapDuration, format->gapDuration(), + word, roundTripDelay, format->roundTripDelay(), + word, endSystemDelay, format->endSystemDelay(), + byte, signalLevel, format->signalLevel(), + byte, noiseLevel, format->noiseLevel(), + byte, rerl, format->rerl(), + byte, Gmin, format->Gmin(), + byte, rFactor, format->rFactor(), + byte, extRFactor, format->extRFactor(), + byte, mosLQ, format->mosLQ(), + byte, mosCQ, format->mosCQ(), + byte, rxConfig, format->rxConfig(), + byte, plc, format->plc(), + byte, jba, format->jba(), + byte, jbRate, format->jbRate(), + word, jbNominal, format->jbNominal(), + word, jbMaximum, format->jbMaximum(), + word, jbAbsMax, format->jbAbsMax(), + bool, next, (NULL != format->nextVoIPMetricsReportBlock()) + ); + + traceXRReportBlock(mediaChannelID, format); + } + } } - mAllocationBuffer = make_shared(alignedSize(mAllocationSize)); - - mAllocationPos = mAllocationBuffer->BytePtr(); - - // scope: allocation size is now established; begin parsing all reports contained in RTCP packet { - size_t remaining = size; - const BYTE *pos = buffer; + auto count = xr->unknownReportBlockCount(); + if (count > 0) { + for (size_t index = 0; index < count; ++index) { + auto format = xr->unknownReportBlockAtIndex(index); + ZS_EVENTING_4(x, i, Basic, RTCPPacketTraceXRTypeRLEReportBlock, ol, RtcpPacket, Info, + puid, mediaChannelID, mediaChannelID, + string, type, "UnknownReportBlock", + size_t, index, index, + bool, next, (NULL != format->nextUnknownReportBlock()) + ); + + traceXRReportBlock(mediaChannelID, format); + } + } + } + } + } // namespace internal - if (0 != mSenderReportCount) { - mFirstSenderReport = new (allocateBuffer(alignedSize(sizeof(SenderReport)) * mSenderReportCount)) SenderReport[mSenderReportCount]; - } - if (0 != mReceiverReportCount) { - mFirstReceiverReport = new (allocateBuffer(alignedSize(sizeof(ReceiverReport)) * mReceiverReportCount)) ReceiverReport[mReceiverReportCount]; - } - if (0 != mSDESCount) { - mFirstSDES = new (allocateBuffer(alignedSize(sizeof(SDES)) * mSDESCount)) SDES[mSDESCount]; - } - if (0 != mByeCount) { - mFirstBye = new (allocateBuffer(alignedSize(sizeof(Bye)) * mByeCount)) Bye[mByeCount]; - } - if (0 != mAppCount) { - mFirstApp = new (allocateBuffer(alignedSize(sizeof(App)) * mAppCount)) App[mAppCount]; - } - if (0 != mTransportLayerFeedbackMessageCount) { - mFirstTransportLayerFeedbackMessage = new (allocateBuffer(alignedSize(sizeof(TransportLayerFeedbackMessage)) * mTransportLayerFeedbackMessageCount)) TransportLayerFeedbackMessage[mTransportLayerFeedbackMessageCount]; - } - if (0 != mPayloadSpecificFeedbackMessageCount) { - mFirstPayloadSpecificFeedbackMessage = new (allocateBuffer(alignedSize(sizeof(PayloadSpecificFeedbackMessage)) * mPayloadSpecificFeedbackMessageCount)) PayloadSpecificFeedbackMessage[mPayloadSpecificFeedbackMessageCount]; - } - if (0 != mXRCount) { - mFirstXR = new (allocateBuffer(alignedSize(sizeof(XR)) * mXRCount)) XR[mXRCount]; - } - if (0 != mUnknownReportCount) { - mFirstUnknownReport = new (allocateBuffer(alignedSize(sizeof(UnknownReport)) * mUnknownReportCount)) UnknownReport[mUnknownReportCount]; - } + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::SenderReport + // - mSenderReportCount = 0; - mReceiverReportCount = 0; - mSDESCount = 0; - mByeCount = 0; - mAppCount = 0; - mTransportLayerFeedbackMessageCount = 0; - mPayloadSpecificFeedbackMessageCount = 0; - mXRCount = 0; - mUnknownReportCount = 0; + //------------------------------------------------------------------------- + const char *RTCPPacket::Report::ptToString(BYTE pt) noexcept + { + switch (pt) { + case SenderReport::kPayloadType: return "SenderReport"; + case ReceiverReport::kPayloadType: return "ReceiverReport"; + case SDES::kPayloadType: return "SDES"; + case Bye::kPayloadType: return "Bye"; + case App::kPayloadType: return "App"; + case TransportLayerFeedbackMessage::kPayloadType: return "TransportLayerFeedbackMessage"; + case PayloadSpecificFeedbackMessage::kPayloadType: return "PayloadSpecificFeedbackMessage"; + case XR::kPayloadType: return "XR"; + default: { + } + } + return "Uknown"; + } - Report *lastReport = NULL; - size_t count = 0; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::SenderReport + // - while (remaining >= kMinRtcpPacketLen) { - auto version = RTCP_GET_BITS(*pos, 0x3, 6); - size_t length = sizeof(DWORD) + (static_cast(RTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD)); + //------------------------------------------------------------------------- + Time RTCPPacket::SenderReport::ntpTimestamp() const noexcept + { + return UseRTPUtils::ntpToTime(mNTPTimestampMS, mNTPTimestampLS); + } - size_t padding = 0; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk::StringItem + // - if (RTCP_IS_FLAG_SET(*pos, 5)) { - padding = buffer[size-1]; - length -= padding; // already protected during pre-parse against malformed padding length - } + //------------------------------------------------------------------------- + const char *RTCPPacket::SDES::Chunk::StringItem::typeToString(BYTE type) noexcept + { + switch (type) { + case CName::kItemType: return "CName"; + case Name::kItemType: return "Name"; + case Email::kItemType: return "Email"; + case Phone::kItemType: return "Phone"; + case Loc::kItemType: return "Loc"; + case Tool::kItemType: return "Tool"; + case Note::kItemType: return "Note"; + case Priv::kItemType: return "Priv"; + case Mid::kItemType: return "Mid"; + case Rid::kItemType: return "Rid"; + default: { + break; + } + } + return "Unknown"; + } - BYTE reportSpecific = RTCP_GET_BITS(*pos, 0x1F, 0); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::SDES::Chunk + // - const BYTE *prePos = pos; - BYTE pt = pos[1]; + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::CName *RTCPPacket::SDES::Chunk::cNameAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mCNameCount); + return &(mFirstCName[index]); + } - advancePos(pos, remaining, sizeof(DWORD)); + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Name *RTCPPacket::SDES::Chunk::nameAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mNameCount); + return &(mFirstName[index]); + } - size_t preAllocationSize = mAllocationSize; + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Email *RTCPPacket::SDES::Chunk::emailAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mEmailCount); + return &(mFirstEmail[index]); + } - if (!parse(lastReport, version, static_cast(padding), reportSpecific, pt, pos, length - sizeof(DWORD))) return false; + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Phone *RTCPPacket::SDES::Chunk::phoneAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mPhoneCount); + return &(mFirstPhone[index]); + } - if (NULL == mFirst) { - mFirst = lastReport; - } + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Loc *RTCPPacket::SDES::Chunk::locAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mLocCount); + return &(mFirstLoc[index]); + } - advancePos(pos, remaining, length - sizeof(DWORD)); + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Tool *RTCPPacket::SDES::Chunk::toolAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mToolCount); + return &(mFirstTool[index]); + } - if (0 != padding) { - advancePos(pos, remaining, padding); - } + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Note *RTCPPacket::SDES::Chunk::noteAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mNoteCount); + return &(mFirstNote[index]); + } - if (ZS_IS_LOGGING(Insane)) { - ZS_LOG_TRACE(log("report parsed") + ZS_PARAM("pt", Report::ptToString(pt)) + ZS_PARAM("pt (number)", pt) + ZS_PARAM("consumed", (reinterpret_cast(pos) - reinterpret_cast(prePos))) + ZS_PARAM("consumed allocation", preAllocationSize - mAllocationSize)) - } + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Priv *RTCPPacket::SDES::Chunk::privAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mPrivCount); + return &(mFirstPriv[index]); + } - ++count; - ASSERT(count <= mCount) - } - } + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Mid *RTCPPacket::SDES::Chunk::midAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mMidCount); + return &(mFirstMid[index]); + } - ZS_LOG_INSANE(debug("parsed")) + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Rid *RTCPPacket::SDES::Chunk::ridAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mRidCount); + return &(mFirstRid[index]); + } - return true; - } + //------------------------------------------------------------------------- + RTCPPacket::SDES::Chunk::Unknown *RTCPPacket::SDES::Chunk::unknownAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mUnknownCount); + return &(mFirstUnknown[index]); + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket (parse allocation sizing routines) - #pragma mark + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::Bye + // - //------------------------------------------------------------------------- - bool RTCPPacket::getAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - BYTE pt, - const BYTE *contents, - size_t contentSize - ) - { - bool result = false; + //------------------------------------------------------------------------- + DWORD RTCPPacket::Bye::ssrc(size_t index) const noexcept + { + ZS_ASSERT(index < sc()); + return mSSRCs[index]; + } - switch (pt) { - case SenderReport::kPayloadType: result = getSenderReportAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case ReceiverReport::kPayloadType: result = getReceiverReportAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case SDES::kPayloadType: result = getSDESAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case Bye::kPayloadType: result = getByeAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case App::kPayloadType: result = getAppAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case TransportLayerFeedbackMessage::kPayloadType: result = getTransportLayerFeedbackMessageAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case PayloadSpecificFeedbackMessage::kPayloadType: result = getPayloadSpecificFeedbackMessageAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - case XR::kPayloadType: result = getXRAllocationSize(version, padding, reportSpecific, contents, contentSize); break; - default: - { - result = getUnknownReportAllocationSize(version, padding, reportSpecific, contents, contentSize); - break; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::FeedbackMessage + // + + //------------------------------------------------------------------------- + const char *RTCPPacket::FeedbackMessage::fmtToString(BYTE pt, BYTE fmt, DWORD subFmt) noexcept + { + switch (pt) { + case TransportLayerFeedbackMessage::kPayloadType: { + switch (fmt) { + case TransportLayerFeedbackMessage::GenericNACK::kFmt: return "GenericNACK"; + case TransportLayerFeedbackMessage::TMMBR::kFmt: return "TMMBR"; + case TransportLayerFeedbackMessage::TMMBN::kFmt: return "TMMBN"; + default: break; + } + break; + } + case PayloadSpecificFeedbackMessage::kPayloadType: { + switch (fmt) { + case PayloadSpecificFeedbackMessage::PLI::kFmt: return "PLI"; + case PayloadSpecificFeedbackMessage::SLI::kFmt: return "SLI"; + case PayloadSpecificFeedbackMessage::RPSI::kFmt: return "RPSI"; + case PayloadSpecificFeedbackMessage::FIR::kFmt: return "FIR"; + case PayloadSpecificFeedbackMessage::TSTR::kFmt: return "TSTR"; + case PayloadSpecificFeedbackMessage::TSTN::kFmt: return "TSTN"; + case PayloadSpecificFeedbackMessage::VBCM::kFmt: return "VBCM"; + case PayloadSpecificFeedbackMessage::AFB::kFmt: { + const char *tmp = "REMB"; + if (subFmt == *(reinterpret_cast(tmp))) return "REMB"; + return "AFB"; + } + default: break; } + break; + } + default: { + break; } - return result; } + return "Unknown"; + } - //------------------------------------------------------------------------- - bool RTCPPacket::getSenderReportAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mSenderReportCount; + //------------------------------------------------------------------------- + const char *RTCPPacket::FeedbackMessage::fmtToString() const noexcept + { + if (PayloadSpecificFeedbackMessage::kPayloadType == mPT) { + if (PayloadSpecificFeedbackMessage::AFB::kFmt == mReportSpecific) { + auto result = reinterpret_cast(this); + const char tmp1[sizeof(DWORD)] {}; + const char *tmp2 = "REMB"; + const char *usingTmp = (result->mHasREMB ? tmp2 : (&(tmp1[0]))); - mAllocationSize += alignedSize(sizeof(SenderReport)) + (alignedSize(sizeof(SenderReport::ReportBlock)) * static_cast(reportSpecific)); - return true; + return fmtToString(mPT, mReportSpecific, *(reinterpret_cast(usingTmp))); + } } + return fmtToString(mPT, mReportSpecific); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getReceiverReportAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mReceiverReportCount; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::TransportLayerFeedbackMessage + // - mAllocationSize += alignedSize(sizeof(ReceiverReport)) + (alignedSize(sizeof(ReceiverReport::ReportBlock)) * static_cast(reportSpecific)); - return true; - } + //------------------------------------------------------------------------- + RTCPPacket::TransportLayerFeedbackMessage::GenericNACK *RTCPPacket::TransportLayerFeedbackMessage::genericNACKAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mGenericNACKCount); + return &(mFirstGenericNACK[index]); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getSDESAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mSDESCount; + //------------------------------------------------------------------------- + RTCPPacket::TransportLayerFeedbackMessage::TMMBR *RTCPPacket::TransportLayerFeedbackMessage::tmmbrAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mTMMBRCount); + return &(mFirstTMMBR[index]); + } - size_t chunksCount = static_cast(reportSpecific); + //------------------------------------------------------------------------- + RTCPPacket::TransportLayerFeedbackMessage::TMMBN *RTCPPacket::TransportLayerFeedbackMessage::tmmbnAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mTMMBNCount); + return &(mFirstTMMBN[index]); + } - mAllocationSize += alignedSize(sizeof(SDES)) + (alignedSize(sizeof(SDES::Chunk)) * chunksCount); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::VBCM + // - size_t remaining = contentSize; + //------------------------------------------------------------------------- + BYTE RTCPPacket::PayloadSpecificFeedbackMessage::VBCM::zeroBit() const noexcept + { + return RTCP_GET_BITS(mControlSpecific, 0x1, 23); + } - const BYTE *pos = contents; + //------------------------------------------------------------------------- + BYTE RTCPPacket::PayloadSpecificFeedbackMessage::VBCM::payloadType() const noexcept + { + return RTCP_GET_BITS(mControlSpecific, 0x7F, 16); + } - while ((remaining > sizeof(DWORD)) && - (chunksCount > 0)) - { - advancePos(pos, remaining, sizeof(DWORD)); + //------------------------------------------------------------------------- + size_t RTCPPacket::PayloadSpecificFeedbackMessage::VBCM::vbcmOctetStringSize() const noexcept + { + return RTCP_GET_BITS(mControlSpecific, 0xFFFF, 0); + } - ZS_LOG_INSANE(log("getting SDES chunk allocation size") + ZS_PARAM("chunk number", static_cast(reportSpecific) - chunksCount)) + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage::REMB + // - --chunksCount; + //------------------------------------------------------------------------- + DWORD RTCPPacket::PayloadSpecificFeedbackMessage::REMB::ssrcAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < numSSRC()); + return mSSRCs[index]; + } - while (remaining >= sizeof(BYTE)) { + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::PayloadSpecificFeedbackMessage + // - size_t preAllocationSize = mAllocationSize; + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::PLI *RTCPPacket::PayloadSpecificFeedbackMessage::pli() const noexcept + { + if (PLI::kFmt != fmt()) return NULL; + return const_cast(&mPLI); + } - BYTE type = *pos; - advancePos(pos, remaining); + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::SLI *RTCPPacket::PayloadSpecificFeedbackMessage::sliAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mSLICount); + return &(mFirstSLI[index]); + } - if (SDES::Chunk::kEndOfItemsType == type) { - // skip NUL item (no length octet is present) + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::FIR *RTCPPacket::PayloadSpecificFeedbackMessage::firAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mFIRCount); + return &(mFirstFIR[index]); + } - // skip to next DWORD alignment - auto diff = reinterpret_cast(pos) - reinterpret_cast(contents); - while ((0 != (diff % sizeof(DWORD))) && - (remaining > 0)) - { - // only NUL chunks are allowed - if (SDES::Chunk::kEndOfItemsType != (*pos)) { - ZS_LOG_WARNING(Insane, log("SDES item type is not understood") + ZS_PARAM("type", *pos)) - return false; - } + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::TSTR *RTCPPacket::PayloadSpecificFeedbackMessage::tstrAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mTSTRCount); + return &(mFirstTSTR[index]); + } - advancePos(pos, remaining); - ++diff; - } - break; - } - - if (remaining < sizeof(BYTE)) { - ZS_LOG_WARNING(Trace, log("no length of SDES entry present") + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::TSTN *RTCPPacket::PayloadSpecificFeedbackMessage::tstnAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mTSTNCount) + return &(mFirstTSTN[index]); + } - size_t prefixLength = 0; - size_t length = static_cast(*pos); - advancePos(pos, remaining); + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::VBCM *RTCPPacket::PayloadSpecificFeedbackMessage::vbcmAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mVBCMCount); + return &(mFirstVBCM[index]); + } - if (remaining < length) { - ZS_LOG_WARNING(Trace, debug("malformed SDES length found") + ZS_PARAM("length", length) + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::RPSI *RTCPPacket::PayloadSpecificFeedbackMessage::rpsi() const noexcept + { + if (RPSI::kFmt != fmt()) return NULL; + return const_cast(&mRPSI); + } - switch (type) { - case SDES::Chunk::CName::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::CName)); break; - case SDES::Chunk::Name::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Name)); break; - case SDES::Chunk::Email::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Email)); break; - case SDES::Chunk::Phone::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Phone)); break; - case SDES::Chunk::Loc::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Loc)); break; - case SDES::Chunk::Tool::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Tool)); break; - case SDES::Chunk::Note::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Note)); break; - case SDES::Chunk::Priv::kItemType: - { - { - mAllocationSize += alignedSize(sizeof(SDES::Chunk::Priv)); + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::AFB *RTCPPacket::PayloadSpecificFeedbackMessage::afb() const noexcept + { + if (AFB::kFmt != fmt()) return NULL; + if (mHasREMB) return NULL; + return const_cast(&mAFB); + } - if (length > 0) { - prefixLength = static_cast(*pos); + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage::REMB *RTCPPacket::PayloadSpecificFeedbackMessage::remb() const noexcept + { + if (REMB::kFmt != fmt()) return NULL; + if (!mHasREMB) return NULL; + return const_cast(&mREMB); + } - if (prefixLength > (length-1)) goto illegal_priv_prefix; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::ReportBlock + // - if (0 != prefixLength) { - mAllocationSize += alignedSize(sizeof(char)*(prefixLength+1)); - } - } - break; - } - illegal_priv_prefix: - { - ZS_LOG_WARNING(Trace, debug("malformed SDES Priv prefix found")) - return false; - } - break; - } - case SDES::Chunk::Mid::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Mid)); break; - case SDES::Chunk::Rid::kItemType: mAllocationSize += alignedSize(sizeof(SDES::Chunk::Rid)); break; - default: - { - mAllocationSize += alignedSize(sizeof(SDES::Chunk::Unknown)); - ZS_LOG_WARNING(Insane, log("SDES item type is not understood") + ZS_PARAM("type", type)) - break; - } - } + //------------------------------------------------------------------------- + const char *RTCPPacket::XR::ReportBlock::blockTypeToString(BYTE blockType) noexcept + { + switch (blockType) { + case LossRLEReportBlock::kBlockType: return "LossRLEReportBlock"; + case DuplicateRLEReportBlock::kBlockType: return "DuplicateRLEReportBlock"; + case PacketReceiptTimesReportBlock::kBlockType: return "PacketReceiptTimesReportBlock"; + case ReceiverReferenceTimeReportBlock::kBlockType: return "ReceiverReferenceTimeReportBlock"; + case DLRRReportBlock::kBlockType: return "DLRRReportBlock"; + case StatisticsSummaryReportBlock::kBlockType: return "StatisticsSummaryReportBlock"; + case VoIPMetricsReportBlock::kBlockType: return "VoIPMetricsReportBlock"; + default: { + break; + } + } - if (0 != length) { - mAllocationSize += alignedSize((sizeof(char)*length)+sizeof(char)); - } + return "UnknownReportBlock"; + } - ZS_LOG_INSANE(log("get SDES item allocation size") + ZS_PARAM("type", SDES::Chunk::StringItem::typeToString(type)) + ZS_PARAM("type (number)", type) + ZS_PARAM("prefix length", prefixLength) + ZS_PARAM("length", length) + ZS_PARAM("allocation size", (mAllocationSize - preAllocationSize))) + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::ReportBlockRange + // - advancePos(pos, remaining, length); - } + //------------------------------------------------------------------------- + BYTE RTCPPacket::XR::ReportBlockRange::reserved() const noexcept + { + return RTCP_GET_BITS(mTypeSpecific, 0xF, 4); + } - } + //------------------------------------------------------------------------- + BYTE RTCPPacket::XR::ReportBlockRange::thinning() const noexcept + { + return RTCP_GET_BITS(mTypeSpecific, 0xF, 0); + } - return true; - } + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::RLEReportBlock + // - //------------------------------------------------------------------------- - bool RTCPPacket::getByeAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mByeCount; + //------------------------------------------------------------------------- + RTCPPacket::XR::RLEChunk RTCPPacket::XR::RLEReportBlock::chunkAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < chunkCount()); + return mChunks[index]; + } - size_t ssrcCount = static_cast(reportSpecific); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::PacketReceiptTimesReportBlock + // - mAllocationSize += alignedSize(sizeof(Bye)) + (alignedSize(sizeof(DWORD)) * ssrcCount); + //------------------------------------------------------------------------- + DWORD RTCPPacket::XR::PacketReceiptTimesReportBlock::receiptTimeAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < receiptTimeCount()); + return mReceiptTimes[index]; + } - const BYTE *pos = contents; - size_t remaining = contentSize; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::ReceiverReferenceTimeReportBlock + // - if (remaining < (ssrcCount * sizeof(DWORD))) { - ZS_LOG_WARNING(Trace, debug("malformed BYE SSRC size")) - return false; - } + //------------------------------------------------------------------------- + Time RTCPPacket::XR::ReceiverReferenceTimeReportBlock::ntpTimestamp() const noexcept + { + return UseRTPUtils::ntpToTime(mNTPTimestampMS, mNTPTimestampLS); + } - advancePos(pos, remaining, sizeof(DWORD) * ssrcCount); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::DLRRReportBlock + // - if (remaining < sizeof(BYTE)) return true; + //------------------------------------------------------------------------- + RTCPPacket::XR::DLRRReportBlock::SubBlock *RTCPPacket::XR::DLRRReportBlock::subBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < subBlockCount()); + return &(mSubBlocks[index]); + } - size_t length = static_cast(*pos); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::StatisticsSummaryReportBlock + // - if (length < 1) return true; + //------------------------------------------------------------------------- + bool RTCPPacket::XR::StatisticsSummaryReportBlock::lossReportFlag() const noexcept + { + return RTCP_IS_FLAG_SET(mTypeSpecific, 7); + } - if (length > remaining) { - ZS_LOG_WARNING(Trace, debug("malformed BYE reason length") + ZS_PARAM("length", length) + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + bool RTCPPacket::XR::StatisticsSummaryReportBlock::duplicateReportFlag() const noexcept + { + return RTCP_IS_FLAG_SET(mTypeSpecific, 6); + } - mAllocationSize += alignedSize((sizeof(char)*(length+1))); - return true; - } + //------------------------------------------------------------------------- + bool RTCPPacket::XR::StatisticsSummaryReportBlock::jitterFlag() const noexcept + { + return RTCP_IS_FLAG_SET(mTypeSpecific, 5); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getAppAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mAppCount; + //------------------------------------------------------------------------- + bool RTCPPacket::XR::StatisticsSummaryReportBlock::ttlFlag() const noexcept + { + return (1 == RTCP_GET_BITS(mTypeSpecific, 0x3, 3)); + } - mAllocationSize += alignedSize(sizeof(App)); + //------------------------------------------------------------------------- + bool RTCPPacket::XR::StatisticsSummaryReportBlock::hopLimitFlag() const noexcept + { + return (2 == RTCP_GET_BITS(mTypeSpecific, 0x3, 3)); + } - size_t remaining = contentSize; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::VoIPMetricsReportBlock + // - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Detail, log("malformed APP length") + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + BYTE RTCPPacket::XR::VoIPMetricsReportBlock::plc() const noexcept + { + return RTCP_GET_BITS(mRXConfig, 0x3, 6); + } - return true; - } + //------------------------------------------------------------------------- + BYTE RTCPPacket::XR::VoIPMetricsReportBlock::jba() const noexcept + { + return RTCP_GET_BITS(mRXConfig, 0x3, 4); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getTransportLayerFeedbackMessageAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mTransportLayerFeedbackMessageCount; + //------------------------------------------------------------------------- + BYTE RTCPPacket::XR::VoIPMetricsReportBlock::jbRate() const noexcept + { + return RTCP_GET_BITS(mRXConfig, 0xF, 0); + } - mAllocationSize += alignedSize(sizeof(TransportLayerFeedbackMessage)); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::RunLength + // + + //------------------------------------------------------------------------- + RTCPPacket::XR::RunLength::RunLength(RLEChunk chunk) noexcept : + mRunType(RTCP_GET_BITS(chunk, 0x1, 14)), + mRunLength(RTCP_GET_BITS(chunk, 0x3FFF, 0)) + { + } - const BYTE *pos = contents; - size_t remaining = contentSize; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR::BitVector + // + + //------------------------------------------------------------------------- + RTCPPacket::XR::BitVector::BitVector(RLEChunk chunk) noexcept : + mBitVector(RTCP_GET_BITS(chunk, 0x7FFF, 0)) + { + } - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Detail, log("malformed transport layer feedback message length") + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + BYTE RTCPPacket::XR::BitVector::bitAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < (sizeof(WORD) * 8)); + return (mBitVector >> ((sizeof(WORD)*8)-index-1)) & 0x1; + } - advancePos(pos, remaining, sizeof(DWORD)*2); + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket::XR + // - bool result = false; + //------------------------------------------------------------------------- + RTCPPacket::XR::LossRLEReportBlock *RTCPPacket::XR::lossRLEReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mLossRLEReportBlockCount); + return &(mFirstLossRLEReportBlock[index]); + } - switch (reportSpecific) { - case TransportLayerFeedbackMessage::GenericNACK::kFmt: result = getTransportLayerFeedbackMessageGenericNACKAllocationSize(reportSpecific, pos, remaining); break; - case TransportLayerFeedbackMessage::TMMBR::kFmt: result = getTransportLayerFeedbackMessageTMMBRAllocationSize(reportSpecific, pos, remaining); break; - case TransportLayerFeedbackMessage::TMMBN::kFmt: result = getTransportLayerFeedbackMessageTMMBNAllocationSize(reportSpecific, pos, remaining); break; - default: { - break; - } - } + //------------------------------------------------------------------------- + RTCPPacket::XR::DuplicateRLEReportBlock *RTCPPacket::XR::duplicateRLEReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mDuplicateRLEReportBlockCount); + return &(mFirstDuplicateRLEReportBlock[index]); + } - ZS_LOG_INSANE(packet_slog("getting transport layer feedback message size") + ZS_PARAM("fmt", FeedbackMessage::fmtToString(TransportLayerFeedbackMessage::kPayloadType, reportSpecific)) + ZS_PARAM("fmt (number)", reportSpecific)) + //------------------------------------------------------------------------- + RTCPPacket::XR::PacketReceiptTimesReportBlock *RTCPPacket::XR::packetReceiptTimesReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mPacketReceiptTimesReportBlockCount); + return &(mFirstPacketReceiptTimesReportBlock[index]); + } - return true; - } + //------------------------------------------------------------------------- + RTCPPacket::XR::ReceiverReferenceTimeReportBlock *RTCPPacket::XR::receiverReferenceTimeReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mReceiverReferenceTimeReportBlockCount); + return &(mFirstReceiverReferenceTimeReportBlock[index]); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mPayloadSpecificFeedbackMessageCount; + //------------------------------------------------------------------------- + RTCPPacket::XR::DLRRReportBlock *RTCPPacket::XR::dlrrReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mDLRRReportBlockCount); + return &(mFirstDLRRReportBlock[index]); + } - mAllocationSize += alignedSize(sizeof(PayloadSpecificFeedbackMessage)); + //------------------------------------------------------------------------- + RTCPPacket::XR::StatisticsSummaryReportBlock *RTCPPacket::XR::statisticsSummaryReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mStatisticsSummaryReportBlockCount); + return &(mFirstStatisticsSummaryReportBlock[index]); + } - const BYTE *pos = contents; - size_t remaining = contentSize; + //------------------------------------------------------------------------- + RTCPPacket::XR::VoIPMetricsReportBlock *RTCPPacket::XR::voIPMetricsReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mVoIPMetricsReportBlockCount); + return &(mFirstVoIPMetricsReportBlock[index]); + } - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Detail, log("malformed transport layer feedback message length") + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + RTCPPacket::XR::UnknownReportBlock *RTCPPacket::XR::unknownReportBlockAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mUnknownReportBlockCount); + return &(mFirstUnknownReportBlock[index]); + } - advancePos(pos, remaining, sizeof(DWORD)*2); + //-------------------------------------------------------- noexcept----------------- + bool RTCPPacket::XR::isRunLengthChunk(RLEChunk chunk) noexcept + { + return !RTCP_IS_FLAG_SET(chunk, 15); + } - bool result = false; + //------------------------------------------------------------------------- + bool RTCPPacket::XR::isBitVectorChunk(RLEChunk chunk) noexcept + { + return RTCP_IS_FLAG_SET(chunk, 15); + } - char bogus[sizeof(DWORD)] {}; - const DWORD *usingSubType = reinterpret_cast(&(bogus[0])); - - switch (reportSpecific) { - case PayloadSpecificFeedbackMessage::PLI::kFmt: result = getPayloadSpecificFeedbackMessagePLIAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::SLI::kFmt: result = getPayloadSpecificFeedbackMessageSLIAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::RPSI::kFmt: result = getPayloadSpecificFeedbackMessageRPSIAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::FIR::kFmt: result = getPayloadSpecificFeedbackMessageFIRAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::TSTR::kFmt: result = getPayloadSpecificFeedbackMessageTSTRAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::TSTN::kFmt: result = getPayloadSpecificFeedbackMessageTSTNAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::VBCM::kFmt: result = getPayloadSpecificFeedbackMessageVBCMAllocationSize(reportSpecific, pos, remaining); break; - case PayloadSpecificFeedbackMessage::AFB::kFmt: { - { - if (remaining < sizeof(DWORD)) goto generic_afb; - if (0 != memcmp(pos, reinterpret_cast("REMB"), sizeof(DWORD))) goto generic_afb; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket (public) + // + + //------------------------------------------------------------------------- + RTCPPacket::RTCPPacket( + const make_private &, + MediaChannelID mediaChannelID + ) noexcept : + mMediaChannelID(mediaChannelID) + { + } - usingSubType = reinterpret_cast(pos); + //------------------------------------------------------------------------- + RTCPPacket::~RTCPPacket() noexcept + { + } - result = getPayloadSpecificFeedbackMessageREMBAllocationSize(reportSpecific, pos, remaining); - break; - } - generic_afb: - { - result = getPayloadSpecificFeedbackMessageAFBAllocationSize(reportSpecific, pos, remaining); - break; - } - } - default: { - break; - } - } + //------------------------------------------------------------------------- + RTCPPacketPtr RTCPPacket::create( + const BYTE *buffer, + size_t bufferLengthInBytes, + MediaChannelID mediaChannelID + ) noexcept(false) + { + ORTC_THROW_INVALID_PARAMETERS_IF(!buffer); + ORTC_THROW_INVALID_PARAMETERS_IF(0 == bufferLengthInBytes); + return RTCPPacket::create(UseServicesHelper::convertToBuffer(buffer, bufferLengthInBytes), mediaChannelID); + } - ZS_LOG_INSANE(packet_slog("getting payload specific feedback message size") + ZS_PARAM("fmt", FeedbackMessage::fmtToString(TransportLayerFeedbackMessage::kPayloadType, reportSpecific, *usingSubType)) + ZS_PARAM("fmt (number)", reportSpecific)) + //------------------------------------------------------------------------- + RTCPPacketPtr RTCPPacket::create( + const SecureByteBlock &buffer, + MediaChannelID mediaChannelID + ) noexcept(false) + { + return RTCPPacket::create(buffer.BytePtr(), buffer.SizeInBytes(), mediaChannelID); + } - return true; - } + //------------------------------------------------------------------------- + RTCPPacketPtr RTCPPacket::create( + SecureByteBlockPtr buffer, + MediaChannelID mediaChannelID + ) noexcept(false) + { + RTCPPacketPtr pThis(make_shared(make_private{}, mediaChannelID)); + pThis->mBuffer = buffer; + if (!pThis->parse()) { + ZS_EVENTING_4(x, w, Debug, RTCPPacketParseWarningNotParsed, ol, RtcpPacket, Parse, + string, message, "packet could not be parsed", + puid, mediaChannelID, mediaChannelID, + buffer, buffer, ((bool)buffer) ? buffer->BytePtr() : NULL, + size, size, ((bool)buffer) ? buffer->SizeInBytes() : 0 + ); + return RTCPPacketPtr(); + } + return pThis; + } - //------------------------------------------------------------------------- - bool RTCPPacket::getXRAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mXRCount; + //------------------------------------------------------------------------- + RTCPPacketPtr RTCPPacket::create( + const Report *first, + MediaChannelID mediaChannelID + ) noexcept(false) + { + size_t allocationSize = getPacketSize(first); + SecureByteBlockPtr temp(make_shared(allocationSize)); - mAllocationSize += alignedSize(sizeof(XR)); + BYTE *buffer = temp->BytePtr(); + BYTE *pos = buffer; + writePacket(first, pos, allocationSize); - const BYTE *pos = contents; - size_t remaining = contentSize; + return create(temp, mediaChannelID); + } - if (remaining < sizeof(DWORD)) { - ZS_LOG_WARNING(Trace, debug("XR is not a valid length") + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + SecureByteBlockPtr RTCPPacket::generateFrom(const Report *first) noexcept(false) + { + size_t allocationSize = getPacketSize(first); + SecureByteBlockPtr temp(make_shared(allocationSize)); - advancePos(pos, remaining, sizeof(DWORD)); + BYTE *buffer = temp->BytePtr(); + BYTE *pos = buffer; + writePacket(first, pos, allocationSize); - while (remaining >= sizeof(DWORD)) { - const BYTE *prePos = pos; - size_t preAllocationSize = mAllocationSize; + return temp; + } - BYTE bt = pos[0]; - BYTE typeSpecific = pos[1]; - size_t blockLength = static_cast(RTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD); + //------------------------------------------------------------------------- + const BYTE *RTCPPacket::ptr() const noexcept + { + return mBuffer->BytePtr(); + } - advancePos(pos, remaining, sizeof(DWORD)); + //------------------------------------------------------------------------- + size_t RTCPPacket::size() const noexcept + { + return mBuffer->SizeInBytes(); + } - if (remaining < blockLength) { - ZS_LOG_WARNING(Trace, debug("malformed XR block length found") + ZS_PARAM("block length", blockLength) + ZS_PARAM("remaining", remaining)) - return false; - } + //------------------------------------------------------------------------- + SecureByteBlockPtr RTCPPacket::buffer() const noexcept + { + return mBuffer; + } - bool result = false; + //------------------------------------------------------------------------- + RTCPPacket::SenderReport *RTCPPacket::senderReportAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mSenderReportCount); + return &(mFirstSenderReport[index]); + } - switch (bt) { - case XR::LossRLEReportBlock::kBlockType: result = getXRLossRLEReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - case XR::DuplicateRLEReportBlock::kBlockType: result = getXRDuplicateRLEReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - case XR::PacketReceiptTimesReportBlock::kBlockType: result = getXRPacketReceiptTimesReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - case XR::ReceiverReferenceTimeReportBlock::kBlockType: result = getXRReceiverReferenceTimeReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - case XR::DLRRReportBlock::kBlockType: result = getXRDLRRReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - case XR::StatisticsSummaryReportBlock::kBlockType: result = getXRStatisticsSummaryReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - case XR::VoIPMetricsReportBlock::kBlockType: result = getXRVoIPMetricsReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - default: - { - result = getXRUnknownReportBlockAllocationSize(typeSpecific, pos, blockLength); break; - break; - } - } + //------------------------------------------------------------------------- + RTCPPacket::ReceiverReport *RTCPPacket::receiverReportAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mReceiverReportCount); + return &(mFirstReceiverReport[index]); + } - if (!result) return false; + //------------------------------------------------------------------------- + RTCPPacket::SDES *RTCPPacket::sdesAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mSDESCount); + return &(mFirstSDES[index]); + } - advancePos(pos, remaining, blockLength); + //------------------------------------------------------------------------- + RTCPPacket::Bye *RTCPPacket::byeAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mByeCount); + return &(mFirstBye[index]); + } - ZS_LOG_INSANE(log("get XR allocation size for block") + ZS_PARAM("block type", XR::ReportBlock::blockTypeToString(bt)) + ZS_PARAM("block type (number)", bt) + ZS_PARAM("block size", blockLength) + ZS_PARAM("consumed", (reinterpret_cast(pos) - reinterpret_cast(prePos))) + ZS_PARAM("allocation size", mAllocationSize - preAllocationSize)) - } + //------------------------------------------------------------------------- + RTCPPacket::App *RTCPPacket::appAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mAppCount); + return &(mFirstApp[index]); + } - return true; - } + //------------------------------------------------------------------------- + RTCPPacket::TransportLayerFeedbackMessage *RTCPPacket::transportLayerFeedbackReportAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mTransportLayerFeedbackMessageCount); + return &(mFirstTransportLayerFeedbackMessage[index]); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getUnknownReportAllocationSize( - BYTE version, - BYTE padding, - BYTE reportSpecific, - const BYTE *contents, - size_t contentSize - ) - { - ++mUnknownReportCount; + //------------------------------------------------------------------------- + RTCPPacket::PayloadSpecificFeedbackMessage *RTCPPacket::payloadSpecificFeedbackReportAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mPayloadSpecificFeedbackMessageCount); + return &(mFirstPayloadSpecificFeedbackMessage[index]); + } - mAllocationSize += alignedSize(sizeof(UnknownReport)); - return true; - } + //------------------------------------------------------------------------- + RTCPPacket::XR *RTCPPacket::xrAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mXRCount); + return &(mFirstXR[index]); + } - //------------------------------------------------------------------------- - bool RTCPPacket::getTransportLayerFeedbackMessageGenericNACKAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + //------------------------------------------------------------------------- + RTCPPacket::UnknownReport *RTCPPacket::unknownAtIndex(size_t index) const noexcept + { + ZS_ASSERT(index < mUnknownReportCount); + return &(mFirstUnknownReport[index]); + } - if (remaining < sizeof(DWORD)) { - ZS_LOG_WARNING(Trace, debug("malformed generic NACK transport layer feedback message") + ZS_PARAM("remaining", remaining)) - return false; + //------------------------------------------------------------------------- + void RTCPPacket::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_8(x, i, Basic, RTCPPacketTrace, ol, RtcpPacket, Info, + puid, mediaChannelID, mMediaChannelID, + string, func, func, + string, message, message, + buffer, buffer, ((bool)mBuffer) ? mBuffer->BytePtr() : NULL, + size, size, ((bool)mBuffer) ? mBuffer->SizeInBytes() : 0, + buffer, allocationBuffer, ((bool)mAllocationBuffer) ? mAllocationBuffer->BytePtr() : NULL, + size, allocationBuffersize, ((bool)mAllocationBuffer) ? mAllocationBuffer->SizeInBytes() : 0, + size_t, allocationPos, (NULL != mAllocationPos ? (mAllocationBuffer ? (reinterpret_cast(mAllocationPos) - reinterpret_cast(mAllocationBuffer->BytePtr())) : reinterpret_cast(mAllocationPos)) : 0) + ); + + for (Report *report = mFirst; NULL != report; report = report->next()) + { + switch (report->pt()) { + case SenderReport::kPayloadType: + { + SenderReport *sr = static_cast(report); + internal::traceSenderReport(mMediaChannelID, sr); + break; + } + case ReceiverReport::kPayloadType: + { + ReceiverReport *rr = static_cast(report); + internal::traceReceiverReport(mMediaChannelID, rr); + break; + } + case SDES::kPayloadType: + { + SDES *sdes = static_cast(report); + internal::traceSDES(mMediaChannelID, sdes); + break; + } + case Bye::kPayloadType: + { + Bye *bye = static_cast(report); + internal::traceBye(mMediaChannelID, bye); + break; + } + case App::kPayloadType: + { + App *app = static_cast(report); + internal::traceApp(mMediaChannelID, app); + break; + } + case TransportLayerFeedbackMessage::kPayloadType: + { + TransportLayerFeedbackMessage *fm = static_cast(report); + internal::traceTransportLayerFeedbackMessage(mMediaChannelID, fm); + break; + } + case PayloadSpecificFeedbackMessage::kPayloadType: + { + PayloadSpecificFeedbackMessage *fm = static_cast(report); + internal::tracePayloadSpecificFeedbackMessage(mMediaChannelID, fm); + break; + } + case XR::kPayloadType: + { + XR *xr = static_cast(report); + internal::traceXR(mMediaChannelID, xr); + break; + } + default: + { + UnknownReport *unknown = static_cast(report); + ZS_EVENTING_2(x, i, Basic, RTCPPacketTraceUnknownReport, ol, RtcpPacket, Info, + puid, mediaChannelID, mMediaChannelID, + bool, next, (NULL != unknown->nextUnknown()) + ); + break; + } } + } + } - size_t possibleNACKs = remaining / sizeof(DWORD); - mAllocationSize += (alignedSize(sizeof(TransportLayerFeedbackMessage::GenericNACK)) * possibleNACKs); - return true; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket (internal) + // + + //------------------------------------------------------------------------- + bool RTCPPacket::parse() noexcept + { + const BYTE *buffer = mBuffer->BytePtr(); + size_t size = mBuffer->SizeInBytes(); + + if (size < internal::kMinRtcpPacketLen) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "packet length is too short", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, 0, + size_t, length, size + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "packet length is too short"); + return false; } - //------------------------------------------------------------------------- - bool RTCPPacket::getTransportLayerFeedbackMessageTMMBRAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) + bool foundPaddingBit = false; + + // scope: calculate total memory allocation size needed to parse entire RTCP packet { - size_t remaining = contentSize; + size_t remaining = size; + const BYTE *pos = buffer; - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed TMMBR transport layer feedback message") + ZS_PARAM("remaining", remaining)) - return false; - } + while (remaining >= internal::kMinRtcpPacketLen) { + BYTE version = RTCP_GET_BITS(*pos, 0x3, 6); + if (internal::kRtpVersion != version) { + ZS_EVENTING_3(x, w, Trace, RTCPPacketParseWarningIllegalVersion, ol, RtcpPacket, Parse, + string, message, "illegal version found", + puid, mediaChannelID, mMediaChannelID, + byte, version, version + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "illegal version found"); + return false; + } - size_t possibleTMMBRs = remaining / (sizeof(DWORD)*2); + size_t length = sizeof(DWORD) + (static_cast(UseRTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD)); - mAllocationSize += (alignedSize(sizeof(TransportLayerFeedbackMessage::TMMBR)) * possibleTMMBRs); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getTransportLayerFeedbackMessageTMMBNAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + size_t padding = 0; - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed TMMBN transport layer feedback message") + ZS_PARAM("remaining", remaining)) - return false; - } + if (RTCP_IS_FLAG_SET(*pos, 5)) { + if (foundPaddingBit) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "found illegal second padding bit set in compound RTCP block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "found illegal second padding bit set in compound RTCP block"); + return false; + } - size_t possibleTMMBNs = remaining / (sizeof(DWORD)*2); + padding = buffer[size-1]; + } - mAllocationSize += (alignedSize(sizeof(TransportLayerFeedbackMessage::TMMBN)) * possibleTMMBNs); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessagePLIAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageSLIAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + if ((sizeof(DWORD) + padding) > length) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed padding size in RTCP packet", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "malformed padding size in RTCP packet"); + return false; + } - if (remaining < sizeof(DWORD)) { - ZS_LOG_WARNING(Trace, debug("malformed SLI payload specific feedback message") + ZS_PARAM("remaining", remaining)) - return false; - } + length -= padding; - size_t possibleSLIs = remaining / sizeof(DWORD); + if (remaining < length) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "insufficient length remaining for RTCP block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "insufficient length remaining for RTCP block"); + return false; + } - mAllocationSize += (alignedSize(sizeof(PayloadSpecificFeedbackMessage::SLI)) * possibleSLIs); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageRPSIAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageFIRAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + BYTE reportSpecific = RTCP_GET_BITS(*pos, 0x1F, 0); - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed FIR payload specific feedback message") + ZS_PARAM("remaining", remaining)) - return false; - } + const BYTE *prePos = pos; + BYTE pt = pos[1]; - size_t possibleFIRs = remaining / (sizeof(DWORD)*2); + internal::advancePos(pos, remaining, sizeof(DWORD)); - mAllocationSize += (alignedSize(sizeof(PayloadSpecificFeedbackMessage::FIR)) * possibleFIRs); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageTSTRAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + size_t preAllocationSize = mAllocationSize; - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed TSTR payload specific feedback message") + ZS_PARAM("remaining", remaining)) - return false; - } + if (!getAllocationSize(static_cast(version), static_cast(padding), reportSpecific, pt, pos, static_cast(length - sizeof(DWORD)))) return false; - size_t possibleTSTRs = remaining / (sizeof(DWORD)*2); + internal::advancePos(pos, remaining, length - sizeof(DWORD)); - mAllocationSize += (alignedSize(sizeof(PayloadSpecificFeedbackMessage::TSTR)) * possibleTSTRs); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageTSTNAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + if (0 != padding) { + internal::advancePos(pos, remaining, padding); + } - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed TSTN payload specific feedback message") + ZS_PARAM("remaining", remaining)) - return false; + ZS_EVENTING_6(x, i, Insane, RTCPPacketParseAllocationSize, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, pt, Report::ptToString(pt), + size_t, consumed, static_cast(reinterpret_cast(pos) - reinterpret_cast(prePos)), + size_t, allocationSize, mAllocationSize - preAllocationSize, + size_t, remaining, remaining, + size_t, length, length + ); + ++mCount; } + } - size_t possibleTSTNs = remaining / (sizeof(DWORD)*2); - - mAllocationSize += (alignedSize(sizeof(PayloadSpecificFeedbackMessage::TSTN)) * possibleTSTNs); + if (0 == mAllocationSize) { + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "no RTCP packets were processed"); return true; } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageVBCMAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - const BYTE *pos = contents; - size_t remaining = contentSize; - size_t possibleVBCMs = 0; + mAllocationBuffer = make_shared(internal::alignedSize(mAllocationSize)); - while (remaining >= (sizeof(DWORD)*2)) { - mAllocationSize += alignedSize(sizeof(PayloadSpecificFeedbackMessage::VBCM)); - ++possibleVBCMs; - - size_t length = RTPUtils::getBE16(&(pos[6])); - size_t modulas = length % sizeof(DWORD); - size_t padding = ((0 != modulas) ? (sizeof(DWORD)-modulas) : 0); - - advancePos(pos, remaining, sizeof(DWORD)*2); + mAllocationPos = mAllocationBuffer->BytePtr(); - if (remaining < length) { - ZS_LOG_WARNING(Trace, debug("malformed VBCM payload specific feedback message") + ZS_PARAM("remaining", remaining) + ZS_PARAM("length", length)) - return false; - } + // scope: allocation size is now established; begin parsing all reports contained in RTCP packet + { + size_t remaining = size; + const BYTE *pos = buffer; - size_t skipLength = (((length + padding) > remaining) ? remaining : (length + padding)); - advancePos(pos, remaining, skipLength); + if (0 != mSenderReportCount) { + mFirstSenderReport = new (allocateBuffer(internal::alignedSize(sizeof(SenderReport)) * mSenderReportCount)) SenderReport[mSenderReportCount]; } - - if (possibleVBCMs < 1) { - ZS_LOG_WARNING(Trace, debug("malformed VBCM payload specific feedback message") + ZS_PARAM("remaining", remaining) + ZS_PARAM("possible", possibleVBCMs)) - return false; + if (0 != mReceiverReportCount) { + mFirstReceiverReport = new (allocateBuffer(internal::alignedSize(sizeof(ReceiverReport)) * mReceiverReportCount)) ReceiverReport[mReceiverReportCount]; + } + if (0 != mSDESCount) { + mFirstSDES = new (allocateBuffer(internal::alignedSize(sizeof(SDES)) * mSDESCount)) SDES[mSDESCount]; + } + if (0 != mByeCount) { + mFirstBye = new (allocateBuffer(internal::alignedSize(sizeof(Bye)) * mByeCount)) Bye[mByeCount]; + } + if (0 != mAppCount) { + mFirstApp = new (allocateBuffer(internal::alignedSize(sizeof(App)) * mAppCount)) App[mAppCount]; + } + if (0 != mTransportLayerFeedbackMessageCount) { + mFirstTransportLayerFeedbackMessage = new (allocateBuffer(internal::alignedSize(sizeof(TransportLayerFeedbackMessage)) * mTransportLayerFeedbackMessageCount)) TransportLayerFeedbackMessage[mTransportLayerFeedbackMessageCount]; + } + if (0 != mPayloadSpecificFeedbackMessageCount) { + mFirstPayloadSpecificFeedbackMessage = new (allocateBuffer(internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage)) * mPayloadSpecificFeedbackMessageCount)) PayloadSpecificFeedbackMessage[mPayloadSpecificFeedbackMessageCount]; + } + if (0 != mXRCount) { + mFirstXR = new (allocateBuffer(internal::alignedSize(sizeof(XR)) * mXRCount)) XR[mXRCount]; + } + if (0 != mUnknownReportCount) { + mFirstUnknownReport = new (allocateBuffer(internal::alignedSize(sizeof(UnknownReport)) * mUnknownReportCount)) UnknownReport[mUnknownReportCount]; } - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageAFBAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getPayloadSpecificFeedbackMessageREMBAllocationSize( - BYTE fmt, - const BYTE *contents, - size_t contentSize - ) - { - size_t remaining = contentSize; + mSenderReportCount = 0; + mReceiverReportCount = 0; + mSDESCount = 0; + mByeCount = 0; + mAppCount = 0; + mTransportLayerFeedbackMessageCount = 0; + mPayloadSpecificFeedbackMessageCount = 0; + mXRCount = 0; + mUnknownReportCount = 0; - if (remaining < (sizeof(DWORD)*3)) { - ZS_LOG_WARNING(Trace, debug("malformed REMB payload specific feedback message") + ZS_PARAM("remaining", remaining)) - return false; - } + Report *lastReport = NULL; + size_t count = 0; - size_t possibleSSRCs = (remaining - (sizeof(DWORD)*2)) / sizeof(DWORD); + while (remaining >= internal::kMinRtcpPacketLen) { + BYTE version = RTCP_GET_BITS(*pos, 0x3, 6); + size_t length = sizeof(DWORD) + (static_cast(UseRTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD)); - mAllocationSize += (alignedSize(sizeof(DWORD)) * possibleSSRCs); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getXRLossRLEReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::LossRLEReportBlock)); + size_t padding = 0; - const BYTE *pos = contents; - size_t remaining = contentSize; + if (RTCP_IS_FLAG_SET(*pos, 5)) { + padding = buffer[size-1]; + length -= padding; // already protected during pre-parse against malformed padding length + } - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed loss RLE report block")) - return false; - } + BYTE reportSpecific = RTCP_GET_BITS(*pos, 0x1F, 0); - advancePos(pos, remaining, sizeof(DWORD)*2); + const BYTE *prePos = pos; + BYTE pt = pos[1]; - size_t possibleChunks = remaining / sizeof(WORD); + internal::advancePos(pos, remaining, sizeof(DWORD)); - if (0 != possibleChunks) { - mAllocationSize += alignedSize(sizeof(XR::RLEChunk)) * possibleChunks; - } + size_t preAllocationSize = mAllocationSize; - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getXRDuplicateRLEReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::DuplicateRLEReportBlock)); + if (!parse(lastReport, version, static_cast(padding), reportSpecific, pt, pos, length - sizeof(DWORD))) return false; - const BYTE *pos = contents; - size_t remaining = contentSize; + if (NULL == mFirst) { + mFirst = lastReport; + } - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed duplicate RLE report block")) - return false; - } + internal::advancePos(pos, remaining, length - sizeof(DWORD)); - advancePos(pos, remaining, sizeof(DWORD)*2); + if (0 != padding) { + internal::advancePos(pos, remaining, padding); + } - size_t possibleChunks = remaining / sizeof(WORD); + ZS_EVENTING_5(x, i, Insane, RTCPPacketParsedReport, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + byte, ptValue, pt, + string, pt, Report::ptToString(pt), + size_t, consumed, static_cast(reinterpret_cast(pos) - reinterpret_cast(prePos)), + size_t, consumedAllocation, preAllocationSize - mAllocationSize + ); - if (0 != possibleChunks) { - mAllocationSize += alignedSize(sizeof(XR::RLEChunk)) * possibleChunks; + ++count; + ZS_ASSERT(count <= mCount); } - - return true; } - - //------------------------------------------------------------------------- - bool RTCPPacket::getXRPacketReceiptTimesReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::PacketReceiptTimesReportBlock)); - const BYTE *pos = contents; - size_t remaining = contentSize; + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "parsed"); + return true; + } - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed packet receipt times report block")) - return false; + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket (parse allocation sizing routines) + // + + //------------------------------------------------------------------------- + bool RTCPPacket::getAllocationSize( + BYTE version, + BYTE padding, + BYTE reportSpecific, + BYTE pt, + const BYTE *contents, + size_t contentSize + ) noexcept + { + bool result = false; + + switch (pt) { + case SenderReport::kPayloadType: result = getSenderReportAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case ReceiverReport::kPayloadType: result = getReceiverReportAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case SDES::kPayloadType: result = getSDESAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case Bye::kPayloadType: result = getByeAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case App::kPayloadType: result = getAppAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case TransportLayerFeedbackMessage::kPayloadType: result = getTransportLayerFeedbackMessageAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case PayloadSpecificFeedbackMessage::kPayloadType: result = getPayloadSpecificFeedbackMessageAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + case XR::kPayloadType: result = getXRAllocationSize(version, padding, reportSpecific, contents, contentSize); break; + default: + { + result = getUnknownReportAllocationSize(version, padding, reportSpecific, contents, contentSize); + break; } + } + return result; + } - advancePos(pos, remaining, sizeof(DWORD)*2); - - size_t possibleReceiptTimes = remaining / sizeof(DWORD); - - if (0 != possibleReceiptTimes) { - mAllocationSize += alignedSize(sizeof(DWORD)) * possibleReceiptTimes; - } + //------------------------------------------------------------------------- + bool RTCPPacket::getSenderReportAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + BYTE reportSpecific, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + ++mSenderReportCount; + + mAllocationSize += internal::alignedSize(sizeof(SenderReport)) + (internal::alignedSize(sizeof(SenderReport::ReportBlock)) * static_cast(reportSpecific)); + return true; + } - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getXRReceiverReferenceTimeReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::ReceiverReferenceTimeReportBlock)); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::getXRDLRRReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::DLRRReportBlock)); + //------------------------------------------------------------------------- + bool RTCPPacket::getReceiverReportAllocationSize( + BYTE version, + BYTE padding, + BYTE reportSpecific, + const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + ++mReceiverReportCount; + + mAllocationSize += internal::alignedSize(sizeof(ReceiverReport)) + (internal::alignedSize(sizeof(ReceiverReport::ReportBlock)) * static_cast(reportSpecific)); + return true; + } - size_t possibleSubBlocks = contentSize / (sizeof(DWORD) + sizeof(DWORD) + sizeof(DWORD)); - if (0 != possibleSubBlocks) { - mAllocationSize += alignedSize(sizeof(XR::DLRRReportBlock::SubBlock)) * possibleSubBlocks; - } - return true; - } + //------------------------------------------------------------------------- + bool RTCPPacket::getSDESAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + BYTE reportSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ++mSDESCount; - //------------------------------------------------------------------------- - bool RTCPPacket::getXRStatisticsSummaryReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::StatisticsSummaryReportBlock)); - return true; - } + size_t chunksCount = static_cast(reportSpecific); - //------------------------------------------------------------------------- - bool RTCPPacket::getXRVoIPMetricsReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::VoIPMetricsReportBlock)); - return true; - } + mAllocationSize += internal::alignedSize(sizeof(SDES)) + (internal::alignedSize(sizeof(SDES::Chunk)) * chunksCount); - //------------------------------------------------------------------------- - bool RTCPPacket::getXRUnknownReportBlockAllocationSize( - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) - { - mAllocationSize += alignedSize(sizeof(XR::UnknownReportBlock)); - return true; - } + size_t remaining = contentSize; - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket (parsing routines) - #pragma mark + const BYTE *pos = contents; - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - Report * &ioLastReport, - BYTE version, - BYTE padding, - BYTE reportSpecific, - BYTE pt, - const BYTE *contents, - size_t contentSize - ) + while ((remaining > sizeof(DWORD)) && + (chunksCount > 0)) { - Report *usingReport = NULL; - - switch (pt) { - case SenderReport::kPayloadType: { - auto temp = &(mFirstSenderReport[mSenderReportCount]);; - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case ReceiverReport::kPayloadType: { - auto temp = &(mFirstReceiverReport[mReceiverReportCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case SDES::kPayloadType: { - auto temp = &(mFirstSDES[mSDESCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case Bye::kPayloadType: { - auto temp = &(mFirstBye[mByeCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case App::kPayloadType: { - auto temp = &(mFirstApp[mAppCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case TransportLayerFeedbackMessage::kPayloadType: { - auto temp = &(mFirstTransportLayerFeedbackMessage[mTransportLayerFeedbackMessageCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case PayloadSpecificFeedbackMessage::kPayloadType: { - auto temp = &(mFirstPayloadSpecificFeedbackMessage[mPayloadSpecificFeedbackMessageCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - case XR::kPayloadType: { - auto temp = &(mFirstXR[mXRCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - default: - { - auto temp = &(mFirstUnknownReport[mUnknownReportCount]); - fill(temp, version, padding, reportSpecific, pt, contents, contentSize); - if (!parse(temp)) return false; - usingReport = temp; - break; - } - } + internal::advancePos(pos, remaining, sizeof(DWORD)); - if (NULL != ioLastReport) { - ioLastReport->mNext = usingReport; - } + ZS_EVENTING_3(x, i, Insane, RTCPPacketGetSDESAllocationSizeChunks, ol, RtcpPacket, Parse, + string, message, "getting SDES chunk allocation size", + puid, mediaChannelID, mMediaChannelID, + size_t, chunkNumber, static_cast(reportSpecific) - chunksCount + ); - ioLastReport = usingReport; - return true; - } + --chunksCount; - //------------------------------------------------------------------------- - void RTCPPacket::fill( - Report *report, - BYTE version, - BYTE padding, - BYTE reportSpecific, - BYTE pt, - const BYTE *contents, - size_t contentSize - ) - { - if (contentSize > 0) { - report->mPtr = contents; - report->mSize = contentSize; - } - report->mVersion = version; - report->mPadding = padding; - report->mReportSpecific = reportSpecific; - report->mPT = pt; - } + while (remaining >= sizeof(BYTE)) { - //------------------------------------------------------------------------- - bool RTCPPacket::parseCommon( - SenderReceiverCommonReport *report, - size_t detailedHeaderSize - ) - { - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); + size_t preAllocationSize = mAllocationSize; - { - if (remaining < sizeof(DWORD)) goto illegal_size; + BYTE type = *pos; + internal::advancePos(pos, remaining); - report->mSSRCOfSender = RTPUtils::getBE32(pos); + if (SDES::Chunk::kEndOfItemsType == type) { + // skip NUL item (no length octet is present) - advancePos(pos, remaining, sizeof(DWORD)); + // skip to next DWORD alignment + auto diff = reinterpret_cast(pos) - reinterpret_cast(contents); + while ((0 != (diff % sizeof(DWORD))) && + (remaining > 0)) + { + // only NUL chunks are allowed + if (SDES::Chunk::kEndOfItemsType != (*pos)) { + ZS_EVENTING_3(x, w, Insane, RTCPPacketGetSDESAllocationSizeSDESTypeNotUnderstood, ol, RtcpPacket, Parse, + string, message, "SDES item type is not understood", + puid, mediaChannelID, mMediaChannelID, + byte, type, *pos + ); + return false; + } - if (remaining < detailedHeaderSize) goto illegal_size; + internal::advancePos(pos, remaining); + ++diff; + } + break; + } - advancePos(pos, remaining, detailedHeaderSize); + if (remaining < sizeof(BYTE)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "no length of SDES entry present", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - size_t count = 0; + size_t prefixLength = 0; + size_t length = static_cast(*pos); + internal::advancePos(pos, remaining); - if (report->rc() > 0) { - report->mFirstReportBlock = new (allocateBuffer(alignedSize(sizeof(SenderReceiverCommonReport::ReportBlock))*report->rc())) SenderReceiverCommonReport::ReportBlock[report->rc()]; + if (remaining < length) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed SDES length found", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + return false; + } - while ((remaining >= (sizeof(DWORD)*6)) && - (count < report->rc())) + switch (type) { + case SDES::Chunk::CName::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::CName)); break; + case SDES::Chunk::Name::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Name)); break; + case SDES::Chunk::Email::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Email)); break; + case SDES::Chunk::Phone::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Phone)); break; + case SDES::Chunk::Loc::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Loc)); break; + case SDES::Chunk::Tool::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Tool)); break; + case SDES::Chunk::Note::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Note)); break; + case SDES::Chunk::Priv::kItemType: { - SenderReceiverCommonReport::ReportBlock *block = &(report->mFirstReportBlock[count]); - if (0 != count) { - report->mFirstReportBlock[count-1].mNext = block; - } + { + mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Priv)); - block->mSSRC = RTPUtils::getBE32(&(pos[0])); - block->mFractionLost = pos[4]; - block->mCumulativeNumberOfPacketsLost = RTPUtils::getBE32(&(pos[4])); - block->mCumulativeNumberOfPacketsLost = block->mCumulativeNumberOfPacketsLost & 0x00FFFFFF; - block->mExtendedHighestSequenceNumberReceived = RTPUtils::getBE32(&(pos[8])); - block->mInterarrivalJitter = RTPUtils::getBE32(&(pos[12])); - block->mLSR = RTPUtils::getBE32(&(pos[16])); - block->mDLSR = RTPUtils::getBE32(&(pos[20])); + if (length > 0) { + prefixLength = static_cast(*pos); - advancePos(pos, remaining, sizeof(DWORD)*6); + if (prefixLength > (length-1)) goto illegal_priv_prefix; - ++count; + if (0 != prefixLength) { + mAllocationSize += internal::alignedSize(sizeof(char)*(prefixLength+1)); + } + } + break; + } + illegal_priv_prefix: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed SDES Priv prefix found", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "malformed SDES Priv prefix found"); + return false; + } + break; + } + case SDES::Chunk::Mid::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Mid)); break; + case SDES::Chunk::Rid::kItemType: mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Rid)); break; + default: + { + mAllocationSize += internal::alignedSize(sizeof(SDES::Chunk::Unknown)); + ZS_EVENTING_3(x, w, Insane, RTCPPacketGetSDESAllocationSizeSDESTypeNotUnderstood, ol, RtcpPacket, Parse, + string, message, "SDES item type is not understood", + puid, mediaChannelID, mMediaChannelID, + byte, type, type + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "SDES item type is not understood"); + break; } } - if (count != report->rc()) goto illegal_size; - - if (0 != remaining) { - report->mExtension = pos; - report->mExtensionSize = remaining; + if (0 != length) { + mAllocationSize += internal::alignedSize((sizeof(char)*length)+sizeof(char)); } - return true; - } - - illegal_size: - { - ZS_LOG_WARNING(Trace, debug("unable to parse sender/receiver report (malformed packet)") + ZS_PARAM("remaining", remaining) + ZS_PARAM("detailed header size", detailedHeaderSize)) + ZS_EVENTING_7(x, i, Insane, RTCPPacketGetSDESAllocationSizeSDES, ol, RtcpPacket, Parse, + string, message, "get SDES item allocation size", + puid, mediaChannelID, mMediaChannelID, + string, type, SDES::Chunk::StringItem::typeToString(type), + byte, typeValue, type, + size_t, prefixLength, prefixLength, + size_t, length, length, + size_t, allocationSize, (mAllocationSize - preAllocationSize) + ); + internal::advancePos(pos, remaining, length); } - return false; } - //------------------------------------------------------------------------- - bool RTCPPacket::parse(SenderReport *report) - { - if (0 != mSenderReportCount) { - (&(mFirstSenderReport[mSenderReportCount-1]))->mNextSenderReport = report; - } - ++mSenderReportCount; + return true; + } - if (!parseCommon(report, sizeof(DWORD)*5)) return false; + //------------------------------------------------------------------------- + bool RTCPPacket::getByeAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + BYTE reportSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ++mByeCount; - const BYTE *pos = report->ptr(); + size_t ssrcCount = static_cast(reportSpecific); - report->mNTPTimestampMS = RTPUtils::getBE32(&(pos[4])); - report->mNTPTimestampLS = RTPUtils::getBE32(&(pos[8])); - report->mRTPTimestamp = RTPUtils::getBE32(&(pos[12])); - report->mSenderPacketCount = RTPUtils::getBE32(&(pos[16])); - report->mSenderOctetCount = RTPUtils::getBE32(&(pos[20])); + mAllocationSize += internal::alignedSize(sizeof(Bye)) + (internal::alignedSize(sizeof(DWORD)) * ssrcCount); - return true; + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < (ssrcCount * sizeof(DWORD))) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed BYE SSRC size", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; } - //------------------------------------------------------------------------- - bool RTCPPacket::parse(ReceiverReport *report) - { - if (0 != mReceiverReportCount) { - (&(mFirstReceiverReport[mReceiverReportCount-1]))->mNextReceiverReport = report; - } - ++mReceiverReportCount; + internal::advancePos(pos, remaining, sizeof(DWORD) * ssrcCount); - if (!parseCommon(report, 0)) return false; + if (remaining < sizeof(BYTE)) return true; - return true; + size_t length = static_cast(*pos); + + if (length < 1) return true; + + if (length > remaining) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed BYE reason length", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + return false; } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse(SDES *report) - { - if (0 != mSDESCount) { - (&(mFirstSDES[mSDESCount-1]))->mNextSDES = report; - } - ++mSDESCount; - if (0 == report->sc()) return true; + mAllocationSize += internal::alignedSize((sizeof(char)*(length+1))); + return true; + } - size_t chunkCount = 0; + //------------------------------------------------------------------------- + bool RTCPPacket::getAppAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + ZS_MAYBE_USED() BYTE reportSpecific, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ZS_MAYBE_USED(reportSpecific); + ZS_MAYBE_USED(contents); + ++mAppCount; + + mAllocationSize += internal::alignedSize(sizeof(App)); + + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed APP length", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); + return true; + } - report->mFirstChunk = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk))*(report->sc()))) SDES::Chunk[report->sc()]; + //------------------------------------------------------------------------- + bool RTCPPacket::getTransportLayerFeedbackMessageAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + BYTE reportSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ++mTransportLayerFeedbackMessageCount; + + mAllocationSize += internal::alignedSize(sizeof(TransportLayerFeedbackMessage)); + + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed transport layer feedback message length", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - while ((remaining > sizeof(DWORD)) && - ((chunkCount < report->sc()))) - { - SDES::Chunk *chunk = &(report->mFirstChunk[chunkCount]); - if (0 != chunkCount) { - report->mFirstChunk[chunkCount-1].mNext = chunk; - } - ++chunkCount; + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - ZS_LOG_INSANE(log("parsing SDES chunk") + ZS_PARAM("chunk number", chunkCount-1)) + bool result = false; - chunk->mSSRC = RTPUtils::getBE32(pos); - advancePos(pos, remaining, sizeof(DWORD)); + switch (reportSpecific) { + case TransportLayerFeedbackMessage::GenericNACK::kFmt: result = getTransportLayerFeedbackMessageGenericNACKAllocationSize(reportSpecific, pos, remaining); break; + case TransportLayerFeedbackMessage::TMMBR::kFmt: result = getTransportLayerFeedbackMessageTMMBRAllocationSize(reportSpecific, pos, remaining); break; + case TransportLayerFeedbackMessage::TMMBN::kFmt: result = getTransportLayerFeedbackMessageTMMBNAllocationSize(reportSpecific, pos, remaining); break; + default: { + break; + } + } - const BYTE *startOfItems = pos; - size_t remainingAtStartOfItems = remaining; + ZS_EVENTING_3(x, i, Insane, RTCPPacketGetTransportLayerFeedbackMessageAllocationSize, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, fmt, FeedbackMessage::fmtToString(TransportLayerFeedbackMessage::kPayloadType, reportSpecific), + byte, fmtNumber, reportSpecific + ); + return true; + } - // first do an items count - while (remaining >= sizeof(BYTE)) { + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + BYTE reportSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ++mPayloadSpecificFeedbackMessageCount; + + mAllocationSize += internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage)); + + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed transport layer feedback message length", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - BYTE type = *pos; - advancePos(pos, remaining); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - if (SDES::Chunk::kEndOfItemsType == type) { - // stop now (going to retry parsing again anyway) - break; - } + bool result = false; - ASSERT(remaining >= sizeof(BYTE)) - - size_t length = static_cast(*pos); - advancePos(pos, remaining); - - ASSERT(remaining >= length) - - switch (type) { - case SDES::Chunk::CName::kItemType: ++(chunk->mCNameCount); break; - case SDES::Chunk::Name::kItemType: ++(chunk->mNameCount); break; - case SDES::Chunk::Email::kItemType: ++(chunk->mEmailCount); break; - case SDES::Chunk::Phone::kItemType: ++(chunk->mPhoneCount); break; - case SDES::Chunk::Loc::kItemType: ++(chunk->mLocCount); break; - case SDES::Chunk::Tool::kItemType: ++(chunk->mToolCount); break; - case SDES::Chunk::Note::kItemType: ++(chunk->mNoteCount); break; - case SDES::Chunk::Priv::kItemType: ++(chunk->mPrivCount); break; - case SDES::Chunk::Mid::kItemType: ++(chunk->mMidCount); break; - case SDES::Chunk::Rid::kItemType: ++(chunk->mRidCount); break; - default: - { - ++(chunk->mUnknownCount); - ZS_LOG_WARNING(Insane, log("SDES item type is not understood") + ZS_PARAM("type", type)) - break; - } - } + char bogus[sizeof(DWORD)] {}; + const DWORD *usingSubType = reinterpret_cast(&(bogus[0])); - advancePos(pos, remaining, length); - } + switch (reportSpecific) { + case PayloadSpecificFeedbackMessage::PLI::kFmt: result = getPayloadSpecificFeedbackMessagePLIAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::SLI::kFmt: result = getPayloadSpecificFeedbackMessageSLIAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::RPSI::kFmt: result = getPayloadSpecificFeedbackMessageRPSIAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::FIR::kFmt: result = getPayloadSpecificFeedbackMessageFIRAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::TSTR::kFmt: result = getPayloadSpecificFeedbackMessageTSTRAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::TSTN::kFmt: result = getPayloadSpecificFeedbackMessageTSTNAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::VBCM::kFmt: result = getPayloadSpecificFeedbackMessageVBCMAllocationSize(reportSpecific, pos, remaining); break; + case PayloadSpecificFeedbackMessage::AFB::kFmt: { + { + if (remaining < sizeof(DWORD)) goto generic_afb; + if (0 != memcmp(pos, reinterpret_cast("REMB"), sizeof(DWORD))) goto generic_afb; - // allocate space for items + usingSubType = reinterpret_cast(pos); - if (0 != chunk->mCNameCount) { - chunk->mFirstCName = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::CName))*(chunk->mCNameCount))) SDES::Chunk::CName[chunk->mCNameCount]; - } - if (0 != chunk->mNameCount) { - chunk->mFirstName = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Name))*(chunk->mNameCount))) SDES::Chunk::Name[chunk->mNameCount]; - } - if (0 != chunk->mEmailCount) { - chunk->mFirstEmail = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Email))*(chunk->mEmailCount))) SDES::Chunk::Email[chunk->mEmailCount]; - } - if (0 != chunk->mPhoneCount) { - chunk->mFirstPhone = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Phone))*(chunk->mPhoneCount))) SDES::Chunk::Phone[chunk->mPhoneCount]; - } - if (0 != chunk->mLocCount) { - chunk->mFirstLoc = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Loc))*(chunk->mLocCount))) SDES::Chunk::Loc[chunk->mLocCount]; - } - if (0 != chunk->mToolCount) { - chunk->mFirstTool = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Tool))*(chunk->mToolCount))) SDES::Chunk::Tool[chunk->mToolCount]; - } - if (0 != chunk->mNoteCount) { - chunk->mFirstNote = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Note))*(chunk->mNoteCount))) SDES::Chunk::Note[chunk->mNoteCount]; - } - if (0 != chunk->mPrivCount) { - chunk->mFirstPriv = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Priv))*(chunk->mPrivCount))) SDES::Chunk::Priv[chunk->mPrivCount]; - } - if (0 != chunk->mMidCount) { - chunk->mFirstMid = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Mid))*(chunk->mMidCount))) SDES::Chunk::Mid[chunk->mMidCount]; - } - if (0 != chunk->mRidCount) { - chunk->mFirstRid = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Rid))*(chunk->mRidCount))) SDES::Chunk::Rid[chunk->mRidCount]; + result = getPayloadSpecificFeedbackMessageREMBAllocationSize(reportSpecific, pos, remaining); + break; } - if (0 != chunk->mUnknownCount) { - chunk->mFirstUnknown = new (allocateBuffer(alignedSize(sizeof(SDES::Chunk::Unknown))*(chunk->mUnknownCount))) SDES::Chunk::Unknown[chunk->mUnknownCount]; + generic_afb: + { + result = getPayloadSpecificFeedbackMessageAFBAllocationSize(reportSpecific, pos, remaining); + break; } + } + default: { + break; + } + } - chunk->mCNameCount = 0; - chunk->mNameCount = 0; - chunk->mEmailCount = 0; - chunk->mPhoneCount = 0; - chunk->mLocCount = 0; - chunk->mToolCount = 0; - chunk->mNoteCount = 0; - chunk->mPrivCount = 0; - chunk->mMidCount = 0; - chunk->mRidCount = 0; - chunk->mUnknownCount = 0; + ZS_EVENTING_3(x, i, Insane, RTCPPacketGetPayloadSpecificFeedbackMessageAllocationSize, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, fmt, FeedbackMessage::fmtToString(TransportLayerFeedbackMessage::kPayloadType, reportSpecific, *usingSubType), + byte, fmtNumber, reportSpecific + ); + return true; + } - // start over and now parse - pos = startOfItems; - remaining = remainingAtStartOfItems; + //------------------------------------------------------------------------- + bool RTCPPacket::getXRAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + ZS_MAYBE_USED() BYTE reportSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ZS_MAYBE_USED(reportSpecific); + ++mXRCount; + + mAllocationSize += internal::alignedSize(sizeof(XR)); + + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < sizeof(DWORD)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "XR is not a valid length", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - while (remaining >= sizeof(BYTE)) { + internal::advancePos(pos, remaining, sizeof(DWORD)); - BYTE type = *pos; - advancePos(pos, remaining); + while (remaining >= sizeof(DWORD)) { + const BYTE *prePos = pos; + size_t preAllocationSize = mAllocationSize; - if (SDES::Chunk::kEndOfItemsType == type) { - // skip NUL item (no length octet is present) + BYTE bt = pos[0]; + BYTE typeSpecific = pos[1]; + size_t blockLength = static_cast(UseRTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD); - // skip to next DWORD alignment - auto diff = reinterpret_cast(pos) - reinterpret_cast(ptr()); - while ((0 != (diff % sizeof(DWORD))) && - (remaining > 0)) - { - // only NUL chunks are allowed - ASSERT(SDES::Chunk::kEndOfItemsType == (*pos)) - advancePos(pos, remaining); - ++diff; - } - break; - } + internal::advancePos(pos, remaining, sizeof(DWORD)); - ASSERT(remaining >= sizeof(BYTE)) + if (remaining < blockLength) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed XR block length found", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, blockLength + ); + return false; + } - size_t length = static_cast(*pos); - advancePos(pos, remaining); + bool result = false; - ASSERT(remaining >= length) + switch (bt) { + case XR::LossRLEReportBlock::kBlockType: result = getXRLossRLEReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + case XR::DuplicateRLEReportBlock::kBlockType: result = getXRDuplicateRLEReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + case XR::PacketReceiptTimesReportBlock::kBlockType: result = getXRPacketReceiptTimesReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + case XR::ReceiverReferenceTimeReportBlock::kBlockType: result = getXRReceiverReferenceTimeReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + case XR::DLRRReportBlock::kBlockType: result = getXRDLRRReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + case XR::StatisticsSummaryReportBlock::kBlockType: result = getXRStatisticsSummaryReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + case XR::VoIPMetricsReportBlock::kBlockType: result = getXRVoIPMetricsReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + default: + { + result = getXRUnknownReportBlockAllocationSize(typeSpecific, pos, blockLength); break; + break; + } + } - SDES::Chunk::StringItem *item {}; + if (!result) return false; - const char *prefixStr = NULL; - size_t prefixLen = 0; + internal::advancePos(pos, remaining, blockLength); - switch (type) { - case SDES::Chunk::CName::kItemType: { - item = &(chunk->mFirstCName[chunk->mCNameCount]); - if (0 != chunk->mCNameCount) { - (&(chunk->mFirstCName[chunk->mCNameCount-1]))->mNext = item; - } - ++(chunk->mCNameCount); - break; - } - case SDES::Chunk::Name::kItemType: { - item = &(chunk->mFirstName[chunk->mNameCount]); - if (0 != chunk->mNameCount) { - (&(chunk->mFirstName[chunk->mNameCount-1]))->mNext = item; - } - ++(chunk->mNameCount); - break; - } - case SDES::Chunk::Email::kItemType: { - item = &(chunk->mFirstEmail[chunk->mEmailCount]); - if (0 != chunk->mEmailCount) { - (&(chunk->mFirstEmail[chunk->mEmailCount-1]))->mNext = item; - } - ++(chunk->mEmailCount); - break; - } - case SDES::Chunk::Phone::kItemType: { - item = &(chunk->mFirstPhone[chunk->mPhoneCount]); - if (0 != chunk->mPhoneCount) { - (&(chunk->mFirstPhone[chunk->mPhoneCount-1]))->mNext = item; - } - ++(chunk->mPhoneCount); - break; - } - case SDES::Chunk::Loc::kItemType: { - item = &(chunk->mFirstLoc[chunk->mLocCount]); - if (0 != chunk->mLocCount) { - (&(chunk->mFirstLoc[chunk->mLocCount-1]))->mNext = item; - } - ++(chunk->mLocCount); - break; - } - case SDES::Chunk::Tool::kItemType: { - item = &(chunk->mFirstTool[chunk->mToolCount]); - if (0 != chunk->mToolCount) { - (&(chunk->mFirstTool[chunk->mToolCount-1]))->mNext = item; - } - ++(chunk->mToolCount); - break; - } - case SDES::Chunk::Note::kItemType: { - item = &(chunk->mFirstNote[chunk->mNoteCount]); - if (0 != chunk->mNoteCount) { - (&(chunk->mFirstNote[chunk->mNoteCount-1]))->mNext = item; - } - ++(chunk->mNoteCount); - break; - } - case SDES::Chunk::Priv::kItemType: { - SDES::Chunk::Priv *priv = &(chunk->mFirstPriv[chunk->mPrivCount]); - if (0 != chunk->mPrivCount) { - (&(chunk->mFirstPriv[chunk->mPrivCount-1]))->mNext = priv; - } + ZS_EVENTING_5(x, i, Insane, RTCPPacketGetXRAllocationSize, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, blockType, XR::ReportBlock::blockTypeToString(bt), + size_t, blockLength, blockLength, + uint64, consumed, (reinterpret_cast(pos) - reinterpret_cast(prePos)), + size_t, allocationSize, mAllocationSize - preAllocationSize + ); + } - if (length > 0) { - prefixLen = static_cast(*pos); - advancePos(pos, remaining); - --length; - if (0 != prefixLen) { - priv->mPrefix = new (allocateBuffer(sizeof(char)*(prefixLen+1))) char [prefixLen+1]; - priv->mPrefixLength = prefixLen; - memcpy(const_cast(priv->mPrefix), pos, prefixLen); - - advancePos(pos, remaining, prefixLen); - ASSERT(length >= prefixLen) - - length -= prefixLen; - } - } + return true; + } - item = priv; + //------------------------------------------------------------------------- + bool RTCPPacket::getUnknownReportAllocationSize( + ZS_MAYBE_USED() BYTE version, + ZS_MAYBE_USED() BYTE padding, + ZS_MAYBE_USED() BYTE reportSpecific, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(version); + ZS_MAYBE_USED(padding); + ZS_MAYBE_USED(reportSpecific); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + ++mUnknownReportCount; + + mAllocationSize += internal::alignedSize(sizeof(UnknownReport)); + return true; + } - ++(chunk->mPrivCount); - break; - } - case SDES::Chunk::Mid::kItemType: { - item = &(chunk->mFirstMid[chunk->mMidCount]); - if (0 != chunk->mMidCount) { - (&(chunk->mFirstMid[chunk->mMidCount-1]))->mNext = item; - } - ++(chunk->mMidCount); - break; - } - case SDES::Chunk::Rid::kItemType: { - item = &(chunk->mFirstRid[chunk->mRidCount]); - if (0 != chunk->mRidCount) { - (&(chunk->mFirstRid[chunk->mRidCount-1]))->mNext = item; - } - ++(chunk->mRidCount); - break; - } - default: - { - item = &(chunk->mFirstUnknown[chunk->mUnknownCount]); - if (0 != chunk->mUnknownCount) { - (&(chunk->mFirstUnknown[chunk->mUnknownCount-1]))->mNext = item; - } - ++(chunk->mUnknownCount); - ZS_LOG_WARNING(Insane, log("SDES item type is not understood") + ZS_PARAM("type", type)) - break; - } - } + //------------------------------------------------------------------------- + bool RTCPPacket::getTransportLayerFeedbackMessageGenericNACKAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < sizeof(DWORD)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed generic NACK transport layer feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - if (NULL != item) { - item->mType = type; - if (length > 0) { - item->mValue = new (allocateBuffer(length+1)) char [length+1]; - item->mLength = length; - memcpy(const_cast(item->mValue), pos, length); - } - if (ZS_IS_LOGGING(Insane)) { - if (NULL != prefixStr) { - ZS_LOG_INSANE(packet_slog("parsing SDES") + ZS_PARAM("type", item->typeToString()) + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("prefix len", prefixLen) + ZS_PARAM("prefix", prefixStr) + ZS_PARAM("len", length) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } else { - ZS_LOG_INSANE(packet_slog("parsing SDES") + ZS_PARAM("type", item->typeToString()) + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", length) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - } - } + size_t possibleNACKs = remaining / sizeof(DWORD); - ++(chunk->mCount); + mAllocationSize += (internal::alignedSize(sizeof(TransportLayerFeedbackMessage::GenericNACK)) * possibleNACKs); + return true; + } - advancePos(pos, remaining, length); - } + //------------------------------------------------------------------------- + bool RTCPPacket::getTransportLayerFeedbackMessageTMMBRAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed TMMBR transport layer feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - } + size_t possibleTMMBRs = remaining / (sizeof(DWORD)*2); - if (chunkCount != report->sc()) { - ZS_LOG_WARNING(Trace, debug("chunk count in SDES does not match packet count") + ZS_PARAM("chunk count", chunkCount) + ZS_PARAM("packet count", report->sc())) - return false; - } + mAllocationSize += (internal::alignedSize(sizeof(TransportLayerFeedbackMessage::TMMBR)) * possibleTMMBRs); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getTransportLayerFeedbackMessageTMMBNAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed TMMBN transport layer feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - return true; + size_t possibleTMMBNs = remaining / (sizeof(DWORD)*2); + + mAllocationSize += (internal::alignedSize(sizeof(TransportLayerFeedbackMessage::TMMBN)) * possibleTMMBNs); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessagePLIAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageSLIAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < sizeof(DWORD)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed SLI payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; } + + size_t possibleSLIs = remaining / sizeof(DWORD); + + mAllocationSize += (internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage::SLI)) * possibleSLIs); + return true; + } - //------------------------------------------------------------------------- - bool RTCPPacket::parse(Bye *report) - { - if (0 != mByeCount) { - (&(mFirstBye[mByeCount-1]))->mNextBye = report; - } - ++mByeCount; + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageRPSIAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageFIRAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed FIR payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); + size_t possibleFIRs = remaining / (sizeof(DWORD)*2); - if (NULL == pos) { - if (0 != report->sc()) { - ZS_LOG_WARNING(Trace, debug("BYE report count > 0 but does not contain SSRCs") + ZS_PARAM("sc", report->sc())) - return false; - } + mAllocationSize += (internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage::FIR)) * possibleFIRs); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageTSTRAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed TSTR payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - return true; - } + size_t possibleTSTRs = remaining / (sizeof(DWORD)*2); - if (0 != report->sc()) { - report->mSSRCs = new (allocateBuffer(alignedSize(sizeof(DWORD))*(report->sc()))) DWORD[report->sc()]; - } + mAllocationSize += (internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage::TSTR)) * possibleTSTRs); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageTSTNAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed TSTN payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - { - size_t index = 0; + size_t possibleTSTNs = remaining / (sizeof(DWORD)*2); - while (index < report->sc()) { - if (remaining < sizeof(DWORD)) goto illegal_remaining; + mAllocationSize += (internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage::TSTN)) * possibleTSTNs); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageVBCMAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + const BYTE *pos = contents; + size_t remaining = contentSize; - report->mSSRCs[index] = RTPUtils::getBE32(pos); - advancePos(pos, remaining, sizeof(DWORD)); - ++index; - } + size_t possibleVBCMs = 0; - if (remaining > sizeof(BYTE)) { - size_t length = static_cast(*pos); - advancePos(pos, remaining); + while (remaining >= (sizeof(DWORD)*2)) { + mAllocationSize += internal::alignedSize(sizeof(PayloadSpecificFeedbackMessage::VBCM)); + ++possibleVBCMs; - if (remaining < length) goto illegal_remaining; + size_t length = UseRTPUtils::getBE16(&(pos[6])); + size_t modulas = length % sizeof(DWORD); + size_t padding = ((0 != modulas) ? (sizeof(DWORD)-modulas) : 0); - if (length > 0) { - report->mReasonForLeaving = new (allocateBuffer(alignedSize((sizeof(char)*length)+sizeof(char)))) char[length+1]; - memcpy(const_cast(report->mReasonForLeaving), pos, length); - } - } + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - return true; + if (remaining < length) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed VBCM payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + return false; } - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed BYE") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ZS_PARAM("remaining", remaining)) - } - return false; + size_t skipLength = (((length + padding) > remaining) ? remaining : (length + padding)); + + internal::advancePos(pos, remaining, skipLength); } - //------------------------------------------------------------------------- - bool RTCPPacket::parse(App *report) - { - if (0 != mAppCount) { - (&(mFirstApp[mAppCount-1]))->mNextApp = report; - } - ++mAppCount; + if (possibleVBCMs < 1) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed VBCM payload specific feedback message (possible VBCMs too small)", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, possibleVBCMs + ); + return false; + } - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageAFBAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + return true; + } - { - if (remaining < sizeof(DWORD)) goto illegal_remaining; + //------------------------------------------------------------------------- + bool RTCPPacket::getPayloadSpecificFeedbackMessageREMBAllocationSize( + ZS_MAYBE_USED() BYTE fmt, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(fmt); + ZS_MAYBE_USED(contents); + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*3)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed REMB payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - report->mSSRC = RTPUtils::getBE32(pos); - advancePos(pos, remaining, sizeof(DWORD)); + size_t possibleSSRCs = (remaining - (sizeof(DWORD)*2)) / sizeof(DWORD); - if (remaining < sizeof(DWORD)) goto illegal_remaining; + mAllocationSize += (internal::alignedSize(sizeof(DWORD)) * possibleSSRCs); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getXRLossRLEReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + mAllocationSize += internal::alignedSize(sizeof(XR::LossRLEReportBlock)); + + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed loss RLE report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - for (size_t index = 0; index < sizeof(DWORD); ++index) { - report->mName[index] = static_cast(pos[index]); - } - advancePos(pos, remaining, sizeof(DWORD)); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - if (0 != remaining) { - report->mData = pos; - report->mDataSize = remaining; - } + size_t possibleChunks = remaining / sizeof(WORD); - return true; - } + if (0 != possibleChunks) { + mAllocationSize += internal::alignedSize(sizeof(XR::RLEChunk)) * possibleChunks; + } - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed APP") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ZS_PARAM("remaining", remaining)) - } + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getXRDuplicateRLEReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + mAllocationSize += internal::alignedSize(sizeof(XR::DuplicateRLEReportBlock)); + + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed duplicate RLE report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); return false; } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse(TransportLayerFeedbackMessage *report) - { - if (0 != mTransportLayerFeedbackMessageCount) { - (&(mFirstTransportLayerFeedbackMessage[mTransportLayerFeedbackMessageCount-1]))->mNextTransportLayerFeedbackMessage = report; - } - ++mTransportLayerFeedbackMessageCount; - - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); - { - if (remaining < (sizeof(DWORD)*2)) goto illegal_remaining; + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - fill(report, pos, remaining); + size_t possibleChunks = remaining / sizeof(WORD); - bool result = false; + if (0 != possibleChunks) { + mAllocationSize += internal::alignedSize(sizeof(XR::RLEChunk)) * possibleChunks; + } - switch (report->fmt()) { - case TransportLayerFeedbackMessage::GenericNACK::kFmt: result = parseGenericNACK(report); break; - case TransportLayerFeedbackMessage::TMMBR::kFmt: result = parseTMMBR(report); break; - case TransportLayerFeedbackMessage::TMMBN::kFmt: result = parseTMMBN(report); break; - default: { - result = parseUnknown(report); - break; - } - } + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getXRPacketReceiptTimesReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + mAllocationSize += internal::alignedSize(sizeof(XR::PacketReceiptTimesReportBlock)); + + const BYTE *pos = contents; + size_t remaining = contentSize; + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed packet receipt times report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - ZS_LOG_INSANE(packet_slog("parsed transport layer feedback message") + ZS_PARAM("fmt", report->fmtToString()) + ZS_PARAM("fmt (number)", report->reportSpecific())) + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - return true; - } + size_t possibleReceiptTimes = remaining / sizeof(DWORD); - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed transport layer feedback message") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ZS_PARAM("remaining", remaining)) - } - return false; + if (0 != possibleReceiptTimes) { + mAllocationSize += internal::alignedSize(sizeof(DWORD)) * possibleReceiptTimes; } + + return true; + } - //------------------------------------------------------------------------- - bool RTCPPacket::parse(PayloadSpecificFeedbackMessage *report) - { - if (0 != mPayloadSpecificFeedbackMessageCount) { - (&(mFirstPayloadSpecificFeedbackMessage[mPayloadSpecificFeedbackMessageCount-1]))->mNextPayloadSpecificFeedbackMessage = report; - } - ++mPayloadSpecificFeedbackMessageCount; + //------------------------------------------------------------------------- + bool RTCPPacket::getXRReceiverReferenceTimeReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + mAllocationSize += internal::alignedSize(sizeof(XR::ReceiverReferenceTimeReportBlock)); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::getXRDLRRReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + ZS_MAYBE_USED() const BYTE *contents, + size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + ZS_MAYBE_USED(contents); + mAllocationSize += internal::alignedSize(sizeof(XR::DLRRReportBlock)); - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); + size_t possibleSubBlocks = contentSize / (sizeof(DWORD) + sizeof(DWORD) + sizeof(DWORD)); + if (0 != possibleSubBlocks) { + mAllocationSize += internal::alignedSize(sizeof(XR::DLRRReportBlock::SubBlock)) * possibleSubBlocks; + } + return true; + } - { - if (remaining < (sizeof(DWORD)*2)) goto illegal_remaining; - - fill(report, pos, remaining); - advancePos(pos, remaining, sizeof(DWORD)*2); - - bool result = false; - - switch (report->fmt()) { - case PayloadSpecificFeedbackMessage::PLI::kFmt: result = parsePLI(report); break; - case PayloadSpecificFeedbackMessage::SLI::kFmt: result = parseSLI(report); break; - case PayloadSpecificFeedbackMessage::RPSI::kFmt: result = parseRPSI(report); break; - case PayloadSpecificFeedbackMessage::FIR::kFmt: result = parseFIR(report); break; - case PayloadSpecificFeedbackMessage::TSTR::kFmt: result = parseTSTR(report); break; - case PayloadSpecificFeedbackMessage::TSTN::kFmt: result = parseTSTN(report); break; - case PayloadSpecificFeedbackMessage::VBCM::kFmt: result = parseVBCM(report); break; - case PayloadSpecificFeedbackMessage::AFB::kFmt: { - { - if (remaining < sizeof(DWORD)) goto generic_afb; - if (0 != memcmp(pos, reinterpret_cast("REMB"), sizeof(DWORD))) goto generic_afb; + //------------------------------------------------------------------------- + bool RTCPPacket::getXRStatisticsSummaryReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + mAllocationSize += internal::alignedSize(sizeof(XR::StatisticsSummaryReportBlock)); + return true; + } - result = parseREMB(report); - break; - } - generic_afb: - { - result = parseAFB(report); - break; - } - } - default: { - result = parseUnknown(report); - break; - } - } - - ZS_LOG_INSANE(packet_slog("parsed payload specific feedback message") + ZS_PARAM("fmt", report->fmtToString()) + ZS_PARAM("fmt (number)", report->reportSpecific())) + //------------------------------------------------------------------------- + bool RTCPPacket::getXRVoIPMetricsReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + mAllocationSize += internal::alignedSize(sizeof(XR::VoIPMetricsReportBlock)); + return true; + } - return true; - } + //------------------------------------------------------------------------- + bool RTCPPacket::getXRUnknownReportBlockAllocationSize( + ZS_MAYBE_USED() BYTE typeSpecific, + ZS_MAYBE_USED() const BYTE *contents, + ZS_MAYBE_USED() size_t contentSize + ) noexcept + { + ZS_MAYBE_USED(typeSpecific); + ZS_MAYBE_USED(contents); + ZS_MAYBE_USED(contentSize); + mAllocationSize += internal::alignedSize(sizeof(XR::UnknownReportBlock)); + return true; + } - illegal_remaining: + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTCPPacket (parsing routines) + // + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + Report * &ioLastReport, + BYTE version, + BYTE padding, + BYTE reportSpecific, + BYTE pt, + const BYTE *contents, + size_t contentSize + ) noexcept + { + Report *usingReport = NULL; + + switch (pt) { + case SenderReport::kPayloadType: { + auto temp = &(mFirstSenderReport[mSenderReportCount]);; + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case ReceiverReport::kPayloadType: { + auto temp = &(mFirstReceiverReport[mReceiverReportCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case SDES::kPayloadType: { + auto temp = &(mFirstSDES[mSDESCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case Bye::kPayloadType: { + auto temp = &(mFirstBye[mByeCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case App::kPayloadType: { + auto temp = &(mFirstApp[mAppCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case TransportLayerFeedbackMessage::kPayloadType: { + auto temp = &(mFirstTransportLayerFeedbackMessage[mTransportLayerFeedbackMessageCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case PayloadSpecificFeedbackMessage::kPayloadType: { + auto temp = &(mFirstPayloadSpecificFeedbackMessage[mPayloadSpecificFeedbackMessageCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + case XR::kPayloadType: { + auto temp = &(mFirstXR[mXRCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; + } + default: { - ZS_LOG_WARNING(Trace, debug("malformed payload specific feedback message") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ZS_PARAM("remaining", remaining)) + auto temp = &(mFirstUnknownReport[mUnknownReportCount]); + fill(temp, version, padding, reportSpecific, pt, contents, contentSize); + if (!parse(temp)) return false; + usingReport = temp; + break; } - return false; } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse(XR *report) - { - if (0 != mXRCount) { - (&(mFirstXR[mXRCount-1]))->mNextXR = report; - } - ++mXRCount; - const BYTE *pos = report->ptr(); - size_t remaining = report->size(); + if (NULL != ioLastReport) { + ioLastReport->mNext = usingReport; + } - { - if (remaining < sizeof(DWORD)) goto illegal_remaining; + ioLastReport = usingReport; + return true; + } - report->mSSRC = RTPUtils::getBE32(pos); - advancePos(pos, remaining, sizeof(DWORD)); + //------------------------------------------------------------------------- + void RTCPPacket::fill( + Report *report, + BYTE version, + BYTE padding, + BYTE reportSpecific, + BYTE pt, + const BYTE *contents, + size_t contentSize + ) noexcept + { + if (contentSize > 0) { + report->mPtr = contents; + report->mSize = contentSize; + } + report->mVersion = version; + report->mPadding = padding; + report->mReportSpecific = reportSpecific; + report->mPT = pt; + } - // first count the totals for each XR block type - while (remaining >= sizeof(DWORD)) { + //------------------------------------------------------------------------- + bool RTCPPacket::parseCommon( + SenderReceiverCommonReport *report, + size_t detailedHeaderSize + ) noexcept + { + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); - BYTE bt = pos[0]; - size_t blockLength = static_cast(RTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD); + { + if (remaining < sizeof(DWORD)) goto illegal_size; - advancePos(pos, remaining, sizeof(DWORD)); + report->mSSRCOfSender = UseRTPUtils::getBE32(pos); - ++report->mReportBlockCount; + internal::advancePos(pos, remaining, sizeof(DWORD)); - if (remaining < blockLength) { - ZS_LOG_WARNING(Trace, debug("illegal XR block length found") + ZS_PARAM("block length", blockLength) + ZS_PARAM("remaining", remaining)) - return false; - } + if (remaining < detailedHeaderSize) goto illegal_size; - switch (bt) { - case XR::LossRLEReportBlock::kBlockType: ++(report->mLossRLEReportBlockCount); break; - case XR::DuplicateRLEReportBlock::kBlockType: ++(report->mDuplicateRLEReportBlockCount); break; - case XR::PacketReceiptTimesReportBlock::kBlockType: ++(report->mPacketReceiptTimesReportBlockCount); break; - case XR::ReceiverReferenceTimeReportBlock::kBlockType: ++(report->mReceiverReferenceTimeReportBlockCount); break; - case XR::DLRRReportBlock::kBlockType: ++(report->mDLRRReportBlockCount); break; - case XR::StatisticsSummaryReportBlock::kBlockType: ++(report->mStatisticsSummaryReportBlockCount); break; - case XR::VoIPMetricsReportBlock::kBlockType: ++(report->mVoIPMetricsReportBlockCount); break; - default: - { - ++(report->mUnknownReportBlockCount); break; - break; - } - } - - advancePos(pos, remaining, blockLength); - } + internal::advancePos(pos, remaining, detailedHeaderSize); - if (0 != report->mLossRLEReportBlockCount) { - report->mFirstLossRLEReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::LossRLEReportBlock))*(report->mLossRLEReportBlockCount))) XR::LossRLEReportBlock[report->mLossRLEReportBlockCount]; - } - if (0 != report->mDuplicateRLEReportBlockCount) { - report->mFirstDuplicateRLEReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::DuplicateRLEReportBlock))*(report->mDuplicateRLEReportBlockCount))) XR::DuplicateRLEReportBlock[report->mDuplicateRLEReportBlockCount]; - } - if (0 != report->mPacketReceiptTimesReportBlockCount) { - report->mFirstPacketReceiptTimesReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::PacketReceiptTimesReportBlock))*(report->mPacketReceiptTimesReportBlockCount))) XR::PacketReceiptTimesReportBlock[report->mPacketReceiptTimesReportBlockCount]; - } - if (0 != report->mReceiverReferenceTimeReportBlockCount) { - report->mFirstReceiverReferenceTimeReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::ReceiverReferenceTimeReportBlock))*(report->mReceiverReferenceTimeReportBlockCount))) XR::ReceiverReferenceTimeReportBlock[report->mReceiverReferenceTimeReportBlockCount]; - } - if (0 != report->mDLRRReportBlockCount) { - report->mFirstDLRRReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::DLRRReportBlock))*(report->mDLRRReportBlockCount))) XR::DLRRReportBlock[report->mDLRRReportBlockCount]; - } - if (0 != report->mStatisticsSummaryReportBlockCount) { - report->mFirstStatisticsSummaryReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::StatisticsSummaryReportBlock))*(report->mStatisticsSummaryReportBlockCount))) XR::StatisticsSummaryReportBlock[report->mStatisticsSummaryReportBlockCount]; - } - if (0 != report->mVoIPMetricsReportBlockCount) { - report->mFirstVoIPMetricsReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::VoIPMetricsReportBlock))*(report->mVoIPMetricsReportBlockCount))) XR::VoIPMetricsReportBlock[report->mVoIPMetricsReportBlockCount]; - } - if (0 != report->mUnknownReportBlockCount) { - report->mFirstUnknownReportBlock = new (allocateBuffer(alignedSize(sizeof(XR::UnknownReportBlock))*(report->mUnknownReportBlockCount))) XR::UnknownReportBlock[report->mUnknownReportBlockCount]; - } + size_t count = 0; - report->mLossRLEReportBlockCount = 0; - report->mDuplicateRLEReportBlockCount = 0; - report->mPacketReceiptTimesReportBlockCount = 0; - report->mReceiverReferenceTimeReportBlockCount = 0; - report->mDLRRReportBlockCount = 0; - report->mStatisticsSummaryReportBlockCount = 0; - report->mVoIPMetricsReportBlockCount = 0; - report->mUnknownReportBlockCount = 0; + if (report->rc() > 0) { + report->mFirstReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(SenderReceiverCommonReport::ReportBlock))*report->rc())) SenderReceiverCommonReport::ReportBlock[report->rc()]; - XR::ReportBlock *previousReportBlock = NULL; + while ((remaining >= (sizeof(DWORD)*6)) && + (count < report->rc())) + { + SenderReceiverCommonReport::ReportBlock *block = &(report->mFirstReportBlock[count]); + if (0 != count) { + report->mFirstReportBlock[count-1].mNext = block; + } - // reset to start of buffer - pos = report->ptr(); - remaining = report->size(); + block->mSSRC = UseRTPUtils::getBE32(&(pos[0])); + block->mFractionLost = pos[4]; + block->mCumulativeNumberOfPacketsLost = UseRTPUtils::getBE32(&(pos[4])); + block->mCumulativeNumberOfPacketsLost = block->mCumulativeNumberOfPacketsLost & 0x00FFFFFF; + block->mExtendedHighestSequenceNumberReceived = UseRTPUtils::getBE32(&(pos[8])); + block->mInterarrivalJitter = UseRTPUtils::getBE32(&(pos[12])); + block->mLSR = UseRTPUtils::getBE32(&(pos[16])); + block->mDLSR = UseRTPUtils::getBE32(&(pos[20])); - advancePos(pos, remaining, sizeof(DWORD)); + internal::advancePos(pos, remaining, sizeof(DWORD)*6); - // parse each XR report block - while (remaining >= sizeof(DWORD)) { - const BYTE *prePos = pos; - size_t preAllocationSize = mAllocationSize; + ++count; + } + } - BYTE bt = pos[0]; - BYTE typeSpecific = pos[1]; - size_t blockLength = static_cast(RTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD); + if (count != report->rc()) goto illegal_size; - advancePos(pos, remaining, sizeof(DWORD)); + if (0 != remaining) { + report->mExtension = pos; + report->mExtensionSize = remaining; + } - if (remaining < blockLength) { - ZS_LOG_WARNING(Trace, debug("malformed XR block length found") + ZS_PARAM("block length", blockLength) + ZS_PARAM("remaining", remaining)) - return false; - } + return true; + } - XR::ReportBlock *usingBlock = NULL; + illegal_size: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "unable to parse sender/receiver report (malformed packet)", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, detailedHeaderSize + ); + } - switch (bt) { - case XR::LossRLEReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstLossRLEReportBlock[report->mLossRLEReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mLossRLEReportBlockCount) { - (&(report->mFirstLossRLEReportBlock[report->mLossRLEReportBlockCount-1]))->mNextLossRLE = reportBlock; - } - ++(report->mLossRLEReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - case XR::DuplicateRLEReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstDuplicateRLEReportBlock[report->mDuplicateRLEReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mDuplicateRLEReportBlockCount) { - (&(report->mFirstDuplicateRLEReportBlock[report->mDuplicateRLEReportBlockCount-1]))->mNextDuplicateRLE = reportBlock; - } - ++(report->mDuplicateRLEReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - case XR::PacketReceiptTimesReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstPacketReceiptTimesReportBlock[report->mPacketReceiptTimesReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mPacketReceiptTimesReportBlockCount) { - (&(report->mFirstPacketReceiptTimesReportBlock[report->mPacketReceiptTimesReportBlockCount-1]))->mNextPacketReceiptTimesReportBlock = reportBlock; - } - ++(report->mPacketReceiptTimesReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - case XR::ReceiverReferenceTimeReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstReceiverReferenceTimeReportBlock[report->mReceiverReferenceTimeReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mReceiverReferenceTimeReportBlockCount) { - (&(report->mFirstReceiverReferenceTimeReportBlock[report->mReceiverReferenceTimeReportBlockCount-1]))->mNextReceiverReferenceTimeReportBlock = reportBlock; - } - ++(report->mReceiverReferenceTimeReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - case XR::DLRRReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstDLRRReportBlock[report->mDLRRReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mDLRRReportBlockCount) { - (&(report->mFirstDLRRReportBlock[report->mDLRRReportBlockCount-1]))->mNextDLRRReportBlock = reportBlock; - } - ++(report->mDLRRReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - case XR::StatisticsSummaryReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstStatisticsSummaryReportBlock[report->mStatisticsSummaryReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mStatisticsSummaryReportBlockCount) { - (&(report->mFirstStatisticsSummaryReportBlock[report->mStatisticsSummaryReportBlockCount-1]))->mNextStatisticsSummaryReportBlock = reportBlock; - } - ++(report->mStatisticsSummaryReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - case XR::VoIPMetricsReportBlock::kBlockType: { - auto reportBlock = &(report->mFirstVoIPMetricsReportBlock[report->mVoIPMetricsReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mVoIPMetricsReportBlockCount) { - (&(report->mFirstVoIPMetricsReportBlock[report->mVoIPMetricsReportBlockCount-1]))->mNextVoIPMetricsReportBlock = reportBlock; - } - ++(report->mVoIPMetricsReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - default: { - auto reportBlock = &(report->mFirstUnknownReportBlock[report->mUnknownReportBlockCount]); - usingBlock = reportBlock; - if (0 != report->mUnknownReportBlockCount) { - (&(report->mFirstUnknownReportBlock[report->mUnknownReportBlockCount-1]))->mNextUnknownReportBlock = reportBlock; - } - ++(report->mUnknownReportBlockCount); - fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); - if (!parse(report, reportBlock)) return false; - break; - } - } + return false; + } - advancePos(pos, remaining, blockLength); + //------------------------------------------------------------------------- + bool RTCPPacket::parse(SenderReport *report) noexcept + { + if (0 != mSenderReportCount) { + (&(mFirstSenderReport[mSenderReportCount-1]))->mNextSenderReport = report; + } + ++mSenderReportCount; - ZS_LOG_INSANE(packet_slog("parsed XR block") + ZS_PARAM("block type", usingBlock->blockTypeToString()) + ZS_PARAM("block type (number)", usingBlock->blockType()) + ZS_PARAM("block size", blockLength) + ZS_PARAM("consumed", (reinterpret_cast(pos) - reinterpret_cast(prePos))) + ZS_PARAM("allocation consumed", preAllocationSize - mAllocationSize)) - } - + if (!parseCommon(report, sizeof(DWORD)*5)) return false; - return true; - } + const BYTE *pos = report->ptr(); - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed XR when parsing") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ZS_PARAM("remaining", remaining)) - } - return false; - } + report->mNTPTimestampMS = UseRTPUtils::getBE32(&(pos[4])); + report->mNTPTimestampLS = UseRTPUtils::getBE32(&(pos[8])); + report->mRTPTimestamp = UseRTPUtils::getBE32(&(pos[12])); + report->mSenderPacketCount = UseRTPUtils::getBE32(&(pos[16])); + report->mSenderOctetCount = UseRTPUtils::getBE32(&(pos[20])); - //------------------------------------------------------------------------- - bool RTCPPacket::parse(UnknownReport *report) - { - if (0 != mUnknownReportCount) { - (&(mFirstUnknownReport[mUnknownReportCount-1]))->mNextUnknown = report; - } - ++mUnknownReportCount; + return true; + } - return true; + //------------------------------------------------------------------------- + bool RTCPPacket::parse(ReceiverReport *report) noexcept + { + if (0 != mReceiverReportCount) { + (&(mFirstReceiverReport[mReceiverReportCount-1]))->mNextReceiverReport = report; } + ++mReceiverReportCount; + + if (!parseCommon(report, 0)) return false; + + return true; + } - //------------------------------------------------------------------------- - void RTCPPacket::fill(FeedbackMessage *report, const BYTE *contents, size_t contentSize) - { - const BYTE *pos = contents; - size_t remaining = contentSize; + //------------------------------------------------------------------------- + bool RTCPPacket::parse(SDES *report) noexcept + { + if (0 != mSDESCount) { + (&(mFirstSDES[mSDESCount-1]))->mNextSDES = report; + } + ++mSDESCount; - report->mSSRCOfPacketSender = RTPUtils::getBE32(&(pos[0])); - report->mSSRCOfMediaSource = RTPUtils::getBE32(&(pos[4])); + if (0 == report->sc()) return true; - advancePos(pos, remaining, sizeof(DWORD)*2); + size_t chunkCount = 0; - if (remaining > sizeof(BYTE)) { - report->mFCI = pos; - report->mFCISize = remaining; - } - } + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); - //------------------------------------------------------------------------- - void RTCPPacket::fill( - XR *report, - XR::ReportBlock *reportBlock, - XR::ReportBlock * &ioPreviousReportBlock, - BYTE blockType, - BYTE typeSpecific, - const BYTE *contents, - size_t contentSize - ) + report->mFirstChunk = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk))*(report->sc()))) SDES::Chunk[report->sc()]; + + while ((remaining > sizeof(DWORD)) && + ((chunkCount < report->sc()))) { - reportBlock->mBlockType = blockType; - reportBlock->mTypeSpecific = typeSpecific; - if (0 != contentSize) { - reportBlock->mTypeSpecificContents = contents; - reportBlock->mTypeSpecificContentSize = contentSize; + SDES::Chunk *chunk = &(report->mFirstChunk[chunkCount]); + if (0 != chunkCount) { + report->mFirstChunk[chunkCount-1].mNext = chunk; } + ++chunkCount; - if (NULL == report->mFirstReportBlock) { - report->mFirstReportBlock = reportBlock; - } - if (NULL != ioPreviousReportBlock) { - ioPreviousReportBlock->mNext = reportBlock; - } - ioPreviousReportBlock = reportBlock; - } + ZS_EVENTING_2(x, i, Insane, RTCPPacketParseSDES, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + size_t, chunkCount, chunkCount - 1 + ); - //------------------------------------------------------------------------- - bool RTCPPacket::parseGenericNACK(TransportLayerFeedbackMessage *report) - { - typedef TransportLayerFeedbackMessage::GenericNACK GenericNACK; - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); + chunk->mSSRC = UseRTPUtils::getBE32(pos); + internal::advancePos(pos, remaining, sizeof(DWORD)); - size_t possibleNACKs = remaining / sizeof(DWORD); + const BYTE *startOfItems = pos; + size_t remainingAtStartOfItems = remaining; - ASSERT(0 != possibleNACKs) + // first do an items count + while (remaining >= sizeof(BYTE)) { - report->mFirstGenericNACK = new (allocateBuffer(alignedSize(sizeof(GenericNACK))*possibleNACKs)) GenericNACK[possibleNACKs]; + BYTE type = *pos; + internal::advancePos(pos, remaining); - while (remaining >= sizeof(DWORD)) { - GenericNACK *nack = &(report->mFirstGenericNACK[report->mGenericNACKCount]); + if (SDES::Chunk::kEndOfItemsType == type) { + // stop now (going to retry parsing again anyway) + break; + } - nack->mPID = RTPUtils::getBE16(&(pos[0])); - nack->mBLP = RTPUtils::getBE16(&(pos[2])); + ZS_ASSERT(remaining >= sizeof(BYTE)); - advancePos(pos, remaining, sizeof(DWORD)); + size_t length = static_cast(*pos); + internal::advancePos(pos, remaining); - ++(report->mGenericNACKCount); - } + ZS_ASSERT(remaining >= length); - ASSERT(possibleNACKs == report->mGenericNACKCount) + switch (type) { + case SDES::Chunk::CName::kItemType: ++(chunk->mCNameCount); break; + case SDES::Chunk::Name::kItemType: ++(chunk->mNameCount); break; + case SDES::Chunk::Email::kItemType: ++(chunk->mEmailCount); break; + case SDES::Chunk::Phone::kItemType: ++(chunk->mPhoneCount); break; + case SDES::Chunk::Loc::kItemType: ++(chunk->mLocCount); break; + case SDES::Chunk::Tool::kItemType: ++(chunk->mToolCount); break; + case SDES::Chunk::Note::kItemType: ++(chunk->mNoteCount); break; + case SDES::Chunk::Priv::kItemType: ++(chunk->mPrivCount); break; + case SDES::Chunk::Mid::kItemType: ++(chunk->mMidCount); break; + case SDES::Chunk::Rid::kItemType: ++(chunk->mRidCount); break; + default: + { + ++(chunk->mUnknownCount); + ZS_EVENTING_2(x, w, Insane, RTCPPacketParseWarningSDESItemNotUnderstood, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + byte, type, type + ); + break; + } + } - return true; - } - - //------------------------------------------------------------------------- - void RTCPPacket::fillTMMBRCommon( - TransportLayerFeedbackMessage *report, - TransportLayerFeedbackMessage::TMMBRCommon *common, - const BYTE *pos - ) - { - typedef TransportLayerFeedbackMessage::TMMBRCommon TMMBRCommon; + internal::advancePos(pos, remaining, length); + } - common->mSSRC = RTPUtils::getBE32(&(pos[0])); - common->mMxTBRExp = RTCP_GET_BITS(pos[4], 0x3F, 2); - common->mMxTBRMantissa = RTCP_GET_BITS(RTPUtils::getBE32(&(pos[4])), 0x1FFFF, 9); - common->mMeasuredOverhead = RTCP_GET_BITS(RTPUtils::getBE32(&(pos[4])), 0x1FF, 0); - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseTMMBR(TransportLayerFeedbackMessage *report) - { - typedef TransportLayerFeedbackMessage::TMMBR TMMBR; + // allocate space for items - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); + if (0 != chunk->mCNameCount) { + chunk->mFirstCName = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::CName))*(chunk->mCNameCount))) SDES::Chunk::CName[chunk->mCNameCount]; + } + if (0 != chunk->mNameCount) { + chunk->mFirstName = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Name))*(chunk->mNameCount))) SDES::Chunk::Name[chunk->mNameCount]; + } + if (0 != chunk->mEmailCount) { + chunk->mFirstEmail = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Email))*(chunk->mEmailCount))) SDES::Chunk::Email[chunk->mEmailCount]; + } + if (0 != chunk->mPhoneCount) { + chunk->mFirstPhone = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Phone))*(chunk->mPhoneCount))) SDES::Chunk::Phone[chunk->mPhoneCount]; + } + if (0 != chunk->mLocCount) { + chunk->mFirstLoc = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Loc))*(chunk->mLocCount))) SDES::Chunk::Loc[chunk->mLocCount]; + } + if (0 != chunk->mToolCount) { + chunk->mFirstTool = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Tool))*(chunk->mToolCount))) SDES::Chunk::Tool[chunk->mToolCount]; + } + if (0 != chunk->mNoteCount) { + chunk->mFirstNote = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Note))*(chunk->mNoteCount))) SDES::Chunk::Note[chunk->mNoteCount]; + } + if (0 != chunk->mPrivCount) { + chunk->mFirstPriv = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Priv))*(chunk->mPrivCount))) SDES::Chunk::Priv[chunk->mPrivCount]; + } + if (0 != chunk->mMidCount) { + chunk->mFirstMid = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Mid))*(chunk->mMidCount))) SDES::Chunk::Mid[chunk->mMidCount]; + } + if (0 != chunk->mRidCount) { + chunk->mFirstRid = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Rid))*(chunk->mRidCount))) SDES::Chunk::Rid[chunk->mRidCount]; + } + if (0 != chunk->mUnknownCount) { + chunk->mFirstUnknown = new (allocateBuffer(internal::alignedSize(sizeof(SDES::Chunk::Unknown))*(chunk->mUnknownCount))) SDES::Chunk::Unknown[chunk->mUnknownCount]; + } - size_t possibleTMMBRs = remaining / (sizeof(DWORD)*2); + chunk->mCNameCount = 0; + chunk->mNameCount = 0; + chunk->mEmailCount = 0; + chunk->mPhoneCount = 0; + chunk->mLocCount = 0; + chunk->mToolCount = 0; + chunk->mNoteCount = 0; + chunk->mPrivCount = 0; + chunk->mMidCount = 0; + chunk->mRidCount = 0; + chunk->mUnknownCount = 0; - ASSERT(0 != possibleTMMBRs) + // start over and now parse + pos = startOfItems; + remaining = remainingAtStartOfItems; - report->mFirstTMMBR = new (allocateBuffer(alignedSize(sizeof(TMMBR))*possibleTMMBRs)) TMMBR[possibleTMMBRs]; + while (remaining >= sizeof(BYTE)) { - while (remaining >= (sizeof(DWORD)*2)) { - TMMBR *tmmbr = &(report->mFirstTMMBR[report->mTMMBRCount]); + BYTE type = *pos; + internal::advancePos(pos, remaining); - fillTMMBRCommon(report, tmmbr, pos); + if (SDES::Chunk::kEndOfItemsType == type) { + // skip NUL item (no length octet is present) - advancePos(pos, remaining, sizeof(DWORD)*2); + // skip to next DWORD alignment + auto diff = reinterpret_cast(pos) - reinterpret_cast(ptr()); + while ((0 != (diff % sizeof(DWORD))) && + (remaining > 0)) + { + // only NUL chunks are allowed + ZS_ASSERT(SDES::Chunk::kEndOfItemsType == (*pos)); + internal::advancePos(pos, remaining); + ++diff; + } + break; + } - ++(report->mTMMBRCount); - } + ZS_ASSERT(remaining >= sizeof(BYTE)); - ASSERT(possibleTMMBRs == report->mTMMBRCount) + size_t length = static_cast(*pos); + internal::advancePos(pos, remaining); - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseTMMBN(TransportLayerFeedbackMessage *report) - { - typedef TransportLayerFeedbackMessage::TMMBN TMMBN; + ZS_ASSERT(remaining >= length); - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); + SDES::Chunk::StringItem *item {}; - size_t possibleTMMBNs = remaining / (sizeof(DWORD)*2); + const char *prefixStr = NULL; + size_t prefixLen = 0; - if (possibleTMMBNs < 1) { - report->mFirstTMMBN = NULL; - report->mTMMBNCount = 0; - return true; - } + switch (type) { + case SDES::Chunk::CName::kItemType: { + item = &(chunk->mFirstCName[chunk->mCNameCount]); + if (0 != chunk->mCNameCount) { + (&(chunk->mFirstCName[chunk->mCNameCount-1]))->mNext = item; + } + ++(chunk->mCNameCount); + break; + } + case SDES::Chunk::Name::kItemType: { + item = &(chunk->mFirstName[chunk->mNameCount]); + if (0 != chunk->mNameCount) { + (&(chunk->mFirstName[chunk->mNameCount-1]))->mNext = item; + } + ++(chunk->mNameCount); + break; + } + case SDES::Chunk::Email::kItemType: { + item = &(chunk->mFirstEmail[chunk->mEmailCount]); + if (0 != chunk->mEmailCount) { + (&(chunk->mFirstEmail[chunk->mEmailCount-1]))->mNext = item; + } + ++(chunk->mEmailCount); + break; + } + case SDES::Chunk::Phone::kItemType: { + item = &(chunk->mFirstPhone[chunk->mPhoneCount]); + if (0 != chunk->mPhoneCount) { + (&(chunk->mFirstPhone[chunk->mPhoneCount-1]))->mNext = item; + } + ++(chunk->mPhoneCount); + break; + } + case SDES::Chunk::Loc::kItemType: { + item = &(chunk->mFirstLoc[chunk->mLocCount]); + if (0 != chunk->mLocCount) { + (&(chunk->mFirstLoc[chunk->mLocCount-1]))->mNext = item; + } + ++(chunk->mLocCount); + break; + } + case SDES::Chunk::Tool::kItemType: { + item = &(chunk->mFirstTool[chunk->mToolCount]); + if (0 != chunk->mToolCount) { + (&(chunk->mFirstTool[chunk->mToolCount-1]))->mNext = item; + } + ++(chunk->mToolCount); + break; + } + case SDES::Chunk::Note::kItemType: { + item = &(chunk->mFirstNote[chunk->mNoteCount]); + if (0 != chunk->mNoteCount) { + (&(chunk->mFirstNote[chunk->mNoteCount-1]))->mNext = item; + } + ++(chunk->mNoteCount); + break; + } + case SDES::Chunk::Priv::kItemType: { + SDES::Chunk::Priv *priv = &(chunk->mFirstPriv[chunk->mPrivCount]); + if (0 != chunk->mPrivCount) { + (&(chunk->mFirstPriv[chunk->mPrivCount-1]))->mNext = priv; + } + + if (length > 0) { + prefixLen = static_cast(*pos); + internal::advancePos(pos, remaining); + --length; + if (0 != prefixLen) { + priv->mPrefix = new (allocateBuffer(sizeof(char)*(prefixLen+1))) char [prefixLen+1]; + priv->mPrefixLength = prefixLen; + memcpy(const_cast(priv->mPrefix), pos, prefixLen); + + internal::advancePos(pos, remaining, prefixLen); + ZS_ASSERT(length >= prefixLen); + + length -= prefixLen; + } + } - report->mFirstTMMBN = new (allocateBuffer(alignedSize(sizeof(TMMBN))*possibleTMMBNs)) TMMBN[possibleTMMBNs]; + item = priv; - while (remaining >= (sizeof(DWORD)*2)) { - TMMBN *tmmbr = &(report->mFirstTMMBN[report->mTMMBNCount]); + ++(chunk->mPrivCount); + break; + } + case SDES::Chunk::Mid::kItemType: { + item = &(chunk->mFirstMid[chunk->mMidCount]); + if (0 != chunk->mMidCount) { + (&(chunk->mFirstMid[chunk->mMidCount-1]))->mNext = item; + } + ++(chunk->mMidCount); + break; + } + case SDES::Chunk::Rid::kItemType: { + item = &(chunk->mFirstRid[chunk->mRidCount]); + if (0 != chunk->mRidCount) { + (&(chunk->mFirstRid[chunk->mRidCount-1]))->mNext = item; + } + ++(chunk->mRidCount); + break; + } + default: + { + item = &(chunk->mFirstUnknown[chunk->mUnknownCount]); + if (0 != chunk->mUnknownCount) { + (&(chunk->mFirstUnknown[chunk->mUnknownCount-1]))->mNext = item; + } + ++(chunk->mUnknownCount); + ZS_EVENTING_2(x, w, Insane, RTCPPacketParseSDESItemTypeNotUnderstood, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + byte, type, type + ); + break; + } + } - fillTMMBRCommon(report, tmmbr, pos); + if (NULL != item) { + item->mType = type; + if (length > 0) { + item->mValue = new (allocateBuffer(length+1)) char [length+1]; + item->mLength = length; + memcpy(const_cast(item->mValue), pos, length); + } + if (NULL != prefixStr) { + ZS_EVENTING_7(x, i, Insane, RTCPPacketParseSDESPrefixItemPrefix, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, type, item->typeToString(), + size_t, chunkCount, chunkCount, + size_t, prefixLen, prefixLen, + string, prefixStr, prefixStr, + size_t, length, length, + string, value, (NULL != item->mValue ? item->mValue : NULL) + ); + } else { + ZS_EVENTING_5(x, i, Insane, RTCPPacketParseSDESItemPrefix, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, type, item->typeToString(), + size_t, chunkCount, chunkCount, + size_t, length, length, + string, value, (NULL != item->mValue ? item->mValue : NULL) + ); + } + } - advancePos(pos, remaining, sizeof(DWORD)*2); + ++(chunk->mCount); - ++(report->mTMMBNCount); + internal::advancePos(pos, remaining, length); } - ASSERT(possibleTMMBNs == report->mTMMBNCount) - - return true; } - //------------------------------------------------------------------------- - bool RTCPPacket::parseUnknown(TransportLayerFeedbackMessage *report) - { - report->mUnknown = report; - return true; + if (chunkCount != report->sc()) { + ZS_EVENTING_3(x, w, Trace, RTCPPacketParseSDESChunkCountAndPacketCountMismatch, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + size_t, chunkCount, chunkCount, + size_t, sc, report->sc() + ); + return false; } - //------------------------------------------------------------------------- - bool RTCPPacket::parsePLI(PayloadSpecificFeedbackMessage *report) - { - return true; + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse(Bye *report) noexcept + { + if (0 != mByeCount) { + (&(mFirstBye[mByeCount-1]))->mNextBye = report; } + ++mByeCount; - //------------------------------------------------------------------------- - bool RTCPPacket::parseSLI(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::SLI SLI; + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); + + if (NULL == pos) { + if (0 != report->sc()) { + ZS_EVENTING_2(x, w, Trace, RTCPPacketParseByeReportCountMissingSSRCs, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + size_t, sc, report->sc() + ); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "BYE report count > 0 but does not contain SSRCs"); + return false; + } - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); + return true; + } - size_t possibleSLIs = remaining / (sizeof(DWORD)); + if (0 != report->sc()) { + report->mSSRCs = new (allocateBuffer(internal::alignedSize(sizeof(DWORD))*(report->sc()))) DWORD[report->sc()]; + } - ASSERT(0 != possibleSLIs) + { + size_t index = 0; - report->mFirstSLI = new (allocateBuffer(alignedSize(sizeof(SLI))*possibleSLIs)) SLI[possibleSLIs]; + while (index < report->sc()) { + if (remaining < sizeof(DWORD)) goto illegal_remaining; - while (remaining >= (sizeof(DWORD))) { - SLI *sli = &(report->mFirstSLI[report->mSLICount]); + report->mSSRCs[index] = UseRTPUtils::getBE32(pos); + internal::advancePos(pos, remaining, sizeof(DWORD)); + ++index; + } - sli->mFirst = RTCP_GET_BITS(RTPUtils::getBE16(&(pos[0])), 0x1FFF, 3); - sli->mNumber = static_cast(RTCP_GET_BITS(RTPUtils::getBE32(&(pos[0])), 0x1FFF, 6)); - sli->mPictureID = RTCP_GET_BITS(pos[3], 0x3F, 0); + if (remaining > sizeof(BYTE)) { + size_t length = static_cast(*pos); + internal::advancePos(pos, remaining); - advancePos(pos, remaining, sizeof(DWORD)); + if (remaining < length) goto illegal_remaining; - ++(report->mSLICount); + if (length > 0) { + report->mReasonForLeaving = new (allocateBuffer(internal::alignedSize((sizeof(char)*length)+sizeof(char)))) char[length+1]; + memcpy(const_cast(report->mReasonForLeaving), pos, length); + } } - ASSERT(possibleSLIs == report->mSLICount) - return true; } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseRPSI(PayloadSpecificFeedbackMessage *report) + + illegal_remaining: { - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed BYE", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ); + } + return false; + } - { - if (remaining < sizeof(WORD)) goto illegal_remaining; + //------------------------------------------------------------------------- + bool RTCPPacket::parse(App *report) noexcept + { + if (0 != mAppCount) { + (&(mFirstApp[mAppCount-1]))->mNextApp = report; + } + ++mAppCount; - BYTE pb = pos[0]; - report->mRPSI.mZeroBit = RTCP_GET_BITS(pos[1], 0x1, 7); - report->mRPSI.mPayloadType = RTCP_GET_BITS(pos[1], 0x7F, 0); + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); - advancePos(pos, remaining, sizeof(WORD)); + { + if (remaining < sizeof(DWORD)) goto illegal_remaining; - if (remaining > 0) { - report->mRPSI.mNativeRPSIBitString = pos; - report->mRPSI.mNativeRPSIBitStringSizeInBits = (remaining*8); - if (pb > report->mRPSI.mNativeRPSIBitStringSizeInBits) goto illegal_remaining; + report->mSSRC = UseRTPUtils::getBE32(pos); + internal::advancePos(pos, remaining, sizeof(DWORD)); - report->mRPSI.mNativeRPSIBitStringSizeInBits -= static_cast(pb); - if (0 == report->mRPSI.mNativeRPSIBitStringSizeInBits) { - report->mRPSI.mNativeRPSIBitString = NULL; - } - } + if (remaining < sizeof(DWORD)) goto illegal_remaining; - return true; + for (size_t index = 0; index < sizeof(DWORD); ++index) { + report->mName[index] = static_cast(pos[index]); } + internal::advancePos(pos, remaining, sizeof(DWORD)); - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed RPSI payload specific feedback message") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->fci())) + ZS_PARAM("remaining", remaining)) - } - return false; - } - - //------------------------------------------------------------------------- - void RTCPPacket::fillCodecControlCommon( - PayloadSpecificFeedbackMessage *report, - PayloadSpecificFeedbackMessage::CodecControlCommon *common, - const BYTE *pos - ) - { - common->mSSRC = RTPUtils::getBE32(&(pos[0])); - common->mSeqNr = pos[4]; - common->mReserved = RTCP_GET_BITS(RTPUtils::getBE32(&(pos[4])), 0xFFFFFF, 0); - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseFIR(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::FIR FIR; - - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); - - size_t possibleFIRs = remaining / (sizeof(DWORD)*2); - - ASSERT(0 != possibleFIRs) - - report->mFirstFIR = new (allocateBuffer(alignedSize(sizeof(FIR))*possibleFIRs)) FIR[possibleFIRs]; - - while (remaining >= (sizeof(DWORD)*2)) { - FIR *fir = &(report->mFirstFIR[report->mFIRCount]); - fillCodecControlCommon(report, fir, pos); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - ++(report->mFIRCount); - } - - ASSERT(possibleFIRs == report->mFIRCount) - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseTSTR(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::TSTR TSTR; - - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); - - size_t possibleTSTRs = remaining / (sizeof(DWORD)*2); - - ASSERT(0 != possibleTSTRs) - - report->mFirstTSTR = new (allocateBuffer(alignedSize(sizeof(TSTR))*possibleTSTRs)) TSTR[possibleTSTRs]; - - while (remaining >= (sizeof(DWORD)*2)) { - TSTR *tstr = &(report->mFirstTSTR[report->mTSTRCount]); - fillCodecControlCommon(report, tstr, pos); - - tstr->mControlSpecific = RTCP_GET_BITS(tstr->mReserved, 0x1F, 0); - tstr->mReserved = RTCP_GET_BITS(tstr->mReserved, 0x7FFFF, 5); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - ++(report->mTSTRCount); - } - - ASSERT(possibleTSTRs == report->mTSTRCount) - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseTSTN(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::TSTN TSTN; - - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); - - size_t possibleTSTNs = remaining / (sizeof(DWORD)*2); - - ASSERT(0 != possibleTSTNs) - - report->mFirstTSTN = new (allocateBuffer(alignedSize(sizeof(TSTN))*possibleTSTNs)) TSTN[possibleTSTNs]; - - while (remaining >= (sizeof(DWORD)*2)) { - TSTN *tstn = &(report->mFirstTSTN[report->mTSTNCount]); - fillCodecControlCommon(report, tstn, pos); - - tstn->mControlSpecific = RTCP_GET_BITS(tstn->mReserved, 0x1F, 0); - tstn->mReserved = RTCP_GET_BITS(tstn->mReserved, 0x7FFFF, 5); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - ++(report->mTSTNCount); - } - - ASSERT(possibleTSTNs == report->mTSTNCount) - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseVBCM(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::VBCM VBCM; - - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); - - size_t possibleVBCMs = 0; - - // first count the VBCM blocks - { - while (remaining >= (sizeof(DWORD)*2)) { - ++possibleVBCMs; - - size_t length = RTPUtils::getBE16(&(pos[6])); - size_t modulas = length % sizeof(DWORD); - size_t padding = ((0 != modulas) ? (sizeof(DWORD)-modulas) : 0); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - ASSERT(remaining >= length) - - size_t skipLength = (((length + padding) > remaining) ? remaining : (length + padding)); - - advancePos(pos, remaining, skipLength); - } - ASSERT(0 != possibleVBCMs) - } - - pos = report->fci(); - remaining = report->fciSize(); - - { - ASSERT(0 != possibleVBCMs) - - report->mFirstVBCM = new (allocateBuffer(alignedSize(sizeof(VBCM))*possibleVBCMs)) VBCM[possibleVBCMs]; - - while (remaining >= (sizeof(DWORD)*2)) { - VBCM *vcbm = &(report->mFirstVBCM[report->mVBCMCount]); - fillCodecControlCommon(report, vcbm, pos); - - // move reserved to control specific - vcbm->mControlSpecific = vcbm->mReserved; - vcbm->mReserved = 0; - - size_t length = RTPUtils::getBE16(&(pos[6])); - size_t modulas = length % sizeof(DWORD); - size_t padding = ((0 != modulas) ? (sizeof(DWORD)-modulas) : 0); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - ASSERT(remaining >= length) - - if (length > 0) { - vcbm->mVBCMOctetString = pos; - } - - size_t skipLength = (((length + padding) > remaining) ? remaining : (length + padding)); - - advancePos(pos, remaining, skipLength); - - ++(report->mVBCMCount); - } - - ASSERT(possibleVBCMs == report->mVBCMCount) - } - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseAFB(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::AFB AFB; - - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); - - if (remaining > 0) { - report->mAFB.mData = pos; - report->mAFB.mDataSize = remaining; - } - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseREMB(PayloadSpecificFeedbackMessage *report) - { - typedef PayloadSpecificFeedbackMessage::REMB REMB; - - if (!parseAFB(report)) return false; - - const BYTE *pos = report->fci(); - size_t remaining = report->fciSize(); - - report->mHasREMB = true; - - { - ASSERT(remaining >= sizeof(DWORD)*3) - - report->mREMB.mNumSSRC = pos[4]; - report->mREMB.mBRExp = RTCP_GET_BITS(pos[5], 0x3F, 2); - report->mREMB.mBRMantissa = RTCP_GET_BITS(RTPUtils::getBE32(&(pos[4])), 0x3FFFF, 0); - - size_t possibleSSRCs = (remaining - sizeof(DWORD)*2) / (sizeof(DWORD)); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - report->mREMB.mSSRCs = new (allocateBuffer(alignedSize(sizeof(DWORD))*possibleSSRCs)) DWORD[possibleSSRCs]; - - size_t count = 0; - while ((possibleSSRCs > 0) && - (count < report->mREMB.numSSRC()) && - (remaining >= sizeof(DWORD))) - { - report->mREMB.mSSRCs[count] = RTPUtils::getBE32(pos); - advancePos(pos, remaining, sizeof(DWORD)); - --possibleSSRCs; - ++count; - } - - if (count != report->mREMB.numSSRC()) goto illegal_remaining; - return true; - } - - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed REMB payload specific feedback message") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(report->fci())) + ZS_PARAM("remaining", remaining)) - } - return false; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseUnknown(PayloadSpecificFeedbackMessage *report) - { - report->mUnknown = report; - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseCommonRange( - XR *xr, - XR::ReportBlockRange *reportBlock - ) - { - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - { - if (remaining < (sizeof(DWORD)*2)) goto illegal_remaining; - - reportBlock->mSSRCOfSource = RTPUtils::getBE32(&(pos[0])); - reportBlock->mBeginSeq = RTPUtils::getBE16(&(pos[4])); - reportBlock->mEndSeq = RTPUtils::getBE16(&(pos[6])); - - return true; - } - - illegal_remaining: - { - ZS_LOG_WARNING(Trace, debug("malformed report block range") + ZS_PARAM("pos", reinterpret_cast(pos) - reinterpret_cast(reportBlock->typeSpecificContents())) + ZS_PARAM("remaining", remaining)) - } - return false; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parseCommonRLE( - XR *xr, - XR::RLEReportBlock *reportBlock - ) - { - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - if (!parseCommonRange(xr, reportBlock)) return false; - - advancePos(pos, remaining, sizeof(DWORD)*2); - - size_t possibleRLEsCount = (remaining / sizeof(WORD)); - - if (0 == possibleRLEsCount) return true; - - reportBlock->mChunks = new (allocateBuffer(alignedSize(sizeof(XR::RLEChunk)*possibleRLEsCount))) XR::RLEChunk[possibleRLEsCount]; - - while (remaining >= sizeof(WORD)) - { - XR::RLEChunk value = RTPUtils::getBE16(pos); - advancePos(pos, remaining, sizeof(WORD)); - - if (0 == value) break; - reportBlock->mChunks[reportBlock->mChunkCount] = value; - ++(reportBlock->mChunkCount); - } - - if (0 == reportBlock->mChunkCount) { - reportBlock->mChunks = NULL; - } - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::LossRLEReportBlock *reportBlock - ) - { - return parseCommonRLE(xr, reportBlock); - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::DuplicateRLEReportBlock *reportBlock - ) - { - return parseCommonRLE(xr, reportBlock); - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::PacketReceiptTimesReportBlock *reportBlock - ) - { - if (!parseCommonRange(xr, reportBlock)) return false; - - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - advancePos(pos, remaining, sizeof(DWORD)*2); - - size_t possibleTimes = remaining / sizeof(DWORD); - - if (0 == possibleTimes) return true; - - reportBlock->mReceiptTimes = new (allocateBuffer(alignedSize(sizeof(DWORD))*possibleTimes)) DWORD[possibleTimes]; - - while (remaining >= sizeof(DWORD)) { - reportBlock->mReceiptTimes[reportBlock->mReceiptTimeCount] = RTPUtils::getBE32(pos); - advancePos(pos, remaining, sizeof(DWORD)); - ++(reportBlock->mReceiptTimeCount); - } - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::ReceiverReferenceTimeReportBlock *reportBlock - ) - { - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed receiver reference time report block") + ZS_PARAM("remain", remaining)) - return false; - } - - reportBlock->mNTPTimestampMS = RTPUtils::getBE32(&(pos[0])); - reportBlock->mNTPTimestampLS = RTPUtils::getBE32(&(pos[4])); - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::DLRRReportBlock *reportBlock - ) - { - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - size_t possibleSubBlockCount = remaining / (sizeof(DWORD)*3); - - if (0 == possibleSubBlockCount) return true; - - if (remaining < (sizeof(DWORD)*2)) { - ZS_LOG_WARNING(Trace, debug("malformed dlr report block") + ZS_PARAM("remain", remaining)) - return false; - } - - reportBlock->mSubBlocks = new (allocateBuffer(alignedSize(sizeof(XR::DLRRReportBlock::SubBlock))*possibleSubBlockCount)) XR::DLRRReportBlock::SubBlock[possibleSubBlockCount]; - - while (remaining >= (sizeof(DWORD)*3)) - { - auto subBlock = &(reportBlock->mSubBlocks[reportBlock->mSubBlockCount]); - - subBlock->mSSRC = RTPUtils::getBE32(&(pos[0])); - subBlock->mLRR = RTPUtils::getBE32(&(pos[4])); - subBlock->mDLRR = RTPUtils::getBE32(&(pos[8])); - - advancePos(pos, remaining, sizeof(DWORD)*3); - - ++(reportBlock->mSubBlockCount); - } - - ASSERT(reportBlock->mSubBlockCount == possibleSubBlockCount) - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::StatisticsSummaryReportBlock *reportBlock - ) - { - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - parseCommonRange(xr, reportBlock); - - if (remaining < (sizeof(DWORD)*9)) { - ZS_LOG_TRACE(debug("malformed statistics summary report block") + ZS_PARAM("remaining", remaining)) - return false; - } - - advancePos(pos, remaining, sizeof(DWORD)*2); - - reportBlock->mLostPackets = RTPUtils::getBE32(&(pos[0])); - reportBlock->mDupPackets = RTPUtils::getBE32(&(pos[4])); - reportBlock->mMinJitter = RTPUtils::getBE32(&(pos[8])); - reportBlock->mMaxJitter = RTPUtils::getBE32(&(pos[12])); - reportBlock->mMeanJitter = RTPUtils::getBE32(&(pos[16])); - reportBlock->mDevJitter = RTPUtils::getBE32(&(pos[20])); - - reportBlock->mMinTTLOrHL = pos[24]; - reportBlock->mMaxTTLOrHL = pos[25]; - reportBlock->mMeanTTLOrHL = pos[26]; - reportBlock->mDevTTLOrHL = pos[27]; - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::VoIPMetricsReportBlock *reportBlock - ) - { - const BYTE *pos = reportBlock->typeSpecificContents(); - size_t remaining = reportBlock->typeSpecificContentSize(); - - if (remaining < (sizeof(DWORD)*8)) { - ZS_LOG_TRACE(debug("malformed voip metrics report block") + ZS_PARAM("remaining", remaining)) - return false; + if (0 != remaining) { + report->mData = pos; + report->mDataSize = remaining; } - reportBlock->mSSRCOfSource = RTPUtils::getBE32(&(pos[0])); - reportBlock->mLossRate = pos[4]; - reportBlock->mDiscardRate = pos[5]; - reportBlock->mBurstDensity = pos[6]; - reportBlock->mGapDensity = pos[7]; - reportBlock->mBurstDuration = RTPUtils::getBE16(&(pos[8])); - reportBlock->mGapDuration = RTPUtils::getBE16(&(pos[10])); - reportBlock->mRoundTripDelay = RTPUtils::getBE16(&(pos[12])); - reportBlock->mEndSystemDelay = RTPUtils::getBE16(&(pos[14])); - reportBlock->mSignalLevel = pos[16]; - reportBlock->mNoiseLevel = pos[17]; - reportBlock->mRERL = pos[18]; - reportBlock->mGmin = pos[19]; - reportBlock->mRFactor = pos[20]; - reportBlock->mExtRFactor = pos[21]; - reportBlock->mMOSLQ = pos[22]; - reportBlock->mMOSCQ = pos[23]; - reportBlock->mRXConfig = pos[24]; - reportBlock->mReservedVoIP = pos[25]; - reportBlock->mJBNominal = RTPUtils::getBE16(&(pos[26])); - reportBlock->mJBMaximum = RTPUtils::getBE16(&(pos[28])); - reportBlock->mJBAbsMax = RTPUtils::getBE16(&(pos[30])); - - return true; - } - - //------------------------------------------------------------------------- - bool RTCPPacket::parse( - XR *xr, - XR::UnknownReportBlock *reportBlock - ) - { return true; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket (writing sizing routines) - #pragma mark - - //------------------------------------------------------------------------- - void *RTCPPacket::allocateBuffer(size_t size) - { - return internal::allocateBuffer(mAllocationPos, mAllocationSize, size); - } - - //------------------------------------------------------------------------- - static size_t getPacketSizeSenderReport(const RTCPPacket::SenderReport *report) - { - auto rc = report->rc(); - throwIfGreaterThanBitsAllow(rc, 5); - return (sizeof(DWORD)*2) + (sizeof(DWORD)*5) + ((sizeof(DWORD)*6)*rc) + boundarySize(report->extensionSize()); - } - - //------------------------------------------------------------------------- - static size_t getPacketSizeReceiverReport(const RTCPPacket::ReceiverReport *report) - { - auto rc = report->rc(); - throwIfGreaterThanBitsAllow(rc, 5); - return (sizeof(DWORD)*2) + ((sizeof(DWORD)*6)*rc) + boundarySize(report->extensionSize()); - } - - //------------------------------------------------------------------------- - static size_t getPacketSizeSDES(const RTCPPacket::SDES *report) - { - typedef RTCPPacket::SDES::Chunk Chunk; - - size_t result = (sizeof(DWORD)); - - size_t chunkCount = 0; - - for (Chunk *chunk = report->firstChunk(); NULL != chunk; chunk = chunk->next(), ++chunkCount) - { - size_t chunkSize = sizeof(DWORD); - - for (auto *item = chunk->firstCName(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES CName size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstName(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Name size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstEmail(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Email size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstPhone(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Phone size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstLoc(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Loc size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstTool(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Tool size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstNote(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Note size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstPriv(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len1 = (NULL != item->mValue ? strlen(item->mValue) : 0); - size_t len2 = (NULL != item->mPrefix ? strlen(item->mPrefix) : 0); - - size_t totalLen = len1 + len2; - if (0 != totalLen) ++totalLen; - - throwIfGreaterThanBitsAllow(totalLen, 8); - chunkSize += ((sizeof(BYTE))*totalLen); - ZS_LOG_INSANE(packet_slog("get packet SDES Priv size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("prefix len", len2) + ZS_PARAM("prefix", (NULL != item->mPrefix ? item->mPrefix : NULL)) + ZS_PARAM("len", len1) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstMid(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Mid size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - for (auto *item = chunk->firstRid(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Rid size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - for (auto *item = chunk->firstUnknown(); NULL != item; item = item->next()) - { - chunkSize += (sizeof(BYTE)*2); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - throwIfGreaterThanBitsAllow(len, 8); - chunkSize += ((sizeof(BYTE))*len); - ZS_LOG_INSANE(packet_slog("get packet SDES Unknown size") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } - - size_t modulas = chunkSize % sizeof(DWORD); - - if ((chunkSize == sizeof(DWORD)) || - (0 == modulas)) { - chunkSize += sizeof(DWORD); - } - - result += boundarySize(chunkSize); - } - - throwIfGreaterThanBitsAllow(chunkCount, 5); - return result; - } - - //------------------------------------------------------------------------- - static size_t getPacketSizeBye(const RTCPPacket::Bye *report) - { - auto sc = report->sc(); - throwIfGreaterThanBitsAllow(sc, 5); - - size_t result = (sizeof(DWORD)) + (sizeof(DWORD)*sc); - - if (NULL != report->reasonForLeaving()) { - size_t len = strlen(report->reasonForLeaving()); - if (len > 0) { - throwIfGreaterThanBitsAllow(len, 8); - result += sizeof(BYTE)+(sizeof(BYTE)*len); - } - } - - return boundarySize(result); - } - - //------------------------------------------------------------------------- - static size_t getPacketSizeApp(const RTCPPacket::App *report) - { - size_t result = (sizeof(DWORD)*3); - - auto dataSize = report->dataSize(); - if (0 != dataSize) { - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == report->mData) - result += dataSize; - } - - return boundarySize(result); - } - - //------------------------------------------------------------------------- - static size_t getPacketSizeTransportLayerFeedbackMessage(const RTCPPacket::TransportLayerFeedbackMessage *fm) - { - typedef RTCPPacket::TransportLayerFeedbackMessage TransportLayerFeedbackMessage; - typedef RTCPPacket::TransportLayerFeedbackMessage::GenericNACK GenericNACK; - typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBR TMMBR; - typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBN TMMBN; - - size_t result = (sizeof(DWORD)*3); - - switch (fm->fmt()) { - case GenericNACK::kFmt: - { - auto count = fm->genericNACKCount(); - throwIfLessThan(count, 1); - result += ((sizeof(DWORD))*(count)); - break; - } - case TMMBR::kFmt: - { - auto count = fm->tmmbrCount(); - throwIfLessThan(count, 1); - result += ((sizeof(DWORD)*2)*(count)); - break; - } - case TMMBN::kFmt: - { - auto count = fm->tmmbnCount(); - result += ((sizeof(DWORD)*2)*(count)); - break; - } - default: - { - auto fciSize = fm->fciSize(); - if (0 != fciSize) { - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == fm->fci()) - result += fciSize; - } - break; - } - } - - ZS_LOG_INSANE(packet_slog("getting transport layer feedback message packet size") + ZS_PARAM("fmt", fm->fmtToString()) + ZS_PARAM("fmt (number)", fm->reportSpecific()) + ZS_PARAM("size", result)) - - return boundarySize(result); - } - - //------------------------------------------------------------------------- - static size_t getPacketSizePayloadSpecificFeedbackMessage(const RTCPPacket::PayloadSpecificFeedbackMessage *fm) - { - typedef RTCPPacket::PayloadSpecificFeedbackMessage PayloadSpecificFeedbackMessage; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::PLI PLI; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::SLI SLI; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::RPSI RPSI; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::FIR FIR; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTR TSTR; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTN TSTN; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::VBCM VBCM; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::AFB AFB; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::REMB REMB; - - size_t result = (sizeof(DWORD)*3); - - switch (fm->fmt()) { - case PLI::kFmt: - { - break; - } - case SLI::kFmt: - { - auto count = fm->sliCount(); - throwIfLessThan(count, 1); - result += (sizeof(DWORD)*(count)); - break; - } - case RPSI::kFmt: - { - auto rpsi = fm->rpsi(); - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == rpsi) - result += sizeof(WORD) + (rpsi->nativeRPSIBitStringSizeInBits()/8); - if (0 != (rpsi->nativeRPSIBitStringSizeInBits()%8)) ++result; - break; - } - case FIR::kFmt: - { - auto count = fm->firCount(); - throwIfLessThan(count, 1); - result += ((sizeof(DWORD)*2)*(count)); - break; - } - case TSTR::kFmt: - { - auto count = fm->tstrCount(); - throwIfLessThan(count, 1); - result += ((sizeof(DWORD)*2)*(count)); - break; - } - case TSTN::kFmt: - { - auto count = fm->tstnCount(); - throwIfLessThan(count, 1); - result += ((sizeof(DWORD)*2)*(count)); - break; - } - case VBCM::kFmt: - { - auto count = fm->vbcmCount(); - throwIfLessThan(count, 1); - for (size_t index = 0; index < count; ++index) - { - auto vbcm = fm->vbcmAtIndex(index); - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == vbcm) + } - size_t size = (sizeof(DWORD)*2) + (vbcm->vbcmOctetStringSize()*sizeof(BYTE)); - result += boundarySize(size); - } - break; - } - case AFB::kFmt: - { - auto remb = fm->remb(); - if (NULL == remb) { - auto afb = fm->afb(); - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == afb) + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed APP", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ); + } + return false; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse(TransportLayerFeedbackMessage *report) noexcept + { + if (0 != mTransportLayerFeedbackMessageCount) { + (&(mFirstTransportLayerFeedbackMessage[mTransportLayerFeedbackMessageCount-1]))->mNextTransportLayerFeedbackMessage = report; + } + ++mTransportLayerFeedbackMessageCount; - result += afb->dataSize(); - } else { - result += (sizeof(DWORD)*2); - size_t numSSRCs = remb->numSSRC(); - throwIfGreaterThanBitsAllow(numSSRCs, 8); - throwIfLessThan(numSSRCs, 1); - result += ((sizeof(DWORD))*numSSRCs); - } - break; - } - default: - { - auto fciSize = fm->fciSize(); - if (0 != fciSize) { - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == fm->fci()) - result += fciSize; - } + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); + + { + if (remaining < (sizeof(DWORD)*2)) goto illegal_remaining; + + fill(report, pos, remaining); + + bool result = false; + + switch (report->fmt()) { + case TransportLayerFeedbackMessage::GenericNACK::kFmt: result = parseGenericNACK(report); break; + case TransportLayerFeedbackMessage::TMMBR::kFmt: result = parseTMMBR(report); break; + case TransportLayerFeedbackMessage::TMMBN::kFmt: result = parseTMMBN(report); break; + default: { + result = parseUnknown(report); break; } } - ZS_LOG_INSANE(packet_slog("getting payload specific feedback message packet size") + ZS_PARAM("fmt", fm->fmtToString()) + ZS_PARAM("fmt (number)", fm->reportSpecific()) + ZS_PARAM("size", result)) + ZS_EVENTING_3(x, i, Insane, RTCPPacketParseTransportLayerFeedbackMessage, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, fmt, report->fmtToString(), + byte, fmtNumber, report->reportSpecific() + ); + return true; + } - return boundarySize(result); + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed transport layer feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ); + } + return false; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse(PayloadSpecificFeedbackMessage *report) noexcept + { + if (0 != mPayloadSpecificFeedbackMessageCount) { + (&(mFirstPayloadSpecificFeedbackMessage[mPayloadSpecificFeedbackMessageCount-1]))->mNextPayloadSpecificFeedbackMessage = report; } + ++mPayloadSpecificFeedbackMessageCount; + + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); - //------------------------------------------------------------------------- - static size_t getPacketSizeXR(const RTCPPacket::XR *report) { - typedef RTCPPacket::XR XR; - typedef RTCPPacket::XR::ReportBlock ReportBlock; - typedef RTCPPacket::XR::LossRLEReportBlock LossRLEReportBlock; - typedef RTCPPacket::XR::DuplicateRLEReportBlock DuplicateRLEReportBlock; - typedef RTCPPacket::XR::PacketReceiptTimesReportBlock PacketReceiptTimesReportBlock; - typedef RTCPPacket::XR::ReceiverReferenceTimeReportBlock ReceiverReferenceTimeReportBlock; - typedef RTCPPacket::XR::DLRRReportBlock DLRRReportBlock; - typedef RTCPPacket::XR::StatisticsSummaryReportBlock StatisticsSummaryReportBlock; - typedef RTCPPacket::XR::VoIPMetricsReportBlock VoIPMetricsReportBlock; - typedef RTCPPacket::XR::UnknownReportBlock UnknownReportBlock; + if (remaining < (sizeof(DWORD)*2)) goto illegal_remaining; - size_t result = (sizeof(DWORD)*2); + fill(report, pos, remaining); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - for (const ReportBlock *reportBlock = report->firstReportBlock(); NULL != reportBlock; reportBlock = reportBlock->next()) - { - size_t preSize = result; + bool result = false; - switch (reportBlock->mBlockType) { - case LossRLEReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - result += (sizeof(DWORD)*3); - result += boundarySize(sizeof(WORD)*(block->chunkCount())); - break; - } - case DuplicateRLEReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - result += (sizeof(DWORD)*3); - result += boundarySize(sizeof(WORD)*(block->chunkCount())); - break; - } - case PacketReceiptTimesReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - result += (sizeof(DWORD)*3); - result += (sizeof(DWORD)*(block->receiptTimeCount())); - break; - } - case ReceiverReferenceTimeReportBlock::kBlockType: - { - result += (sizeof(DWORD)*3); - break; - } - case DLRRReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - result += (sizeof(DWORD)); - result += ((sizeof(DWORD)*3)*(block->subBlockCount())); - break; - } - case StatisticsSummaryReportBlock::kBlockType: + switch (report->fmt()) { + case PayloadSpecificFeedbackMessage::PLI::kFmt: result = parsePLI(report); break; + case PayloadSpecificFeedbackMessage::SLI::kFmt: result = parseSLI(report); break; + case PayloadSpecificFeedbackMessage::RPSI::kFmt: result = parseRPSI(report); break; + case PayloadSpecificFeedbackMessage::FIR::kFmt: result = parseFIR(report); break; + case PayloadSpecificFeedbackMessage::TSTR::kFmt: result = parseTSTR(report); break; + case PayloadSpecificFeedbackMessage::TSTN::kFmt: result = parseTSTN(report); break; + case PayloadSpecificFeedbackMessage::VBCM::kFmt: result = parseVBCM(report); break; + case PayloadSpecificFeedbackMessage::AFB::kFmt: { { - result += (sizeof(DWORD)*10); + if (remaining < sizeof(DWORD)) goto generic_afb; + if (0 != memcmp(pos, reinterpret_cast("REMB"), sizeof(DWORD))) goto generic_afb; + + result = parseREMB(report); break; } - case VoIPMetricsReportBlock::kBlockType: + generic_afb: { - result += (sizeof(DWORD)*9); + result = parseAFB(report); break; } - default: - { - result += (sizeof(DWORD)) + boundarySize(reportBlock->mTypeSpecificContentSize); - } } - - ZS_LOG_INSANE(packet_slog("XR block packet size") + ZS_PARAM("block type", reportBlock->blockTypeToString()) + ZS_PARAM("block type (number)", reportBlock->blockType()) + ZS_PARAM("size", result - preSize)) + default: { + result = parseUnknown(report); + break; + } } - return boundarySize(result); + ZS_EVENTING_3(x, i, Insane, RTCPPacketParsePayloadSpecificFeedbackMessage, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, fmt, report->fmtToString(), + byte, fmtNumber, report->reportSpecific() + ); + return true; } - //------------------------------------------------------------------------- - size_t RTCPPacket::getPacketSize(const Report *first) + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ); + } + return false; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse(XR *report) noexcept + { + if (0 != mXRCount) { + (&(mFirstXR[mXRCount-1]))->mNextXR = report; + } + ++mXRCount; + + const BYTE *pos = report->ptr(); + size_t remaining = report->size(); + { - size_t result = 0; + if (remaining < sizeof(DWORD)) goto illegal_remaining; - const Report *final = NULL; + report->mSSRC = UseRTPUtils::getBE32(pos); + internal::advancePos(pos, remaining, sizeof(DWORD)); - for (const Report *report = first; NULL != report; report = report->next()) - { - final = report; + // first count the totals for each XR block type + while (remaining >= sizeof(DWORD)) { + + BYTE bt = pos[0]; + size_t blockLength = static_cast(UseRTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD); + + internal::advancePos(pos, remaining, sizeof(DWORD)); - size_t beforeSize = result; + ++report->mReportBlockCount; - switch (report->pt()) { - case SenderReport::kPayloadType: + if (remaining < blockLength) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "illegal XR block length found", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, blockLength + ); + return false; + } + + switch (bt) { + case XR::LossRLEReportBlock::kBlockType: ++(report->mLossRLEReportBlockCount); break; + case XR::DuplicateRLEReportBlock::kBlockType: ++(report->mDuplicateRLEReportBlockCount); break; + case XR::PacketReceiptTimesReportBlock::kBlockType: ++(report->mPacketReceiptTimesReportBlockCount); break; + case XR::ReceiverReferenceTimeReportBlock::kBlockType: ++(report->mReceiverReferenceTimeReportBlockCount); break; + case XR::DLRRReportBlock::kBlockType: ++(report->mDLRRReportBlockCount); break; + case XR::StatisticsSummaryReportBlock::kBlockType: ++(report->mStatisticsSummaryReportBlockCount); break; + case XR::VoIPMetricsReportBlock::kBlockType: ++(report->mVoIPMetricsReportBlockCount); break; + default: { - const SenderReport *sr = static_cast(report); - result += internal::getPacketSizeSenderReport(sr); + ++(report->mUnknownReportBlockCount); break; break; } - case ReceiverReport::kPayloadType: - { - const ReceiverReport *rr = static_cast(report); - result += internal::getPacketSizeReceiverReport(rr); + } + + internal::advancePos(pos, remaining, blockLength); + } + + if (0 != report->mLossRLEReportBlockCount) { + report->mFirstLossRLEReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::LossRLEReportBlock))*(report->mLossRLEReportBlockCount))) XR::LossRLEReportBlock[report->mLossRLEReportBlockCount]; + } + if (0 != report->mDuplicateRLEReportBlockCount) { + report->mFirstDuplicateRLEReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::DuplicateRLEReportBlock))*(report->mDuplicateRLEReportBlockCount))) XR::DuplicateRLEReportBlock[report->mDuplicateRLEReportBlockCount]; + } + if (0 != report->mPacketReceiptTimesReportBlockCount) { + report->mFirstPacketReceiptTimesReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::PacketReceiptTimesReportBlock))*(report->mPacketReceiptTimesReportBlockCount))) XR::PacketReceiptTimesReportBlock[report->mPacketReceiptTimesReportBlockCount]; + } + if (0 != report->mReceiverReferenceTimeReportBlockCount) { + report->mFirstReceiverReferenceTimeReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::ReceiverReferenceTimeReportBlock))*(report->mReceiverReferenceTimeReportBlockCount))) XR::ReceiverReferenceTimeReportBlock[report->mReceiverReferenceTimeReportBlockCount]; + } + if (0 != report->mDLRRReportBlockCount) { + report->mFirstDLRRReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::DLRRReportBlock))*(report->mDLRRReportBlockCount))) XR::DLRRReportBlock[report->mDLRRReportBlockCount]; + } + if (0 != report->mStatisticsSummaryReportBlockCount) { + report->mFirstStatisticsSummaryReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::StatisticsSummaryReportBlock))*(report->mStatisticsSummaryReportBlockCount))) XR::StatisticsSummaryReportBlock[report->mStatisticsSummaryReportBlockCount]; + } + if (0 != report->mVoIPMetricsReportBlockCount) { + report->mFirstVoIPMetricsReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::VoIPMetricsReportBlock))*(report->mVoIPMetricsReportBlockCount))) XR::VoIPMetricsReportBlock[report->mVoIPMetricsReportBlockCount]; + } + if (0 != report->mUnknownReportBlockCount) { + report->mFirstUnknownReportBlock = new (allocateBuffer(internal::alignedSize(sizeof(XR::UnknownReportBlock))*(report->mUnknownReportBlockCount))) XR::UnknownReportBlock[report->mUnknownReportBlockCount]; + } + + report->mLossRLEReportBlockCount = 0; + report->mDuplicateRLEReportBlockCount = 0; + report->mPacketReceiptTimesReportBlockCount = 0; + report->mReceiverReferenceTimeReportBlockCount = 0; + report->mDLRRReportBlockCount = 0; + report->mStatisticsSummaryReportBlockCount = 0; + report->mVoIPMetricsReportBlockCount = 0; + report->mUnknownReportBlockCount = 0; + + XR::ReportBlock *previousReportBlock = NULL; + + // reset to start of buffer + pos = report->ptr(); + remaining = report->size(); + + internal::advancePos(pos, remaining, sizeof(DWORD)); + + // parse each XR report block + while (remaining >= sizeof(DWORD)) { + const BYTE *prePos = pos; + size_t preAllocationSize = mAllocationSize; + + BYTE bt = pos[0]; + BYTE typeSpecific = pos[1]; + size_t blockLength = static_cast(UseRTPUtils::getBE16(&(pos[2]))) * sizeof(DWORD); + + internal::advancePos(pos, remaining, sizeof(DWORD)); + + if (remaining < blockLength) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed XR block length found", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, blockLength + ); + return false; + } + + XR::ReportBlock *usingBlock = NULL; + + switch (bt) { + case XR::LossRLEReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstLossRLEReportBlock[report->mLossRLEReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mLossRLEReportBlockCount) { + (&(report->mFirstLossRLEReportBlock[report->mLossRLEReportBlockCount-1]))->mNextLossRLE = reportBlock; + } + ++(report->mLossRLEReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - case SDES::kPayloadType: - { - const SDES *sdes = static_cast(report); - result += internal::getPacketSizeSDES(sdes); + case XR::DuplicateRLEReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstDuplicateRLEReportBlock[report->mDuplicateRLEReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mDuplicateRLEReportBlockCount) { + (&(report->mFirstDuplicateRLEReportBlock[report->mDuplicateRLEReportBlockCount-1]))->mNextDuplicateRLE = reportBlock; + } + ++(report->mDuplicateRLEReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - case Bye::kPayloadType: - { - const Bye *bye = static_cast(report); - result += internal::getPacketSizeBye(bye); + case XR::PacketReceiptTimesReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstPacketReceiptTimesReportBlock[report->mPacketReceiptTimesReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mPacketReceiptTimesReportBlockCount) { + (&(report->mFirstPacketReceiptTimesReportBlock[report->mPacketReceiptTimesReportBlockCount-1]))->mNextPacketReceiptTimesReportBlock = reportBlock; + } + ++(report->mPacketReceiptTimesReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - case App::kPayloadType: - { - const App *app = static_cast(report); - result += internal::getPacketSizeApp(app); + case XR::ReceiverReferenceTimeReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstReceiverReferenceTimeReportBlock[report->mReceiverReferenceTimeReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mReceiverReferenceTimeReportBlockCount) { + (&(report->mFirstReceiverReferenceTimeReportBlock[report->mReceiverReferenceTimeReportBlockCount-1]))->mNextReceiverReferenceTimeReportBlock = reportBlock; + } + ++(report->mReceiverReferenceTimeReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - case TransportLayerFeedbackMessage::kPayloadType: - { - const TransportLayerFeedbackMessage *fm = static_cast(report); - result += internal::getPacketSizeTransportLayerFeedbackMessage(fm); + case XR::DLRRReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstDLRRReportBlock[report->mDLRRReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mDLRRReportBlockCount) { + (&(report->mFirstDLRRReportBlock[report->mDLRRReportBlockCount-1]))->mNextDLRRReportBlock = reportBlock; + } + ++(report->mDLRRReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - case PayloadSpecificFeedbackMessage::kPayloadType: - { - const PayloadSpecificFeedbackMessage *fm = static_cast(report); - result += internal::getPacketSizePayloadSpecificFeedbackMessage(fm); + case XR::StatisticsSummaryReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstStatisticsSummaryReportBlock[report->mStatisticsSummaryReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mStatisticsSummaryReportBlockCount) { + (&(report->mFirstStatisticsSummaryReportBlock[report->mStatisticsSummaryReportBlockCount-1]))->mNextStatisticsSummaryReportBlock = reportBlock; + } + ++(report->mStatisticsSummaryReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - case XR::kPayloadType: - { - const XR *xr = static_cast(report); - result += internal::getPacketSizeXR(xr); + case XR::VoIPMetricsReportBlock::kBlockType: { + auto reportBlock = &(report->mFirstVoIPMetricsReportBlock[report->mVoIPMetricsReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mVoIPMetricsReportBlockCount) { + (&(report->mFirstVoIPMetricsReportBlock[report->mVoIPMetricsReportBlockCount-1]))->mNextVoIPMetricsReportBlock = reportBlock; + } + ++(report->mVoIPMetricsReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } - default: - { - result += sizeof(DWORD) + boundarySize(report->size()); + default: { + auto reportBlock = &(report->mFirstUnknownReportBlock[report->mUnknownReportBlockCount]); + usingBlock = reportBlock; + if (0 != report->mUnknownReportBlockCount) { + (&(report->mFirstUnknownReportBlock[report->mUnknownReportBlockCount-1]))->mNextUnknownReportBlock = reportBlock; + } + ++(report->mUnknownReportBlockCount); + fill(report, reportBlock, previousReportBlock, bt, typeSpecific, pos, blockLength); + if (!parse(report, reportBlock)) return false; break; } } - size_t afterSize = result; + internal::advancePos(pos, remaining, blockLength); - if (ZS_IS_LOGGING(Insane)) { - ZS_LOG_TRACE(slog("getting report packet size") + ZS_PARAM("pt", report->ptToString()) + ZS_PARAM("pt (num)", report->pt()) + ZS_PARAM("size", afterSize-beforeSize)) - } + ZS_EVENTING_5(x, i, Insane, RTCPPacketParseXR, ol, RtcpPacket, Parse, + puid, mediaChannelID, mMediaChannelID, + string, blockType, usingBlock->blockTypeToString(), + size_t, blockLength, blockLength, + size_t, consumed, (reinterpret_cast(pos) - reinterpret_cast(prePos)), + size_t, allocationConsumed, preAllocationSize - mAllocationSize + ); } - if (NULL != final) { - auto padding = final->padding(); - if (0 != padding) { - result += padding; - } - } + return true; + } - return boundarySize(result); + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed XR when parsing", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->ptr())) + ); } + return false; + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket (packet writing routines) - #pragma mark + //------------------------------------------------------------------------- + bool RTCPPacket::parse(UnknownReport *report) noexcept + { + if (0 != mUnknownReportCount) { + (&(mFirstUnknownReport[mUnknownReportCount-1]))->mNextUnknown = report; + } + ++mUnknownReportCount; - //------------------------------------------------------------------------- - static void writePacketHeader(const RTCPPacket::Report *report, BYTE * &pos, size_t &remaining) - { - ASSERT(remaining >= sizeof(DWORD)) - ASSERT(2 == report->version()) + return true; + } + + //------------------------------------------------------------------------- + void RTCPPacket::fill(FeedbackMessage *report, const BYTE *contents, size_t contentSize) noexcept + { + const BYTE *pos = contents; + size_t remaining = contentSize; - auto padding = report->padding(); - if (0 != padding) { - ASSERT(NULL == report->next()) - ASSERT(throwIfGreaterThanBitsAllow(padding, 8)) - } + report->mSSRCOfPacketSender = UseRTPUtils::getBE32(&(pos[0])); + report->mSSRCOfMediaSource = UseRTPUtils::getBE32(&(pos[4])); - ASSERT(throwIfGreaterThanBitsAllow(report->reportSpecific(), 5)) + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - pos[0] = RTCP_PACK_BITS(report->version(), 0x3, 6) | - ((0 != padding) ? RTCP_PACK_BITS(1, 0x1, 5) : 0) | - RTCP_PACK_BITS(report->reportSpecific(), 0x1F, 0); - pos[1] = report->pt(); + if (remaining > sizeof(BYTE)) { + report->mFCI = pos; + report->mFCISize = remaining; } + } - //------------------------------------------------------------------------- - static void writePacketSenderReceiverCommonReport(const RTCPPacket::SenderReceiverCommonReport *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::SenderReceiverCommonReport SenderReceiverCommonReport; - typedef RTCPPacket::SenderReceiverCommonReport::ReportBlock ReportBlock; + //------------------------------------------------------------------------- + void RTCPPacket::fill( + XR *report, + XR::ReportBlock *reportBlock, + XR::ReportBlock * &ioPreviousReportBlock, + BYTE blockType, + BYTE typeSpecific, + const BYTE *contents, + size_t contentSize + ) noexcept + { + reportBlock->mBlockType = blockType; + reportBlock->mTypeSpecific = typeSpecific; + if (0 != contentSize) { + reportBlock->mTypeSpecificContents = contents; + reportBlock->mTypeSpecificContentSize = contentSize; + } - size_t count = 0; - for (const ReportBlock *block = report->firstReportBlock(); NULL != block; block = block->next(), ++count) - { - ASSERT(count < report->rc()) + if (NULL == report->mFirstReportBlock) { + report->mFirstReportBlock = reportBlock; + } + if (NULL != ioPreviousReportBlock) { + ioPreviousReportBlock->mNext = reportBlock; + } + ioPreviousReportBlock = reportBlock; + } - RTPUtils::setBE32(&(pos[0]), block->ssrc()); - ASSERT(throwIfGreaterThanBitsAllow(block->cumulativeNumberOfPacketsLost(), 24)) - RTPUtils::setBE32(&(pos[4]), block->cumulativeNumberOfPacketsLost()); - pos[4] = block->fractionLost(); - RTPUtils::setBE32(&(pos[8]), block->extendedHighestSequenceNumberReceived()); - RTPUtils::setBE32(&(pos[12]), block->interarrivalJitter()); - RTPUtils::setBE32(&(pos[16]), block->lsr()); - RTPUtils::setBE32(&(pos[20]), block->dlsr()); + //------------------------------------------------------------------------- + bool RTCPPacket::parseGenericNACK(TransportLayerFeedbackMessage *report) noexcept + { + typedef TransportLayerFeedbackMessage::GenericNACK GenericNACK; + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - advancePos(pos, remaining, sizeof(DWORD)*6); - } + size_t possibleNACKs = remaining / sizeof(DWORD); + + ZS_ASSERT(0 != possibleNACKs); + + report->mFirstGenericNACK = new (allocateBuffer(internal::alignedSize(sizeof(GenericNACK))*possibleNACKs)) GenericNACK[possibleNACKs]; + + while (remaining >= sizeof(DWORD)) { + GenericNACK *nack = &(report->mFirstGenericNACK[report->mGenericNACKCount]); + + nack->mPID = UseRTPUtils::getBE16(&(pos[0])); + nack->mBLP = UseRTPUtils::getBE16(&(pos[2])); + + internal::advancePos(pos, remaining, sizeof(DWORD)); + + ++(report->mGenericNACKCount); + } + + ZS_ASSERT(possibleNACKs == report->mGenericNACKCount); + + return true; + } + + //------------------------------------------------------------------------- + void RTCPPacket::fillTMMBRCommon( + ZS_MAYBE_USED() TransportLayerFeedbackMessage *report, + TransportLayerFeedbackMessage::TMMBRCommon *common, + const BYTE *pos + ) noexcept + { + ZS_MAYBE_USED(report); + //typedef TransportLayerFeedbackMessage::TMMBRCommon TMMBRCommon; + + common->mSSRC = UseRTPUtils::getBE32(&(pos[0])); + common->mMxTBRExp = RTCP_GET_BITS(pos[4], 0x3F, 2); + common->mMxTBRMantissa = RTCP_GET_BITS(UseRTPUtils::getBE32(&(pos[4])), 0x1FFFF, 9); + common->mMeasuredOverhead = RTCP_GET_BITS(UseRTPUtils::getBE32(&(pos[4])), 0x1FF, 0); + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parseTMMBR(TransportLayerFeedbackMessage *report) noexcept + { + typedef TransportLayerFeedbackMessage::TMMBR TMMBR; + + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); + + size_t possibleTMMBRs = remaining / (sizeof(DWORD)*2); + + ZS_ASSERT(0 != possibleTMMBRs); + + report->mFirstTMMBR = new (allocateBuffer(internal::alignedSize(sizeof(TMMBR))*possibleTMMBRs)) TMMBR[possibleTMMBRs]; + + while (remaining >= (sizeof(DWORD)*2)) { + TMMBR *tmmbr = &(report->mFirstTMMBR[report->mTMMBRCount]); + + fillTMMBRCommon(report, tmmbr, pos); + + internal::advancePos(pos, remaining, sizeof(DWORD)*2); + + ++(report->mTMMBRCount); + } - ASSERT(count == report->rc()) + ZS_ASSERT(possibleTMMBRs == report->mTMMBRCount); - if (report->extensionSize() > 0) { - ASSERT(NULL != report->extension()) - memcpy(pos, report->extension(), report->extensionSize()); - advancePos(pos, remaining, boundarySize(report->extensionSize())); - } - } + return true; + } - //------------------------------------------------------------------------- - static void writePacketSenderReport(const RTCPPacket::SenderReport *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::SenderReport SenderReport; - pos[1] = SenderReport::kPayloadType; + //------------------------------------------------------------------------- + bool RTCPPacket::parseTMMBN(TransportLayerFeedbackMessage *report) noexcept + { + typedef TransportLayerFeedbackMessage::TMMBN TMMBN; - RTPUtils::setBE32(&(pos[4]), report->ssrcOfSender()); - RTPUtils::setBE32(&(pos[8]), report->ntpTimestampMS()); - RTPUtils::setBE32(&(pos[12]), report->ntpTimestampLS()); - RTPUtils::setBE32(&(pos[16]), report->rtpTimestamp()); - RTPUtils::setBE32(&(pos[20]), report->senderPacketCount()); - RTPUtils::setBE32(&(pos[24]), report->senderOctetCount()); + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - advancePos(pos, remaining, sizeof(DWORD)*7); + size_t possibleTMMBNs = remaining / (sizeof(DWORD)*2); - writePacketSenderReceiverCommonReport(report, pos, remaining); + if (possibleTMMBNs < 1) { + report->mFirstTMMBN = NULL; + report->mTMMBNCount = 0; + return true; } - //------------------------------------------------------------------------- - static void writePacketReceiverReport(const RTCPPacket::ReceiverReport *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::ReceiverReport ReceiverReport; - pos[1] = ReceiverReport::kPayloadType; + report->mFirstTMMBN = new (allocateBuffer(internal::alignedSize(sizeof(TMMBN))*possibleTMMBNs)) TMMBN[possibleTMMBNs]; - RTPUtils::setBE32(&(pos[4]), report->ssrcOfPacketSender()); + while (remaining >= (sizeof(DWORD)*2)) { + TMMBN *tmmbr = &(report->mFirstTMMBN[report->mTMMBNCount]); - advancePos(pos, remaining, sizeof(DWORD)*2); + fillTMMBRCommon(report, tmmbr, pos); - writePacketSenderReceiverCommonReport(report, pos, remaining); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); + + ++(report->mTMMBNCount); } - - //------------------------------------------------------------------------- - static void writePacketSDES(const RTCPPacket::SDES *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::SDES SDES; - typedef RTCPPacket::SDES::Chunk Chunk; - pos[1] = SDES::kPayloadType; + ZS_ASSERT(possibleTMMBNs == report->mTMMBNCount); - advancePos(pos, remaining, sizeof(DWORD)); + return true; + } - size_t chunkCount = 0; + //------------------------------------------------------------------------- + bool RTCPPacket::parseUnknown(TransportLayerFeedbackMessage *report) noexcept + { + report->mUnknown = report; + return true; + } - for (Chunk *chunk = report->firstChunk(); NULL != chunk; chunk = chunk->next(), ++chunkCount) - { - RTPUtils::setBE32(pos, chunk->ssrc()); - advancePos(pos, remaining, sizeof(DWORD)); + //------------------------------------------------------------------------- + bool RTCPPacket::parsePLI(ZS_MAYBE_USED() PayloadSpecificFeedbackMessage *report) noexcept + { + ZS_MAYBE_USED(report); + return true; + } - BYTE *startPos = pos; + //------------------------------------------------------------------------- + bool RTCPPacket::parseSLI(PayloadSpecificFeedbackMessage *report) noexcept + { + typedef PayloadSpecificFeedbackMessage::SLI SLI; - for (auto *item = chunk->firstCName(); NULL != item; item = item->next()) - { - pos[0] = Chunk::CName::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - advancePos(pos, remaining, sizeof(WORD)); + size_t possibleSLIs = remaining / (sizeof(DWORD)); - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES CName") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + ZS_ASSERT(0 != possibleSLIs); - for (auto *item = chunk->firstName(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Name::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + report->mFirstSLI = new (allocateBuffer(internal::alignedSize(sizeof(SLI))*possibleSLIs)) SLI[possibleSLIs]; - advancePos(pos, remaining, sizeof(WORD)); + while (remaining >= (sizeof(DWORD))) { + SLI *sli = &(report->mFirstSLI[report->mSLICount]); - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Name") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + sli->mFirst = RTCP_GET_BITS(UseRTPUtils::getBE16(&(pos[0])), 0x1FFF, 3); + sli->mNumber = static_cast(RTCP_GET_BITS(UseRTPUtils::getBE32(&(pos[0])), 0x1FFF, 6)); + sli->mPictureID = RTCP_GET_BITS(pos[3], 0x3F, 0); - for (auto *item = chunk->firstEmail(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Email::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + internal::advancePos(pos, remaining, sizeof(DWORD)); - advancePos(pos, remaining, sizeof(WORD)); + ++(report->mSLICount); + } - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Email") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + ZS_ASSERT(possibleSLIs == report->mSLICount); - for (auto *item = chunk->firstPhone(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Phone::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parseRPSI(PayloadSpecificFeedbackMessage *report) noexcept + { + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - advancePos(pos, remaining, sizeof(WORD)); + { + if (remaining < sizeof(WORD)) goto illegal_remaining; - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Phone") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + BYTE pb = pos[0]; + report->mRPSI.mZeroBit = RTCP_GET_BITS(pos[1], 0x1, 7); + report->mRPSI.mPayloadType = RTCP_GET_BITS(pos[1], 0x7F, 0); - for (auto *item = chunk->firstLoc(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Loc::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + internal::advancePos(pos, remaining, sizeof(WORD)); - advancePos(pos, remaining, sizeof(WORD)); + if (remaining > 0) { + report->mRPSI.mNativeRPSIBitString = pos; + report->mRPSI.mNativeRPSIBitStringSizeInBits = (remaining*8); + if (pb > report->mRPSI.mNativeRPSIBitStringSizeInBits) goto illegal_remaining; - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Loc") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) + report->mRPSI.mNativeRPSIBitStringSizeInBits -= static_cast(pb); + if (0 == report->mRPSI.mNativeRPSIBitStringSizeInBits) { + report->mRPSI.mNativeRPSIBitString = NULL; } + } - for (auto *item = chunk->firstTool(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Tool::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) - - advancePos(pos, remaining, sizeof(WORD)); - - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Tool") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + return true; + } - for (auto *item = chunk->firstNote(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Note::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed RPSI payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->fci())) + ); + } + return false; + } + + //------------------------------------------------------------------------- + void RTCPPacket::fillCodecControlCommon( + ZS_MAYBE_USED() PayloadSpecificFeedbackMessage *report, + PayloadSpecificFeedbackMessage::CodecControlCommon *common, + const BYTE *pos + ) noexcept + { + ZS_MAYBE_USED(report); + common->mSSRC = UseRTPUtils::getBE32(&(pos[0])); + common->mSeqNr = pos[4]; + common->mReserved = RTCP_GET_BITS(UseRTPUtils::getBE32(&(pos[4])), 0xFFFFFF, 0); + } - advancePos(pos, remaining, sizeof(WORD)); + //------------------------------------------------------------------------- + bool RTCPPacket::parseFIR(PayloadSpecificFeedbackMessage *report) noexcept + { + typedef PayloadSpecificFeedbackMessage::FIR FIR; - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Note") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - for (auto *item = chunk->firstPriv(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Priv::kItemType; - size_t len1 = (NULL != item->mPrefix ? strlen(item->mPrefix) : 0); - size_t len2 = (NULL != item->mValue ? strlen(item->mValue) : 0); - size_t len = len1 + len2; - if (len > 0) ++len; - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + size_t possibleFIRs = remaining / (sizeof(DWORD)*2); - advancePos(pos, remaining, sizeof(WORD)); + ZS_ASSERT(0 != possibleFIRs); - if (len > 0) { - pos[0] = static_cast(len1); - advancePos(pos, remaining); - if (len1 > 0) { - memcpy(pos, item->prefix(), len1*sizeof(BYTE)); - advancePos(pos, remaining, len1*sizeof(BYTE)); - } - if (len2 > 0) { - memcpy(pos, item->value(), len2*sizeof(BYTE)); - advancePos(pos, remaining, len2*sizeof(BYTE)); - } - } - ZS_LOG_INSANE(packet_slog("writing SDES Priv") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("prefix len", len1) + ZS_PARAM("prefix", (NULL != item->mPrefix ? item->mPrefix : NULL)) + ZS_PARAM("len", len2) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + report->mFirstFIR = new (allocateBuffer(internal::alignedSize(sizeof(FIR))*possibleFIRs)) FIR[possibleFIRs]; - for (auto *item = chunk->firstMid(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Mid::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + while (remaining >= (sizeof(DWORD)*2)) { + FIR *fir = &(report->mFirstFIR[report->mFIRCount]); + fillCodecControlCommon(report, fir, pos); - advancePos(pos, remaining, sizeof(WORD)); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Mid report") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + ++(report->mFIRCount); + } - for (auto *item = chunk->firstRid(); NULL != item; item = item->next()) - { - pos[0] = Chunk::Rid::kItemType; - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + ZS_ASSERT(possibleFIRs == report->mFIRCount) - advancePos(pos, remaining, sizeof(WORD)); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parseTSTR(PayloadSpecificFeedbackMessage *report) noexcept + { + typedef PayloadSpecificFeedbackMessage::TSTR TSTR; - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Rid report") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - for (auto *item = chunk->firstUnknown(); NULL != item; item = item->next()) - { - pos[0] = item->type(); - size_t len = (NULL != item->mValue ? strlen(item->mValue) : 0); - pos[1] = static_cast(len); - ASSERT(throwIfGreaterThanBitsAllow(len, 8)) + size_t possibleTSTRs = remaining / (sizeof(DWORD)*2); - advancePos(pos, remaining, sizeof(WORD)); + ZS_ASSERT(0 != possibleTSTRs); - if (len > 0) { - memcpy(pos, item->value(), len*sizeof(BYTE)); - advancePos(pos, remaining, len*sizeof(BYTE)); - } - ZS_LOG_INSANE(packet_slog("writing SDES Unknown") + ZS_PARAM("chunk", chunkCount) + ZS_PARAM("len", len) + ZS_PARAM("type", item->mType) + ZS_PARAM("value", (NULL != item->mValue ? item->mValue : NULL))) - } + report->mFirstTSTR = new (allocateBuffer(internal::alignedSize(sizeof(TSTR))*possibleTSTRs)) TSTR[possibleTSTRs]; - BYTE *endPos = pos; + while (remaining >= (sizeof(DWORD)*2)) { + TSTR *tstr = &(report->mFirstTSTR[report->mTSTRCount]); + fillCodecControlCommon(report, tstr, pos); - PTRNUMBER diff = reinterpret_cast(endPos) - reinterpret_cast(startPos); - auto modulas = (diff % sizeof(DWORD)); - if (0 != modulas) { - advancePos(pos, remaining, sizeof(DWORD)-modulas); - } + tstr->mControlSpecific = RTCP_GET_BITS(tstr->mReserved, 0x1F, 0); + tstr->mReserved = RTCP_GET_BITS(tstr->mReserved, 0x7FFFF, 5); - if ((0 == diff) || - (0 == modulas)) { - // write "empty" chunk - RTPUtils::setBE32(pos, 0); - advancePos(pos, remaining, sizeof(DWORD)); - } - } + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - throwIfGreaterThanBitsAllow(chunkCount, 5); + ++(report->mTSTRCount); } + + ZS_ASSERT(possibleTSTRs == report->mTSTRCount); + + return true; + } - //------------------------------------------------------------------------- - static void writePacketBye(const RTCPPacket::Bye *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::Bye Bye; - pos[1] = Bye::kPayloadType; + //------------------------------------------------------------------------- + bool RTCPPacket::parseTSTN(PayloadSpecificFeedbackMessage *report) noexcept + { + typedef PayloadSpecificFeedbackMessage::TSTN TSTN; - advancePos(pos, remaining, sizeof(DWORD)); + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - for (size_t index = 0; index < report->sc(); ++index) - { - RTPUtils::setBE32(pos, report->ssrc(index)); - advancePos(pos, remaining, sizeof(DWORD)); - } + size_t possibleTSTNs = remaining / (sizeof(DWORD)*2); - if (NULL != report->reasonForLeaving()) { - size_t len = strlen(report->reasonForLeaving()); - if (len > 0) { - pos[0] = static_cast(len); - memcpy(&(pos[1]), report->reasonForLeaving(), len*sizeof(BYTE)); - advancePos(pos, remaining, (len*sizeof(BYTE))+sizeof(BYTE)); - } - } + ZS_ASSERT(0 != possibleTSTNs); + + report->mFirstTSTN = new (allocateBuffer(internal::alignedSize(sizeof(TSTN))*possibleTSTNs)) TSTN[possibleTSTNs]; + + while (remaining >= (sizeof(DWORD)*2)) { + TSTN *tstn = &(report->mFirstTSTN[report->mTSTNCount]); + fillCodecControlCommon(report, tstn, pos); + + tstn->mControlSpecific = RTCP_GET_BITS(tstn->mReserved, 0x1F, 0); + tstn->mReserved = RTCP_GET_BITS(tstn->mReserved, 0x7FFFF, 5); + + internal::advancePos(pos, remaining, sizeof(DWORD)*2); + + ++(report->mTSTNCount); } - //------------------------------------------------------------------------- - static void writePacketApp(const RTCPPacket::App *report, BYTE * &pos, size_t &remaining) + ZS_ASSERT(possibleTSTNs == report->mTSTNCount); + + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parseVBCM(PayloadSpecificFeedbackMessage *report) noexcept + { + typedef PayloadSpecificFeedbackMessage::VBCM VBCM; + + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); + + size_t possibleVBCMs = 0; + + // first count the VBCM blocks { - typedef RTCPPacket::App App; - pos[1] = App::kPayloadType; + while (remaining >= (sizeof(DWORD)*2)) { + ++possibleVBCMs; + + size_t length = UseRTPUtils::getBE16(&(pos[6])); + size_t modulas = length % sizeof(DWORD); + size_t padding = ((0 != modulas) ? (sizeof(DWORD)-modulas) : 0); - RTPUtils::setBE32(&(pos[4]), report->ssrc()); - memcpy(&(pos[8]), report->name(), sizeof(DWORD)); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - advancePos(pos, remaining, sizeof(DWORD)*3); + ZS_ASSERT(remaining >= length); - size_t dataSize = report->dataSize(); - if (0 != dataSize) { - memcpy(pos, report->data(), dataSize); - advancePos(pos, remaining, dataSize); + size_t skipLength = (((length + padding) > remaining) ? remaining : (length + padding)); + + internal::advancePos(pos, remaining, skipLength); } + ZS_ASSERT(0 != possibleVBCMs); } - //------------------------------------------------------------------------- - static void writePacketTransportLayerFeedbackMessage(const RTCPPacket::TransportLayerFeedbackMessage *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::TransportLayerFeedbackMessage TransportLayerFeedbackMessage; - typedef RTCPPacket::TransportLayerFeedbackMessage::GenericNACK GenericNACK; - typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBR TMMBR; - typedef RTCPPacket::TransportLayerFeedbackMessage::TMMBN TMMBN; - - pos[1] = TransportLayerFeedbackMessage::kPayloadType; + pos = report->fci(); + remaining = report->fciSize(); - RTPUtils::setBE32(&(pos[4]), report->ssrcOfPacketSender()); - RTPUtils::setBE32(&(pos[8]), report->ssrcOfMediaSource()); + { + ZS_ASSERT(0 != possibleVBCMs); - advancePos(pos, remaining, sizeof(DWORD)*3); + report->mFirstVBCM = new (allocateBuffer(internal::alignedSize(sizeof(VBCM))*possibleVBCMs)) VBCM[possibleVBCMs]; - switch (report->fmt()) { - case GenericNACK::kFmt: - { - auto count = report->genericNACKCount(); + while (remaining >= (sizeof(DWORD)*2)) { + VBCM *vcbm = &(report->mFirstVBCM[report->mVBCMCount]); + fillCodecControlCommon(report, vcbm, pos); - for (size_t index = 0; index < count; ++index) - { - auto item = report->genericNACKAtIndex(index); - RTPUtils::setBE16(&(pos[0]), item->pid()); - RTPUtils::setBE16(&(pos[2]), item->blp()); - advancePos(pos, remaining, sizeof(DWORD)); - } - break; - } - case TMMBR::kFmt: - { - auto count = report->tmmbrCount(); + // move reserved to control specific + vcbm->mControlSpecific = vcbm->mReserved; + vcbm->mReserved = 0; - for (size_t index = 0; index < count; ++index) - { - auto item = report->tmmbrAtIndex(index); - RTPUtils::setBE32(&(pos[0]), item->ssrc()); + size_t length = UseRTPUtils::getBE16(&(pos[6])); + size_t modulas = length % sizeof(DWORD); + size_t padding = ((0 != modulas) ? (sizeof(DWORD)-modulas) : 0); - DWORD merged = RTCP_PACK_BITS(static_cast(item->mxTBRExp()), 0x3F, 26) | - RTCP_PACK_BITS(static_cast(item->mxTBRMantissa()), 0x1FFFF, 9) | - RTCP_PACK_BITS(static_cast(item->measuredOverhead()), 0x1FF, 0); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - RTPUtils::setBE32(&(pos[4]), merged); + ZS_ASSERT(remaining >= length) - advancePos(pos, remaining, sizeof(DWORD)*2); - } - break; + if (length > 0) { + vcbm->mVBCMOctetString = pos; } - case TMMBN::kFmt: - { - auto count = report->tmmbnCount(); - - for (size_t index = 0; index < count; ++index) - { - auto item = report->tmmbnAtIndex(index); - RTPUtils::setBE32(&(pos[0]), item->ssrc()); - DWORD merged = RTCP_PACK_BITS(static_cast(item->mxTBRExp()), 0x3F, 26) | - RTCP_PACK_BITS(static_cast(item->mxTBRMantissa()), 0x1FFFF, 9) | - RTCP_PACK_BITS(static_cast(item->measuredOverhead()), 0x1FF, 0); + size_t skipLength = (((length + padding) > remaining) ? remaining : (length + padding)); - RTPUtils::setBE32(&(pos[4]), merged); + internal::advancePos(pos, remaining, skipLength); - advancePos(pos, remaining, sizeof(DWORD)*2); - } - break; - } - default: - { - auto fciSize = report->fciSize(); - if (0 != fciSize) { - memcpy(pos, report->fci(), report->fciSize()); - advancePos(pos, remaining, report->fciSize()); - } - break; - } + ++(report->mVBCMCount); } - ZS_LOG_INSANE(packet_slog("writing transport layer feedback message") + ZS_PARAM("fmt", report->fmtToString()) + ZS_PARAM("fmt (number)", report->reportSpecific())) + ZS_ASSERT(possibleVBCMs == report->mVBCMCount); } - - //------------------------------------------------------------------------- - static void writePacketPayloadSpecificFeedbackMessage(const RTCPPacket::PayloadSpecificFeedbackMessage *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::PayloadSpecificFeedbackMessage PayloadSpecificFeedbackMessage; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::PLI PLI; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::SLI SLI; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::RPSI RPSI; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::FIR FIR; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTR TSTR; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::TSTN TSTN; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::VBCM VBCM; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::AFB AFB; - typedef RTCPPacket::PayloadSpecificFeedbackMessage::REMB REMB; + return true; + } - pos[1] = PayloadSpecificFeedbackMessage::kPayloadType; + //------------------------------------------------------------------------- + bool RTCPPacket::parseAFB(PayloadSpecificFeedbackMessage *report) noexcept + { + //typedef PayloadSpecificFeedbackMessage::AFB AFB; - RTPUtils::setBE32(&(pos[4]), report->ssrcOfPacketSender()); - RTPUtils::setBE32(&(pos[8]), report->ssrcOfMediaSource()); + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - advancePos(pos, remaining, sizeof(DWORD)*3); + if (remaining > 0) { + report->mAFB.mData = pos; + report->mAFB.mDataSize = remaining; + } + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parseREMB(PayloadSpecificFeedbackMessage *report) noexcept + { + //typedef PayloadSpecificFeedbackMessage::REMB REMB; - switch (report->fmt()) { - case PLI::kFmt: - { - break; - } - case SLI::kFmt: - { - auto count = report->sliCount(); + if (!parseAFB(report)) return false; - for (size_t index = 0; index < count; ++index) - { - auto item = report->sliAtIndex(index); + const BYTE *pos = report->fci(); + size_t remaining = report->fciSize(); - DWORD merged = RTCP_PACK_BITS(static_cast(item->first()), 0x1FFF, 19) | - RTCP_PACK_BITS(static_cast(item->number()), 0x1FFF, 6) | - RTCP_PACK_BITS(static_cast(item->pictureID()), 0x3F, 0); + report->mHasREMB = true; - RTPUtils::setBE32(&(pos[0]), merged); - advancePos(pos, remaining, sizeof(DWORD)); - } - break; - } - case RPSI::kFmt: - { - auto rpsi = report->rpsi(); + { + ZS_ASSERT(remaining >= sizeof(DWORD) * 3); - pos[1] = RTCP_PACK_BITS(static_cast(rpsi->zeroBit()), 0x1, 7) | - RTCP_PACK_BITS(static_cast(rpsi->payloadType()), 0x7F, 0); + report->mREMB.mNumSSRC = pos[4]; + report->mREMB.mBRExp = RTCP_GET_BITS(pos[5], 0x3F, 2); + report->mREMB.mBRMantissa = RTCP_GET_BITS(UseRTPUtils::getBE32(&(pos[4])), 0x3FFFF, 0); - auto totalBits = static_cast(rpsi->nativeRPSIBitStringSizeInBits()); + size_t possibleSSRCs = (remaining - sizeof(DWORD)*2) / (sizeof(DWORD)); - size_t byteModulas = (totalBits%8); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - size_t totalBytes = (totalBits/8) + ((0 != byteModulas) ? 1 : 0); - if (0 != totalBytes) { - memcpy(&(pos[2]), rpsi->nativeRPSIBitString(), totalBytes); - if (0 != byteModulas) { - BYTE &by = (pos[2+totalBytes-1]); - by = by & static_cast(((1 << byteModulas)-1) << (8-byteModulas)); - } - } + report->mREMB.mSSRCs = new (allocateBuffer(internal::alignedSize(sizeof(DWORD))*possibleSSRCs)) DWORD[possibleSSRCs]; - size_t totalSizeInBits = (sizeof(WORD)*8)+(totalBits); - auto boundaryModulas = totalSizeInBits % (sizeof(DWORD)*8); + size_t count = 0; + while ((possibleSSRCs > 0) && + (count < report->mREMB.numSSRC()) && + (remaining >= sizeof(DWORD))) + { + report->mREMB.mSSRCs[count] = UseRTPUtils::getBE32(pos); + internal::advancePos(pos, remaining, sizeof(DWORD)); + --possibleSSRCs; + ++count; + } - if (0 != boundaryModulas) { - pos[0] = static_cast((sizeof(DWORD)*8)-boundaryModulas); - } else { - pos[0] = 0; - } + if (count != report->mREMB.numSSRC()) goto illegal_remaining; + return true; + } - advancePos(pos, remaining, sizeof(WORD)+(sizeof(BYTE)*totalBytes)); - break; - } - case FIR::kFmt: - { - auto count = report->firCount(); + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed REMB payload specific feedback message", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(report->fci())) + ); + } + return false; + } - for (size_t index = 0; index < count; ++index) - { - auto item = report->firAtIndex(index); - RTPUtils::setBE32(&(pos[0]), item->ssrc()); - RTPUtils::setBE32(&(pos[4]), item->reserved()); - pos[4] = item->seqNr(); - advancePos(pos, remaining, sizeof(DWORD)*2); - } - break; - } - case TSTR::kFmt: - { - auto count = report->tstrCount(); + //------------------------------------------------------------------------- + bool RTCPPacket::parseUnknown(PayloadSpecificFeedbackMessage *report) noexcept + { + report->mUnknown = report; + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parseCommonRange( + ZS_MAYBE_USED() XR *xr, + XR::ReportBlockRange *reportBlock + ) noexcept + { + ZS_MAYBE_USED(xr); + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); - for (size_t index = 0; index < count; ++index) - { - auto item = report->tstrAtIndex(index); - RTPUtils::setBE32(&(pos[0]), item->ssrc()); + { + if (remaining < (sizeof(DWORD)*2)) goto illegal_remaining; - DWORD merged = RTCP_PACK_BITS(static_cast(item->seqNr()), 0xFF, 24) | - RTCP_PACK_BITS(static_cast(item->reserved()), 0x7FFFF, 5) | - RTCP_PACK_BITS(static_cast(item->index()), 0x1F, 0); + reportBlock->mSSRCOfSource = UseRTPUtils::getBE32(&(pos[0])); + reportBlock->mBeginSeq = UseRTPUtils::getBE16(&(pos[4])); + reportBlock->mEndSeq = UseRTPUtils::getBE16(&(pos[6])); - RTPUtils::setBE32(&(pos[4]), merged); - advancePos(pos, remaining, sizeof(DWORD)*2); - } - break; - } - case TSTN::kFmt: - { - auto count = report->tstnCount(); + return true; + } - for (size_t index = 0; index < count; ++index) - { - auto item = report->tstnAtIndex(index); - RTPUtils::setBE32(&(pos[0]), item->ssrc()); + illegal_remaining: + { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed report block range", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, (reinterpret_cast(pos) - reinterpret_cast(reportBlock->typeSpecificContents())) + ); + } + return false; + } - DWORD merged = RTCP_PACK_BITS(static_cast(item->seqNr()), 0xFF, 24) | - RTCP_PACK_BITS(static_cast(item->reserved()), 0x7FFFF, 5) | - RTCP_PACK_BITS(static_cast(item->index()), 0x1F, 0); + //------------------------------------------------------------------------- + bool RTCPPacket::parseCommonRLE( + XR *xr, + XR::RLEReportBlock *reportBlock + ) noexcept + { + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); - RTPUtils::setBE32(&(pos[4]), merged); - advancePos(pos, remaining, sizeof(DWORD)*2); - } - break; - } - case VBCM::kFmt: - { - auto count = report->vbcmCount(); + if (!parseCommonRange(xr, reportBlock)) return false; - for (size_t index = 0; index < count; ++index) - { - auto item = report->vbcmAtIndex(index); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - RTPUtils::setBE32(&(pos[0]), item->ssrc()); + size_t possibleRLEsCount = (remaining / sizeof(WORD)); - pos[4] = item->seqNr(); - pos[5] = RTCP_PACK_BITS(static_cast(item->zeroBit()), 0x1, 7) | - RTCP_PACK_BITS(static_cast(item->payloadType()), 0x7F, 0); + if (0 == possibleRLEsCount) return true; - auto size = item->vbcmOctetStringSize(); - if (0 != size) { - RTPUtils::setBE16(&(pos[6]), static_cast(size)); - memcpy(&(pos[8]), item->vbcmOctetString(), size*sizeof(BYTE)); - } + reportBlock->mChunks = new (allocateBuffer(internal::alignedSize(sizeof(XR::RLEChunk)*possibleRLEsCount))) XR::RLEChunk[possibleRLEsCount]; - advancePos(pos, remaining, boundarySize((sizeof(DWORD)*2)+(size*sizeof(BYTE)))); - } - break; - } - case AFB::kFmt: - { + while (remaining >= sizeof(WORD)) + { + XR::RLEChunk value = UseRTPUtils::getBE16(pos); + internal::advancePos(pos, remaining, sizeof(WORD)); - auto remb = report->remb(); - if (NULL == remb) { - auto afb = report->afb(); + if (0 == value) break; + reportBlock->mChunks[reportBlock->mChunkCount] = value; + ++(reportBlock->mChunkCount); + } - size_t size = afb->dataSize(); - if (0 != size) { - memcpy(pos, afb->data(), size*sizeof(BYTE)); - advancePos(pos, remaining, boundarySize(size*sizeof(BYTE))); - } - } else { - memcpy(pos, "REMB", sizeof(DWORD)); + if (0 == reportBlock->mChunkCount) { + reportBlock->mChunks = NULL; + } - DWORD merged = RTCP_PACK_BITS(static_cast(remb->brExp()), 0x3F, 18) | - RTCP_PACK_BITS(static_cast(remb->brMantissa()), 0x3FFFF, 0); - RTPUtils::setBE32(&(pos[4]), merged); - pos[4] = static_cast(remb->numSSRC()); - advancePos(pos, remaining, sizeof(DWORD)*2); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + XR *xr, + XR::LossRLEReportBlock *reportBlock + ) noexcept + { + return parseCommonRLE(xr, reportBlock); + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + XR *xr, + XR::DuplicateRLEReportBlock *reportBlock + ) noexcept + { + return parseCommonRLE(xr, reportBlock); + } - auto count = remb->numSSRC(); - for (size_t index = 0; index < count; ++index) - { - auto ssrc = remb->ssrcAtIndex(index); - RTPUtils::setBE32(pos, ssrc); - advancePos(pos, remaining, sizeof(DWORD)); - } - } - break; - } - default: - { - auto fciSize = report->fciSize(); - if (0 != fciSize) { - memcpy(pos, report->fci(), fciSize); - advancePos(pos, remaining, fciSize); - } - break; - } - } - ZS_LOG_INSANE(packet_slog("writing payload specific feedback message") + ZS_PARAM("fmt", report->fmtToString()) + ZS_PARAM("fmt (number)", report->reportSpecific())) - } + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + XR *xr, + XR::PacketReceiptTimesReportBlock *reportBlock + ) noexcept + { + if (!parseCommonRange(xr, reportBlock)) return false; - //------------------------------------------------------------------------- - static void writePacketXR(const RTCPPacket::XR *report, BYTE * &pos, size_t &remaining) - { - typedef RTCPPacket::XR XR; - typedef RTCPPacket::XR::ReportBlock ReportBlock; - typedef RTCPPacket::XR::LossRLEReportBlock LossRLEReportBlock; - typedef RTCPPacket::XR::DuplicateRLEReportBlock DuplicateRLEReportBlock; - typedef RTCPPacket::XR::PacketReceiptTimesReportBlock PacketReceiptTimesReportBlock; - typedef RTCPPacket::XR::ReceiverReferenceTimeReportBlock ReceiverReferenceTimeReportBlock; - typedef RTCPPacket::XR::DLRRReportBlock DLRRReportBlock; - typedef RTCPPacket::XR::StatisticsSummaryReportBlock StatisticsSummaryReportBlock; - typedef RTCPPacket::XR::VoIPMetricsReportBlock VoIPMetricsReportBlock; - typedef RTCPPacket::XR::UnknownReportBlock UnknownReportBlock; - typedef RTCPPacket::XR::RLEChunk RLEChunk; + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); - pos[1] = XR::kPayloadType; - RTPUtils::setBE32(&(pos[4]), report->mSSRC); + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - advancePos(pos, remaining, sizeof(DWORD)*2); + size_t possibleTimes = remaining / sizeof(DWORD); - for (const ReportBlock *reportBlock = report->firstReportBlock(); NULL != reportBlock; reportBlock = reportBlock->next()) - { - BYTE *blockStart = pos; + if (0 == possibleTimes) return true; - pos[0] = reportBlock->blockType(); - pos[1] = reportBlock->typeSpecific(); + reportBlock->mReceiptTimes = new (allocateBuffer(internal::alignedSize(sizeof(DWORD))*possibleTimes)) DWORD[possibleTimes]; - advancePos(pos, remaining, sizeof(DWORD)); + while (remaining >= sizeof(DWORD)) { + reportBlock->mReceiptTimes[reportBlock->mReceiptTimeCount] = UseRTPUtils::getBE32(pos); + internal::advancePos(pos, remaining, sizeof(DWORD)); + ++(reportBlock->mReceiptTimeCount); + } - switch (reportBlock->mBlockType) { - case LossRLEReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); + return true; + } - RTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); - RTPUtils::setBE16(&(pos[4]), block->beginSeq()); - RTPUtils::setBE16(&(pos[6]), block->endSeq()); + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + ZS_MAYBE_USED() XR *xr, + XR::ReceiverReferenceTimeReportBlock *reportBlock + ) noexcept + { + ZS_MAYBE_USED(xr); + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); + + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed receiver reference time report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - advancePos(pos, remaining, sizeof(DWORD)*2); + reportBlock->mNTPTimestampMS = UseRTPUtils::getBE32(&(pos[0])); + reportBlock->mNTPTimestampLS = UseRTPUtils::getBE32(&(pos[4])); - size_t chunkCount = block->chunkCount(); - for (size_t index = 0; index < chunkCount; ++index) - { - RLEChunk chunk = block->chunkAtIndex(index); - RTPUtils::setBE16(pos, chunk); - advancePos(pos, remaining, sizeof(WORD)); - } - break; - } - case DuplicateRLEReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + ZS_MAYBE_USED() XR *xr, + XR::DLRRReportBlock *reportBlock + ) noexcept + { + ZS_MAYBE_USED(xr); + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); - RTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); - RTPUtils::setBE16(&(pos[4]), block->beginSeq()); - RTPUtils::setBE16(&(pos[6]), block->endSeq()); + size_t possibleSubBlockCount = remaining / (sizeof(DWORD)*3); - advancePos(pos, remaining, sizeof(DWORD)*2); + if (0 == possibleSubBlockCount) return true; - size_t count = block->chunkCount(); - for (size_t index = 0; index < count; ++index) - { - RLEChunk chunk = block->chunkAtIndex(index); - RTPUtils::setBE16(pos, chunk); - advancePos(pos, remaining, sizeof(WORD)); - } - break; - } - case PacketReceiptTimesReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); + if (remaining < (sizeof(DWORD)*2)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed dlr report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - RTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); - RTPUtils::setBE16(&(pos[4]), block->beginSeq()); - RTPUtils::setBE16(&(pos[6]), block->endSeq()); + reportBlock->mSubBlocks = new (allocateBuffer(internal::alignedSize(sizeof(XR::DLRRReportBlock::SubBlock))*possibleSubBlockCount)) XR::DLRRReportBlock::SubBlock[possibleSubBlockCount]; - advancePos(pos, remaining, sizeof(DWORD)*2); + while (remaining >= (sizeof(DWORD)*3)) + { + auto subBlock = &(reportBlock->mSubBlocks[reportBlock->mSubBlockCount]); - size_t count = block->receiptTimeCount(); - for (size_t index = 0; index < count; ++index) - { - DWORD receiptTime = block->receiptTimeAtIndex(index); - RTPUtils::setBE32(pos, receiptTime); - advancePos(pos, remaining, sizeof(DWORD)); - } - break; - } - case ReceiverReferenceTimeReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - RTPUtils::setBE32(&(pos[0]), block->ntpTimestampMS()); - RTPUtils::setBE32(&(pos[4]), block->ntpTimestampLS()); - advancePos(pos, remaining, sizeof(DWORD)*2); - break; - } - case DLRRReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); + subBlock->mSSRC = UseRTPUtils::getBE32(&(pos[0])); + subBlock->mLRR = UseRTPUtils::getBE32(&(pos[4])); + subBlock->mDLRR = UseRTPUtils::getBE32(&(pos[8])); - size_t count = block->subBlockCount(); - for (size_t index = 0; index < count; ++index) - { - DLRRReportBlock::SubBlock *subBlock = block->subBlockAtIndex(index); - RTPUtils::setBE32(&(pos[0]), subBlock->ssrc()); - RTPUtils::setBE32(&(pos[4]), subBlock->lrr()); - RTPUtils::setBE32(&(pos[8]), subBlock->dlrr()); - advancePos(pos, remaining, sizeof(DWORD)*3); - } - break; - } - case StatisticsSummaryReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - RTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); - RTPUtils::setBE16(&(pos[4]), block->beginSeq()); - RTPUtils::setBE16(&(pos[6]), block->endSeq()); - RTPUtils::setBE32(&(pos[8]), block->lostPackets()); - RTPUtils::setBE32(&(pos[12]), block->dupPackets()); - RTPUtils::setBE32(&(pos[16]), block->minJitter()); - RTPUtils::setBE32(&(pos[20]), block->maxJitter()); - RTPUtils::setBE32(&(pos[24]), block->meanJitter()); - RTPUtils::setBE32(&(pos[28]), block->devJitter()); - pos[32] = block->mMinTTLOrHL; - pos[33] = block->mMaxTTLOrHL; - pos[34] = block->mMeanTTLOrHL; - pos[35] = block->mDevTTLOrHL; - advancePos(pos, remaining, sizeof(DWORD)*9); - break; - } - case VoIPMetricsReportBlock::kBlockType: - { - auto block = reinterpret_cast(reportBlock); - RTPUtils::setBE32(&(pos[0]), block->ssrcOfSource()); - pos[4] = block->lossRate(); - pos[5] = block->discardRate(); - pos[6] = block->burstDensity(); - pos[7] = block->gapDensity(); - RTPUtils::setBE16(&(pos[8]), block->burstDuration()); - RTPUtils::setBE16(&(pos[10]), block->gapDuration()); - RTPUtils::setBE16(&(pos[12]), block->roundTripDelay()); - RTPUtils::setBE16(&(pos[14]), block->endSystemDelay()); - pos[16] = block->signalLevel(); - pos[17] = block->noiseLevel(); - pos[18] = block->rerl(); - pos[19] = block->Gmin(); + internal::advancePos(pos, remaining, sizeof(DWORD)*3); - pos[20] = block->rFactor(); - pos[21] = block->extRFactor(); - pos[22] = block->mosLQ(); - pos[23] = block->mosCQ(); + ++(reportBlock->mSubBlockCount); + } - pos[24] = block->rxConfig(); - pos[25] = block->mReservedVoIP; - RTPUtils::setBE16(&(pos[26]), block->jbNominal()); - RTPUtils::setBE16(&(pos[28]), block->jbMaximum()); - RTPUtils::setBE16(&(pos[30]), block->jbAbsMax()); - advancePos(pos, remaining, sizeof(DWORD)*8); - break; - } - default: - { - auto block = reinterpret_cast(reportBlock); + ZS_ASSERT(reportBlock->mSubBlockCount == possibleSubBlockCount); - auto size = block->typeSpecificContentSize(); - if (0 != size) { - memcpy(pos, block->typeSpecificContents(), size*sizeof(BYTE)); - advancePos(pos, remaining, boundarySize(size*sizeof(BYTE))); - } - } - } + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + XR *xr, + XR::StatisticsSummaryReportBlock *reportBlock + ) noexcept + { + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); + + parseCommonRange(xr, reportBlock); + + if (remaining < (sizeof(DWORD)*9)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed statistics summary report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - BYTE *blockEnd = pos; + internal::advancePos(pos, remaining, sizeof(DWORD)*2); - size_t diff = static_cast(reinterpret_cast(blockEnd) - reinterpret_cast(blockStart)); - auto modulas = diff % sizeof(DWORD); - if (0 != modulas) { - advancePos(pos, remaining, sizeof(DWORD)-modulas); - } + reportBlock->mLostPackets = UseRTPUtils::getBE32(&(pos[0])); + reportBlock->mDupPackets = UseRTPUtils::getBE32(&(pos[4])); + reportBlock->mMinJitter = UseRTPUtils::getBE32(&(pos[8])); + reportBlock->mMaxJitter = UseRTPUtils::getBE32(&(pos[12])); + reportBlock->mMeanJitter = UseRTPUtils::getBE32(&(pos[16])); + reportBlock->mDevJitter = UseRTPUtils::getBE32(&(pos[20])); - diff = boundarySize(diff); - ZS_LOG_INSANE(packet_slog("writing XR block") + ZS_PARAM("block type", reportBlock->blockTypeToString()) + ZS_PARAM("block type (number)", reportBlock->blockType()) + ZS_PARAM("block size", diff)) + reportBlock->mMinTTLOrHL = pos[24]; + reportBlock->mMaxTTLOrHL = pos[25]; + reportBlock->mMeanTTLOrHL = pos[26]; + reportBlock->mDevTTLOrHL = pos[27]; - RTPUtils::setBE16(&(blockStart[2]), static_cast((diff/sizeof(DWORD))-1)); - } + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + ZS_MAYBE_USED() XR *xr, + XR::VoIPMetricsReportBlock *reportBlock + ) noexcept + { + ZS_MAYBE_USED(xr); + const BYTE *pos = reportBlock->typeSpecificContents(); + size_t remaining = reportBlock->typeSpecificContentSize(); + + if (remaining < (sizeof(DWORD)*8)) { + ZS_EVENTING_4(x, w, Trace, RTCPPacketParseWarning, ol, RtcpPacket, Parse, + string, message, "malformed voip metrics report block", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; } - //------------------------------------------------------------------------- - static void writePacketUnknown(const RTCPPacket::UnknownReport *report, BYTE * &pos, size_t &remaining) + reportBlock->mSSRCOfSource = UseRTPUtils::getBE32(&(pos[0])); + reportBlock->mLossRate = pos[4]; + reportBlock->mDiscardRate = pos[5]; + reportBlock->mBurstDensity = pos[6]; + reportBlock->mGapDensity = pos[7]; + reportBlock->mBurstDuration = UseRTPUtils::getBE16(&(pos[8])); + reportBlock->mGapDuration = UseRTPUtils::getBE16(&(pos[10])); + reportBlock->mRoundTripDelay = UseRTPUtils::getBE16(&(pos[12])); + reportBlock->mEndSystemDelay = UseRTPUtils::getBE16(&(pos[14])); + reportBlock->mSignalLevel = pos[16]; + reportBlock->mNoiseLevel = pos[17]; + reportBlock->mRERL = pos[18]; + reportBlock->mGmin = pos[19]; + reportBlock->mRFactor = pos[20]; + reportBlock->mExtRFactor = pos[21]; + reportBlock->mMOSLQ = pos[22]; + reportBlock->mMOSCQ = pos[23]; + reportBlock->mRXConfig = pos[24]; + reportBlock->mReservedVoIP = pos[25]; + reportBlock->mJBNominal = UseRTPUtils::getBE16(&(pos[26])); + reportBlock->mJBMaximum = UseRTPUtils::getBE16(&(pos[28])); + reportBlock->mJBAbsMax = UseRTPUtils::getBE16(&(pos[30])); + + return true; + } + + //------------------------------------------------------------------------- + bool RTCPPacket::parse( + ZS_MAYBE_USED() XR *xr, + ZS_MAYBE_USED() XR::UnknownReportBlock *reportBlock + ) noexcept + { + ZS_MAYBE_USED(xr); + ZS_MAYBE_USED(reportBlock); + return true; + } + + //------------------------------------------------------------------------- + void *RTCPPacket::allocateBuffer(size_t size) noexcept + { + return internal::allocateBuffer(mAllocationPos, mAllocationSize, size); + } + + //------------------------------------------------------------------------- + size_t RTCPPacket::getPacketSize(const Report *first) noexcept(false) + { + size_t result = 0; + + const Report *final = NULL; + + for (const Report *report = first; NULL != report; report = report->next()) { - typedef RTCPPacket::UnknownReport UnknownReport; - pos[1] = report->pt(); + final = report; - advancePos(pos, remaining, sizeof(DWORD)); + size_t beforeSize = result; - auto size = report->size(); - if (0 == size) return; + switch (report->pt()) { + case SenderReport::kPayloadType: + { + const SenderReport *sr = static_cast(report); + result += internal::getPacketSizeSenderReport(sr); + break; + } + case ReceiverReport::kPayloadType: + { + const ReceiverReport *rr = static_cast(report); + result += internal::getPacketSizeReceiverReport(rr); + break; + } + case SDES::kPayloadType: + { + const SDES *sdes = static_cast(report); + result += internal::getPacketSizeSDES(sdes); + break; + } + case Bye::kPayloadType: + { + const Bye *bye = static_cast(report); + result += internal::getPacketSizeBye(bye); + break; + } + case App::kPayloadType: + { + const App *app = static_cast(report); + result += internal::getPacketSizeApp(app); + break; + } + case TransportLayerFeedbackMessage::kPayloadType: + { + const TransportLayerFeedbackMessage *fm = static_cast(report); + result += internal::getPacketSizeTransportLayerFeedbackMessage(fm); + break; + } + case PayloadSpecificFeedbackMessage::kPayloadType: + { + const PayloadSpecificFeedbackMessage *fm = static_cast(report); + result += internal::getPacketSizePayloadSpecificFeedbackMessage(fm); + break; + } + case XR::kPayloadType: + { + const XR *xr = static_cast(report); + result += internal::getPacketSizeXR(xr); + break; + } + default: + { + result += sizeof(DWORD) + internal::boundarySize(report->size()); + break; + } + } - ASSERT(NULL != report->ptr()) + size_t afterSize = result; - memcpy(pos, report->ptr(), size); + ZS_EVENTING_3(x, i, Insane, RTCPPacketGettingReportPacketSize, ol, RtcpPacket, Info, + string, payloadType , report->ptToString(), + byte, payloadTypeNumber, report->pt(), + size_t, size, afterSize - beforeSize + ); + } - advancePos(pos, remaining, size); + if (NULL != final) { + auto padding = final->padding(); + if (0 != padding) { + result += padding; + } } - //------------------------------------------------------------------------- - void RTCPPacket::writePacket(const Report *first, BYTE * &pos, size_t &remaining) - { - ASSERT(sizeof(char) == sizeof(BYTE)) - ASSERT(NULL != first) + return internal::boundarySize(result); + } - for (const Report *report = first; NULL != report; report = report->next()) - { - BYTE *startOfReport = pos; + //------------------------------------------------------------------------- + void RTCPPacket::writePacket(const Report *first, BYTE * &pos, size_t &remaining) noexcept + { + ZS_ASSERT(sizeof(char) == sizeof(BYTE)); + ZS_ASSERT(NULL != first); - writePacketHeader(report, pos, remaining); + for (const Report *report = first; NULL != report; report = report->next()) + { + BYTE *startOfReport = pos; - switch (report->pt()) { - case SenderReport::kPayloadType: - { - const SenderReport *sr = static_cast(report); - internal::writePacketSenderReport(sr, pos, remaining); - break; - } - case ReceiverReport::kPayloadType: - { - const ReceiverReport *rr = static_cast(report); - internal::writePacketReceiverReport(rr, pos, remaining); - break; - } - case SDES::kPayloadType: - { - const SDES *sdes = static_cast(report); - internal::writePacketSDES(sdes, pos, remaining); - break; - } - case Bye::kPayloadType: - { - const Bye *bye = static_cast(report); - internal::writePacketBye(bye, pos, remaining); - break; - } - case App::kPayloadType: - { - const App *app = static_cast(report); - internal::writePacketApp(app, pos, remaining); - break; - } - case TransportLayerFeedbackMessage::kPayloadType: - { - const TransportLayerFeedbackMessage *fm = static_cast(report); - internal::writePacketTransportLayerFeedbackMessage(fm, pos, remaining); - break; - } - case PayloadSpecificFeedbackMessage::kPayloadType: - { - const PayloadSpecificFeedbackMessage *fm = static_cast(report); - internal::writePacketPayloadSpecificFeedbackMessage(fm, pos, remaining); - break; - } - case XR::kPayloadType: - { - const XR *xr = static_cast(report); - internal::writePacketXR(xr, pos, remaining); - break; - } - default: - { - const UnknownReport *unknown = static_cast(report); - internal::writePacketUnknown(unknown, pos, remaining); - break; - } + internal::writePacketHeader(report, pos, remaining); + + switch (report->pt()) { + case SenderReport::kPayloadType: + { + const SenderReport *sr = static_cast(report); + internal::writePacketSenderReport(sr, pos, remaining); + break; + } + case ReceiverReport::kPayloadType: + { + const ReceiverReport *rr = static_cast(report); + internal::writePacketReceiverReport(rr, pos, remaining); + break; + } + case SDES::kPayloadType: + { + const SDES *sdes = static_cast(report); + internal::writePacketSDES(sdes, pos, remaining); + break; } + case Bye::kPayloadType: + { + const Bye *bye = static_cast(report); + internal::writePacketBye(bye, pos, remaining); + break; + } + case App::kPayloadType: + { + const App *app = static_cast(report); + internal::writePacketApp(app, pos, remaining); + break; + } + case TransportLayerFeedbackMessage::kPayloadType: + { + const TransportLayerFeedbackMessage *fm = static_cast(report); + internal::writePacketTransportLayerFeedbackMessage(fm, pos, remaining); + break; + } + case PayloadSpecificFeedbackMessage::kPayloadType: + { + const PayloadSpecificFeedbackMessage *fm = static_cast(report); + internal::writePacketPayloadSpecificFeedbackMessage(fm, pos, remaining); + break; + } + case XR::kPayloadType: + { + const XR *xr = static_cast(report); + internal::writePacketXR(xr, pos, remaining); + break; + } + default: + { + const UnknownReport *unknown = static_cast(report); + internal::writePacketUnknown(unknown, pos, remaining); + break; + } + } - BYTE *endOfReport = pos; - size_t diff = static_cast(reinterpret_cast(endOfReport) - reinterpret_cast(startOfReport)); + BYTE *endOfReport = pos; + size_t diff = static_cast(reinterpret_cast(endOfReport) - reinterpret_cast(startOfReport)); - size_t modulas = diff % sizeof(DWORD); - if (0 != modulas) { - advancePos(pos, remaining, sizeof(DWORD)-modulas); - diff += (sizeof(DWORD)-modulas); - } + size_t modulas = diff % sizeof(DWORD); + if (0 != modulas) { + internal::advancePos(pos, remaining, sizeof(DWORD)-modulas); + diff += (sizeof(DWORD)-modulas); + } - if (ZS_IS_LOGGING(Insane)) { - ZS_LOG_TRACE(slog("writing report") + ZS_PARAM("pt", report->ptToString()) + ZS_PARAM("pt (number)", report->pt()) + ZS_PARAM("size", diff)) - } + ZS_EVENTING_3(x, i, Insane, RTCPPacketWriteReport, ol, RtcpPacket, Info, + string, payloadType, report->ptToString(), + byte, payloadTypeNumber, report->pt(), + size_t, size, diff + ); - size_t padding = 0; + size_t padding = 0; - if (NULL == report->next()) { - padding = boundarySize(static_cast(report->padding())); - if (0 != padding) { - if (padding > 1) { - advancePos(pos, remaining, (padding-1)*sizeof(BYTE)); - } - pos[0] = static_cast(padding); - advancePos(pos, remaining); + if (NULL == report->next()) { + padding = internal::boundarySize(static_cast(report->padding())); + if (0 != padding) { + if (padding > 1) { + internal::advancePos(pos, remaining, (padding-1)*sizeof(BYTE)); } + pos[0] = static_cast(padding); + internal::advancePos(pos, remaining); } - - size_t headerSize = ((diff+padding)/sizeof(DWORD))-1; - ASSERT(throwIfGreaterThanBitsAllow(headerSize, 16)) - - RTPUtils::setBE16(&(startOfReport[2]), static_cast(headerSize)); } - ASSERT(0 == remaining) + size_t headerSize = ((diff+padding)/sizeof(DWORD))-1; + ZS_ASSERT(internal::throwIfGreaterThanBitsAllow(headerSize, 16)); + + UseRTPUtils::setBE16(&(startOfReport[2]), static_cast(headerSize)); } + ZS_ASSERT(0 == remaining); } } diff --git a/ortc/cpp/ortc_RTPSenderChannelMediaBase.cpp b/ortc/cpp/ortc_RTP.cpp similarity index 50% rename from ortc/cpp/ortc_RTPSenderChannelMediaBase.cpp rename to ortc/cpp/ortc_RTP.cpp index 53f16a86..4417220c 100644 --- a/ortc/cpp/ortc_RTPSenderChannelMediaBase.cpp +++ b/ortc/cpp/ortc_RTP.cpp @@ -29,103 +29,56 @@ */ -#include -#include -#include -#include -#include -#include -#include +#include +#include #include -//#include -//#include -//#include -// -//#include -//#include -//#include -// -//#include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpsender) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } namespace ortc { -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::ISettings, UseSettings) -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper) -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP) -// -// typedef ortc::services::Hasher SHA1Hasher; - namespace internal { //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // IRTP + // //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPSenderChannelMediaBaseForRTPSenderChannel::toDebug(ForRTPSenderChannelPtr object) + const char *IRTP::toString(States state) noexcept { - if (!object) return ElementPtr(); - - { - auto pThis = RTPSenderChannelAudio::convert(object); - if (pThis) return pThis->toDebug(); + switch (state) { + case State_Pending: return "pending"; + case State_Ready: return "ready"; + case State_ShuttingDown: return "shutting down"; + case State_Shutdown: return "shutdown"; } - { - auto pThis = RTPSenderChannelVideo::convert(object); - if (pThis) return pThis->toDebug(); + return "UNDEFINED"; + } + //------------------------------------------------------------------------- + IRTP::States IRTP::toState(const char *stateStr) noexcept(false) + { + String str(stateStr); + for (IRTP::States index = IRTP::State_First; index <= IRTP::State_Last; index = static_cast(static_cast::type>(index) + 1)) { + if (0 == str.compareNoCase(IRTP::toString(index))) return index; } - return ElementPtr(); + ORTC_THROW_INVALID_PARAMETERS("Invalid parameter value: " + str) + return IRTP::State_First; } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelMediaBaseForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPSenderChannelMediaBaseForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) - { - if (!object) return ElementPtr(); - - { - auto pThis = RTPSenderChannelAudio::convert(object); - if (pThis) return pThis->toDebug(); - } - { - auto pThis = RTPSenderChannelVideo::convert(object); - if (pThis) return pThis->toDebug(); - } - - return ElementPtr(); - } + // + // IRTPForMediaEngine + // - } // internal namespace + } // namespace internal } diff --git a/ortc/cpp/ortc_RTPDecoderAudio.cpp b/ortc/cpp/ortc_RTPDecoderAudio.cpp new file mode 100644 index 00000000..075e07bf --- /dev/null +++ b/ortc/cpp/ortc_RTPDecoderAudio.cpp @@ -0,0 +1,606 @@ +/* + + Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(RTPDecoderAudioSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudioSettingsDefaults + // + + class RTPDecoderAudioSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~RTPDecoderAudioSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static RTPDecoderAudioSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static RTPDecoderAudioSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installRTPDecoderAudioSettingsDefaults() noexcept + { + RTPDecoderAudioSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderAudioForMediaEngine + // + + //------------------------------------------------------------------------- + IRTPDecoderAudio::PromiseWithRTPDecoderAudioPtr IRTPDecoderAudio::create( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderAudio, UseEngine); + return UseEngine::createRTPDecoderAudio(parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoderAudio + // + + //------------------------------------------------------------------------- + IRTPDecoderAudioForMediaEngine::ForMediaEnginePtr IRTPDecoderAudioForMediaEngine::create( + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + return internal::IRTPDecoderAudioFactory::singleton().create(promise, mediaEngine, parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + RTPDecoderAudio::RTPDecoderAudio( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + promise_(promise), + parameters_(parameters), + notifyDelegate_(delegate_), + delegate_(IRTPDecoderDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_1(x, i, Detail, RTPDecoderAudioCreate, ol, MediaEngine, Start, puid, id, id_); + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::init() noexcept + { + asyncThisDelegate_ = IRTPDecoderAysncDelegateProxy::createWeak(thisWeak_.lock()); + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + RTPDecoderAudio::~RTPDecoderAudio() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, RTPDecoderAudioDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + RTPDecoderAudioPtr RTPDecoderAudio::create( + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueRTP(), promise, mediaEngine, parameters, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + RTPDecoderAudioPtr RTPDecoderAudio::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(RTPDecoderAudio, object); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTP + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::cancel() noexcept + { + ZS_EVENTING_1(x, i, Debug, RTPDecoderAudioCancel, ol, MediaEngine, Cancel, puid, id, id_); + + AutoRecursiveLock lock(*this); + innerCancel(); + } + + //------------------------------------------------------------------------- + RTPDecoderAudio::States RTPDecoderAudio::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoder + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::notifyRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept + { + try { + asyncThisDelegate_->onRTPDecoderRTPPacket(trace, packet); + } catch (const IRTPDecoderAysncDelegateProxy::Exceptions::DelegateGone &) { + // should never happen + } + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::notifyRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept + { + try { + asyncThisDelegate_->onRTPDecoderRTCPPacket(trace, packet); + } catch (const IRTPDecoderAysncDelegateProxy::Exceptions::DelegateGone &) { + // should never happen + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderAudio + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPForMediaEngine + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, RTPDecoderAudioShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderAudioForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IWakeDelegate + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::onWake() + { + ZS_EVENTING_1(x, i, Trace, RTPDecoderAudioOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, RTPDecoderAudioOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderAysncDelegate + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::onRTPDecoderRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) + { +#pragma ZS_BUILD_NOTE("TODO","Implement onRTPDecoderRTPPacket") + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::onRTPDecoderRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) + { +#pragma ZS_BUILD_NOTE("TODO","Implement onRTPDecoderRTCPPacket") + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio => (internal) + // + + //------------------------------------------------------------------------- + void RTPDecoderAudio::innerCancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IRTP::State_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, RTPDecoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingPromise()) return; + if (!stepShutdownCoder()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IRTP::State_Shutdown); + + stepShutdownPendingPromise(); + stepShutdownCoder(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyRTPShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool RTPDecoderAudio::stepShutdownPendingPromise() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Debug, RTPDecoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no pending promise"); + return true; + } + + ZS_EVENTING_2(x, i, Debug, RTPDecoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending promise"); + + promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + bool RTPDecoderAudio::stepShutdownCoder() noexcept + { + ZS_EVENTING_2(x, i, Debug, RTPDecoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "coder"); + +#pragma ZS_BUILD_NOTE("TODO","stepShutdownCoder") + + return true; + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, RTPDecoderAudioStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, RTPDecoderAudioStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepSetup()) goto not_ready; + if (!stepResolve()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, RTPDecoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, RTPDecoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IRTP::State_Ready); + return; + } + } + + //------------------------------------------------------------------------- + bool RTPDecoderAudio::stepSetup() noexcept + { + return true; + } + + //------------------------------------------------------------------------- + bool RTPDecoderAudio::stepResolve() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Trace, RTPDecoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "promise already resolved"); + return true; + } + + ZS_EVENTING_2(x, i, Trace, RTPDecoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "resolving promise"); + + promise_->resolve(thisWeak_.lock()); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, RTPDecoderAudioSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IRTP::toString(state), string, oldState, IRTP::toString(currentState_)); + + currentState_ = state; + + auto pThis = thisWeak_.lock(); + + if ((delegate_) && + (pThis)) { + try { + delegate_->onRTPDecoderStateChanged(thisWeak_.lock(), state); + } catch (IRTPDecoderDelegateProxy::Exceptions::DelegateGone &) { + } + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, RTPDecoderAudioSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, RTPDecoderAudioSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + void RTPDecoderAudio::innerNotifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept + { + IRTPDecoderDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + + delegate->notifyRTPDecoderAudioFrame(traceHelper_.trace(trace), frame); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderAudioFactory + // + + //------------------------------------------------------------------------- + IRTPDecoderAudioFactory &IRTPDecoderAudioFactory::singleton() noexcept + { + return RTPDecoderAudioFactory::singleton(); + } + + //------------------------------------------------------------------------- + RTPDecoderAudioPtr IRTPDecoderAudioFactory::create( + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::RTPDecoderAudio::create(promise, mediaEngine, parameters, delegate); + } + + } // internal namespace +} + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif //__GNUC__ diff --git a/ortc/cpp/ortc_RTPDecoderVideo.cpp b/ortc/cpp/ortc_RTPDecoderVideo.cpp new file mode 100644 index 00000000..70c9a9de --- /dev/null +++ b/ortc/cpp/ortc_RTPDecoderVideo.cpp @@ -0,0 +1,606 @@ +/* + + Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(RTPDecoderVideoSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideoSettingsDefaults + // + + class RTPDecoderVideoSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~RTPDecoderVideoSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static RTPDecoderVideoSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static RTPDecoderVideoSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installRTPDecoderVideoSettingsDefaults() noexcept + { + RTPDecoderVideoSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderVideoForMediaEngine + // + + //------------------------------------------------------------------------- + IRTPDecoderVideo::PromiseWithRTPDecoderVideoPtr IRTPDecoderVideo::create( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderVideo, UseEngine); + return UseEngine::createRTPDecoderVideo(parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoderVideo + // + + //------------------------------------------------------------------------- + IRTPDecoderVideoForMediaEngine::ForMediaEnginePtr IRTPDecoderVideoForMediaEngine::create( + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + return internal::IRTPDecoderVideoFactory::singleton().create(promise, mediaEngine, parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + RTPDecoderVideo::RTPDecoderVideo( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + promise_(promise), + parameters_(parameters), + notifyDelegate_(delegate_), + delegate_(IRTPDecoderDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_1(x, i, Detail, RTPDecoderVideoCreate, ol, MediaEngine, Start, puid, id, id_); + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::init() noexcept + { + asyncThisDelegate_ = IRTPDecoderAysncDelegateProxy::createWeak(thisWeak_.lock()); + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + RTPDecoderVideo::~RTPDecoderVideo() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, RTPDecoderVideoDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + RTPDecoderVideoPtr RTPDecoderVideo::create( + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueRTP(), promise, mediaEngine, parameters, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + RTPDecoderVideoPtr RTPDecoderVideo::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(RTPDecoderVideo, object); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTP + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::cancel() noexcept + { + ZS_EVENTING_1(x, i, Debug, RTPDecoderVideoCancel, ol, MediaEngine, Cancel, puid, id, id_); + + AutoRecursiveLock lock(*this); + innerCancel(); + } + + //------------------------------------------------------------------------- + RTPDecoderVideo::States RTPDecoderVideo::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoder + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::notifyRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept + { + try { + asyncThisDelegate_->onRTPDecoderRTPPacket(trace, packet); + } catch (const IRTPDecoderAysncDelegateProxy::Exceptions::DelegateGone &) { + // should never happen + } + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::notifyRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept + { + try { + asyncThisDelegate_->onRTPDecoderRTCPPacket(trace, packet); + } catch (const IRTPDecoderAysncDelegateProxy::Exceptions::DelegateGone &) { + // should never happen + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderVideo + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPForMediaEngine + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, RTPDecoderVideoShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderVideoForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IWakeDelegate + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::onWake() + { + ZS_EVENTING_1(x, i, Trace, RTPDecoderVideoOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, RTPDecoderVideoOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderAysncDelegate + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::onRTPDecoderRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) + { +#pragma ZS_BUILD_NOTE("TODO","implement onRTPDecoderRTPPacket") + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::onRTPDecoderRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) + { +#pragma ZS_BUILD_NOTE("TODO","implement onRTPDecoderRTCPPacket") + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo => (internal) + // + + //------------------------------------------------------------------------- + void RTPDecoderVideo::innerCancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IRTP::State_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, RTPDecoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingPromise()) return; + if (!stepShutdownCoder()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IRTP::State_Shutdown); + + stepShutdownPendingPromise(); + stepShutdownCoder(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyRTPShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool RTPDecoderVideo::stepShutdownPendingPromise() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Debug, RTPDecoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no pending promise"); + return true; + } + + ZS_EVENTING_2(x, i, Debug, RTPDecoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending promise"); + + promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + bool RTPDecoderVideo::stepShutdownCoder() noexcept + { + ZS_EVENTING_2(x, i, Debug, RTPDecoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "coder"); + +#pragma ZS_BUILD_NOTE("TODO","Implement stepShutdownCoder") + + return true; + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, RTPDecoderVideoStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, RTPDecoderVideoStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepSetup()) goto not_ready; + if (!stepResolve()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, RTPDecoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, RTPDecoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IRTP::State_Ready); + return; + } + } + + //------------------------------------------------------------------------- + bool RTPDecoderVideo::stepSetup() noexcept + { + return true; + } + + //------------------------------------------------------------------------- + bool RTPDecoderVideo::stepResolve() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Trace, RTPDecoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "promise already resolved"); + return true; + } + + ZS_EVENTING_2(x, i, Trace, RTPDecoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "resolving promise"); + + promise_->resolve(thisWeak_.lock()); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, RTPDecoderVideoSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IRTP::toString(state), string, oldState, IRTP::toString(currentState_)); + + currentState_ = state; + + auto pThis = thisWeak_.lock(); + + if ((delegate_) && + (pThis)) { + try { + delegate_->onRTPDecoderStateChanged(thisWeak_.lock(), state); + } catch (IRTPDecoderDelegateProxy::Exceptions::DelegateGone &) { + } + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, RTPDecoderVideoSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, RTPDecoderVideoSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + void RTPDecoderVideo::innerNotifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept + { + IRTPDecoderDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + + delegate->notifyRTPDecoderVideoFrame(traceHelper_.trace(trace), frame); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderVideoFactory + // + + //------------------------------------------------------------------------- + IRTPDecoderVideoFactory &IRTPDecoderVideoFactory::singleton() noexcept + { + return RTPDecoderVideoFactory::singleton(); + } + + //------------------------------------------------------------------------- + RTPDecoderVideoPtr IRTPDecoderVideoFactory::create( + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::RTPDecoderVideo::create(promise, mediaEngine, parameters, delegate); + } + + } // internal namespace +} + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif //__GNUC__ diff --git a/ortc/cpp/ortc_RTPEncoderAudio.cpp b/ortc/cpp/ortc_RTPEncoderAudio.cpp new file mode 100644 index 00000000..a3fdbc1a --- /dev/null +++ b/ortc/cpp/ortc_RTPEncoderAudio.cpp @@ -0,0 +1,602 @@ +/* + + Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(RTPEncoderAudioSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudioSettingsDefaults + // + + class RTPEncoderAudioSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~RTPEncoderAudioSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static RTPEncoderAudioSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static RTPEncoderAudioSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installRTPEncoderAudioSettingsDefaults() noexcept + { + RTPEncoderAudioSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderAudioForMediaEngine + // + + //------------------------------------------------------------------------- + IRTPEncoderAudio::PromiseWithRTPEncoderAudioPtr IRTPEncoderAudio::create( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderAudio, UseEngine); + return UseEngine::createRTPEncoderAudio(parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoderAudio + // + + //------------------------------------------------------------------------- + IRTPEncoderAudioForMediaEngine::ForMediaEnginePtr IRTPEncoderAudioForMediaEngine::create( + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + return internal::IRTPEncoderAudioFactory::singleton().create(promise, mediaEngine, parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + RTPEncoderAudio::RTPEncoderAudio( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + promise_(promise), + parameters_(parameters), + notifyDelegate_(delegate_), + delegate_(IRTPEncoderDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_1(x, i, Detail, RTPEncoderAudioCreate, ol, MediaEngine, Start, puid, id, id_); + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::init() noexcept + { + asyncThisDelegate_ = IRTPEncoderAysncDelegateProxy::createWeak(thisWeak_.lock()); + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + RTPEncoderAudio::~RTPEncoderAudio() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, RTPEncoderAudioDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + RTPEncoderAudioPtr RTPEncoderAudio::create( + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueRTP(), promise, mediaEngine, parameters, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + RTPEncoderAudioPtr RTPEncoderAudio::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(RTPEncoderAudio, object); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTP + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::cancel() noexcept + { + ZS_EVENTING_1(x, i, Debug, RTPEncoderAudioCancel, ol, MediaEngine, Cancel, puid, id, id_); + + AutoRecursiveLock lock(*this); + innerCancel(); + } + + //------------------------------------------------------------------------- + RTPEncoderAudio::States RTPEncoderAudio::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoder + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept + { + try { + asyncThisDelegate_->onRTPEncoderAudioFrame(trace, frame); + } catch (const IRTPEncoderAysncDelegateProxy::Exceptions::DelegateGone &) { + // should never happen + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderAudio + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPForMediaEngine + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, RTPEncoderAudioShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderAudioForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IWakeDelegate + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::onWake() + { + ZS_EVENTING_1(x, i, Trace, RTPEncoderAudioOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, RTPEncoderAudioOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderAysncDelegate + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::onRTPEncoderAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) + { +#pragma ZS_BUILD_NOTE("TODO","Implement onRTPEncoderAudioFrame") + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio => (internal) + // + + //------------------------------------------------------------------------- + void RTPEncoderAudio::innerCancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IRTP::State_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, RTPEncoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingPromise()) return; + if (!stepShutdownCoder()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IRTP::State_Shutdown); + + stepShutdownPendingPromise(); + stepShutdownCoder(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyRTPShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool RTPEncoderAudio::stepShutdownPendingPromise() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Debug, RTPEncoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no pending promise"); + return true; + } + + ZS_EVENTING_2(x, i, Debug, RTPEncoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending promise"); + + promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + bool RTPEncoderAudio::stepShutdownCoder() noexcept + { + ZS_EVENTING_2(x, i, Debug, RTPEncoderAudioShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "coder"); + +#pragma ZS_BUILD_NOTE("TODO","Implement stepShutdownCoder") + + return true; + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, RTPEncoderAudioStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, RTPEncoderAudioStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepSetup()) goto not_ready; + if (!stepResolve()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, RTPEncoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, RTPEncoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IRTP::State_Ready); + return; + } + } + + //------------------------------------------------------------------------- + bool RTPEncoderAudio::stepSetup() noexcept + { + return true; + } + + //------------------------------------------------------------------------- + bool RTPEncoderAudio::stepResolve() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Trace, RTPEncoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "promise already resolved"); + return true; + } + + ZS_EVENTING_2(x, i, Trace, RTPEncoderAudioStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "resolving promise"); + + promise_->resolve(thisWeak_.lock()); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, RTPEncoderAudioSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IRTP::toString(state), string, oldState, IRTP::toString(currentState_)); + + currentState_ = state; + + auto pThis = thisWeak_.lock(); + + if ((delegate_) && + (pThis)) { + try { + delegate_->onRTPEncoderStateChanged(thisWeak_.lock(), state); + } catch (IRTPEncoderDelegateProxy::Exceptions::DelegateGone &) { + } + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, RTPEncoderAudioSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, RTPEncoderAudioSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::innerNotifyRTP( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept + { + IRTPEncoderDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + + delegate->notifyRTPEncoderRTPPacket(traceHelper_.trace(trace), packet); + } + + //------------------------------------------------------------------------- + void RTPEncoderAudio::innerNotifyRTCP( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept + { + IRTPEncoderDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + + delegate->notifyRTPEncoderRTCPPacket(traceHelper_.trace(trace), packet); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderAudioFactory + // + + //------------------------------------------------------------------------- + IRTPEncoderAudioFactory &IRTPEncoderAudioFactory::singleton() noexcept + { + return RTPEncoderAudioFactory::singleton(); + } + + //------------------------------------------------------------------------- + RTPEncoderAudioPtr IRTPEncoderAudioFactory::create( + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::RTPEncoderAudio::create(promise, mediaEngine, parameters, delegate); + } + + } // internal namespace +} + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif //__GNUC__ diff --git a/ortc/cpp/ortc_RTPEncoderVideo.cpp b/ortc/cpp/ortc_RTPEncoderVideo.cpp new file mode 100644 index 00000000..9b0db912 --- /dev/null +++ b/ortc/cpp/ortc_RTPEncoderVideo.cpp @@ -0,0 +1,602 @@ +/* + + Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + + +#ifdef __GNUC__ +#error MOVE THIS TO PROJECT SETTING RATHER THAN PUTTING ON INDIVIDUAL FILES +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#endif //__GNUC__ + +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_media_engine) } + +namespace ortc +{ + ZS_DECLARE_USING_PTR(zsLib, ISettings); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + + namespace internal + { + ZS_DECLARE_CLASS_PTR(RTPEncoderVideoSettingsDefaults); + ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideoSettingsDefaults + // + + class RTPEncoderVideoSettingsDefaults : public ISettingsApplyDefaultsDelegate + { + public: + //----------------------------------------------------------------------- + ~RTPEncoderVideoSettingsDefaults() noexcept + { + ISettings::removeDefaults(*this); + } + + //----------------------------------------------------------------------- + static RTPEncoderVideoSettingsDefaultsPtr singleton() noexcept + { + static SingletonLazySharedPtr singleton(create()); + return singleton.singleton(); + } + + //----------------------------------------------------------------------- + static RTPEncoderVideoSettingsDefaultsPtr create() noexcept + { + auto pThis(make_shared()); + ISettings::installDefaults(pThis); + return pThis; + } + + //----------------------------------------------------------------------- + virtual void notifySettingsApplyDefaults() noexcept override + { + } + + }; + + //------------------------------------------------------------------------- + void installRTPEncoderVideoSettingsDefaults() noexcept + { + RTPEncoderVideoSettingsDefaults::singleton(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderVideoForMediaEngine + // + + //------------------------------------------------------------------------- + IRTPEncoderVideo::PromiseWithRTPEncoderVideoPtr IRTPEncoderVideo::create( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderVideo, UseEngine); + return UseEngine::createRTPEncoderVideo(parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoderVideo + // + + //------------------------------------------------------------------------- + IRTPEncoderVideoForMediaEngine::ForMediaEnginePtr IRTPEncoderVideoForMediaEngine::create( + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + return internal::IRTPEncoderVideoFactory::singleton().create(promise, mediaEngine, parameters, delegate); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + //------------------------------------------------------------------------- + RTPEncoderVideo::RTPEncoderVideo( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept : + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + mediaEngine_(mediaEngine), + promise_(promise), + parameters_(parameters), + notifyDelegate_(delegate_), + delegate_(IRTPEncoderDelegateProxy::createWeak(delegate)), + traceHelper_(id_) + { + ZS_EVENTING_1(x, i, Detail, RTPEncoderVideoCreate, ol, MediaEngine, Start, puid, id, id_); + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::init() noexcept + { + asyncThisDelegate_ = IRTPEncoderAysncDelegateProxy::createWeak(thisWeak_.lock()); + AutoRecursiveLock lock(*this); + IWakeDelegateProxy::create(thisWeak_.lock())->onWake(); + } + + //------------------------------------------------------------------------- + RTPEncoderVideo::~RTPEncoderVideo() noexcept + { + if (isNoop()) return; + + thisWeak_.reset(); + + cancel(); + ZS_EVENTING_1(x, i, Detail, RTPEncoderVideoDestroy, ol, MediaEngine, Stop, puid, id, id_); + } + + //----------------------------------------------------------------------- + RTPEncoderVideoPtr RTPEncoderVideo::create( + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + auto pThis(make_shared(make_private{}, IORTCForInternal::queueRTP(), promise, mediaEngine, parameters, delegate)); + pThis->thisWeak_ = pThis; + pThis->init(); + return pThis; + } + + //------------------------------------------------------------------------- + RTPEncoderVideoPtr RTPEncoderVideo::convert(ForMediaEnginePtr object) noexcept + { + return ZS_DYNAMIC_PTR_CAST(RTPEncoderVideo, object); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTP + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::cancel() noexcept + { + ZS_EVENTING_1(x, i, Debug, RTPEncoderVideoCancel, ol, MediaEngine, Cancel, puid, id, id_); + + AutoRecursiveLock lock(*this); + innerCancel(); + } + + //------------------------------------------------------------------------- + RTPEncoderVideo::States RTPEncoderVideo::getState() const noexcept + { + AutoRecursiveLock lock(*this); + return currentState_; + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoder + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::notifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept + { + try { + asyncThisDelegate_->onRTPEncoderVideoFrame(trace, frame); + } catch (const IRTPEncoderAysncDelegateProxy::Exceptions::DelegateGone &) { + // should never happen + } + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderVideo + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPForMediaEngine + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::shutdown() noexcept + { + ZS_EVENTING_1(x, i, Detail, RTPEncoderVideoShutdown, ol, MediaEngine, Close, puid, id, id_); + + AutoRecursiveLock lock(*this); + cancel(); + } + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderVideoForMediaEngine + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IWakeDelegate + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::onWake() + { + ZS_EVENTING_1(x, i, Trace, RTPEncoderVideoOnWake, ol, MediaEngine, Event, puid, id, id_); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IPromiseSettledDelegate + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::onPromiseSettled(PromisePtr promise) + { + ZS_EVENTING_2(x, i, Trace, RTPEncoderVideoOnPromiseSettled, ol, MediaEngine, Event, puid, id, id_, puid, promiseId, promise->getID()); + + AutoRecursiveLock lock(*this); + step(); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderAysncDelegate + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::onRTPEncoderVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) + { +#pragma ZS_BUILD_NOTE("TODO","Implement onRTPEncoderVideoFrame") + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo => (internal) + // + + //------------------------------------------------------------------------- + void RTPEncoderVideo::innerCancel() noexcept + { + //....................................................................... + // try to gracefully shutdown + + if (isShutdown()) return; + + setState(IRTP::State_ShuttingDown); + + if (!gracefulShutdownReference_) gracefulShutdownReference_ = thisWeak_.lock(); + + if (gracefulShutdownReference_) { + ZS_EVENTING_2(x, i, Debug, RTPEncoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "graceful"); + + // perform any graceful asynchronous shutdown processes needed and + // re-attempt shutdown again later if needed. + + if (!stepShutdownPendingPromise()) return; + if (!stepShutdownCoder()) return; + } + + //....................................................................... + // final cleanup (hard shutdown) + + setState(IRTP::State_Shutdown); + + stepShutdownPendingPromise(); + stepShutdownCoder(); + + auto engine = mediaEngine_.lock(); + if (engine) { + engine->notifyRTPShutdownStateChanged(); + } + + // make sure to cleanup any final reference to self + gracefulShutdownReference_.reset(); + + mediaEngine_.reset(); + } + + //------------------------------------------------------------------------- + bool RTPEncoderVideo::stepShutdownPendingPromise() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Debug, RTPEncoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "no pending promise"); + return true; + } + + ZS_EVENTING_2(x, i, Debug, RTPEncoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "pending promise"); + + promise_->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "media engine is shutting down")); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + bool RTPEncoderVideo::stepShutdownCoder() noexcept + { + ZS_EVENTING_2(x, i, Debug, RTPEncoderVideoShutdownStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "coder"); + +#pragma ZS_BUILD_NOTE("TODO","Implement stepShutdownCoder") + + return true; + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::step() noexcept + { + ZS_EVENTING_1(x, i, Trace, RTPEncoderVideoStep, ol, MediaEngine, Step, puid, id, id_); + + if ((isShuttingDown()) || + (isShutdown())) { + ZS_EVENTING_1(x, i, Trace, RTPEncoderVideoStepForwardCancel, ol, MediaEngine, Step, puid, id, id_); + cancel(); + return; + } + + if (!stepSetup()) goto not_ready; + if (!stepResolve()) goto not_ready; + + goto ready; + + not_ready: + { + ZS_EVENTING_2(x, i, Trace, RTPEncoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "not ready"); + return; + } + + ready: + { + ZS_EVENTING_2(x, i, Trace, RTPEncoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "ready"); + setState(IRTP::State_Ready); + return; + } + } + + //------------------------------------------------------------------------- + bool RTPEncoderVideo::stepSetup() noexcept + { + return true; + } + + //------------------------------------------------------------------------- + bool RTPEncoderVideo::stepResolve() noexcept + { + if (!promise_) { + ZS_EVENTING_2(x, i, Trace, RTPEncoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "promise already resolved"); + return true; + } + + ZS_EVENTING_2(x, i, Trace, RTPEncoderVideoStepMessage, ol, MediaEngine, Step, puid, id, id_, string, message, "resolving promise"); + + promise_->resolve(thisWeak_.lock()); + promise_.reset(); + return true; + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::setState(States state) noexcept + { + if (state == currentState_) return; + + ZS_EVENTING_3(x, i, Detail, RTPEncoderVideoSetState, ol, MediaEngine, StateEvent, puid, id, id_, string, newState, IRTP::toString(state), string, oldState, IRTP::toString(currentState_)); + + currentState_ = state; + + auto pThis = thisWeak_.lock(); + + if ((delegate_) && + (pThis)) { + try { + delegate_->onRTPEncoderStateChanged(thisWeak_.lock(), state); + } catch (IRTPEncoderDelegateProxy::Exceptions::DelegateGone &) { + } + } + +// MediaEnginePtr pThis = mThisWeak.lock(); +// if (pThis) { +// mSubscriptions.delegate()->onMediaEngineStateChanged(pThis, currentState_); +// } + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::setError(PromisePtr promise) noexcept + { + if (!promise) return; + + auto reason = promise->reason(); + if (!reason) return; + + setError(reason->mErrorCode, reason->mReason); + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::setError(WORD errorCode, const char *inReason) noexcept + { + String reason(inReason); + if (reason.isEmpty()) { + reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); + } + + if (0 != lastError_) { + ZS_EVENTING_3(x, e, Detail, RTPEncoderVideoSetErrorIgnored, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + return; + } + + lastError_ = errorCode; + lastErrorReason_ = reason; + + ZS_EVENTING_3(x, e, Detail, RTPEncoderVideoSetError, ol, MediaEngine, ErrorEvent, puid, id, id_, word, error, lastError_, string, reason, lastErrorReason_); + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::innerNotifyRTP( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept + { + IRTPEncoderDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + + delegate->notifyRTPEncoderRTPPacket(traceHelper_.trace(trace), packet); + } + + //------------------------------------------------------------------------- + void RTPEncoderVideo::innerNotifyRTCP( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept + { + IRTPEncoderDelegatePtr delegate; + + { + AutoRecursiveLock lock(*this); + delegate = notifyDelegate_.lock(); + } + + if (!delegate) return; + + delegate->notifyRTPEncoderRTCPPacket(traceHelper_.trace(trace), packet); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderVideoFactory + // + + //------------------------------------------------------------------------- + IRTPEncoderVideoFactory &IRTPEncoderVideoFactory::singleton() noexcept + { + return RTPEncoderVideoFactory::singleton(); + } + + //------------------------------------------------------------------------- + RTPEncoderVideoPtr IRTPEncoderVideoFactory::create( + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept + { + if (this) {} + return internal::RTPEncoderVideo::create(promise, mediaEngine, parameters, delegate); + } + + } // internal namespace +} + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif //__GNUC__ diff --git a/ortc/cpp/ortc_RTPListener.cpp b/ortc/cpp/ortc_RTPListener.cpp index e4fd1e0d..412512d0 100644 --- a/ortc/cpp/ortc_RTPListener.cpp +++ b/ortc/cpp/ortc_RTPListener.cpp @@ -29,12 +29,12 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include #include -#include -#include #include #include #include @@ -42,6 +42,9 @@ #include #include +#include +#include + #include #include @@ -53,14 +56,7 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtplistener) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_listener) } namespace ortc { @@ -77,12 +73,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- - static bool shouldFilter(IRTPTypes::HeaderExtensionURIs extensionURI) + static bool shouldFilter(IRTPTypes::HeaderExtensionURIs extensionURI) noexcept { switch (extensionURI) { case IRTPTypes::HeaderExtensionURI_Unknown: return true; @@ -94,37 +90,39 @@ namespace ortc case IRTPTypes::HeaderExtensionURI_RID: return false; case IRTPTypes::HeaderExtensionURI_3gpp_VideoOrientation: return true; case IRTPTypes::HeaderExtensionURI_3gpp_VideoOrientation6: return true; + case IRTPTypes::HeaderExtensionURI_TransmissionTimeOffsets: return true; + case IRTPTypes::HeaderExtensionURI_AbsoluteSendTime: return true; + case IRTPTypes::HeaderExtensionURI_TransportSequenceNumber: return true; } return true; } - //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerSettingsDefaults - #pragma mark + // + // RTPListenerSettingsDefaults + // class RTPListenerSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~RTPListenerSettingsDefaults() + ~RTPListenerSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static RTPListenerSettingsDefaultsPtr singleton() + static RTPListenerSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static RTPListenerSettingsDefaultsPtr create() + static RTPListenerSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -132,7 +130,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { ISettings::setUInt(ORTC_SETTING_RTP_LISTENER_MAX_RTP_PACKETS_IN_BUFFER, 100); ISettings::setUInt(ORTC_SETTING_RTP_LISTENER_MAX_AGE_RTP_PACKETS_IN_SECONDS, 30); @@ -149,7 +147,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installRTPListenerSettingsDefaults() + void installRTPListenerSettingsDefaults() noexcept { RTPListenerSettingsDefaults::singleton(); } @@ -159,19 +157,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerForSecureTransport - #pragma mark + // + // IRTPListenerForSecureTransport + // //------------------------------------------------------------------------- - ElementPtr IRTPListenerForSecureTransport::toDebug(ForSecureTransportPtr listener) + ElementPtr IRTPListenerForSecureTransport::toDebug(ForSecureTransportPtr listener) noexcept { if (!listener) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPListener, listener)->toDebug(); } //------------------------------------------------------------------------- - RTPListenerPtr IRTPListenerForSecureTransport::create(IRTPTransportPtr transport) + RTPListenerPtr IRTPListenerForSecureTransport::create(IRTPTransportPtr transport) noexcept { return IRTPListenerFactory::singleton().create(transport); } @@ -180,19 +178,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerForRTPReceiver - #pragma mark + // + // IRTPListenerForRTPReceiver + // //------------------------------------------------------------------------- - ElementPtr IRTPListenerForRTPReceiver::toDebug(ForRTPReceiverPtr listener) + ElementPtr IRTPListenerForRTPReceiver::toDebug(ForRTPReceiverPtr listener) noexcept { if (!listener) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPListener, listener)->toDebug(); } //------------------------------------------------------------------------- - IRTPListenerForRTPReceiver::ForRTPReceiverPtr IRTPListenerForRTPReceiver::getListener(IRTPTransportPtr rtpTransport) + IRTPListenerForRTPReceiver::ForRTPReceiverPtr IRTPListenerForRTPReceiver::getListener(IRTPTransportPtr rtpTransport) noexcept(false) { ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPListener, UseSecureTransport) @@ -223,23 +221,23 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerForRTPReceiver - #pragma mark + // + // IRTPListenerForRTPReceiver + // //------------------------------------------------------------------------- - ElementPtr IRTPListenerForRTPSender::toDebug(ForRTPSenderPtr listener) + ElementPtr IRTPListenerForRTPSender::toDebug(ForRTPSenderPtr listener) noexcept { if (!listener) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPListener, listener)->toDebug(); } //------------------------------------------------------------------------- - IRTPListenerForRTPSender::ForRTPSenderPtr IRTPListenerForRTPSender::getListener(IRTPTransportPtr rtpTransport) + IRTPListenerForRTPSender::ForRTPSenderPtr IRTPListenerForRTPSender::getListener(IRTPTransportPtr rtpTransport) noexcept(false) { ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPListener, UseSecureTransport) - ORTC_THROW_INVALID_PARAMETERS_IF(!rtpTransport) + ORTC_THROW_INVALID_PARAMETERS_IF(!rtpTransport); UseSecureTransportPtr secureTransport; @@ -266,12 +264,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::RegisteredHeaderExtension - #pragma mark + // + // RTPListener::RegisteredHeaderExtension + // //--------------------------------------------------------------------------- - ElementPtr RTPListener::RegisteredHeaderExtension::toDebug() const + ElementPtr RTPListener::RegisteredHeaderExtension::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPListener::RegisteredHeaderExtension"); @@ -298,19 +296,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::ReceiverInfo - #pragma mark + // + // RTPListener::ReceiverInfo + // //------------------------------------------------------------------------- - RTPListener::SSRCInfoPtr RTPListener::ReceiverInfo::registerSSRCUsage(SSRCInfoPtr ssrcInfo) + RTPListener::SSRCInfoPtr RTPListener::ReceiverInfo::registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept { mRegisteredSSRCs[ssrcInfo->mSSRC] = ssrcInfo; return ssrcInfo; } //------------------------------------------------------------------------- - void RTPListener::ReceiverInfo::unregisterSSRCUsage(SSRCType ssrc) + void RTPListener::ReceiverInfo::unregisterSSRCUsage(SSRCType ssrc) noexcept { auto found = mRegisteredSSRCs.find(ssrc); if (found == mRegisteredSSRCs.end()) return; @@ -318,7 +316,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr RTPListener::ReceiverInfo::toDebug() const + ElementPtr RTPListener::ReceiverInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPListener::ReceiverInfo"); @@ -337,18 +335,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::SSRCInfo - #pragma mark + // + // RTPListener::SSRCInfo + // //--------------------------------------------------------------------------- - RTPListener::SSRCInfo::SSRCInfo() : + RTPListener::SSRCInfo::SSRCInfo() noexcept : mLastUsage(zsLib::now()) { } //--------------------------------------------------------------------------- - ElementPtr RTPListener::SSRCInfo::toDebug() const + ElementPtr RTPListener::SSRCInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPListener::SSRCInfo"); @@ -364,12 +362,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::UnhandledEventInfo - #pragma mark + // + // RTPListener::UnhandledEventInfo + // //--------------------------------------------------------------------------- - bool RTPListener::UnhandledEventInfo::operator<(const UnhandledEventInfo &op2) const + bool RTPListener::UnhandledEventInfo::operator<(const UnhandledEventInfo &op2) const noexcept { if (mSSRC < op2.mSSRC) return true; if (mSSRC > op2.mSSRC) return false; @@ -385,7 +383,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr RTPListener::UnhandledEventInfo::toDebug() const + ElementPtr RTPListener::UnhandledEventInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPListener::UnhandledEventInfo"); @@ -401,12 +399,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener - #pragma mark + // + // RTPListener + // //--------------------------------------------------------------------------- - const char *RTPListener::toString(States state) + const char *RTPListener::toString(States state) noexcept { switch (state) { case State_Pending: return "pending"; @@ -423,9 +421,10 @@ namespace ortc IMessageQueuePtr queue, IRTPListenerDelegatePtr originalDelegate, UseRTPTransportPtr transport - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mRTPTransport(transport), mMaxBufferedRTPPackets(SafeInt(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_MAX_RTP_PACKETS_IN_BUFFER))), mMaxRTPPacketAge(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_MAX_AGE_RTP_PACKETS_IN_SECONDS)), @@ -433,9 +432,9 @@ namespace ortc mMaxRTCPPacketAge(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_MAX_AGE_RTCP_PACKETS_IN_SECONDS)), mReceivers(make_shared()), mSenders(make_shared()), - mAmbiguousPayloadMappingMinDifference(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_ONLY_RESOLVE_AMBIGUOUS_PAYLOAD_MAPPING_IF_ACTIVITY_DIFFERS_IN_MILLISECONDS)), mSSRCTableExpires(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_SSRC_TIMEOUT_IN_SECONDS)), - mUnhandledEventsExpires(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_UNHANDLED_EVENTS_TIMEOUT_IN_SECONDS)) + mUnhandledEventsExpires(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_UNHANDLED_EVENTS_TIMEOUT_IN_SECONDS)), + mAmbiguousPayloadMappingMinDifference(ISettings::getUInt(ORTC_SETTING_RTP_LISTENER_ONLY_RESOLVE_AMBIGUOUS_PAYLOAD_MAPPING_IF_ACTIVITY_DIFFERS_IN_MILLISECONDS)) { ZS_EVENTING_8( x, i, Detail, RtpListenerCreate, ol, RtpListener, Start, @@ -457,7 +456,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::init() + void RTPListener::init() noexcept { AutoRecursiveLock lock(*this); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); @@ -474,7 +473,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPListener::~RTPListener() + RTPListener::~RTPListener() noexcept { if (isNoop()) return; @@ -486,26 +485,26 @@ namespace ortc } //------------------------------------------------------------------------- - RTPListenerPtr RTPListener::convert(IRTPListenerPtr object) + RTPListenerPtr RTPListener::convert(IRTPListenerPtr object) noexcept { IRTPListenerPtr original = IRTPListenerTearAway::original(object); return ZS_DYNAMIC_PTR_CAST(RTPListener, original); } //------------------------------------------------------------------------- - RTPListenerPtr RTPListener::convert(ForSecureTransportPtr object) + RTPListenerPtr RTPListener::convert(ForSecureTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPListener, object); } //------------------------------------------------------------------------- - RTPListenerPtr RTPListener::convert(ForRTPReceiverPtr object) + RTPListenerPtr RTPListener::convert(ForRTPReceiverPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPListener, object); } //------------------------------------------------------------------------- - RTPListenerPtr RTPListener::convert(ForRTPSenderPtr object) + RTPListenerPtr RTPListener::convert(ForRTPSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPListener, object); } @@ -514,12 +513,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListener - #pragma mark + // + // RTPListener => IRTPListener + // //------------------------------------------------------------------------- - ElementPtr RTPListener::toDebug(RTPListenerPtr transport) + ElementPtr RTPListener::toDebug(RTPListenerPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -530,21 +529,21 @@ namespace ortc IRTPListenerDelegatePtr delegate, IRTPTransportPtr transport, Optional headerExtensions - ) + ) noexcept(false) { ORTC_THROW_INVALID_PARAMETERS_IF(!transport) auto useSecureTransport = UseSecureTransport::convert(transport); - ASSERT(((bool)useSecureTransport)) + ZS_ASSERT(((bool)useSecureTransport)) auto listener = useSecureTransport->getListener(); - ORTC_THROW_INVALID_STATE_IF(!listener) + ZS_ASSERT(listener); auto tearAway = IRTPListenerTearAway::create(listener, make_shared()); - ORTC_THROW_INVALID_STATE_IF(!tearAway) + ZS_ASSERT(tearAway); auto tearAwayData = IRTPListenerTearAway::data(tearAway); - ORTC_THROW_INVALID_STATE_IF(!tearAwayData) + ZS_ASSERT(tearAwayData); tearAwayData->mRTPTransport = transport; @@ -561,7 +560,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPListenerSubscriptionPtr RTPListener::subscribe(IRTPListenerDelegatePtr originalDelegate) + IRTPListenerSubscriptionPtr RTPListener::subscribe(IRTPListenerDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -590,13 +589,13 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPTransportPtr RTPListener::transport() const + IRTPTransportPtr RTPListener::transport() const noexcept { return mRTPTransport.lock(); } //------------------------------------------------------------------------- - void RTPListener::setHeaderExtensions(const HeaderExtensionParametersList &headerExtensions) + void RTPListener::setHeaderExtensions(const HeaderExtensionParametersList &headerExtensions) noexcept(false) { AutoRecursiveLock lock(*this); @@ -620,15 +619,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IStatsProvider - #pragma mark + // + // RTPListener => IStatsProvider + // //------------------------------------------------------------------------- - RTPListener::PromiseWithStatsReportPtr RTPListener::getStats(const StatsTypeSet &stats) const + RTPListener::PromiseWithStatsReportPtr RTPListener::getStats(ZS_MAYBE_USED() const StatsTypeSet &stats) const noexcept { -#define TODO 1 -#define TODO 2 + ZS_MAYBE_USED(stats); +#pragma ZS_BUILD_NOTE("TODO","Implement getStats") return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } @@ -636,12 +635,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerForSecureTransport - #pragma mark + // + // RTPListener => IRTPListenerForSecureTransport + // //------------------------------------------------------------------------- - RTPListenerPtr RTPListener::create(IRTPTransportPtr transport) + RTPListenerPtr RTPListener::create(IRTPTransportPtr transport) noexcept { RTPListenerPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), IRTPListenerDelegatePtr(), transport)); pThis->mThisWeak = pThis; @@ -655,7 +654,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_EVENTING_5( x, i, Trace, RtpListenerReceivedIncomingPacket, ol, RtpListener, Receive, @@ -735,7 +734,7 @@ namespace ortc Time tick = zsLib::now(); - ASSERT(IICETypes::Component_RTP == viaComponent); + ZS_ASSERT(IICETypes::Component_RTP == viaComponent); ZS_EVENTING_5( x, i, Debug, RtpListenerBufferIncomingPacket, ol, RtpListener, Buffer, @@ -781,12 +780,12 @@ namespace ortc { for (auto iter = receivers->begin(); iter != receivers->end(); ++iter) { ReceiverID receiverID = (*iter).first; - auto receiverInfo = (*iter).second; + auto currentReceiverInfo = (*iter).second; auto receiver = (*iter).second->mReceiver.lock(); if (!receiver) { - ZS_LOG_WARNING(Trace, log("receiver is gone") + ZS_PARAM("receiver ID", receiverID) + receiverInfo->toDebug()) + ZS_LOG_WARNING(Trace, log("receiver is gone") + ZS_PARAM("receiver ID", receiverID) + currentReceiverInfo->toDebug()) continue; } @@ -835,9 +834,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerForRTPReceiver - #pragma mark + // + // RTPListener => IRTPListenerForRTPReceiver + // //------------------------------------------------------------------------- void RTPListener::registerReceiver( @@ -845,7 +844,7 @@ namespace ortc UseReceiverPtr inReceiver, const Parameters &inParams, RTCPPacketList *outPacketList - ) + ) noexcept(false) { ZS_LOG_TRACE(log("registering RTP receiver") + ZS_PARAM("receiver", inReceiver->getID()) + inParams.toDebug()) @@ -971,7 +970,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::unregisterReceiver(UseReceiver &inReceiver) + void RTPListener::unregisterReceiver(UseReceiver &inReceiver) noexcept { AutoRecursiveLock lock(*this); @@ -998,7 +997,7 @@ namespace ortc ReceiverObjectMapPtr receivers(make_shared(*mReceivers)); auto found = receivers->find(receiverID); - ASSERT(found != receivers->end()) + ZS_ASSERT(found != receivers->end()) auto receiverInfo = (*found).second; @@ -1059,7 +1058,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::getPackets(RTCPPacketList &outPacketList) + void RTPListener::getPackets(RTCPPacketList &outPacketList) noexcept { AutoRecursiveLock lock(*this); @@ -1078,9 +1077,9 @@ namespace ortc const String &rid, IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType - ) + ) noexcept { - ZS_LOG_TRACE(log("notified that a receiver did not handle a delivered packet") + ZS_PARAM("ssrc", ssrc) + ZS_PARAM("payload", payloadType)) + ZS_LOG_TRACE(log("notified that a receiver did not handle a delivered packet") + ZS_PARAM("ssrc", ssrc) + ZS_PARAM("payload", payloadType)); AutoRecursiveLock lock(*this); processUnhandled(muxID, rid, ssrc, payloadType, zsLib::now()); @@ -1090,19 +1089,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerForRTPSender - #pragma mark + // + // RTPListener => IRTPListenerForRTPSender + // //------------------------------------------------------------------------- void RTPListener::registerSender( UseSenderPtr inSender, const Parameters &inParams, RTCPPacketList &outPacketList - ) + ) noexcept { ZS_EVENTING_2( - x, i, Debug, cRtpListenerRegisterSender, ol, RtpListener, Info, + x, i, Debug, RtpListenerRegisterSender, ol, RtpListener, Info, puid, id, mID, puid, senderId, inSender->getID() ); @@ -1133,7 +1132,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::unregisterSender(UseSender &inSender) + void RTPListener::unregisterSender(UseSender &inSender) noexcept { ZS_EVENTING_2( x, i, Debug, RtpListenerUnregisterSender, ol, RtpListener, Info, @@ -1160,9 +1159,9 @@ namespace ortc SenderObjectMapPtr senders(make_shared(*mSenders)); auto found = senders->find(senderID); - ASSERT(found != senders->end()) + ZS_ASSERT(found != senders->end()) - ZS_LOG_DEBUG(log("unregistering sender") + ZS_PARAM("sender id", senderID)) + ZS_LOG_DEBUG(log("unregistering sender") + ZS_PARAM("sender id", senderID)); senders->erase(found); @@ -1176,9 +1175,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IWakeDelegate - #pragma mark + // + // RTPListener => IWakeDelegate + // //------------------------------------------------------------------------- void RTPListener::onWake() @@ -1195,9 +1194,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => ITimerDelegate - #pragma mark + // + // RTPListener => ITimerDelegate + // //------------------------------------------------------------------------- void RTPListener::onTimer(ITimerPtr timer) @@ -1300,9 +1299,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerAsyncDelegate - #pragma mark + // + // RTPListener => IRTPListenerAsyncDelegate + // //------------------------------------------------------------------------- void RTPListener::onDeliverPacket( @@ -1329,19 +1328,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => (internal) - #pragma mark + // + // RTPListener => (internal) + // //------------------------------------------------------------------------- - Log::Params RTPListener::slog(const char *message) + Log::Params RTPListener::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::RTPListener"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params RTPListener::log(const char *message) const + Log::Params RTPListener::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::RTPListener"); IHelper::debugAppend(objectEl, "id", mID); @@ -1349,13 +1348,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPListener::debug(const char *message) const + Log::Params RTPListener::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr RTPListener::toDebug() const + ElementPtr RTPListener::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1380,25 +1379,25 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPListener::isShuttingDown() const + bool RTPListener::isShuttingDown() const noexcept { return State_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool RTPListener::isShutdown() const + bool RTPListener::isShutdown() const noexcept { return State_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void RTPListener::step() + void RTPListener::step() noexcept { ZS_LOG_DEBUG(debug("step")) if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_LOG_DEBUG(debug("step forwarding to cancel")); cancel(); return; } @@ -1413,19 +1412,19 @@ namespace ortc not_ready: { - ZS_LOG_TRACE(debug("listener is not ready")) + ZS_LOG_TRACE(debug("listener is not ready")); return; } ready: { setState(State_Ready); - ZS_LOG_TRACE(log("ready")) + ZS_LOG_TRACE(log("ready")); } } //------------------------------------------------------------------------- - bool RTPListener::stepAttemptDelivery() + bool RTPListener::stepAttemptDelivery() noexcept { ZS_EVENTING_1(x, i, Debug, RtpListenerStep, ol, RtpListener, Step, puid, id, mID); @@ -1475,7 +1474,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::cancel() + void RTPListener::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, RtpListenerCancel, ol, RtpListener, Cancel, puid, id, mID); @@ -1529,11 +1528,11 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::setState(States state) + void RTPListener::setState(States state) noexcept { if (state == mCurrentState) return; - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) + ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))); mCurrentState = state; ZS_EVENTING_2( @@ -1549,7 +1548,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::setError(WORD errorCode, const char *inReason) + void RTPListener::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -1574,7 +1573,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::expireRTPPackets() + void RTPListener::expireRTPPackets() noexcept { auto tick = zsLib::now(); @@ -1607,7 +1606,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::expireRTCPPackets() + void RTPListener::expireRTCPPackets() noexcept { auto tick = zsLib::now(); @@ -1645,10 +1644,10 @@ namespace ortc HeaderExtensionURIs extensionURI, LocalID localID, bool encrytped - ) + ) noexcept(false) { if (shouldFilter(extensionURI)) { - ZS_LOG_DEBUG(log("extension header is not relevant to listener (thus filtering)") + ZS_PARAM("object id", objectID) + ZS_PARAM("extension uri", IRTPTypes::toString(extensionURI)) + ZS_PARAM("local ID", localID) + ZS_PARAM("encrypted", encrytped)) + ZS_LOG_DEBUG(log("extension header is not relevant to listener (thus filtering)") + ZS_PARAM("object id", objectID) + ZS_PARAM("extension uri", IRTPTypes::toString(extensionURI)) + ZS_PARAM("local ID", localID) + ZS_PARAM("encrypted", encrytped)); return; } @@ -1671,7 +1670,7 @@ namespace ortc size_t, totalReferences, extension.mReferences.size() ); - ZS_LOG_DEBUG(log("registered header extension") + ZS_PARAM("object id", objectID) + extension.toDebug()) + ZS_LOG_DEBUG(log("registered header extension") + ZS_PARAM("object id", objectID) + extension.toDebug()); return; } @@ -1695,11 +1694,11 @@ namespace ortc size_t, totalReferences, extension.mReferences.size() ); - ZS_LOG_DEBUG(log("referencing existing header extension") + ZS_PARAM("object id", objectID) + extension.toDebug()) + ZS_LOG_DEBUG(log("referencing existing header extension") + ZS_PARAM("object id", objectID) + extension.toDebug()); } //------------------------------------------------------------------------- - void RTPListener::unregisterAllHeaderExtensionReferences(PUID objectID) + void RTPListener::unregisterAllHeaderExtensionReferences(PUID objectID) noexcept { for (auto iter_doNotUse = mRegisteredExtensions.begin(); iter_doNotUse != mRegisteredExtensions.end(); ) { @@ -1736,7 +1735,7 @@ namespace ortc const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo, String &outMuxID - ) + ) noexcept { outMuxID = extractMuxID(rtpPacket, outReceiverInfo); @@ -1762,7 +1761,7 @@ namespace ortc fill_mux_id: { - ASSERT((bool)outReceiverInfo) + ZS_ASSERT((bool)outReceiverInfo); if (!fillMuxIDParameters(outMuxID, outReceiverInfo)) { outReceiverInfo = ReceiverInfoPtr(); return false; @@ -1777,7 +1776,7 @@ namespace ortc const String &muxID, const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo - ) + ) noexcept { if (!muxID.hasData()) return false; @@ -1786,7 +1785,7 @@ namespace ortc outReceiverInfo = (*found).second; - ZS_LOG_DEBUG(log("creating new SSRC table entry (based on mux id mapping to existing receiver)") + ZS_PARAM("mux id", muxID) + outReceiverInfo->toDebug()) + ZS_LOG_DEBUG(log("creating new SSRC table entry (based on mux id mapping to existing receiver)") + ZS_PARAM("mux id", muxID) + outReceiverInfo->toDebug()); String inMuxID = muxID; setSSRCUsage(rtpPacket.ssrc(), inMuxID, outReceiverInfo); @@ -1806,7 +1805,7 @@ namespace ortc const String &muxID, const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo - ) + ) noexcept { ReceiverObjectMapPtr receivers = mReceivers; @@ -1879,7 +1878,7 @@ namespace ortc const String &muxID, const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo - ) + ) noexcept { EncodingParameters *foundEncoding = NULL; RTPTypesHelper::DecodedCodecInfo foundDecodedCodec; @@ -1912,11 +1911,11 @@ namespace ortc } if (NULL == matchEncoding) continue; // did not find an appropriate encoding - ASSERT(NULL != baseEncoding) // has to always have a base + ZS_ASSERT(NULL != baseEncoding); // has to always have a base { switch (decodedCodec.mDepth[0].mCodecKind) { - case CodecKind_Unknown: ASSERT(false) break; + case CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case CodecKind_Audio: case CodecKind_AudioSupplemental: case CodecKind_Video: @@ -1930,7 +1929,7 @@ namespace ortc auto foundSSRC = mSSRCTable.find(ssrc); if (foundSSRC == mSSRCTable.end()) { - ZS_LOG_WARNING(Trace, log("catch not match encoding as master SSRC was not active recently") + receiverInfo->toDebug()) + ZS_LOG_WARNING(Trace, log("catch not match encoding as master SSRC was not active recently") + receiverInfo->toDebug()); continue; } @@ -1946,23 +1945,23 @@ namespace ortc if ((diffLast < mAmbiguousPayloadMappingMinDifference) && (diffCurrent < mAmbiguousPayloadMappingMinDifference)) { - ZS_LOG_WARNING(Debug, log("ambiguity exists to which receiver the packet should match because both channels have been recendly active (thus cannot pick any encoding)") + ZS_PARAM("tick", tick) + ZS_PARAM("match time", lastMatchUsageTime) + ZS_PARAM("ambiguity window", mAmbiguousPayloadMappingMinDifference) + ZS_PARAM("diff last", diffLast) + ZS_PARAM("diff current", diffCurrent) + ssrcInfo->toDebug() + ZS_PARAM("previous find", outReceiverInfo->toDebug()) + ZS_PARAM("found", receiverInfo->toDebug())) + ZS_LOG_WARNING(Debug, log("ambiguity exists to which receiver the packet should match because both channels have been recendly active (thus cannot pick any encoding)") + ZS_PARAM("tick", tick) + ZS_PARAM("match time", lastMatchUsageTime) + ZS_PARAM("ambiguity window", mAmbiguousPayloadMappingMinDifference) + ZS_PARAM("diff last", diffLast) + ZS_PARAM("diff current", diffCurrent) + ssrcInfo->toDebug() + ZS_PARAM("previous find", outReceiverInfo->toDebug()) + ZS_PARAM("found", receiverInfo->toDebug())); return false; } if (ssrcInfo->mLastUsage < lastMatchUsageTime) { - ZS_LOG_WARNING(Trace, log("possible ambiguity in match (but going with previous more recent usage)") + ZS_PARAM("match time", lastMatchUsageTime) + ssrcInfo->toDebug()) + ZS_LOG_WARNING(Trace, log("possible ambiguity in match (but going with previous more recent usage)") + ZS_PARAM("match time", lastMatchUsageTime) + ssrcInfo->toDebug()); continue; } - ZS_LOG_WARNING(Trace, log("possible ambiguity in match (going with this as more recent in usage)") + ZS_PARAM("match time", lastMatchUsageTime) + ssrcInfo->toDebug() + ZS_PARAM("using", receiverInfo->toDebug()) + ZS_PARAM("previous found", outReceiverInfo->toDebug())) + ZS_LOG_WARNING(Trace, log("possible ambiguity in match (going with this as more recent in usage)") + ZS_PARAM("match time", lastMatchUsageTime) + ssrcInfo->toDebug() + ZS_PARAM("using", receiverInfo->toDebug()) + ZS_PARAM("previous found", outReceiverInfo->toDebug())); lastMatchUsageTime = ssrcInfo->mLastUsage; outReceiverInfo = receiverInfo; foundEncoding = matchEncoding; foundDecodedCodec = decodedCodec; } else { - ZS_LOG_TRACE(log("found likely match") + receiverInfo->toDebug() + ssrcInfo->toDebug()) + ZS_LOG_TRACE(log("found likely match") + receiverInfo->toDebug() + ssrcInfo->toDebug()); lastMatchUsageTime = ssrcInfo->mLastUsage; outReceiverInfo = receiverInfo; @@ -1999,7 +1998,7 @@ namespace ortc for (; encodingIter != outReceiverInfo->mFilledParameters.mEncodings.end(); ++encodingIter, ++replacementIter) { - ASSERT(replacementIter != replacementInfo->mFilledParameters.mEncodings.end()) + ZS_ASSERT(replacementIter != replacementInfo->mFilledParameters.mEncodings.end()); auto &encoding = (*encodingIter); auto &replaceEncoding = (*encodingIter); @@ -2007,7 +2006,7 @@ namespace ortc if ((&encoding) != foundEncoding) continue; // this is not the encoding you are searching for... switch (foundDecodedCodec.mDepth[0].mCodecKind) { - case CodecKind_Unknown: ASSERT(false) break; + case CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case CodecKind_Audio: case CodecKind_Video: case CodecKind_AV: @@ -2042,13 +2041,13 @@ namespace ortc } } - ASSERT(false) + ZS_ASSERT_FAIL("should not reach this code"); return false; } replace_receiver: { - ZS_LOG_DEBUG(log("filled in SSSRC value in receiver (thus replacing existing receiver)") + outReceiverInfo->toDebug()) + ZS_LOG_DEBUG(log("filled in SSSRC value in receiver (thus replacing existing receiver)") + outReceiverInfo->toDebug()); setReceiverInfo(replacementInfo); outReceiverInfo = replacementInfo; @@ -2056,7 +2055,7 @@ namespace ortc insert_ssrc_into_table: { - ZS_LOG_DEBUG(log("creating a new SSRC entry in SSRC table (based on payload type matching)") + outReceiverInfo->toDebug()) + ZS_LOG_DEBUG(log("creating a new SSRC entry in SSRC table (based on payload type matching)") + outReceiverInfo->toDebug()); setReceiverInfo(replacementInfo); outReceiverInfo = replacementInfo; @@ -2078,7 +2077,7 @@ namespace ortc String RTPListener::extractMuxID( const RTPPacket &rtpPacket, ReceiverInfoPtr &ioReceiverInfo - ) + ) noexcept { for (auto ext = rtpPacket.firstHeaderExtension(); NULL != ext; ext = ext->mNext) { LocalID localID = static_cast(ext->mID); @@ -2105,7 +2104,7 @@ namespace ortc } //------------------------------------------------------------------------- - String RTPListener::extractRID(const RTPPacket &rtpPacket) + String RTPListener::extractRID(const RTPPacket &rtpPacket) noexcept { for (auto ext = rtpPacket.firstHeaderExtension(); NULL != ext; ext = ext->mNext) { LocalID localID = static_cast(ext->mID); @@ -2131,9 +2130,9 @@ namespace ortc bool RTPListener::fillMuxIDParameters( const String &muxID, ReceiverInfoPtr &ioReceiverInfo - ) + ) noexcept { - ASSERT((bool)ioReceiverInfo) + ZS_ASSERT((bool)ioReceiverInfo); if (!muxID.hasData()) return true; @@ -2156,7 +2155,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::setReceiverInfo(ReceiverInfoPtr receiverInfo) + void RTPListener::setReceiverInfo(ReceiverInfoPtr receiverInfo) noexcept { ReceiverObjectMapPtr receivers(make_shared(*mReceivers)); @@ -2231,7 +2230,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::processByes(const RTCPPacket &rtcpPacket) + void RTPListener::processByes(const RTCPPacket &rtcpPacket) noexcept { for (auto bye = rtcpPacket.firstBye(); NULL != bye; bye = bye->nextBye()) { for (size_t index = 0; index < bye->sc(); ++index) { @@ -2275,7 +2274,7 @@ namespace ortc for (; iterParm != info->mFilledParameters.mEncodings.end(); ++iterParm, ++iterOriginalParams) { - ASSERT(iterOriginalParams != info->mOriginalParameters.mEncodings.end()) + ZS_ASSERT(iterOriginalParams != info->mOriginalParameters.mEncodings.end()) EncodingParameters &encParams = (*iterParm); EncodingParameters &originalEncParams = (*iterOriginalParams); @@ -2314,7 +2313,7 @@ namespace ortc for (; iterParm != info->mFilledParameters.mEncodings.end(); ++iterParm, ++iterOriginalParams) { - ASSERT(iterOriginalParams != info->mOriginalParameters.mEncodings.end()) + ZS_ASSERT(iterOriginalParams != info->mOriginalParameters.mEncodings.end()); EncodingParameters &encParams = (*iterParm); EncodingParameters &originalEncParams = (*iterOriginalParams); @@ -2353,7 +2352,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::processSDESMid(const RTCPPacket &rtcpPacket) + void RTPListener::processSDESMid(const RTCPPacket &rtcpPacket) noexcept { for (auto sdes = rtcpPacket.firstSDES(); NULL != sdes; sdes = sdes->nextSDES()) { @@ -2368,7 +2367,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::processSenderReports(const RTCPPacket &rtcpPacket) + void RTPListener::processSenderReports(const RTCPPacket &rtcpPacket) noexcept { for (auto sr = rtcpPacket.firstSenderReport(); NULL != sr; sr = sr->nextSenderReport()) { String ignoredStr; @@ -2382,7 +2381,7 @@ namespace ortc ReceiverInfoPtr replacementInfo, const EncodingParameters &existing, EncodingParameters &ioReplacement - ) + ) noexcept { // scope: check for codec changes { @@ -2439,8 +2438,9 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::unregisterEncoding(const EncodingParameters &existing) + void RTPListener::unregisterEncoding(ZS_MAYBE_USED() const EncodingParameters &existing) noexcept { + ZS_MAYBE_USED(existing); } //------------------------------------------------------------------------- @@ -2448,7 +2448,7 @@ namespace ortc SSRCType ssrc, String &ioMuxID, ReceiverInfoPtr &ioReceiverInfo - ) + ) noexcept { SSRCInfoPtr ssrcInfo; @@ -2522,13 +2522,13 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPListener::registerSSRCUsage(SSRCInfoPtr ssrcInfo) + void RTPListener::registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept { mRegisteredSSRCs[ssrcInfo->mSSRC] = ssrcInfo; } //------------------------------------------------------------------------- - void RTPListener::reattemptDelivery() + void RTPListener::reattemptDelivery() noexcept { if (mReattemptRTPDelivery) return; mReattemptRTPDelivery = true; @@ -2542,7 +2542,7 @@ namespace ortc IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType, const Time &tick - ) + ) noexcept { UnhandledEventInfo unhandled; unhandled.mSSRC = ssrc; @@ -2578,12 +2578,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerFactory - #pragma mark + // + // IRTPListenerFactory + // //------------------------------------------------------------------------- - IRTPListenerFactory &IRTPListenerFactory::singleton() + IRTPListenerFactory &IRTPListenerFactory::singleton() noexcept { return RTPListenerFactory::singleton(); } @@ -2593,14 +2593,14 @@ namespace ortc IRTPListenerDelegatePtr delegate, IRTPTransportPtr transport, Optional headerExtensions - ) + ) noexcept(false) { if (this) {} return internal::RTPListener::create(delegate, transport, headerExtensions); } //------------------------------------------------------------------------- - RTPListenerPtr IRTPListenerFactory::create(IRTPTransportPtr transport) + RTPListenerPtr IRTPListenerFactory::create(IRTPTransportPtr transport) noexcept { if (this) {} return internal::RTPListener::create(transport); @@ -2613,12 +2613,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListener - #pragma mark + // + // IRTPListener + // //--------------------------------------------------------------------------- - ElementPtr IRTPListener::toDebug(IRTPListenerPtr transport) + ElementPtr IRTPListener::toDebug(IRTPListenerPtr transport) noexcept { return internal::RTPListener::toDebug(internal::RTPListener::convert(transport)); } @@ -2628,7 +2628,7 @@ namespace ortc IRTPListenerDelegatePtr delegate, IRTPTransportPtr transport, Optional headerExtensions - ) + ) noexcept(false) { return internal::IRTPListenerFactory::singleton().create(delegate, transport, headerExtensions); } diff --git a/ortc/cpp/ortc_RTPMediaEngine.cpp b/ortc/cpp/ortc_RTPMediaEngine.cpp deleted file mode 100644 index 73e90b9b..00000000 --- a/ortc/cpp/ortc_RTPMediaEngine.cpp +++ /dev/null @@ -1,4952 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef WINRT -#include -#endif - -#pragma comment(lib, "mfplat") - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpmediaengine) } - -namespace ortc -{ - ZS_DECLARE_USING_PTR(zsLib, ISettings); - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); - - namespace internal - { - ZS_DECLARE_CLASS_PTR(RTPMediaEngineSettingsDefaults); - ZS_DECLARE_CLASS_PTR(RTPMediaEngineRegistration); - ZS_DECLARE_CLASS_PTR(RTPMediaEngineSingleton); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark - - // foreward declaration - void webrtcTrace(Log::Severity severity, Log::Level level, const char *message); - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngineSettingsDefaults - #pragma mark - - class RTPMediaEngineSettingsDefaults : public ISettingsApplyDefaultsDelegate - { - public: - //----------------------------------------------------------------------- - ~RTPMediaEngineSettingsDefaults() - { - ISettings::removeDefaults(*this); - } - - //----------------------------------------------------------------------- - static RTPMediaEngineSettingsDefaultsPtr singleton() - { - static SingletonLazySharedPtr singleton(create()); - return singleton.singleton(); - } - - //----------------------------------------------------------------------- - static RTPMediaEngineSettingsDefaultsPtr create() - { - auto pThis(make_shared()); - ISettings::installDefaults(pThis); - return pThis; - } - - //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override - { - } - - }; - - //------------------------------------------------------------------------- - void installRTPMediaEngineSettingsDefaults() - { - RTPMediaEngineSettingsDefaults::singleton(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngineRegistration - #pragma mark - - class RTPMediaEngineRegistration : public IRTPMediaEngineRegistration - { - protected: - struct make_private {}; - public: - //----------------------------------------------------------------------- - RTPMediaEngineRegistration(const make_private &) - {} - - //----------------------------------------------------------------------- - ~RTPMediaEngineRegistration() - { - mEngine->shutdown(); - mEngine.reset(); - } - - //----------------------------------------------------------------------- - static RTPMediaEngineRegistrationPtr create() - { - RTPMediaEngineRegistrationPtr pThis(make_shared(make_private{})); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //----------------------------------------------------------------------- - void init() - { - mEngine = IRTPMediaEngineFactory::singleton().create(mThisWeak.lock()); - } - - //----------------------------------------------------------------------- - PromiseWithRTPMediaEnginePtr notify() - { - auto promise = PromiseWithRTPMediaEngine::create(IORTCForInternal::queueORTC()); - promise->setReferenceHolder(mThisWeak.lock()); - mEngine->notify(promise); - return promise; - } - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineRegistration - #pragma mark - - virtual RTPMediaEnginePtr getRTPEngine() const {return mEngine;} - - protected: - RTPMediaEngineRegistrationWeakPtr mThisWeak; - RTPMediaEnginePtr mEngine; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngineSingleton - #pragma mark - - class RTPMediaEngineSingleton : public SharedRecursiveLock, - public ISingletonManagerDelegate - { - protected: - struct make_private {}; - - public: - //----------------------------------------------------------------------- - RTPMediaEngineSingleton(const make_private &) : - SharedRecursiveLock(SharedRecursiveLock::create()) - { - } - - //----------------------------------------------------------------------- - static RTPMediaEngineSingletonPtr create() - { - RTPMediaEngineSingletonPtr pThis(make_shared(make_private{})); - return pThis; - } - - //----------------------------------------------------------------------- - static RTPMediaEngineSingletonPtr singleton() - { - AutoRecursiveLock lock(*IHelper::getGlobalLock()); - static SingletonLazySharedPtr singleton(create()); - RTPMediaEngineSingletonPtr result = singleton.singleton(); - - static zsLib::SingletonManager::Register registerSingleton("org.ortc.RTPMediaEngineSingleton", result); - - if (!result) { - ZS_LOG_WARNING(Detail, slog("singleton gone")) - } - - return result; - } - - //----------------------------------------------------------------------- - static RTPMediaEnginePtr getEngineIfAlive() - { - auto pThis(singleton()); - if (!pThis) return RTPMediaEnginePtr(); - - AutoRecursiveLock lock(*pThis); - auto result = pThis->mEngineRegistration.lock(); - if (!result) return RTPMediaEnginePtr(); - - return result->getRTPEngine(); - } - - //----------------------------------------------------------------------- - Log::Params log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPMediaEngineSingleton"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - - //----------------------------------------------------------------------- - static Log::Params slog(const char *message) - { - return Log::Params(message, "ortc::RTPMediaEngineSingleton"); - } - - //----------------------------------------------------------------------- - Log::Params debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - - //----------------------------------------------------------------------- - virtual ElementPtr toDebug() const - { - AutoRecursiveLock lock(*this); - ElementPtr resultEl = Element::create("ortc::RTPMediaEngineSingleton"); - - IHelper::debugAppend(resultEl, "id", mID); - - return resultEl; - } - - //----------------------------------------------------------------------- - RTPMediaEngineRegistrationPtr getEngineRegistration() - { - AutoRecursiveLock lock(*this); - auto result = mEngineRegistration.lock(); - if (!result) { - result = RTPMediaEngineRegistration::create(); - mEngineRegistration = result; - } - return result; - } - - protected: - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark ISingletonManagerDelegate - #pragma mark - - virtual void notifySingletonCleanup() - { - AutoRecursiveLock lock(*this); - mEngineRegistration.reset(); - } - - protected: - AutoPUID mID; - - RTPMediaEngineRegistrationWeakPtr mEngineRegistration; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForORTC - #pragma mark - - //------------------------------------------------------------------------- - void IRTPMediaEngineForORTC::setLogLevel(Log::Level level) - { - RTPMediaEngine::setLogLevel(level); - } - - //------------------------------------------------------------------------- - void IRTPMediaEngineForORTC::ntpServerTime(const Milliseconds &value) - { - RTPMediaEngine::ntpServerTime(value); - } - - //------------------------------------------------------------------------- - void IRTPMediaEngineForORTC::startMediaTracing() - { - RTPMediaEngine::startMediaTracing(); - } - - //------------------------------------------------------------------------- - void IRTPMediaEngineForORTC::stopMediaTracing() - { - RTPMediaEngine::stopMediaTracing(); - } - - //------------------------------------------------------------------------- - bool IRTPMediaEngineForORTC::isMediaTracing() - { - return RTPMediaEngine::isMediaTracing(); - } - - //------------------------------------------------------------------------- - bool IRTPMediaEngineForORTC::saveMediaTrace(String filename) - { - return RTPMediaEngine::saveMediaTrace(filename); - } - - //------------------------------------------------------------------------- - bool IRTPMediaEngineForORTC::saveMediaTrace(String host, int port) - { - return RTPMediaEngine::saveMediaTrace(host, port); - } - - //------------------------------------------------------------------------- - bool IRTPMediaEngineForORTC::isMRPInstalled() - { - return RTPMediaEngine::isMRPInstalled(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForSettings - #pragma mark - - //------------------------------------------------------------------------- - void IRTPMediaEngineForSettings::applyDefaults() - { -// UseSettings::setUInt(ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE, 5*1024); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPReceiverChannelMediaBase - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPMediaEngineForRTPReceiverChannelMediaBase::toDebug(ForRTPReceiverChannelMediaBasePtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object)->toDebug(); - } - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEnginePtr IRTPMediaEngineForRTPReceiverChannelMediaBase::create() - { - return RTPMediaEngine::createEnginePromise(); - } - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEngineChannelResourcePtr IRTPMediaEngineForRTPReceiverChannelMediaBase::setupChannel( - UseReceiverChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ) - { - auto singleton = RTPMediaEngineSingleton::singleton(); - if (!singleton) return PromiseWithRTPMediaEngineChannelResource::createRejected(IORTCForInternal::queueORTC()); - return singleton->getEngineRegistration()->getRTPEngine()->setupChannel( - channel, - transport, - track, - parameters, - packet - ); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPSenderChannelMediaBase - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPMediaEngineForRTPSenderChannelMediaBase::toDebug(ForRTPSenderChannelMediaBasePtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object)->toDebug(); - } - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEnginePtr IRTPMediaEngineForRTPSenderChannelMediaBase::create() - { - return RTPMediaEngine::createEnginePromise(); - } - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEngineChannelResourcePtr IRTPMediaEngineForRTPSenderChannelMediaBase::setupChannel( - UseSenderChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ) - { - auto singleton = RTPMediaEngineSingleton::singleton(); - if (!singleton) return PromiseWithRTPMediaEngineChannelResource::createRejected(IORTCForInternal::queueORTC()); - return singleton->getEngineRegistration()->getRTPEngine()->setupChannel( - channel, - transport, - track, - parameters, - dtmfDelegate - ); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPMediaEngineForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object)->toDebug(); - } - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEnginePtr IRTPMediaEngineForMediaStreamTrack::create() - { - return RTPMediaEngine::createEnginePromise(); - } - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEngineDeviceResourcePtr IRTPMediaEngineForMediaStreamTrack::setupDevice(UseMediaStreamTrackPtr track) - { - auto singleton = RTPMediaEngineSingleton::singleton(); - if (!singleton) return PromiseWithRTPMediaEngineDeviceResource::createRejected(IORTCForInternal::queueORTC()); - return singleton->getEngineRegistration()->getRTPEngine()->setupDevice(track); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine - #pragma mark - - //--------------------------------------------------------------------------- - const char *RTPMediaEngine::toString(States state) - { - switch (state) { - case State_Pending: return "pending"; - case State_Ready: return "ready"; - case State_ShuttingDown: return "shutting down"; - case State_Shutdown: return "shutdown"; - } - return "UNDEFINED"; - } - - //------------------------------------------------------------------------- - RTPMediaEngine::RTPMediaEngine( - const make_private &, - IMessageQueuePtr queue, - IRTPMediaEngineRegistrationPtr registration - ) : - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()), - mRegistration(registration), - mTraceCallback(new WebRtcTraceCallback()), - mLogSink(new WebRtcLogSink()) - { - ZS_EVENTING_1(x, i, Detail, RtpMediaEngineCreate, ol, RtpMediaEngine, Start, puid, id, mID); - ZS_LOG_DETAIL(debug("created")); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::init() - { - webrtc::Trace::CreateTrace(); - webrtc::Trace::SetTraceCallback(mTraceCallback.get()); - - auto level = IORTCForInternal::webrtcLogLevel(); - if (level.hasValue()) { - internalSetLogLevel(level); - } - -#if defined(WINRT) - webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); -#endif - - AutoRecursiveLock lock(*this); - - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - RTPMediaEngine::~RTPMediaEngine() - { - if (isNoop()) return; - - webrtc::Trace::SetTraceCallback(nullptr); - webrtc::Trace::ReturnTrace(); - - ZS_LOG_DETAIL(log("destroyed")); - mThisWeak.reset(); - - cancel(); - ZS_EVENTING_1(x, i, Detail, RtpMediaEngineDestroy, ol, RtpMediaEngine, Stop, puid, id, mID); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForSettingsPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPReceiverChannelPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPReceiverChannelMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPReceiverChannelAudioPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPReceiverChannelVideoPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPSenderChannelMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPSenderChannelAudioPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForRTPSenderChannelVideoPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::convert(ForMediaStreamTrackPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - RTPMediaEnginePtr RTPMediaEngine::convert(ForDeviceResourcePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - RTPMediaEnginePtr RTPMediaEngine::convert(ForChannelResourcePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPMediaEngine, object); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => RTPMediaEngineSingleton/RTPMediaEngineRegistration - #pragma mark - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEnginePtr RTPMediaEngine::createEnginePromise() - { - auto singleton = RTPMediaEngineSingleton::singleton(); - if (!singleton) { - return PromiseWithRTPMediaEngine::createRejected(IORTCForInternal::queueORTC()); - } - return singleton->getEngineRegistration()->notify(); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr RTPMediaEngine::create(IRTPMediaEngineRegistrationPtr registration) - { - RTPMediaEnginePtr pThis(make_shared(make_private {}, IORTCForInternal::queueBlockingMediaStartStopThread(), registration)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::notify(PromiseWithRTPMediaEnginePtr promise) - { - IRTPMediaEngineRegistrationPtr registration; - - { - AutoRecursiveLock lock(*this); - if (!isReady()) { - mPendingReady.push_back(promise); - return; - } - registration = mRegistration.lock(); - } - - if (registration) { - promise->resolve(registration->getRTPEngine()); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::shutdown() - { - AutoRecursiveLock lock(*this); - - // WARNING: Do NOT call cancel directly as this object must only be - // shutdown on the object's media queue. - setState(State_ShuttingDown); - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForORTC - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::setLogLevel(Log::Level level) - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - engine->internalSetLogLevel(level); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::ntpServerTime(const Milliseconds &value) - { - rtc::SyncWithNtp(value.count()); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::startMediaTracing() - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - engine->internalStartMediaTracing(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::stopMediaTracing() - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - engine->internalStopMediaTracing(); - } - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::isMediaTracing() - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - return engine->internalIsMediaTracing(); - } - return false; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::saveMediaTrace(String filename) - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - return engine->internalSaveMediaTrace(filename); - } - return false; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::saveMediaTrace(String host, int port) - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - return engine->internalSaveMediaTrace(host, port); - } - return false; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::isMRPInstalled() - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - return engine->internalIsMRPInstalled(); - } - return false; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannelMediaBase - #pragma mark - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEngineChannelResourcePtr RTPMediaEngine::setupChannel( - UseReceiverChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ) - { - // WARNING - DO NOT ENTER A LOCK! - - auto setup = make_shared(); - setup->mRegistration = mRegistration.lock(); - setup->mPromise = PromiseWithRTPMediaEngineChannelResource::create(IORTCForInternal::queueORTC()); - setup->mChannel = channel; - setup->mTransport = transport; - setup->mTrack = track; - setup->mParameters = parameters; - setup->mPacket = packet; - - IRTPMediaEngineAsyncDelegateProxy::create(mThisWeak.lock())->onSetupReceiverChannel(setup); - - return setup->mPromise; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannelAudio - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannelVideo - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannel - #pragma mark - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannelMediaBase - #pragma mark - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEngineChannelResourcePtr RTPMediaEngine::setupChannel( - UseSenderChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ) - { - auto setup = make_shared(); - setup->mRegistration = mRegistration.lock(); - setup->mPromise = PromiseWithRTPMediaEngineChannelResource::create(IORTCForInternal::queueORTC()); - setup->mChannel = channel; - setup->mTransport = transport; - setup->mTrack = track; - setup->mParameters = parameters; - setup->mDTMFDelegate = dtmfDelegate; - - IRTPMediaEngineAsyncDelegateProxy::create(mThisWeak.lock())->onSetupSenderChannel(setup); - - return setup->mPromise; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannelAudio - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannelVideo - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - PromiseWithRTPMediaEngineDeviceResourcePtr RTPMediaEngine::setupDevice(UseMediaStreamTrackPtr track) - { - auto setup = make_shared(); - setup->mRegistration = mRegistration.lock(); - setup->mPromise = PromiseWithRTPMediaEngineDeviceResource::create(IORTCForInternal::queueORTC()); - setup->mTrack = track; - - IRTPMediaEngineAsyncDelegateProxy::create(mThisWeak.lock())->onSetupDevice(setup); - - return setup->mPromise; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForDeviceResource - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::notifyResourceGone(IDeviceResourceForRTPMediaEngine &inResource) - { - PUID resourceID = inResource.getID(); - - AutoRecursiveLock lock(*this); - - auto found = mDeviceResources.find(resourceID); - if (found != mDeviceResources.end()) { - mDeviceResources.erase(found); - } - - // invoke "step" mechanism again - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForChannelResource - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::notifyResourceGone(IChannelResourceForRTPMediaEngine &inResource) - { - PUID resourceID = inResource.getID(); - - AutoRecursiveLock lock(*this); - - auto found = mChannelResources.find(resourceID); - if (found != mChannelResources.end()) { - mChannelResources.erase(found); - } - - // invoke "step" mechanism again - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - webrtc::VoiceEngine *RTPMediaEngine::getVoiceEngine() - { - return mVoiceEngine.get(); - } - - //------------------------------------------------------------------------- - rtc::scoped_refptr RTPMediaEngine::getAudioState() - { - return mAudioState; - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IWakeDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::onWake() - { - ZS_LOG_DEBUG(log("wake")) - - AutoRecursiveLock lock(*this); - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => ITimerDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::onTimer(ITimerPtr timer) - { - ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) - - AutoRecursiveLock lock(*this); - // NOTE: ADD IF NEEDED... - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::onSetupSenderChannel(SetupSenderChannelPtr setup) - { - AutoRecursiveLock lock(*this); - - if (ZS_DYNAMIC_PTR_CAST(IRTPSenderChannelAudioForRTPMediaEngine, setup->mChannel)) { - ChannelResourcePtr resource = AudioSenderChannelResource::create( - setup->mRegistration, - setup->mTransport, - setup->mTrack, - setup->mParameters, - setup->mDTMFDelegate - ); - resource->registerPromise(setup->mPromise); - mChannelResources[resource->getID()] = resource; - mPendingSetupChannelResources.push_back(resource); - } else if (ZS_DYNAMIC_PTR_CAST(IRTPSenderChannelVideoForRTPMediaEngine, setup->mChannel)) { - ChannelResourcePtr resource = VideoSenderChannelResource::create( - setup->mRegistration, - setup->mTransport, - setup->mTrack, - setup->mParameters - ); - resource->registerPromise(setup->mPromise); - mChannelResources[resource->getID()] = resource; - mPendingSetupChannelResources.push_back(resource); - } - - step(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::onSetupReceiverChannel(SetupReceiverChannelPtr setup) - { - AutoRecursiveLock lock(*this); - - if (ZS_DYNAMIC_PTR_CAST(IRTPReceiverChannelAudioForRTPMediaEngine, setup->mChannel)) { - AudioReceiverChannelResourcePtr resource = AudioReceiverChannelResource::create( - setup->mRegistration, - setup->mTransport, - setup->mTrack, - setup->mParameters, - setup->mPacket - ); - resource->registerPromise(setup->mPromise); - mChannelResources[resource->getID()] = resource; - mPendingSetupChannelResources.push_back(resource); - } else if (ZS_DYNAMIC_PTR_CAST(IRTPReceiverChannelVideoForRTPMediaEngine, setup->mChannel)) { - VideoReceiverChannelResourcePtr resource = VideoReceiverChannelResource::create( - setup->mRegistration, - setup->mTransport, - setup->mTrack, - setup->mParameters, - setup->mPacket - ); - resource->registerPromise(setup->mPromise); - mChannelResources[resource->getID()] = resource; - mPendingSetupChannelResources.push_back(resource); - } - - step(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::onSetupDevice(SetupDevicePtr setup) - { - AutoRecursiveLock lock(*this); - DeviceResourcePtr resource = DeviceResource::create( - setup->mRegistration, - setup->mTrack - ); - - resource->registerPromise(setup->mPromise); - - mDeviceResources[resource->getID()] = resource; - mPendingSetupDeviceResources.push_back(resource); - - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (friend DeviceResource) - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::shutdownDeviceResource(DeviceResourcePtr deviceResource) - { - { - AutoRecursiveLock lock(*this); - mPendingCloseDeviceResources.push_back(deviceResource); - } - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => webrtc::SetupEventTracer - #pragma mark - -#if defined(WINRT) - const unsigned char *RTPMediaEngine::GetCategoryGroupEnabled(const char *categoryGroup) - { - return reinterpret_cast("webrtc"); - } - - void __cdecl RTPMediaEngine::AddTraceEvent( - char phase, - const unsigned char *categoryGroupEnabled, - const char *name, - uint64 id, - int numArgs, - const char **argNames, - const unsigned char *argTypes, - const uint64 *argValues, - unsigned char flags - ) - { - auto engine = RTPMediaEngineSingleton::getEngineIfAlive(); - if (engine) { - engine->internalAddTraceEvent(phase, categoryGroupEnabled, name, id, - numArgs, argNames, argTypes, argValues, flags); - } - } -#endif - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (friend ChannelResource) - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::shutdownChannelResource(ChannelResourcePtr channelResource) - { - { - AutoRecursiveLock lock(*this); - mPendingCloseChannelResources.push_back(channelResource); - } - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (internal) - #pragma mark - - //------------------------------------------------------------------------- - Log::Params RTPMediaEngine::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPMediaEngine"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - - //------------------------------------------------------------------------- - Log::Params RTPMediaEngine::debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - - //------------------------------------------------------------------------- - ElementPtr RTPMediaEngine::toDebug() const - { - AutoRecursiveLock lock(*this); - - ElementPtr resultEl = Element::create("ortc::RTPMediaEngine"); - - IHelper::debugAppend(resultEl, "id", mID); - - IHelper::debugAppend(resultEl, "graceful shutdown", (bool)mGracefulShutdownReference); - - IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); - - IHelper::debugAppend(resultEl, "error", mLastError); - IHelper::debugAppend(resultEl, "error reason", mLastErrorReason); - - auto registration = mRegistration.lock(); - IHelper::debugAppend(resultEl, "registration", (bool)registration); - - IHelper::debugAppend(resultEl, "pending ready", mPendingReady.size()); - - IHelper::debugAppend(resultEl, "device resources", mDeviceResources.size()); - IHelper::debugAppend(resultEl, "pending setup device resources", mPendingSetupDeviceResources.size()); - IHelper::debugAppend(resultEl, "pending close device resources", mPendingCloseDeviceResources.size()); - - IHelper::debugAppend(resultEl, "channel resources", mChannelResources.size()); - IHelper::debugAppend(resultEl, "pending setup channel resources", mPendingSetupChannelResources.size()); - IHelper::debugAppend(resultEl, "pending close channel resources", mPendingCloseChannelResources.size()); - - return resultEl; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::internalSetLogLevel(Log::Level level) - { - webrtc::TraceLevel traceLevel {webrtc::kTraceAll}; - rtc::LoggingSeverity rtcLevel {rtc::LS_INFO}; - - switch (level) - { - case Log::Level::None: rtcLevel = rtc::LS_NONE; traceLevel = static_cast(webrtc::kTraceNone); break; - case Log::Level::Basic: rtcLevel = rtc::LS_ERROR; traceLevel = static_cast(webrtc::kTraceCritical | webrtc::kTraceError); break; - case Log::Level::Detail: rtcLevel = rtc::LS_WARNING; traceLevel = static_cast(webrtc::kTraceWarning | webrtc::kTraceError | webrtc::kTraceCritical); break; - case Log::Level::Debug: rtcLevel = rtc::LS_INFO; traceLevel = static_cast(webrtc::kTraceDefault); break; - case Log::Level::Trace: rtcLevel = rtc::LS_VERBOSE; traceLevel = static_cast(webrtc::kTraceDefault | webrtc::kTraceModuleCall | webrtc::kTraceTimer | webrtc::kTraceDebug); break; - case Log::Level::Insane: rtcLevel = rtc::LS_SENSITIVE; traceLevel = static_cast(webrtc::kTraceAll); break; - } - - rtc::LogMessage::RemoveLogToStream(mLogSink.get()); - rtc::LogMessage::AddLogToStream(mLogSink.get(), rtcLevel); - - webrtc::Trace::set_level_filter(traceLevel); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::internalStartMediaTracing() - { - mTraceLog.EnableTraceInternalStorage(); - mTraceLog.StartTracing(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::internalStopMediaTracing() - { - mTraceLog.StopTracing(); - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::internalIsMediaTracing() - { - return mTraceLog.IsTracing(); - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::internalSaveMediaTrace(String filename) - { - return mTraceLog.Save(filename); - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::internalSaveMediaTrace(String host, int port) - { - return mTraceLog.Save(host, port); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::internalAddTraceEvent( - char phase, - const unsigned char *categoryGroupEnabled, - const char *name, - uint64_t id, - int numArgs, - const char **argNames, - const unsigned char *argTypes, - const uint64_t *argValues, - unsigned char flags - ) - { - mTraceLog.Add(phase, categoryGroupEnabled, name, id, - numArgs, argNames, argTypes, argValues, flags); - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::internalIsMRPInstalled() - { - static bool isMRPInstalledValueSet = false; - static bool isMRPInstalled = false; - - if (isMRPInstalledValueSet) - return isMRPInstalled; - - // MFStartup fails when Media Resource Pack is not installed. - if (SUCCEEDED(MFStartup(MF_VERSION))) - { - MFShutdown(); - isMRPInstalled = true; - isMRPInstalledValueSet = true; - } - return isMRPInstalled; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::isReady() const - { - return State_Ready == mCurrentState; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::isShuttingDown() const - { - return State_ShuttingDown == mCurrentState; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::isShutdown() const - { - return State_Shutdown == mCurrentState; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::step() - { - ZS_LOG_DEBUG(debug("step")) - - if ((isShuttingDown()) || - (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) - stepCancel(); - return; - } - - // ... other steps here ... - if (!stepSetup()) goto not_ready; - if (!stepSetupDevices()) goto not_ready; - if (!stepSetupChannels()) goto not_ready; - if (!stepCloseChannels()) goto not_ready; - // ... other steps here ... - - goto ready; - - not_ready: - { - ZS_LOG_TRACE(debug("not ready")) - return; - } - - ready: - { - ZS_LOG_TRACE(log("ready")) - setState(State_Ready); - } - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::stepSetup() - { - if (isReady()) { - ZS_LOG_TRACE(log("already setup")) - return true; - } - - if (!isMRPInstalled()) - return true; - - mVoiceEngine = rtc::scoped_ptr(webrtc::VoiceEngine::Create()); - - webrtc::VoEBase::GetInterface(mVoiceEngine.get())->Init(); - - webrtc::AudioState::Config audioStateConfig; - audioStateConfig.voice_engine = mVoiceEngine.get(); - mAudioState = rtc::scoped_refptr(webrtc::AudioState::Create(audioStateConfig)); - - webrtc::EcModes ecMode = webrtc::kEcConference; - webrtc::AecmModes aecmMode = webrtc::kAecmSpeakerphone; - webrtc::AgcModes agcMode = webrtc::kAgcAdaptiveAnalog; - webrtc::NsModes nsMode = webrtc::kNsHighSuppression; -#if defined(WINRT) - ecMode = webrtc::kEcAecm; -#endif - - if (webrtc::VoEHardware::GetInterface(mVoiceEngine.get())->BuiltInAECIsAvailable()) - webrtc::VoEHardware::GetInterface(mVoiceEngine.get())->EnableBuiltInAEC(true); - webrtc::VoEAudioProcessing::GetInterface(mVoiceEngine.get())->SetEcStatus(true, ecMode); -#if !defined(WINRT) - webrtc::VoEAudioProcessing::GetInterface(mVoiceEngine.get())->SetEcMetricsStatus(true); -#endif - if (ecMode == webrtc::kEcAecm) - webrtc::VoEAudioProcessing::GetInterface(mVoiceEngine.get())->SetAecmMode(aecmMode); - - if (webrtc::VoEHardware::GetInterface(mVoiceEngine.get())->BuiltInAGCIsAvailable()) - webrtc::VoEHardware::GetInterface(mVoiceEngine.get())->EnableBuiltInAGC(true); - webrtc::VoEAudioProcessing::GetInterface(mVoiceEngine.get())->SetAgcStatus(true, agcMode); - - if (webrtc::VoEHardware::GetInterface(mVoiceEngine.get())->BuiltInNSIsAvailable()) - webrtc::VoEHardware::GetInterface(mVoiceEngine.get())->EnableBuiltInNS(true); - webrtc::VoEAudioProcessing::GetInterface(mVoiceEngine.get())->SetNsStatus(true, nsMode); - - webrtc::VoEAudioProcessing::GetInterface(mVoiceEngine.get())->EnableHighPassFilter(true); - - return true; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::stepSetupDevices() - { - if (!isMRPInstalled()) - return true; - - while (mPendingSetupDeviceResources.size() > 0) { - auto deviceResource = mPendingSetupDeviceResources.front(); - - deviceResource->stepSetup(); - - mPendingSetupDeviceResources.pop_front(); - } - - return true; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::stepCloseDevices() - { - if (!isMRPInstalled()) - return true; - - while (mPendingCloseDeviceResources.size() > 0) { - auto deviceResource = mPendingCloseDeviceResources.front(); - - deviceResource->stepShutdown(); - - mPendingCloseDeviceResources.pop_front(); - } - - return true; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::stepSetupChannels() - { - if (!isMRPInstalled()) - return true; - - while (mPendingSetupChannelResources.size() > 0) { - auto channelResource = mPendingSetupChannelResources.front(); - - channelResource->stepSetup(); - - mPendingSetupChannelResources.pop_front(); - } - - return true; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::stepCloseChannels() - { - if (!isMRPInstalled()) - return true; - - while (mPendingCloseChannelResources.size() > 0) { - auto channelResource = mPendingCloseChannelResources.front(); - - channelResource->stepShutdown(); - - mPendingCloseChannelResources.pop_front(); - } - - return true; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::cancel() - { - //....................................................................... - // try to gracefully shutdown - - if (isShutdown()) return; - - setState(State_ShuttingDown); - - if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); - - { - for (auto iter = mPendingSetupChannelResources.begin(); iter != mPendingSetupChannelResources.end(); ++iter) - { - auto channelResource = (*iter); - channelResource->notifyPromisesReject(); - } - mPendingSetupChannelResources.clear(); - } - - if (mGracefulShutdownReference) { - // perform any graceful asynchronous shutdown processes needed and - // re-attempt shutdown again later if needed. - -#define TODO_IMPLEMENT_MEDIA_GRACEFUL_SHUTDOWN 1 -#define TODO_IMPLEMENT_MEDIA_GRACEFUL_SHUTDOWN 2 -// return; - } - - //....................................................................... - // final cleanup (hard shutdown) - - setState(State_Shutdown); - -#define TODO_IMPLEMENT_MEDIA_HARD_SHUTDOWN 1 -#define TODO_IMPLEMENT_MEDIA_HARD_SHUTDOWN 2 - - // resolve any outstanding promises - { - auto registration = mRegistration.lock(); - while (mPendingReady.size() > 0) - { - auto &front = mPendingReady.front(); - if (registration) { - front->resolve(registration); - } else { - front->reject(); - } - mPendingReady.pop_front(); - } - } - - // make sure to cleanup any final reference to self - mGracefulShutdownReference.reset(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::stepCancel() - { - { - for (auto iter = mPendingCloseChannelResources.begin(); iter != mPendingCloseChannelResources.end(); ++iter) - { - auto channelResource = (*iter); - channelResource->stepShutdown(); - } - mPendingCloseChannelResources.clear(); - } - - { - for (auto iter = mChannelResources.begin(); iter != mChannelResources.end(); ++iter) - { - auto channelResource = (*iter).second.lock(); - channelResource->stepShutdown(); - } - - mChannelResources.clear(); - } - cancel(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::setState(States state) - { - if (state == mCurrentState) return; - - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) - - mCurrentState = state; - - if (isReady()) { - auto registration = mRegistration.lock(); - - while (mPendingReady.size() > 0) - { - auto &front = mPendingReady.front(); - if (registration) { - front->resolve(registration->getRTPEngine()); - } else { - front->reject(); - } - mPendingReady.pop_front(); - } - } - -// RTPMediaEnginePtr pThis = mThisWeak.lock(); -// if (pThis) { -// mSubscriptions.delegate()->onRTPMediaEngineStateChanged(pThis, mCurrentState); -// } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::setError(WORD errorCode, const char *inReason) - { - String reason(inReason); - if (reason.isEmpty()) { - reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); - } - - if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) - return; - } - - mLastError = errorCode; - mLastErrorReason = reason; - - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::WebRtcTraceCallback - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::WebRtcTraceCallback::Print(webrtc::TraceLevel trace, const char* message, int length) - { - static const size_t stripLength = 34; - - Log::Severity severity {Log::Severity::Informational}; - Log::Level level {Log::Level::Basic}; - - switch (trace) - { - case webrtc::kTraceNone: level = Log::Level::None; break; - case webrtc::kTraceStateInfo: level = Log::Level::Debug; break; - case webrtc::kTraceCritical: severity = Log::Severity::Fatal; level = Log::Level::Basic; break; - case webrtc::kTraceError: severity = Log::Severity::Error; level = Log::Level::Basic; break; - case webrtc::kTraceWarning: severity = Log::Severity::Warning; level = Log::Level::Detail; break; - case webrtc::kTraceApiCall: level = Log::Level::Debug; break; - case webrtc::kTraceDefault: level = Log::Level::Debug; break; - case webrtc::kTraceModuleCall: level = Log::Level::Trace; break; - case webrtc::kTraceMemory: level = Log::Level::Trace; break; - case webrtc::kTraceTimer: level = Log::Level::Trace; break; - case webrtc::kTraceStream: level = Log::Level::Insane; break; - case webrtc::kTraceDebug: level = Log::Level::Insane; break; - case webrtc::kTraceInfo: level = Log::Level::Insane; break; - case webrtc::kTraceTerseInfo: level = Log::Level::Insane; break; - case webrtc::kTraceAll: level = Log::Level::Insane; break; - } - - // Skip past boilerplate prefix text - if (length < stripLength) { - std::string msg(message, length); - webrtcTrace(Log::Severity::Error, Log::Level::Basic, (std::string("Malformed webrtc log message: ") + msg).c_str()); - } else { - std::string msg(message + (stripLength-1), length - stripLength); - webrtcTrace(severity, level, msg.c_str()); - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::WebRtcTraceCallback - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::WebRtcLogSink::OnLogMessage(const std::string& message) - { - if (message.length() < 1) return; - - bool hasEOL = ('\n' == message[message.length() - 1]); - - std::string msg(message.c_str(), message.length() - (hasEOL ? 1 : 0)); - - webrtcTrace(Log::Severity::Informational, Log::Level::Basic, msg.c_str()); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::BaseResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::BaseResource::BaseResource( - const make_private &, - IRTPMediaEngineRegistrationPtr registration, - RTPMediaEnginePtr engine - ) : - SharedRecursiveLock(engine ? SharedRecursiveLock(engine->getSharedLock()) : SharedRecursiveLock::create()), - MessageQueueAssociator(engine ? engine->getAssociatedMessageQueue() : IORTCForInternal::queueBlockingMediaStartStopThread()), - mMediaEngine(engine), - mRegistration(registration) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::BaseResource::~BaseResource() - { - mThisWeak.reset(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::BaseResource::notifyPromisesResolve() - { - { - AutoRecursiveLock lock(*this); - mNotifiedReady = true; - } - internalFixState(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::BaseResource::notifyPromisesReject() - { - { - AutoRecursiveLock lock(*this); - mNotifiedRejected = true; - } - internalFixState(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::BaseResource => (internal) - #pragma mark - - - //------------------------------------------------------------------------- - IMessageQueuePtr RTPMediaEngine::BaseResource::delegateQueue() - { - return IORTCForInternal::queueORTC(); - } - - //------------------------------------------------------------------------- - PromisePtr RTPMediaEngine::BaseResource::internalSetupPromise(PromisePtr promise) - { - auto lifetime = make_shared(mThisWeak.lock()); - promise->setReferenceHolder(lifetime); - - { - AutoRecursiveLock lock(*this); - mPendingPromises.push_back(promise); - } - internalFixState(); - return promise; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::BaseResource::internalFixState() - { - PendingPromiseList promises; - - { - AutoRecursiveLock lock(*this); - - { - if (mNotifiedRejected) goto prepare_reject_all; - if (mNotifiedReady) goto prepare_resolve_all; - return; - } - - prepare_resolve_all: - { - promises = mPendingPromises; - mPendingPromises.clear(); - goto resolve_all; - } - - prepare_reject_all: - { - promises = mPendingPromises; - mPendingPromises.clear(); - goto reject_all; - } - } - - resolve_all: - { - for (auto iter = promises.begin(); iter != promises.end(); ++iter) { - auto promise = (*iter).lock(); - if (!promise) continue; - promise->resolve(mThisWeak.lock()); - } - return; - } - - reject_all: - { - for (auto iter = promises.begin(); iter != promises.end(); ++iter) { - auto promise = (*iter).lock(); - if (!promise) continue; - promise->reject(); - } - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::DeviceResource::DeviceResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration, - UseMediaStreamTrackPtr track - ) : - BaseResource(priv, registration, registration ? registration->getRTPEngine() : RTPMediaEnginePtr()), - mTrack(track) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::DeviceResource::~DeviceResource() - { - mThisWeak.reset(); // shared pointer to self is no longer valid - - // inform the rtp media engine of this resource no longer being in use - UseEnginePtr engine = getEngine(); - if (engine) { - engine->notifyResourceGone(*this); - } - } - - //------------------------------------------------------------------------- - RTPMediaEngine::DeviceResourcePtr RTPMediaEngine::DeviceResource::create( - IRTPMediaEngineRegistrationPtr registration, - UseMediaStreamTrackPtr track - ) - { - auto pThis = make_shared( - make_private{}, - registration, - track - ); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::lifetimeHolderGone() - { - auto shutdownPromise = shutdown(); - if (shutdownPromise) { - // don't really care about result - shutdownPromise->then(IPromiseDelegateProxy::createNoop(IORTCForInternal::queueBlockingMediaStartStopThread())); - shutdownPromise->background(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::init() - { - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => IRTPMediaEngineDeviceResource - #pragma mark - - //------------------------------------------------------------------------- - String RTPMediaEngine::DeviceResource::getDeviceID() const - { - return mDeviceID; - } - - //------------------------------------------------------------------------- - PromisePtr RTPMediaEngine::DeviceResource::shutdown() - { - PromisePtr promise = getShutdownPromise(); - if (isShutdown()) return promise; - if (mShuttingDown) return promise; - - mShuttingDown = true; - - auto outer = mMediaEngine.lock(); - if (outer) { - outer->shutdownDeviceResource(ZS_DYNAMIC_PTR_CAST(DeviceResource, mThisWeak.lock())); - } else { - stepShutdown(); - } - return promise; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::stop() - { - AutoRecursiveLock lock(*this); - - if (mVideoCaptureModule) { - mVideoCaptureModule->StopCapture(); - mVideoCaptureModule->DeRegisterCaptureDataCallback(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::updateConstraints(PromisePtr promise, TrackConstraintsPtr constraints) - { - auto pThis = ZS_DYNAMIC_PTR_CAST(DeviceResource, mThisWeak.lock()); - IRTPMediaEngineDeviceResourceAsyncDelegateProxy::create(pThis)->onUpdateConstraints(promise, constraints); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) - { - auto pThis = ZS_DYNAMIC_PTR_CAST(DeviceResource, mThisWeak.lock()); - IRTPMediaEngineDeviceResourceAsyncDelegateProxy::create(pThis)->onProvideStats(promise, stats); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) - { - auto track = mTrack.lock(); - if (!track) return; - auto kind = track->kind(); - - AutoRecursiveLock lock(*this); - - if (kind == Kinds::Kind_Video) { - mVideoRenderCallbackReferenceHolder = callback; - mVideoRendererCallback = dynamic_cast(callback.get()); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::renderVideoFrame(VideoFramePtr videoFrame) - { - ++mFramesReceived; - - auto track = mTrack.lock(); - if (!track) return; - - auto settings = track->getSettings(); - if (!settings) return; - - AutoRecursiveLock lock(*this); - - if (mVideoRendererCallback) { - mVideoRendererCallback->RenderFrame(1, *videoFrame); - } - - if (!settings->mWidth.hasValue() || (settings->mWidth != videoFrame->width())) - settings->mWidth = videoFrame->width(); - if (!settings->mHeight.hasValue() || (settings->mHeight != videoFrame->height())) - settings->mHeight = videoFrame->height(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::setFrameCount() - { - AutoRecursiveLock lock(*this); - - if (mFramesSent > 5) { - mAverageFramesSent += mFramesSent; - } - if (mFramesReceived > 5) { - mAverageFramesReceived += mFramesReceived; - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => IRTPMediaEngineDeviceResourceAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::onUpdateConstraints(PromisePtr promise, TrackConstraintsPtr constraints) - { - auto track = mTrack.lock(); - if (!track) return; - - auto settings = track->getSettings(); - if (!settings) return; - - auto kind = track->kind(); - auto remote = track->remote(); - - AutoRecursiveLock lock(*this); - - if (kind == Kinds::Kind_Audio && remote) { - - mDeviceID = constraints->mAdvanced.front()->mDeviceID.mValue.value().mValue.value(); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - int audioDeviceIndex = getAudioDeviceIndex(voiceEngine, mDeviceID); - - if (webrtc::VoEHardware::GetInterface(voiceEngine)->SetPlayoutDevice(audioDeviceIndex) == -1) { - return; - } - - settings->mDeviceID = mDeviceID; - } - - promise->resolve(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) - { - auto track = mTrack.lock(); - if (!track) return; - - auto remote = track->remote(); - auto id = track->id(); - - auto settings = track->getSettings(); - if (!settings) return; - - AutoRecursiveLock lock(*this); - - UseStatsReport::StatMap reportStats; - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_Track)) { - - auto report = make_shared(); - - decltype(report->mFramesPerSecond) framesPerSecond{}; - - if (!remote) - framesPerSecond = mAverageFramesSent.value(); - else - framesPerSecond = mAverageFramesReceived.value(); - - report->mID = id; - report->mTrackID = id; - report->mRemoteSource = remote; - report->mFrameWidth = settings->mWidth.hasValue() ? settings->mWidth : 0; - report->mFrameHeight = settings->mHeight.hasValue() ? settings->mHeight : 0; - report->mFramesPerSecond = framesPerSecond; - report->mFramesSent = mFramesSent; - report->mFramesReceived = mFramesReceived; - report->mAudioLevel = 0.0; - - reportStats[report->mID] = report; - } - - promise->resolve(UseStatsReport::create(reportStats)); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::onCapturedVideoFrame(VideoFramePtr frame) - { - UseMediaStreamTrackPtr track = mTrack.lock(); - - { - AutoRecursiveLock lock(*this); - - if (mVideoRendererCallback) mVideoRendererCallback->RenderFrame(1, *frame); - } - - if (!track) return; - - track->sendCapturedVideoFrame(frame); - ++mFramesSent; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => friend RTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::stepSetup() - { - auto track = mTrack.lock(); - if (!track) { - notifyPromisesReject(); - return; - } - - auto settings = track->getSettings(); - if (!settings) { - notifyPromisesReject(); - return; - } - - auto kind = track->kind(); - auto remote = track->remote(); - - auto constraints = track->getConstraints(); - auto pThis = ZS_DYNAMIC_PTR_CAST(DeviceResource, mThisWeak.lock()); - - AutoRecursiveLock lock(*this); - - mTransport = VideoCaptureTransport::create(pThis); - - if (kind == Kinds::Kind_Video && !remote) { - if (!constraints) { - notifyPromisesReject(); - return; - } - - mDeviceID = constraints->mAdvanced.front()->mDeviceID.mValue.value().mValue.value(); - mVideoCaptureModule = webrtc::VideoCaptureFactory::Create(0, mDeviceID.c_str()); - if (!mVideoCaptureModule) { - return; - } - - mVideoCaptureModule->AddRef(); - - mVideoCaptureModule->RegisterCaptureDataCallback(*mTransport); - - webrtc::VideoCaptureModule::DeviceInfo* info = webrtc::VideoCaptureFactory::CreateDeviceInfo(0); - if (!info) return; - - std::list capabilityCandidates; - int32_t numCapabilities = info->NumberOfCapabilities(mDeviceID.c_str()); - for (INT i = 0; i < numCapabilities; ++i) { - webrtc::VideoCaptureCapability capability; - if (info->GetCapability(mDeviceID.c_str(), i, capability) == -1) - continue; - ConstrainLongRange widthRange; - ConstrainLongRange heightRange; - if (constraints->mWidth.mValue.hasValue()) - widthRange.mIdeal = constraints->mWidth.mValue.value(); - if (constraints->mHeight.mValue.hasValue()) - heightRange.mIdeal = constraints->mHeight.mValue.value(); - if (constraints->mWidth.mRange.hasValue()) - widthRange = constraints->mWidth.mRange; - if (constraints->mHeight.mRange.hasValue()) - heightRange = constraints->mHeight.mRange; - FLOAT sizeDistance = calculateSizeDistance(widthRange, heightRange, capability); - if (sizeDistance == FLT_MAX) - continue; - ConstrainDoubleRange frameRateRange; - if (constraints->mFrameRate.mValue.hasValue()) - frameRateRange.mIdeal = constraints->mFrameRate.mValue.value(); - if (constraints->mFrameRate.mRange.hasValue()) - frameRateRange = constraints->mFrameRate.mRange; - FLOAT frameRateDistance = calculateFrameRateDistance(frameRateRange, capability); - if (frameRateDistance == FLT_MAX) - continue; - ConstrainDoubleRange aspectRatioRange; - if (constraints->mAspectRatio.mValue.hasValue()) - aspectRatioRange.mIdeal = constraints->mAspectRatio.mValue.value(); - if (constraints->mAspectRatio.mRange.hasValue()) - aspectRatioRange = constraints->mAspectRatio.mRange; - FLOAT aspectRatioDistance = calculateAspectRatioDistance(aspectRatioRange, capability); - if (aspectRatioDistance == FLT_MAX) - continue; - FLOAT formatDistance = calculateFormatDistance(capability); - FLOAT totalDistance = 200.0F * sizeDistance + 20.0F * frameRateDistance + 10.0F * aspectRatioDistance + formatDistance; - VideoCaptureCapabilityWithDistance capabilityWithDistance; - capabilityWithDistance.mCapability = capability; - capabilityWithDistance.mDistance = totalDistance; - capabilityCandidates.push_back(capabilityWithDistance); - } - delete info; - - std::list advancedCapabilityCandidates; - std::list::iterator constraintsIter = constraints->mAdvanced.begin(); - while (constraintsIter != constraints->mAdvanced.end()) { - std::list::iterator capabilityCandidatesIter = capabilityCandidates.begin(); - while (capabilityCandidatesIter != capabilityCandidates.end()) { - ConstrainLongRange widthRange; - ConstrainLongRange heightRange; - if ((*constraintsIter)->mWidth.mValue.hasValue()) - widthRange.mExact = (*constraintsIter)->mWidth.mValue.value(); - if ((*constraintsIter)->mHeight.mValue.hasValue()) - heightRange.mExact = (*constraintsIter)->mHeight.mValue.value(); - if ((*constraintsIter)->mWidth.mRange.hasValue()) - widthRange = (*constraintsIter)->mWidth.mRange; - if ((*constraintsIter)->mHeight.mRange.hasValue()) - heightRange = (*constraintsIter)->mHeight.mRange; - FLOAT sizeDistance = calculateSizeDistance(widthRange, heightRange, capabilityCandidatesIter->mCapability); - if (sizeDistance == FLT_MAX) { - capabilityCandidatesIter++; - continue; - } - ConstrainDoubleRange frameRateRange; - if ((*constraintsIter)->mFrameRate.mValue.hasValue()) - frameRateRange.mExact = (*constraintsIter)->mFrameRate.mValue.value(); - if ((*constraintsIter)->mFrameRate.mRange.hasValue()) - frameRateRange = (*constraintsIter)->mFrameRate.mRange; - FLOAT frameRateDistance = calculateFrameRateDistance(frameRateRange, capabilityCandidatesIter->mCapability); - if (frameRateDistance == FLT_MAX) { - capabilityCandidatesIter++; - continue; - } - ConstrainDoubleRange aspectRatioRange; - if ((*constraintsIter)->mAspectRatio.mValue.hasValue()) - aspectRatioRange.mExact = (*constraintsIter)->mAspectRatio.mValue.value(); - if ((*constraintsIter)->mAspectRatio.mRange.hasValue()) - aspectRatioRange = (*constraintsIter)->mAspectRatio.mRange; - FLOAT aspectRatioDistance = calculateAspectRatioDistance(aspectRatioRange, capabilityCandidatesIter->mCapability); - if (aspectRatioDistance == FLT_MAX) { - capabilityCandidatesIter++; - continue; - } - FLOAT formatDistance = calculateFormatDistance(capabilityCandidatesIter->mCapability); - FLOAT totalDistance = 200.0F * sizeDistance + 20.0F * frameRateDistance + 10.0F * aspectRatioDistance + formatDistance; - VideoCaptureCapabilityWithDistance capabilityWithDistance; - capabilityWithDistance.mCapability = capabilityCandidatesIter->mCapability; - capabilityWithDistance.mDistance = totalDistance; - advancedCapabilityCandidates.push_back(capabilityWithDistance); - capabilityCandidatesIter++; - } - if (advancedCapabilityCandidates.size() > 0) - break; - constraintsIter++; - } - - FLOAT bestDistance = FLT_MAX; - webrtc::VideoCaptureCapability bestCapability; - if (advancedCapabilityCandidates.size() > 0) { - std::list::iterator advancedCapabilityCandidatesIter = advancedCapabilityCandidates.begin(); - while (advancedCapabilityCandidatesIter != advancedCapabilityCandidates.end()) { - if (advancedCapabilityCandidatesIter->mDistance <= bestDistance) { - bestDistance = advancedCapabilityCandidatesIter->mDistance; - bestCapability = advancedCapabilityCandidatesIter->mCapability; - } - advancedCapabilityCandidatesIter++; - } - } else if (advancedCapabilityCandidates.size() > 0) { - std::list::iterator capabilityCandidatesIter = capabilityCandidates.begin(); - while (capabilityCandidatesIter != capabilityCandidates.end()) { - if (capabilityCandidatesIter->mDistance <= bestDistance) { - bestDistance = capabilityCandidatesIter->mDistance; - bestCapability = capabilityCandidatesIter->mCapability; - } - capabilityCandidatesIter++; - } - } - - if (bestDistance == FLT_MAX) - return; - - settings->mWidth = bestCapability.width; - settings->mHeight = bestCapability.height; - settings->mFrameRate = bestCapability.maxFPS; - settings->mDeviceID = mDeviceID; - - if (mVideoCaptureModule->StartCapture(bestCapability) != 0) { - mVideoCaptureModule->DeRegisterCaptureDataCallback(); - return; - } - } else if (kind == Kinds::Kind_Audio && !remote) { - - if (!constraints) { - notifyPromisesReject(); - return; - } - - mDeviceID = constraints->mAdvanced.front()->mDeviceID.mValue.value().mValue.value(); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - int audioDeviceIndex = getAudioDeviceIndex(voiceEngine, mDeviceID); - - if (webrtc::VoEHardware::GetInterface(voiceEngine)->SetRecordingDevice(audioDeviceIndex) == -1) { - return; - } - - settings->mDeviceID = mDeviceID; - } - - notifyPromisesResolve(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::stepShutdown() - { - mDenyNonLockedAccess = true; - - // rare race condition that can happen so - while (mAccessFromNonLockedMethods > 0) - { - // NOTE: very temporary lock so should clear itself out fast - std::this_thread::yield(); - } - - //AutoRecursiveLock lock(*this); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => (internal friend derived) - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::notifyPromisesShutdown() - { - AutoRecursiveLock lock(*this); - - mShutdown = true; - mShuttingDown = false; - - for (auto iter = mShutdownPromises.begin(); iter != mShutdownPromises.end(); ++iter) { - auto promise = (*iter); - promise->resolve(); - } - mShutdownPromises.clear(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => friend VideoCaptureTransport - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::OnIncomingCapturedFrame(const int32_t id, const webrtc::VideoFrame& videoFrame) - { - auto newFrame = make_shared(); - newFrame->ShallowCopy(videoFrame); - - auto pThis = ZS_DYNAMIC_PTR_CAST(DeviceResource, mThisWeak.lock()); - - IRTPMediaEngineDeviceResourceAsyncDelegateProxy::create(pThis)->onCapturedVideoFrame(newFrame); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::OnCaptureDelayChanged(const int32_t id, const int32_t delay) - { -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource::VideoCaptureTransport - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::DeviceResource::VideoCaptureTransport::VideoCaptureTransport( - const make_private &, - DeviceResourcePtr outer - ) : - mOuter(outer) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::DeviceResource::VideoCaptureTransport::~VideoCaptureTransport() - { - mThisWeak.reset(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::VideoCaptureTransport::init() - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::DeviceResource::VideoCaptureTransportPtr RTPMediaEngine::DeviceResource::VideoCaptureTransport::create(DeviceResourcePtr outer) - { - VideoCaptureTransportPtr pThis(make_shared(make_private{}, outer)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource::Transport => webrtc::VideoCaptureDataCallback - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::VideoCaptureTransport::OnIncomingCapturedFrame(const int32_t id, const webrtc::VideoFrame& videoFrame) - { - auto outer = mOuter.lock(); - if (!outer) return; - return outer->OnIncomingCapturedFrame(id, videoFrame); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::DeviceResource::VideoCaptureTransport::OnCaptureDelayChanged(const int32_t id, const int32_t delay) - { - auto outer = mOuter.lock(); - if (!outer) return; - return outer->OnCaptureDelayChanged(id, delay); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => (internal) - #pragma mark - - //------------------------------------------------------------------------- - PromisePtr RTPMediaEngine::DeviceResource::getShutdownPromise() - { - if (isShutdown()) { - return Promise::createResolved(delegateQueue()); - } - PromisePtr promise = Promise::create(delegateQueue()); - mShutdownPromises.push_back(promise); - return promise; - } - - int RTPMediaEngine::DeviceResource::getAudioDeviceIndex(webrtc::VoiceEngine *voiceEngine, String deviceID) - { - int devices; - if (webrtc::VoEHardware::GetInterface(voiceEngine)->GetNumOfRecordingDevices(devices) != 0) { - return -1; - } - int index = -1; - char deviceName[128]; - char deviceUniqueId[128]; - for (int i = 0; i < devices; i++) { - webrtc::VoEHardware::GetInterface(voiceEngine)->GetRecordingDeviceName(i, deviceName, deviceUniqueId); - if (0 == String(deviceUniqueId).compareNoCase(deviceID)) { - index = i; - break; - } - } - return index; - } - - //------------------------------------------------------------------------- - FLOAT RTPMediaEngine::DeviceResource::calculateSizeDistance( - ConstrainLongRange width, - ConstrainLongRange height, - webrtc::VideoCaptureCapability capability - ) - { - if (width.mMin.hasValue() && width.mMin.value() > capability.width) - return FLT_MAX; - if (width.mMax.hasValue() && width.mMax.value() < capability.width) - return FLT_MAX; - if (width.mExact.hasValue() && width.mExact.value() != capability.width) - return FLT_MAX; - FLOAT withDistance = 0.0F; - if (width.mIdeal.hasValue() && width.mIdeal.value() != capability.width) { - withDistance = (FLOAT)(abs((int)(capability.width - width.mIdeal.value()))) / (FLOAT)width.mIdeal.value(); - } - - if (height.mMin.hasValue() && height.mMin.value() > capability.height) - return FLT_MAX; - if (height.mMax.hasValue() && height.mMax.value() < capability.height) - return FLT_MAX; - if (height.mExact.hasValue() && height.mExact.value() != capability.height) - return FLT_MAX; - FLOAT heightDistance = 0.0F; - if (height.mIdeal.hasValue() && height.mIdeal.value() != capability.height) { - heightDistance = (FLOAT)(abs((int)(capability.height - height.mIdeal.value()))) / (FLOAT)height.mIdeal.value(); - } - - - return withDistance + heightDistance; - } - - //------------------------------------------------------------------------- - FLOAT RTPMediaEngine::DeviceResource::calculateFrameRateDistance( - ConstrainDoubleRange frameRate, - webrtc::VideoCaptureCapability capability - ) - { - if (frameRate.mMin.hasValue() && frameRate.mMin.value() > (DOUBLE)capability.maxFPS) - return FLT_MAX; - if (frameRate.mMax.hasValue() && frameRate.mMax.value() < (DOUBLE)capability.maxFPS) - return FLT_MAX; - if (frameRate.mExact.hasValue() && fabs(frameRate.mExact.value() - (DOUBLE)capability.maxFPS) > 0.01F) - return FLT_MAX; - FLOAT frameRateDistance = 0.0F; - if (frameRate.mIdeal.hasValue() && fabs(frameRate.mExact.value() - (DOUBLE)capability.maxFPS) > 0.01F) { - frameRateDistance = (FLOAT)(abs((int)(capability.maxFPS - frameRate.mIdeal.value()))) / (FLOAT)frameRate.mIdeal.value(); - } - - return frameRateDistance; - } - - //------------------------------------------------------------------------- - FLOAT RTPMediaEngine::DeviceResource::calculateAspectRatioDistance( - ConstrainDoubleRange aspectRatio, - webrtc::VideoCaptureCapability capability - ) - { - DOUBLE capabilityAspectRatio = (DOUBLE)capability.width / (DOUBLE)capability.height; - - if (aspectRatio.mMin.hasValue() && aspectRatio.mMin.value() > capabilityAspectRatio) - return FLT_MAX; - if (aspectRatio.mMax.hasValue() && aspectRatio.mMax.value() < capabilityAspectRatio) - return FLT_MAX; - if (aspectRatio.mExact.hasValue() && fabs(aspectRatio.mExact.value() - capabilityAspectRatio) > 0.001F) - return FLT_MAX; - FLOAT aspectRatioDistance = 0.0F; - if (aspectRatio.mIdeal.hasValue() && fabs(aspectRatio.mIdeal.value() - capabilityAspectRatio) > 0.001F) { - aspectRatioDistance = static_cast((capabilityAspectRatio - aspectRatio.mIdeal.value()) / aspectRatio.mIdeal.value()); - } - - return aspectRatioDistance; - } - - //------------------------------------------------------------------------- - FLOAT RTPMediaEngine::DeviceResource::calculateFormatDistance(webrtc::VideoCaptureCapability capability) - { - switch (capability.rawType) { - case webrtc::kVideoI420: - case webrtc::kVideoYV12: - case webrtc::kVideoYUY2: - case webrtc::kVideoUYVY: - case webrtc::kVideoIYUV: - case webrtc::kVideoARGB: - case webrtc::kVideoRGB24: - case webrtc::kVideoRGB565: - case webrtc::kVideoARGB4444: - case webrtc::kVideoARGB1555: - case webrtc::kVideoNV12: - case webrtc::kVideoNV21: - case webrtc::kVideoBGRA: - return 0.0F; - case webrtc::kVideoMJPEG: - return 1.0F; - default: - return FLT_MAX; - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::ChannelResource::ChannelResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration - ) : - BaseResource(priv, registration, registration ? registration->getRTPEngine() : RTPMediaEnginePtr()), - mHandlePacketQueue(IORTCForInternal::queuePacket()), - mClock(webrtc::Clock::GetRealTimeClock()), - mRemb(mClock) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::ChannelResource::~ChannelResource() - { - mThisWeak.reset(); - UseEnginePtr engine = getEngine(); - if (engine) { - engine->notifyResourceGone(*this); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::ChannelResource::lifetimeHolderGone() - { - auto shutdownPromise = shutdown(); - if (shutdownPromise) { - // don't really care about result - shutdownPromise->then(IPromiseDelegateProxy::createNoop(IORTCForInternal::queueBlockingMediaStartStopThread())); - shutdownPromise->background(); - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - //------------------------------------------------------------------------- - PromisePtr RTPMediaEngine::ChannelResource::shutdown() - { - PromisePtr promise = getShutdownPromise(); - if (isShutdown()) return promise; - if (mShuttingDown) return promise; - - mShuttingDown = true; - - auto outer = mMediaEngine.lock(); - if (outer) { - outer->shutdownChannelResource(ZS_DYNAMIC_PTR_CAST(ChannelResource, mThisWeak.lock())); - } else { - stepShutdown(); - } - return promise; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::ChannelResource::notifyTransportState(ISecureTransportTypes::States state) - { - auto pThis = ZS_DYNAMIC_PTR_CAST(ChannelResource, mThisWeak.lock()); - IRTPMediaEngineChannelResourceAsyncDelegateProxy::create(pThis)->onSecureTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::ChannelResource::notifyUpdate(ParametersPtr param) - { - auto pThis = ZS_DYNAMIC_PTR_CAST(ChannelResource, mThisWeak.lock()); - IRTPMediaEngineChannelResourceAsyncDelegateProxy::create(pThis)->onUpdate(param); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::ChannelResource::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) - { - auto pThis = ZS_DYNAMIC_PTR_CAST(ChannelResource, mThisWeak.lock()); - IRTPMediaEngineChannelResourceAsyncDelegateProxy::create(pThis)->onProvideStats(promise, stats); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => (internal friend derived) - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::ChannelResource::notifyPromisesShutdown() - { - AutoRecursiveLock lock(*this); - - mShutdown = true; - mShuttingDown = false; - - for (auto iter = mShutdownPromises.begin(); iter != mShutdownPromises.end(); ++iter) { - auto promise = (*iter); - promise->resolve(); - } - mShutdownPromises.clear(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => (internal) - #pragma mark - - //------------------------------------------------------------------------- - PromisePtr RTPMediaEngine::ChannelResource::getShutdownPromise() - { - if (isShutdown()) { - return Promise::createResolved(delegateQueue()); - } - PromisePtr promise = Promise::create(delegateQueue()); - mShutdownPromises.push_back(promise); - return promise; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::AudioReceiverChannelResource::AudioReceiverChannelResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ) : - ChannelResource(priv, registration), - mTransport(transport), - mTrack(track), - mParameters(parameters), - mInitPacket(packet) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::AudioReceiverChannelResource::~AudioReceiverChannelResource() - { - mThisWeak.reset(); // shared pointer to self is no longer valid - } - - //------------------------------------------------------------------------- - RTPMediaEngine::AudioReceiverChannelResourcePtr RTPMediaEngine::AudioReceiverChannelResource::create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ) - { - auto pThis = make_shared( - make_private{}, - registration, - transport, - track, - parameters, - packet - ); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::init() - { - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::onSecureTransportState(ISecureTransport::States state) - { - AutoRecursiveLock lock(*this); - - if (state == mTransportState) return; - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - ISecureTransport::States previousState = mTransportState; - mTransportState = state; - if (mParameters && (mParameters->mEncodings.size() == 0 || - (mParameters->mEncodings.size() > 0 && mParameters->mEncodings.begin()->mActive))) { - if (state == ISecureTransport::State_Connected) { - webrtc::VoEBase::GetInterface(voiceEngine)->StartReceive(mChannel); - webrtc::VoEBase::GetInterface(voiceEngine)->StartPlayout(mChannel); - } else if (previousState == ISecureTransport::State_Connected) { - webrtc::VoEBase::GetInterface(voiceEngine)->StopPlayout(mChannel); - webrtc::VoEBase::GetInterface(voiceEngine)->StopReceive(mChannel); - } - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::onUpdate(ParametersPtr params) - { - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - ParametersPtr previousParams = mParameters; - mParameters = params; - bool previousActive = false; - bool currentActive = false; - if (previousParams->mEncodings.size() == 0 || - (previousParams->mEncodings.size() > 0 && previousParams->mEncodings.begin()->mActive)) { - previousActive = true; - } - if (params->mEncodings.size() == 0 || - (params->mEncodings.size() > 0 && params->mEncodings.begin()->mActive)) { - currentActive = true; - } - if (mTransportState == ISecureTransport::State_Connected) { - if (!previousActive && currentActive) { - webrtc::VoEBase::GetInterface(voiceEngine)->StartReceive(mChannel); - webrtc::VoEBase::GetInterface(voiceEngine)->StartPlayout(mChannel); - } else if (previousActive && !currentActive) { - webrtc::VoEBase::GetInterface(voiceEngine)->StopPlayout(mChannel); - webrtc::VoEBase::GetInterface(voiceEngine)->StopReceive(mChannel); - } - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) - { - AutoRecursiveLock lock(*this); - - UseStatsReport::StatMap reportStats; - - webrtc::AudioReceiveStream::Stats receiveStreamStats = mReceiveStream->GetStats(); - - auto track = mTrack.lock(); - if (!track) { - return; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_InboundRTP)) { - - auto report = make_shared(); - - report->mID = string(receiveStreamStats.remote_ssrc) + "_recv"; - - report->mSSRC = receiveStreamStats.remote_ssrc; - report->mIsRemote = true; - report->mMediaType = "audio"; - report->mMediaTrackID = track->id(); - report->mCodecID = mCodecPayloadName; - report->mPacketsReceived = receiveStreamStats.packets_rcvd; - report->mBytesReceived = receiveStreamStats.bytes_rcvd; - report->mPacketsLost = receiveStreamStats.packets_lost; - report->mJitter = receiveStreamStats.jitter_ms; - report->mFractionLost = receiveStreamStats.fraction_lost; -#ifdef WINRT - report->mEndToEndDelay = Milliseconds(receiveStreamStats.end_to_end_delayMs); -#endif - reportStats[report->mID] = report; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_Codec)) { - - auto report = make_shared(); - - report->mID = string(receiveStreamStats.remote_ssrc) + "_recv_codec"; - - report->mPayloadType = mCodecPayloadType; - report->mCodec = mCodecPayloadName; - report->mClockRate = 0; - report->mChannels = 0; - - reportStats[report->mID] = report; - } - - promise->resolve(UseStatsReport::create(reportStats)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineAudioReceiverChannelResource - #pragma mark - - //------------------------------------------------------------------------- - bool RTPMediaEngine::AudioReceiverChannelResource::handlePacket(const RTPPacket &packet) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onHandleRTPPacket(packet.timestamp(), packet.buffer()); - return true; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::AudioReceiverChannelResource::handlePacket(const RTCPPacket &packet) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onHandleRTCPPacket(packet.buffer()); - return true; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - webrtc::PacketTime time(timestamp, 0); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - webrtc::VoENetwork::GetInterface(voiceEngine)->ReceivedRTPPacket(getChannel(), buffer->BytePtr(), buffer->SizeInBytes(), time); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::onHandleRTCPPacket(SecureByteBlockPtr buffer) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - webrtc::VoENetwork::GetInterface(voiceEngine)->ReceivedRTCPPacket(getChannel(), buffer->BytePtr(), buffer->SizeInBytes()); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => webrtc::BitrateObserver - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) - { - AutoRecursiveLock lock(*this); - - mCurrentTargetBitrate = targetBitrateBps; - - uint32_t allocatedBitrateBps = mBitrateAllocator->OnNetworkChanged( - targetBitrateBps, - fractionLoss, - rttMs - ); - - int padUpToBitrateBps = 0; - uint32_t pacerBitrateBps = std::max(targetBitrateBps, allocatedBitrateBps); - - if (mCongestionController) - mCongestionController->UpdatePacerBitrate( - targetBitrateBps / 1000, - webrtc::PacedSender::kDefaultPaceMultiplier * pacerBitrateBps / 1000, - padUpToBitrateBps / 1000 - ); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => friend RTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::stepSetup() - { - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (!engine) { - notifyPromisesReject(); - return; - } - - auto voiceEngine = engine->getVoiceEngine(); - if (NULL == voiceEngine) { - notifyPromisesReject(); - return; - } - - auto audioState = engine->getAudioState(); - - mModuleProcessThread = webrtc::ProcessThread::Create("AudioReceiverChannelResourceModuleProcessThread"); - mPacerThread = webrtc::ProcessThread::Create("AudioReceiverChannelResourcePacerThread"); - - mBitrateAllocator = rtc::scoped_ptr(new webrtc::BitrateAllocator()); - mCallStats = rtc::scoped_ptr(new webrtc::CallStats(mClock)); - mCongestionController = - rtc::scoped_ptr(new webrtc::CongestionController( - mClock, - this, - &mRemb - )); - - mCallStats->RegisterStatsObserver(mCongestionController.get()); - - mChannel = webrtc::VoEBase::GetInterface(voiceEngine)->CreateChannel(); - - bool audioCodecSet = false; - webrtc::CodecInst codec; - for (auto codecIter = mParameters->mCodecs.begin(); codecIter != mParameters->mCodecs.end(); codecIter++) { - auto supportedCodec = IRTPTypes::toSupportedCodec(codecIter->mName); - if (IRTPTypes::getCodecKind(supportedCodec) == IRTPTypes::CodecKind_Audio && audioCodecSet) - continue; - codec = getAudioCodec(voiceEngine, codecIter->mName); - codec.pltype = codecIter->mPayloadType; - if (codecIter->mPTime != Milliseconds::zero()) - codec.pacsize = (codec.plfreq / 1000) * codecIter->mPTime.count(); - if (codecIter->mNumChannels.hasValue()) - codec.channels = codecIter->mNumChannels; - switch (supportedCodec) { - case IRTPTypes::SupportedCodec_Opus: - codec.rate = 48000; - webrtc::VoECodec::GetInterface(voiceEngine)->SetRecPayloadType(mChannel, codec); - goto set_rtcp_feedback; - case IRTPTypes::SupportedCodec_Isac: - case IRTPTypes::SupportedCodec_G722: - case IRTPTypes::SupportedCodec_ILBC: - case IRTPTypes::SupportedCodec_PCMU: - case IRTPTypes::SupportedCodec_PCMA: - webrtc::VoECodec::GetInterface(voiceEngine)->SetRecPayloadType(mChannel, codec); - goto set_rtcp_feedback; - case IRTPTypes::SupportedCodec_RED: - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetREDStatus(mChannel, true, codecIter->mPayloadType); - break; - } - continue; - - set_rtcp_feedback: - for (auto rtcpFeedbackIter = codecIter->mRTCPFeedback.begin(); rtcpFeedbackIter != codecIter->mRTCPFeedback.end(); rtcpFeedbackIter++) { - IRTPTypes::KnownFeedbackTypes feedbackType = IRTPTypes::toKnownFeedbackType(rtcpFeedbackIter->mType); - IRTPTypes::KnownFeedbackParameters feedbackParameter = IRTPTypes::toKnownFeedbackParameter(rtcpFeedbackIter->mParameter); - if (IRTPTypes::KnownFeedbackType_NACK == feedbackType && IRTPTypes::KnownFeedbackParameter_Unknown == feedbackParameter) { - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetNACKStatus(mChannel, true, 250); - } - } - audioCodecSet = true; - } - - mCodecPayloadName = codec.plname; - mCodecPayloadType = codec.pltype; - - webrtc::AudioReceiveStream::Config config; - config.voe_channel_id = mChannel; - - for (auto encodingParamIter = mParameters->mEncodings.begin(); encodingParamIter != mParameters->mEncodings.end(); encodingParamIter++) { - - IRTPTypes::PayloadType codecPayloadType {}; - if (encodingParamIter->mCodecPayloadType.hasValue()) - codecPayloadType = encodingParamIter->mCodecPayloadType; - else - codecPayloadType = codec.pltype; - - if (codecPayloadType == codec.pltype) { - uint32_t ssrc = 0; - if (encodingParamIter->mSSRC.hasValue()) - ssrc = encodingParamIter->mSSRC; - if (encodingParamIter->mFEC.hasValue()) { - IRTPTypes::FECParameters fec = encodingParamIter->mFEC; - if (fec.mSSRC.hasValue()) - ssrc = fec.mSSRC; - } - config.rtp.remote_ssrc = ssrc; - } - } - if (config.rtp.remote_ssrc == 0) { - config.rtp.remote_ssrc = mInitPacket->ssrc(); - mInitPacket.reset(); - } - - for (auto headerExtensionIter = mParameters->mHeaderExtensions.begin(); headerExtensionIter != mParameters->mHeaderExtensions.end(); headerExtensionIter++) { - IRTPTypes::HeaderExtensionURIs headerExtensionURI = IRTPTypes::toHeaderExtensionURI(headerExtensionIter->mURI); - switch (headerExtensionURI) { - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_ClienttoMixerAudioLevelIndication: - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetReceiveAudioLevelIndicationStatus(mChannel, true, headerExtensionIter->mID); - config.rtp.extensions.push_back(webrtc::RtpExtension(headerExtensionIter->mURI, headerExtensionIter->mID)); - break; - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_AbsoluteSendTime: - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetReceiveAbsoluteSenderTimeStatus(mChannel, true, headerExtensionIter->mID); - config.rtp.extensions.push_back(webrtc::RtpExtension(headerExtensionIter->mURI, headerExtensionIter->mID)); - break; - default: - break; - } - } - - uint32_t localSSRC = mParameters->mRTCP.mSSRC; - if (localSSRC == 0) - localSSRC = 1; - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetLocalSSRC(mChannel, localSSRC); - config.rtp.local_ssrc = localSSRC; - config.receive_transport = mTransport.get(); - config.rtcp_send_transport = mTransport.get(); - - mModuleProcessThread->Start(); - mModuleProcessThread->RegisterModule(mCallStats.get()); - mModuleProcessThread->RegisterModule(mCongestionController.get()); - mPacerThread->RegisterModule(mCongestionController->pacer()); - mPacerThread->RegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mPacerThread->Start(); - - mReceiveStream = rtc::scoped_ptr( - new webrtc::internal::AudioReceiveStream( - mCongestionController.get(), - config, - audioState - )); - - webrtc::VoENetwork::GetInterface(voiceEngine)->RegisterExternalTransport(mChannel, *mTransport); - - if (mTransportState == ISecureTransport::State_Connected) { - webrtc::VoEBase::GetInterface(voiceEngine)->StartReceive(mChannel); - webrtc::VoEBase::GetInterface(voiceEngine)->StartPlayout(mChannel); - } - - notifyPromisesResolve(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioReceiverChannelResource::stepShutdown() - { - mDenyNonLockedAccess = true; - - // rare race condition that can happen so - while (mAccessFromNonLockedMethods > 0) - { - // NOTE: very temporary lock so should clear itself out fast - std::this_thread::yield(); - } - - AutoRecursiveLock lock(*this); - - auto outer = mMediaEngine.lock(); - - if (outer) { - auto voiceEngine = outer->getVoiceEngine(); - if (voiceEngine) { - if (mTransportState == ISecureTransport::State_Connected) { - webrtc::VoEBase::GetInterface(voiceEngine)->StopPlayout(mChannel); - webrtc::VoEBase::GetInterface(voiceEngine)->StopReceive(mChannel); - } - webrtc::VoENetwork::GetInterface(voiceEngine)->DeRegisterExternalTransport(mChannel); - } - } - - mPacerThread->Stop(); - mPacerThread->DeRegisterModule(mCongestionController->pacer()); - mPacerThread->DeRegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mModuleProcessThread->DeRegisterModule(mCongestionController.get()); - mModuleProcessThread->DeRegisterModule(mCallStats.get()); - mModuleProcessThread->Stop(); - - mCallStats->DeregisterStatsObserver(mCongestionController.get()); - - mReceiveStream.reset(); - mCongestionController.reset(); - mCallStats.reset(); - mBitrateAllocator.reset(); - mModuleProcessThread.reset(); - mPacerThread.reset(); - - notifyPromisesShutdown(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => (internal) - #pragma mark - - //------------------------------------------------------------------------- - int RTPMediaEngine::AudioReceiverChannelResource::getChannel() const - { - return mChannel; - } - - //------------------------------------------------------------------------- - webrtc::CodecInst RTPMediaEngine::AudioReceiverChannelResource::getAudioCodec( - webrtc::VoiceEngine *voiceEngine, - String payloadName - ) - { - webrtc::CodecInst codec; - int numOfCodecs = webrtc::VoECodec::GetInterface(voiceEngine)->NumOfCodecs(); - for (int i = 0; i < numOfCodecs; ++i) { - webrtc::CodecInst currentCodec; - webrtc::VoECodec::GetInterface(voiceEngine)->GetCodec(i, currentCodec); - if (0 == String(currentCodec.plname).compareNoCase(payloadName)) { - codec = currentCodec; - break; - } - } - - return codec; - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::AudioSenderChannelResource::AudioSenderChannelResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ) : - ChannelResource(priv, registration), - mTransport(transport), - mTrack(track), - mParameters(parameters), - mDTMFSenderDelegate(IDTMFSenderDelegateProxy::createWeak(dtmfDelegate)) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::AudioSenderChannelResource::~AudioSenderChannelResource() - { - mThisWeak.reset(); // shared pointer to self is no longer valid - } - - //------------------------------------------------------------------------- - RTPMediaEngine::AudioSenderChannelResourcePtr RTPMediaEngine::AudioSenderChannelResource::create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ) - { - auto pThis = make_shared( - make_private{}, - registration, - transport, - track, - parameters, - dtmfDelegate - ); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::init() - { - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::onSecureTransportState(ISecureTransport::States state) - { - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - ISecureTransport::States previousState = mTransportState; - mTransportState = state; - if (mParameters && (mParameters->mEncodings.size() == 0 || - (mParameters->mEncodings.size() > 0 && mParameters->mEncodings.begin()->mActive))) { - if (state == ISecureTransport::State_Connected) { - webrtc::VoEBase::GetInterface(voiceEngine)->StartSend(mChannel); - } else if (previousState == ISecureTransport::State_Connected) { - webrtc::VoEBase::GetInterface(voiceEngine)->StopSend(mChannel); - } - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::onUpdate(ParametersPtr params) - { - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - ParametersPtr previousParams = mParameters; - mParameters = params; - bool previousActive = false; - bool currentActive = false; - if (previousParams->mEncodings.size() == 0 || - (previousParams->mEncodings.size() > 0 && previousParams->mEncodings.begin()->mActive)) { - previousActive = true; - } - if (params->mEncodings.size() == 0 || - (params->mEncodings.size() > 0 && params->mEncodings.begin()->mActive)) { - currentActive = true; - } - if (mTransportState == ISecureTransport::State_Connected) { - if (!previousActive && currentActive) { - webrtc::VoEBase::GetInterface(voiceEngine)->StartSend(mChannel); - } else if (previousActive && !currentActive) { - webrtc::VoEBase::GetInterface(voiceEngine)->StopSend(mChannel); - } - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) - { - AutoRecursiveLock lock(*this); - - UseStatsReport::StatMap reportStats; - - webrtc::AudioSendStream::Stats sendStreamStats = mSendStream->GetStats(); - - auto track = mTrack.lock(); - if (!track) { - return; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_OutboundRTP)) { - - auto report = make_shared(); - - report->mID = string(sendStreamStats.local_ssrc) + "_send"; - - report->mSSRC = sendStreamStats.local_ssrc; - report->mIsRemote = false; - report->mMediaType = "audio"; - report->mMediaTrackID = track->id(); - report->mCodecID = mCodecPayloadName; - report->mPacketsSent = sendStreamStats.packets_sent; - report->mBytesSent = sendStreamStats.bytes_sent; - report->mTargetBitrate = (DOUBLE)mCurrentTargetBitrate; - report->mRoundTripTime = (DOUBLE)mCallStats->rtcp_rtt_stats()->LastProcessedRtt(); - - reportStats[report->mID] = report; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_Codec)) { - auto report = make_shared(); - - report->mID = string(sendStreamStats.local_ssrc) + "_send_codec"; - - report->mPayloadType = mCodecPayloadType; - report->mCodec = mCodecPayloadName; - report->mClockRate = 0; - report->mChannels = 0; - - reportStats[report->mID] = report; - } - - promise->resolve(UseStatsReport::create(reportStats)); - } - - void RTPMediaEngine::AudioSenderChannelResource::onSendDTMFTone() - { - AutoRecursiveLock lock(*this); - - if (mDTMFPayloadType == 0) - return; - - size_t firstTonePosition = mDTMFTones.find_first_of(dtmfValidTones); - int code = 0; - if (firstTonePosition == std::string::npos) { - mDTMFTones.clear(); - notifyToneEvent(""); - return; - } else { - char tone = mDTMFTones[firstTonePosition]; - char event = toupper(tone); - const char* p = strchr(dtmfTonesTable, event); - if (!p) { - mDTMFTones.clear(); - notifyToneEvent(""); - return; - } - code = p - dtmfTonesTable - 1; - } - - int toneGap = mDTMFInterToneGap.count(); - if (code == dtmfTwoSecondsDelayCode) { - toneGap = dtmfTwoSecondInMs; - } else { - mSendStream->SendTelephoneEvent(mDTMFPayloadType, code, mDTMFDuration.count()); - toneGap += mDTMFDuration.count(); - } - - notifyToneEvent(mDTMFTones.substr(firstTonePosition, 1).c_str()); - - mDTMFTones.erase(0, firstTonePosition + 1); - - auto pThis = ZS_DYNAMIC_PTR_CAST(AudioSenderChannelResource, mThisWeak.lock()); - mDTMFTimer = ITimer::create(pThis, Milliseconds(toneGap), false); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineAudioSenderChannelResource - #pragma mark - - //------------------------------------------------------------------------- - bool RTPMediaEngine::AudioSenderChannelResource::handlePacket(const RTCPPacket &packet) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onHandleRTCPPacket(packet.buffer()); - return true; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) - { - AutoRecursiveLock lock(*this); - - auto pThis = ZS_DYNAMIC_PTR_CAST(AudioSenderChannelResource, mThisWeak.lock()); - mDTMFTones = tones; - mDTMFDuration = duration; - mDTMFInterToneGap = interToneGap; - mDTMFTimer = ITimer::create(pThis, Milliseconds(0), false); - } - - //------------------------------------------------------------------------- - String RTPMediaEngine::AudioSenderChannelResource::toneBuffer() const - { - AutoRecursiveLock lock(*this); - - return mDTMFTones; - } - - //------------------------------------------------------------------------- - Milliseconds RTPMediaEngine::AudioSenderChannelResource::duration() const - { - AutoRecursiveLock lock(*this); - - return mDTMFDuration; - } - - //------------------------------------------------------------------------- - Milliseconds RTPMediaEngine::AudioSenderChannelResource::interToneGap() const - { - AutoRecursiveLock lock(*this); - - return mDTMFInterToneGap; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::onHandleRTCPPacket(SecureByteBlockPtr buffer) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - auto stream = mSendStream.get(); - if (NULL == stream) return; - - bool result = stream->DeliverRtcp(buffer->BytePtr(), buffer->SizeInBytes()); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => ITimerDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::onTimer(ITimerPtr timer) - { - AutoRecursiveLock lock(*this); - - auto pThis = ZS_DYNAMIC_PTR_CAST(AudioSenderChannelResource, mThisWeak.lock()); - IRTPMediaEngineChannelResourceAsyncDelegateProxy::create(pThis)->onSendDTMFTone(); - - mDTMFTimer->cancel(); - mDTMFTimer.reset(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => webrtc::BitrateObserver - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) - { - AutoRecursiveLock lock(*this); - - mCurrentTargetBitrate = targetBitrateBps; - - uint32_t allocatedBitrateBps = mBitrateAllocator->OnNetworkChanged( - targetBitrateBps, - fractionLoss, - rttMs - ); - - int padUpToBitrateBps = 0; - uint32_t pacerBitrateBps = std::max(targetBitrateBps, allocatedBitrateBps); - - if (mCongestionController) - mCongestionController->UpdatePacerBitrate( - targetBitrateBps / 1000, - webrtc::PacedSender::kDefaultPaceMultiplier * pacerBitrateBps / 1000, - padUpToBitrateBps / 1000 - ); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => friend RTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::stepSetup() - { - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (!engine) { - notifyPromisesReject(); - return; - } - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) { - notifyPromisesReject(); - return; - } - - auto audioState = engine->getAudioState(); - - mModuleProcessThread = webrtc::ProcessThread::Create("AudioSenderChannelResourceModuleProcessThread"); - mPacerThread = webrtc::ProcessThread::Create("AudioSenderChannelResourcePacerThread"); - - mBitrateAllocator = rtc::scoped_ptr(new webrtc::BitrateAllocator()); - mCallStats = rtc::scoped_ptr(new webrtc::CallStats(mClock)); - mCongestionController = - rtc::scoped_ptr(new webrtc::CongestionController( - mClock, - this, - &mRemb - )); - - mCallStats->RegisterStatsObserver(mCongestionController.get()); - - mChannel = webrtc::VoEBase::GetInterface(voiceEngine)->CreateChannel(); - - bool audioCodecSet = false; - webrtc::CodecInst codec; - for (auto codecIter = mParameters->mCodecs.begin(); codecIter != mParameters->mCodecs.end(); codecIter++) { - auto supportedCodec = IRTPTypes::toSupportedCodec(codecIter->mName); - if (IRTPTypes::getCodecKind(supportedCodec) == IRTPTypes::CodecKind_Audio && audioCodecSet) - continue; - codec = getAudioCodec(voiceEngine, codecIter->mName); - codec.pltype = codecIter->mPayloadType; - if (codecIter->mPTime != Milliseconds::zero()) - codec.pacsize = (codec.plfreq / 1000) * codecIter->mPTime.count(); - if (codecIter->mNumChannels.hasValue()) - codec.channels = codecIter->mNumChannels; - switch (supportedCodec) { - case IRTPTypes::SupportedCodec_Opus: - { - codec.rate = 32000 * codec.channels; - webrtc::VoECodec::GetInterface(voiceEngine)->SetSendCodec(mChannel, codec); - auto parameters = IRTPTypes::OpusCodecParameters::convert(codecIter->mParameters); - if (parameters->mUseInbandFEC.hasValue()) - webrtc::VoECodec::GetInterface(voiceEngine)->SetFECStatus(mChannel, parameters->mUseInbandFEC); - if (parameters->mUseDTX.hasValue()) - webrtc::VoECodec::GetInterface(voiceEngine)->SetOpusDtx(mChannel, parameters->mUseDTX); - webrtc::VoECodec::GetInterface(voiceEngine)->SetOpusMaxPlaybackRate(mChannel, 48000); - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_Isac: - case IRTPTypes::SupportedCodec_G722: - case IRTPTypes::SupportedCodec_ILBC: - case IRTPTypes::SupportedCodec_PCMU: - case IRTPTypes::SupportedCodec_PCMA: - webrtc::VoECodec::GetInterface(voiceEngine)->SetSendCodec(mChannel, codec); - goto set_rtcp_feedback; - case IRTPTypes::SupportedCodec_RED: - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetREDStatus(mChannel, true, codecIter->mPayloadType); - break; - case IRTPTypes::SupportedCodec_TelephoneEvent: - mDTMFPayloadType = codecIter->mPayloadType; - break; - } - continue; - - set_rtcp_feedback: - for (auto rtcpFeedbackIter = codecIter->mRTCPFeedback.begin(); rtcpFeedbackIter != codecIter->mRTCPFeedback.end(); rtcpFeedbackIter++) { - IRTPTypes::KnownFeedbackTypes feedbackType = IRTPTypes::toKnownFeedbackType(rtcpFeedbackIter->mType); - IRTPTypes::KnownFeedbackParameters feedbackParameter = IRTPTypes::toKnownFeedbackParameter(rtcpFeedbackIter->mParameter); - if (IRTPTypes::KnownFeedbackType_NACK == feedbackType && IRTPTypes::KnownFeedbackParameter_Unknown == feedbackParameter) { - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetNACKStatus(mChannel, true, 250); - } - } - audioCodecSet = true; - } - - mCodecPayloadName = codec.plname; - mCodecPayloadType = codec.pltype; - - webrtc::AudioSendStream::Config config(mTransport.get()); - config.voe_channel_id = mChannel; - - for (auto encodingParamIter = mParameters->mEncodings.begin(); encodingParamIter != mParameters->mEncodings.end(); encodingParamIter++) { - - IRTPTypes::PayloadType codecPayloadType {}; - if (encodingParamIter->mCodecPayloadType.hasValue()) - codecPayloadType = encodingParamIter->mCodecPayloadType; - else - codecPayloadType = codec.pltype; - - if (codecPayloadType == codec.pltype) { - uint32_t ssrc = 0; - if (encodingParamIter->mSSRC.hasValue()) { - ssrc = encodingParamIter->mSSRC; - } - if (encodingParamIter->mFEC.hasValue()) { - IRTPTypes::FECParameters fec = encodingParamIter->mFEC; - if (fec.mSSRC.hasValue()) { - ssrc = fec.mSSRC; - } - } - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetLocalSSRC(mChannel, ssrc); - config.rtp.ssrc = ssrc; - } - } - if (config.rtp.ssrc == 0) { - uint32_t ssrc = SafeInt(ortc::services::IHelper::random(1, 0xFFFFFFFF)); - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetLocalSSRC(mChannel, ssrc); - config.rtp.ssrc = ssrc; - } - - for (auto headerExtensionIter = mParameters->mHeaderExtensions.begin(); headerExtensionIter != mParameters->mHeaderExtensions.end(); headerExtensionIter++) { - IRTPTypes::HeaderExtensionURIs headerExtensionURI = IRTPTypes::toHeaderExtensionURI(headerExtensionIter->mURI); - switch (headerExtensionURI) { - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_ClienttoMixerAudioLevelIndication: - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetSendAudioLevelIndicationStatus(mChannel, true, headerExtensionIter->mID); - config.rtp.extensions.push_back(webrtc::RtpExtension(headerExtensionIter->mURI, headerExtensionIter->mID)); - break; - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_AbsoluteSendTime: - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetSendAbsoluteSenderTimeStatus(mChannel, true, headerExtensionIter->mID); - config.rtp.extensions.push_back(webrtc::RtpExtension(headerExtensionIter->mURI, headerExtensionIter->mID)); - break; - default: - break; - } - } - - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetRTCPStatus(mChannel, true); - webrtc::VoERTP_RTCP::GetInterface(voiceEngine)->SetRTCP_CNAME(mChannel, mParameters->mRTCP.mCName); - - mCongestionController->SetBweBitrates(10000, 40000, 100000); - - mModuleProcessThread->Start(); - mModuleProcessThread->RegisterModule(mCallStats.get()); - mModuleProcessThread->RegisterModule(mCongestionController.get()); - mPacerThread->RegisterModule(mCongestionController->pacer()); - mPacerThread->RegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mPacerThread->Start(); - - mSendStream = rtc::scoped_ptr( - new webrtc::internal::AudioSendStream( - config, - audioState, - mCongestionController.get() - )); - - webrtc::VoENetwork::GetInterface(voiceEngine)->RegisterExternalTransport(mChannel, *mTransport); - - if (mTransportState == ISecureTransport::State_Connected) - webrtc::VoEBase::GetInterface(voiceEngine)->StartSend(mChannel); - - notifyPromisesResolve(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::stepShutdown() - { - mDenyNonLockedAccess = true; - - // rare race condition that can happen so - while (mAccessFromNonLockedMethods > 0) - { - // NOTE: very temporary lock so should clear itself out fast - std::this_thread::yield(); - } - - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (engine) { - auto voiceEngine = engine->getVoiceEngine(); - if (voiceEngine) { - if (mTransportState == ISecureTransport::State_Connected) - webrtc::VoEBase::GetInterface(voiceEngine)->StopSend(mChannel); - webrtc::VoENetwork::GetInterface(voiceEngine)->DeRegisterExternalTransport(mChannel); - } - } - - mPacerThread->Stop(); - mPacerThread->DeRegisterModule(mCongestionController->pacer()); - mPacerThread->DeRegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mModuleProcessThread->DeRegisterModule(mCongestionController.get()); - mModuleProcessThread->DeRegisterModule(mCallStats.get()); - mModuleProcessThread->Stop(); - - mCallStats->DeregisterStatsObserver(mCongestionController.get()); - - mSendStream.reset(); - mCongestionController.reset(); - mCallStats.reset(); - mBitrateAllocator.reset(); - mModuleProcessThread.reset(); - mPacerThread.reset(); - - notifyPromisesShutdown(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => (internal) - #pragma mark - - //------------------------------------------------------------------------- - webrtc::CodecInst RTPMediaEngine::AudioSenderChannelResource::getAudioCodec( - webrtc::VoiceEngine *voiceEngine, - String payloadName - ) - { - webrtc::CodecInst codec; - int numOfCodecs = webrtc::VoECodec::GetInterface(voiceEngine)->NumOfCodecs(); - for (int i = 0; i < numOfCodecs; ++i) { - webrtc::CodecInst currentCodec; - webrtc::VoECodec::GetInterface(voiceEngine)->GetCodec(i, currentCodec); - if (0 == String(currentCodec.plname).compareNoCase(payloadName)) { - codec = currentCodec; - break; - } - } - return codec; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::AudioSenderChannelResource::notifyToneEvent(const char *tone) - { - if (!mDTMFSenderDelegate) return; - - try { - mDTMFSenderDelegate->onDTMFSenderToneChanged(IDTMFSenderPtr(), tone); - } catch (const IDTMFSenderDelegateProxy::Exceptions::DelegateGone &) { - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource::ReceiverVideoRenderer - #pragma mark - - //--------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::ReceiverVideoRenderer::setMediaStreamTrack(UseMediaStreamTrackPtr videoTrack) - { - mVideoTrack = videoTrack; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::ReceiverVideoRenderer::RenderFrame(const webrtc::VideoFrame &videoFrame, int timeToRenderMs) - { - auto frameCopy = make_shared(); - frameCopy->ShallowCopy(videoFrame); - - mVideoTrack.lock()->renderVideoFrame(frameCopy); - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::VideoReceiverChannelResource::ReceiverVideoRenderer::IsTextureSupported() const - { - return false; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::VideoReceiverChannelResource::VideoReceiverChannelResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ) : - ChannelResource(priv, registration), - mTransport(transport), - mTrack(track), - mParameters(parameters), - mInitPacket(packet) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::VideoReceiverChannelResource::~VideoReceiverChannelResource() - { - mThisWeak.reset(); // shared pointer to self is no longer valid - } - - //------------------------------------------------------------------------- - RTPMediaEngine::VideoReceiverChannelResourcePtr RTPMediaEngine::VideoReceiverChannelResource::create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ) - { - auto pThis = make_shared( - make_private{}, - registration, - transport, - track, - parameters, - packet - ); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::init() - { - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::onSecureTransportState(ISecureTransport::States state) - { - AutoRecursiveLock lock(*this); - - if (state == mTransportState) return; - - ISecureTransport::States previousState = mTransportState; - mTransportState = state; - - if (!mReceiveStream) return; - - if (mParameters && (mParameters->mEncodings.size() == 0 || - (mParameters->mEncodings.size() > 0 && mParameters->mEncodings.begin()->mActive))) { - if (state == ISecureTransport::State_Connected) - mReceiveStream->Start(); - else if (previousState == ISecureTransport::State_Connected) - mReceiveStream->Stop(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::onUpdate(ParametersPtr params) - { - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - ParametersPtr previousParams = mParameters; - mParameters = params; - - if (!mReceiveStream) return; - - bool previousActive = false; - bool currentActive = false; - if (previousParams->mEncodings.size() == 0 || - (previousParams->mEncodings.size() > 0 && previousParams->mEncodings.begin()->mActive)) { - previousActive = true; - } - if (params->mEncodings.size() == 0 || - (params->mEncodings.size() > 0 && params->mEncodings.begin()->mActive)) { - currentActive = true; - } - if (mTransportState == ISecureTransport::State_Connected) { - if (!previousActive && currentActive) - mReceiveStream->Start(); - else if (previousActive && !currentActive) - mReceiveStream->Stop(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) - { - AutoRecursiveLock lock(*this); - - UseStatsReport::StatMap reportStats; - - webrtc::VideoReceiveStream::Stats receiveStreamStats = mReceiveStream->GetStats(); - - auto track = mTrack.lock(); - if (!track) { - notifyPromisesReject(); - return; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_InboundRTP)) { - - auto report = make_shared(); - - report->mID = string(receiveStreamStats.ssrc) + "_recv"; - - report->mSSRC = receiveStreamStats.ssrc; - report->mIsRemote = true; - report->mMediaType = "video"; - report->mMediaTrackID = track->id(); - report->mCodecID = mCodecPayloadName; - report->mFIRCount = receiveStreamStats.rtcp_packet_type_counts.fir_packets; - report->mPLICount = receiveStreamStats.rtcp_packet_type_counts.pli_packets; - report->mNACKCount = receiveStreamStats.rtcp_packet_type_counts.nack_packets; - report->mPacketsReceived = receiveStreamStats.rtp_stats.transmitted.packets; - report->mBytesReceived = receiveStreamStats.rtp_stats.transmitted.header_bytes + - receiveStreamStats.rtp_stats.transmitted.payload_bytes + - receiveStreamStats.rtp_stats.transmitted.padding_bytes; - report->mPacketsLost = receiveStreamStats.rtp_stats.retransmitted.packets; - report->mJitter = receiveStreamStats.rtcp_stats.jitter; - report->mFractionLost = receiveStreamStats.rtcp_stats.fraction_lost; -#ifdef WINRT - report->mEndToEndDelay = Milliseconds(receiveStreamStats.current_endtoend_delay_ms); -#endif - reportStats[report->mID] = report; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_Codec)) { - - auto report = make_shared(); - - report->mID = string(receiveStreamStats.ssrc) + "_recv_codec"; - - report->mPayloadType = mCodecPayloadType; - report->mCodec = mCodecPayloadName; - report->mClockRate = 0; - report->mChannels = 0; - - reportStats[report->mID] = report; - } - - promise->resolve(UseStatsReport::create(reportStats)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineVideoReceiverChannelResource - #pragma mark - - //------------------------------------------------------------------------- - bool RTPMediaEngine::VideoReceiverChannelResource::handlePacket(const RTPPacket &packet) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onHandleRTPPacket(packet.timestamp(), packet.buffer()); - return true; - } - - //------------------------------------------------------------------------- - bool RTPMediaEngine::VideoReceiverChannelResource::handlePacket(const RTCPPacket &packet) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onHandleRTCPPacket(packet.buffer()); - return true; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - auto stream = mReceiveStream.get(); - if (NULL == stream) return; - - webrtc::PacketTime time(timestamp, 0); - bool result = stream->DeliverRtp(buffer->BytePtr(), buffer->SizeInBytes(), time); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::onHandleRTCPPacket(SecureByteBlockPtr buffer) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - auto stream = mReceiveStream.get(); - if (NULL == stream) return; - - bool result = stream->DeliverRtcp(buffer->BytePtr(), buffer->SizeInBytes()); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => webrtc::BitrateObserver - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) - { - AutoRecursiveLock lock(*this); - - mCurrentTargetBitrate = targetBitrateBps; - - uint32_t allocatedBitrateBps = mBitrateAllocator->OnNetworkChanged( - targetBitrateBps, - fractionLoss, - rttMs - ); - - int padUpToBitrateBps = 0; - uint32_t pacerBitrateBps = std::max(targetBitrateBps, allocatedBitrateBps); - - if (mCongestionController) - mCongestionController->UpdatePacerBitrate( - targetBitrateBps / 1000, - webrtc::PacedSender::kDefaultPaceMultiplier * pacerBitrateBps / 1000, - padUpToBitrateBps / 1000 - ); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => friend RTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::stepSetup() - { - AutoRecursiveLock lock(*this); - - auto track = mTrack.lock(); - if (!track) { - return; - } - - mModuleProcessThread = webrtc::ProcessThread::Create("VideoReceiverChannelResourceModuleProcessThread"); - mPacerThread = webrtc::ProcessThread::Create("VideoReceiverChannelResourcePacerThread"); - - mReceiverVideoRenderer.setMediaStreamTrack(track); - - mBitrateAllocator = rtc::scoped_ptr(new webrtc::BitrateAllocator()); - mCallStats = rtc::scoped_ptr(new webrtc::CallStats(mClock)); - mCongestionController = - rtc::scoped_ptr(new webrtc::CongestionController( - mClock, - this, - &mRemb - )); - - mCallStats->RegisterStatsObserver(mCongestionController.get()); - - int numCpuCores = webrtc::CpuInfo::DetectNumberOfCores(); - - webrtc::Transport* transport = mTransport.get(); - webrtc::VideoReceiveStream::Config config(transport); - webrtc::VideoReceiveStream::Decoder decoder; - std::vector rtxPayloadTypes; - - bool videoCodecSet = false; - bool rtxCodecSet = false; - bool redCodecSet = false; - bool fecCodecSet = false; - for (auto codecIter = mParameters->mCodecs.begin(); codecIter != mParameters->mCodecs.end(); ++codecIter) { - auto supportedCodec = IRTPTypes::toSupportedCodec(codecIter->mName); - switch (supportedCodec) { - case IRTPTypes::SupportedCodec_VP8: - { - if (videoCodecSet) - continue; - webrtc::VideoDecoder* videoDecoder = webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp8); - decoder.decoder = videoDecoder; - decoder.payload_name = IRTPTypes::toString(supportedCodec); - decoder.payload_type = codecIter->mPayloadType; - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_VP9: - { - if (videoCodecSet) - continue; - webrtc::VideoDecoder* videoDecoder = webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kVp9); - decoder.decoder = videoDecoder; - decoder.payload_name = IRTPTypes::toString(supportedCodec); - decoder.payload_type = codecIter->mPayloadType; - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_H264: - { - if (videoCodecSet) - continue; -#ifndef WINRT - webrtc::VideoDecoder* videoDecoder = webrtc::VideoDecoder::Create(webrtc::VideoDecoder::kH264); -#else - std::unique_ptr decoderFactory = std::make_unique(); - webrtc::VideoDecoder* videoDecoder = decoderFactory->CreateVideoDecoder(webrtc::VideoCodecType::kVideoCodecH264); -#endif - decoder.decoder = videoDecoder; - decoder.payload_name = IRTPTypes::toString(supportedCodec); - decoder.payload_type = codecIter->mPayloadType; - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_RTX: - { - if (rtxCodecSet) - continue; - rtxPayloadTypes.push_back(codecIter->mPayloadType); - rtxCodecSet = true; - break; - } - case IRTPTypes::SupportedCodec_RED: - { - if (redCodecSet) - continue; - config.rtp.fec.red_payload_type = codecIter->mPayloadType; - redCodecSet = true; - break; - } - case IRTPTypes::SupportedCodec_ULPFEC: - { - if (fecCodecSet) - continue; - config.rtp.fec.ulpfec_payload_type = codecIter->mPayloadType; - fecCodecSet = true; - break; - } - case IRTPTypes::SupportedCodec_FlexFEC: - { - break; - } - } - continue; - - set_rtcp_feedback: - for (auto rtcpFeedbackIter = codecIter->mRTCPFeedback.begin(); rtcpFeedbackIter != codecIter->mRTCPFeedback.end(); rtcpFeedbackIter++) { - IRTPTypes::KnownFeedbackTypes feedbackType = IRTPTypes::toKnownFeedbackType(rtcpFeedbackIter->mType); - IRTPTypes::KnownFeedbackParameters feedbackParameter = IRTPTypes::toKnownFeedbackParameter(rtcpFeedbackIter->mParameter); - if (IRTPTypes::KnownFeedbackType_NACK == feedbackType && IRTPTypes::KnownFeedbackParameter_Unknown == feedbackParameter) { - config.rtp.nack.rtp_history_ms = 1000; - } else if (IRTPTypes::KnownFeedbackType_REMB == feedbackType && IRTPTypes::KnownFeedbackParameter_Unknown == feedbackParameter) { - config.rtp.remb = true; - } - } - videoCodecSet = true; - } - - mCodecPayloadName = decoder.payload_name; - mCodecPayloadType = decoder.payload_type; - - for (auto encodingParamIter = mParameters->mEncodings.begin(); encodingParamIter != mParameters->mEncodings.end(); encodingParamIter++) { - - IRTPTypes::PayloadType codecPayloadType {}; - if (encodingParamIter->mCodecPayloadType.hasValue()) - codecPayloadType = encodingParamIter->mCodecPayloadType; - else - codecPayloadType = decoder.payload_type; - - if (codecPayloadType == decoder.payload_type) { - uint32_t ssrc = 0; - if (encodingParamIter->mSSRC.hasValue()) - ssrc = encodingParamIter->mSSRC; - if (encodingParamIter->mFEC.hasValue()) { - IRTPTypes::FECParameters fec = encodingParamIter->mFEC; - if (fec.mSSRC.hasValue()) { - ssrc = encodingParamIter->mSSRC; - } - } - config.rtp.remote_ssrc = ssrc; - if (encodingParamIter->mRTX.hasValue()) { - IRTPTypes::RTXParameters rtxEncodingParam = encodingParamIter->mRTX; - webrtc::VideoReceiveStream::Config::Rtp::Rtx rtx; - rtx.payload_type = rtxPayloadTypes.front(); - if (rtxEncodingParam.mSSRC.hasValue()) - rtx.ssrc = rtxEncodingParam.mSSRC; - config.rtp.rtx[codecPayloadType] = rtx; - } - } - } - if (config.rtp.remote_ssrc == 0) { - config.rtp.remote_ssrc = mInitPacket->ssrc(); - mInitPacket.reset(); - } - uint32_t localSSRC = mParameters->mRTCP.mSSRC; - if (localSSRC == 0) - localSSRC = 1; - config.rtp.local_ssrc = localSSRC; - - for (auto headerExtensionIter = mParameters->mHeaderExtensions.begin(); headerExtensionIter != mParameters->mHeaderExtensions.end(); headerExtensionIter++) { - IRTPTypes::HeaderExtensionURIs headerExtensionURI = IRTPTypes::toHeaderExtensionURI(headerExtensionIter->mURI); - switch (headerExtensionURI) { - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_TransmissionTimeOffsets: - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_AbsoluteSendTime: - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_3gpp_VideoOrientation: - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_TransportSequenceNumber: - config.rtp.extensions.push_back(webrtc::RtpExtension(headerExtensionIter->mURI, headerExtensionIter->mID)); - break; - default: - break; - } - } - - if (mParameters->mRTCP.mReducedSize) - config.rtp.rtcp_mode = webrtc::RtcpMode::kReducedSize; - config.decoders.push_back(decoder); - config.renderer = &mReceiverVideoRenderer; - - mModuleProcessThread->Start(); - mModuleProcessThread->RegisterModule(mCallStats.get()); - mModuleProcessThread->RegisterModule(mCongestionController.get()); - mPacerThread->RegisterModule(mCongestionController->pacer()); - mPacerThread->RegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mPacerThread->Start(); - - mReceiveStream = rtc::scoped_ptr( - new webrtc::internal::VideoReceiveStream( - numCpuCores, - mCongestionController.get(), - config, - NULL, - mModuleProcessThread.get(), - mCallStats.get(), - &mRemb - )); - - if (mTransportState == ISecureTransport::State_Connected) - mReceiveStream->Start(); - - notifyPromisesResolve(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoReceiverChannelResource::stepShutdown() - { - mDenyNonLockedAccess = true; - - // rare race condition that can happen so - while (mAccessFromNonLockedMethods > 0) - { - // NOTE: very temporary lock so should clear itself out fast - std::this_thread::yield(); - } - - AutoRecursiveLock lock(*this); - - if (mReceiveStream && mTransportState == ISecureTransport::State_Connected) - mReceiveStream->Stop(); - - mPacerThread->Stop(); - mPacerThread->DeRegisterModule(mCongestionController->pacer()); - mPacerThread->DeRegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mModuleProcessThread->DeRegisterModule(mCongestionController.get()); - mModuleProcessThread->DeRegisterModule(mCallStats.get()); - mModuleProcessThread->Stop(); - - mCallStats->DeregisterStatsObserver(mCongestionController.get()); - - mReceiveStream.reset(); - mCongestionController.reset(); - mCallStats.reset(); - mBitrateAllocator.reset(); - mModuleProcessThread.reset(); - mPacerThread.reset(); - - notifyPromisesShutdown(); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource - #pragma mark - - //------------------------------------------------------------------------- - RTPMediaEngine::VideoSenderChannelResource::VideoSenderChannelResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters - ) : - ChannelResource(priv, registration), - mTransport(transport), - mTrack(track), - mParameters(parameters) - { - } - - //------------------------------------------------------------------------- - RTPMediaEngine::VideoSenderChannelResource::~VideoSenderChannelResource() - { - mThisWeak.reset(); // shared pointer to self is no longer valid - } - - //------------------------------------------------------------------------- - RTPMediaEngine::VideoSenderChannelResourcePtr RTPMediaEngine::VideoSenderChannelResource::create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters - ) - { - auto pThis = make_shared( - make_private{}, - registration, - transport, - track, - parameters - ); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::init() - { - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::onSecureTransportState(ISecureTransport::States state) - { - AutoRecursiveLock lock(*this); - - if (state == mTransportState) return; - - ISecureTransport::States previousState = mTransportState; - mTransportState = state; - - if (!mSendStream) return; - - if (mParameters && (mParameters->mEncodings.size() == 0 || - (mParameters->mEncodings.size() > 0 && mParameters->mEncodings.begin()->mActive))) { - if (state == ISecureTransport::State_Connected) - mSendStream->Start(); - else if (previousState == ISecureTransport::State_Connected) - mSendStream->Stop(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::onUpdate(ParametersPtr params) - { - AutoRecursiveLock lock(*this); - - auto engine = mMediaEngine.lock(); - if (!engine) return; - - auto voiceEngine = engine->getVoiceEngine(); - if (!voiceEngine) return; - - ParametersPtr previousParams = mParameters; - mParameters = params; - - if (!mSendStream) return; - - bool previousActive = false; - bool currentActive = false; - if (previousParams->mEncodings.size() == 0 || - (previousParams->mEncodings.size() > 0 && previousParams->mEncodings.begin()->mActive)) { - previousActive = true; - } - if (params->mEncodings.size() == 0 || - (params->mEncodings.size() > 0 && params->mEncodings.begin()->mActive)) { - currentActive = true; - } - if (mTransportState == ISecureTransport::State_Connected) { - if (!previousActive && currentActive) - mSendStream->Start(); - else if (previousActive && !currentActive) - mSendStream->Stop(); - } - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) - { - AutoRecursiveLock lock(*this); - - UseStatsReport::StatMap reportStats; - - webrtc::VideoSendStream::Stats sendStreamStats = mSendStream->GetStats(); - - auto track = mTrack.lock(); - if (!track) { - return; - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_OutboundRTP)) { - - for (auto statsIter = sendStreamStats.substreams.begin(); statsIter != sendStreamStats.substreams.end(); statsIter++) { - - auto report = make_shared(); - - report->mID = string((*statsIter).first) + "_send"; - - report->mSSRC = (*statsIter).first; - report->mIsRemote = false; - report->mMediaType = "video"; - report->mMediaTrackID = track->id(); - report->mCodecID = mCodecPayloadName; - report->mFIRCount = (*statsIter).second.rtcp_packet_type_counts.fir_packets; - report->mPLICount = (*statsIter).second.rtcp_packet_type_counts.pli_packets; - report->mNACKCount = (*statsIter).second.rtcp_packet_type_counts.nack_packets; - report->mPacketsSent = (*statsIter).second.rtp_stats.transmitted.packets; - report->mBytesSent = (*statsIter).second.rtp_stats.transmitted.header_bytes + - (*statsIter).second.rtp_stats.transmitted.payload_bytes + - (*statsIter).second.rtp_stats.transmitted.padding_bytes; - report->mTargetBitrate = (DOUBLE)mCurrentTargetBitrate; - report->mRoundTripTime = (DOUBLE)mCallStats->rtcp_rtt_stats()->LastProcessedRtt(); - - reportStats[report->mID] = report; - } - } - - if (stats.hasStatType(IStatsReportTypes::StatsTypes::StatsType_Codec)) { - auto report = make_shared(); - - report->mID = string((*sendStreamStats.substreams.begin()).first) + "_send_codec"; - - report->mPayloadType = mCodecPayloadType; - report->mCodec = mCodecPayloadName; - report->mClockRate = 0; - report->mChannels = 0; - - reportStats[report->mID] = report; - } - - promise->resolve(UseStatsReport::create(reportStats)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - bool RTPMediaEngine::VideoSenderChannelResource::handlePacket(const RTCPPacket &packet) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onHandleRTCPPacket(packet.buffer()); - return true; - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::sendVideoFrame(VideoFramePtr videoFrame) - { - IRTPMediaEngineHandlePacketAsyncDelegateProxy::createUsingQueue(mHandlePacketQueue, getThis())->onSendVideoFrame(videoFrame); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::onHandleRTCPPacket(SecureByteBlockPtr buffer) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - auto stream = mSendStream.get(); - if (NULL == stream) return; - - bool result = stream->DeliverRtcp(buffer->BytePtr(), buffer->SizeInBytes()); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::onSendVideoFrame(VideoFramePtr videoFrame) - { - AutoIncrementLock incLock(mAccessFromNonLockedMethods); - - if (mDenyNonLockedAccess) return; - - auto stream = mSendStream.get(); - if (NULL == stream) return; - - stream->Input()->IncomingCapturedFrame(*videoFrame); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => webrtc::BitrateObserver - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) - { - AutoRecursiveLock lock(*this); - - mCurrentTargetBitrate = targetBitrateBps; - - uint32_t allocatedBitrateBps = mBitrateAllocator->OnNetworkChanged( - targetBitrateBps, - fractionLoss, - rttMs - ); - - int padUpToBitrateBps = 0; - if (mSendStream) - padUpToBitrateBps = static_cast(mSendStream.get())->GetPaddingNeededBps(); - uint32_t pacerBitrateBps = std::max(targetBitrateBps, allocatedBitrateBps); - - if (mCongestionController) - mCongestionController->UpdatePacerBitrate( - targetBitrateBps / 1000, - webrtc::PacedSender::kDefaultPaceMultiplier * pacerBitrateBps / 1000, - padUpToBitrateBps / 1000 - ); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => friend RTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::stepSetup() - { - AutoRecursiveLock lock(*this); - - auto track = mTrack.lock(); - if (!track) { - return; - } - - mModuleProcessThread = webrtc::ProcessThread::Create("VideoSenderChannelResourceModuleProcessThread"); - mPacerThread = webrtc::ProcessThread::Create("VideoSenderChannelResourcePacerThread"); - - mBitrateAllocator = rtc::scoped_ptr(new webrtc::BitrateAllocator()); - mCallStats = rtc::scoped_ptr(new webrtc::CallStats(mClock)); - mCongestionController = - rtc::scoped_ptr(new webrtc::CongestionController( - mClock, - this, - &mRemb - )); - - mCallStats->RegisterStatsObserver(mCongestionController.get()); - - int numCpuCores = webrtc::CpuInfo::DetectNumberOfCores(); - - size_t sourceWidth = 640; - size_t sourceHeight = 480; - int sourceMaxFramerate = 15; - IMediaStreamTrack::SettingsPtr trackSettings = track->getSettings(); - if (trackSettings->mWidth.hasValue()) - sourceWidth = trackSettings->mWidth.value(); - if (trackSettings->mHeight.hasValue()) - sourceHeight = trackSettings->mHeight.value(); - if (trackSettings->mFrameRate.hasValue()) - sourceMaxFramerate = trackSettings->mFrameRate.value(); - - webrtc::VideoSendStream::Config config(mTransport.get()); - webrtc::VideoEncoderConfig encoderConfig; - std::map suspendedSSRCs; - - encoderConfig.min_transmit_bitrate_bps = 0; - encoderConfig.content_type = webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo; - - bool videoCodecSet = false; - bool rtxCodecSet = false; - bool redCodecSet = false; - bool fecCodecSet = false; - for (auto codecIter = mParameters->mCodecs.begin(); codecIter != mParameters->mCodecs.end(); codecIter++) { - auto supportedCodec = IRTPTypes::toSupportedCodec(codecIter->mName); - switch (supportedCodec) { - case IRTPTypes::SupportedCodec_VP8: - { - if (videoCodecSet) - continue; - webrtc::VideoEncoder* videoEncoder = webrtc::VideoEncoder::Create(webrtc::VideoEncoder::kVp8); - config.encoder_settings.encoder = videoEncoder; - config.encoder_settings.payload_name = IRTPTypes::toString(supportedCodec); - config.encoder_settings.payload_type = codecIter->mPayloadType; - mVideoEncoderSettings.mVp8 = webrtc::VideoEncoder::GetDefaultVp8Settings(); - mVideoEncoderSettings.mVp8.automaticResizeOn = true; - mVideoEncoderSettings.mVp8.denoisingOn = true; - mVideoEncoderSettings.mVp8.frameDroppingOn = true; - encoderConfig.encoder_specific_settings = &mVideoEncoderSettings.mVp8; - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_VP9: - { - if (videoCodecSet) - continue; - webrtc::VideoEncoder* videoEncoder = webrtc::VideoEncoder::Create(webrtc::VideoEncoder::kVp9); - config.encoder_settings.encoder = videoEncoder; - config.encoder_settings.payload_name = IRTPTypes::toString(supportedCodec); - config.encoder_settings.payload_type = codecIter->mPayloadType; - mVideoEncoderSettings.mVp9 = webrtc::VideoEncoder::GetDefaultVp9Settings(); - mVideoEncoderSettings.mVp9.frameDroppingOn = true; - encoderConfig.encoder_specific_settings = &mVideoEncoderSettings.mVp9; - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_H264: - { - if (videoCodecSet) - continue; -#ifndef WINRT - webrtc::VideoEncoder* videoEncoder = webrtc::VideoEncoder::Create(webrtc::VideoEncoder::kH264); -#else - std::unique_ptr encoderFactory = std::make_unique(); - webrtc::VideoEncoder* videoEncoder = encoderFactory->CreateVideoEncoder(webrtc::VideoCodecType::kVideoCodecH264); -#endif - config.encoder_settings.encoder = videoEncoder; - config.encoder_settings.payload_name = IRTPTypes::toString(supportedCodec); - config.encoder_settings.payload_type = codecIter->mPayloadType; - mVideoEncoderSettings.mH264 = webrtc::VideoEncoder::GetDefaultH264Settings(); - mVideoEncoderSettings.mH264.frameDroppingOn = true; - encoderConfig.encoder_specific_settings = &mVideoEncoderSettings.mH264; - goto set_rtcp_feedback; - } - case IRTPTypes::SupportedCodec_RTX: - { - if (rtxCodecSet) - continue; - config.rtp.rtx.payload_type = codecIter->mPayloadType; - rtxCodecSet = true; - break; - } - case IRTPTypes::SupportedCodec_RED: - { - if (redCodecSet) - continue; - config.rtp.fec.red_payload_type = codecIter->mPayloadType; - redCodecSet = true; - break; - } - case IRTPTypes::SupportedCodec_ULPFEC: - { - if (fecCodecSet) - continue; - config.rtp.fec.ulpfec_payload_type = codecIter->mPayloadType; - fecCodecSet = true; - break; - } - case IRTPTypes::SupportedCodec_FlexFEC: - { - break; - } - } - continue; - - set_rtcp_feedback: - for (auto rtcpFeedbackIter = codecIter->mRTCPFeedback.begin(); rtcpFeedbackIter != codecIter->mRTCPFeedback.end(); rtcpFeedbackIter++) { - IRTPTypes::KnownFeedbackTypes feedbackType = IRTPTypes::toKnownFeedbackType(rtcpFeedbackIter->mType); - IRTPTypes::KnownFeedbackParameters feedbackParameter = IRTPTypes::toKnownFeedbackParameter(rtcpFeedbackIter->mParameter); - if (IRTPTypes::KnownFeedbackType_NACK == feedbackType && IRTPTypes::KnownFeedbackParameter_Unknown == feedbackParameter) { - config.rtp.nack.rtp_history_ms = 1000; - } - } - videoCodecSet = true; - } - - mCodecPayloadName = config.encoder_settings.payload_name; - mCodecPayloadType = config.encoder_settings.payload_type; - - int totalMinBitrate = 0; - int totalMaxBitrate = 0; - int totalTargetBitrate = 0; - for (auto encodingParamIter = mParameters->mEncodings.begin(); encodingParamIter != mParameters->mEncodings.end(); encodingParamIter++) { - - IRTPTypes::PayloadType codecPayloadType {}; - if (encodingParamIter->mCodecPayloadType.hasValue()) - codecPayloadType = encodingParamIter->mCodecPayloadType; - else - codecPayloadType = config.encoder_settings.payload_type; - - if (codecPayloadType == config.encoder_settings.payload_type) { - uint32_t ssrc = 0; - if (encodingParamIter->mSSRC.hasValue()) - ssrc = encodingParamIter->mSSRC; - if (encodingParamIter->mFEC.hasValue()) { - IRTPTypes::FECParameters fec = encodingParamIter->mFEC; - if (fec.mSSRC.hasValue()) { - ssrc = encodingParamIter->mSSRC; - } - } - if (ssrc == 0) - ssrc = SafeInt(ortc::services::IHelper::random(1, 0xFFFFFFFF)); - config.rtp.ssrcs.push_back(ssrc); - if (encodingParamIter->mRTX.hasValue()) { - IRTPTypes::RTXParameters rtx = encodingParamIter->mRTX; - if (rtx.mSSRC.hasValue()) - config.rtp.rtx.ssrcs.push_back(rtx.mSSRC); - } - webrtc::VideoStream stream; - stream.width = encodingParamIter->mResolutionScale.hasValue() ? sourceWidth / encodingParamIter->mResolutionScale : sourceWidth; - stream.height = encodingParamIter->mResolutionScale.hasValue() ? sourceHeight / encodingParamIter->mResolutionScale : sourceHeight; - stream.max_framerate = encodingParamIter->mFramerateScale.hasValue() ? sourceMaxFramerate / encodingParamIter->mResolutionScale : sourceMaxFramerate; - stream.min_bitrate_bps = 30000; - stream.max_bitrate_bps = encodingParamIter->mMaxBitrate.hasValue() ? encodingParamIter->mMaxBitrate : 2000000; - stream.target_bitrate_bps = stream.max_bitrate_bps / 2; - stream.max_qp = 56; - encoderConfig.streams.push_back(stream); - totalMinBitrate += stream.min_bitrate_bps; - totalMaxBitrate += stream.max_bitrate_bps; - totalTargetBitrate += stream.target_bitrate_bps; - } - } - if (encoderConfig.streams.size() == 0) { - config.rtp.ssrcs.push_back(SafeInt(ortc::services::IHelper::random(1, 0xFFFFFFFF))); - webrtc::VideoStream stream; - stream.width = sourceWidth; - stream.height = sourceHeight; - stream.max_framerate = sourceMaxFramerate; - stream.min_bitrate_bps = 30000; - stream.max_bitrate_bps = 2000000; - stream.target_bitrate_bps = stream.max_bitrate_bps / 2; - stream.max_qp = 56; - encoderConfig.streams.push_back(stream); - totalMinBitrate = stream.min_bitrate_bps; - totalMaxBitrate = stream.max_bitrate_bps; - totalTargetBitrate = stream.target_bitrate_bps; - } - if (encoderConfig.streams.size() > 1) - mVideoEncoderSettings.mVp8.automaticResizeOn = false; - - for (auto headerExtensionIter = mParameters->mHeaderExtensions.begin(); headerExtensionIter != mParameters->mHeaderExtensions.end(); headerExtensionIter++) { - IRTPTypes::HeaderExtensionURIs headerExtensionURI = IRTPTypes::toHeaderExtensionURI(headerExtensionIter->mURI); - switch (headerExtensionURI) { - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_TransmissionTimeOffsets: - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_AbsoluteSendTime: - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_3gpp_VideoOrientation: - case IRTPTypes::HeaderExtensionURIs::HeaderExtensionURI_TransportSequenceNumber: - config.rtp.extensions.push_back(webrtc::RtpExtension(headerExtensionIter->mURI, headerExtensionIter->mID)); - break; - default: - break; - } - } - - config.rtp.c_name = mParameters->mRTCP.mCName; - - mCongestionController->SetBweBitrates(totalMinBitrate, totalTargetBitrate, totalMaxBitrate); - - mModuleProcessThread->Start(); - mModuleProcessThread->RegisterModule(mCallStats.get()); - mModuleProcessThread->RegisterModule(mCongestionController.get()); - mPacerThread->RegisterModule(mCongestionController->pacer()); - mPacerThread->RegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mPacerThread->Start(); - - mSendStream = rtc::scoped_ptr( - new webrtc::internal::VideoSendStream( - numCpuCores, - mModuleProcessThread.get(), - mCallStats.get(), - mCongestionController.get(), - &mRemb, - mBitrateAllocator.get(), - config, - encoderConfig, - suspendedSSRCs - )); - - if (mTransportState == ISecureTransport::State_Connected) - mSendStream->Start(); - - notifyPromisesResolve(); - } - - //------------------------------------------------------------------------- - void RTPMediaEngine::VideoSenderChannelResource::stepShutdown() - { - mDenyNonLockedAccess = true; - - // rare race condition that can happen so - while (mAccessFromNonLockedMethods > 0) - { - // NOTE: very temporary lock so should clear itself out fast - std::this_thread::yield(); - } - - AutoRecursiveLock lock(*this); - - if (mSendStream && mTransportState == ISecureTransport::State_Connected) - mSendStream->Stop(); - - mPacerThread->Stop(); - mPacerThread->DeRegisterModule(mCongestionController->pacer()); - mPacerThread->DeRegisterModule(mCongestionController->GetRemoteBitrateEstimator(true)); - mModuleProcessThread->DeRegisterModule(mCongestionController.get()); - mModuleProcessThread->DeRegisterModule(mCallStats.get()); - mModuleProcessThread->Stop(); - - mCallStats->DeregisterStatsObserver(mCongestionController.get()); - - mSendStream.reset(); - mCongestionController.reset(); - mCallStats.reset(); - mBitrateAllocator.reset(); - mModuleProcessThread.reset(); - mPacerThread.reset(); - - notifyPromisesShutdown(); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineFactory - #pragma mark - - //------------------------------------------------------------------------- - IRTPMediaEngineFactory &IRTPMediaEngineFactory::singleton() - { - return RTPMediaEngineFactory::singleton(); - } - - //------------------------------------------------------------------------- - RTPMediaEnginePtr IRTPMediaEngineFactory::create(IRTPMediaEngineRegistrationPtr registration) - { - if (this) {} - return internal::RTPMediaEngine::create(registration); - } - - } // internal namespace -} diff --git a/ortc/cpp/ortc_RTPPacket.cpp b/ortc/cpp/ortc_RTPPacket.cpp index 3ccc5609..1507269f 100644 --- a/ortc/cpp/ortc_RTPPacket.cpp +++ b/ortc/cpp/ortc_RTPPacket.cpp @@ -29,7 +29,9 @@ */ -#include +#include +#include + #include #include #include @@ -46,11 +48,6 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG #define RTP_HEADER_EXTENSION_BIT (0x10) @@ -65,28 +62,30 @@ #define RTP_GET_BITS(xByte, xBitPattern, xLowestBit) (((xByte) >> (xLowestBit)) & (xBitPattern)) #define RTP_PACK_BITS(xByte, xBitPattern, xLowestBit) (((xByte) & (xBitPattern)) << (xLowestBit)) -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtp_rtcp_packet) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_rtcp_packet) } namespace ortc { - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper) -// ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP) -// -// typedef ortc::services::Hasher SHA1Hasher; + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHelper, UseServicesHelper); + ZS_DECLARE_TYPEDEF_PTR(ortc::internal::Helper, UseHelper); + ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTPUtils, UseRTPUtils); - namespace internal - { - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::Helper, UseHelper) + using CryptoPP::Integer; - using CryptoPP::Integer; + // ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP) + // + // typedef ortc::services::Hasher SHA1Hasher; + + namespace internal + { //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // static const size_t kMinRtpPacketLen = 12; static const BYTE kRtpVersion = 2; @@ -97,7 +96,7 @@ namespace ortc BYTE headerExtensionAppBits, size_t headerExtensionPrepaddedSize, const BYTE *headerExtensionParseStoppedPos - ) + ) noexcept { return (NULL != firstExtension) || (0 != headerExtensionAppBits) || @@ -113,7 +112,7 @@ namespace ortc size_t headerExtensionParseStoppedSize, size_t &outSizeInBytes, size_t &outTotalHeaderExtensions - ) + ) noexcept { typedef RTPPacket::HeaderExtension HeaderExtension; @@ -131,1268 +130,1385 @@ namespace ortc outSizeInBytes += (sizeof(DWORD) - modulas); } } + } // namespace internal + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::HeaderExtension + // + + //--------------------------------------------------------------------------- + void RTPPacket::HeaderExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_6(x, i, Basic, RTPPacketHeaderExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize + ); + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::ClientToMixerExtension - #pragma mark - - //------------------------------------------------------------------------- - RTPPacket::ClientToMixerExtension::ClientToMixerExtension(const HeaderExtension &header) - { - mID = header.mID; - mDataSizeInBytes = header.mDataSizeInBytes; - mPostPaddingSize = header.mPostPaddingSize; - if (NULL == header.mData) mDataSizeInBytes = 0; - if (0 == mDataSizeInBytes) mData = NULL; - - if (sizeof(BYTE) == header.mDataSizeInBytes) { - memcpy(&mLevelBuffer, header.mData, sizeof(BYTE)); - mData = &mLevelBuffer; - } - } + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::ClientToMixerExtension + // - //------------------------------------------------------------------------- - RTPPacket::ClientToMixerExtension::ClientToMixerExtension( - BYTE id, - bool voiceActivity, - BYTE level - ) - { - mID = id; + //--------------------------------------------------------------------------- + RTPPacket::ClientToMixerExtension::ClientToMixerExtension(const HeaderExtension &header) noexcept + { + mID = header.mID; + mDataSizeInBytes = header.mDataSizeInBytes; + mPostPaddingSize = header.mPostPaddingSize; + if (NULL == header.mData) mDataSizeInBytes = 0; + if (0 == mDataSizeInBytes) mData = NULL; + + if (sizeof(BYTE) == header.mDataSizeInBytes) { + memcpy(&mLevelBuffer, header.mData, sizeof(BYTE)); mData = &mLevelBuffer; - mDataSizeInBytes = sizeof(BYTE); - - mLevelBuffer = static_cast(voiceActivity ? 0x80 : 0x00) | (level & 0x7F); } + } - //------------------------------------------------------------------------- - bool RTPPacket::ClientToMixerExtension::voiceActivity() const - { - return RTP_IS_FLAG_SET(mLevelBuffer, 7); - } + //--------------------------------------------------------------------------- + RTPPacket::ClientToMixerExtension::ClientToMixerExtension( + BYTE id, + bool voiceActivity, + BYTE level + ) noexcept + { + mID = id; + mData = &mLevelBuffer; + mDataSizeInBytes = sizeof(BYTE); - //------------------------------------------------------------------------- - BYTE RTPPacket::ClientToMixerExtension::level() const - { - return RTP_GET_BITS(mLevelBuffer, 0x7F, 0); - } + mLevelBuffer = static_cast(voiceActivity ? 0x80 : 0x00) | (level & 0x7F); + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::MixerToClientExtension - #pragma mark + //--------------------------------------------------------------------------- + bool RTPPacket::ClientToMixerExtension::voiceActivity() const noexcept + { + return RTP_IS_FLAG_SET(mLevelBuffer, 7); + } - //------------------------------------------------------------------------- - RTPPacket::MixerToClientExtension::MixerToClientExtension(const HeaderExtension &header) - { - mID = header.mID; - mDataSizeInBytes = header.mDataSizeInBytes; - mPostPaddingSize = header.mPostPaddingSize; - if (NULL == header.mData) mDataSizeInBytes = 0; - if (0 == mDataSizeInBytes) mData = NULL; - - size_t copySize = header.mDataSizeInBytes; - if (copySize > sizeof(mLevelBuffer)) copySize = sizeof(mLevelBuffer); - - if (0 != copySize) { - memcpy(&(mLevelBuffer[0]), header.mData, copySize); - mData = &(mLevelBuffer[0]); - } - mDataSizeInBytes = copySize; - } + //--------------------------------------------------------------------------- + BYTE RTPPacket::ClientToMixerExtension::level() const noexcept + { + return RTP_GET_BITS(mLevelBuffer, 0x7F, 0); + } - //------------------------------------------------------------------------- - RTPPacket::MixerToClientExtension::MixerToClientExtension( - BYTE id, - BYTE *levels, - size_t count - ) - { - mID = id; - mDataSizeInBytes = count * sizeof(BYTE); + //--------------------------------------------------------------------------- + void RTPPacket::ClientToMixerExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_8(x, i, Basic, RTPPacketClientToMixerExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + bool, voiceActivity, voiceActivity(), + byte, level, level() + ); + } - if (mDataSizeInBytes > sizeof(mLevelBuffer)) { - count = sizeof(mLevelBuffer)/sizeof(BYTE); - } + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::MixerToClientExtension + // - if (0 != mDataSizeInBytes) { - mData = &(mLevelBuffer[0]); - memcpy(&(mLevelBuffer[0]), levels, mDataSizeInBytes); - } + //--------------------------------------------------------------------------- + RTPPacket::MixerToClientExtension::MixerToClientExtension(const HeaderExtension &header) noexcept + { + mID = header.mID; + mDataSizeInBytes = header.mDataSizeInBytes; + mPostPaddingSize = header.mPostPaddingSize; + if (NULL == header.mData) mDataSizeInBytes = 0; + if (0 == mDataSizeInBytes) mData = NULL; + + size_t copySize = header.mDataSizeInBytes; + if (copySize > sizeof(mLevelBuffer)) copySize = sizeof(mLevelBuffer); + + if (0 != copySize) { + memcpy(&(mLevelBuffer[0]), header.mData, copySize); + mData = &(mLevelBuffer[0]); } + mDataSizeInBytes = copySize; + } - //------------------------------------------------------------------------- - size_t RTPPacket::MixerToClientExtension::levelsCount() const - { - return mDataSizeInBytes / sizeof(BYTE); - } + //--------------------------------------------------------------------------- + RTPPacket::MixerToClientExtension::MixerToClientExtension( + BYTE id, + BYTE *levels, + size_t count + ) noexcept + { + mID = id; + mDataSizeInBytes = count * sizeof(BYTE); - //------------------------------------------------------------------------- - BYTE RTPPacket::MixerToClientExtension::unusedBit(size_t index) const - { - ASSERT(index < levelsCount()) - return RTP_GET_BITS(mLevelBuffer[index], 0x80, 7); + if (mDataSizeInBytes > sizeof(mLevelBuffer)) { + count = sizeof(mLevelBuffer)/sizeof(BYTE); } - //------------------------------------------------------------------------- - BYTE RTPPacket::MixerToClientExtension::level(size_t index) const - { - ASSERT(index < levelsCount()) - return RTP_GET_BITS(mLevelBuffer[index], 0x7F, 0); + if (0 != mDataSizeInBytes) { + mData = &(mLevelBuffer[0]); + memcpy(&(mLevelBuffer[0]), levels, mDataSizeInBytes); } + } + //--------------------------------------------------------------------------- + size_t RTPPacket::MixerToClientExtension::levelsCount() const noexcept + { + return mDataSizeInBytes / sizeof(BYTE); + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::StringHeaderExtension - #pragma mark - - //------------------------------------------------------------------------- - RTPPacket::StringHeaderExtension::StringHeaderExtension(const HeaderExtension &header) - { - ASSERT(sizeof(char) == sizeof(BYTE)) + //--------------------------------------------------------------------------- + BYTE RTPPacket::MixerToClientExtension::unusedBit(size_t index) const noexcept + { + ZS_ASSERT(index < levelsCount()); + return RTP_GET_BITS(mLevelBuffer[index], 0x80, 7); + } - mID = header.mID; - mDataSizeInBytes = header.mDataSizeInBytes; - mPostPaddingSize = header.mPostPaddingSize; - if (NULL == header.mData) mDataSizeInBytes = 0; - if (0 == mDataSizeInBytes) mData = NULL; + //--------------------------------------------------------------------------- + BYTE RTPPacket::MixerToClientExtension::level(size_t index) const noexcept + { + ZS_ASSERT(index < levelsCount()); + return RTP_GET_BITS(mLevelBuffer[index], 0x7F, 0); + } - size_t copySize = header.mDataSizeInBytes; - if (copySize > (sizeof(BYTE)*kMaxStringLength)) copySize = (sizeof(BYTE)*kMaxStringLength); + //--------------------------------------------------------------------------- + void RTPPacket::MixerToClientExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_7(x, i, Basic, RTPPacketMixerToClientExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + size_t, levelsCount, levelsCount() + ); + } - if (0 != copySize) { - memcpy(&(mStringBuffer[0]), header.mData, copySize); - mData = &(mStringBuffer[0]); - } - mDataSizeInBytes = copySize; - } + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::StringHeaderExtension + // - //------------------------------------------------------------------------- - RTPPacket::StringHeaderExtension::StringHeaderExtension( - BYTE id, - const char *mid - ) - { - mID = id; - mData = &(mStringBuffer[0]); - mDataSizeInBytes = sizeof(char)*(NULL != mid ? strlen(mid) : 0); + //--------------------------------------------------------------------------- + RTPPacket::StringHeaderExtension::StringHeaderExtension(const HeaderExtension &header) noexcept + { + ZS_ASSERT(sizeof(char) == sizeof(BYTE)); - if (mDataSizeInBytes > (sizeof(BYTE)*kMaxStringLength)) mDataSizeInBytes = (sizeof(BYTE)*kMaxStringLength); + mID = header.mID; + mDataSizeInBytes = header.mDataSizeInBytes; + mPostPaddingSize = header.mPostPaddingSize; + if (NULL == header.mData) mDataSizeInBytes = 0; + if (0 == mDataSizeInBytes) mData = NULL; - if (0 != mDataSizeInBytes) { - memcpy(&(mStringBuffer[0]), mid, mDataSizeInBytes); - } - } + size_t copySize = header.mDataSizeInBytes; + if (copySize > (sizeof(BYTE)*kMaxStringLength)) copySize = (sizeof(BYTE)*kMaxStringLength); - //------------------------------------------------------------------------- - const char *RTPPacket::StringHeaderExtension::str() const - { - return reinterpret_cast(&mStringBuffer[0]); + if (0 != copySize) { + memcpy(&(mStringBuffer[0]), header.mData, copySize); + mData = &(mStringBuffer[0]); } + mDataSizeInBytes = copySize; + } - //------------------------------------------------------------------------- - ElementPtr RTPPacket::StringHeaderExtension::toDebug() const - { - ElementPtr result = Element::create("ortc::RTPPacket::StringHeaderExtension"); + //--------------------------------------------------------------------------- + RTPPacket::StringHeaderExtension::StringHeaderExtension( + BYTE id, + const char *mid + ) noexcept + { + mID = id; + mData = &(mStringBuffer[0]); + mDataSizeInBytes = sizeof(char)*(NULL != mid ? strlen(mid) : 0); - UseServicesHelper::debugAppend(result, "str", str()); + if (mDataSizeInBytes > (sizeof(BYTE)*kMaxStringLength)) mDataSizeInBytes = (sizeof(BYTE)*kMaxStringLength); - return result; + if (0 != mDataSizeInBytes) { + memcpy(&(mStringBuffer[0]), mid, mDataSizeInBytes); } + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::StringHeaderExtension - #pragma mark - - //------------------------------------------------------------------------- - RTPPacket::NumberHeaderExtension::NumberHeaderExtension(const HeaderExtension &header) - { - ASSERT(sizeof(char) == sizeof(BYTE)) - - mID = header.mID; - mDataSizeInBytes = header.mDataSizeInBytes; - mPostPaddingSize = header.mPostPaddingSize; - if (NULL == header.mData) mDataSizeInBytes = 0; - if (0 == mDataSizeInBytes) mData = NULL; + //--------------------------------------------------------------------------- + const char *RTPPacket::StringHeaderExtension::str() const noexcept + { + return reinterpret_cast(&mStringBuffer[0]); + } - size_t copySize = header.mDataSizeInBytes; - if (copySize > (sizeof(BYTE)*kMaxNumberByteLength)) copySize = (sizeof(BYTE)*kMaxNumberByteLength); + //--------------------------------------------------------------------------- + void RTPPacket::StringHeaderExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_7(x, i, Basic, RTPPacketStringHeaderExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + string, str, str() + ); + } - if (0 != copySize) { - memcpy(&(mNumberBuffer[0]), header.mData, copySize); - mData = &(mNumberBuffer[0]); - } - mDataSizeInBytes = copySize; - } + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::NumberHeaderExtension + // - //------------------------------------------------------------------------- - RTPPacket::NumberHeaderExtension::NumberHeaderExtension( - BYTE id, - const BYTE *number, - size_t lengthInBytes - ) - { - mID = id; - mData = &(mNumberBuffer[0]); - mDataSizeInBytes = sizeof(char)*(NULL != number ? lengthInBytes : 0); + //--------------------------------------------------------------------------- + RTPPacket::NumberHeaderExtension::NumberHeaderExtension(const HeaderExtension &header) noexcept + { + ZS_ASSERT(sizeof(char) == sizeof(BYTE)); - if (mDataSizeInBytes > (sizeof(BYTE)*kMaxNumberByteLength)) mDataSizeInBytes = (sizeof(BYTE)*kMaxNumberByteLength); + mID = header.mID; + mDataSizeInBytes = header.mDataSizeInBytes; + mPostPaddingSize = header.mPostPaddingSize; + if (NULL == header.mData) mDataSizeInBytes = 0; + if (0 == mDataSizeInBytes) mData = NULL; - if (0 != mDataSizeInBytes) { - memcpy(&(mNumberBuffer[0]), number, mDataSizeInBytes); - } - } + size_t copySize = header.mDataSizeInBytes; + if (copySize > (sizeof(BYTE)*kMaxNumberByteLength)) copySize = (sizeof(BYTE)*kMaxNumberByteLength); - //------------------------------------------------------------------------- - RTPPacket::NumberHeaderExtension::NumberHeaderExtension( - BYTE id, - const char *valueInBase10 - ) - { - mID = id; + if (0 != copySize) { + memcpy(&(mNumberBuffer[0]), header.mData, copySize); mData = &(mNumberBuffer[0]); - mDataSizeInBytes = 1; - - String str(valueInBase10); - - try { - Integer value(str); // convert from base 10 into big number class - - size_t minSizeNeeded = value.MinEncodedSize(); - ORTC_THROW_INVALID_PARAMETERS_IF(minSizeNeeded > kMaxNumberByteLength) - - // this will encode in big endian and pad with most significant "0" - // values as needed - value.Encode(&(mNumberBuffer[0]), minSizeNeeded); - - mDataSizeInBytes = minSizeNeeded; - - } catch(...) { - ORTC_THROW_INVALID_PARAMETERS("unable to convert integer: " + str) - } } + mDataSizeInBytes = copySize; + } - //------------------------------------------------------------------------- - const BYTE *RTPPacket::NumberHeaderExtension::number() const - { - return &(mNumberBuffer[0]); - } - - //------------------------------------------------------------------------- - size_t RTPPacket::NumberHeaderExtension::length() const - { - return mDataSizeInBytes; - } - - //------------------------------------------------------------------------- - String RTPPacket::NumberHeaderExtension::str() const - { - if (mDataSizeInBytes < 1) return String(); - - Integer value(&(mNumberBuffer[0]), mDataSizeInBytes); - - std::stringstream output; + //--------------------------------------------------------------------------- + RTPPacket::NumberHeaderExtension::NumberHeaderExtension( + BYTE id, + const BYTE *number, + size_t lengthInBytes + ) noexcept + { + mID = id; + mData = &(mNumberBuffer[0]); + mDataSizeInBytes = sizeof(char)*(NULL != number ? lengthInBytes : 0); - output << value; + if (mDataSizeInBytes > (sizeof(BYTE)*kMaxNumberByteLength)) mDataSizeInBytes = (sizeof(BYTE)*kMaxNumberByteLength); - return output.str(); + if (0 != mDataSizeInBytes) { + memcpy(&(mNumberBuffer[0]), number, mDataSizeInBytes); } + } - //------------------------------------------------------------------------- - ElementPtr RTPPacket::NumberHeaderExtension::toDebug() const - { - ElementPtr result = Element::create("ortc::RTPPacket::NumberHeaderExtension"); - - Integer value(number(), length()); + //--------------------------------------------------------------------------- + RTPPacket::NumberHeaderExtension::NumberHeaderExtension( + BYTE id, + const char *valueInBase10 + ) noexcept(false) + { + mID = id; + mData = &(mNumberBuffer[0]); + mDataSizeInBytes = 1; - UseServicesHelper::debugAppend(result, "number", str()); + String str(valueInBase10); - return result; - } + try { + Integer value(str); // convert from base 10 into big number class - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::MidHeaderExtension - #pragma mark + size_t minSizeNeeded = value.MinEncodedSize(); + ORTC_THROW_INVALID_PARAMETERS_IF(minSizeNeeded > kMaxNumberByteLength) - //------------------------------------------------------------------------- - ElementPtr RTPPacket::MidHeaderExtension::toDebug() const - { - ElementPtr result = Element::create("ortc::RTPPacket::MidHeaderExtension"); + // this will encode in big endian and pad with most significant "0" + // values as needed + value.Encode(&(mNumberBuffer[0]), minSizeNeeded); - UseServicesHelper::debugAppend(result, "mid", mid()); + mDataSizeInBytes = minSizeNeeded; - return result; + } catch(...) { + ORTC_THROW_INVALID_PARAMETERS("unable to convert integer: " + str) } + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::RidHeaderExtension - #pragma mark + //--------------------------------------------------------------------------- + const BYTE *RTPPacket::NumberHeaderExtension::number() const noexcept + { + return &(mNumberBuffer[0]); + } - //------------------------------------------------------------------------- - ElementPtr RTPPacket::RidHeaderExtension::toDebug() const - { - ElementPtr result = Element::create("ortc::RTPPacket::RidHeaderExtension"); + //--------------------------------------------------------------------------- + size_t RTPPacket::NumberHeaderExtension::length() const noexcept + { + return mDataSizeInBytes; + } - UseServicesHelper::debugAppend(result, "rid", rid()); + //--------------------------------------------------------------------------- + String RTPPacket::NumberHeaderExtension::str() const noexcept + { + if (mDataSizeInBytes < 1) return String(); - return result; - } + Integer value(&(mNumberBuffer[0]), mDataSizeInBytes); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::VideoOrientationHeaderExtension - #pragma mark + std::stringstream output; - //------------------------------------------------------------------------- - RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension(const HeaderExtension &header) - { - mID = header.mID; - mDataSizeInBytes = header.mDataSizeInBytes; - mPostPaddingSize = header.mPostPaddingSize; - if (NULL == header.mData) mDataSizeInBytes = 0; + output << value; - if (mDataSizeInBytes < sizeof(mEncoded)) return; // cannot decrypt this packet - } + return output.str(); + } - //------------------------------------------------------------------------- - RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension(const VideoOrientation6HeaderExtension &) - { - mData = &(mEncoded[0]); - mDataSizeInBytes = sizeof(mEncoded); - } + //--------------------------------------------------------------------------- + void RTPPacket::NumberHeaderExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_7(x, i, Basic, RTPPacketNumberHeaderExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + string, number, str() + ); + } - //------------------------------------------------------------------------- - RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension( - const Clockwise &, - bool frontFacingCamera, - bool flip, - UINT orientation - ) - { - mData = &(mEncoded[0]); - mDataSizeInBytes = sizeof(mEncoded); + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::MidHeaderExtension + // + + //--------------------------------------------------------------------------- + void RTPPacket::MidHeaderExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_7(x, i, Basic, RTPPacketMidHeaderExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + bool, data, mData ? true : false, + size_t, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + string, mid, mid() + ); + } - orientation %= 360; + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::RidHeaderExtension + // + + //--------------------------------------------------------------------------- + void RTPPacket::RidHeaderExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_7(x, i, Insane, RTPPacketRidHeaderExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + string, rid, rid() + ); + } - // find closest approximation to the video orientation for the 2 bit allowance - orientation += 45; // range is now 45 -> 404 - orientation /= 90; - orientation %= 4; // range is now 0..3 + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::VideoOrientationHeaderExtension + // - // Bit# 7 6 5 4 3 2 1 0 (LSB) - // Definition 0 0 0 0 C F R1 R0 + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension(const HeaderExtension &header) noexcept + { + mID = header.mID; + mDataSizeInBytes = header.mDataSizeInBytes; + mPostPaddingSize = header.mPostPaddingSize; + if (NULL == header.mData) mDataSizeInBytes = 0; - mEncoded[0] = RTP_PACK_BITS(frontFacingCamera ? 1 : 0, 0x1, 3) | - RTP_PACK_BITS(flip ? 1 : 0, 0x1, 2) | - RTP_PACK_BITS(static_cast(orientation), 0x3, 0); - } + if (mDataSizeInBytes < sizeof(mEncoded)) return; // cannot decrypt this packet + } - //------------------------------------------------------------------------- - RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension( - const CounterClockwise &, - bool frontFacingCamera, // true = front facing, false = backfacing - bool flip, // horizontal left-right flip (mirro) - UINT orientation - ) : - VideoOrientationHeaderExtension(Clockwise {}, frontFacingCamera, flip, 360-(orientation%360)) - { - } + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension(const VideoOrientation6HeaderExtension &) noexcept + { + mData = &(mEncoded[0]); + mDataSizeInBytes = sizeof(mEncoded); + } - //------------------------------------------------------------------------- - bool RTPPacket::VideoOrientationHeaderExtension::frontFacing() const - { - if (NULL == mData) return false; - return (0 != RTP_GET_BITS(mData[0], 0x1, 3)); - } + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension( + const Clockwise &, + bool frontFacingCamera, + bool flip, + UINT orientation + ) noexcept + { + mData = &(mEncoded[0]); + mDataSizeInBytes = sizeof(mEncoded); - //------------------------------------------------------------------------- - bool RTPPacket::VideoOrientationHeaderExtension::backFacing() const - { - if (NULL == mData) return false; - return (0 == RTP_GET_BITS(mData[0], 0x1, 3)); - } + orientation %= 360; - //------------------------------------------------------------------------- - bool RTPPacket::VideoOrientationHeaderExtension::flip() const - { - if (NULL == mData) return false; - return (0 == RTP_GET_BITS(mData[0], 0x1, 2)); - } + // find closest approximation to the video orientation for the 2 bit allowance + orientation += 45; // range is now 45 -> 404 + orientation /= 90; + orientation %= 4; // range is now 0..3 - //------------------------------------------------------------------------- - UINT RTPPacket::VideoOrientationHeaderExtension::degreesClockwise() const - { - if (NULL == mData) return 0; - UINT degrees = static_cast(RTP_GET_BITS(mData[0], 0x3, 0)); + // Bit# 7 6 5 4 3 2 1 0 (LSB) + // Definition 0 0 0 0 C F R1 R0 - degrees *= 90; + mEncoded[0] = RTP_PACK_BITS(frontFacingCamera ? 1 : 0, 0x1, 3) | + RTP_PACK_BITS(flip ? 1 : 0, 0x1, 2) | + RTP_PACK_BITS(static_cast(orientation), 0x3, 0); + } - return degrees; - } + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientationHeaderExtension::VideoOrientationHeaderExtension( + const CounterClockwise &, + bool frontFacingCamera, // true = front facing, false = backfacing + bool flip, // horizontal left-right flip (mirro) + UINT orientation + ) noexcept : + VideoOrientationHeaderExtension(Clockwise {}, frontFacingCamera, flip, 360-(orientation%360)) + { + } - //------------------------------------------------------------------------- - UINT RTPPacket::VideoOrientationHeaderExtension::degreesCounterClockwise() const - { - return (360-degreesClockwise())%360; - } + //--------------------------------------------------------------------------- + bool RTPPacket::VideoOrientationHeaderExtension::frontFacing() const noexcept + { + if (NULL == mData) return false; + return (0 != RTP_GET_BITS(mData[0], 0x1, 3)); + } - //------------------------------------------------------------------------- - ElementPtr RTPPacket::VideoOrientationHeaderExtension::toDebug() const - { - ElementPtr result = Element::create("ortc::RTPPacket::VideoOrientationHeaderExtension"); + //--------------------------------------------------------------------------- + bool RTPPacket::VideoOrientationHeaderExtension::backFacing() const noexcept + { + if (NULL == mData) return false; + return (0 == RTP_GET_BITS(mData[0], 0x1, 3)); + } - UseServicesHelper::debugAppend(result, "front facing", frontFacing()); - UseServicesHelper::debugAppend(result, "flip", flip()); - UseServicesHelper::debugAppend(result, "degrees", degreesClockwise()); + //--------------------------------------------------------------------------- + bool RTPPacket::VideoOrientationHeaderExtension::flip() const noexcept + { + if (NULL == mData) return false; + return (0 == RTP_GET_BITS(mData[0], 0x1, 2)); + } - return result; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::VideoOrientation6HeaderExtension - #pragma mark + //--------------------------------------------------------------------------- + UINT RTPPacket::VideoOrientationHeaderExtension::degreesClockwise() const noexcept + { + if (NULL == mData) return 0; + UINT degrees = static_cast(RTP_GET_BITS(mData[0], 0x3, 0)); - //------------------------------------------------------------------------- - RTPPacket::VideoOrientation6HeaderExtension::VideoOrientation6HeaderExtension(const HeaderExtension &header) : - VideoOrientationHeaderExtension(header) - { - } + degrees *= 90; - //------------------------------------------------------------------------- - RTPPacket::VideoOrientation6HeaderExtension::VideoOrientation6HeaderExtension( - const Clockwise &, - bool frontFacingCamera, - bool flip, - UINT orientation - ) : - VideoOrientationHeaderExtension(*this) - { - // find closest approximation to the video orientation for the 6 bit allowance - orientation %= 360; - - // r = x * 360 - // ------- - // 64 - // - // r * 64 = x * 360 - // - // x = r * 64 - // ------ - // 360 - - orientation *= 64; - orientation /= 360; - orientation %= 64; - - // Bit# 7 6 5 4 3 2 1 0 (LSB) - // Definition R5 R4 R3 R2 C F R1 R0 - - // R1 R0 R5 R4 R3 R2 - // 0 0 0 0 0 0 = 0 - // 0 0 0 0 0 1 = 1 - // 1 1 1 1 1 1 = 63 - - BYTE ordered = static_cast(orientation) & 0x3F; - - mEncoded[0] = RTP_PACK_BITS(frontFacingCamera ? 1 : 0, 0x1, 3) | - RTP_PACK_BITS(flip ? 1 : 0, 0x1, 2) | - RTP_PACK_BITS(RTP_GET_BITS(ordered, 0x3, 4), 0x3, 0) | - RTP_PACK_BITS(RTP_GET_BITS(ordered, 0xF, 0), 0xF, 4); - } + return degrees; + } - //------------------------------------------------------------------------- - RTPPacket::VideoOrientation6HeaderExtension::VideoOrientation6HeaderExtension( - const CounterClockwise &, - bool frontFacingCamera, - bool flip, - UINT orientation - ) : - VideoOrientation6HeaderExtension(Clockwise{}, frontFacingCamera, flip, 360-(orientation % 360)) - { - } + //--------------------------------------------------------------------------- + UINT RTPPacket::VideoOrientationHeaderExtension::degreesCounterClockwise() const noexcept + { + return (360-degreesClockwise())%360; + } - //------------------------------------------------------------------------- - UINT RTPPacket::VideoOrientation6HeaderExtension::degreesClockwise() const - { - if (NULL == mData) return 0; + //--------------------------------------------------------------------------- + void RTPPacket::VideoOrientationHeaderExtension::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_9(x, i, Basic, RTPPacketVideoOrientationHeaderExtension, ol, RtpPacket, Info, + string, func, func, + string, message, message, + byte, id, mID, + binary, data, mData, + size, dataSizeInBytes, mDataSizeInBytes, + size_t, postPaddingSize, mPostPaddingSize, + bool, frontFacing, frontFacing(), + bool, flip, flip(), + uint64, degrees, degreesClockwise() + ); + } + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket::VideoOrientation6HeaderExtension + // + + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientation6HeaderExtension::VideoOrientation6HeaderExtension(const HeaderExtension &header) noexcept : + VideoOrientationHeaderExtension(header) + { + } - BYTE ordered = RTP_PACK_BITS(RTP_GET_BITS(mData[0], 0x3, 0), 0x3, 4) | - RTP_PACK_BITS(RTP_GET_BITS(mData[0], 0xF, 4), 0xF, 0); + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientation6HeaderExtension::VideoOrientation6HeaderExtension( + const Clockwise &, + bool frontFacingCamera, + bool flip, + UINT orientation + ) noexcept : + VideoOrientationHeaderExtension(*this) + { + // find closest approximation to the video orientation for the 6 bit allowance + orientation %= 360; + + // r = x * 360 + // ------- + // 64 + // + // r * 64 = x * 360 + // + // x = r * 64 + // ------ + // 360 + + orientation *= 64; + orientation /= 360; + orientation %= 64; + + // Bit# 7 6 5 4 3 2 1 0 (LSB) + // Definition R5 R4 R3 R2 C F R1 R0 + + // R1 R0 R5 R4 R3 R2 + // 0 0 0 0 0 0 = 0 + // 0 0 0 0 0 1 = 1 + // 1 1 1 1 1 1 = 63 + + BYTE ordered = static_cast(orientation) & 0x3F; + + mEncoded[0] = RTP_PACK_BITS(frontFacingCamera ? 1 : 0, 0x1, 3) | + RTP_PACK_BITS(flip ? 1 : 0, 0x1, 2) | + RTP_PACK_BITS(RTP_GET_BITS(ordered, 0x3, 4), 0x3, 0) | + RTP_PACK_BITS(RTP_GET_BITS(ordered, 0xF, 0), 0xF, 4); + } - UINT degrees = (static_cast(ordered)*360)/64; - return degrees % 360; - } + //--------------------------------------------------------------------------- + RTPPacket::VideoOrientation6HeaderExtension::VideoOrientation6HeaderExtension( + const CounterClockwise &, + bool frontFacingCamera, + bool flip, + UINT orientation + ) noexcept : + VideoOrientation6HeaderExtension(Clockwise{}, frontFacingCamera, flip, 360-(orientation % 360)) + { + } - //------------------------------------------------------------------------- - UINT RTPPacket::VideoOrientation6HeaderExtension::degreesCounterClockwise() const - { - return (360-degreesClockwise())%360; - } + //--------------------------------------------------------------------------- + UINT RTPPacket::VideoOrientation6HeaderExtension::degreesClockwise() const noexcept + { + if (NULL == mData) return 0; - //------------------------------------------------------------------------- - ElementPtr RTPPacket::VideoOrientation6HeaderExtension::toDebug() const - { - ElementPtr result = Element::create("ortc::RTPPacket::VideoOrientation6HeaderExtension"); + BYTE ordered = RTP_PACK_BITS(RTP_GET_BITS(mData[0], 0x3, 0), 0x3, 4) | + RTP_PACK_BITS(RTP_GET_BITS(mData[0], 0xF, 4), 0xF, 0); - UseServicesHelper::debugAppend(result, "front facing", frontFacing()); - UseServicesHelper::debugAppend(result, "flip", flip()); - UseServicesHelper::debugAppend(result, "degrees", degreesClockwise()); + UINT degrees = (static_cast(ordered)*360)/64; + return degrees % 360; + } - return result; - } + //--------------------------------------------------------------------------- + UINT RTPPacket::VideoOrientation6HeaderExtension::degreesCounterClockwise() const noexcept + { + return (360-degreesClockwise())%360; + } - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket (public) - #pragma mark + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket (public) + // + + //--------------------------------------------------------------------------- + RTPPacket::RTPPacket( + const make_private &, + MediaChannelID mediaChannelID + ) noexcept : + mMediaChannelID(mediaChannelID) + { + } - //------------------------------------------------------------------------- - RTPPacket::RTPPacket(const make_private &) - { + //--------------------------------------------------------------------------- + RTPPacket::~RTPPacket() noexcept + { + if (mHeaderExtensions) { + delete [] mHeaderExtensions; + mHeaderExtensions = NULL; } + } - //------------------------------------------------------------------------- - RTPPacket::~RTPPacket() - { - if (mHeaderExtensions) { - delete [] mHeaderExtensions; - mHeaderExtensions = NULL; - } - } + //--------------------------------------------------------------------------- + RTPPacketPtr RTPPacket::create( + const RTPPacket &packet, + MediaChannelID mediaChannelID + ) noexcept + { + RTPPacketPtr pThis(make_shared(make_private{}, mediaChannelID)); + pThis->generate(packet); + return pThis; + } - //------------------------------------------------------------------------- - RTPPacketPtr RTPPacket::create(const RTPPacket &packet) - { - RTPPacketPtr pThis(make_shared(make_private{})); - pThis->generate(packet); - return pThis; - } + //--------------------------------------------------------------------------- + RTPPacketPtr RTPPacket::create(const CreationParams ¶ms) noexcept + { + RTPPacketPtr pThis(make_shared(make_private{}, params.mMediaChannelID)); + pThis->generate(params); + return pThis; + } - //------------------------------------------------------------------------- - RTPPacketPtr RTPPacket::create(const CreationParams ¶ms) - { - RTPPacketPtr pThis(make_shared(make_private{})); - pThis->generate(params); - return pThis; - } + //--------------------------------------------------------------------------- + RTPPacketPtr RTPPacket::create( + const BYTE *buffer, + size_t bufferLengthInBytes, + MediaChannelID mediaChannelID + ) noexcept + { + ZS_ASSERT(buffer); + ZS_ASSERT(0 != bufferLengthInBytes); + return RTPPacket::create(UseServicesHelper::convertToBuffer(buffer, bufferLengthInBytes), mediaChannelID); + } - //------------------------------------------------------------------------- - RTPPacketPtr RTPPacket::create(const BYTE *buffer, size_t bufferLengthInBytes) - { - ORTC_THROW_INVALID_PARAMETERS_IF(!buffer) - ORTC_THROW_INVALID_PARAMETERS_IF(0 == bufferLengthInBytes) - return RTPPacket::create(UseServicesHelper::convertToBuffer(buffer, bufferLengthInBytes)); - } + //--------------------------------------------------------------------------- + RTPPacketPtr RTPPacket::create( + const SecureByteBlock &buffer, + ZS_MAYBE_USED() MediaChannelID mediaChannelID + ) noexcept + { + ZS_MAYBE_USED(mediaChannelID); + return RTPPacket::create(buffer.BytePtr(), buffer.SizeInBytes()); + } - //------------------------------------------------------------------------- - RTPPacketPtr RTPPacket::create(const SecureByteBlock &buffer) - { - return RTPPacket::create(buffer.BytePtr(), buffer.SizeInBytes()); + //--------------------------------------------------------------------------- + RTPPacketPtr RTPPacket::create( + SecureByteBlockPtr buffer, + MediaChannelID mediaChannelID + ) noexcept + { + RTPPacketPtr pThis(make_shared(make_private{}, mediaChannelID)); + pThis->mBuffer = buffer; + if (!pThis->parse()) { + ZS_EVENTING_2(x, w, Debug, RTPPacketCreate, ol, RtpPacket, Start, puid, mediaChannelId, pThis->mMediaChannelID, string, message, "packet could not be parsed"); + return RTPPacketPtr(); } + return pThis; + } - //------------------------------------------------------------------------- - RTPPacketPtr RTPPacket::create(SecureByteBlockPtr buffer) - { - RTPPacketPtr pThis(make_shared(make_private{})); - pThis->mBuffer = buffer; - if (!pThis->parse()) { - ZS_LOG_WARNING(Debug, pThis->log("packet could not be parsed")) - return RTPPacketPtr(); - } - return pThis; - } + //--------------------------------------------------------------------------- + const BYTE *RTPPacket::ptr() const noexcept + { + return mBuffer->BytePtr(); + } - //------------------------------------------------------------------------- - const BYTE *RTPPacket::ptr() const - { - return mBuffer->BytePtr(); - } + //--------------------------------------------------------------------------- + size_t RTPPacket::size() const noexcept + { + return mBuffer->SizeInBytes(); + } - //------------------------------------------------------------------------- - size_t RTPPacket::size() const - { - return mBuffer->SizeInBytes(); - } + //--------------------------------------------------------------------------- + SecureByteBlockPtr RTPPacket::buffer() const noexcept + { + return mBuffer; + } - //------------------------------------------------------------------------- - SecureByteBlockPtr RTPPacket::buffer() const - { - return mBuffer; - } + //--------------------------------------------------------------------------- + DWORD RTPPacket::getCSRC(size_t index) const noexcept + { + ZS_ASSERT(index < cc()); + return UseRTPUtils::getBE32(&((ptr())[internal::kMinRtpPacketLen + (sizeof(DWORD)*index)])); + } - //------------------------------------------------------------------------- - DWORD RTPPacket::getCSRC(size_t index) const - { - ASSERT(index < cc()) - return RTPUtils::getBE32(&((ptr())[kMinRtpPacketLen + (sizeof(DWORD)*index)])); - } + //--------------------------------------------------------------------------- + const BYTE *RTPPacket::payload() const noexcept + { + if (0 == mPayloadSize) return NULL; + const BYTE *buffer = ptr(); + return &(buffer[mHeaderSize + mHeaderExtensionSize]); + } - //------------------------------------------------------------------------- - const BYTE *RTPPacket::payload() const - { - if (0 == mPayloadSize) return NULL; - const BYTE *buffer = ptr(); - return &(buffer[mHeaderSize + mHeaderExtensionSize]); - } + //--------------------------------------------------------------------------- + RTPPacket::HeaderExtension *RTPPacket::getHeaderExtensionAtIndex(size_t index) const noexcept + { + if (index >= mTotalHeaderExtensions) return NULL; + return &(mHeaderExtensions[index]); + } - //------------------------------------------------------------------------- - RTPPacket::HeaderExtension *RTPPacket::getHeaderExtensionAtIndex(size_t index) const - { - if (index >= mTotalHeaderExtensions) return NULL; - return &(mHeaderExtensions[index]); + //--------------------------------------------------------------------------- + void RTPPacket::trace( + const char *func, + const char *message + ) const noexcept + { + ZS_EVENTING_21(x, i, Basic, RTPPacketTrace, ol, RtpPacket, Info, + string, func, func, + string, message, message, + puid, mediaChannelID, mMediaChannelID, + binary, buffer, mBuffer ? mBuffer->BytePtr() : NULL, + size, size, mBuffer ? mBuffer->SizeInBytes() : 0, + byte, version, mVersion, + size_t, padding, mPadding, + byte, cc, mCC, + bool, m, mM, + byte, pt, mPT, + word, sequenceNumber, mSequenceNumber, + dword, timestamp, mTimestamp, + dword, ssrc, mSSRC, + size_t, headerSize, mHeaderSize, + size_t, headerExtensionSize, mHeaderExtensionSize, + size_t, payloadSize, mPayloadSize, + size_t, totalHeaderExtensions, mTotalHeaderExtensions, + byte, headerExtensionAppBits, mHeaderExtensionAppBits, + size_t, headerExtensionPrepaddedSize, mHeaderExtensionPrepaddedSize, + binary, headerExtensionParseStoppedPos, mHeaderExtensionParseStoppedPos, + size, headerExtensionParseStoppedSize, mHeaderExtensionParseStoppedSize + ); + + for (auto current = mHeaderExtensions; NULL != current; current = current->mNext) { + current->trace(func, message); } + } - //------------------------------------------------------------------------- - ElementPtr RTPPacket::toDebug() const - { - ElementPtr objectEl = Element::create("ortc::RTPPacket"); - - UseServicesHelper::debugAppend(objectEl, "buffer", mBuffer ? mBuffer->SizeInBytes() : 0); - - UseServicesHelper::debugAppend(objectEl, "version", mVersion); - UseServicesHelper::debugAppend(objectEl, "padding", mPadding); - UseServicesHelper::debugAppend(objectEl, "cc", mCC); - UseServicesHelper::debugAppend(objectEl, "m", mM); - UseServicesHelper::debugAppend(objectEl, "pt", mPT); - UseServicesHelper::debugAppend(objectEl, "sequence number", mSequenceNumber); - UseServicesHelper::debugAppend(objectEl, "timestamp", mTimestamp); - UseServicesHelper::debugAppend(objectEl, "ssrc", mSSRC); - - UseServicesHelper::debugAppend(objectEl, "header size", mHeaderSize); - UseServicesHelper::debugAppend(objectEl, "extension header size", mHeaderExtensionSize); - UseServicesHelper::debugAppend(objectEl, "payload size", mPayloadSize); - - UseServicesHelper::debugAppend(objectEl, "total header extensions", mTotalHeaderExtensions); - - for (auto current = mHeaderExtensions; NULL != current; current = current->mNext) - { - ElementPtr extensionEl = Element::create("extension"); - UseServicesHelper::debugAppend(extensionEl, "id", current->mID); - UseServicesHelper::debugAppend(extensionEl, "size", current->mDataSizeInBytes); - UseServicesHelper::debugAppend(extensionEl, "data", (NULL != current->mData) ? UseServicesHelper::convertToHex(current->mData, current->mDataSizeInBytes) : String()); - UseServicesHelper::debugAppend(extensionEl, "padding", current->mPostPaddingSize); - UseServicesHelper::debugAppend(objectEl, extensionEl); - } - - UseServicesHelper::debugAppend(objectEl, "header extension appbits", mHeaderExtensionAppBits); - - UseServicesHelper::debugAppend(objectEl, "header extension prepadding size", mHeaderExtensionPrepaddedSize); - UseServicesHelper::debugAppend(objectEl, "header extension parse stopped pos", (NULL != mHeaderExtensionParseStoppedPos) ? ((PTRNUMBER)(mHeaderExtensionParseStoppedPos - ptr())) : 0); - UseServicesHelper::debugAppend(objectEl, "header extension parse stopped size", mHeaderExtensionParseStoppedSize); - - return objectEl; - } + //--------------------------------------------------------------------------- + static bool requiresTwoByteHeader( + RTPPacket::HeaderExtension *firstExtension, + BYTE headerExtensionAppBits + ) noexcept + { + typedef RTPPacket::HeaderExtension HeaderExtension; - //------------------------------------------------------------------------- - static bool requiresTwoByteHeader( - RTPPacket::HeaderExtension *firstExtension, - BYTE headerExtensionAppBits - ) - { - typedef RTPPacket::HeaderExtension HeaderExtension; + bool twoByteHeader = (0 != headerExtensionAppBits); + if (!twoByteHeader) { + for (HeaderExtension *current = firstExtension; NULL != current; current = current->mNext) { + ZS_ASSERT(0 != current->mID); // not legal - bool twoByteHeader = (0 != headerExtensionAppBits); - if (!twoByteHeader) { - for (HeaderExtension *current = firstExtension; NULL != current; current = current->mNext) { - ASSERT(0 != current->mID) // not legal - - if (current->mID > 14) { - twoByteHeader = true; - break; - } - if (0 == current->mDataSizeInBytes) { - twoByteHeader = true; - break; - } - if (current->mDataSizeInBytes > 16) { - ASSERT(current->mDataSizeInBytes < 255) - twoByteHeader = true; - break; - } + if (current->mID > 14) { + twoByteHeader = true; + break; + } + if (0 == current->mDataSizeInBytes) { + twoByteHeader = true; + break; + } + if (current->mDataSizeInBytes > 16) { + ZS_ASSERT(current->mDataSizeInBytes < 255); + twoByteHeader = true; + break; } } - return twoByteHeader; } + return twoByteHeader; + } - //------------------------------------------------------------------------- - void RTPPacket::changeHeaderExtensions(HeaderExtension *firstExtension) - { - bool twoByteHeader = requiresTwoByteHeader(firstExtension, mHeaderExtensionAppBits); - - if (twoByteHeader) { - ORTC_THROW_INVALID_STATE_IF(NULL != mHeaderExtensionParseStoppedPos) // requires a 1 byte header to append this data - } + //--------------------------------------------------------------------------- + void RTPPacket::changeHeaderExtensions(HeaderExtension *firstExtension) noexcept(false) + { + bool twoByteHeader = requiresTwoByteHeader(firstExtension, mHeaderExtensionAppBits); - bool requiresExtension = requiredExtension(firstExtension, mHeaderExtensionAppBits, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedPos); + if (twoByteHeader) { + ORTC_THROW_INVALID_STATE_IF(NULL != mHeaderExtensionParseStoppedPos); // requires a 1 byte header to append this data + } - const BYTE *buffer = ptr(); + bool requiresExtension = internal::requiredExtension(firstExtension, mHeaderExtensionAppBits, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedPos); - ASSERT(NULL != buffer) + const BYTE *buffer = ptr(); - size_t existingHeaderExtensionSize = mHeaderExtensionSize; - size_t postHeaderExtensionSize = mPayloadSize + mPadding; + ZS_ASSERT(NULL != buffer); - ASSERT(size() == (mHeaderSize + existingHeaderExtensionSize + postHeaderExtensionSize)) + size_t existingHeaderExtensionSize = mHeaderExtensionSize; + size_t postHeaderExtensionSize = mPayloadSize + mPadding; - if (!requiresExtension) { - // going to strip the extension header out entirely + ZS_ASSERT(size() == (mHeaderSize + existingHeaderExtensionSize + postHeaderExtensionSize)); - if (RTP_HEADER_EXTENSION(buffer)) { - ZS_LOG_INSANE(log("no extension present (thus no need to strip extension from RTP packet)")) - return; - } + if (!requiresExtension) { + // going to strip the extension header out entirely - ASSERT(size() == (mHeaderSize + existingHeaderExtensionSize + postHeaderExtensionSize)) + if (!RTP_HEADER_EXTENSION(buffer)) { + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "no extension present (thus no need to strip extension from RTP packet)"); + return; + } - size_t newSize = mHeaderSize + postHeaderExtensionSize; + ZS_ASSERT(size() == (mHeaderSize + existingHeaderExtensionSize + postHeaderExtensionSize)); - SecureByteBlockPtr tempBuffer(make_shared(newSize)); + size_t newSize = mHeaderSize + postHeaderExtensionSize; - BYTE *newBuffer = tempBuffer->BytePtr(); + SecureByteBlockPtr tempBuffer(make_shared(newSize)); - // copy the bytes before the extension header to the new buffer - memcpy(newBuffer, buffer, mHeaderSize); + BYTE *newBuffer = tempBuffer->BytePtr(); - // copy the bytes from after the extension header in the older buffer to the new buffer - memcpy(&(newBuffer[mHeaderSize]), &(buffer[mHeaderSize + existingHeaderExtensionSize]), postHeaderExtensionSize); + // copy the bytes before the extension header to the new buffer + memcpy(newBuffer, buffer, mHeaderSize); - // strip the extension bit - newBuffer[0] = newBuffer[0] & (0xFF ^ RTP_HEADER_EXTENSION_BIT); + // copy the bytes from after the extension header in the older buffer to the new buffer + memcpy(&(newBuffer[mHeaderSize]), &(buffer[mHeaderSize + existingHeaderExtensionSize]), postHeaderExtensionSize); - mBuffer = tempBuffer; + // strip the extension bit + newBuffer[0] = newBuffer[0] & (0xFF ^ RTP_HEADER_EXTENSION_BIT); - mHeaderExtensionSize = 0; + mBuffer = tempBuffer; - mTotalHeaderExtensions = 0; - if (mHeaderExtensions) { - delete [] mHeaderExtensions; - mHeaderExtensions = NULL; - } - mHeaderExtensionAppBits = 0; - mHeaderExtensionPrepaddedSize = 0; - mHeaderExtensionParseStoppedPos = NULL; - mHeaderExtensionParseStoppedSize = 0; + mHeaderExtensionSize = 0; - ZS_LOG_INSANE(debug("stripped existing extension header")) - return; + mTotalHeaderExtensions = 0; + if (mHeaderExtensions) { + delete [] mHeaderExtensions; + mHeaderExtensions = NULL; } + mHeaderExtensionAppBits = 0; + mHeaderExtensionPrepaddedSize = 0; + mHeaderExtensionParseStoppedPos = NULL; + mHeaderExtensionParseStoppedSize = 0; - mHeaderExtensionSize = 0; - mTotalHeaderExtensions = 0; - getHeaderExtensionSize(firstExtension, twoByteHeader, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedSize, mHeaderExtensionSize, mTotalHeaderExtensions); + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "stripped existing extension header"); + return; + } - size_t newSize = mHeaderSize + mHeaderExtensionSize + postHeaderExtensionSize; + mHeaderExtensionSize = 0; + mTotalHeaderExtensions = 0; + internal::getHeaderExtensionSize(firstExtension, twoByteHeader, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedSize, mHeaderExtensionSize, mTotalHeaderExtensions); - SecureByteBlockPtr oldBuffer = mBuffer; // temporary to keep previous allocation alive during swap + size_t newSize = mHeaderSize + mHeaderExtensionSize + postHeaderExtensionSize; - mBuffer = make_shared(newSize); + SecureByteBlockPtr oldBuffer = mBuffer; // temporary to keep previous allocation alive during swap - BYTE *newBuffer = mBuffer->BytePtr(); + mBuffer = make_shared(newSize); - // copy the bytes before the extension header to the new buffer - memcpy(newBuffer, buffer, mHeaderSize); + BYTE *newBuffer = mBuffer->BytePtr(); - // copy the bytes from after the extension header in the older buffer to the new buffer - memcpy(&(newBuffer[mHeaderSize + mHeaderExtensionSize]), &(buffer[mHeaderSize + existingHeaderExtensionSize]), postHeaderExtensionSize); + // copy the bytes before the extension header to the new buffer + memcpy(newBuffer, buffer, mHeaderSize); - writeHeaderExtensions(firstExtension, twoByteHeader); + // copy the bytes from after the extension header in the older buffer to the new buffer + memcpy(&(newBuffer[mHeaderSize + mHeaderExtensionSize]), &(buffer[mHeaderSize + existingHeaderExtensionSize]), postHeaderExtensionSize); - ZS_LOG_INSANE(debug("header extension changed")) - } + writeHeaderExtensions(firstExtension, twoByteHeader); - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket (internal) - #pragma mark + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "header extension changed"); + } - //------------------------------------------------------------------------- - Log::Params RTPPacket::slog(const char *message) - { - ElementPtr objectEl = Element::create("ortc::RTPPacket"); - return Log::Params(message, objectEl); + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // RTPPacket (internal) + // + + //--------------------------------------------------------------------------- + bool RTPPacket::parse() noexcept + { + const BYTE *buffer = mBuffer->BytePtr(); + size_t size = mBuffer->SizeInBytes(); + + if (size < internal::kMinRtpPacketLen) { + ZS_EVENTING_3(x, w, Trace, RTPPacketParseWarningPacketLengthTooShort, ol, RtpPacket, Parse, + string, message, "packet length is too short", + puid, mediaChannelID, mMediaChannelID, + size_t, length, size + ); + return false; } - //------------------------------------------------------------------------- - Log::Params RTPPacket::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPPacket"); - return Log::Params(message, objectEl); + mVersion = RTP_HEADER_VERSION(buffer); + if (mVersion != internal::kRtpVersion) { + ZS_EVENTING_2(x, w, Trace, RTPPacketParseWarning, ol, RtpPacket, Parse, + string, message, "not an RTP packet", + puid, mediaChannelID, mMediaChannelID + ); + return false; } - //------------------------------------------------------------------------- - Log::Params RTPPacket::debug(const char *message) const - { - return Log::Params(message, toDebug()); + if (UseRTPUtils::isRTCPPacketType(buffer, size)) { + ZS_EVENTING_3(x, w, Trace, RTPPacketParseWarningPacketisRTCP, ol, RtpPacket, Parse, + string, message, "packet is RTCP not RTP", + puid, mediaChannelID, mMediaChannelID, + size_t, length, size + ); + return false; } - //------------------------------------------------------------------------- - bool RTPPacket::parse() - { - const BYTE *buffer = mBuffer->BytePtr(); - size_t size = mBuffer->SizeInBytes(); + bool hasPadding = RTP_HEADER_PADDING(buffer); + mCC = RTP_HEADER_CC(buffer); + mM = RTP_HEADER_M(buffer); + mPT = RTP_HEADER_PT(buffer); + mSequenceNumber = UseRTPUtils::getBE16(&(buffer[2])); + mTimestamp = UseRTPUtils::getBE32(&(buffer[4])); + mSSRC = UseRTPUtils::getBE32(&(buffer[8])); + + mHeaderSize = internal::kMinRtpPacketLen + (static_cast(mCC) * sizeof(DWORD)); + + if (size < mHeaderSize) { + ZS_EVENTING_2(x, w, Trace, RTPPacketParseWarning, ol, RtpPacket, Parse, + string, message, "illegal RTP packet (packet is not large enough to hold header)", + puid, mediaChannelID, mMediaChannelID + ); + return false; + } - if (size < kMinRtpPacketLen) { - ZS_LOG_WARNING(Trace, log("packet length is too short") + ZS_PARAM("length", size)) + if (RTP_HEADER_EXTENSION(buffer)) { + if (size < (mHeaderSize + sizeof(DWORD))) { + ZS_EVENTING_2(x, w, Trace, RTPPacketParseWarning, ol, RtpPacket, Parse, + string, message, "illegal RTP packet (packet not large enough to hold data)", + puid, mediaChannelID, mMediaChannelID + ); return false; } - mVersion = RTP_HEADER_VERSION(buffer); - if (mVersion != kRtpVersion) { - ZS_LOG_WARNING(Trace, log("not an RTP packet")) + mHeaderExtensionSize = (static_cast(UseRTPUtils::getBE16(&(buffer[mHeaderSize + 2]))) * sizeof(DWORD)) + sizeof(DWORD); + if (size < (mHeaderSize + mHeaderExtensionSize)) { + ZS_EVENTING_2(x, w, Trace, RTPPacketParseWarning, ol, RtpPacket, Parse, + string, message, "illegal RTP packet (packet not large enough to hold extensions)", + puid, mediaChannelID, mMediaChannelID + ); return false; } + } - if (RTPUtils::isRTCPPacketType(buffer, size)) { - ZS_LOG_WARNING(Trace, log("packet is RTCP not RTP") + ZS_PARAM("length", size)) + if (hasPadding) { + mPadding = static_cast(buffer[size-1]); + if (0 == mPadding) { + ZS_EVENTING_2(x, w, Trace, RTPPacketParseWarning, ol, RtpPacket, Parse, + string, message, "illegal RTP packet (no padding size)", + puid, mediaChannelID, mMediaChannelID + ); return false; } - bool hasPadding = RTP_HEADER_PADDING(buffer); - mCC = RTP_HEADER_CC(buffer); - mM = RTP_HEADER_M(buffer); - mPT = RTP_HEADER_PT(buffer); - mSequenceNumber = RTPUtils::getBE16(&(buffer[2])); - mTimestamp = RTPUtils::getBE32(&(buffer[4])); - mSSRC = RTPUtils::getBE32(&(buffer[8])); - - mHeaderSize = kMinRtpPacketLen + (static_cast(mCC) * sizeof(DWORD)); - - if (size < mHeaderSize) { - ZS_LOG_WARNING(Trace, debug("illegal RTP packet")) + if (size < (mHeaderSize + mHeaderExtensionSize + mPadding)) { + ZS_EVENTING_2(x, w, Trace, RTPPacketParseWarning, ol, RtpPacket, Parse, + string, message, "illegal RTP packet (packet not large enough to hold padding)", + puid, mediaChannelID, mMediaChannelID + ); return false; } + } - if (RTP_HEADER_EXTENSION(buffer)) { - if (size < (mHeaderSize + sizeof(DWORD))) { - ZS_LOG_WARNING(Trace, debug("illegal RTP packet")) - return false; - } - - mHeaderExtensionSize = (static_cast(RTPUtils::getBE16(&(buffer[mHeaderSize + 2]))) * sizeof(DWORD)) + sizeof(DWORD); - if (size < (mHeaderSize + mHeaderExtensionSize)) { - ZS_LOG_WARNING(Trace, debug("illegal RTP packet")) - return false; - } - } - - if (hasPadding) { - mPadding = static_cast(buffer[size-1]); - if (0 == mPadding) { - ZS_LOG_WARNING(Trace, debug("illegal RTP packet (no padding size)")) - return false; - } - - if (size < (mHeaderSize + mHeaderExtensionSize + mPadding)) { - ZS_LOG_WARNING(Trace, debug("illegal RTP packet")) - return false; - } - } + mPayloadSize = size - (mHeaderSize + mHeaderExtensionSize + mPadding); - mPayloadSize = size - (mHeaderSize + mHeaderExtensionSize + mPadding); + if (0 == mHeaderExtensionSize) { + // no extensions present + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "parsed"); + return true; + } - if (0 == mHeaderExtensionSize) { - // no extensions present - ZS_LOG_INSANE(debug("parsed")) - return true; - } + const BYTE *profilePos = &(buffer[mHeaderSize]); - const BYTE *profilePos = &(buffer[mHeaderSize]); + bool oneByte = false; - bool oneByte = false; + if ((0xBE == profilePos[0]) && + (0xDE == profilePos[1])) { + oneByte = true; + } else { + WORD twoByteHeader = UseRTPUtils::getBE16(profilePos); + mHeaderExtensionAppBits = (twoByteHeader & 0xF); - if ((0xBE == profilePos[0]) && - (0xDE == profilePos[1])) { - oneByte = true; - } else { - WORD twoByteHeader = RTPUtils::getBE16(profilePos); - mHeaderExtensionAppBits = (twoByteHeader & 0xF); - - if (0x100 != ((twoByteHeader & 0xFFF0) >> 4)) { - ZS_LOG_WARNING(Trace, log("header extension profile is not understood") + ZS_PARAM("profile", twoByteHeader)) - return false; - } + if (0x100 != ((twoByteHeader & 0xFFF0) >> 4)) { + ZS_EVENTING_3(x, w, Trace, RTPPacketParseWarningHeaderProfileNotUnderstood, ol, RtpPacket, Parse, + string, message, "illegal RTP packet (packet not large enough to hold padding)", + puid, mediaChannelID, mMediaChannelID, + word, profile, twoByteHeader + ); + return false; } + } - size_t remaining = mHeaderExtensionSize - sizeof(DWORD); - if (0 == remaining) { - ZS_LOG_INSANE(debug("parsed")) - return true; - } + size_t remaining = mHeaderExtensionSize - sizeof(DWORD); + if (0 == remaining) { + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "parsed"); + return true; + } - const BYTE *pos = &(profilePos[4]); + const BYTE *pos = &(profilePos[4]); - size_t totalPossibleHeaderExtensions = (remaining / sizeof(WORD)) + ((0 != (remaining % sizeof(WORD))) ? 1 : 0); + size_t totalPossibleHeaderExtensions = (remaining / sizeof(WORD)) + ((0 != (remaining % sizeof(WORD))) ? 1 : 0); - mHeaderExtensions = new HeaderExtension[totalPossibleHeaderExtensions] {}; + mHeaderExtensions = new HeaderExtension[totalPossibleHeaderExtensions] {}; - size_t totalFound = 0; + size_t totalFound = 0; - while ((remaining > 0) && - (totalFound < totalPossibleHeaderExtensions)) { + while ((remaining > 0) && + (totalFound < totalPossibleHeaderExtensions)) { - HeaderExtension *current = &(mHeaderExtensions[totalFound]); + HeaderExtension *current = &(mHeaderExtensions[totalFound]); - if (0 == pos[0]) { - // see https://tools.ietf.org/html/rfc5285 4.1 + if (0 == pos[0]) { + // see https://tools.ietf.org/html/rfc5285 4.1 - // A sequence of extension elements, possibly with padding, forms the - // header extension defined in the RTP specification. There are as many - // extension elements as fit into the length as indicated in the RTP - // header extension length. Since this length is signaled in full 32- - // bit words, padding bytes are used to pad to a 32-bit boundary. The - // entire extension is parsed byte-by-byte to find each extension - // element (no alignment is required), and parsing stops at the earlier - // of the end of the entire header extension, or, in one-byte headers, - // on encountering an identifier with the reserved value of 15. + // A sequence of extension elements, possibly with padding, forms the + // header extension defined in the RTP specification. There are as many + // extension elements as fit into the length as indicated in the RTP + // header extension length. Since this length is signaled in full 32- + // bit words, padding bytes are used to pad to a 32-bit boundary. The + // entire extension is parsed byte-by-byte to find each extension + // element (no alignment is required), and parsing stops at the earlier + // of the end of the entire header extension, or, in one-byte headers, + // on encountering an identifier with the reserved value of 15. - // In both forms, padding bytes have the value of 0 (zero). They may be - // placed between extension elements, if desired for alignment, or after - // the last extension element, if needed for padding. A padding byte - // does not supply the ID of an element, nor the length field. When a - // padding byte is found, it is ignored and the parser moves on to - // interpreting the next byte. + // In both forms, padding bytes have the value of 0 (zero). They may be + // placed between extension elements, if desired for alignment, or after + // the last extension element, if needed for padding. A padding byte + // does not supply the ID of an element, nor the length field. When a + // padding byte is found, it is ignored and the parser moves on to + // interpreting the next byte. - // skip padding byte - ++pos; - --remaining; - if (0 == totalFound) { - ++mHeaderExtensionPrepaddedSize; - } else { - ++(mHeaderExtensions[totalFound-1].mPostPaddingSize); - } - continue; + // skip padding byte + ++pos; + --remaining; + if (0 == totalFound) { + ++mHeaderExtensionPrepaddedSize; + } else { + ++(mHeaderExtensions[totalFound-1].mPostPaddingSize); } + continue; + } - if (oneByte) { - BYTE id = ((pos[0] & 0xF0) >> 4); - if (id == 0xF) { - // see https://tools.ietf.org/html/rfc5285 4.2 - - // The local identifier value 15 is reserved for future extension and - // MUST NOT be used as an identifier. If the ID value 15 is - // encountered, its length field should be ignored, processing of the - // entire extension should terminate at that point, and only the - // extension elements present prior to the element with ID 15 - // considered. - mHeaderExtensionParseStoppedPos = pos; - mHeaderExtensionParseStoppedSize = remaining; - break; - } - - // The 4-bit length is the number minus one of data bytes of this header - // extension element following the one-byte header. Therefore, the - // value zero in this field indicates that one byte of data follows, and - // a value of 15 (the maximum) indicates element data of 16 bytes. - // (This permits carriage of 16-byte values, which is a common length of - // labels and identifiers, while losing the possibility of zero-length - // values -- which would often be padded anyway.) - - size_t length = static_cast((pos[0] & 0x0F) + 1); - - if (remaining < (1 + length)) { - ZS_LOG_WARNING(Trace, log("extension header is not valid") + ZS_PARAM("id", id) + ZS_PARAM("remaining", remaining) + ZS_PARAM("length", length)) - return false; - } - - current->mID = id; - current->mDataSizeInBytes = length; - current->mData = &(pos[1]); - if (0 != totalFound) { - mHeaderExtensions[totalFound-1].mNext = current; - } - - remaining -= (1 + length); - pos += (1 + length); - ++totalFound; - continue; + if (oneByte) { + BYTE id = ((pos[0] & 0xF0) >> 4); + if (id == 0xF) { + // see https://tools.ietf.org/html/rfc5285 4.2 + + // The local identifier value 15 is reserved for future extension and + // MUST NOT be used as an identifier. If the ID value 15 is + // encountered, its length field should be ignored, processing of the + // entire extension should terminate at that point, and only the + // extension elements present prior to the element with ID 15 + // considered. + mHeaderExtensionParseStoppedPos = pos; + mHeaderExtensionParseStoppedSize = remaining; + break; } - // must be a two byte header format - - if (remaining < sizeof(WORD)) { - ZS_LOG_WARNING(Trace, log("extension header is not valid") + ZS_PARAM("remaining", remaining)) - return false; - } - - BYTE id = (pos[0]); - size_t length = (pos[1]); - - if (remaining < (sizeof(WORD) + length)) { - ZS_LOG_WARNING(Trace, log("extension header is not valid") + ZS_PARAM("id", id) + ZS_PARAM("remaining", remaining) + ZS_PARAM("length", length)) + // The 4-bit length is the number minus one of data bytes of this header + // extension element following the one-byte header. Therefore, the + // value zero in this field indicates that one byte of data follows, and + // a value of 15 (the maximum) indicates element data of 16 bytes. + // (This permits carriage of 16-byte values, which is a common length of + // labels and identifiers, while losing the possibility of zero-length + // values -- which would often be padded anyway.) + + size_t length = static_cast((pos[0] & 0x0F) + 1); + + if (remaining < (1 + length)) { + ZS_EVENTING_4(x, w, Trace, RTPPacketParseWarningExtensionHeaderNotValid, ol, RtpPacket, Parse, + string, message, "extension header is not valid", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); return false; } current->mID = id; current->mDataSizeInBytes = length; - if (0 != length) { - current->mData = &(pos[2]); - } + current->mData = &(pos[1]); if (0 != totalFound) { mHeaderExtensions[totalFound-1].mNext = current; } - remaining -= (2 + length); - pos += (2 + length); + remaining -= (1 + length); + pos += (1 + length); ++totalFound; continue; } - mTotalHeaderExtensions = totalFound; - - ZS_LOG_INSANE(debug("parsed")) - return true; - } - - //------------------------------------------------------------------------- - void RTPPacket::writeHeaderExtensions( - HeaderExtension *firstExtension, - bool twoByteHeader - ) - { - ASSERT((bool)mBuffer) - ASSERT(0 != mBuffer->SizeInBytes()) - ASSERT(0 != mHeaderSize) - //ASSERT(mHeaderExtensionAppBits) // needs to be set (but no way to verify here) - //ASSERT(mTotalHeaderExtensions) // needs to be set (but no way to verify here) - //ASSERT(mHeaderExtensionPrepaddedSize) // needs to be set (but no way to verify here) - //ASSSRT(mHeaderExtensionParseStoppedSize) // needs to be set (but no way to verify here) - //ASSERT(mHeaderExtensionParseStoppedPos) // needs to be set (but no way to verify here) - ASSERT(0 != mHeaderExtensionSize) - + // must be a two byte header format - BYTE *newBuffer = mBuffer->BytePtr(); + if (remaining < sizeof(WORD)) { + ZS_EVENTING_4(x, w, Trace, RTPPacketParseWarningExtensionHeaderNotValid, ol, RtpPacket, Parse, + string, message, "extension header is not valid (must have room for two byte header)", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, 0 + ); + return false; + } - // set the extension bit - newBuffer[0] = newBuffer[0] | RTP_HEADER_EXTENSION_BIT; + BYTE id = (pos[0]); + size_t length = (pos[1]); - BYTE *newProfilePos = &(newBuffer[mHeaderSize]); + if (remaining < (sizeof(WORD) + length)) { + ZS_EVENTING_4(x, w, Trace, RTPPacketParseWarningExtensionHeaderNotValid, ol, RtpPacket, Parse, + string, message, "extension header is not valid (must have room for two byte header and length)", + puid, mediaChannelID, mMediaChannelID, + size_t, remaining, remaining, + size_t, length, length + ); + return false; + } - if (twoByteHeader) { - WORD profileType = (0x100 << 4) | (mHeaderExtensionAppBits & 0xF); - newProfilePos[0] = static_cast((profileType & 0xFF00) >> 8); - newProfilePos[1] = static_cast(profileType & 0xFF); - } else { - newProfilePos[0] = 0xBE; - newProfilePos[1] = 0xDE; + current->mID = id; + current->mDataSizeInBytes = length; + if (0 != length) { + current->mData = &(pos[2]); + } + if (0 != totalFound) { + mHeaderExtensions[totalFound-1].mNext = current; } - WORD totalDWORDsLength = static_cast(((mHeaderExtensionSize - sizeof(DWORD)) / sizeof(DWORD))); - newProfilePos[2] = static_cast((totalDWORDsLength & 0xFF00) >> 8); - newProfilePos[3] = static_cast(totalDWORDsLength & 0xFF); + remaining -= (2 + length); + pos += (2 + length); + ++totalFound; + continue; + } - BYTE *pos = &(newProfilePos[sizeof(DWORD)]) + mHeaderExtensionPrepaddedSize; + mTotalHeaderExtensions = totalFound; - HeaderExtension *newExtensions = NULL; - if (0 != mTotalHeaderExtensions) { - newExtensions = new HeaderExtension[mTotalHeaderExtensions] {}; - } + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "parsed"); + return true; + } + + //--------------------------------------------------------------------------- + void RTPPacket::writeHeaderExtensions( + HeaderExtension *firstExtension, + bool twoByteHeader + ) noexcept + { + ZS_ASSERT((bool)mBuffer); + ZS_ASSERT(0 != mBuffer->SizeInBytes()); + ZS_ASSERT(0 != mHeaderSize); + //ZS_ASSERT(mHeaderExtensionAppBits); // needs to be set (but no way to verify here) + //ZS_ASSERT(mTotalHeaderExtensions); // needs to be set (but no way to verify here) + //ZS_ASSERT(mHeaderExtensionPrepaddedSize); // needs to be set (but no way to verify here) + //ZS_ASSERT(mHeaderExtensionParseStoppedSize); // needs to be set (but no way to verify here) + //ZS_ASSERT(mHeaderExtensionParseStoppedPos); // needs to be set (but no way to verify here) + ZS_ASSERT(0 != mHeaderExtensionSize); + + + BYTE *newBuffer = mBuffer->BytePtr(); + + // set the extension bit + newBuffer[0] = newBuffer[0] | RTP_HEADER_EXTENSION_BIT; + + BYTE *newProfilePos = &(newBuffer[mHeaderSize]); + + if (twoByteHeader) { + WORD profileType = (0x100 << 4) | (mHeaderExtensionAppBits & 0xF); + newProfilePos[0] = static_cast((profileType & 0xFF00) >> 8); + newProfilePos[1] = static_cast(profileType & 0xFF); + } else { + newProfilePos[0] = 0xBE; + newProfilePos[1] = 0xDE; + } - size_t index = 0; - for (HeaderExtension *current = firstExtension; NULL != current; current = current->mNext, ++index) { - HeaderExtension *newCurrent = &(newExtensions[index]); - if (0 != index) { - newExtensions[index-1].mNext = newCurrent; - } + WORD totalDWORDsLength = static_cast(((mHeaderExtensionSize - sizeof(DWORD)) / sizeof(DWORD))); + newProfilePos[2] = static_cast((totalDWORDsLength & 0xFF00) >> 8); + newProfilePos[3] = static_cast(totalDWORDsLength & 0xFF); - if (twoByteHeader) { - pos[0] = current->mID; - pos[1] = static_cast(current->mDataSizeInBytes); - pos += 2; - } else { - pos[0] = ((current->mID) << 4) | ((current->mDataSizeInBytes - 1) & 0xF); - ++pos; - } + BYTE *pos = &(newProfilePos[sizeof(DWORD)]) + mHeaderExtensionPrepaddedSize; - newCurrent->mID = current->mID; - newCurrent->mData = pos; - newCurrent->mDataSizeInBytes = current->mDataSizeInBytes; - newCurrent->mPostPaddingSize = current->mPostPaddingSize; + HeaderExtension *newExtensions = NULL; + if (0 != mTotalHeaderExtensions) { + newExtensions = new HeaderExtension[mTotalHeaderExtensions] {}; + } - if (0 != current->mDataSizeInBytes) { - memcpy(pos, current->mData, current->mDataSizeInBytes); - pos += current->mDataSizeInBytes; - } - pos += current->mPostPaddingSize; + size_t index = 0; + for (HeaderExtension *current = firstExtension; NULL != current; current = current->mNext, ++index) { + HeaderExtension *newCurrent = &(newExtensions[index]); + if (0 != index) { + newExtensions[index-1].mNext = newCurrent; } - if (0 != mHeaderExtensionParseStoppedSize) { - ASSERT(NULL != mHeaderExtensionParseStoppedPos) - - memcpy(pos, mHeaderExtensionParseStoppedPos, mHeaderExtensionParseStoppedSize); - mHeaderExtensionParseStoppedPos = pos; + if (twoByteHeader) { + pos[0] = current->mID; + pos[1] = static_cast(current->mDataSizeInBytes); + pos += 2; } else { - mHeaderExtensionParseStoppedPos = NULL; + pos[0] = ((current->mID) << 4) | ((current->mDataSizeInBytes - 1) & 0xF); + ++pos; } - ASSERT(index == mTotalHeaderExtensions) + newCurrent->mID = current->mID; + newCurrent->mData = pos; + newCurrent->mDataSizeInBytes = current->mDataSizeInBytes; + newCurrent->mPostPaddingSize = current->mPostPaddingSize; - mTotalHeaderExtensions = index; - if (NULL != mHeaderExtensions) { - delete [] mHeaderExtensions; - mHeaderExtensions = NULL; + if (0 != current->mDataSizeInBytes) { + memcpy(pos, current->mData, current->mDataSizeInBytes); + pos += current->mDataSizeInBytes; } - mHeaderExtensions = newExtensions; + pos += current->mPostPaddingSize; } - //------------------------------------------------------------------------- - void RTPPacket::generate(const RTPPacket &packet) - { - CreationParams params; - - params.mVersion = packet.version(); - params.mPadding = packet.padding(); - params.mM = packet.m(); - params.mPT = packet.pt(); - params.mSequenceNumber = packet.sequenceNumber(); - params.mTimestamp = packet.timestamp(); - params.mSSRC = packet.ssrc(); - - params.mCC = packet.cc(); - params.mCC = (static_cast(packet.cc()) & 0xF); - - DWORD tmpCCList[0xF]; - if (params.mCC > 0) { - for (decltype(params.mCC) index = 0; index < params.mCC; ++index) { - tmpCCList[index] = packet.getCSRC(index); - } - params.mCSRCList = &(tmpCCList[0]); - } - - params.mPayload = packet.payload(); - params.mPayloadSize = packet.payloadSize(); - params.mFirstHeaderExtension = packet.firstHeaderExtension(); - params.mHeaderExtensionAppBits = packet.headerExtensionAppBits(); + if (0 != mHeaderExtensionParseStoppedSize) { + ZS_ASSERT(NULL != mHeaderExtensionParseStoppedPos); - params.mHeaderExtensionPrepaddedSize = packet.headerExtensionPrepaddedSize(); - params.mHeaderExtensionStopParsePos = packet.headerExtensionParseStopped(); - params.mHeaderExtensionStopParseSize = packet.headerExtensionParseStoppedSize(); - - generate(params); + memcpy(pos, mHeaderExtensionParseStoppedPos, mHeaderExtensionParseStoppedSize); + mHeaderExtensionParseStoppedPos = pos; + } else { + mHeaderExtensionParseStoppedPos = NULL; } - //------------------------------------------------------------------------- - void RTPPacket::generate(const CreationParams ¶ms) - { - ASSERT(params.mVersion <= 0x3) - ASSERT(params.mPadding <= 0xFF) - ASSERT(params.mCC <= 0xF) - ASSERT(params.mPT <= 0x7F) - - ASSERT(0 == params.mCC ? (NULL == params.mCSRCList) : (NULL != params.mCSRCList)) - ASSERT(0 == params.mPayloadSize ? (NULL == params.mPayload) : (NULL != params.mPayload)) + ZS_ASSERT(index == mTotalHeaderExtensions); - mVersion = params.mVersion & 0x3; - mPadding = params.mPadding; - mCC = (static_cast(params.mCC) & 0xF); - mM = params.mM; - mPT = (params.mPT & 0x7F); - mSequenceNumber = params.mSequenceNumber; - mTimestamp = params.mTimestamp; - mSSRC = params.mSSRC; - - mHeaderSize = kMinRtpPacketLen + (static_cast(mCC) * sizeof(DWORD)); - //mHeaderExtensionSize = 0; // filled in later - mPayloadSize = params.mPayloadSize; + mTotalHeaderExtensions = index; + if (NULL != mHeaderExtensions) { + delete [] mHeaderExtensions; + mHeaderExtensions = NULL; + } + mHeaderExtensions = newExtensions; + } - //mTotalHeaderExtensions (later) - //mHeaderExtensions (later) - mHeaderExtensionAppBits = params.mHeaderExtensionAppBits; + //--------------------------------------------------------------------------- + void RTPPacket::generate(const RTPPacket &packet) noexcept + { + CreationParams params; + + params.mMediaChannelID = packet.mMediaChannelID; + params.mVersion = packet.version(); + params.mPadding = packet.padding(); + params.mM = packet.m(); + params.mPT = packet.pt(); + params.mSequenceNumber = packet.sequenceNumber(); + params.mTimestamp = packet.timestamp(); + params.mSSRC = packet.ssrc(); + + params.mCC = packet.cc(); + params.mCC = (static_cast(packet.cc()) & 0xF); + + DWORD tmpCCList[0xF]; + if (params.mCC > 0) { + for (decltype(params.mCC) index = 0; index < params.mCC; ++index) { + tmpCCList[index] = packet.getCSRC(index); + } + params.mCSRCList = &(tmpCCList[0]); + } - mHeaderExtensionPrepaddedSize = params.mHeaderExtensionPrepaddedSize; - mHeaderExtensionParseStoppedPos = params.mHeaderExtensionStopParsePos; - mHeaderExtensionParseStoppedSize = params.mHeaderExtensionStopParseSize; + params.mPayload = packet.payload(); + params.mPayloadSize = packet.payloadSize(); + params.mFirstHeaderExtension = packet.firstHeaderExtension(); + params.mHeaderExtensionAppBits = packet.headerExtensionAppBits(); - bool twoByteHeader = requiresTwoByteHeader(params.mFirstHeaderExtension, mHeaderExtensionAppBits); + params.mHeaderExtensionPrepaddedSize = packet.headerExtensionPrepaddedSize(); + params.mHeaderExtensionStopParsePos = packet.headerExtensionParseStopped(); + params.mHeaderExtensionStopParseSize = packet.headerExtensionParseStoppedSize(); - if (twoByteHeader) { - ORTC_THROW_INVALID_STATE_IF(NULL != mHeaderExtensionParseStoppedPos) // requires a 1 byte header to append this data - } + generate(params); + } - bool requiresExtension = requiredExtension(params.mFirstHeaderExtension, mHeaderExtensionAppBits, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedPos); + //--------------------------------------------------------------------------- + void RTPPacket::generate(const CreationParams ¶ms) noexcept(false) + { + ZS_ASSERT(params.mVersion <= 0x3); + ZS_ASSERT(params.mPadding <= 0xFF); + ZS_ASSERT(params.mCC <= 0xF); + ZS_ASSERT(params.mPT <= 0x7F); + + ZS_ASSERT(0 == params.mCC ? (NULL == params.mCSRCList) : (NULL != params.mCSRCList)); + ZS_ASSERT(0 == params.mPayloadSize ? (NULL == params.mPayload) : (NULL != params.mPayload)); + + mVersion = params.mVersion & 0x3; + mPadding = params.mPadding; + mCC = (static_cast(params.mCC) & 0xF); + mM = params.mM; + mPT = (params.mPT & 0x7F); + mSequenceNumber = params.mSequenceNumber; + mTimestamp = params.mTimestamp; + mSSRC = params.mSSRC; + + mHeaderSize = internal::kMinRtpPacketLen + (static_cast(mCC) * sizeof(DWORD)); + //mHeaderExtensionSize = 0; // filled in later + mPayloadSize = params.mPayloadSize; + + //mTotalHeaderExtensions (later) + //mHeaderExtensions (later) + mHeaderExtensionAppBits = params.mHeaderExtensionAppBits; + + mHeaderExtensionPrepaddedSize = params.mHeaderExtensionPrepaddedSize; + mHeaderExtensionParseStoppedPos = params.mHeaderExtensionStopParsePos; + mHeaderExtensionParseStoppedSize = params.mHeaderExtensionStopParseSize; + + bool twoByteHeader = requiresTwoByteHeader(params.mFirstHeaderExtension, mHeaderExtensionAppBits); + + if (twoByteHeader) { + ORTC_THROW_INVALID_STATE_IF(NULL != mHeaderExtensionParseStoppedPos); // requires a 1 byte header to append this data + } - if (requiresExtension) { - mHeaderExtensionSize = 0; - mTotalHeaderExtensions = 0; - getHeaderExtensionSize(params.mFirstHeaderExtension, twoByteHeader, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedSize, mHeaderExtensionSize, mTotalHeaderExtensions); - } + bool requiresExtension = internal::requiredExtension(params.mFirstHeaderExtension, mHeaderExtensionAppBits, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedPos); - size_t postHeaderExtensionSize = mPayloadSize + mPadding; + if (requiresExtension) { + mHeaderExtensionSize = 0; + mTotalHeaderExtensions = 0; + internal::getHeaderExtensionSize(params.mFirstHeaderExtension, twoByteHeader, mHeaderExtensionPrepaddedSize, mHeaderExtensionParseStoppedSize, mHeaderExtensionSize, mTotalHeaderExtensions); + } - size_t newSize = mHeaderSize + mHeaderExtensionSize + postHeaderExtensionSize; + size_t postHeaderExtensionSize = mPayloadSize + mPadding; - mBuffer = make_shared(newSize); + size_t newSize = mHeaderSize + mHeaderExtensionSize + postHeaderExtensionSize; - BYTE *newBuffer = mBuffer->BytePtr(); + mBuffer = make_shared(newSize); - // fill standard header + BYTE *newBuffer = mBuffer->BytePtr(); - BYTE *pos = newBuffer; - pos[0] = RTP_PACK_BITS(mVersion, 0x3, 6) | - RTP_PACK_BITS(0 != mPadding ? 1 : 0, 0x1, 5) | - RTP_PACK_BITS(requiresExtension ? 1 : 0, 0x1, 4) | - RTP_PACK_BITS(mCC, 0xF, 0); - pos[1] = RTP_PACK_BITS(mM ? 1 : 0, 0x1, 7) | - RTP_PACK_BITS(mPT, 0x7F, 0); + // fill standard header - RTPUtils::setBE16(&(pos[2]), mSequenceNumber); - RTPUtils::setBE32(&(pos[4]), mTimestamp); - RTPUtils::setBE32(&(pos[8]), mSSRC); + BYTE *pos = newBuffer; + pos[0] = RTP_PACK_BITS(mVersion, 0x3, 6) | + RTP_PACK_BITS(0 != mPadding ? 1 : 0, 0x1, 5) | + RTP_PACK_BITS(requiresExtension ? 1 : 0, 0x1, 4) | + RTP_PACK_BITS(mCC, 0xF, 0); + pos[1] = RTP_PACK_BITS(mM ? 1 : 0, 0x1, 7) | + RTP_PACK_BITS(mPT, 0x7F, 0); - // write CSRC list (if any) - for (size_t index = 0; index < static_cast(mCC); ++index) { - RTPUtils::setBE32(&(pos[12+(sizeof(DWORD)*index)]), params.mCSRCList[index]); - } + UseRTPUtils::setBE16(&(pos[2]), mSequenceNumber); + UseRTPUtils::setBE32(&(pos[4]), mTimestamp); + UseRTPUtils::setBE32(&(pos[8]), mSSRC); - if (requiresExtension) { - writeHeaderExtensions(params.mFirstHeaderExtension, twoByteHeader); - } + // write CSRC list (if any) + for (size_t index = 0; index < static_cast(mCC); ++index) { + UseRTPUtils::setBE32(&(pos[12+(sizeof(DWORD)*index)]), params.mCSRCList[index]); + } - if (0 != mPayloadSize) { - memcpy(&(pos[mHeaderSize+mHeaderExtensionSize]), params.mPayload, mPayloadSize); - } + if (requiresExtension) { + writeHeaderExtensions(params.mFirstHeaderExtension, twoByteHeader); + } - if (0 != mPadding) { - newBuffer[newSize-1] = static_cast(mPadding); - } + if (0 != mPayloadSize) { + memcpy(&(pos[mHeaderSize+mHeaderExtensionSize]), params.mPayload, mPayloadSize); + } - ZS_LOG_INSANE(debug("generated RTP packet")) + if (0 != mPadding) { + newBuffer[newSize-1] = static_cast(mPadding); } + + ZS_EVENTING_TRACE_OBJECT(Insane, *this, "generated"); } -} +} // namespace ortc diff --git a/ortc/cpp/ortc_RTPReceiver.cpp b/ortc/cpp/ortc_RTPReceiver.cpp index 94dad051..753b20ab 100644 --- a/ortc/cpp/ortc_RTPReceiver.cpp +++ b/ortc/cpp/ortc_RTPReceiver.cpp @@ -29,14 +29,14 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include #include #include #include -#include -#include #include #include #include @@ -45,6 +45,8 @@ #include #include +#include +#include #include @@ -59,14 +61,7 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpreceiver) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_receiver) } namespace ortc { @@ -85,12 +80,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- - static bool shouldFilter(IRTPTypes::HeaderExtensionURIs extensionURI) + static bool shouldFilter(IRTPTypes::HeaderExtensionURIs extensionURI) noexcept { switch (extensionURI) { case IRTPTypes::HeaderExtensionURI_Unknown: return true; @@ -102,6 +97,10 @@ namespace ortc case IRTPTypes::HeaderExtensionURI_RID: return false; case IRTPTypes::HeaderExtensionURI_3gpp_VideoOrientation: return true; case IRTPTypes::HeaderExtensionURI_3gpp_VideoOrientation6: return true; + + case IRTPTypes::HeaderExtensionURI_TransmissionTimeOffsets: return true; + case IRTPTypes::HeaderExtensionURI_AbsoluteSendTime: return true; + case IRTPTypes::HeaderExtensionURI_TransportSequenceNumber: return true; } return true; } @@ -111,28 +110,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverSettingsDefaults - #pragma mark + // + // RTPReceiverSettingsDefaults + // class RTPReceiverSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~RTPReceiverSettingsDefaults() + ~RTPReceiverSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static RTPReceiverSettingsDefaultsPtr singleton() + static RTPReceiverSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static RTPReceiverSettingsDefaultsPtr create() + static RTPReceiverSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -140,7 +139,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { ISettings::setUInt(ORTC_SETTING_RTP_RECEIVER_SSRC_TIMEOUT_IN_SECONDS, 60); @@ -157,7 +156,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installRTPReceiverSettingsDefaults() + void installRTPReceiverSettingsDefaults() noexcept { RTPReceiverSettingsDefaults::singleton(); } @@ -166,12 +165,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverForRTPListener - #pragma mark + // + // IRTPReceiverForRTPListener + // //------------------------------------------------------------------------- - ElementPtr IRTPReceiverForRTPListener::toDebug(ForRTPListenerPtr object) + ElementPtr IRTPReceiverForRTPListener::toDebug(ForRTPListenerPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object)->toDebug(); @@ -181,12 +180,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // IRTPReceiverForRTPReceiverChannel + // //------------------------------------------------------------------------- - ElementPtr IRTPReceiverForRTPReceiverChannel::toDebug(ForRTPReceiverChannelPtr object) + ElementPtr IRTPReceiverForRTPReceiverChannel::toDebug(ForRTPReceiverChannelPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object)->toDebug(); @@ -196,12 +195,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverForMediaStreamTrack - #pragma mark + // + // IRTPReceiverForMediaStreamTrack + // //------------------------------------------------------------------------- - ElementPtr IRTPReceiverForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) + ElementPtr IRTPReceiverForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object)->toDebug(); @@ -211,20 +210,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::RegisteredHeaderExtension - #pragma mark + // + // RTPReceiver::RegisteredHeaderExtension + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::CodecTypes - #pragma mark + // + // RTPReceiver::CodecTypes + // //--------------------------------------------------------------------------- - const char *RTPReceiver::toString(CodecTypes type) + const char *RTPReceiver::toString(CodecTypes type) noexcept { switch (type) { case CodecType_Normal: return "normal"; @@ -237,7 +236,7 @@ namespace ortc } //--------------------------------------------------------------------------- - RTPReceiver::CodecTypes RTPReceiver::toCodecType(const char *type) + RTPReceiver::CodecTypes RTPReceiver::toCodecType(const char *type) noexcept(false) { String str(type); @@ -245,24 +244,24 @@ namespace ortc if (str == toString(index)) return index; } - ORTC_THROW_INVALID_PARAMETERS(type) + ORTC_THROW_INVALID_PARAMETERS(type); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::ChannelHolder - #pragma mark + // + // RTPReceiver::ChannelHolder + // //------------------------------------------------------------------------- - RTPReceiver::ChannelHolder::ChannelHolder() + RTPReceiver::ChannelHolder::ChannelHolder() noexcept { } //------------------------------------------------------------------------- - RTPReceiver::ChannelHolder::~ChannelHolder() + RTPReceiver::ChannelHolder::~ChannelHolder() noexcept { notify(ISecureTransport::State_Closed); @@ -273,13 +272,13 @@ namespace ortc } //------------------------------------------------------------------------- - PUID RTPReceiver::ChannelHolder::getID() const + PUID RTPReceiver::ChannelHolder::getID() const noexcept { return mChannel->getID(); } //------------------------------------------------------------------------- - void RTPReceiver::ChannelHolder::notify(ISecureTransport::States state) + void RTPReceiver::ChannelHolder::notify(ISecureTransport::States state) noexcept { if (state == mLastReportedState) return; @@ -288,48 +287,48 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::ChannelHolder::notify(RTPPacketPtr packet) + void RTPReceiver::ChannelHolder::notify(RTPPacketPtr packet) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return; mChannel->notifyPacket(packet); } //------------------------------------------------------------------------- - void RTPReceiver::ChannelHolder::notify(RTCPPacketListPtr packets) + void RTPReceiver::ChannelHolder::notify(RTCPPacketListPtr packets) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return; mChannel->notifyPackets(packets); } //------------------------------------------------------------------------- - void RTPReceiver::ChannelHolder::update(const Parameters ¶ms) + void RTPReceiver::ChannelHolder::update(const Parameters ¶ms) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return; mChannel->notifyUpdate(params); } //------------------------------------------------------------------------- - bool RTPReceiver::ChannelHolder::handle(RTPPacketPtr packet) + bool RTPReceiver::ChannelHolder::handle(RTPPacketPtr packet) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return false; return mChannel->handlePacket(packet); } //------------------------------------------------------------------------- - bool RTPReceiver::ChannelHolder::handle(RTCPPacketPtr packet) + bool RTPReceiver::ChannelHolder::handle(RTCPPacketPtr packet) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return false; return mChannel->handlePacket(packet); } //------------------------------------------------------------------------- - void RTPReceiver::ChannelHolder::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) + void RTPReceiver::ChannelHolder::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept { return mChannel->requestStats(promise, stats); } //------------------------------------------------------------------------- - ElementPtr RTPReceiver::ChannelHolder::toDebug() const + ElementPtr RTPReceiver::ChannelHolder::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPReceiver::ChannelHolder"); @@ -345,26 +344,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::ChannelInfo - #pragma mark + // + // RTPReceiver::ChannelInfo + // //------------------------------------------------------------------------- - bool RTPReceiver::ChannelInfo::shouldLatchAll() const + bool RTPReceiver::ChannelInfo::shouldLatchAll() const noexcept { if (mOriginalParameters->mEncodings.size() < 1) return true; return false; } //------------------------------------------------------------------------- - String RTPReceiver::ChannelInfo::rid() const + String RTPReceiver::ChannelInfo::rid() const noexcept { if (shouldLatchAll()) return String(); return mFilledParameters->mEncodings.front().mEncodingID; } //------------------------------------------------------------------------- - RTPReceiver::SSRCInfoPtr RTPReceiver::ChannelInfo::registerSSRCUsage(SSRCInfoPtr ssrcInfo) + RTPReceiver::SSRCInfoPtr RTPReceiver::ChannelInfo::registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept { mRegisteredSSRCs[SSRCRoutingPair(ssrcInfo->mSSRC, ssrcInfo->mRoutingPayload)] = ssrcInfo; return ssrcInfo; @@ -374,7 +373,7 @@ namespace ortc void RTPReceiver::ChannelInfo::unregisterSSRCUsage( SSRCType ssrc, RoutingPayloadType routingPayload - ) + ) noexcept { auto found = mRegisteredSSRCs.find(SSRCRoutingPair(ssrc, routingPayload)); if (found == mRegisteredSSRCs.end()) return; @@ -382,7 +381,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::ChannelInfo::registerHolder(ChannelHolderPtr channelHolder) + void RTPReceiver::ChannelInfo::registerHolder(ChannelHolderPtr channelHolder) noexcept { if (!channelHolder) return; mChannelHolder = channelHolder; @@ -394,7 +393,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr RTPReceiver::ChannelInfo::toDebug() const + ElementPtr RTPReceiver::ChannelInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPReceiver::ChannelInfo"); @@ -421,12 +420,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::RIDInfo - #pragma mark + // + // RTPReceiver::RIDInfo + // //------------------------------------------------------------------------- - ElementPtr RTPReceiver::RIDInfo::toDebug() const + ElementPtr RTPReceiver::RIDInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPReceiver::RIDInfo"); @@ -440,18 +439,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::SSRCInfo - #pragma mark + // + // RTPReceiver::SSRCInfo + // //--------------------------------------------------------------------------- - RTPReceiver::SSRCInfo::SSRCInfo() : + RTPReceiver::SSRCInfo::SSRCInfo() noexcept : mLastUsage(zsLib::now()) { } //--------------------------------------------------------------------------- - ElementPtr RTPReceiver::SSRCInfo::toDebug() const + ElementPtr RTPReceiver::SSRCInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPReceiver::SSRCInfo"); @@ -468,12 +467,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::CodecInfo - #pragma mark + // + // RTPReceiver::CodecInfo + // //--------------------------------------------------------------------------- - ElementPtr RTPReceiver::CodecInfo::toDebug() const + ElementPtr RTPReceiver::CodecInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPReceiver::CodecInfo"); @@ -492,12 +491,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver - #pragma mark + // + // RTPReceiver + // //--------------------------------------------------------------------------- - const char *RTPReceiver::toString(States state) + const char *RTPReceiver::toString(States state) noexcept { switch (state) { case State_Pending: return "pending"; @@ -516,29 +515,32 @@ namespace ortc Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) : + ) noexcept(false) : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mKind(kind), mChannels(make_shared()), + mSSRCTableExpires(Seconds(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_SSRC_TIMEOUT_IN_SECONDS))), mMaxBufferedRTPPackets(SafeInt(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_MAX_RTP_PACKETS_IN_BUFFER))), mMaxRTPPacketAge(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_MAX_AGE_RTP_PACKETS_IN_SECONDS)), + mContributingSourcesExpiry(Seconds(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_CSRC_EXPIRY_TIME_IN_SECONDS))), mLockAfterSwitchTime(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_LOCK_TO_RECEIVER_CHANNEL_AFTER_SWITCH_EXCLUSIVELY_FOR_IN_MILLISECONDS)), - mAmbiguousPayloadMappingMinDifference(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_ONLY_RESOLVE_AMBIGUOUS_PAYLOAD_MAPPING_IF_ACTIVITY_DIFFERS_IN_MILLISECONDS)), - mSSRCTableExpires(Seconds(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_SSRC_TIMEOUT_IN_SECONDS))), - mContributingSourcesExpiry(Seconds(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_CSRC_EXPIRY_TIME_IN_SECONDS))) + mAmbiguousPayloadMappingMinDifference(ISettings::getUInt(ORTC_SETTING_RTP_RECEIVER_ONLY_RESOLVE_AMBIGUOUS_PAYLOAD_MAPPING_IF_ACTIVITY_DIFFERS_IN_MILLISECONDS)) { - ZS_LOG_DETAIL(debug("created")) + ZS_LOG_DETAIL(debug("created")); mListener = UseListener::getListener(transport); - ORTC_THROW_INVALID_PARAMETERS_IF(!mListener) + ORTC_THROW_INVALID_PARAMETERS_IF(!mListener); UseSecureTransport::getReceivingTransport(transport, rtcpTransport, mReceiveRTPOverTransport, mReceiveRTCPOverTransport, mRTPTransport, mRTCPTransport); mSendRTCPOverTransport = mReceiveRTCPOverTransport; - ZS_LOG_DEBUG(log("creating media stream track") + ZS_PARAM("kind", IMediaStreamTrack::toString(mKind))) + ZS_LOG_DEBUG(log("creating media stream track") + ZS_PARAM("kind", IMediaStreamTrack::toString(mKind))); +#if 0 mTrack = UseMediaStreamTrack::create(mKind); +#endif //0 ZS_LOG_DEBUG(log("created media stream track") + ZS_PARAM("kind", IMediaStreamTrack::toString(mKind)) + ZS_PARAM("track", mTrack ? mTrack->getID() : 0)); @@ -561,7 +563,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::init() + void RTPReceiver::init() noexcept { AutoRecursiveLock lock(*this); @@ -582,7 +584,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPReceiver::~RTPReceiver() + RTPReceiver::~RTPReceiver() noexcept { if (isNoop()) return; @@ -594,25 +596,25 @@ namespace ortc } //------------------------------------------------------------------------- - RTPReceiverPtr RTPReceiver::convert(IRTPReceiverPtr object) + RTPReceiverPtr RTPReceiver::convert(IRTPReceiverPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object); } //------------------------------------------------------------------------- - RTPReceiverPtr RTPReceiver::convert(ForRTPListenerPtr object) + RTPReceiverPtr RTPReceiver::convert(ForRTPListenerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object); } //------------------------------------------------------------------------- - RTPReceiverPtr RTPReceiver::convert(ForRTPReceiverChannelPtr object) + RTPReceiverPtr RTPReceiver::convert(ForRTPReceiverChannelPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object); } //------------------------------------------------------------------------- - RTPReceiverPtr RTPReceiver::convert(ForMediaStreamTrackPtr object) + RTPReceiverPtr RTPReceiver::convert(ForMediaStreamTrackPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiver, object); } @@ -622,12 +624,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IStatsProvider - #pragma mark + // + // RTPReceiver => IStatsProvider + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr RTPReceiver::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr RTPReceiver::getStats(const StatsTypeSet &stats) const noexcept { if (!stats.hasStatType(IStatsReportTypes::StatsType_InboundRTP)) { return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); @@ -642,7 +644,6 @@ namespace ortc channels = mChannels; // obtain pointer to COW list while inside a lock } - bool result = false; for (auto iter = channels->begin(); iter != channels->end(); ++iter) { auto channel = (*iter).second.lock(); @@ -660,12 +661,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiver - #pragma mark + // + // RTPReceiver => IRTPReceiver + // //------------------------------------------------------------------------- - ElementPtr RTPReceiver::toDebug(RTPReceiverPtr transport) + ElementPtr RTPReceiver::toDebug(RTPReceiverPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -677,7 +678,7 @@ namespace ortc Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept { RTPReceiverPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, kind, transport, rtcpTransport)); pThis->mThisWeak = pThis; @@ -686,7 +687,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPReceiverSubscriptionPtr RTPReceiver::subscribe(IRTPReceiverDelegatePtr originalDelegate) + IRTPReceiverSubscriptionPtr RTPReceiver::subscribe(IRTPReceiverDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to receiver")) @@ -710,13 +711,13 @@ namespace ortc } //------------------------------------------------------------------------- - IMediaStreamTrackPtr RTPReceiver::track() const + ortc::IMediaStreamTrackPtr RTPReceiver::track() const noexcept { return IMediaStreamTrackPtr(MediaStreamTrack::convert(mTrack)); } //------------------------------------------------------------------------- - IRTPTransportPtr RTPReceiver::transport() const + IRTPTransportPtr RTPReceiver::transport() const noexcept { AutoRecursiveLock lock(*this); if (!mRTPTransport) return IRTPTransportPtr(); @@ -734,7 +735,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTCPTransportPtr RTPReceiver::rtcpTransport() const + IRTCPTransportPtr RTPReceiver::rtcpTransport() const noexcept { AutoRecursiveLock lock(*this); if (!mRTCPTransport) return IRTCPTransportPtr(); @@ -758,14 +759,14 @@ namespace ortc void RTPReceiver::setTransport( IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept(false) { typedef std::set PUIDSet; AutoRecursiveLock lock(*this); UseListenerPtr listener = UseListener::getListener(transport); - ORTC_THROW_INVALID_PARAMETERS_IF(!listener) + ORTC_THROW_INVALID_PARAMETERS_IF(!listener); if (listener->getID() == mListener->getID()) { ZS_LOG_TRACE(log("transport has not changed (noop)")) @@ -818,7 +819,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPReceiverTypes::CapabilitiesPtr RTPReceiver::getCapabilities(Optional kind) + IRTPReceiverTypes::CapabilitiesPtr RTPReceiver::getCapabilities(Optional kind) noexcept { //kRtcpReport - always on //kRtcpSr - always on @@ -1308,7 +1309,7 @@ namespace ortc } //------------------------------------------------------------------------- - PromisePtr RTPReceiver::receive(const Parameters &inParameters) + PromisePtr RTPReceiver::receive(const Parameters &inParameters) noexcept(false) { typedef RTPTypesHelper::ParametersPtrPairList ParametersPtrPairList; @@ -1402,9 +1403,9 @@ namespace ortc if (CodecType_RTX != info.mCodecType) continue; - for (auto iter = parameters->mCodecs.begin(); iter != parameters->mCodecs.end(); ++iter) + for (auto iterCodecs = parameters->mCodecs.begin(); iterCodecs != parameters->mCodecs.end(); ++iterCodecs) { - auto &codec = (*iter); + auto &codec = (*iterCodecs); if (codec.mPayloadType != info.mPayloadType) continue; RTXCodecParametersPtr rtxParam = RTXCodecParameters::convert(codec.mParameters); @@ -1418,7 +1419,7 @@ namespace ortc info.mOriginalCodec = &aptCodec; } - ORTC_THROW_INVALID_PARAMETERS_IF(NULL == info.mOriginalCodec) // must point to an original codec + ORTC_THROW_INVALID_PARAMETERS_IF(NULL == info.mOriginalCodec); // must point to an original codec } } @@ -1431,11 +1432,16 @@ namespace ortc { case SupportedCodec_VP8: case SupportedCodec_VP9: +#if 0 mTrack->setH264Rendering(false); +#endif //0 goto end_codec_loop; case SupportedCodec_H264: +#if 0 mTrack->setH264Rendering(true); +#endif //0 goto end_codec_loop; + default: break; } continue; @@ -1472,7 +1478,7 @@ namespace ortc for (auto iter = removeChannels.begin(); iter != removeChannels.end(); ++iter) { auto ¶ms = (*iter); auto found = mChannelInfos.find(params); - ASSERT(found != mChannelInfos.end()) + ZS_ASSERT(found != mChannelInfos.end()); if (found == mChannelInfos.end()) continue; @@ -1490,7 +1496,7 @@ namespace ortc auto &oldParams = pairInfo.first; auto &newParams = pairInfo.second; auto found = mChannelInfos.find(oldParams); - ASSERT(found != mChannelInfos.end()) + ZS_ASSERT(found != mChannelInfos.end()); if (found == mChannelInfos.end()) continue; @@ -1508,7 +1514,7 @@ namespace ortc auto &oldParams = pairInfo.first; auto &newParams = pairInfo.second; auto found = mChannelInfos.find(oldParams); - ASSERT(found != mChannelInfos.end()) + ZS_ASSERT(found != mChannelInfos.end()); if (found == mChannelInfos.end()) continue; @@ -1561,7 +1567,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::stop() + void RTPReceiver::stop() noexcept { ZS_EVENTING_1(x, i, Detail, RtpReceiverStop, ol, RtpReceiver, Stop, puid, id, mID); @@ -1572,7 +1578,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPReceiverTypes::ContributingSourceList RTPReceiver::getContributingSources() const + IRTPReceiverTypes::ContributingSourceList RTPReceiver::getContributingSources() const noexcept { ContributingSourceList result; @@ -1588,24 +1594,25 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::requestSendCSRC(SSRCType csrc) + void RTPReceiver::requestSendCSRC(ZS_MAYBE_USED() SSRCType csrc) noexcept(false) { - ZS_THROW_NOT_IMPLEMENTED("solely used by the H.264/UC codec; for a receiver to request an SSRC from a sender (not implemented by this client)") + ZS_MAYBE_USED(csrc); + ZS_THROW_NOT_IMPLEMENTED("solely used by the H.264/UC codec; for a receiver to request an SSRC from a sender (not implemented by this client)"); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverForRTPListener - #pragma mark + // + // RTPReceiver => IRTPReceiverForRTPListener + // //------------------------------------------------------------------------- bool RTPReceiver::handlePacket( IICETypes::Components viaTransport, RTPPacketPtr packet - ) + ) noexcept { ZS_EVENTING_5( x, i, Trace, RtpReceivedIncomingPacket, ol, RtpReceiver, Receive, @@ -1617,7 +1624,8 @@ namespace ortc ); - ZS_LOG_TRACE(log("received packet") + ZS_PARAM("via", IICETypes::toString(viaTransport)) + packet->toDebug()) + ZS_LOG_TRACE(log("received packet") + ZS_PARAM("via", IICETypes::toString(viaTransport))); + ZS_EVENTING_TRACE_OBJECT(Insane, *packet, "rtp receiver received packet"); ChannelHolderPtr channelHolder; @@ -1676,7 +1684,7 @@ namespace ortc bool RTPReceiver::handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) + ) noexcept { ZS_EVENTING_5( x, i, Trace, RtpReceivedIncomingPacket, ol, RtpReceiver, Receive, @@ -1687,7 +1695,8 @@ namespace ortc size, size, packet->buffer()->SizeInBytes() ); - ZS_LOG_TRACE(log("received packet") + ZS_PARAM("via", IICETypes::toString(viaTransport)) + packet->toDebug()); + ZS_LOG_TRACE(log("received packet") + ZS_PARAM("via", IICETypes::toString(viaTransport))); + ZS_EVENTING_TRACE_OBJECT(Insane, *packet, "rtp receiver received packet"); ChannelWeakMapPtr channels; @@ -1735,12 +1744,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // RTPReceiver => IRTPReceiverForRTPReceiverChannel + // //------------------------------------------------------------------------- - bool RTPReceiver::sendPacket(RTCPPacketPtr packet) + bool RTPReceiver::sendPacket(RTCPPacketPtr packet) noexcept { UseSecureTransportPtr rtcpTransport; @@ -1778,17 +1787,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // RTPReceiver => IRTPReceiverForRTPReceiverChannel + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => ISecureTransportDelegate - #pragma mark + // + // RTPReceiver => ISecureTransportDelegate + // //------------------------------------------------------------------------- void RTPReceiver::onSecureTransportStateChanged( @@ -1813,9 +1822,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IWakeDelegate - #pragma mark + // + // RTPReceiver => IWakeDelegate + // //------------------------------------------------------------------------- void RTPReceiver::onWake() @@ -1832,9 +1841,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => ITimerDelegate - #pragma mark + // + // RTPReceiver => ITimerDelegate + // //------------------------------------------------------------------------- void RTPReceiver::onTimer(ITimerPtr timer) @@ -1917,20 +1926,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverAsyncDelegate - #pragma mark + // + // RTPReceiver => IRTPReceiverAsyncDelegate + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => (friend RTPReceiver::ChannelHolder) - #pragma mark + // + // RTPReceiver => (friend RTPReceiver::ChannelHolder) + // //------------------------------------------------------------------------- - void RTPReceiver::notifyChannelGone() + void RTPReceiver::notifyChannelGone() noexcept { ZS_EVENTING_1(x, i, Trace, RtpReceiverInternalChannelGoneEvent, ol, RtpReceiver, InternalEvent, puid, id, mID); @@ -1942,12 +1951,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => (internal) - #pragma mark + // + // RTPReceiver => (internal) + // //------------------------------------------------------------------------- - Log::Params RTPReceiver::log(const char *message) const + Log::Params RTPReceiver::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::RTPReceiver"); UseServicesHelper::debugAppend(objectEl, "id", mID); @@ -1955,13 +1964,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPReceiver::debug(const char *message) const + Log::Params RTPReceiver::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr RTPReceiver::toDebug() const + ElementPtr RTPReceiver::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -2030,25 +2039,25 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPReceiver::isShuttingDown() const + bool RTPReceiver::isShuttingDown() const noexcept { return State_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool RTPReceiver::isShutdown() const + bool RTPReceiver::isShutdown() const noexcept { return State_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void RTPReceiver::step() + void RTPReceiver::step() noexcept { - ZS_LOG_DEBUG(debug("step")) + ZS_LOG_DEBUG(debug("step")); if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_LOG_DEBUG(debug("step forwarding to cancel")); cancel(); return; } @@ -2064,28 +2073,28 @@ namespace ortc not_ready: { - ZS_LOG_TRACE(debug("receiver is not ready")) + ZS_LOG_TRACE(debug("receiver is not ready")); return; } ready: { - ZS_LOG_TRACE(log("ready")) + ZS_LOG_TRACE(log("ready")); setState(State_Ready); } } //------------------------------------------------------------------------- - bool RTPReceiver::stepAttemptDelivery() + bool RTPReceiver::stepAttemptDelivery() noexcept { ZS_EVENTING_1(x, i, Debug, RtpReceiverStep, ol, RtpReceiver, Step, puid, id, mID); if (!mReattemptRTPDelivery) { - ZS_LOG_TRACE(log("no need to reattempt deliver at this time")) + ZS_LOG_TRACE(log("no need to reattempt deliver at this time")); return true; } - ZS_LOG_DEBUG(log("will attempt to deliver any buffered RTP packets")) + ZS_LOG_DEBUG(log("will attempt to deliver any buffered RTP packets")); mReattemptRTPDelivery = false; @@ -2124,7 +2133,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPReceiver::stepCleanChannels() + bool RTPReceiver::stepCleanChannels() noexcept { ZS_EVENTING_1(x, i, Debug, RtpReceiverStep, ol, RtpReceiver, Step, puid, id, mID); @@ -2154,7 +2163,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::cancel() + void RTPReceiver::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, RtpReceiverCancel, ol, RtpReceiver, Cancel, puid, id, mID); @@ -2234,7 +2243,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::setState(States state) + void RTPReceiver::setState(States state) noexcept { if (state == mCurrentState) return; @@ -2250,7 +2259,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::setError(WORD errorCode, const char *inReason) + void RTPReceiver::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -2275,14 +2284,14 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPReceiver::shouldLatchAll() + bool RTPReceiver::shouldLatchAll() noexcept { if (1 != mChannelInfos.size()) return false; return (mChannelInfos.begin())->second->shouldLatchAll(); } //------------------------------------------------------------------------- - void RTPReceiver::notifyChannelsOfTransportState() + void RTPReceiver::notifyChannelsOfTransportState() noexcept { ISecureTransport::States currentState = ISecureTransport::State_Pending; @@ -2312,7 +2321,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::flushAllAutoLatchedChannels() + void RTPReceiver::flushAllAutoLatchedChannels() noexcept { ZS_LOG_TRACE(log("flushing all auto-latched channels") + ZS_PARAM("channels", mChannels->size())) @@ -2332,7 +2341,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::addChannel(ParametersPtr params) + void RTPReceiver::addChannel(ParametersPtr params) noexcept { ChannelInfoPtr channelInfo(make_shared()); channelInfo->mOriginalParameters = params; @@ -2365,7 +2374,7 @@ namespace ortc void RTPReceiver::updateChannel( ChannelInfoPtr channelInfo, ParametersPtr newParams - ) + ) noexcept { ZS_EVENTING_2(x, i, Debug, RtpReceiverUpdateChannel, ol, RtpReceiver, Info, puid, id, mID, puid, channelObjectId, channelInfo->mID); @@ -2470,7 +2479,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::removeChannel(const ChannelInfo &channelInfo) + void RTPReceiver::removeChannel(const ChannelInfo &channelInfo) noexcept { ZS_EVENTING_2(x, i, Debug, RtpReceiverRemoveChannel, ol, RtpReceiver, Info, puid, id, mID, puid, channelObjectId, channelInfo.mID); @@ -2584,8 +2593,9 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::registerHeaderExtensions(const Parameters ¶ms) + void RTPReceiver::registerHeaderExtensions(ZS_MAYBE_USED() const Parameters ¶ms) noexcept { + ZS_MAYBE_USED(params); mRegisteredExtensions.clear(); for (auto iter = mParameters->mHeaderExtensions.begin(); iter != mParameters->mHeaderExtensions.end(); ++iter) { @@ -2621,7 +2631,7 @@ namespace ortc RoutingPayloadType routingPayload, String &ioRID, ChannelHolderPtr &ioChannelHolder - ) + ) noexcept { SSRCInfoPtr ssrcInfo; @@ -2706,7 +2716,7 @@ namespace ortc void RTPReceiver::setRIDUsage( const String &rid, ChannelInfoPtr &ioChannelInfo - ) + ) noexcept { if (rid.isEmpty()) return; @@ -2734,7 +2744,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::registerSSRCUsage(SSRCInfoPtr ssrcInfo) + void RTPReceiver::registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept { mSSRCRoutingPayloadTable[SSRCRoutingPair(ssrcInfo->mSSRC, ssrcInfo->mRoutingPayload)] = ssrcInfo; } @@ -2744,7 +2754,7 @@ namespace ortc const IRTPTypes::EncodingParameters &encodingParams, ChannelInfoPtr channelInfo, ChannelHolderPtr &ioChannelHolder - ) + ) noexcept { if (!encodingParams.mCodecPayloadType.hasValue()) return; @@ -2812,7 +2822,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::reattemptDelivery() + void RTPReceiver::reattemptDelivery() noexcept { if (mReattemptRTPDelivery) return; mReattemptRTPDelivery = true; @@ -2820,7 +2830,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::expireRTPPackets() + void RTPReceiver::expireRTPPackets() noexcept { auto tick = zsLib::now(); @@ -2842,14 +2852,14 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPReceiver::shouldCleanChannel(bool objectExists) + bool RTPReceiver::shouldCleanChannel(bool objectExists) noexcept { if (!objectExists) cleanChannels(); return !objectExists; } //------------------------------------------------------------------------- - void RTPReceiver::cleanChannels() + void RTPReceiver::cleanChannels() noexcept { if (mCleanChannels) return; mCleanChannels = true; @@ -2865,7 +2875,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelHolderPtr &outChannelHolder, String &outRID - ) + ) noexcept { ChannelInfoPtr channelInfo; @@ -2896,12 +2906,12 @@ namespace ortc fill_rid: { if (!outChannelHolder) { - ASSERT((bool)channelInfo) + ZS_ASSERT((bool)channelInfo); createChannel(rtpPacket.ssrc(), routingPayload, outRID, channelInfo, outChannelHolder); outChannelHolder = channelInfo->mChannelHolder.lock(); - ASSERT(outChannelHolder) + ZS_ASSERT(outChannelHolder); } if (channelInfo) { @@ -2920,7 +2930,7 @@ namespace ortc RoutingPayloadType routingPayload, const RTPPacket &rtpPacket, ChannelHolderPtr &outChannelHolder - ) + ) noexcept { for (auto ext = rtpPacket.firstHeaderExtension(); NULL != ext; ext = ext->mNext) { LocalID localID = static_cast(ext->mID); @@ -2947,7 +2957,7 @@ namespace ortc } //------------------------------------------------------------------------- - String RTPReceiver::extractMuxID(const RTPPacket &rtpPacket) + String RTPReceiver::extractMuxID(const RTPPacket &rtpPacket) noexcept { for (auto ext = rtpPacket.firstHeaderExtension(); NULL != ext; ext = ext->mNext) { LocalID localID = static_cast(ext->mID); @@ -2976,7 +2986,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ) + ) noexcept { if (!rid.hasData()) return false; @@ -2988,7 +2998,7 @@ namespace ortc outChannelInfo = ridInfo.mChannelInfo; outChannelHolder = outChannelInfo->mChannelHolder.lock(); - ZS_LOG_DEBUG(log("creating new SSRC table entry (based on rid mapping to existing receiver)") + ZS_PARAM("rid", rid) + ridInfo.toDebug()) + ZS_LOG_DEBUG(log("creating new SSRC table entry (based on rid mapping to existing receiver)") + ZS_PARAM("rid", rid) + ridInfo.toDebug()); String inRID = rid; setSSRCUsage(rtpPacket.ssrc(), routingPayload, inRID, outChannelHolder); @@ -3010,7 +3020,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ) + ) noexcept { for (auto iter = mChannelInfos.begin(); iter != mChannelInfos.end(); ++iter) { @@ -3089,7 +3099,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ) + ) noexcept { EncodingParameters *foundEncoding = NULL; @@ -3098,7 +3108,7 @@ namespace ortc Optional kind = mKind; RTPTypesHelper::DecodedCodecInfo decodedCodec; if (!RTPTypesHelper::decodePacketCodecs(kind, rtpPacket, *mParameters, decodedCodec)) { - ZS_LOG_WARNING(Debug, log("unable to find a codec for packet") + ZS_PARAM("packet ssrc", rtpPacket.ssrc()) + ZS_PARAM("payload type", rtpPacket.pt()) + mParameters->toDebug()) + ZS_LOG_WARNING(Debug, log("unable to find a codec for packet") + ZS_PARAM("packet ssrc", rtpPacket.ssrc()) + ZS_PARAM("payload type", rtpPacket.pt()) + mParameters->toDebug()); return false; } @@ -3117,7 +3127,7 @@ namespace ortc } if (NULL == matchEncoding) continue; // did not find an appropriate encoding - ASSERT(NULL != baseEncoding) // has to always have a base + ZS_ASSERT(NULL != baseEncoding); // has to always have a base if (baseEncoding->mEncodingID.hasData()) { if (rid.hasData()) { @@ -3130,7 +3140,7 @@ namespace ortc { switch (decodedCodec.mDepth[0].mCodecKind) { - case CodecKind_Unknown: ASSERT(false) break; + case CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case CodecKind_Audio: case CodecKind_AudioSupplemental: case CodecKind_Video: @@ -3169,7 +3179,7 @@ namespace ortc continue; } - ZS_LOG_WARNING(Trace, log("possible ambiguity in match (going with this as more recent in usage)") + ZS_PARAM("match time", lastMatchUsageTime) + ssrcInfo->toDebug() + ZS_PARAM("using", channelInfo->toDebug()) + ZS_PARAM("previous found", outChannelInfo->toDebug())) + ZS_LOG_WARNING(Trace, log("possible ambiguity in match (going with this as more recent in usage)") + ZS_PARAM("match time", lastMatchUsageTime) + ssrcInfo->toDebug() + ZS_PARAM("using", channelInfo->toDebug()) + ZS_PARAM("previous found", outChannelInfo->toDebug())); lastMatchUsageTime = ssrcInfo->mLastUsage; outChannelInfo = channelInfo; @@ -3198,10 +3208,10 @@ namespace ortc // scope: fill in SSRC in encoding parameters { - ASSERT(foundEncoding) + ZS_ASSERT(foundEncoding); switch (decodedCodec.mDepth[0].mCodecKind) { - case CodecKind_Unknown: ASSERT(false) break; + case CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case CodecKind_Audio: case CodecKind_Video: case CodecKind_AV: @@ -3233,7 +3243,7 @@ namespace ortc } } - ASSERT(false) + ZS_ASSERT_FAIL("code should be unreachable"); return false; } @@ -3263,7 +3273,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ) + ) noexcept { Time lastMatchUsageTime; ChannelInfoPtr foundChannelInfo; @@ -3277,7 +3287,7 @@ namespace ortc auto &channelInfo = channelHolder->mChannelInfo; - ASSERT(channelInfo->mFilledParameters->mEncodings.size() > 0) + ZS_ASSERT(channelInfo->mFilledParameters->mEncodings.size() > 0); auto &filledEncoding = *(channelInfo->mFilledParameters->mEncodings.begin()); @@ -3301,7 +3311,7 @@ namespace ortc if (NULL == matchEncoding) continue; switch (decodedCodec.mDepth[0].mCodecKind) { - case CodecKind_Unknown: ASSERT(false) break; + case CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case CodecKind_Audio: case CodecKind_Video: case CodecKind_AV: @@ -3423,18 +3433,18 @@ namespace ortc if (foundChannelInfo) { - ASSERT(foundChannelInfo->mFilledParameters->mEncodings.size() > 0) + ZS_ASSERT(foundChannelInfo->mFilledParameters->mEncodings.size() > 0); auto &filledEncoding = *(foundChannelInfo->mFilledParameters->mEncodings.begin()); switch (decodedCodec.mDepth[0].mCodecKind) { - case CodecKind_Unknown: ASSERT(false) break; + case CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case CodecKind_Audio: case CodecKind_Video: case CodecKind_AV: case CodecKind_Data: { - ASSERT(false); + ZS_ASSERT_FAIL("codec node legal"); break; } case CodecKind_AudioSupplemental: @@ -3466,14 +3476,14 @@ namespace ortc } default: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown codec for FEC"); break; } } } } - ZS_LOG_DEBUG(log("filled RTX codec") + filledEncoding.toDebug()) + ZS_LOG_DEBUG(log("filled RTX codec") + filledEncoding.toDebug()); break; } case CodecKind_FEC: @@ -3490,7 +3500,7 @@ namespace ortc } default: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown codec for FEC"); break; } } @@ -3500,7 +3510,7 @@ namespace ortc filledEncoding.mFEC.value().mSSRC = rtpPacket.ssrc(); } - ZS_LOG_DEBUG(log("filled FEC codec") + filledEncoding.toDebug()) + ZS_LOG_DEBUG(log("filled FEC codec") + filledEncoding.toDebug()); break; } } @@ -3516,7 +3526,7 @@ namespace ortc switch (decodedCodec.mDepth[0].mCodecKind) { case CodecKind_Unknown: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown codec"); break; } case CodecKind_Audio: @@ -3610,7 +3620,7 @@ namespace ortc } default: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown FEC codec"); goto not_appropriate_latch; } } @@ -3712,9 +3722,9 @@ namespace ortc bool RTPReceiver::fillRIDParameters( const String &rid, ChannelInfoPtr &ioChannelInfo - ) + ) noexcept { - ASSERT((bool)ioChannelInfo) + ZS_ASSERT((bool)ioChannelInfo); if (!rid.hasData()) return true; @@ -3746,9 +3756,9 @@ namespace ortc const String &rid, ChannelInfoPtr channelInfo, ChannelHolderPtr &ioChannelHolder - ) + ) noexcept { - ASSERT(channelInfo) + ZS_ASSERT(channelInfo); if (ioChannelHolder) return; @@ -3792,7 +3802,7 @@ namespace ortc const String &rid, IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType - ) + ) noexcept { ZS_LOG_TRACE(log("notifying listener of unhandled SSRC") + ZS_PARAM("mux id", muxID) + ZS_PARAM("rid", rid) + ZS_PARAM("ssrc", ssrc) + ZS_PARAM("payload type", payloadType)); @@ -3809,7 +3819,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::processByes(const RTCPPacket &rtcpPacket) + void RTPReceiver::processByes(const RTCPPacket &rtcpPacket) noexcept { for (auto bye = rtcpPacket.firstBye(); NULL != bye; bye = bye->nextBye()) { for (size_t index = 0; index < bye->sc(); ++index) { @@ -3857,7 +3867,7 @@ namespace ortc for (; iterFilledParams != channelInfo->mFilledParameters->mEncodings.end(); ++iterFilledParams, ++iterOriginalParams) { - ASSERT(iterOriginalParams != channelInfo->mOriginalParameters->mEncodings.end()) + ZS_ASSERT(iterOriginalParams != channelInfo->mOriginalParameters->mEncodings.end()); EncodingParameters &filledParams = (*iterFilledParams); EncodingParameters &originalEncParams = (*iterOriginalParams); @@ -3873,20 +3883,20 @@ namespace ortc (! ((originalEncParams.mRTX.hasValue()) && (originalEncParams.mRTX.value().mSSRC.hasValue())) )) { - if (byeSSRC == filledParams.mRTX.value().mSSRC.value()) { - filledParams.mRTX.value().mSSRC = originalEncParams.mRTX.value().mSSRC; - } - } + if (byeSSRC == filledParams.mRTX.value().mSSRC.value()) { + filledParams.mRTX.value().mSSRC = originalEncParams.mRTX.value().mSSRC; + } + } if (((filledParams.mFEC.hasValue()) && (filledParams.mFEC.value().mSSRC.hasValue())) && (! ((originalEncParams.mFEC.hasValue()) && (originalEncParams.mFEC.value().mSSRC.hasValue())) )) { - if (byeSSRC == filledParams.mFEC.value().mSSRC.value()) { - filledParams.mFEC.value().mSSRC = originalEncParams.mFEC.value().mSSRC; - } - } + if (byeSSRC == filledParams.mFEC.value().mSSRC.value()) { + filledParams.mFEC.value().mSSRC = originalEncParams.mFEC.value().mSSRC; + } + } } } } @@ -3895,7 +3905,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::processSenderReports(const RTCPPacket &rtcpPacket) + void RTPReceiver::processSenderReports(const RTCPPacket &rtcpPacket) noexcept { for (auto sr = rtcpPacket.firstSenderReport(); NULL != sr; sr = sr->nextSenderReport()) { for (auto iter = mSSRCRoutingPayloadTable.begin(); iter != mSSRCRoutingPayloadTable.end(); ++iter) @@ -3913,7 +3923,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiver::extractCSRCs(const RTPPacket &rtpPacket) + void RTPReceiver::extractCSRCs(const RTPPacket &rtpPacket) noexcept { for (auto ext = rtpPacket.firstHeaderExtension(); NULL != ext; ext = ext->mNext) { LocalID localID = static_cast(ext->mID); @@ -3951,7 +3961,7 @@ namespace ortc SSRCType csrc, BYTE level, const Optional &voiceActivityFlag - ) + ) noexcept { auto found = mContributingSources.find(csrc); if (found == mContributingSources.end()) { @@ -3989,10 +3999,10 @@ namespace ortc void RTPReceiver::postFindMappingProcessPacket( const RTPPacket &rtpPacket, ChannelHolderPtr &channelHolder - ) + ) noexcept { - ASSERT(channelHolder) - ASSERT(channelHolder->mChannelInfo->mFilledParameters->mEncodings.size() > 0) + ZS_ASSERT(channelHolder); + ZS_ASSERT(channelHolder->mChannelInfo->mFilledParameters->mEncodings.size() > 0); auto &encoding = *(channelHolder->mChannelInfo->mFilledParameters->mEncodings.begin()); @@ -4025,11 +4035,13 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelObjectId, channelHolder->getID() ); +#if 0 mTrack->notifyActiveReceiverChannel(RTPReceiverChannel::convert(channelHolder->mChannel)); +#endif //0 } //------------------------------------------------------------------------- - void RTPReceiver::resetActiveReceiverChannel() + void RTPReceiver::resetActiveReceiverChannel() noexcept { if (!mCurrentChannel) return; @@ -4042,15 +4054,16 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelObjectId, 0 ); - +#if 0 mTrack->notifyActiveReceiverChannel(RTPReceiverChannelPtr()); +#endif //0 } //------------------------------------------------------------------------- Optional RTPReceiver::decodeREDRoutingPayloadType( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { Optional result; @@ -4083,7 +4096,7 @@ namespace ortc case CodecType_RTX: break; } - ZS_LOG_WARNING(Trace, log("RED packet contains unsupported codec") + codecInfo.toDebug()) + ZS_LOG_WARNING(Trace, log("RED packet contains unsupported codec") + codecInfo.toDebug()); return result; } @@ -4091,7 +4104,7 @@ namespace ortc Optional RTPReceiver::decodeFECPayloadType( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { Optional result; Optional recoveryPayloadType = RTPTypesHelper::getFecRecoveryPayloadType(buffer, bufferSizeInBytes); @@ -4102,7 +4115,7 @@ namespace ortc } //------------------------------------------------------------------------- - Optional RTPReceiver::getRoutingPayloadType(const RTPPacket &rtpPacket) + Optional RTPReceiver::getRoutingPayloadType(const RTPPacket &rtpPacket) noexcept { Optional result; @@ -4167,19 +4180,19 @@ namespace ortc } // should not be possible - ASSERT(false); + ZS_ASSERT_FAIL("code should be unreachable"); return result; } //------------------------------------------------------------------------- - Optional RTPReceiver::getRoutingPayload(const RTPTypesHelper::DecodedCodecInfo &decodedCodec) + Optional RTPReceiver::getRoutingPayload(const RTPTypesHelper::DecodedCodecInfo &decodedCodec) noexcept { Optional result; switch (decodedCodec.mDepth[0].mCodecKind) { case IRTPTypes::CodecKind_Unknown: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown codec"); return result; } case IRTPTypes::CodecKind_Audio: @@ -4220,7 +4233,7 @@ namespace ortc case IRTPTypes::CodecKind_Unknown: case IRTPTypes::CodecKind_RTX: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown / unsupported codec"); break; } case IRTPTypes::CodecKind_Audio: @@ -4238,7 +4251,7 @@ namespace ortc { case 0: break; case 1: break; - case 2: break; + case 2: { result = (static_cast(decodedCodec.mDepth[0].mCodecParameters->mPayloadType) << 24) | (static_cast(decodedCodec.mDepth[1].mCodecParameters->mPayloadType) << 8) | static_cast(decodedCodec.mDepth[2].mCodecParameters->mPayloadType); return result; @@ -4256,7 +4269,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPReceiver::RoutingPayloadType RTPReceiver::getMediaCodecRoutingPayload(PayloadType originalPayload) + RTPReceiver::RoutingPayloadType RTPReceiver::getMediaCodecRoutingPayload(PayloadType originalPayload) noexcept { return static_cast(originalPayload); } @@ -4269,7 +4282,7 @@ namespace ortc Optional &resultFECv2, PayloadType *outPayloadTypeFECv1, PayloadType *outPayloadTypeFECv2 - ) + ) noexcept { auto found = mCodecInfos.find(originalPayload); if (found == mCodecInfos.end()) return; @@ -4356,7 +4369,7 @@ namespace ortc } //------------------------------------------------------------------------- - Optional RTPReceiver::getRtxMediaCodecRoutingPayload(PayloadType originalPayload) + Optional RTPReceiver::getRtxMediaCodecRoutingPayload(PayloadType originalPayload) noexcept { Optional result; @@ -4380,11 +4393,11 @@ namespace ortc //------------------------------------------------------------------------- void RTPReceiver::getRtxFECMediaCodecRoutingPayload( - PayloadType originalPayload, - IRTPTypes::KnownFECMechanisms mechanism, - Optional &resultFECv1, - Optional &resultFECv2 - ) + PayloadType originalPayload, + IRTPTypes::KnownFECMechanisms mechanism, + Optional &resultFECv1, + Optional &resultFECv2 + ) noexcept { auto found = mCodecInfos.find(originalPayload); if (found == mCodecInfos.end()) return; @@ -4421,12 +4434,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverFactory - #pragma mark + // + // IRTPReceiverFactory + // //------------------------------------------------------------------------- - IRTPReceiverFactory &IRTPReceiverFactory::singleton() + IRTPReceiverFactory &IRTPReceiverFactory::singleton() noexcept { return RTPReceiverFactory::singleton(); } @@ -4437,14 +4450,14 @@ namespace ortc Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept { if (this) {} return internal::RTPReceiver::create(delegate, kind, transport, rtcpTransport); } //------------------------------------------------------------------------- - IRTPReceiverFactory::CapabilitiesPtr IRTPReceiverFactory::getCapabilities(Optional kind) + IRTPReceiverFactory::CapabilitiesPtr IRTPReceiverFactory::getCapabilities(Optional kind) noexcept { if (this) {} return RTPReceiver::getCapabilities(kind); @@ -4457,12 +4470,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverTypes::ContributingSource - #pragma mark + // + // IRTPReceiverTypes::ContributingSource + // //--------------------------------------------------------------------------- - ElementPtr IRTPReceiverTypes::ContributingSource::toDebug() const + ElementPtr IRTPReceiverTypes::ContributingSource::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::IRTPReceiverTypes::Capabilities"); @@ -4475,7 +4488,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IRTPReceiverTypes::ContributingSource::hash() const + String IRTPReceiverTypes::ContributingSource::hash() const noexcept { auto hasher = IHasher::sha1(); hasher->update("IRTPReceiverTypes:ContributingSource:"); @@ -4493,12 +4506,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiver - #pragma mark + // + // IRTPReceiver + // //--------------------------------------------------------------------------- - ElementPtr IRTPReceiver::toDebug(IRTPReceiverPtr transport) + ElementPtr IRTPReceiver::toDebug(IRTPReceiverPtr transport) noexcept { return internal::RTPReceiver::toDebug(internal::RTPReceiver::convert(transport)); } @@ -4509,13 +4522,13 @@ namespace ortc Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept { return internal::IRTPReceiverFactory::singleton().create(delegate, kind, transport, rtcpTransport); } //--------------------------------------------------------------------------- - IRTPReceiverTypes::CapabilitiesPtr IRTPReceiver::getCapabilities(Optional kind) + IRTPReceiverTypes::CapabilitiesPtr IRTPReceiver::getCapabilities(Optional kind) noexcept { return internal::IRTPReceiverFactory::singleton().getCapabilities(kind); } diff --git a/ortc/cpp/ortc_RTPReceiverChannel.cpp b/ortc/cpp/ortc_RTPReceiverChannel.cpp index e13fa108..1675a522 100644 --- a/ortc/cpp/ortc_RTPReceiverChannel.cpp +++ b/ortc/cpp/ortc_RTPReceiverChannel.cpp @@ -30,21 +30,19 @@ */ #include -#include -#include -#include #include #include #include #include -#include -#include #include #include #include #include #include +#include +#include + #include #include @@ -56,15 +54,7 @@ #include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpreceiver) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_receiver) } namespace ortc { @@ -79,9 +69,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // @@ -89,28 +79,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelSettingsDefaults - #pragma mark + // + // RTPReceiverChannelSettingsDefaults + // class RTPReceiverChannelSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~RTPReceiverChannelSettingsDefaults() + ~RTPReceiverChannelSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static RTPReceiverChannelSettingsDefaultsPtr singleton() + static RTPReceiverChannelSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static RTPReceiverChannelSettingsDefaultsPtr create() + static RTPReceiverChannelSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -118,7 +108,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { // ISettings::setUInt(ORTC_SETTING_RTP_RECEIVER_CHANNEL_, 0); } @@ -126,7 +116,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installRTPReceiverChannelSettingsDefaults() + void installRTPReceiverChannelSettingsDefaults() noexcept { RTPReceiverChannelSettingsDefaults::singleton(); } @@ -135,12 +125,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // IRTPReceiverChannelForRTPReceiver + // //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelForRTPReceiver::toDebug(ForRTPReceiverPtr object) + ElementPtr IRTPReceiverChannelForRTPReceiver::toDebug(ForRTPReceiverPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object)->toDebug(); @@ -152,7 +142,7 @@ namespace ortc MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ) + ) noexcept { return internal::IRTPReceiverChannelFactory::singleton().create(receiver, track, params, packets); } @@ -161,12 +151,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // IRTPReceiverChannelForMediaStreamTrack + // //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) + ElementPtr IRTPReceiverChannelForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object)->toDebug(); @@ -177,12 +167,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel - #pragma mark + // + // RTPReceiverChannel + // //--------------------------------------------------------------------------- - const char *RTPReceiverChannel::toString(States state) + const char *RTPReceiverChannel::toString(States state) noexcept { switch (state) { case State_Pending: return "pending"; @@ -200,12 +190,12 @@ namespace ortc UseReceiverPtr receiver, UseMediaStreamTrackPtr track, const Parameters ¶ms - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), mReceiver(receiver), - mTrack(track), - mParameters(make_shared(params)) + mParameters(make_shared(params)), + mTrack(track) { ZS_EVENTING_3( x, i, Detail, RtpReceiverChannelCreate, ol, RtpReceiverChannel, Start, @@ -215,12 +205,13 @@ namespace ortc ); ZS_LOG_DETAIL(debug("created")); - ORTC_THROW_INVALID_PARAMETERS_IF(!receiver); + ZS_ASSERT(receiver); } //------------------------------------------------------------------------- - void RTPReceiverChannel::init(const RTCPPacketList &packets) + void RTPReceiverChannel::init(ZS_MAYBE_USED() const RTCPPacketList &packets) noexcept { + ZS_MAYBE_USED(packets); AutoRecursiveLock lock(*this); Optional kind = RTPTypesHelper::getCodecsKind(*mParameters); @@ -232,27 +223,22 @@ namespace ortc switch (kind.value()) { case IMediaStreamTrackTypes::Kind_Audio: { - mAudio = UseAudio::create(mThisWeak.lock(), MediaStreamTrack::convert(mTrack), *mParameters); - mMediaBase = mAudio; found = true; break; } case IMediaStreamTrackTypes::Kind_Video: { - mVideo = UseVideo::create(mThisWeak.lock(), MediaStreamTrack::convert(mTrack), *mParameters); - mMediaBase = mVideo; found = true; break; } } } - ORTC_THROW_INVALID_PARAMETERS_IF(!found); + ZS_ASSERT(found); - ZS_EVENTING_3( + ZS_EVENTING_2( x, i, Detail, RtpReceiverChannelCreateMediaChannel, ol, RtpReceiverChannel, Info, puid, id, mID, - puid, mediaBaseId, mMediaBase->getID(), string, kind, IMediaStreamTrack::toString(kind.value()) ); @@ -260,7 +246,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPReceiverChannel::~RTPReceiverChannel() + RTPReceiverChannel::~RTPReceiverChannel() noexcept { if (isNoop()) return; @@ -272,31 +258,31 @@ namespace ortc } //------------------------------------------------------------------------- - RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverPtr object) + RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object); } //------------------------------------------------------------------------- - RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverChannelMediaBasePtr object) + RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverChannelMediaBasePtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object); } //------------------------------------------------------------------------- - RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverChannelAudioPtr object) + RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverChannelAudioPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object); } //------------------------------------------------------------------------- - RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverChannelVideoPtr object) + RTPReceiverChannelPtr RTPReceiverChannel::convert(ForRTPReceiverChannelVideoPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object); } //------------------------------------------------------------------------- - RTPReceiverChannelPtr RTPReceiverChannel::convert(ForMediaStreamTrackPtr object) + RTPReceiverChannelPtr RTPReceiverChannel::convert(ForMediaStreamTrackPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannel, object); } @@ -306,12 +292,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ForRTPReceiver - #pragma mark + // + // RTPReceiverChannel => ForRTPReceiver + // //------------------------------------------------------------------------- - ElementPtr RTPReceiverChannel::toDebug(RTPReceiverChannelPtr transport) + ElementPtr RTPReceiverChannel::toDebug(RTPReceiverChannelPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -323,7 +309,7 @@ namespace ortc MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ) + ) noexcept { RTPReceiverChannelPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), receiver, track, params)); pThis->mThisWeak = pThis; @@ -332,7 +318,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiverChannel::notifyTransportState(ISecureTransport::States state) + void RTPReceiverChannel::notifyTransportState(ISecureTransport::States state) noexcept { ZS_EVENTING_2(x, i, Detail, RtpReceiverChannelInternalSecureTransportStateChangedEvent, ol, RtpReceiverChannel, InternalEvent, puid, id, mID, string, state, ISecureTransportTypes::toString(state)); @@ -341,21 +327,21 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiverChannel::notifyPacket(RTPPacketPtr packet) + void RTPReceiverChannel::notifyPacket(RTPPacketPtr packet) noexcept { // do NOT lock this object here, instead notify self asynchronously IRTPReceiverChannelAsyncDelegateProxy::create(mThisWeak.lock())->onNotifyPacket(packet); } //------------------------------------------------------------------------- - void RTPReceiverChannel::notifyPackets(RTCPPacketListPtr packets) + void RTPReceiverChannel::notifyPackets(RTCPPacketListPtr packets) noexcept { // do NOT lock this object here, instead notify self asynchronously IRTPReceiverChannelAsyncDelegateProxy::create(mThisWeak.lock())->onNotifyPackets(packets); } //------------------------------------------------------------------------- - void RTPReceiverChannel::notifyUpdate(const Parameters ¶ms) + void RTPReceiverChannel::notifyUpdate(const Parameters ¶ms) noexcept { ZS_EVENTING_1(x, i, Detail, RtpReceiverChannelInternalUpdateEvent, ol, RtpReceiverChannel, InternalEvent, puid, id, mID); @@ -364,38 +350,37 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPReceiverChannel::handlePacket(RTPPacketPtr packet) + bool RTPReceiverChannel::handlePacket(RTPPacketPtr packet) noexcept { - ZS_EVENTING_5( + ZS_EVENTING_4( x, i, Trace, RtpReceiverChannelDeliverIncomingPacketToMediaChannel, ol, RtpReceiverChannel, Deliver, puid, id, mID, - puid, mediaBaseId, mMediaBase->getID(), enum, packetType, zsLib::to_underlying(IICETypes::Component_RTP), buffer, packet, packet->buffer()->BytePtr(), size, size, packet->buffer()->SizeInBytes() ); - return mMediaBase->handlePacket(packet); + return false; } //------------------------------------------------------------------------- - bool RTPReceiverChannel::handlePacket(RTCPPacketPtr packet) + bool RTPReceiverChannel::handlePacket(RTCPPacketPtr packet) noexcept { - ZS_EVENTING_5( + ZS_EVENTING_4( x, i, Trace, RtpReceiverChannelDeliverIncomingPacketToMediaChannel, ol, RtpReceiverChannel, Deliver, puid, id, mID, - puid, mediaBaseId, mMediaBase->getID(), enum, packetType, zsLib::to_underlying(IICETypes::Component_RTCP), buffer, packet, packet->buffer()->BytePtr(), size, size, packet->buffer()->SizeInBytes() ); - return mMediaBase->handlePacket(packet); + return false; } //------------------------------------------------------------------------- - void RTPReceiverChannel::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) + void RTPReceiverChannel::requestStats(ZS_MAYBE_USED() PromiseWithStatsReportPtr promise, ZS_MAYBE_USED() const StatsTypeSet &stats) noexcept { - return mMediaBase->requestStats(promise, stats); + ZS_MAYBE_USED(promise); + ZS_MAYBE_USED(stats); } @@ -405,20 +390,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ForMediaStreamTrack - #pragma mark + // + // RTPReceiverChannel => ForMediaStreamTrack + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ForRTPReceiverChannelMediaBase - #pragma mark + // + // RTPReceiverChannel => ForRTPReceiverChannelMediaBase + // //------------------------------------------------------------------------- - bool RTPReceiverChannel::sendPacket(RTCPPacketPtr packet) + bool RTPReceiverChannel::sendPacket(RTCPPacketPtr packet) noexcept { auto receiver = mReceiver.lock(); if (!receiver) return false; @@ -439,50 +424,49 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ForRTPReceiverChannelAudio - #pragma mark + // + // RTPReceiverChannel => ForRTPReceiverChannelAudio + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ForRTPReceiverChannelVideo - #pragma mark + // + // RTPReceiverChannel => ForRTPReceiverChannelVideo + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // //------------------------------------------------------------------------- int32_t RTPReceiverChannel::getAudioSamples( - const size_t numberOfSamples, - const uint8_t numberOfChannels, - void *audioSamples, + ZS_MAYBE_USED() const size_t numberOfSamples, + ZS_MAYBE_USED() const uint8_t numberOfChannels, + ZS_MAYBE_USED() void *audioSamples, size_t& numberOfSamplesOut - ) + ) noexcept { + ZS_MAYBE_USED(numberOfSamples); + ZS_MAYBE_USED(numberOfChannels); + ZS_MAYBE_USED(audioSamples); numberOfSamplesOut = 0; // report no samples available - -#define TODO_VERIFY_RETURN_RESULT 1 -#define TODO_VERIFY_RETURN_RESULT 2 - if (!mAudio) return 0; - - return mAudio->getAudioSamples(numberOfSamples, numberOfChannels, audioSamples, numberOfSamplesOut); +#pragma ZS_BUILD_NOTE("TODO","Verify return result") + return 0; } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IWakeDelegate - #pragma mark + // + // RTPReceiverChannel => IWakeDelegate + // //------------------------------------------------------------------------- void RTPReceiverChannel::onWake() @@ -497,9 +481,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ITimerDelegate - #pragma mark + // + // RTPReceiverChannel => ITimerDelegate + // //------------------------------------------------------------------------- void RTPReceiverChannel::onTimer(ITimerPtr timer) @@ -514,9 +498,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelAsyncDelegate - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelAsyncDelegate + // //------------------------------------------------------------------------- void RTPReceiverChannel::onSecureTransportState(ISecureTransport::States state) @@ -533,8 +517,6 @@ namespace ortc cancel(); } } - - mMediaBase->notifyTransportState(state); } //------------------------------------------------------------------------- @@ -564,13 +546,10 @@ namespace ortc { ZS_LOG_TRACE(log("on update") + params->toDebug()) - UseMediaBasePtr mediaBase; - { AutoRecursiveLock lock(*this); mParameters = params; - mediaBase = mMediaBase; Optional kind = RTPTypesHelper::getCodecsKind(*mParameters); @@ -581,33 +560,31 @@ namespace ortc switch (kind.value()) { case IMediaStreamTrackTypes::Kind_Audio: { - found = (bool)mAudio; + found = true; break; } case IMediaStreamTrackTypes::Kind_Video: { - found = (bool)mVideo; + found = true; break; } } } - ORTC_THROW_INVALID_PARAMETERS_IF(!found) + ORTC_THROW_INVALID_PARAMETERS_IF(!found); } - - mediaBase->notifyUpdate(params); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => (internal) - #pragma mark + // + // RTPReceiverChannel => (internal) + // //------------------------------------------------------------------------- - Log::Params RTPReceiverChannel::log(const char *message) const + Log::Params RTPReceiverChannel::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::RTPReceiverChannel"); IHelper::debugAppend(objectEl, "id", mID); @@ -615,13 +592,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPReceiverChannel::debug(const char *message) const + Log::Params RTPReceiverChannel::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr RTPReceiverChannel::toDebug() const + ElementPtr RTPReceiverChannel::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -645,25 +622,25 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPReceiverChannel::isShuttingDown() const + bool RTPReceiverChannel::isShuttingDown() const noexcept { return State_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool RTPReceiverChannel::isShutdown() const + bool RTPReceiverChannel::isShutdown() const noexcept { return State_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void RTPReceiverChannel::step() + void RTPReceiverChannel::step() noexcept { ZS_LOG_DEBUG(debug("step")) if ((isShuttingDown()) || (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) + ZS_LOG_DEBUG(debug("step forwarding to cancel")); cancel(); return; } @@ -681,7 +658,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiverChannel::cancel() + void RTPReceiverChannel::cancel() noexcept { //....................................................................... // try to gracefully shutdown @@ -706,7 +683,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiverChannel::setState(States state) + void RTPReceiverChannel::setState(States state) noexcept { if (state == mCurrentState) return; @@ -721,7 +698,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPReceiverChannel::setError(WORD errorCode, const char *inReason) + void RTPReceiverChannel::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -743,12 +720,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelFactory - #pragma mark + // + // IRTPReceiverChannelFactory + // //------------------------------------------------------------------------- - IRTPReceiverChannelFactory &IRTPReceiverChannelFactory::singleton() + IRTPReceiverChannelFactory &IRTPReceiverChannelFactory::singleton() noexcept { return RTPReceiverChannelFactory::singleton(); } @@ -759,7 +736,7 @@ namespace ortc MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ) + ) noexcept { if (this) {} return internal::RTPReceiverChannel::create(receiver, track, params, packets); diff --git a/ortc/cpp/ortc_RTPReceiverChannelAudio.cpp b/ortc/cpp/ortc_RTPReceiverChannelAudio.cpp deleted file mode 100644 index e2cd3c22..00000000 --- a/ortc/cpp/ortc_RTPReceiverChannelAudio.cpp +++ /dev/null @@ -1,845 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include - -#include - -#include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpreceiver) } - -namespace ortc -{ - ZS_DECLARE_USING_PTR(zsLib, ISettings); - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); - - namespace internal - { - ZS_DECLARE_CLASS_PTR(RTPReceiverChannelAudioSettingsDefaults); - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudioSettingsDefaults - #pragma mark - - class RTPReceiverChannelAudioSettingsDefaults : public ISettingsApplyDefaultsDelegate - { - public: - //----------------------------------------------------------------------- - ~RTPReceiverChannelAudioSettingsDefaults() - { - ISettings::removeDefaults(*this); - } - - //----------------------------------------------------------------------- - static RTPReceiverChannelAudioSettingsDefaultsPtr singleton() - { - static SingletonLazySharedPtr singleton(create()); - return singleton.singleton(); - } - - //----------------------------------------------------------------------- - static RTPReceiverChannelAudioSettingsDefaultsPtr create() - { - auto pThis(make_shared()); - ISettings::installDefaults(pThis); - return pThis; - } - - //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override - { - // UseSettings::setUInt(ORTC_SETTING_RTP_RECEIVER_CHANNEL_AUDIO_, 0); - } - - }; - - //------------------------------------------------------------------------- - void installRTPReceiverChannelAudioSettingsDefaults() - { - RTPReceiverChannelAudioSettingsDefaults::singleton(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelAudioForRTPReceiverChannel::toDebug(ForRTPReceiverChannelPtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object)->toDebug(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr IRTPReceiverChannelAudioForRTPReceiverChannel::create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - return internal::IRTPReceiverChannelAudioFactory::singleton().create(receiverChannel, track, params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelAudioForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object)->toDebug(); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio - #pragma mark - - //--------------------------------------------------------------------------- - const char *RTPReceiverChannelAudio::toString(States state) - { - switch (state) { - case State_Pending: return "pending"; - case State_Ready: return "ready"; - case State_ShuttingDown: return "shutting down"; - case State_Shutdown: return "shutdown"; - } - return "UNDEFINED"; - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudio::RTPReceiverChannelAudio( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr receiverChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ) : - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()), - mReceiverChannel(receiverChannel), - mTrack(track), - mParameters(make_shared(params)) - { - ZS_LOG_DETAIL(debug("created")) - - ORTC_THROW_INVALID_PARAMETERS_IF(!receiverChannel) - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::init() - { - AutoRecursiveLock lock(*this); - - mTransport = Transport::create(mThisWeak.lock()); - - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudio::~RTPReceiverChannelAudio() - { - if (isNoop()) return; - - ZS_LOG_DETAIL(log("destroyed")) - mThisWeak.reset(); - - cancel(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForReceiverChannelFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForRTPReceiverChannelPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForMediaStreamTrackFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForMediaStreamTrackPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::convert(ForRTPMediaEnginePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelAudio, object); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::notifyTransportState(ISecureTransportTypes::States state) - { - IRTPReceiverChannelAudioAsyncDelegateProxy::create(mThisWeak.lock())->onSecureTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::notifyUpdate(ParametersPtr params) - { - IRTPReceiverChannelAudioAsyncDelegateProxy::create(mThisWeak.lock())->onUpdate(params); - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::handlePacket(RTPPacketPtr packet) - { - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - if (isShuttingDown() || isShutdown()) - return false; - channelResource = mChannelResource; - bool shouldQueue = false; - if (!channelResource) - shouldQueue = true; - if (mQueuedRTP.size() > 0) - shouldQueue = true; - if (shouldQueue) { - mQueuedRTP.push(packet); - if (1 == mQueuedRTP.size()) - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - return true; - } - } - - if (!channelResource) return true; - return channelResource->handlePacket(*packet); - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::handlePacket(RTCPPacketPtr packet) - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - if (mQueuedRTP.size() > 0) { - mQueuedRTCP.push(packet); - return true; - } - channelResource = mChannelResource; - } - - if (!channelResource) return false; - return channelResource->handlePacket(*packet); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) { - promise->reject(); - return; - } - return channelResource->requestStats(promise, stats); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - RTPReceiverChannelAudioPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), receiverChannel, track, params)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - int32_t RTPReceiverChannelAudio::getAudioSamples( - const size_t numberOfSamples, - const uint8_t numberOfChannels, - void *audioSamples, - size_t& numberOfSamplesOut - ) - { -#define TODO_IMPLEMENT_THIS 1 -#define TODO_IMPLEMENT_THIS 2 - return 0; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IWakeDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::onWake() - { - ZS_LOG_DEBUG(log("wake")) - - AutoRecursiveLock lock(*this); - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => ITimerDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::onTimer(ITimerPtr timer) - { - ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) - - AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IPromiseSettledDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::onPromiseSettled(PromisePtr promise) - { - ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID())) - - AutoRecursiveLock lock(*this); - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelAudioAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::onReceiverChannelAudioDeliverPackets() - { - RTPPacketQueue rtpPackets; - RTCPPacketQueue rtcpPackets; - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - rtpPackets = mQueuedRTP; - rtcpPackets = mQueuedRTCP; - mQueuedRTP = RTPPacketQueue(); - mQueuedRTCP = RTCPPacketQueue(); - channelResource = mChannelResource; - } - - if (!channelResource) - return; - - while (rtpPackets.size() > 0) { - auto packet = rtpPackets.front(); - channelResource->handlePacket(*packet); - rtpPackets.pop(); - } - - while (rtcpPackets.size() > 0) { - auto packet = rtcpPackets.front(); - channelResource->handlePacket(*packet); - rtcpPackets.pop(); - } - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::onSecureTransportState(ISecureTransport::States state) - { - ZS_LOG_TRACE(log("notified secure transport state") + ZS_PARAM("state", ISecureTransport::toString(state))) - - AutoRecursiveLock lock(*this); - - mTransportState = state; - - if (mChannelResource) - mChannelResource->notifyTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::onUpdate(ParametersPtr params) - { - ZS_LOG_TRACE(log("on update") + params->toDebug()) - - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - mParameters = make_shared(*params); - channelResource = mChannelResource; - } - - if (channelResource) - channelResource->notifyUpdate(params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => friend Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::SendRtcp(const uint8_t* packet, size_t length) - { - auto channel = mReceiverChannel.lock(); - if (!channel) return false; - return channel->sendPacket(RTCPPacket::create(packet, length)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio::Transport - #pragma mark - - //------------------------------------------------------------------------- - RTPReceiverChannelAudio::Transport::Transport( - const make_private &, - RTPReceiverChannelAudioPtr outer - ) : - mOuter(outer) - { - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudio::Transport::~Transport() - { - mThisWeak.reset(); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::Transport::init() - { - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudio::TransportPtr RTPReceiverChannelAudio::Transport::create(RTPReceiverChannelAudioPtr outer) - { - TransportPtr pThis(make_shared(make_private{}, outer)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio::Transport => webrtc::Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::Transport::SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) - { - return true; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::Transport::SendRtcp(const uint8_t* packet, size_t length) - { - auto outer = mOuter.lock(); - if (!outer) return false; - return outer->SendRtcp(packet, length); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => (internal) - #pragma mark - - //------------------------------------------------------------------------- - Log::Params RTPReceiverChannelAudio::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPReceiverChannelAudio"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - - //------------------------------------------------------------------------- - Log::Params RTPReceiverChannelAudio::debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - - //------------------------------------------------------------------------- - ElementPtr RTPReceiverChannelAudio::toDebug() const - { - AutoRecursiveLock lock(*this); - - ElementPtr resultEl = Element::create("ortc::RTPReceiverChannelAudio"); - - IHelper::debugAppend(resultEl, "id", mID); - - IHelper::debugAppend(resultEl, "graceful shutdown", (bool)mGracefulShutdownReference); - - IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); - - IHelper::debugAppend(resultEl, "error", mLastError); - IHelper::debugAppend(resultEl, "error reason", mLastErrorReason); - - auto receiverChannel = mReceiverChannel.lock(); - IHelper::debugAppend(resultEl, "receiver channel", receiverChannel ? receiverChannel->getID() : 0); - - return resultEl; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::isShuttingDown() const - { - return State_ShuttingDown == mCurrentState; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::isShutdown() const - { - return State_Shutdown == mCurrentState; - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::step() - { - ZS_LOG_DEBUG(debug("step")) - - if ((isShuttingDown()) || - (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) - cancel(); - return; - } - - // ... other steps here ... - if (!stepChannelPromise()) goto not_ready; - if (!stepSetupChannel()) goto not_ready; - // ... other steps here ... - - goto ready; - - not_ready: - { - ZS_LOG_TRACE(debug("not ready")) - return; - } - - ready: - { - ZS_LOG_TRACE(log("ready")) - setState(State_Ready); - } - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::stepChannelPromise() - { - if (mChannelResourceLifetimeHolderPromise) { - ZS_LOG_TRACE(log("already setup channel promise")) - return true; - } - - if (mQueuedRTP.size() < 1) { - ZS_LOG_TRACE(log("cannot setup channel promise until first packet is received")) - return false; - } - - auto packet = mQueuedRTP.front(); - - mChannelResourceLifetimeHolderPromise = UseMediaEngine::setupChannel( - mThisWeak.lock(), - mTransport, - MediaStreamTrack::convert(mTrack), - mParameters, - packet - ); - - mChannelResourceLifetimeHolderPromise->thenWeak(mThisWeak.lock()); - - return true; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelAudio::stepSetupChannel() - { - if (mChannelResource) { - ZS_LOG_TRACE(log("already setup channel resource")) - return true; - } - - if (!mChannelResourceLifetimeHolderPromise->isSettled()) { - ZS_LOG_TRACE(log("waiting for setup channel promise to be set up")) - return false; - } - - if (mChannelResourceLifetimeHolderPromise->isRejected()) { - ZS_LOG_WARNING(Debug, log("media engine rejected channel setup")) - cancel(); - return false; - } - - mChannelResource = ZS_DYNAMIC_PTR_CAST(UseChannelResource, mChannelResourceLifetimeHolderPromise->value()); - - if (!mChannelResource) { - ZS_LOG_WARNING(Detail, log("failed to initialize channel resource")) - cancel(); - return false; - } - - ZS_LOG_DEBUG(log("media channel is setup") + ZS_PARAM("channel", mChannelResource->getID())) - - IRTPReceiverChannelAudioAsyncDelegateProxy::create(mThisWeak.lock())->onReceiverChannelAudioDeliverPackets(); - - mChannelResource->notifyTransportState(mTransportState); - - return true; - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::cancel() - { - //....................................................................... - // try to gracefully shutdown - - if (isShutdown()) return; - - setState(State_ShuttingDown); - - mQueuedRTP = RTPPacketQueue(); - mQueuedRTCP = RTCPPacketQueue(); - - if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); - - if (!mCloseChannelPromise) { - if (mChannelResource) { - mCloseChannelPromise = mChannelResource->shutdown(); - mCloseChannelPromise->thenWeak(mGracefulShutdownReference); - } - } - - if (mGracefulShutdownReference) { - if (mCloseChannelPromise) { - if (!mCloseChannelPromise->isSettled()) { - ZS_LOG_DEBUG(log("waiting for close channel promise")) - return; - } - } - } - - //....................................................................... - // final cleanup - - setState(State_Shutdown); - - mChannelResourceLifetimeHolderPromise.reset(); - - mChannelResource.reset(); - mCloseChannelPromise.reset(); - - // make sure to cleanup any final reference to self - mGracefulShutdownReference.reset(); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::setState(States state) - { - if (state == mCurrentState) return; - - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) - - mCurrentState = state; - -// RTPReceiverChannelAudioPtr pThis = mThisWeak.lock(); -// if (pThis) { -// mSubscriptions.delegate()->onRTPReceiverChannelAudioStateChanged(pThis, mCurrentState); -// } - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelAudio::setError(WORD errorCode, const char *inReason) - { - String reason(inReason); - if (reason.isEmpty()) { - reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); - } - - if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) - return; - } - - mLastError = errorCode; - mLastErrorReason = reason; - - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioFactory - #pragma mark - - //------------------------------------------------------------------------- - IRTPReceiverChannelAudioFactory &IRTPReceiverChannelAudioFactory::singleton() - { - return RTPReceiverChannelAudioFactory::singleton(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelAudioPtr IRTPReceiverChannelAudioFactory::create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - if (this) {} - return internal::RTPReceiverChannelAudio::create(receiverChannel, track, params); - } - - } // internal namespace -} diff --git a/ortc/cpp/ortc_RTPReceiverChannelVideo.cpp b/ortc/cpp/ortc_RTPReceiverChannelVideo.cpp deleted file mode 100644 index a6db2a14..00000000 --- a/ortc/cpp/ortc_RTPReceiverChannelVideo.cpp +++ /dev/null @@ -1,828 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpreceiver) } - -namespace ortc -{ - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); - - namespace internal - { - ZS_DECLARE_CLASS_PTR(RTPReceiverChannelVideoSettingsDefaults); - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSenderSettingsDefaults - #pragma mark - - class RTPReceiverChannelVideoSettingsDefaults : public ISettingsApplyDefaultsDelegate - { - public: - //----------------------------------------------------------------------- - ~RTPReceiverChannelVideoSettingsDefaults() - { - ISettings::removeDefaults(*this); - } - - //----------------------------------------------------------------------- - static RTPReceiverChannelVideoSettingsDefaultsPtr singleton() - { - static SingletonLazySharedPtr singleton(create()); - return singleton.singleton(); - } - - //----------------------------------------------------------------------- - static RTPReceiverChannelVideoSettingsDefaultsPtr create() - { - auto pThis(make_shared()); - ISettings::installDefaults(pThis); - return pThis; - } - - //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override - { - } - - }; - - //------------------------------------------------------------------------- - void installRTPReceiverChannelVideoSettingsDefaults() - { - RTPReceiverChannelVideoSettingsDefaults::singleton(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelVideoForRTPReceiverChannel::toDebug(ForRTPReceiverChannelPtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object)->toDebug(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr IRTPReceiverChannelVideoForRTPReceiverChannel::create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - return internal::IRTPReceiverChannelVideoFactory::singleton().create(receiverChannel, track, params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr IRTPReceiverChannelVideoForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) - { - if (!object) return ElementPtr(); - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object)->toDebug(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo - #pragma mark - - //--------------------------------------------------------------------------- - const char *RTPReceiverChannelVideo::toString(States state) - { - switch (state) { - case State_Pending: return "pending"; - case State_Ready: return "ready"; - case State_ShuttingDown: return "shutting down"; - case State_Shutdown: return "shutdown"; - } - return "UNDEFINED"; - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideo::RTPReceiverChannelVideo( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr receiverChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ) : - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()), - mReceiverChannel(receiverChannel), - mTrack(track), - mParameters(make_shared(params)) - { - ZS_LOG_DETAIL(debug("created")) - - ORTC_THROW_INVALID_PARAMETERS_IF(!receiverChannel) - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::init() - { - AutoRecursiveLock lock(*this); - - mTransport = Transport::create(mThisWeak.lock()); - - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideo::~RTPReceiverChannelVideo() - { - if (isNoop()) return; - - ZS_LOG_DETAIL(log("destroyed")) - mThisWeak.reset(); - - cancel(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::convert(ForSettingsPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::convert(ForReceiverChannelFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::convert(ForRTPReceiverChannelPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::convert(ForMediaStreamTrackFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::convert(ForMediaStreamTrackPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::convert(ForRTPMediaEnginePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPReceiverChannelVideo, object); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::notifyTransportState(ISecureTransportTypes::States state) - { - IRTPReceiverChannelVideoAsyncDelegateProxy::create(mThisWeak.lock())->onSecureTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::notifyUpdate(ParametersPtr params) - { - IRTPReceiverChannelVideoAsyncDelegateProxy::create(mThisWeak.lock())->onUpdate(params); - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::handlePacket(RTPPacketPtr packet) - { - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - if (isShuttingDown() || isShutdown()) - return false; - channelResource = mChannelResource; - bool shouldQueue = false; - if (!channelResource) - shouldQueue = true; - if (mQueuedRTP.size() > 0) - shouldQueue = true; - if (shouldQueue) { - mQueuedRTP.push(packet); - if (1 == mQueuedRTP.size()) - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - return true; - } - } - - if (!channelResource) return false; - return channelResource->handlePacket(*packet); - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::handlePacket(RTCPPacketPtr packet) - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - if (mQueuedRTP.size() > 0) { - mQueuedRTCP.push(packet); - return true; - } - channelResource = mChannelResource; - } - - if (!channelResource) return false; - return channelResource->handlePacket(*packet); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) { - promise->reject(); - return; - } - return channelResource->requestStats(promise, stats); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr RTPReceiverChannelVideo::create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - RTPReceiverChannelVideoPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), receiverChannel, track, params)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IWakeDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::onWake() - { - ZS_LOG_DEBUG(log("wake")) - - AutoRecursiveLock lock(*this); - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => ITimerDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::onTimer(ITimerPtr timer) - { - ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) - - AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IPromiseSettledDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::onPromiseSettled(PromisePtr promise) - { - ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID())) - - AutoRecursiveLock lock(*this); - step(); - - if (ZS_DYNAMIC_PTR_CAST(PromiseWithRTPMediaEngineChannelResource, promise)) { - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelVideoAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::onReceiverChannelVideoDeliverPackets() - { - RTPPacketQueue rtpPackets; - RTCPPacketQueue rtcpPackets; - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - rtpPackets = mQueuedRTP; - rtcpPackets = mQueuedRTCP; - mQueuedRTP = RTPPacketQueue(); - mQueuedRTCP = RTCPPacketQueue(); - channelResource = mChannelResource; - } - - if (!channelResource) - return; - - while (rtpPackets.size() > 0) { - auto packet = rtpPackets.front(); - channelResource->handlePacket(*packet); - rtpPackets.pop(); - } - - while (rtcpPackets.size() > 0) { - auto packet = rtcpPackets.front(); - channelResource->handlePacket(*packet); - rtcpPackets.pop(); - } - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::onSecureTransportState(ISecureTransport::States state) - { - ZS_LOG_TRACE(log("notified secure transport state") + ZS_PARAM("state", ISecureTransport::toString(state))) - - AutoRecursiveLock lock(*this); - - mTransportState = state; - - if (mChannelResource) - mChannelResource->notifyTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::onUpdate(ParametersPtr params) - { - ZS_LOG_TRACE(log("on update") + params->toDebug()) - - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - mParameters = make_shared(*params); - channelResource = mChannelResource; - } - - if (channelResource) - channelResource->notifyUpdate(params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => friend Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::SendRtcp(const uint8_t* packet, size_t length) - { - auto channel = mReceiverChannel.lock(); - if (!channel) return false; - return channel->sendPacket(RTCPPacket::create(packet, length)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo::Transport - #pragma mark - - //------------------------------------------------------------------------- - RTPReceiverChannelVideo::Transport::Transport( - const make_private &, - RTPReceiverChannelVideoPtr outer - ) : - mOuter(outer) - { - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideo::Transport::~Transport() - { - mThisWeak.reset(); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::Transport::init() - { - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideo::TransportPtr RTPReceiverChannelVideo::Transport::create(RTPReceiverChannelVideoPtr outer) - { - TransportPtr pThis(make_shared(make_private{}, outer)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo::Transport => webrtc::Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::Transport::SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) - { - return true; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::Transport::SendRtcp(const uint8_t* packet, size_t length) - { - auto outer = mOuter.lock(); - if (!outer) return false; - return outer->SendRtcp(packet, length); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => (internal) - #pragma mark - - //------------------------------------------------------------------------- - Log::Params RTPReceiverChannelVideo::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPReceiverChannelVideo"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - - //------------------------------------------------------------------------- - Log::Params RTPReceiverChannelVideo::debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - - //------------------------------------------------------------------------- - ElementPtr RTPReceiverChannelVideo::toDebug() const - { - AutoRecursiveLock lock(*this); - - ElementPtr resultEl = Element::create("ortc::RTPReceiverChannelVideo"); - - IHelper::debugAppend(resultEl, "id", mID); - - IHelper::debugAppend(resultEl, "graceful shutdown", (bool)mGracefulShutdownReference); - - IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); - - IHelper::debugAppend(resultEl, "error", mLastError); - IHelper::debugAppend(resultEl, "error reason", mLastErrorReason); - - auto receiverChannel = mReceiverChannel.lock(); - IHelper::debugAppend(resultEl, "receiver channel", receiverChannel ? receiverChannel->getID() : 0); - - return resultEl; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::isShuttingDown() const - { - return State_ShuttingDown == mCurrentState; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::isShutdown() const - { - return State_Shutdown == mCurrentState; - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::step() - { - ZS_LOG_DEBUG(debug("step")) - - if ((isShuttingDown()) || - (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) - cancel(); - return; - } - - // ... other steps here ... - if (!stepChannelPromise()) goto not_ready; - if (!stepSetupChannel()) goto not_ready; - // ... other steps here ... - - goto ready; - - not_ready: - { - ZS_LOG_TRACE(debug("not ready")) - return; - } - - ready: - { - ZS_LOG_TRACE(log("ready")) - setState(State_Ready); - } - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::stepChannelPromise() - { - if (mChannelResourceLifetimeHolderPromise) { - ZS_LOG_TRACE(log("already setup channel promise")) - return true; - } - - if (mQueuedRTP.size() < 1) { - ZS_LOG_TRACE(log("cannot setup channel promise until first packet is received")) - return false; - } - - auto packet = mQueuedRTP.front(); - - mChannelResourceLifetimeHolderPromise = UseMediaEngine::setupChannel( - mThisWeak.lock(), - mTransport, - MediaStreamTrack::convert(mTrack), - mParameters, - packet - ); - - mChannelResourceLifetimeHolderPromise->thenWeak(mThisWeak.lock()); - - return true; - } - - //------------------------------------------------------------------------- - bool RTPReceiverChannelVideo::stepSetupChannel() - { - if (mChannelResource) { - ZS_LOG_TRACE(log("already setup channel resource")) - return true; - } - - if (!mChannelResourceLifetimeHolderPromise->isSettled()) { - ZS_LOG_TRACE(log("waiting for setup channel promise to be set up")) - return false; - } - - if (mChannelResourceLifetimeHolderPromise->isRejected()) { - ZS_LOG_WARNING(Debug, log("media engine rejected channel setup")) - cancel(); - return false; - } - - mChannelResource = ZS_DYNAMIC_PTR_CAST(UseChannelResource, mChannelResourceLifetimeHolderPromise->value()); - - if (!mChannelResource) { - ZS_LOG_WARNING(Detail, log("failed to initialize channel resource")) - cancel(); - return false; - } - - ZS_LOG_DEBUG(log("media channel is setup") + ZS_PARAM("channel", mChannelResource->getID())) - - IRTPReceiverChannelVideoAsyncDelegateProxy::create(mThisWeak.lock())->onReceiverChannelVideoDeliverPackets(); - - mChannelResource->notifyTransportState(mTransportState); - - return true; - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::cancel() - { - //....................................................................... - // try to gracefully shutdown - - if (isShutdown()) return; - - setState(State_ShuttingDown); - - mQueuedRTP = RTPPacketQueue(); - mQueuedRTCP = RTCPPacketQueue(); - - if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); - - if (!mCloseChannelPromise) { - if (mChannelResource) { - mCloseChannelPromise = mChannelResource->shutdown(); - mCloseChannelPromise->thenWeak(mGracefulShutdownReference); - } - } - - if (mGracefulShutdownReference) { - if (mCloseChannelPromise) { - if (!mCloseChannelPromise->isSettled()) { - ZS_LOG_DEBUG(log("waiting for close channel promise")) - return; - } - } - } - - //....................................................................... - // final cleanup - - setState(State_Shutdown); - - mChannelResourceLifetimeHolderPromise.reset(); - - mChannelResource.reset(); - mCloseChannelPromise.reset(); - - // make sure to cleanup any final reference to self - mGracefulShutdownReference.reset(); - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::setState(States state) - { - if (state == mCurrentState) return; - - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) - - mCurrentState = state; - -// RTPReceiverChannelVideoPtr pThis = mThisWeak.lock(); -// if (pThis) { -// mSubscriptions.delegate()->onRTPReceiverChannelVideoStateChanged(pThis, mCurrentState); -// } - } - - //------------------------------------------------------------------------- - void RTPReceiverChannelVideo::setError(WORD errorCode, const char *inReason) - { - String reason(inReason); - if (reason.isEmpty()) { - reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); - } - - if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) - return; - } - - mLastError = errorCode; - mLastErrorReason = reason; - - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoFactory - #pragma mark - - //------------------------------------------------------------------------- - IRTPReceiverChannelVideoFactory &IRTPReceiverChannelVideoFactory::singleton() - { - return RTPReceiverChannelVideoFactory::singleton(); - } - - //------------------------------------------------------------------------- - RTPReceiverChannelVideoPtr IRTPReceiverChannelVideoFactory::create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - if (this) {} - return internal::RTPReceiverChannelVideo::create(receiverChannel, track, params); - } - - } // internal namespace -} diff --git a/ortc/cpp/ortc_RTPSender.cpp b/ortc/cpp/ortc_RTPSender.cpp index 69fe6533..e4f19e0a 100644 --- a/ortc/cpp/ortc_RTPSender.cpp +++ b/ortc/cpp/ortc_RTPSender.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -36,8 +38,6 @@ #include #include #include -#include -#include #include #include #include @@ -46,6 +46,8 @@ #include #include +#include +#include #include @@ -59,18 +61,8 @@ #include -#ifdef _DEBUG -#ifdef _WIN32 -#define ASSERT(x) {assert(x);} -#else -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#endif //_WIN32 -#else -#define ASSERT(x) -#endif //_DEBUG - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpsender) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_sender) } namespace ortc { @@ -87,37 +79,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderSettingsDefaults - #pragma mark + // + // RTPSenderSettingsDefaults + // class RTPSenderSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~RTPSenderSettingsDefaults() + ~RTPSenderSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static RTPSenderSettingsDefaultsPtr singleton() + static RTPSenderSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static RTPSenderSettingsDefaultsPtr create() + static RTPSenderSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -125,14 +117,14 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { } }; //------------------------------------------------------------------------- - void installRTPSenderSettingsDefaults() + void installRTPSenderSettingsDefaults() noexcept { RTPSenderSettingsDefaults::singleton(); } @@ -141,12 +133,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForSettings - #pragma mark + // + // IICETransportForSettings + // //------------------------------------------------------------------------- - void IRTPSenderForSettings::applyDefaults() + void IRTPSenderForSettings::applyDefaults() noexcept { // ISettings::setUInt(ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE, 5*1024); } @@ -155,12 +147,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForRTPListener - #pragma mark + // + // IRTPSenderForRTPListener + // //------------------------------------------------------------------------- - ElementPtr IRTPSenderForRTPListener::toDebug(ForRTPListenerPtr object) + ElementPtr IRTPSenderForRTPListener::toDebug(ForRTPListenerPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPSender, object)->toDebug(); @@ -170,12 +162,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForRTPSenderChannel - #pragma mark + // + // IRTPSenderForRTPSenderChannel + // //------------------------------------------------------------------------- - ElementPtr IRTPSenderForRTPSenderChannel::toDebug(ForRTPSenderChannelPtr object) + ElementPtr IRTPSenderForRTPSenderChannel::toDebug(ForRTPSenderChannelPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPSender, object)->toDebug(); @@ -185,12 +177,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForMediaStreamTrack - #pragma mark + // + // IRTPSenderForMediaStreamTrack + // //------------------------------------------------------------------------- - ElementPtr IRTPSenderForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) + ElementPtr IRTPSenderForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPSender, object)->toDebug(); @@ -200,12 +192,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForDTMFSender - #pragma mark + // + // IRTPSenderForDTMFSender + // //------------------------------------------------------------------------- - ElementPtr IRTPSenderForDTMFSender::toDebug(ForDTMFSenderPtr transport) + ElementPtr IRTPSenderForDTMFSender::toDebug(ForDTMFSenderPtr transport) noexcept { if (!transport) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPSender, transport)->toDebug(); @@ -216,22 +208,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::ChannelHolder - #pragma mark + // + // RTPReceiver::ChannelHolder + // //------------------------------------------------------------------------- - RTPSender::ChannelHolder::ChannelHolder() + RTPSender::ChannelHolder::ChannelHolder() noexcept { } //------------------------------------------------------------------------- - RTPSender::ChannelHolder::~ChannelHolder() + RTPSender::ChannelHolder::~ChannelHolder() noexcept { notify(ISecureTransport::State_Closed); - ASSERT((bool)mChannel) - auto outer = mHolder.lock(); if (outer) { outer->notifyChannelGone(); @@ -239,13 +229,13 @@ namespace ortc } //------------------------------------------------------------------------- - PUID RTPSender::ChannelHolder::getID() const + PUID RTPSender::ChannelHolder::getID() const noexcept { return mChannel->getID(); } //------------------------------------------------------------------------- - void RTPSender::ChannelHolder::notify(ISecureTransport::States state) + void RTPSender::ChannelHolder::notify(ISecureTransport::States state) noexcept { if (state == mLastReportedState) return; @@ -254,28 +244,28 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::ChannelHolder::notify(RTCPPacketListPtr packets) + void RTPSender::ChannelHolder::notify(RTCPPacketListPtr packets) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return; mChannel->notifyPackets(packets); } //------------------------------------------------------------------------- - void RTPSender::ChannelHolder::update(const Parameters ¶ms) + void RTPSender::ChannelHolder::update(const Parameters ¶ms) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return; mChannel->notifyUpdate(params); } //------------------------------------------------------------------------- - bool RTPSender::ChannelHolder::handle(RTCPPacketPtr packet) + bool RTPSender::ChannelHolder::handle(RTCPPacketPtr packet) noexcept { if (ISecureTransport::State_Closed == mLastReportedState) return false; return mChannel->handlePacket(packet); } //------------------------------------------------------------------------- - void RTPSender::ChannelHolder::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) + void RTPSender::ChannelHolder::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept { mChannel->requestStats(promise, stats); } @@ -285,31 +275,31 @@ namespace ortc const char *tones, Milliseconds duration, Milliseconds interToneGap - ) + ) noexcept { mChannel->insertDTMF(tones, duration, interToneGap); } //------------------------------------------------------------------------- - String RTPSender::ChannelHolder::toneBuffer() const + String RTPSender::ChannelHolder::toneBuffer() const noexcept { return mChannel->toneBuffer(); } //------------------------------------------------------------------------- - Milliseconds RTPSender::ChannelHolder::duration() const + Milliseconds RTPSender::ChannelHolder::duration() const noexcept { return mChannel->duration(); } //------------------------------------------------------------------------- - Milliseconds RTPSender::ChannelHolder::interToneGap() const + Milliseconds RTPSender::ChannelHolder::interToneGap() const noexcept { return mChannel->interToneGap(); } //------------------------------------------------------------------------- - ElementPtr RTPSender::ChannelHolder::toDebug() const + ElementPtr RTPSender::ChannelHolder::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPSender::ChannelHolder"); @@ -324,12 +314,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender - #pragma mark + // + // RTPSender + // //------------------------------------------------------------------------- - const char *RTPSender::toString(States state) + const char *RTPSender::toString(States state) noexcept { switch (state) { case State_Pending: return "pending"; @@ -345,14 +335,16 @@ namespace ortc const make_private &, IMessageQueuePtr queue, IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) : + ) noexcept(false) : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), - mChannels(make_shared()), - mTrack(MediaStreamTrack::convert(track)) + mSubscriptions(decltype(mSubscriptions)::create()), + mDTMFSubscriptions(decltype(mDTMFSubscriptions)::create()), + mTrack(MediaStreamTrack::convert(track)), + mChannels(make_shared()) { ZS_LOG_DETAIL(debug("created")) @@ -372,7 +364,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::init() + void RTPSender::init() noexcept { AutoRecursiveLock lock(*this); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); @@ -381,7 +373,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPSender::~RTPSender() + RTPSender::~RTPSender() noexcept { if (isNoop()) return; @@ -393,37 +385,37 @@ namespace ortc } //------------------------------------------------------------------------- - RTPSenderPtr RTPSender::convert(IRTPSenderPtr object) + RTPSenderPtr RTPSender::convert(IRTPSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSender, object); } //------------------------------------------------------------------------- - RTPSenderPtr RTPSender::convert(ForSettingsPtr object) + RTPSenderPtr RTPSender::convert(ForSettingsPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSender, object); } //------------------------------------------------------------------------- - RTPSenderPtr RTPSender::convert(ForRTPListenerPtr object) + RTPSenderPtr RTPSender::convert(ForRTPListenerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSender, object); } //------------------------------------------------------------------------- - RTPSenderPtr RTPSender::convert(ForRTPSenderChannelPtr object) + RTPSenderPtr RTPSender::convert(ForRTPSenderChannelPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSender, object); } //------------------------------------------------------------------------- - RTPSenderPtr RTPSender::convert(ForDTMFSenderPtr object) + RTPSenderPtr RTPSender::convert(ForDTMFSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSender, object); } //------------------------------------------------------------------------- - RTPSenderPtr RTPSender::convert(ForMediaStreamTrackPtr object) + RTPSenderPtr RTPSender::convert(ForMediaStreamTrackPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSender, object); } @@ -433,12 +425,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IStatsProvider - #pragma mark + // + // RTPSender => IStatsProvider + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr RTPSender::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr RTPSender::getStats(const StatsTypeSet &stats) const noexcept { if (!stats.hasStatType(IStatsReportTypes::StatsType_OutboundRTP)) { return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); @@ -453,7 +445,6 @@ namespace ortc channels = mChannels; // obtain pointer to COW list while inside a lock } - bool result = false; for (auto iter = channels->begin(); iter != channels->end(); ++iter) { auto channel = (*iter).second; @@ -470,12 +461,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSender - #pragma mark + // + // RTPSender => IRTPSender + // //------------------------------------------------------------------------- - ElementPtr RTPSender::toDebug(RTPSenderPtr transport) + ElementPtr RTPSender::toDebug(RTPSenderPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -484,10 +475,10 @@ namespace ortc //------------------------------------------------------------------------- RTPSenderPtr RTPSender::create( IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept { RTPSenderPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, track, transport, rtcpTransport)); pThis->mThisWeak = pThis; @@ -496,7 +487,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPSenderSubscriptionPtr RTPSender::subscribe(IRTPSenderDelegatePtr originalDelegate) + IRTPSenderSubscriptionPtr RTPSender::subscribe(IRTPSenderDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to receiver")) @@ -510,7 +501,7 @@ namespace ortc if (delegate) { RTPSenderPtr pThis = mThisWeak.lock(); - ASSERT((bool)pThis) + ZS_ASSERT((bool)pThis); for (auto iter = mConflicts.begin(); iter != mConflicts.end(); ++iter) { auto &ssrc = (*iter); @@ -527,14 +518,14 @@ namespace ortc } //------------------------------------------------------------------------- - IMediaStreamTrackPtr RTPSender::track() const + ortc::IMediaStreamTrackPtr RTPSender::track() const noexcept { AutoRecursiveLock lock(*this); return MediaStreamTrack::convert(mTrack); } //------------------------------------------------------------------------- - IRTPTransportPtr RTPSender::transport() const + IRTPTransportPtr RTPSender::transport() const noexcept { AutoRecursiveLock lock(*this); if (!mRTPTransport) return IRTPTransportPtr(); @@ -552,7 +543,7 @@ namespace ortc } //------------------------------------------------------------------------- - IRTCPTransportPtr RTPSender::rtcpTransport() const + IRTCPTransportPtr RTPSender::rtcpTransport() const noexcept { AutoRecursiveLock lock(*this); if (!mRTCPTransport) return IRTCPTransportPtr(); @@ -576,14 +567,14 @@ namespace ortc void RTPSender::setTransport( IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept(false) { typedef UseListener::RTCPPacketList RTCPPacketList; AutoRecursiveLock lock(*this); auto listener = UseListener::getListener(transport); - ORTC_THROW_INVALID_STATE_IF(!listener) + ORTC_THROW_INVALID_STATE_IF(!listener); if (mParameters) { if (listener->getID() != mListener->getID()) { @@ -634,7 +625,7 @@ namespace ortc } //------------------------------------------------------------------------- - PromisePtr RTPSender::setTrack(IMediaStreamTrackPtr inTrack) + PromisePtr RTPSender::setTrack(ortc::IMediaStreamTrackPtr inTrack) noexcept { UseMediaStreamTrackPtr track = MediaStreamTrack::convert(inTrack); @@ -677,7 +668,9 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelId, channel->getID() ); +#if 0 mTrack->notifyDetachSenderChannel(RTPSenderChannel::convert(channel->mChannel)); +#endif //0 } } @@ -692,7 +685,9 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelId, channel->getID() ); +#if 0 mTrack->notifyAttachSenderChannel(RTPSenderChannel::convert(channel->mChannel)); +#endif //0 } } @@ -702,13 +697,13 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPSenderTypes::CapabilitiesPtr RTPSender::getCapabilities(Optional kind) + IRTPSenderTypes::CapabilitiesPtr RTPSender::getCapabilities(Optional kind) noexcept { return IRTPReceiver::getCapabilities(kind); } //------------------------------------------------------------------------- - PromisePtr RTPSender::send(const Parameters ¶meters) + PromisePtr RTPSender::send(const Parameters ¶meters) noexcept(false) { typedef RTPTypesHelper::ParametersPtrPairList ParametersPtrPairList; @@ -723,10 +718,10 @@ namespace ortc Optional foundKind; RTPTypesHelper::validateCodecParameters(parameters, foundKind); - ORTC_THROW_INVALID_PARAMETERS_IF(!foundKind.hasValue()) // only one media kind is allowed to be specified to a sender + ORTC_THROW_INVALID_PARAMETERS_IF(!foundKind.hasValue()); // only one media kind is allowed to be specified to a sender if (mKind.hasValue()) { - ORTC_THROW_INVALID_PARAMETERS_IF(mKind.value() != foundKind.value()) // not allowed to change codec kind + ORTC_THROW_INVALID_PARAMETERS_IF(mKind.value() != foundKind.value()); // not allowed to change codec kind } else { mKind = foundKind; } @@ -844,7 +839,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::stop() + void RTPSender::stop() noexcept { ZS_EVENTING_1(x, i, Detail, RtpSenderStop, ol, RtpSender, Close, puid, id, mID); @@ -858,15 +853,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForRTPListener - #pragma mark + // + // RTPSender => IRTPSenderForRTPListener + // //------------------------------------------------------------------------- bool RTPSender::handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) + ) noexcept { ZS_EVENTING_5( x, i, Trace, RtpSenderIncomingPacket, ol, RtpSender, Receive, @@ -877,7 +872,8 @@ namespace ortc size, size, packet->buffer()->SizeInBytes() ); - ZS_LOG_TRACE(log("received packet") + ZS_PARAM("via", IICETypes::toString(viaTransport)) + packet->toDebug()) + ZS_LOG_TRACE(log("received packet") + ZS_PARAM("via", IICETypes::toString(viaTransport))) + ZS_EVENTING_TRACE_OBJECT(Insane, *packet, "rtp sender received packet"); ParametersToChannelHolderMapPtr channels; @@ -911,12 +907,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForRTPSenderChannel - #pragma mark + // + // RTPSender => IRTPSenderForRTPSenderChannel + // //------------------------------------------------------------------------- - bool RTPSender::sendPacket(RTPPacketPtr packet) + bool RTPSender::sendPacket(RTPPacketPtr packet) noexcept { UseSecureTransportPtr rtpTransport; @@ -951,7 +947,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPSender::sendPacket(RTCPPacketPtr packet) + bool RTPSender::sendPacket(RTCPPacketPtr packet) noexcept { UseSecureTransportPtr rtcpTransport; @@ -990,9 +986,9 @@ namespace ortc UseChannelPtr channel, IRTPTypes::SSRCType ssrc, bool selfDestruct - ) + ) noexcept { - ZS_LOG_DEBUG(log("notify ssrc conflict") + ZS_PARAM("channel", channel ? channel->getID() : 0) + ZS_PARAM("ssrc", ssrc) + ZS_PARAM("self destruct", selfDestruct)) + ZS_LOG_DEBUG(log("notify ssrc conflict") + ZS_PARAM("channel", channel ? channel->getID() : 0) + ZS_PARAM("ssrc", ssrc) + ZS_PARAM("self destruct", selfDestruct)); AutoRecursiveLock lock(*this); @@ -1000,7 +996,7 @@ namespace ortc for (auto iter = mConflicts.begin(); iter != mConflicts.end(); ++iter) { auto &existingSSRC = (*iter); if (existingSSRC == ssrc) { - ZS_LOG_WARNING(Detail, log("conflict already registered") + ZS_PARAM("ssrc", ssrc)) + ZS_LOG_WARNING(Detail, log("conflict already registered") + ZS_PARAM("ssrc", ssrc)); found = true; break; } @@ -1027,7 +1023,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::notifyDTMFSenderToneChanged(const char *tone) + void RTPSender::notifyDTMFSenderToneChanged(const char *tone) noexcept { AutoRecursiveLock lock(*this); @@ -1038,20 +1034,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForMediaStreamTrack - #pragma mark + // + // RTPSender => IRTPSenderForMediaStreamTrack + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForDTMFSender - #pragma mark + // + // RTPSender => IRTPSenderForDTMFSender + // //------------------------------------------------------------------------- - IDTMFSenderSubscriptionPtr RTPSender::subscribeDTMF(IDTMFSenderDelegatePtr originalDelegate) + IDTMFSenderSubscriptionPtr RTPSender::subscribe(IDTMFSenderDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to dtmf")); @@ -1075,7 +1071,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPSender::canInsertDTMF() const + bool RTPSender::canInsertDTMF() const noexcept { AutoRecursiveLock lock(*this); @@ -1118,10 +1114,7 @@ namespace ortc const char *tones, Milliseconds duration, Milliseconds interToneGap - ) throw ( - InvalidStateError, - InvalidCharacterError - ) + ) noexcept(false) { ZS_THROW_CUSTOM_IF(InvalidCharacterError, NULL == tones); ZS_THROW_CUSTOM_IF(InvalidCharacterError, '\0' == *tones); @@ -1175,13 +1168,13 @@ namespace ortc } //------------------------------------------------------------------------- - IRTPSenderPtr RTPSender::sender() const + IRTPSenderPtr RTPSender::sender() const noexcept { return mThisWeak.lock(); } //------------------------------------------------------------------------- - String RTPSender::toneBuffer() const + String RTPSender::toneBuffer() const noexcept { ChannelHolderPtr holder; @@ -1196,7 +1189,7 @@ namespace ortc } //------------------------------------------------------------------------- - Milliseconds RTPSender::duration() const + Milliseconds RTPSender::duration() const noexcept { ChannelHolderPtr holder; @@ -1211,7 +1204,7 @@ namespace ortc } //------------------------------------------------------------------------- - Milliseconds RTPSender::interToneGap() const + Milliseconds RTPSender::interToneGap() const noexcept { ChannelHolderPtr holder; @@ -1229,9 +1222,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => ISecureTransportDelegate - #pragma mark + // + // RTPReceiver => ISecureTransportDelegate + // //------------------------------------------------------------------------- void RTPSender::onSecureTransportStateChanged( @@ -1256,9 +1249,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IWakeDelegate - #pragma mark + // + // RTPSender => IWakeDelegate + // //------------------------------------------------------------------------- void RTPSender::onWake() @@ -1275,9 +1268,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IDTMFSenderDelegate - #pragma mark + // + // RTPSender => IDTMFSenderDelegate + // //------------------------------------------------------------------------- void RTPSender::onDTMFSenderToneChanged( @@ -1295,9 +1288,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderAsyncDelegate - #pragma mark + // + // RTPSender => IRTPSenderAsyncDelegate + // //------------------------------------------------------------------------- void RTPSender::onDestroyChannel(UseChannelPtr channel) @@ -1330,7 +1323,9 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelId, existingChannel->getID() ); +#if 0 mTrack->notifyDetachSenderChannel(RTPSenderChannel::convert(existingChannel->mChannel)); +#endif //0 } replacementChannels->erase(current); @@ -1344,12 +1339,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (friend ChannelHolder) - #pragma mark + // + // RTPSender => (friend ChannelHolder) + // //------------------------------------------------------------------------- - void RTPSender::notifyChannelGone() + void RTPSender::notifyChannelGone() noexcept { ZS_EVENTING_1(x, i, Debug, RtpSenderInternalChannelGoneEvent, ol, RtpSender, InternalEvent, puid, id, mID); // nothing to do @@ -1359,12 +1354,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (internal) - #pragma mark + // + // RTPSender => (internal) + // //------------------------------------------------------------------------- - Log::Params RTPSender::log(const char *message) const + Log::Params RTPSender::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::RTPSender"); IHelper::debugAppend(objectEl, "id", mID); @@ -1372,13 +1367,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPSender::debug(const char *message) const + Log::Params RTPSender::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr RTPSender::toDebug() const + ElementPtr RTPSender::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1423,19 +1418,19 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPSender::isShuttingDown() const + bool RTPSender::isShuttingDown() const noexcept { return State_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool RTPSender::isShutdown() const + bool RTPSender::isShutdown() const noexcept { return State_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void RTPSender::step() + void RTPSender::step() noexcept { ZS_LOG_DEBUG(debug("step")) @@ -1459,7 +1454,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::cancel() + void RTPSender::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, RtpSenderCancel, ol, RtpSender, Cancel, puid, id, mID); @@ -1506,7 +1501,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::setState(States state) + void RTPSender::setState(States state) noexcept { if (state == mCurrentState) return; @@ -1522,7 +1517,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::setError(WORD errorCode, const char *inReason) + void RTPSender::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -1547,7 +1542,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPSender::ChannelHolderPtr RTPSender::addChannel(ParametersPtr newParams) + RTPSender::ChannelHolderPtr RTPSender::addChannel(ParametersPtr newParams) noexcept { ChannelHolderPtr channel(make_shared()); channel->mHolder = mThisWeak.lock(); @@ -1560,8 +1555,9 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelId, channel->getID() ); - +#if 0 mTrack->notifyAttachSenderChannel(RTPSenderChannel::convert(channel->mChannel)); +#endif //0 } ZS_EVENTING_2( x, i, Debug, RtpSenderAddChannel, ol, RtpSender, Info, @@ -1575,7 +1571,7 @@ namespace ortc void RTPSender::updateChannel( ChannelHolderPtr channel, ParametersPtr newParams - ) + ) noexcept { ZS_EVENTING_2( x, i, Debug, RtpSenderUpdateChannel, ol, RtpSender, Info, @@ -1586,7 +1582,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSender::removeChannel(ChannelHolderPtr channel) + void RTPSender::removeChannel(ChannelHolderPtr channel) noexcept { ZS_EVENTING_2( x, i, Debug, RtpSenderRemoveChannel, ol, RtpSender, Info, @@ -1602,12 +1598,14 @@ namespace ortc puid, trackId, mTrack->getID(), puid, channelId, channel->getID() ); +#if 0 mTrack->notifyDetachSenderChannel(RTPSenderChannel::convert(channel->mChannel)); +#endif //0 } } //------------------------------------------------------------------------- - void RTPSender::notifyChannelsOfTransportState() + void RTPSender::notifyChannelsOfTransportState() noexcept { ISecureTransport::States currentState = ISecureTransport::State_Pending; @@ -1635,14 +1633,14 @@ namespace ortc } //------------------------------------------------------------------------- - RTPSender::ChannelHolderPtr RTPSender::getDTMFChannelHolder() const + RTPSender::ChannelHolderPtr RTPSender::getDTMFChannelHolder() const noexcept { if (mParametersGroupedIntoChannels.size() < 1) return ChannelHolderPtr(); auto params = mParametersGroupedIntoChannels.front(); - ZS_THROW_BAD_STATE_IF(!params); - ZS_THROW_BAD_STATE_IF(!mChannels); + ZS_ASSERT(params); + ZS_ASSERT(mChannels); auto found = mChannels->find(params); if (found == mChannels->end()) return ChannelHolderPtr(); @@ -1654,12 +1652,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderFactory - #pragma mark + // + // IRTPSenderFactory + // //------------------------------------------------------------------------- - IRTPSenderFactory &IRTPSenderFactory::singleton() + IRTPSenderFactory &IRTPSenderFactory::singleton() noexcept { return RTPSenderFactory::singleton(); } @@ -1667,17 +1665,17 @@ namespace ortc //------------------------------------------------------------------------- RTPSenderPtr IRTPSenderFactory::create( IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept { if (this) {} return internal::RTPSender::create(delegate, track, transport, rtcpTransport); } //------------------------------------------------------------------------- - IRTPSenderFactory::CapabilitiesPtr IRTPSenderFactory::getCapabilities(Optional kind) + IRTPSenderFactory::CapabilitiesPtr IRTPSenderFactory::getCapabilities(Optional kind) noexcept { if (this) {} return RTPSender::getCapabilities(kind); @@ -1691,12 +1689,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderTypes - #pragma mark + // + // IRTPSenderTypes + // //--------------------------------------------------------------------------- - IRTPSenderTypes::IncompatibleMediaStreamTrackErrorPtr IRTPSenderTypes::IncompatibleMediaStreamTrackError::convert(AnyPtr any) + IRTPSenderTypes::IncompatibleMediaStreamTrackErrorPtr IRTPSenderTypes::IncompatibleMediaStreamTrackError::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(IncompatibleMediaStreamTrackError, any); } @@ -1705,12 +1703,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSender - #pragma mark + // + // IRTPSender + // //--------------------------------------------------------------------------- - ElementPtr IRTPSender::toDebug(IRTPSenderPtr transport) + ElementPtr IRTPSender::toDebug(IRTPSenderPtr transport) noexcept { return internal::RTPSender::toDebug(internal::RTPSender::convert(transport)); } @@ -1718,16 +1716,16 @@ namespace ortc //--------------------------------------------------------------------------- IRTPSenderPtr IRTPSender::create( IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport - ) + ) noexcept { return internal::IRTPSenderFactory::singleton().create(delegate, track, transport, rtcpTransport); } //--------------------------------------------------------------------------- - IRTPSenderTypes::CapabilitiesPtr IRTPSender::getCapabilities(Optional kind) + IRTPSenderTypes::CapabilitiesPtr IRTPSender::getCapabilities(Optional kind) noexcept { return internal::IRTPSenderFactory::singleton().getCapabilities(kind); } diff --git a/ortc/cpp/ortc_RTPSenderChannel.cpp b/ortc/cpp/ortc_RTPSenderChannel.cpp index b8303af0..7fdf50f1 100644 --- a/ortc/cpp/ortc_RTPSenderChannel.cpp +++ b/ortc/cpp/ortc_RTPSenderChannel.cpp @@ -30,22 +30,20 @@ */ #include -#include -#include -#include #include #include #include #include #include -#include -#include #include #include #include #include #include +#include +#include + #include #include @@ -59,14 +57,7 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpsender) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_sender) } namespace ortc { @@ -82,37 +73,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelSettingsDefaults - #pragma mark + // + // RTPSenderChannelSettingsDefaults + // class RTPSenderChannelSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~RTPSenderChannelSettingsDefaults() + ~RTPSenderChannelSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static RTPSenderChannelSettingsDefaultsPtr singleton() + static RTPSenderChannelSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static RTPSenderChannelSettingsDefaultsPtr create() + static RTPSenderChannelSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -120,7 +111,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { ISettings::setUInt(ORTC_SETTING_RTP_SENDER_CHANNEL_RETAG_RTP_PACKETS_AFTER_SSRC_NOT_SENT_IN_SECONDS, 5); ISettings::setBool(ORTC_SETTING_RTP_SENDER_CHANNEL_TAG_MID_RID_IN_RTCP_SDES, true); @@ -129,7 +120,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installRTPSenderChannelSettingsDefaults() + void installRTPSenderChannelSettingsDefaults() noexcept { RTPSenderChannelSettingsDefaults::singleton(); } @@ -138,12 +129,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForRTPSender - #pragma mark + // + // IRTPSenderChannelForRTPSender + // //------------------------------------------------------------------------- - ElementPtr IRTPSenderChannelForRTPSender::toDebug(ForRTPSenderPtr object) + ElementPtr IRTPSenderChannelForRTPSender::toDebug(ForRTPSenderPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object)->toDebug(); @@ -154,7 +145,7 @@ namespace ortc RTPSenderPtr sender, MediaStreamTrackPtr track, const Parameters ¶ms - ) + ) noexcept { return internal::IRTPSenderChannelFactory::singleton().create(sender, track, params); } @@ -163,12 +154,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // IRTPSenderChannelForMediaStreamTrack + // //------------------------------------------------------------------------- - ElementPtr IRTPSenderChannelForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) + ElementPtr IRTPSenderChannelForMediaStreamTrack::toDebug(ForMediaStreamTrackPtr object) noexcept { if (!object) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object)->toDebug(); @@ -178,12 +169,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel - #pragma mark + // + // RTPSenderChannel + // //------------------------------------------------------------------------- - const char *RTPSenderChannel::toString(States state) + const char *RTPSenderChannel::toString(States state) noexcept { switch (state) { case State_Pending: return "pending"; @@ -201,18 +192,18 @@ namespace ortc UseSenderPtr sender, UseMediaStreamTrackPtr track, const Parameters ¶ms - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), mSender(sender), - mTrack(track), mParameters(make_shared(params)), mRetagAfterInSeconds(Seconds(ISettings::getUInt(ORTC_SETTING_RTP_SENDER_CHANNEL_RETAG_RTP_PACKETS_AFTER_SSRC_NOT_SENT_IN_SECONDS))), - mTagSDES(ISettings::getBool(ORTC_SETTING_RTP_SENDER_CHANNEL_TAG_MID_RID_IN_RTCP_SDES)) + mTagSDES(ISettings::getBool(ORTC_SETTING_RTP_SENDER_CHANNEL_TAG_MID_RID_IN_RTCP_SDES)), + mTrack(track) { - ZS_LOG_DETAIL(debug("created")) + ZS_LOG_DETAIL(debug("created")); - ORTC_THROW_INVALID_PARAMETERS_IF(!sender) + ZS_ASSERT(sender); setupTagging(); @@ -225,7 +216,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::init() + void RTPSenderChannel::init() noexcept { AutoRecursiveLock lock(*this); @@ -238,27 +229,22 @@ namespace ortc switch (kind.value()) { case IMediaStreamTrackTypes::Kind_Audio: { - mAudio = UseAudio::create(mThisWeak.lock(), MediaStreamTrack::convert(mTrack), *mParameters); - mMediaBase = mAudio; found = true; break; } case IMediaStreamTrackTypes::Kind_Video: { - mVideo = UseVideo::create(mThisWeak.lock(), MediaStreamTrack::convert(mTrack), *mParameters); - mMediaBase = mVideo; found = true; break; } } } - ORTC_THROW_INVALID_PARAMETERS_IF(!found); + ZS_ASSERT(found); - ZS_EVENTING_3( + ZS_EVENTING_2( x, i, Detail, RtpSenderChannelCreateMediaChannel, ol, RtpSender, Info, puid, id, mID, - puid, mediaBaseId, mMediaBase->getID(), string, kind, IMediaStreamTrack::toString(kind.value()) ); @@ -266,7 +252,7 @@ namespace ortc } //------------------------------------------------------------------------- - RTPSenderChannel::~RTPSenderChannel() + RTPSenderChannel::~RTPSenderChannel() noexcept { if (isNoop()) return; @@ -279,31 +265,31 @@ namespace ortc //------------------------------------------------------------------------- - RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderPtr object) + RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object); } //------------------------------------------------------------------------- - RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderChannelMediaBasePtr object) + RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderChannelMediaBasePtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object); } //------------------------------------------------------------------------- - RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderChannelAudioPtr object) + RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderChannelAudioPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object); } //------------------------------------------------------------------------- - RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderChannelVideoPtr object) + RTPSenderChannelPtr RTPSenderChannel::convert(ForRTPSenderChannelVideoPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object); } //------------------------------------------------------------------------- - RTPSenderChannelPtr RTPSenderChannel::convert(ForMediaStreamTrackPtr object) + RTPSenderChannelPtr RTPSenderChannel::convert(ForMediaStreamTrackPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPSenderChannel, object); } @@ -312,12 +298,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => ForRTPSender - #pragma mark + // + // RTPSenderChannel => ForRTPSender + // //------------------------------------------------------------------------- - ElementPtr RTPSenderChannel::toDebug(RTPSenderChannelPtr transport) + ElementPtr RTPSenderChannel::toDebug(RTPSenderChannelPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -328,7 +314,7 @@ namespace ortc RTPSenderPtr sender, MediaStreamTrackPtr track, const Parameters ¶ms - ) + ) noexcept { RTPSenderChannelPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), sender, track, params)); pThis->mThisWeak = pThis; @@ -337,20 +323,19 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::notifyTrackChanged(MediaStreamTrackPtr inTrack) + void RTPSenderChannel::notifyTrackChanged(MediaStreamTrackPtr inTrack) noexcept { UseMediaStreamTrackPtr track = inTrack; - ZS_EVENTING_3( + ZS_EVENTING_2( x, i, Debug, RtpSenderChannelChangeTrack, ol, RtpSenderChannel, InternalEvent, puid, id, mID, - puid, mediaBaseId, mMediaBase->getID(), puid, trackId, ((bool)track) ? track->getID() : 0 ); IRTPSenderChannelAsyncDelegateProxy::create(mThisWeak.lock())->onTrackChanged(track); } //------------------------------------------------------------------------- - void RTPSenderChannel::notifyTransportState(ISecureTransportTypes::States state) + void RTPSenderChannel::notifyTransportState(ISecureTransportTypes::States state) noexcept { ZS_EVENTING_2( x, i, Debug, RtpSenderChannelInternalSecureTransportStateChangedEvent, ol, RtpSenderChannel, InternalEvent, @@ -363,14 +348,14 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::notifyPackets(RTCPPacketListPtr packets) + void RTPSenderChannel::notifyPackets(RTCPPacketListPtr packets) noexcept { // do NOT lock this object here, instead notify self asynchronously IRTPSenderChannelAsyncDelegateProxy::create(mThisWeak.lock())->onNotifyPackets(packets); } //------------------------------------------------------------------------- - void RTPSenderChannel::notifyUpdate(const Parameters ¶ms) + void RTPSenderChannel::notifyUpdate(const Parameters ¶ms) noexcept { ZS_EVENTING_1(x, i, Debug, RtpSenderChannelInternalUpdateEvent, ol, RtpSenderChannel, InternalEvent, puid, id, mID); @@ -379,27 +364,22 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) + void RTPSenderChannel::requestStats(PromiseWithStatsReportPtr promise, ZS_MAYBE_USED() const StatsTypeSet &stats) noexcept { + ZS_MAYBE_USED(stats); ZS_LOG_TRACE(log("on provide stats") + ZS_PARAM("promise", promise->getID())); - UseMediaBasePtr mediaBase; - { AutoRecursiveLock lock(*this); - mediaBase = mMediaBase; } - - mediaBase->requestStats(promise, stats); } //------------------------------------------------------------------------- - bool RTPSenderChannel::handlePacket(RTCPPacketPtr packet) + bool RTPSenderChannel::handlePacket(RTCPPacketPtr packet) noexcept { - ZS_EVENTING_5( + ZS_EVENTING_4( x, i, Trace, RtpSenderChannelDeliverIncomingPacketToMediaChannel, ol, RtpSenderChannel, Deliver, puid, id, mID, - puid, mediaBaseId, mMediaBase->getID(), enum, packetType, zsLib::to_underlying(IICETypes::Component_RTCP), buffer, packet, packet->buffer()->BytePtr(), size, size, packet->buffer()->SizeInBytes() @@ -443,47 +423,49 @@ namespace ortc } } - return mMediaBase->handlePacket(packet); + return false; } //------------------------------------------------------------------------- void RTPSenderChannel::insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) + ZS_MAYBE_USED() const char *tones, + ZS_MAYBE_USED() Milliseconds duration, + ZS_MAYBE_USED() Milliseconds interToneGap + ) noexcept { - mMediaBase->insertDTMF(tones, duration, interToneGap); + ZS_MAYBE_USED(tones); + ZS_MAYBE_USED(duration); + ZS_MAYBE_USED(interToneGap); } //------------------------------------------------------------------------- - String RTPSenderChannel::toneBuffer() const + String RTPSenderChannel::toneBuffer() const noexcept { - return mMediaBase->toneBuffer(); + return String(); } //------------------------------------------------------------------------- - Milliseconds RTPSenderChannel::duration() const + Milliseconds RTPSenderChannel::duration() const noexcept { - return mMediaBase->duration(); + return Milliseconds(); } //------------------------------------------------------------------------- - Milliseconds RTPSenderChannel::interToneGap() const + Milliseconds RTPSenderChannel::interToneGap() const noexcept { - return mMediaBase->interToneGap(); + return Milliseconds(); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => ForRTPSenderChannelMediaBase - #pragma mark + // + // RTPSenderChannel => ForRTPSenderChannelMediaBase + // //------------------------------------------------------------------------- - bool RTPSenderChannel::sendPacket(RTPPacketPtr packet) + bool RTPSenderChannel::sendPacket(RTPPacketPtr packet) noexcept { auto sender = mSender.lock(); if (!sender) return false; @@ -514,8 +496,8 @@ namespace ortc auto oldHeaderExtensions = packet->mHeaderExtensions; // remember old pointer temporarily - RTPPacket::StringHeaderExtension muxHeader(mMuxHeader ? mMuxHeader->mID : 0, mMuxID.c_str()); - RTPPacket::StringHeaderExtension ridHeader(mRIDHeader ? mRIDHeader->mID : 0, mRID.c_str()); + RTPPacket::StringHeaderExtension muxHeader(mMuxHeader ? static_cast(mMuxHeader->mID) : 0, mMuxID.c_str()); + RTPPacket::StringHeaderExtension ridHeader(mRIDHeader ? static_cast(mRIDHeader->mID) : 0, mRID.c_str()); // Re-point extenion headers in RTP packet to first point to MuxID or // RID or both. @@ -557,7 +539,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPSenderChannel::sendPacket(RTCPPacketPtr packet) + bool RTPSenderChannel::sendPacket(RTCPPacketPtr packet) noexcept { auto sender = mSender.lock(); if (!sender) return false; @@ -595,8 +577,8 @@ namespace ortc { for (auto chunk = sdes->firstChunk(); NULL != chunk; chunk = chunk->next()) { - ASSERT(NULL == chunk->firstMid()) - ASSERT(NULL == chunk->firstRid()) + ZS_ASSERT(NULL == chunk->firstMid()); + ZS_ASSERT(NULL == chunk->firstRid()); if (muxID.hasData()) { chunk->mMidCount = 1; chunk->mFirstMid = &midItem; @@ -636,12 +618,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => ForRTPSenderChannelAudio - #pragma mark + // + // RTPSenderChannel => ForRTPSenderChannelAudio + // //------------------------------------------------------------------------- - void RTPSenderChannel::notifyDTMFSenderToneChanged(const char *tone) + void RTPSenderChannel::notifyDTMFSenderToneChanged(const char *tone) noexcept { auto sender = mSender.lock(); if (!sender) { @@ -656,45 +638,45 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => ForRTPSenderChannelVideo - #pragma mark + // + // RTPSenderChannel => ForRTPSenderChannelVideo + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelForMediaStreamTrack + // //------------------------------------------------------------------------- int32_t RTPSenderChannel::sendAudioSamples( - const void* audioSamples, - const size_t numberOfSamples, - const uint8_t numberOfChannels - ) + ZS_MAYBE_USED() const void* audioSamples, + ZS_MAYBE_USED() const size_t numberOfSamples, + ZS_MAYBE_USED() const uint8_t numberOfChannels + ) noexcept { -#define TODO_VERIFY_RESULT 1 -#define TODO_VERIFY_RESULT 2 + ZS_MAYBE_USED(audioSamples); + ZS_MAYBE_USED(numberOfSamples); + ZS_MAYBE_USED(numberOfChannels); +#pragma ZS_BUILD_NOTE("TODO","Verify result") if (!mAudio) return 0; - return mAudio->sendAudioSamples(audioSamples, numberOfSamples, numberOfChannels); + return 0; } //------------------------------------------------------------------------- - void RTPSenderChannel::sendVideoFrame(VideoFramePtr videoFrame) + void RTPSenderChannel::sendVideoFrame(VideoFramePtr videoFrame) noexcept { - if (!mVideo) return; - mVideo->sendVideoFrame(videoFrame); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IWakeDelegate - #pragma mark + // + // RTPSenderChannel => IWakeDelegate + // //------------------------------------------------------------------------- void RTPSenderChannel::onWake() @@ -709,9 +691,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => ITimerDelegate - #pragma mark + // + // RTPSenderChannel => ITimerDelegate + // //------------------------------------------------------------------------- void RTPSenderChannel::onTimer(ITimerPtr timer) @@ -719,32 +701,25 @@ namespace ortc ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 +#pragma ZS_BUILD_NOTE("TODO","implement timer") } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelAsyncDelegate - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelAsyncDelegate + // //------------------------------------------------------------------------- void RTPSenderChannel::onTrackChanged(UseMediaStreamTrackPtr track) { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase, UseBaseMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelAudio, UseAudioMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelVideo, UseVideoMediaStreamTrack) - switch (mKind.value()) { case IMediaStreamTrackTypes::Kind_Audio: { - mMediaBase->onTrackChanged(IMediaStreamTrackForRTPSenderChannelAudioPtr(MediaStreamTrack::convert(track))); break; } case IMediaStreamTrackTypes::Kind_Video: { - mMediaBase->onTrackChanged(IMediaStreamTrackForRTPSenderChannelVideoPtr(MediaStreamTrack::convert(track))); break; } } @@ -765,8 +740,6 @@ namespace ortc cancel(); } } - - mMediaBase->notifyTransportState(state); } //------------------------------------------------------------------------- @@ -817,24 +790,22 @@ namespace ortc } } - ORTC_THROW_INVALID_PARAMETERS_IF(!found) + ZS_ASSERT(found); setupTagging(); } - - mediaBase->notifyUpdate(params); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => (internal) - #pragma mark + // + // RTPSenderChannel => (internal) + // //------------------------------------------------------------------------- - Log::Params RTPSenderChannel::log(const char *message) const + Log::Params RTPSenderChannel::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::RTPSenderChannel"); IHelper::debugAppend(objectEl, "id", mID); @@ -842,13 +813,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPSenderChannel::debug(const char *message) const + Log::Params RTPSenderChannel::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr RTPSenderChannel::toDebug() const + ElementPtr RTPSenderChannel::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -872,19 +843,19 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPSenderChannel::isShuttingDown() const + bool RTPSenderChannel::isShuttingDown() const noexcept { return State_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool RTPSenderChannel::isShutdown() const + bool RTPSenderChannel::isShutdown() const noexcept { return State_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void RTPSenderChannel::step() + void RTPSenderChannel::step() noexcept { ZS_LOG_DEBUG(debug("step")) @@ -908,7 +879,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::cancel() + void RTPSenderChannel::cancel() noexcept { //....................................................................... // try to gracefully shutdown @@ -931,11 +902,11 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::setState(States state) + void RTPSenderChannel::setState(States state) noexcept { if (state == mCurrentState) return; - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) + ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))); mCurrentState = state; @@ -946,7 +917,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::setError(WORD errorCode, const char *inReason) + void RTPSenderChannel::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -965,7 +936,7 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPSenderChannel::setupTagging() + void RTPSenderChannel::setupTagging() noexcept { mMuxHeader.reset(); mRIDHeader.reset(); @@ -1038,12 +1009,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelFactory - #pragma mark + // + // IRTPSenderChannelFactory + // //------------------------------------------------------------------------- - IRTPSenderChannelFactory &IRTPSenderChannelFactory::singleton() + IRTPSenderChannelFactory &IRTPSenderChannelFactory::singleton() noexcept { return RTPSenderChannelFactory::singleton(); } @@ -1053,7 +1024,7 @@ namespace ortc RTPSenderPtr sender, MediaStreamTrackPtr track, const Parameters ¶ms - ) + ) noexcept { if (this) {} return internal::RTPSenderChannel::create(sender, track, params); diff --git a/ortc/cpp/ortc_RTPSenderChannelAudio.cpp b/ortc/cpp/ortc_RTPSenderChannelAudio.cpp deleted file mode 100644 index 99ec2778..00000000 --- a/ortc/cpp/ortc_RTPSenderChannelAudio.cpp +++ /dev/null @@ -1,939 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include - -#include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpsender) } - -namespace ortc -{ - ZS_DECLARE_USING_PTR(zsLib, ISettings); - - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); - - namespace internal - { - ZS_DECLARE_CLASS_PTR(RTPSenderChannelAudioSettingsDefaults); - - ZS_DECLARE_TYPEDEF_PTR(IStatsReportForInternal, UseStatsReport); - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark - - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudioSettingsDefaults - #pragma mark - - class RTPSenderChannelAudioSettingsDefaults : public ISettingsApplyDefaultsDelegate - { - public: - //----------------------------------------------------------------------- - ~RTPSenderChannelAudioSettingsDefaults() - { - ISettings::removeDefaults(*this); - } - - //----------------------------------------------------------------------- - static RTPSenderChannelAudioSettingsDefaultsPtr singleton() - { - static SingletonLazySharedPtr singleton(create()); - return singleton.singleton(); - } - - //----------------------------------------------------------------------- - static RTPSenderChannelAudioSettingsDefaultsPtr create() - { - auto pThis(make_shared()); - ISettings::installDefaults(pThis); - return pThis; - } - - //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override - { - } - - }; - - //------------------------------------------------------------------------- - void installRTPSenderChannelAudioSettingsDefaults() - { - RTPSenderChannelAudioSettingsDefaults::singleton(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr IRTPSenderChannelAudioForRTPSenderChannel::create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - return internal::IRTPSenderChannelAudioFactory::singleton().create(senderChannel, track, params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio::ToneInfo - #pragma mark - - //------------------------------------------------------------------------- - ElementPtr RTPSenderChannelAudio::ToneInfo::toDebug() const - { - ElementPtr resultEl = Element::create("ortc::RTPSenderChannelAudio::ToneInfo"); - - IHelper::debugAppend(resultEl, "tones", mTones); - IHelper::debugAppend(resultEl, "duration", mDuration); - IHelper::debugAppend(resultEl, "inter tone gap", mInterToneGap); - - return resultEl; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio - #pragma mark - - //------------------------------------------------------------------------- - const char *RTPSenderChannelAudio::toString(States state) - { - switch (state) { - case State_Pending: return "pending"; - case State_Ready: return "ready"; - case State_ShuttingDown: return "shutting down"; - case State_Shutdown: return "shutdown"; - } - return "UNDEFINED"; - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudio::RTPSenderChannelAudio( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr senderChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ) : - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()), - mSenderChannel(senderChannel), - mTrack(track), - mParameters(make_shared(params)) - { - ZS_LOG_DETAIL(debug("created")) - - ORTC_THROW_INVALID_PARAMETERS_IF(!senderChannel) - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::init() - { - TransportPtr transport = Transport::create(mThisWeak.lock()); - - PromiseWithRTPMediaEngineChannelResourcePtr setupChannelPromise = UseMediaEngine::setupChannel( - mThisWeak.lock(), - transport, - MediaStreamTrack::convert(mTrack), - mParameters, - mThisWeak.lock() - ); - { - AutoRecursiveLock lock(*this); - mChannelResourceLifetimeHolderPromise = setupChannelPromise; - mTransport = transport; - } - setupChannelPromise->thenWeak(mThisWeak.lock()); - - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudio::~RTPSenderChannelAudio() - { - if (isNoop()) return; - - ZS_LOG_DETAIL(log("destroyed")) - mThisWeak.reset(); - - cancel(); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForRTPSenderChannelFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForRTPSenderChannelPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForMediaStreamTrackFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForMediaStreamTrackPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr RTPSenderChannelAudio::convert(ForRTPMediaEnginePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelAudio, object); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onTrackChanged(UseBaseMediaStreamTrackPtr track) - { - AutoRecursiveLock lock(*this); - mTrack = MediaStreamTrack::convert(track); // NOTE: track might be NULL -#define TODO_HANDLE_CHANGE_IN_TRACK 1 -#define TODO_HANDLE_CHANGE_IN_TRACK 2 - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::notifyTransportState(ISecureTransportTypes::States state) - { - IRTPSenderChannelAudioAsyncDelegateProxy::create(mThisWeak.lock())->onSecureTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::notifyUpdate(ParametersPtr params) - { - IRTPSenderChannelAudioAsyncDelegateProxy::create(mThisWeak.lock())->onUpdate(params); - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::handlePacket(RTCPPacketPtr packet) - { - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) return false; - return channelResource->handlePacket(*packet); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) - { - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) { - promise->reject(); - return; - } - return channelResource->requestStats(promise, stats); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - - if ((!channelResource) || - (mPendingTones.size() > 0)) { - auto info = make_shared(); - info->mTones = String(tones); - info->mDuration = duration; - info->mInterToneGap = interToneGap; - mPendingTones.push_back(info); - return; - } - } - - channelResource->insertDTMF(tones, duration, interToneGap); - } - - //------------------------------------------------------------------------- - String RTPSenderChannelAudio::toneBuffer() const - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - - if (mPendingTones.size() > 0) { - auto info = mPendingTones.front(); - return info->mTones; - } - } - - if (!channelResource) return String(); - - return channelResource->toneBuffer(); - } - - //------------------------------------------------------------------------- - Milliseconds RTPSenderChannelAudio::duration() const - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - if (mPendingTones.size() > 0) { - auto info = mPendingTones.front(); - return info->mDuration; - } - } - - if (!channelResource) return Milliseconds(); - - return channelResource->duration(); - } - - //------------------------------------------------------------------------- - Milliseconds RTPSenderChannelAudio::interToneGap() const - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - if (mPendingTones.size() > 0) { - auto info = mPendingTones.front(); - return info->mInterToneGap; - } - } - - if (!channelResource) return Milliseconds(); - - return channelResource->interToneGap(); - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr RTPSenderChannelAudio::create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - RTPSenderChannelAudioPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), senderChannel, track, params)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - int32_t RTPSenderChannelAudio::sendAudioSamples( - const void* audioSamples, - const size_t numberOfSamples, - const uint8_t numberOfChannels - ) - { -#define TODO_IMPLEMENT_THIS 1 -#define TODO_IMPLEMENT_THIS 2 - return 0; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelAudioForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IWakeDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onWake() - { - ZS_LOG_DEBUG(log("wake")); - - ToneInfoList pending; - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - step(); - - if ((mChannelResource) && - (mPendingTones.size() > 0)) { - pending = mPendingTones; - mPendingTones.clear(); - - auto tempLockoutTones = make_shared(); - tempLockoutTones->mTones = ORTC_SENDER_CHANNEL_PENDING_TONE_LOCK_OUT_MAGIC_STRING; - - mPendingTones.push_back(tempLockoutTones); - - channelResource = mChannelResource; - } - } - - if (pending.size() > 0) - { - while (pending.size() > 0) - { - ToneInfoPtr tone = pending.front(); - pending.pop_front(); - - if (0 == tone->mTones.compare(ORTC_SENDER_CHANNEL_PENDING_TONE_LOCK_OUT_MAGIC_STRING)) continue; - - channelResource->insertDTMF(tone->mTones, tone->mDuration, tone->mInterToneGap); - } - - { - AutoRecursiveLock lock(*this); - - if (mPendingTones.size() > 1) { - // NOTE: a pending tone was inserted while the current tone was - // being played out thus attempt to deliver pending tones again - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - return; - } - - // NOTE: the only possible tone in the tone buffer is the lock out - /// tone thus clear out the pending tone - mPendingTones.clear(); - } - } - } - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IWakeDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onDTMFSenderToneChanged( - IDTMFSenderPtr sender, - String tone - ) - { - auto senderChannel = mSenderChannel.lock(); - - if (!senderChannel) { - ZS_LOG_WARNING(Debug, log("cannot foreward tone event (sender channel is gone)")); - return; - } - - senderChannel->notifyDTMFSenderToneChanged(tone); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => ITimerDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onTimer(ITimerPtr timer) - { - ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) - - AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IPromiseSettledDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onPromiseSettled(PromisePtr promise) - { - ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID())) - - AutoRecursiveLock lock(*this); - step(); - - if (ZS_DYNAMIC_PTR_CAST(PromiseWithRTPMediaEngineChannelResource, promise)) { - } - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelAudioAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onSecureTransportState(ISecureTransport::States state) - { - ZS_LOG_TRACE(log("notified secure transport state") + ZS_PARAM("state", ISecureTransport::toString(state))) - - AutoRecursiveLock lock(*this); - - mTransportState = state; - - if (mChannelResource) - mChannelResource->notifyTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::onUpdate(ParametersPtr params) - { - ZS_LOG_TRACE(log("on update") + params->toDebug()) - - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - mParameters = make_shared(*params); - channelResource = mChannelResource; - } - - if (channelResource) - channelResource->notifyUpdate(params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => friend Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) - { - auto channel = mSenderChannel.lock(); - if (!channel) return false; - return channel->sendPacket(RTPPacket::create(packet, length)); - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::SendRtcp(const uint8_t* packet, size_t length) - { - auto channel = mSenderChannel.lock(); - if (!channel) return false; - return channel->sendPacket(RTCPPacket::create(packet, length)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio::Transport - #pragma mark - - //------------------------------------------------------------------------- - RTPSenderChannelAudio::Transport::Transport( - const make_private &, - RTPSenderChannelAudioPtr outer - ) : - mOuter(outer) - { - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudio::Transport::~Transport() - { - mThisWeak.reset(); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::Transport::init() - { - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudio::TransportPtr RTPSenderChannelAudio::Transport::create(RTPSenderChannelAudioPtr outer) - { - TransportPtr pThis(make_shared(make_private{}, outer)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio::Transport => webrtc::Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::Transport::SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) - { - auto outer = mOuter.lock(); - if (!outer) return false; - return outer->SendRtp(packet, length, options); - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::Transport::SendRtcp(const uint8_t* packet, size_t length) - { - auto outer = mOuter.lock(); - if (!outer) return false; - return outer->SendRtcp(packet, length); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => (internal) - #pragma mark - - //------------------------------------------------------------------------- - Log::Params RTPSenderChannelAudio::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPSenderChannelAudio"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - - //------------------------------------------------------------------------- - Log::Params RTPSenderChannelAudio::debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - - //------------------------------------------------------------------------- - ElementPtr RTPSenderChannelAudio::toDebug() const - { - AutoRecursiveLock lock(*this); - - ElementPtr resultEl = Element::create("ortc::RTPSenderChannelAudio"); - - IHelper::debugAppend(resultEl, "id", mID); - - IHelper::debugAppend(resultEl, "graceful shutdown", (bool)mGracefulShutdownReference); - - IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); - - IHelper::debugAppend(resultEl, "error", mLastError); - IHelper::debugAppend(resultEl, "error reason", mLastErrorReason); - - auto senderChannel = mSenderChannel.lock(); - IHelper::debugAppend(resultEl, "sender channel", senderChannel ? senderChannel->getID() : 0); - - return resultEl; - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::isShuttingDown() const - { - return State_ShuttingDown == mCurrentState; - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::isShutdown() const - { - return State_Shutdown == mCurrentState; - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::step() - { - ZS_LOG_DEBUG(debug("step")) - - if ((isShuttingDown()) || - (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) - cancel(); - return; - } - - // ... other steps here ... - if (!stepSetupChannel()) goto not_ready; - // ... other steps here ... - - goto ready; - - not_ready: - { - ZS_LOG_TRACE(debug("not ready")) - return; - } - - ready: - { - ZS_LOG_TRACE(log("ready")) - setState(State_Ready); - } - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelAudio::stepSetupChannel() - { - if (mChannelResource) { - ZS_LOG_TRACE(log("already setup channel resource")) - return true; - } - - if (!mChannelResourceLifetimeHolderPromise->isSettled()) { - ZS_LOG_TRACE(log("waiting for setup channel promise to be set up")) - return false; - } - - if (mChannelResourceLifetimeHolderPromise->isRejected()) { - ZS_LOG_WARNING(Debug, log("media engine rejected channel setup")) - cancel(); - return false; - } - - mChannelResource = ZS_DYNAMIC_PTR_CAST(UseChannelResource, mChannelResourceLifetimeHolderPromise->value()); - - if (!mChannelResource) { - ZS_LOG_WARNING(Detail, log("failed to initialize channel resource")) - cancel(); - return false; - } - - ZS_LOG_DEBUG(log("media channel is setup") + ZS_PARAM("channel", mChannelResource->getID())) - - mChannelResource->notifyTransportState(mTransportState); - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - return true; - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::cancel() - { - //....................................................................... - // try to gracefully shutdown - - if (isShutdown()) return; - - setState(State_ShuttingDown); - - if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); - - if (!mCloseChannelPromise) { - if (mChannelResource) { - mCloseChannelPromise = mChannelResource->shutdown(); - mCloseChannelPromise->thenWeak(mGracefulShutdownReference); - } - } - - if (mGracefulShutdownReference) { - if (mCloseChannelPromise) { - if (!mCloseChannelPromise->isSettled()) { - ZS_LOG_DEBUG(log("waiting for close channel promise")) - return; - } - } - } - - //....................................................................... - // final cleanup - - setState(State_Shutdown); - - mChannelResourceLifetimeHolderPromise.reset(); - - mChannelResource.reset(); - mCloseChannelPromise.reset(); - - // make sure to cleanup any final reference to self - mGracefulShutdownReference.reset(); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::setState(States state) - { - if (state == mCurrentState) return; - - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) - - mCurrentState = state; - -// RTPSenderChannelAudioPtr pThis = mThisWeak.lock(); -// if (pThis) { -// mSubscriptions.delegate()->onRTPSenderChannelAudioStateChanged(pThis, mCurrentState); -// } - } - - //------------------------------------------------------------------------- - void RTPSenderChannelAudio::setError(WORD errorCode, const char *inReason) - { - String reason(inReason); - if (reason.isEmpty()) { - reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); - } - - if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) - return; - } - - mLastError = errorCode; - mLastErrorReason = reason; - - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioFactory - #pragma mark - - //------------------------------------------------------------------------- - IRTPSenderChannelAudioFactory &IRTPSenderChannelAudioFactory::singleton() - { - return RTPSenderChannelAudioFactory::singleton(); - } - - //------------------------------------------------------------------------- - RTPSenderChannelAudioPtr IRTPSenderChannelAudioFactory::create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - if (this) {} - return internal::RTPSenderChannelAudio::create(senderChannel, track, params); - } - - } // internal namespace - -} diff --git a/ortc/cpp/ortc_RTPSenderChannelVideo.cpp b/ortc/cpp/ortc_RTPSenderChannelVideo.cpp deleted file mode 100644 index a74c1ac3..00000000 --- a/ortc/cpp/ortc_RTPSenderChannelVideo.cpp +++ /dev/null @@ -1,763 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include - -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtpsender) } - -namespace ortc -{ - ZS_DECLARE_USING_PTR(zsLib, ISettings); - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); - - namespace internal - { - ZS_DECLARE_CLASS_PTR(RTPSenderChannelVideoSettingsDefaults); - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark - - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideoSettingsDefaults - #pragma mark - - class RTPSenderChannelVideoSettingsDefaults : public ISettingsApplyDefaultsDelegate - { - public: - //----------------------------------------------------------------------- - ~RTPSenderChannelVideoSettingsDefaults() - { - ISettings::removeDefaults(*this); - } - - //----------------------------------------------------------------------- - static RTPSenderChannelVideoSettingsDefaultsPtr singleton() - { - static SingletonLazySharedPtr singleton(create()); - return singleton.singleton(); - } - - //----------------------------------------------------------------------- - static RTPSenderChannelVideoSettingsDefaultsPtr create() - { - auto pThis(make_shared()); - ISettings::installDefaults(pThis); - return pThis; - } - - //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override - { - // ISettings::setUInt(ORTC_SETTING_RTP_SENDER_CHANNEL_VIDEO_, 0); - } - - }; - - //------------------------------------------------------------------------- - void installRTPSenderChannelVideoSettingsDefaults() - { - RTPSenderChannelVideoSettingsDefaults::singleton(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr IRTPSenderChannelVideoForRTPSenderChannel::create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - return internal::IRTPSenderChannelVideoFactory::singleton().create(senderChannel, track, params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo - #pragma mark - - //------------------------------------------------------------------------- - const char *RTPSenderChannelVideo::toString(States state) - { - switch (state) { - case State_Pending: return "pending"; - case State_Ready: return "ready"; - case State_ShuttingDown: return "shutting down"; - case State_Shutdown: return "shutdown"; - } - return "UNDEFINED"; - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideo::RTPSenderChannelVideo( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr senderChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ) : - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()), - mSenderChannel(senderChannel), - mTrack(track), - mParameters(make_shared(params)) - { - ZS_LOG_DETAIL(debug("created")) - - ORTC_THROW_INVALID_PARAMETERS_IF(!senderChannel) - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::init() - { - TransportPtr transport = Transport::create(mThisWeak.lock()); - - PromiseWithRTPMediaEngineChannelResourcePtr setupChannelPromise = UseMediaEngine::setupChannel( - mThisWeak.lock(), - transport, - MediaStreamTrack::convert(mTrack), - mParameters, - IDTMFSenderDelegatePtr() - ); - { - AutoRecursiveLock lock(*this); - mChannelResourceLifetimeHolderPromise = setupChannelPromise; - mTransport = transport; - } - - setupChannelPromise->thenWeak(mThisWeak.lock()); - - IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideo::~RTPSenderChannelVideo() - { - if (isNoop()) return; - - ZS_LOG_DETAIL(log("destroyed")) - mThisWeak.reset(); - - cancel(); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr RTPSenderChannelVideo::convert(ForRTPSenderChannelFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr RTPSenderChannelVideo::convert(ForRTPSenderChannelPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr RTPSenderChannelVideo::convert(ForMediaStreamTrackFromMediaBasePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr RTPSenderChannelVideo::convert(ForMediaStreamTrackPtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelVideo, object); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr RTPSenderChannelVideo::convert(ForRTPMediaEnginePtr object) - { - return ZS_DYNAMIC_PTR_CAST(RTPSenderChannelVideo, object); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::onTrackChanged(UseBaseMediaStreamTrackPtr track) - { - AutoRecursiveLock lock(*this); - mTrack = MediaStreamTrack::convert(track); // NOTE: track might be NULL -#define TODO_HANDLE_CHANGE_IN_TRACK 1 -#define TODO_HANDLE_CHANGE_IN_TRACK 2 - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::notifyTransportState(ISecureTransportTypes::States state) - { - IRTPSenderChannelVideoAsyncDelegateProxy::create(mThisWeak.lock())->onSecureTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::notifyUpdate(ParametersPtr params) - { - IRTPSenderChannelVideoAsyncDelegateProxy::create(mThisWeak.lock())->onUpdate(params); - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::handlePacket(RTCPPacketPtr packet) - { - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) return true; - return channelResource->handlePacket(*packet); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) - { - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) { - promise->reject(); - return; - } - return channelResource->requestStats(promise, stats); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr RTPSenderChannelVideo::create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - RTPSenderChannelVideoPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), senderChannel, track, params)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelVideoForMediaStreamTrack - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::sendVideoFrame(VideoFramePtr videoFrame) - { - UseChannelResourcePtr channelResource; - - { - AutoRecursiveLock lock(*this); - channelResource = mChannelResource; - } - - if (!channelResource) return; - channelResource->sendVideoFrame(videoFrame); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPMediaEngine - #pragma mark - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IWakeDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::onWake() - { - ZS_LOG_DEBUG(log("wake")) - - AutoRecursiveLock lock(*this); - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => ITimerDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::onTimer(ITimerPtr timer) - { - ZS_LOG_DEBUG(log("timer") + ZS_PARAM("timer id", timer->getID())) - - AutoRecursiveLock lock(*this); -#define TODO 1 -#define TODO 2 - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IPromiseSettledDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::onPromiseSettled(PromisePtr promise) - { - ZS_LOG_DEBUG(log("promise settled") + ZS_PARAM("promise", promise->getID())) - - AutoRecursiveLock lock(*this); - step(); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelVideoAsyncDelegate - #pragma mark - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::onSecureTransportState(ISecureTransport::States state) - { - ZS_LOG_TRACE(log("notified secure transport state") + ZS_PARAM("state", ISecureTransport::toString(state))) - - AutoRecursiveLock lock(*this); - - mTransportState = state; - - if (mChannelResource) - mChannelResource->notifyTransportState(state); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::onUpdate(ParametersPtr params) - { - ZS_LOG_TRACE(log("on update") + params->toDebug()) - - UseChannelResourcePtr channelResource; - { - AutoRecursiveLock lock(*this); - mParameters = make_shared(*params); - channelResource = mChannelResource; - } - - if (channelResource) - channelResource->notifyUpdate(params); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => friend Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) - { - auto channel = mSenderChannel.lock(); - if (!channel) return false; - return channel->sendPacket(RTPPacket::create(packet, length)); - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::SendRtcp(const uint8_t* packet, size_t length) - { - auto channel = mSenderChannel.lock(); - if (!channel) return false; - return channel->sendPacket(RTCPPacket::create(packet, length)); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo::Transport - #pragma mark - - //------------------------------------------------------------------------- - RTPSenderChannelVideo::Transport::Transport( - const make_private &, - RTPSenderChannelVideoPtr outer - ) : - mOuter(outer) - { - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideo::Transport::~Transport() - { - mThisWeak.reset(); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::Transport::init() - { - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideo::TransportPtr RTPSenderChannelVideo::Transport::create(RTPSenderChannelVideoPtr outer) - { - TransportPtr pThis(make_shared(make_private{}, outer)); - pThis->mThisWeak = pThis; - pThis->init(); - return pThis; - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo::Transport => webrtc::Transport - #pragma mark - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::Transport::SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) - { - auto outer = mOuter.lock(); - if (!outer) return false; - return outer->SendRtp(packet, length, options); - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::Transport::SendRtcp(const uint8_t* packet, size_t length) - { - auto outer = mOuter.lock(); - if (!outer) return false; - return outer->SendRtcp(packet, length); - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => (internal) - #pragma mark - - //------------------------------------------------------------------------- - Log::Params RTPSenderChannelVideo::log(const char *message) const - { - ElementPtr objectEl = Element::create("ortc::RTPSenderChannelVideo"); - IHelper::debugAppend(objectEl, "id", mID); - return Log::Params(message, objectEl); - } - - //------------------------------------------------------------------------- - Log::Params RTPSenderChannelVideo::debug(const char *message) const - { - return Log::Params(message, toDebug()); - } - - //------------------------------------------------------------------------- - ElementPtr RTPSenderChannelVideo::toDebug() const - { - AutoRecursiveLock lock(*this); - - ElementPtr resultEl = Element::create("ortc::RTPSenderChannelVideo"); - - IHelper::debugAppend(resultEl, "id", mID); - - IHelper::debugAppend(resultEl, "graceful shutdown", (bool)mGracefulShutdownReference); - - IHelper::debugAppend(resultEl, "state", toString(mCurrentState)); - - IHelper::debugAppend(resultEl, "error", mLastError); - IHelper::debugAppend(resultEl, "error reason", mLastErrorReason); - - auto senderChannel = mSenderChannel.lock(); - IHelper::debugAppend(resultEl, "sender channel", senderChannel ? senderChannel->getID() : 0); - - return resultEl; - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::isShuttingDown() const - { - return State_ShuttingDown == mCurrentState; - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::isShutdown() const - { - return State_Shutdown == mCurrentState; - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::step() - { - ZS_LOG_DEBUG(debug("step")) - - if ((isShuttingDown()) || - (isShutdown())) { - ZS_LOG_DEBUG(debug("step forwarding to cancel")) - cancel(); - return; - } - - // ... other steps here ... - if (!stepSetupChannel()) goto not_ready; - // ... other steps here ... - - goto ready; - - not_ready: - { - ZS_LOG_TRACE(debug("not ready")) - return; - } - - ready: - { - ZS_LOG_TRACE(log("ready")) - setState(State_Ready); - } - } - - //------------------------------------------------------------------------- - bool RTPSenderChannelVideo::stepSetupChannel() - { - if (mChannelResource) { - ZS_LOG_TRACE(log("already setup channel resource")) - return true; - } - - if (!mChannelResourceLifetimeHolderPromise->isSettled()) { - ZS_LOG_TRACE(log("waiting for setup channel promise to be set up")) - return false; - } - - if (mChannelResourceLifetimeHolderPromise->isRejected()) { - ZS_LOG_WARNING(Debug, log("media engine rejected channel setup")) - cancel(); - return false; - } - - mChannelResource = ZS_DYNAMIC_PTR_CAST(UseChannelResource, mChannelResourceLifetimeHolderPromise->value()); - - if (!mChannelResource) { - ZS_LOG_WARNING(Detail, log("failed to initialize channel resource")) - cancel(); - return false; - } - - ZS_LOG_DEBUG(log("media channel is setup") + ZS_PARAM("channel", mChannelResource->getID())) - - mChannelResource->notifyTransportState(mTransportState); - - return true; - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::cancel() - { - //....................................................................... - // try to gracefully shutdown - - if (isShutdown()) return; - - setState(State_ShuttingDown); - - if (!mGracefulShutdownReference) mGracefulShutdownReference = mThisWeak.lock(); - - if (!mCloseChannelPromise) { - if (mChannelResource) { - mCloseChannelPromise = mChannelResource->shutdown(); - mCloseChannelPromise->thenWeak(mGracefulShutdownReference); - } - } - - if (mGracefulShutdownReference) { - if (mCloseChannelPromise) { - if (!mCloseChannelPromise->isSettled()) { - ZS_LOG_DEBUG(log("waiting for close channel promise")) - return; - } - } - } - - //....................................................................... - // final cleanup - - setState(State_Shutdown); - - mChannelResourceLifetimeHolderPromise.reset(); - - mChannelResource.reset(); - mCloseChannelPromise.reset(); - - // make sure to cleanup any final reference to self - mGracefulShutdownReference.reset(); - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::setState(States state) - { - if (state == mCurrentState) return; - - ZS_LOG_DETAIL(debug("state changed") + ZS_PARAM("new state", toString(state)) + ZS_PARAM("old state", toString(mCurrentState))) - - mCurrentState = state; - -// RTPSenderChannelVideoPtr pThis = mThisWeak.lock(); -// if (pThis) { -// mSubscriptions.delegate()->onRTPSenderChannelVideoStateChanged(pThis, mCurrentState); -// } - } - - //------------------------------------------------------------------------- - void RTPSenderChannelVideo::setError(WORD errorCode, const char *inReason) - { - String reason(inReason); - if (reason.isEmpty()) { - reason = UseHTTP::toString(UseHTTP::toStatusCode(errorCode)); - } - - if (0 != mLastError) { - ZS_LOG_WARNING(Detail, debug("error already set thus ignoring new error") + ZS_PARAM("new error", errorCode) + ZS_PARAM("new reason", reason)) - return; - } - - mLastError = errorCode; - mLastErrorReason = reason; - - ZS_LOG_WARNING(Detail, debug("error set") + ZS_PARAM("error", mLastError) + ZS_PARAM("reason", mLastErrorReason)) - } - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoFactory - #pragma mark - - //------------------------------------------------------------------------- - IRTPSenderChannelVideoFactory &IRTPSenderChannelVideoFactory::singleton() - { - return RTPSenderChannelVideoFactory::singleton(); - } - - //------------------------------------------------------------------------- - RTPSenderChannelVideoPtr IRTPSenderChannelVideoFactory::create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) - { - if (this) {} - return internal::RTPSenderChannelVideo::create(senderChannel, track, params); - } - - } // internal namespace - -} diff --git a/ortc/cpp/ortc_RTPTypes.cpp b/ortc/cpp/ortc_RTPTypes.cpp index 0768b151..21833db0 100644 --- a/ortc/cpp/ortc_RTPTypes.cpp +++ b/ortc/cpp/ortc_RTPTypes.cpp @@ -33,11 +33,11 @@ #include #include #include -#include #include #include #include +#include #include @@ -50,14 +50,8 @@ #include #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc) } namespace ortc { @@ -72,9 +66,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // const float kExactMatchRankAmount = 1000000.0; @@ -82,12 +76,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPTypesHelper::FindCodecOptions - #pragma mark + // + // RTPTypesHelper::FindCodecOptions + // //------------------------------------------------------------------------- - ElementPtr RTPTypesHelper::FindCodecOptions::toDebug() const + ElementPtr RTPTypesHelper::FindCodecOptions::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPTypesHelper::FindCodecOptions"); @@ -117,12 +111,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPTypesHelper::DecodedCodecInfo - #pragma mark + // + // RTPTypesHelper::DecodedCodecInfo + // //------------------------------------------------------------------------- - ElementPtr RTPTypesHelper::DecodedCodecInfo::toDebug() const + ElementPtr RTPTypesHelper::DecodedCodecInfo::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::RTPTypesHelper::DecodedCodecInfo"); @@ -146,12 +140,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPTypesHelper::DecodedCodecInfo::DepthInfo - #pragma mark + // + // RTPTypesHelper::DecodedCodecInfo::DepthInfo + // //------------------------------------------------------------------------- - ElementPtr RTPTypesHelper::DecodedCodecInfo::DepthInfo::toDebug() const + ElementPtr RTPTypesHelper::DecodedCodecInfo::DepthInfo::toDebug() const noexcept { if (NULL == mCodecParameters) return ElementPtr(); @@ -166,15 +160,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPTypesHelper - #pragma mark + // + // RTPTypesHelper + // //------------------------------------------------------------------------- void RTPTypesHelper::validateCodecParameters( const Parameters ¶ms, Optional &ioKind - ) throw (InvalidParameters) + ) noexcept(false) { for (auto iter = params.mCodecs.begin(); iter != params.mCodecs.end(); ++iter) { @@ -438,7 +432,7 @@ namespace ortc void RTPTypesHelper::splitParamsIntoChannels( const Parameters ¶ms, ParametersPtrList &outParamsGroupedIntoChannels - ) + ) noexcept(false) { typedef IRTPTypes::EncodingID EncodingID; typedef std::map StreamMap; @@ -476,7 +470,7 @@ namespace ortc if (encoding.mDependencyEncodingIDs.size() < 1) continue; // skip all that do not have any dependencies - ORTC_THROW_INVALID_PARAMETERS_IF(encoding.mEncodingID.isEmpty()) // if dependencies exist, this layer must have an encoding id + ORTC_THROW_INVALID_PARAMETERS_IF(encoding.mEncodingID.isEmpty()); // if dependencies exist, this layer must have an encoding id auto foundExisting = streamMap.find(encoding.mEncodingID); if (foundExisting != streamMap.end()) continue; // already processed this entry @@ -521,7 +515,7 @@ namespace ortc ParametersPtrList &outNewChannels, ParametersPtrPairList &outUpdatedChannels, ParametersPtrList &outRemovedChannels - ) + ) noexcept { typedef String Hash; typedef std::pair HashParameterPair; @@ -904,7 +898,7 @@ namespace ortc bool RTPTypesHelper::isGeneralizedSSRCCompatibleChange( const Parameters &oldParams, const Parameters &newParams - ) + ) noexcept { ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) @@ -919,7 +913,7 @@ namespace ortc const CodecParameters &oldCodec, const CodecParameters &newCodec, float &ioRank - ) + ) noexcept { auto supportedCodec = IRTPTypes::toSupportedCodec(oldCodec.mName); @@ -994,7 +988,7 @@ namespace ortc const RTPTypesHelper::CodecParameters *RTPTypesHelper::findCodec( const Parameters ¶ms, const FindCodecOptions &options - ) + ) noexcept { const CodecParameters *foundCodec = NULL; const CodecParameters *preferredCodec = NULL; @@ -1159,7 +1153,7 @@ namespace ortc Optional packetPayloadType, const EncodingParameters *encoding, const EncodingParameters *baseEncoding - ) + ) noexcept { typedef IRTPTypes::CodecKinds CodecKinds; @@ -1214,7 +1208,7 @@ namespace ortc const Parameters &oldParams, const Parameters &newParams, float &outRank - ) + ) noexcept { outRank = 0; @@ -1275,7 +1269,7 @@ namespace ortc check_other_properties: { if (oldParams.mEncodings.size() > 0) { - ASSERT(newParams.mEncodings.size() > 0) + ZS_ASSERT(newParams.mEncodings.size() > 0); auto &oldEncoding = oldParams.mEncodings.front(); auto &newEncoding = newParams.mEncodings.front(); @@ -1334,7 +1328,7 @@ namespace ortc RTPTypesHelper::EncodingParameters *RTPTypesHelper::findEncodingBase( Parameters &inParams, EncodingParameters *inEncoding - ) + ) noexcept { typedef std::map DependencyMap; @@ -1366,11 +1360,11 @@ namespace ortc auto check = pending.begin(); String encodingID = check->first; EncodingParameters *encoding = check->second; - pending.erase(check); if (encoding->mDependencyEncodingIDs.size() < 1) return encoding; previouslyChecked[check->first] = check->second; + pending.erase(check); for (auto iter = encoding->mDependencyEncodingIDs.begin(); iter != encoding->mDependencyEncodingIDs.end(); ++iter) { auto &dependencyID = (*iter); @@ -1391,7 +1385,7 @@ namespace ortc static bool verifyFECKnownMechanism( const IRTPTypes::EncodingParameters &encoding, IRTPTypes::SupportedCodecs supportedCodec - ) + ) noexcept { if (!encoding.mFEC.hasValue()) return false; @@ -1430,7 +1424,7 @@ namespace ortc Parameters &filledParams, const DecodedCodecInfo &decodedCodec, EncodingParameters * &outBaseEncoding - ) + ) noexcept { outBaseEncoding = NULL; @@ -1439,8 +1433,6 @@ namespace ortc return NULL; } - (*(filledParams.mEncodings.begin())); - for (auto encodingIter = filledParams.mEncodings.begin(); encodingIter != filledParams.mEncodings.end(); ++encodingIter) { auto &encoding = (*encodingIter); @@ -1459,7 +1451,7 @@ namespace ortc } switch (decodedCodec.mDepth[0].mCodecKind) { - case IRTPTypes::CodecKind_Unknown: ASSERT(false) break; + case IRTPTypes::CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); break; case IRTPTypes::CodecKind_Audio: case IRTPTypes::CodecKind_Video: case IRTPTypes::CodecKind_AV: @@ -1621,7 +1613,7 @@ namespace ortc } //------------------------------------------------------------------------- - Optional RTPTypesHelper::getCodecsKind(const Parameters ¶ms) + Optional RTPTypesHelper::getCodecsKind(const Parameters ¶ms) noexcept { Optional foundKind; @@ -1669,7 +1661,7 @@ namespace ortc static bool checkDecodedKind( Optional &ioKind, IMediaStreamTrackTypes::Kinds foundKind - ) + ) noexcept { if (ioKind.hasValue()) { if (ioKind.value() != foundKind) { @@ -1688,7 +1680,7 @@ namespace ortc const RTPPacket &packet, const Parameters ¶ms, DecodedCodecInfo &decodedCodecInfo - ) + ) noexcept { decodedCodecInfo.mFilledDepth = 0; @@ -1706,7 +1698,7 @@ namespace ortc switch (decodedCodecInfo.mDepth[nextDepth].mCodecKind) { case IRTPTypes::CodecKind_Unknown: { - ASSERT(false); + ZS_ASSERT_FAIL("unknown codec"); return false; } case IRTPTypes::CodecKind_Audio: return checkDecodedKind(ioKind, IMediaStreamTrackTypes::Kind_Audio); @@ -1745,13 +1737,13 @@ namespace ortc getRTXCodecPayload(packet.payload(), packet.payloadSize(), innerPayload, innerPayloadSize); switch (decodedCodecInfo.mDepth[nextDepth].mCodecKind) { - case IRTPTypes::CodecKind_Unknown: ASSERT(false); return false; + case IRTPTypes::CodecKind_Unknown: ZS_ASSERT_FAIL("unknown codec"); return false; case IRTPTypes::CodecKind_Audio: return checkDecodedKind(ioKind, IMediaStreamTrackTypes::Kind_Audio); case IRTPTypes::CodecKind_AudioSupplemental: return checkDecodedKind(ioKind, IMediaStreamTrackTypes::Kind_Audio); case IRTPTypes::CodecKind_Video: return checkDecodedKind(ioKind, IMediaStreamTrackTypes::Kind_Video); case IRTPTypes::CodecKind_AV: return true; case IRTPTypes::CodecKind_Data: return true; - case IRTPTypes::CodecKind_RTX: ASSERT(false); return false; + case IRTPTypes::CodecKind_RTX: ZS_ASSERT_FAIL("rtx not possible"); return false; case IRTPTypes::CodecKind_FEC: break; } } else { @@ -1819,7 +1811,7 @@ namespace ortc } default: { - ASSERT(false); + ZS_ASSERT(false); return false; } } @@ -1828,7 +1820,7 @@ namespace ortc { auto fecRecoveryPayloadType = getFecRecoveryPayloadType(innerPayload, innerPayloadSize); if (!fecRecoveryPayloadType.hasValue()) { - ZS_LOG_WARNING(Trace, slog("FEC recovery codec type was not understood") + decodedCodecInfo.toDebug()) + ZS_LOG_WARNING(Trace, slog("FEC recovery codec type was not understood") + decodedCodecInfo.toDebug()); return false; } @@ -1838,7 +1830,7 @@ namespace ortc decodedCodecInfo.mDepth[nextDepth].mCodecParameters = findCodec(params, options); if (NULL == decodedCodecInfo.mDepth[nextDepth].mCodecParameters) { - ZS_LOG_WARNING(Trace, slog("Recovery codec type was not understood") + decodedCodecInfo.toDebug()) + ZS_LOG_WARNING(Trace, slog("Recovery codec type was not understood") + decodedCodecInfo.toDebug()); return false; } @@ -1847,7 +1839,7 @@ namespace ortc switch (decodedCodecInfo.mDepth[nextDepth].mCodecKind) { case IRTPTypes::CodecKind_Unknown: { - ZS_LOG_WARNING(Trace, slog("Recovery codec type was not understood") + decodedCodecInfo.toDebug()) + ZS_LOG_WARNING(Trace, slog("Recovery codec type was not understood") + decodedCodecInfo.toDebug()); return false; } case IRTPTypes::CodecKind_Audio: return checkDecodedKind(ioKind, IMediaStreamTrackTypes::Kind_Audio); @@ -1856,11 +1848,11 @@ namespace ortc case IRTPTypes::CodecKind_AV: return true; case IRTPTypes::CodecKind_Data: return true; case IRTPTypes::CodecKind_RTX: { - ZS_LOG_WARNING(Trace, slog("Recovery codec type containing RTX codec is not supported") + decodedCodecInfo.toDebug()) + ZS_LOG_WARNING(Trace, slog("Recovery codec type containing RTX codec is not supported") + decodedCodecInfo.toDebug()); return false; } case IRTPTypes::CodecKind_FEC: { - ZS_LOG_WARNING(Trace, slog("Recovery codec type containing another recovery codec is not supported") + decodedCodecInfo.toDebug()) + ZS_LOG_WARNING(Trace, slog("Recovery codec type containing another recovery codec is not supported") + decodedCodecInfo.toDebug()); return false; } } @@ -1875,7 +1867,7 @@ namespace ortc size_t packetPayloadSizeInBytes, const BYTE * &outInnterPayload, size_t &outInnerPayloadSizeBytes - ) + ) noexcept { if (packetPayloadSizeInBytes < sizeof(WORD)) { outInnterPayload = packetPayload + packetPayloadSizeInBytes; @@ -1893,7 +1885,7 @@ namespace ortc size_t packetPayloadSizeInBytes, const BYTE * &outInnterPayload, size_t &outInnerPayloadSizeBytes - ) + ) noexcept { Optional result; if (NULL == packetPayload) return result; @@ -1915,7 +1907,7 @@ namespace ortc Optional RTPTypesHelper::getFecRecoveryPayloadType( const BYTE *packetPayload, size_t packetPayloadSizeInBytes - ) + ) noexcept { Optional result; if (NULL == packetPayload) return result; @@ -1926,7 +1918,7 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPTypesHelper::slog(const char *message) + Log::Params RTPTypesHelper::slog(const char *message) noexcept { return Log::Params(message, "ortc::RTPTypesHelper"); } @@ -1938,12 +1930,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::IRTPTypes"); } @@ -1952,12 +1944,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::DegradationPreferences - #pragma mark + // + // IRTPTypes::DegradationPreferences + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(DegradationPreferences preference) + const char *IRTPTypes::toString(DegradationPreferences preference) noexcept { switch (preference) { case DegradationPreference_MaintainFramerate: return "maintain-framerate"; @@ -1968,7 +1960,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::DegradationPreferences IRTPTypes::toDegredationPreference(const char *preference) throw (InvalidParameters) + IRTPTypes::DegradationPreferences IRTPTypes::toDegredationPreference(const char *preference) noexcept(false) { String str(preference); for (IRTPTypes::DegradationPreferences index = IRTPTypes::DegradationPreference_First; index <= IRTPTypes::DegradationPreference_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -1984,13 +1976,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::Capabilities - #pragma mark + // + // IRTPTypes::Capabilities + // //--------------------------------------------------------------------------- - IRTPTypes::Capabilities::Capabilities(ElementPtr elem) + IRTPTypes::Capabilities::Capabilities(ElementPtr elem) noexcept { if (!elem) return; @@ -2030,7 +2022,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::Capabilities::createElement(const char *objectName) const + ElementPtr IRTPTypes::Capabilities::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2070,13 +2062,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::Capabilities::toDebug() const + ElementPtr IRTPTypes::Capabilities::toDebug() const noexcept { return createElement("ortc::IRTPTypes::Capabilities"); } //--------------------------------------------------------------------------- - String IRTPTypes::Capabilities::hash() const + String IRTPTypes::Capabilities::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2116,12 +2108,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::CodecCapability - #pragma mark + // + // IRTPTypes::CodecCapability + // //--------------------------------------------------------------------------- - IRTPTypes::CodecCapability::CodecCapability(ElementPtr elem) + IRTPTypes::CodecCapability::CodecCapability(ElementPtr elem) noexcept { if (!elem) return; @@ -2195,7 +2187,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::CodecCapability::createElement(const char *objectName) const + ElementPtr IRTPTypes::CodecCapability::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2301,7 +2293,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::CodecCapability::CodecCapability(const CodecCapability &source) : + IRTPTypes::CodecCapability::CodecCapability(const CodecCapability &source) noexcept : mName(source.mName), mKind(source.mKind), mClockRate(source.mClockRate), @@ -2314,72 +2306,35 @@ namespace ortc mMaxSpatialLayers(source.mMaxSpatialLayers), mSVCMultiStreamSupport(source.mSVCMultiStreamSupport) { - if ((source.mParameters) || - (source.mOptions)) { - SupportedCodecs supported = toSupportedCodec(source.mName); - if (source.mParameters) { - switch (supported) { - case SupportedCodec_Opus: { - auto codec = OpusCodecCapabilityParameters::convert(source.mParameters); - if (codec) { - mParameters = OpusCodecCapabilityParameters::create(*codec); - } - break; - } - case SupportedCodec_VP8: { - auto codec = VP8CodecCapabilityParameters::convert(source.mParameters); - if (codec) { - mParameters = VP8CodecCapabilityParameters::create(*codec); - } - break; - } - case SupportedCodec_H264: { - auto codec = H264CodecCapabilityParameters::convert(source.mParameters); - if (codec) { - mParameters = H264CodecCapabilityParameters::create(*codec); - } - break; - } - case SupportedCodec_RTX: { - auto codec = RTXCodecCapabilityParameters::convert(source.mParameters); - if (codec) { - mParameters = RTXCodecCapabilityParameters::create(*codec); - } - break; - } - case SupportedCodec_FlexFEC: { - auto codec = FlexFECCodecCapabilityParameters::convert(source.mParameters); - if (codec) { - mParameters = FlexFECCodecCapabilityParameters::create(*codec); - } - break; - } - default: break; - } - } - if (source.mOptions) { - switch (supported) { - case SupportedCodec_Opus: { - auto codec = OpusCodecCapabilityOptions::convert(source.mOptions); - if (codec) { - mOptions = OpusCodecCapabilityOptions::create(*codec); - } - break; - } - default: break; - } - } - } + copyAny(source); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::CodecCapability::toDebug() const + IRTPTypes::CodecCapability &IRTPTypes::CodecCapability::operator=(const CodecCapability &op2) noexcept + { + mName = op2.mName; + mKind = op2.mKind; + mClockRate = op2.mClockRate; + mPreferredPayloadType = op2.mPreferredPayloadType; + mPTime = op2.mPTime; + mMaxPTime = op2.mMaxPTime; + mNumChannels = op2.mNumChannels; + mRTCPFeedback = op2.mRTCPFeedback; + mMaxTemporalLayers = op2.mMaxTemporalLayers; + mMaxSpatialLayers = op2.mMaxSpatialLayers; + mSVCMultiStreamSupport = op2.mSVCMultiStreamSupport; + copyAny(op2); + return *this; + } + + //--------------------------------------------------------------------------- + ElementPtr IRTPTypes::CodecCapability::toDebug() const noexcept { return createElement("ortc::IRTPTypes::CodecCapability"); } //--------------------------------------------------------------------------- - String IRTPTypes::CodecCapability::hash() const + String IRTPTypes::CodecCapability::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2477,16 +2432,82 @@ namespace ortc return hasher->finalizeAsString(); } + //--------------------------------------------------------------------------- + void IRTPTypes::CodecCapability::copyAny(const CodecCapability &source) noexcept + { + mParameters.reset(); + mOptions.reset(); + + if ((!source.mParameters) && + (!source.mOptions)) { + return; + } + + SupportedCodecs supported = toSupportedCodec(source.mName); + if (source.mParameters) { + switch (supported) { + case SupportedCodec_Opus: { + auto codec = OpusCodecCapabilityParameters::convert(source.mParameters); + if (codec) { + mParameters = OpusCodecCapabilityParameters::create(*codec); + } + break; + } + case SupportedCodec_VP8: { + auto codec = VP8CodecCapabilityParameters::convert(source.mParameters); + if (codec) { + mParameters = VP8CodecCapabilityParameters::create(*codec); + } + break; + } + case SupportedCodec_H264: { + auto codec = H264CodecCapabilityParameters::convert(source.mParameters); + if (codec) { + mParameters = H264CodecCapabilityParameters::create(*codec); + } + break; + } + case SupportedCodec_RTX: { + auto codec = RTXCodecCapabilityParameters::convert(source.mParameters); + if (codec) { + mParameters = RTXCodecCapabilityParameters::create(*codec); + } + break; + } + case SupportedCodec_FlexFEC: { + auto codec = FlexFECCodecCapabilityParameters::convert(source.mParameters); + if (codec) { + mParameters = FlexFECCodecCapabilityParameters::create(*codec); + } + break; + } + default: break; + } + } + if (source.mOptions) { + switch (supported) { + case SupportedCodec_Opus: { + auto codec = OpusCodecCapabilityOptions::convert(source.mOptions); + if (codec) { + mOptions = OpusCodecCapabilityOptions::create(*codec); + } + break; + } + default: break; + } + } + } + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::OpusCodecCapabilityOptions - #pragma mark + // + // IRTPTypes::OpusCodecCapabilityOptions + // //--------------------------------------------------------------------------- - const char *IRTPTypes::OpusCodecCapabilityOptions::toString(Signals signal) + const char *IRTPTypes::OpusCodecCapabilityOptions::toString(Signals signal) noexcept { switch (signal) { case Signal_Auto: return "auto"; @@ -2498,7 +2519,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecParameters::Signals IRTPTypes::OpusCodecCapabilityOptions::toSignal(const char *signal) + IRTPTypes::OpusCodecParameters::Signals IRTPTypes::OpusCodecCapabilityOptions::toSignal(const char *signal) noexcept(false) { String signalStr(signal); if (signalStr.isEmpty()) return Signal_Auto; @@ -2511,7 +2532,7 @@ namespace ortc } //--------------------------------------------------------------------------- - const char *IRTPTypes::OpusCodecCapabilityOptions::toString(Applications application) + const char *IRTPTypes::OpusCodecCapabilityOptions::toString(Applications application) noexcept { switch (application) { case Application_VoIP: return "voip"; @@ -2523,7 +2544,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecParameters::Applications IRTPTypes::OpusCodecCapabilityOptions::toApplication(const char *application) + IRTPTypes::OpusCodecParameters::Applications IRTPTypes::OpusCodecCapabilityOptions::toApplication(const char *application) noexcept(false) { String applicationStr(application); if (applicationStr.isEmpty()) return Application_VoIP; @@ -2532,11 +2553,11 @@ namespace ortc if (0 == applicationStr.compareNoCase(IRTPTypes::OpusCodecCapabilityOptions::toString(index))) return index; } - ORTC_THROW_INVALID_PARAMETERS((String("unknown application: ") + applicationStr).c_str()) + ORTC_THROW_INVALID_PARAMETERS((String("unknown application: ") + applicationStr).c_str()); } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecCapabilityOptions::OpusCodecCapabilityOptions(ElementPtr elem) + IRTPTypes::OpusCodecCapabilityOptions::OpusCodecCapabilityOptions(ElementPtr elem) noexcept { if (!elem) return; @@ -2568,7 +2589,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::OpusCodecCapabilityOptions::createElement(const char *objectName) const + ElementPtr IRTPTypes::OpusCodecCapabilityOptions::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2590,25 +2611,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecCapabilityOptionsPtr IRTPTypes::OpusCodecCapabilityOptions::create(const OpusCodecCapabilityOptions &capability) + IRTPTypes::OpusCodecCapabilityOptionsPtr IRTPTypes::OpusCodecCapabilityOptions::create(const OpusCodecCapabilityOptions &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecCapabilityOptionsPtr IRTPTypes::OpusCodecCapabilityOptions::convert(AnyPtr any) + IRTPTypes::OpusCodecCapabilityOptionsPtr IRTPTypes::OpusCodecCapabilityOptions::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(OpusCodecCapabilityOptions, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::OpusCodecCapabilityOptions::toDebug() const + ElementPtr IRTPTypes::OpusCodecCapabilityOptions::toDebug() const noexcept { return createElement("ortc::IRTPTypes::OpusCodecCapabilityOptions"); } //--------------------------------------------------------------------------- - String IRTPTypes::OpusCodecCapabilityOptions::hash() const + String IRTPTypes::OpusCodecCapabilityOptions::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2631,12 +2652,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::OpusCodecCapabilityParameters - #pragma mark + // + // IRTPTypes::OpusCodecCapabilityParameters + // //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecCapabilityParameters::OpusCodecCapabilityParameters(ElementPtr elem) + IRTPTypes::OpusCodecCapabilityParameters::OpusCodecCapabilityParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -2651,7 +2672,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::OpusCodecCapabilityParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::OpusCodecCapabilityParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2670,25 +2691,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecCapabilityParametersPtr IRTPTypes::OpusCodecCapabilityParameters::create(const OpusCodecCapabilityParameters &capability) + IRTPTypes::OpusCodecCapabilityParametersPtr IRTPTypes::OpusCodecCapabilityParameters::create(const OpusCodecCapabilityParameters &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecCapabilityParametersPtr IRTPTypes::OpusCodecCapabilityParameters::convert(AnyPtr any) + IRTPTypes::OpusCodecCapabilityParametersPtr IRTPTypes::OpusCodecCapabilityParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(OpusCodecCapabilityParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::OpusCodecCapabilityParameters::toDebug() const + ElementPtr IRTPTypes::OpusCodecCapabilityParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::OpusCodecCapabilityParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::OpusCodecCapabilityParameters::hash() const + String IRTPTypes::OpusCodecCapabilityParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2718,12 +2739,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::VP8CodecCapability - #pragma mark + // + // IRTPTypes::VP8CodecCapability + // //--------------------------------------------------------------------------- - IRTPTypes::VP8CodecCapabilityParameters::VP8CodecCapabilityParameters(ElementPtr elem) + IRTPTypes::VP8CodecCapabilityParameters::VP8CodecCapabilityParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -2732,7 +2753,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::VP8CodecCapabilityParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::VP8CodecCapabilityParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2745,25 +2766,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::VP8CodecCapabilityParametersPtr IRTPTypes::VP8CodecCapabilityParameters::create(const VP8CodecCapabilityParameters &capability) + IRTPTypes::VP8CodecCapabilityParametersPtr IRTPTypes::VP8CodecCapabilityParameters::create(const VP8CodecCapabilityParameters &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::VP8CodecCapabilityParametersPtr IRTPTypes::VP8CodecCapabilityParameters::convert(AnyPtr any) + IRTPTypes::VP8CodecCapabilityParametersPtr IRTPTypes::VP8CodecCapabilityParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(VP8CodecCapabilityParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::VP8CodecCapabilityParameters::toDebug() const + ElementPtr IRTPTypes::VP8CodecCapabilityParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::VP8CodecCapabilityParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::VP8CodecCapabilityParameters::hash() const + String IRTPTypes::VP8CodecCapabilityParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2781,12 +2802,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::H264CodecCapabilityParameters - #pragma mark + // + // IRTPTypes::H264CodecCapabilityParameters + // //--------------------------------------------------------------------------- - IRTPTypes::H264CodecCapabilityParameters::H264CodecCapabilityParameters(ElementPtr elem) + IRTPTypes::H264CodecCapabilityParameters::H264CodecCapabilityParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -2820,7 +2841,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::H264CodecCapabilityParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::H264CodecCapabilityParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2849,25 +2870,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::H264CodecCapabilityParametersPtr IRTPTypes::H264CodecCapabilityParameters::create(const H264CodecCapabilityParameters &capability) + IRTPTypes::H264CodecCapabilityParametersPtr IRTPTypes::H264CodecCapabilityParameters::create(const H264CodecCapabilityParameters &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::H264CodecCapabilityParametersPtr IRTPTypes::H264CodecCapabilityParameters::convert(AnyPtr any) + IRTPTypes::H264CodecCapabilityParametersPtr IRTPTypes::H264CodecCapabilityParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(H264CodecCapabilityParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::H264CodecCapabilityParameters::toDebug() const + ElementPtr IRTPTypes::H264CodecCapabilityParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::H264CodecCapabilityParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::H264CodecCapabilityParameters::hash() const + String IRTPTypes::H264CodecCapabilityParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2903,12 +2924,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTXCodecCapabilityParameters - #pragma mark + // + // IRTPTypes::RTXCodecCapabilityParameters + // //--------------------------------------------------------------------------- - IRTPTypes::RTXCodecCapabilityParameters::RTXCodecCapabilityParameters(ElementPtr elem) + IRTPTypes::RTXCodecCapabilityParameters::RTXCodecCapabilityParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -2917,7 +2938,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTXCodecCapabilityParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::RTXCodecCapabilityParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -2930,25 +2951,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::RTXCodecParametersPtr IRTPTypes::RTXCodecCapabilityParameters::create(const RTXCodecParameters ¶ms) + IRTPTypes::RTXCodecParametersPtr IRTPTypes::RTXCodecCapabilityParameters::create(const RTXCodecParameters ¶ms) noexcept { return make_shared(params); } //--------------------------------------------------------------------------- - IRTPTypes::RTXCodecParametersPtr IRTPTypes::RTXCodecCapabilityParameters::convert(AnyPtr any) + IRTPTypes::RTXCodecParametersPtr IRTPTypes::RTXCodecCapabilityParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(RTXCodecParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTXCodecCapabilityParameters::toDebug() const + ElementPtr IRTPTypes::RTXCodecCapabilityParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::RTXCodecCapabilityParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::RTXCodecCapabilityParameters::hash() const + String IRTPTypes::RTXCodecCapabilityParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2964,12 +2985,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::FlexFECCodecCapabilityParameters - #pragma mark + // + // IRTPTypes::FlexFECCodecCapabilityParameters + // //--------------------------------------------------------------------------- - IRTPTypes::FlexFECCodecCapabilityParameters::FlexFECCodecCapabilityParameters(ElementPtr elem) + IRTPTypes::FlexFECCodecCapabilityParameters::FlexFECCodecCapabilityParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -2991,7 +3012,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::FlexFECCodecCapabilityParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::FlexFECCodecCapabilityParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3006,7 +3027,7 @@ namespace ortc } //--------------------------------------------------------------------------- - const char *IRTPTypes::FlexFECCodecCapabilityParameters::toString(ToPs top) + const char *IRTPTypes::FlexFECCodecCapabilityParameters::toString(ToPs top) noexcept { switch (top) { case ToP_1DInterleavedFEC: return "1d-interleaved-fec"; @@ -3019,7 +3040,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::FlexFECCodecCapabilityParameters::ToPs IRTPTypes::FlexFECCodecCapabilityParameters::toToP(const char *top) + IRTPTypes::FlexFECCodecCapabilityParameters::ToPs IRTPTypes::FlexFECCodecCapabilityParameters::toToP(const char *top) noexcept { String topStr(top); @@ -3031,7 +3052,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::FlexFECCodecCapabilityParameters::ToPs IRTPTypes::FlexFECCodecCapabilityParameters::toToP(ULONG value) + IRTPTypes::FlexFECCodecCapabilityParameters::ToPs IRTPTypes::FlexFECCodecCapabilityParameters::toToP(ULONG value) noexcept(false) { ToPs result = static_cast((std::underlying_type::type)(SafeInt::type>(value))); @@ -3047,25 +3068,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::FlexFECCodecCapabilityParametersPtr IRTPTypes::FlexFECCodecCapabilityParameters::create(const FlexFECCodecParameters &capability) + IRTPTypes::FlexFECCodecCapabilityParametersPtr IRTPTypes::FlexFECCodecCapabilityParameters::create(const FlexFECCodecParameters &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::FlexFECCodecCapabilityParametersPtr IRTPTypes::FlexFECCodecCapabilityParameters::convert(AnyPtr any) + IRTPTypes::FlexFECCodecCapabilityParametersPtr IRTPTypes::FlexFECCodecCapabilityParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(FlexFECCodecCapabilityParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::FlexFECCodecCapabilityParameters::toDebug() const + ElementPtr IRTPTypes::FlexFECCodecCapabilityParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::FlexFECCodecCapabilityParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::FlexFECCodecCapabilityParameters::hash() const + String IRTPTypes::FlexFECCodecCapabilityParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3087,12 +3108,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::HeaderExtensions - #pragma mark + // + // IRTPTypes::HeaderExtensions + // //--------------------------------------------------------------------------- - IRTPTypes::HeaderExtension::HeaderExtension(ElementPtr elem) + IRTPTypes::HeaderExtension::HeaderExtension(ElementPtr elem) noexcept { if (!elem) return; @@ -3103,7 +3124,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::HeaderExtension::createElement(const char *objectName) const + ElementPtr IRTPTypes::HeaderExtension::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3118,13 +3139,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::HeaderExtension::toDebug() const + ElementPtr IRTPTypes::HeaderExtension::toDebug() const noexcept { return createElement("ortc::IRTPTypes::HeaderExtensions"); } //--------------------------------------------------------------------------- - String IRTPTypes::HeaderExtension::hash() const + String IRTPTypes::HeaderExtension::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3146,12 +3167,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTCPFeedback - #pragma mark + // + // IRTPTypes::RTCPFeedback + // //--------------------------------------------------------------------------- - IRTPTypes::RTCPFeedback::RTCPFeedback(ElementPtr elem) + IRTPTypes::RTCPFeedback::RTCPFeedback(ElementPtr elem) noexcept { if (!elem) return; @@ -3160,7 +3181,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTCPFeedback::createElement(const char *objectName) const + ElementPtr IRTPTypes::RTCPFeedback::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3173,13 +3194,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTCPFeedback::toDebug() const + ElementPtr IRTPTypes::RTCPFeedback::toDebug() const noexcept { return createElement("ortc::IRTPTypes::RTCPFeedback"); } //--------------------------------------------------------------------------- - String IRTPTypes::RTCPFeedback::hash() const + String IRTPTypes::RTCPFeedback::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3197,12 +3218,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTCPParameters - #pragma mark + // + // IRTPTypes::RTCPParameters + // //--------------------------------------------------------------------------- - IRTPTypes::RTCPParameters::RTCPParameters(ElementPtr elem) + IRTPTypes::RTCPParameters::RTCPParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3213,7 +3234,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTCPParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::RTCPParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3228,13 +3249,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTCPParameters::toDebug() const + ElementPtr IRTPTypes::RTCPParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::RTCPParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::RTCPParameters::hash() const + String IRTPTypes::RTCPParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3256,12 +3277,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::Parameters - #pragma mark + // + // IRTPTypes::Parameters + // //--------------------------------------------------------------------------- - IRTPTypes::Parameters::Parameters(const Parameters &op2) : + IRTPTypes::Parameters::Parameters(const Parameters &op2) noexcept : mMuxID(op2.mMuxID), mCodecs(op2.mCodecs), mHeaderExtensions(op2.mHeaderExtensions), @@ -3272,7 +3293,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::Parameters &IRTPTypes::Parameters::operator=(const Parameters &op2) + IRTPTypes::Parameters &IRTPTypes::Parameters::operator=(const Parameters &op2) noexcept { if (this == (&op2)) return *this; @@ -3287,7 +3308,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::Parameters::Parameters(ElementPtr elem) + IRTPTypes::Parameters::Parameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3350,7 +3371,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::Parameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::Parameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3391,13 +3412,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::Parameters::toDebug() const + ElementPtr IRTPTypes::Parameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::Parameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::Parameters::hash(const HashOptions &options) const + String IRTPTypes::Parameters::hash(const HashOptions &options) const noexcept { auto hasher = IHasher::sha1(); @@ -3455,12 +3476,26 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::CodecParameters - #pragma mark + // + // IRTPTypes::CodecParameters + // + + + //--------------------------------------------------------------------------- + IRTPTypes::CodecParameters::CodecParameters(const CodecParameters &source) noexcept : + mName(source.mName), + mPayloadType(source.mPayloadType), + mClockRate(source.mClockRate), + mPTime(source.mPTime), + mMaxPTime(source.mMaxPTime), + mNumChannels(source.mNumChannels), + mRTCPFeedback(source.mRTCPFeedback) + { + copyAny(source); + } //--------------------------------------------------------------------------- - IRTPTypes::CodecParameters::CodecParameters(ElementPtr elem) + IRTPTypes::CodecParameters::CodecParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3519,7 +3554,21 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::CodecParameters::createElement(const char *objectName) const + IRTPTypes::CodecParameters &IRTPTypes::CodecParameters::operator=(const CodecParameters &source) noexcept + { + mName = source.mName; + mPayloadType = source.mPayloadType; + mClockRate = source.mClockRate; + mPTime = source.mPTime; + mMaxPTime = source.mMaxPTime; + mNumChannels = source.mNumChannels; + mRTCPFeedback = source.mRTCPFeedback; + copyAny(source); + return *this; + } + + //--------------------------------------------------------------------------- + ElementPtr IRTPTypes::CodecParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3597,74 +3646,15 @@ namespace ortc return elem; } - //--------------------------------------------------------------------------- - IRTPTypes::CodecParameters::CodecParameters(const CodecParameters &source) : - mName(source.mName), - mPayloadType(source.mPayloadType), - mClockRate(source.mClockRate), - mPTime(source.mPTime), - mMaxPTime(source.mMaxPTime), - mNumChannels(source.mNumChannels), - mRTCPFeedback(source.mRTCPFeedback) - { - if (source.mParameters) { - SupportedCodecs supported = toSupportedCodec(source.mName); - switch (supported) { - case SupportedCodec_Opus: { - auto codec = OpusCodecParameters::convert(source.mParameters); - if (codec) { - mParameters = OpusCodecParameters::create(*codec); - } - break; - } - case SupportedCodec_VP8: { - auto codec = VP8CodecParameters::convert(source.mParameters); - if (codec) { - mParameters = VP8CodecParameters::create(*codec); - } - break; - } - case SupportedCodec_H264: { - auto codec = H264CodecParameters::convert(source.mParameters); - if (codec) { - mParameters = H264CodecParameters::create(*codec); - } - break; - } - case SupportedCodec_RTX: { - auto codec = RTXCodecParameters::convert(source.mParameters); - if (codec) { - mParameters = RTXCodecParameters::create(*codec); - } - break; - } - case SupportedCodec_RED: { - auto codec = REDCodecParameters::convert(source.mParameters); - if (codec) { - mParameters = REDCodecParameters::create(*codec); - } - break; - } - case SupportedCodec_FlexFEC: { - auto codec = FlexFECCodecParameters::convert(source.mParameters); - if (codec) { - mParameters = FlexFECCodecParameters::create(*codec); - } - break; - } - default: break; - } - } - } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::CodecParameters::toDebug() const + ElementPtr IRTPTypes::CodecParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::CodecParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::CodecParameters::hash() const + String IRTPTypes::CodecParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3735,16 +3725,71 @@ namespace ortc return hasher->finalizeAsString(); } + //--------------------------------------------------------------------------- + void IRTPTypes::CodecParameters::copyAny(const CodecParameters &source) noexcept + { + mParameters.reset(); + + if (!source.mParameters) return; + + SupportedCodecs supported = toSupportedCodec(source.mName); + switch (supported) { + case SupportedCodec_Opus: { + auto codec = OpusCodecParameters::convert(source.mParameters); + if (codec) { + mParameters = OpusCodecParameters::create(*codec); + } + break; + } + case SupportedCodec_VP8: { + auto codec = VP8CodecParameters::convert(source.mParameters); + if (codec) { + mParameters = VP8CodecParameters::create(*codec); + } + break; + } + case SupportedCodec_H264: { + auto codec = H264CodecParameters::convert(source.mParameters); + if (codec) { + mParameters = H264CodecParameters::create(*codec); + } + break; + } + case SupportedCodec_RTX: { + auto codec = RTXCodecParameters::convert(source.mParameters); + if (codec) { + mParameters = RTXCodecParameters::create(*codec); + } + break; + } + case SupportedCodec_RED: { + auto codec = REDCodecParameters::convert(source.mParameters); + if (codec) { + mParameters = REDCodecParameters::create(*codec); + } + break; + } + case SupportedCodec_FlexFEC: { + auto codec = FlexFECCodecParameters::convert(source.mParameters); + if (codec) { + mParameters = FlexFECCodecParameters::create(*codec); + } + break; + } + default: break; + } + } + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::OpusCodecParameters - #pragma mark + // + // IRTPTypes::OpusCodecParameters + // //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecParameters::OpusCodecParameters(ElementPtr elem) + IRTPTypes::OpusCodecParameters::OpusCodecParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3787,7 +3832,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::OpusCodecParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::OpusCodecParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3813,25 +3858,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecParametersPtr IRTPTypes::OpusCodecParameters::create(const OpusCodecParameters &capability) + IRTPTypes::OpusCodecParametersPtr IRTPTypes::OpusCodecParameters::create(const OpusCodecParameters &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::OpusCodecParametersPtr IRTPTypes::OpusCodecParameters::convert(AnyPtr any) + IRTPTypes::OpusCodecParametersPtr IRTPTypes::OpusCodecParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(OpusCodecParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::OpusCodecParameters::toDebug() const + ElementPtr IRTPTypes::OpusCodecParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::OpusCodecParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::OpusCodecParameters::hash() const + String IRTPTypes::OpusCodecParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3855,13 +3900,13 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::REDCodecParameters - #pragma mark + // + // IRTPTypes::REDCodecParameters + // //--------------------------------------------------------------------------- - IRTPTypes::REDCodecParameters::REDCodecParameters(ElementPtr elem) + IRTPTypes::REDCodecParameters::REDCodecParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3885,7 +3930,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::REDCodecParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::REDCodecParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3906,25 +3951,25 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::REDCodecParametersPtr IRTPTypes::REDCodecParameters::create(const REDCodecParameters &capability) + IRTPTypes::REDCodecParametersPtr IRTPTypes::REDCodecParameters::create(const REDCodecParameters &capability) noexcept { return make_shared(capability); } //--------------------------------------------------------------------------- - IRTPTypes::REDCodecParametersPtr IRTPTypes::REDCodecParameters::convert(AnyPtr any) + IRTPTypes::REDCodecParametersPtr IRTPTypes::REDCodecParameters::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(REDCodecParameters, any); } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::REDCodecParameters::toDebug() const + ElementPtr IRTPTypes::REDCodecParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::REDCodecParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::REDCodecParameters::hash() const + String IRTPTypes::REDCodecParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3945,12 +3990,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::HeaderExtensionParameters - #pragma mark + // + // IRTPTypes::HeaderExtensionParameters + // //--------------------------------------------------------------------------- - IRTPTypes::HeaderExtensionParameters::HeaderExtensionParameters(ElementPtr elem) + IRTPTypes::HeaderExtensionParameters::HeaderExtensionParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -3960,7 +4005,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::HeaderExtensionParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::HeaderExtensionParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -3974,13 +4019,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::HeaderExtensionParameters::toDebug() const + ElementPtr IRTPTypes::HeaderExtensionParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::HeaderExtensionParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::HeaderExtensionParameters::hash() const + String IRTPTypes::HeaderExtensionParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -4000,12 +4045,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::FECParameters - #pragma mark + // + // IRTPTypes::FECParameters + // //--------------------------------------------------------------------------- - IRTPTypes::FECParameters::FECParameters(ElementPtr elem) + IRTPTypes::FECParameters::FECParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -4014,7 +4059,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::FECParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::FECParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -4027,13 +4072,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::FECParameters::toDebug() const + ElementPtr IRTPTypes::FECParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::FECParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::FECParameters::hash() const + String IRTPTypes::FECParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -4051,12 +4096,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::RTXParameters - #pragma mark + // + // IRTPTypes::RTXParameters + // //--------------------------------------------------------------------------- - IRTPTypes::RTXParameters::RTXParameters(ElementPtr elem) + IRTPTypes::RTXParameters::RTXParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -4064,7 +4109,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTXParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::RTXParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -4076,13 +4121,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::RTXParameters::toDebug() const + ElementPtr IRTPTypes::RTXParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::RTXParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::RTXParameters::hash() const + String IRTPTypes::RTXParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -4098,15 +4143,14 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::PriorityTypes - #pragma mark + // + // IRTPTypes::PriorityTypes + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(PriorityTypes type) + const char *IRTPTypes::toString(PriorityTypes type) noexcept { switch (type) { - case PriorityType_Unknown: return ""; case PriorityType_VeryLow: return "very-low"; case PriorityType_Low: return "low"; case PriorityType_Medium: return "medium"; @@ -4117,7 +4161,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::PriorityTypes IRTPTypes::toPriorityType(const char *type) + IRTPTypes::PriorityTypes IRTPTypes::toPriorityType(const char *type) noexcept(false) { String typeStr(type); @@ -4125,7 +4169,7 @@ namespace ortc if (typeStr == IRTPTypes::toString(index)) return index; } - return PriorityType_Unknown; + ORTC_THROW_INVALID_PARAMETERS("unknown priority type"); } //--------------------------------------------------------------------------- @@ -4133,12 +4177,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::EncodingParameters - #pragma mark + // + // IRTPTypes::EncodingParameters + // //--------------------------------------------------------------------------- - IRTPTypes::EncodingParameters::EncodingParameters(ElementPtr elem) + IRTPTypes::EncodingParameters::EncodingParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -4197,7 +4241,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::EncodingParameters::createElement(const char *objectName) const + ElementPtr IRTPTypes::EncodingParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -4236,13 +4280,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IRTPTypes::EncodingParameters::toDebug() const + ElementPtr IRTPTypes::EncodingParameters::toDebug() const noexcept { return createElement("ortc::IRTPTypes::EncodingParameters"); } //--------------------------------------------------------------------------- - String IRTPTypes::EncodingParameters::hash() const + String IRTPTypes::EncodingParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -4283,12 +4327,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::CodecKinds - #pragma mark + // + // IRTPTypes::CodecKinds + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(CodecKinds kind) + const char *IRTPTypes::toString(CodecKinds kind) noexcept { switch (kind) { case CodecKind_Unknown: return ""; @@ -4305,7 +4349,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::CodecKinds IRTPTypes::toCodecKind(const char *kind) + IRTPTypes::CodecKinds IRTPTypes::toCodecKind(const char *kind) noexcept { String kindStr(kind); @@ -4320,12 +4364,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::SupportedCodecs - #pragma mark + // + // IRTPTypes::SupportedCodecs + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(SupportedCodecs codec) + const char *IRTPTypes::toString(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return ""; @@ -4356,7 +4400,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::SupportedCodecs IRTPTypes::toSupportedCodec(const char *codec) + IRTPTypes::SupportedCodecs IRTPTypes::toSupportedCodec(const char *codec) noexcept { String codecStr(codec); @@ -4368,7 +4412,7 @@ namespace ortc } //--------------------------------------------------------------------------- - bool IRTPTypes::hasCapabilityOptions(SupportedCodecs codec) + bool IRTPTypes::hasCapabilityOptions(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4395,11 +4439,12 @@ namespace ortc case SupportedCodec_TelephoneEvent: return false; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("missing definition for supported codec"); + ZS_ASSERT_FAIL("missing definition for supported codec"); + return false; } //--------------------------------------------------------------------------- - bool IRTPTypes::hasCapabilityParameters(SupportedCodecs codec) + bool IRTPTypes::hasCapabilityParameters(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4426,11 +4471,12 @@ namespace ortc case SupportedCodec_TelephoneEvent: return false; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("missing definition for supported codec"); + ZS_ASSERT_FAIL("missing definition for supported codec"); + return false; } //--------------------------------------------------------------------------- - bool IRTPTypes::hasParameters(SupportedCodecs codec) + bool IRTPTypes::hasParameters(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4457,11 +4503,12 @@ namespace ortc case SupportedCodec_TelephoneEvent: return false; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("missing definition for supported codec"); + ZS_ASSERT_FAIL("missing definition for supported codec"); + return false; } //--------------------------------------------------------------------------- - bool IRTPTypes::requiresCapabilityParameters(SupportedCodecs codec) + bool IRTPTypes::requiresCapabilityParameters(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4488,11 +4535,12 @@ namespace ortc case SupportedCodec_TelephoneEvent: return false; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("missing definition for supported codec"); + ZS_ASSERT_FAIL("missing definition for supported codec"); + return false; } //--------------------------------------------------------------------------- - bool IRTPTypes::requiresParameters(SupportedCodecs codec) + bool IRTPTypes::requiresParameters(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4519,11 +4567,12 @@ namespace ortc case SupportedCodec_TelephoneEvent: return false; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("missing definition for supported codec"); + ZS_ASSERT_FAIL("missing definition for supported codec"); + return false; } //--------------------------------------------------------------------------- - IRTPTypes::CodecKinds IRTPTypes::getCodecKind(SupportedCodecs codec) + IRTPTypes::CodecKinds IRTPTypes::getCodecKind(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return CodecKind_Unknown; @@ -4554,7 +4603,7 @@ namespace ortc } //--------------------------------------------------------------------------- - bool IRTPTypes::isSRSTCodec(SupportedCodecs codec) + bool IRTPTypes::isSRSTCodec(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4586,7 +4635,7 @@ namespace ortc //--------------------------------------------------------------------------- - bool IRTPTypes::isMRSTCodec(SupportedCodecs codec) + bool IRTPTypes::isMRSTCodec(SupportedCodecs codec) noexcept { switch (codec) { case SupportedCodec_Unknown: return false; @@ -4621,12 +4670,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::ReservedCodecPayloadTypes - #pragma mark + // + // IRTPTypes::ReservedCodecPayloadTypes + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(ReservedCodecPayloadTypes reservedCodec) + const char *IRTPTypes::toString(ReservedCodecPayloadTypes reservedCodec) noexcept { switch (reservedCodec) { case ReservedCodecPayloadType_Unknown: return ""; @@ -4664,7 +4713,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::ReservedCodecPayloadTypes IRTPTypes::toReservedCodec(PayloadType pt) + IRTPTypes::ReservedCodecPayloadTypes IRTPTypes::toReservedCodec(PayloadType pt) noexcept { auto result = static_cast(pt); @@ -4705,7 +4754,7 @@ namespace ortc //--------------------------------------------------------------------------- - IRTPTypes::ReservedCodecPayloadTypes IRTPTypes::toReservedCodec(const char *encodingName) + IRTPTypes::ReservedCodecPayloadTypes IRTPTypes::toReservedCodec(const char *encodingName) noexcept { static ReservedCodecPayloadTypes types[] = { ReservedCodecPayloadType_PCMU_8000, @@ -4749,7 +4798,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ULONG IRTPTypes::getDefaultClockRate(ReservedCodecPayloadTypes reservedCodec) + ULONG IRTPTypes::getDefaultClockRate(ReservedCodecPayloadTypes reservedCodec) noexcept { switch (reservedCodec) { case ReservedCodecPayloadType_Unknown: return 0; @@ -4787,7 +4836,7 @@ namespace ortc } //--------------------------------------------------------------------------- - Optional IRTPTypes::getDefaultNumberOfChannels(ReservedCodecPayloadTypes reservedCodec) + Optional IRTPTypes::getDefaultNumberOfChannels(ReservedCodecPayloadTypes reservedCodec) noexcept { Optional result; @@ -4827,7 +4876,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::CodecKinds IRTPTypes::getCodecKind(ReservedCodecPayloadTypes reservedCodec) + IRTPTypes::CodecKinds IRTPTypes::getCodecKind(ReservedCodecPayloadTypes reservedCodec) noexcept { switch (reservedCodec) { case ReservedCodecPayloadType_Unknown: return CodecKind_Unknown; @@ -4865,7 +4914,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::SupportedCodecs IRTPTypes::toSupportedCodec(ReservedCodecPayloadTypes reservedCodec) + IRTPTypes::SupportedCodecs IRTPTypes::toSupportedCodec(ReservedCodecPayloadTypes reservedCodec) noexcept { switch (reservedCodec) { case ReservedCodecPayloadType_Unknown: return SupportedCodec_Unknown; @@ -4906,12 +4955,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::HeaderExtensionURIs - #pragma mark + // + // IRTPTypes::HeaderExtensionURIs + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(HeaderExtensionURIs extension) + const char *IRTPTypes::toString(HeaderExtensionURIs extension) noexcept { switch (extension) { case HeaderExtensionURI_Unknown: return ""; @@ -4927,11 +4976,12 @@ namespace ortc case HeaderExtensionURI_TransportSequenceNumber: return "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("header extension uri is not known"); + ZS_ASSERT_FAIL("header extension uri is not known"); + return false; } //--------------------------------------------------------------------------- - IRTPTypes::HeaderExtensionURIs IRTPTypes::toHeaderExtensionURI(const char *uri) + IRTPTypes::HeaderExtensionURIs IRTPTypes::toHeaderExtensionURI(const char *uri) noexcept { String uriStr(uri); @@ -4943,7 +4993,7 @@ namespace ortc } //--------------------------------------------------------------------------- - String IRTPTypes::toKind(HeaderExtensionURIs extension) + String IRTPTypes::toKind(HeaderExtensionURIs extension) noexcept { switch (extension) { case HeaderExtensionURI_Unknown: return ""; @@ -4959,7 +5009,8 @@ namespace ortc case HeaderExtensionURI_TransportSequenceNumber: return ""; } - ORTC_THROW_NOT_SUPPORTED_ERRROR("header extension uri is not known"); + ZS_ASSERT_FAIL("header extension uri is not known"); + return ""; } @@ -4967,12 +5018,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownFeedbackTypes - #pragma mark + // + // IRTPTypes::KnownFeedbackTypes + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(KnownFECMechanisms mechanism) + const char *IRTPTypes::toString(KnownFECMechanisms mechanism) noexcept { switch (mechanism) { case KnownFECMechanism_Unknown: return ""; @@ -4985,7 +5036,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::KnownFECMechanisms IRTPTypes::toKnownFECMechanism(const char *mechanism) + IRTPTypes::KnownFECMechanisms IRTPTypes::toKnownFECMechanism(const char *mechanism) noexcept { String mechanismStr(mechanism); @@ -5001,12 +5052,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownFeedbackTypes - #pragma mark + // + // IRTPTypes::KnownFeedbackTypes + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(KnownFeedbackTypes type) + const char *IRTPTypes::toString(KnownFeedbackTypes type) noexcept { switch (type) { case KnownFeedbackType_Unknown: return ""; @@ -5026,7 +5077,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::KnownFeedbackTypes IRTPTypes::toKnownFeedbackType(const char *type) + IRTPTypes::KnownFeedbackTypes IRTPTypes::toKnownFeedbackType(const char *type) noexcept { String typeStr(type); @@ -5041,12 +5092,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::KnownFeedbackParameters - #pragma mark + // + // IRTPTypes::KnownFeedbackParameters + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(KnownFeedbackParameters mechanism) + const char *IRTPTypes::toString(KnownFeedbackParameters mechanism) noexcept { switch (mechanism) { case KnownFeedbackParameter_Unknown: return ""; @@ -5069,7 +5120,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::KnownFeedbackParameters IRTPTypes::toKnownFeedbackParameter(const char *mechanism) + IRTPTypes::KnownFeedbackParameters IRTPTypes::toKnownFeedbackParameter(const char *mechanism) noexcept { String mechanismStr(mechanism); @@ -5081,7 +5132,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::KnownFeedbackTypesSet IRTPTypes::getUseableWithFeedbackTypes(KnownFeedbackParameters mechanism) + IRTPTypes::KnownFeedbackTypesSet IRTPTypes::getUseableWithFeedbackTypes(KnownFeedbackParameters mechanism) noexcept { KnownFeedbackTypesSet result; @@ -5118,12 +5169,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPTypes::SupportedRTCPMechanisms - #pragma mark + // + // IRTPTypes::SupportedRTCPMechanisms + // //--------------------------------------------------------------------------- - const char *IRTPTypes::toString(SupportedRTCPMechanisms mechanism) + const char *IRTPTypes::toString(SupportedRTCPMechanisms mechanism) noexcept { switch (mechanism) { case SupportedRTCPMechanism_Unknown: return ""; @@ -5139,7 +5190,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IRTPTypes::SupportedRTCPMechanisms IRTPTypes::toSupportedRTCPMechanism(const char *mechanism) + IRTPTypes::SupportedRTCPMechanisms IRTPTypes::toSupportedRTCPMechanism(const char *mechanism) noexcept { String mechanismStr(mechanism); diff --git a/ortc/cpp/ortc_RTPUtils.cpp b/ortc/cpp/ortc_RTPUtils.cpp index fad19d97..78c723a6 100644 --- a/ortc/cpp/ortc_RTPUtils.cpp +++ b/ortc/cpp/ortc_RTPUtils.cpp @@ -48,7 +48,7 @@ namespace std { } #endif //_WIN32 -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_rtptypes) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_rtp_types) } namespace ortc { @@ -64,13 +64,13 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- static const size_t kMinRtpPacketLen = 12; - static const size_t kMaxRtpPacketLen = 2048; + //static const size_t kMaxRtpPacketLen = 2048; static const size_t kMinRtcpPacketLen = 4; static const uint8_t kRtpVersion = 2; @@ -82,17 +82,17 @@ namespace ortc static const size_t kRtcpPayloadTypeOffset = 1; //------------------------------------------------------------------------- - static void set8(void* memory, size_t offset, BYTE v) { + static void set8(void* memory, size_t offset, BYTE v) noexcept { static_cast(memory)[offset] = v; } //------------------------------------------------------------------------- - static BYTE get8(const void* memory, size_t offset) { + static BYTE get8(const void* memory, size_t offset) noexcept { return static_cast(memory)[offset]; } //------------------------------------------------------------------------- - static bool getUint8(const void* data, size_t offset, int* value) { + static bool getUint8(const void* data, size_t offset, int* value) noexcept { if (!data || !value) { return false; } @@ -101,7 +101,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getUint16(const void* data, size_t offset, int* value) { + static bool getUint16(const void* data, size_t offset, int* value) noexcept { if (!data || !value) { return false; } @@ -110,7 +110,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getUint32(const void* data, size_t offset, DWORD* value) { + static bool getUint32(const void* data, size_t offset, DWORD* value) noexcept { if (!data || !value) { return false; } @@ -119,7 +119,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool setUint8(void* data, size_t offset, uint8_t value) { + static bool setUint8(void* data, size_t offset, uint8_t value) noexcept { if (!data) { return false; } @@ -128,7 +128,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool setUint16(void* data, size_t offset, uint16_t value) { + static bool setUint16(void* data, size_t offset, uint16_t value) noexcept { if (!data) { return false; } @@ -137,7 +137,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool setUint32(void* data, size_t offset, DWORD value) { + static bool setUint32(void* data, size_t offset, DWORD value) noexcept { if (!data) { return false; } @@ -146,7 +146,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getRtpFlags(const void* data, size_t len, int* value) { + static bool getRtpFlags(const void* data, size_t len, int* value) noexcept { if (len < kMinRtpPacketLen) { return false; } @@ -154,7 +154,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getRtpPayloadType(const void* data, size_t len, int* value) { + static bool getRtpPayloadType(const void* data, size_t len, int* value) noexcept { if (len < kMinRtpPacketLen) { return false; } @@ -166,7 +166,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getRtpSeqNum(const void* data, size_t len, int* value) { + static bool getRtpSeqNum(const void* data, size_t len, int* value) noexcept { if (len < kMinRtpPacketLen) { return false; } @@ -174,7 +174,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getRtpTimestamp(const void* data, size_t len, DWORD* value) { + static bool getRtpTimestamp(const void* data, size_t len, DWORD* value) noexcept { if (len < kMinRtpPacketLen) { return false; } @@ -182,7 +182,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getRtpSsrc(const void* data, size_t len, DWORD* value) { + static bool getRtpSsrc(const void* data, size_t len, DWORD* value) noexcept { if (len < kMinRtpPacketLen) { return false; } @@ -190,7 +190,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool getRtpHeaderLen(const void* data, size_t len, size_t* value) { + static bool getRtpHeaderLen(const void* data, size_t len, size_t* value) noexcept { if (!data || len < kMinRtpPacketLen || !value) return false; const BYTE* header = static_cast(data); // Get base header size + length of CSRCs (not counting extension yet). @@ -208,7 +208,7 @@ namespace ortc } //------------------------------------------------------------------------- - //bool getRtpHeader(const void* data, size_t len, RtpHeader* header) { + //bool getRtpHeader(const void* data, size_t len, RtpHeader* header) noexcept { // return (GetRtpPayloadType(data, len, &(header->payload_type)) && // GetRtpSeqNum(data, len, &(header->seq_num)) && // GetRtpTimestamp(data, len, &(header->timestamp)) && @@ -216,7 +216,7 @@ namespace ortc //} //------------------------------------------------------------------------- - static bool getRtcpType(const void* data, size_t len, int* value) { + static bool getRtcpType(const void* data, size_t len, int* value) noexcept { if (len < kMinRtcpPacketLen) { return false; } @@ -227,7 +227,7 @@ namespace ortc // This method returns SSRC first of RTCP packet, except if packet is SDES. // TODO(mallinath) - Fully implement RFC 5506. This standard doesn't restrict // to send non-compound packets only to feedback messages. - static bool getRtcpSsrc(const void* data, size_t len, DWORD* value) { + static bool getRtcpSsrc(const void* data, size_t len, DWORD* value) noexcept { // Packet should be at least of 8 bytes, to get SSRC from a RTCP packet. if (!data || len < kMinRtcpPacketLen + 4 || !value) return false; int pl_type; @@ -239,13 +239,14 @@ namespace ortc } //------------------------------------------------------------------------- - static bool setRtpSsrc(void* data, size_t len, DWORD value) { + static bool setRtpSsrc(void* data, ZS_MAYBE_USED() size_t len, DWORD value) noexcept { + ZS_MAYBE_USED(len); return setUint32(data, kRtpSsrcOffset, value); } //------------------------------------------------------------------------- //// Assumes version 2, no padding, no extensions, no csrcs. - //bool SetRtpHeader(void* data, size_t len, const RtpHeader& header) { + //bool SetRtpHeader(void* data, size_t len, const RtpHeader& header) noexcept { // if (!IsValidRtpPayloadType(header.payload_type) || // header.seq_num < 0 || header.seq_num > UINT16_MAX) { // return false; @@ -259,7 +260,7 @@ namespace ortc //} //------------------------------------------------------------------------- - static bool IsRtpPacket(const void* data, size_t len) { + static bool IsRtpPacket(const void* data, size_t len) noexcept { if (len < kMinRtpPacketLen) return false; @@ -267,7 +268,7 @@ namespace ortc } //------------------------------------------------------------------------- - static bool IsValidRtpPayloadType(int payload_type) { + static bool IsValidRtpPayloadType(int payload_type) noexcept { return payload_type >= 0 && payload_type <= 127; } @@ -275,18 +276,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Helper - #pragma mark + // + // Helper + // //------------------------------------------------------------------------- - WORD RTPUtils::getBE16(const void* memory) { + WORD RTPUtils::getBE16(const void* memory) noexcept { return static_cast((get8(memory, 0) << 8) | (get8(memory, 1) << 0)); } //------------------------------------------------------------------------- - DWORD RTPUtils::getBE32(const void* memory) { + DWORD RTPUtils::getBE32(const void* memory) noexcept { return (static_cast(get8(memory, 0)) << 24) | (static_cast(get8(memory, 1)) << 16) | (static_cast(get8(memory, 2)) << 8) | @@ -294,13 +295,13 @@ namespace ortc } //------------------------------------------------------------------------- - void RTPUtils::setBE16(void* memory, WORD v) { + void RTPUtils::setBE16(void* memory, WORD v) noexcept { set8(memory, 0, static_cast(v >> 8)); set8(memory, 1, static_cast(v >> 0)); } //------------------------------------------------------------------------- - void RTPUtils::setBE32(void* memory, DWORD v) { + void RTPUtils::setBE32(void* memory, DWORD v) noexcept { set8(memory, 0, static_cast(v >> 24)); set8(memory, 1, static_cast(v >> 16)); set8(memory, 2, static_cast(v >> 8)); @@ -308,7 +309,7 @@ namespace ortc } //------------------------------------------------------------------------- - int RTPUtils::getRtpPayloadType(const void* data, size_t len) + int RTPUtils::getRtpPayloadType(const void* data, size_t len) noexcept { int value {}; if (ortc::internal::getRtpPayloadType(data, len, &value)) { @@ -320,7 +321,7 @@ namespace ortc } //------------------------------------------------------------------------- - int RTPUtils::getRtpSeqNum(const void* data, size_t len) + int RTPUtils::getRtpSeqNum(const void* data, size_t len) noexcept { int value{}; if (ortc::internal::getRtpSeqNum(data, len, &value)) { @@ -332,7 +333,7 @@ namespace ortc } //------------------------------------------------------------------------- - DWORD RTPUtils::getRtpTimestamp(const void* data, size_t len) + DWORD RTPUtils::getRtpTimestamp(const void* data, size_t len) noexcept { DWORD value{}; if (ortc::internal::getRtpTimestamp(data, len, &value)) { @@ -344,7 +345,7 @@ namespace ortc } //------------------------------------------------------------------------- - DWORD RTPUtils::getRtpSsrc(const void* data, size_t len) + DWORD RTPUtils::getRtpSsrc(const void* data, size_t len) noexcept { DWORD value{}; if (ortc::internal::getRtpSsrc(data, len, &value)) { @@ -356,7 +357,7 @@ namespace ortc } //------------------------------------------------------------------------- - size_t RTPUtils::getRtpHeaderLen(const void* data, size_t len) + size_t RTPUtils::getRtpHeaderLen(const void* data, size_t len) noexcept { size_t value{}; if (ortc::internal::getRtpHeaderLen(data, len, &value)) { @@ -368,7 +369,7 @@ namespace ortc } //------------------------------------------------------------------------- - int RTPUtils::getRtcpType(const void* data, size_t len) { + int RTPUtils::getRtcpType(const void* data, size_t len) noexcept { int value{}; if (ortc::internal::getRtcpType(data, len, &value)) { return value; @@ -379,7 +380,7 @@ namespace ortc } //------------------------------------------------------------------------- - DWORD RTPUtils::getRtcpSsrc(const void* data, size_t len) + DWORD RTPUtils::getRtcpSsrc(const void* data, size_t len) noexcept { DWORD value{}; if (ortc::internal::getRtcpSsrc(data, len, &value)) { @@ -391,19 +392,19 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPUtils::setRtpSsrc(void* data, size_t len, DWORD value) + bool RTPUtils::setRtpSsrc(void* data, size_t len, DWORD value) noexcept { return ortc::internal::setRtpSsrc(data, len, value); } //------------------------------------------------------------------------- - bool RTPUtils::isRtpPacket(const void* data, size_t len) + bool RTPUtils::isRtpPacket(const void* data, size_t len) noexcept { return ortc::internal::IsRtpPacket(data, len); } //------------------------------------------------------------------------- - bool RTPUtils::isRTCPPacketType(const BYTE *data, size_t len) + bool RTPUtils::isRTCPPacketType(const BYTE *data, size_t len) noexcept { if (len < 2) { return false; @@ -413,7 +414,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool RTPUtils::isValidRtpPayloadType(int payload_type) + bool RTPUtils::isValidRtpPayloadType(int payload_type) noexcept { return ortc::internal::IsValidRtpPayloadType(payload_type); } @@ -422,7 +423,7 @@ namespace ortc Time RTPUtils::ntpToTime( DWORD ntpMS, DWORD ntpLS - ) + ) noexcept { // 0x3B9ACA00ULL = 1,000,000,000 (microsoeconds) // 0xFFFFFFFFULL = 2^32 @@ -460,7 +461,7 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params RTPUtils::slog(const char *message) + Log::Params RTPUtils::slog(const char *message) noexcept { return Log::Params(message, "ortc::RTPUtils"); } diff --git a/ortc/cpp/ortc_SCTPTransport.cpp b/ortc/cpp/ortc_SCTPTransport.cpp index a6ecad50..139fb9fb 100644 --- a/ortc/cpp/ortc_SCTPTransport.cpp +++ b/ortc/cpp/ortc_SCTPTransport.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -70,13 +72,6 @@ enum WindowsErrorCompatibility { # include #endif //_WIN32 -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - - // The expression ARRAY_SIZE(a) is a compile-time constant of type // size_t which represents the number of elements of the given // array. You should only use ARRAY_SIZE on statically allocated @@ -86,7 +81,7 @@ enum WindowsErrorCompatibility { ((sizeof(a) / sizeof(*(a))) / \ static_cast(!(sizeof(a) % sizeof(*(a))))) -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_sctp_datachannel) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_sctp_data_channel) } namespace ortc { @@ -114,9 +109,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // const uint32_t kMaxSctpSid = 1023; static const size_t kSctpMtu = 1200; @@ -127,7 +122,7 @@ namespace ortc }; //------------------------------------------------------------------------- - const char *toString(SCTPPayloadProtocolIdentifier ppid) + const char *toString(SCTPPayloadProtocolIdentifier ppid) noexcept { switch (ppid) { case SCTP_PPID_NONE: return "NONE"; @@ -146,12 +141,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPPacketIncoming - #pragma mark + // + // SCTPPacketIncoming + // //------------------------------------------------------------------------- - ElementPtr SCTPPacketIncoming::toDebug() const + ElementPtr SCTPPacketIncoming::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::SCTPPacketIncoming"); @@ -169,12 +164,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPPacketOutgoing - #pragma mark + // + // SCTPPacketOutgoing + // //------------------------------------------------------------------------- - ElementPtr SCTPPacketOutgoing::toDebug() const + ElementPtr SCTPPacketOutgoing::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::SCTPPacketOutgoing"); @@ -192,9 +187,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPHelper - #pragma mark + // + // SCTPHelper + // struct SCTPHelper { @@ -202,7 +197,7 @@ namespace ortc static sockaddr_conn getAddress( WORD port, SCTPTransportWeakPtr *thisSocket - ) + ) noexcept { sockaddr_conn sconn = {}; sconn.sconn_family = AF_CONN; @@ -216,14 +211,14 @@ namespace ortc } //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::SCTPHelper"); return Log::Params(message, objectEl); } //----------------------------------------------------------------------- - static String listFlags(int flags) + static String listFlags(int flags) noexcept { std::stringstream result; bool first = true; @@ -254,7 +249,7 @@ namespace ortc static String listArray( const WORD *array, size_t numElements - ) + ) noexcept { std::stringstream result; for (size_t i = 0; i < numElements; ++i) { @@ -274,28 +269,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- -#pragma mark -#pragma mark SCTPTransportSettingsDefaults -#pragma mark + // + // SCTPTransportSettingsDefaults + // class SCTPTransportSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~SCTPTransportSettingsDefaults() + ~SCTPTransportSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static SCTPTransportSettingsDefaultsPtr singleton() + static SCTPTransportSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static SCTPTransportSettingsDefaultsPtr create() + static SCTPTransportSettingsDefaultsPtr create()noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -303,7 +298,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { // http://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-05#section-6.2 ISettings::setUInt(ORTC_SETTING_SCTP_TRANSPORT_MAX_SESSIONS_PER_PORT, kMaxSctpSid); @@ -312,7 +307,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installSCTPTransportSettingsDefaults() + void installSCTPTransportSettingsDefaults() noexcept { SCTPTransportSettingsDefaults::singleton(); } @@ -321,21 +316,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- -#pragma mark -#pragma mark SCTPInit -#pragma mark + // + // SCTPInit + // -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- -#pragma mark -#pragma mark SCTPInit -#pragma mark + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // SCTPInit + // -// code borrowed from: -// https://chromium.googlesource.com/external/webrtc/+/master/talk/media/sctp/sctpdataengine.cc -// https://chromium.googlesource.com/external/webrtc/+/master/talk/media/sctp/sctpdataengine.h + // code borrowed from: + // https://chromium.googlesource.com/external/webrtc/+/master/talk/media/sctp/sctpdataengine.cc + // https://chromium.googlesource.com/external/webrtc/+/master/talk/media/sctp/sctpdataengine.h class SCTPInit : public ISingletonManagerDelegate { @@ -346,11 +341,11 @@ namespace ortc struct make_private {}; public: - ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, UseDataChannel) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, UseDataChannel); public: //----------------------------------------------------------------------- - SCTPInit(const make_private &) + SCTPInit(const make_private &) noexcept { ZS_EVENTING_1(x, i, Detail, SctpInitCreate, ol, SctpInit, Start, puid, id, mID); ZS_LOG_BASIC(log("created")) @@ -358,7 +353,7 @@ namespace ortc protected: //----------------------------------------------------------------------- - void init() + void init() noexcept { AutoRecursiveLock lock(mLock); @@ -397,7 +392,7 @@ namespace ortc } //----------------------------------------------------------------------- - static SCTPInitPtr create() + static SCTPInitPtr create() noexcept { SCTPInitPtr pThis(make_shared(make_private{})); pThis->mThisWeak = pThis; @@ -407,7 +402,7 @@ namespace ortc public: //----------------------------------------------------------------------- - ~SCTPInit() + ~SCTPInit() noexcept { mThisWeak.reset(); ZS_LOG_BASIC(log("destroyed")) @@ -416,7 +411,7 @@ namespace ortc } //----------------------------------------------------------------------- - static SCTPInitPtr singleton() + static SCTPInitPtr singleton() noexcept { AutoRecursiveLock lock(*IHelper::getGlobalLock()); static SingletonLazySharedPtr singleton(create()); @@ -433,20 +428,20 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPInit => ISingletonManagerDelegate - #pragma mark + // + // SCTPInit => ISingletonManagerDelegate + // //----------------------------------------------------------------------- - virtual void notifySingletonCleanup() override + virtual void notifySingletonCleanup() noexcept override { cancel(); } //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPInit => usrscpt callbacks - #pragma mark + // + // SCTPInit => usrscpt callbacks + // //----------------------------------------------------------------------- // This is the callback usrsctp uses when there's data to send on the network @@ -457,9 +452,9 @@ namespace ortc size_t length, uint8_t tos, uint8_t set_df - ) + ) noexcept { - ZS_THROW_INVALID_ASSUMPTION_IF(!addr); + ZS_ASSERT(addr); SCTPTransportPtr transport = (*(static_cast(addr))).lock(); @@ -487,7 +482,7 @@ namespace ortc } //----------------------------------------------------------------------- - static void debug_sctp_printf(const char *format, ...) + static void debug_sctp_printf(const char *format, ...) noexcept { char s[1024]{}; @@ -506,21 +501,21 @@ namespace ortc //------------------------------------------------------------------------- static int OnSctpInboundPacket( struct socket* sock, - union sctp_sockstore addr, + ZS_MAYBE_USED() union sctp_sockstore addr, void* data, size_t length, struct sctp_rcvinfo rcv, int flags, void* ulp_info - ) + ) noexcept { - ZS_THROW_INVALID_ASSUMPTION_IF(!ulp_info); + ZS_MAYBE_USED(addr); + ZS_ASSERT(ulp_info); SCTPTransportPtr transport = (*(static_cast(ulp_info))).lock(); const SCTPPayloadProtocolIdentifier ppid = static_cast(ntohl(rcv.rcv_ppid)); - if (0 == (flags & MSG_NOTIFICATION)) { switch (ppid) { case SCTP_PPID_CONTROL: @@ -566,12 +561,12 @@ namespace ortc protected: //----------------------------------------------------------------------- -#pragma mark -#pragma mark SCTPInit => (internal) -#pragma mark + // + // SCTPInit => (internal) + // -//----------------------------------------------------------------------- - Log::Params log(const char *message) const + //----------------------------------------------------------------------- + Log::Params log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::SCTPInit"); IHelper::debugAppend(objectEl, "id", mID); @@ -579,19 +574,19 @@ namespace ortc } //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::SCTPInit"); } //----------------------------------------------------------------------- - Log::Params debug(const char *message) const + Log::Params debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //----------------------------------------------------------------------- - virtual ElementPtr toDebug() const + virtual ElementPtr toDebug() const noexcept { AutoRecursiveLock lock(mLock); ElementPtr resultEl = Element::create("ortc::SCTPInit"); @@ -602,7 +597,7 @@ namespace ortc } //----------------------------------------------------------------------- - void cancel() + void cancel() noexcept { ZS_EVENTING_1(x, i, Detail, SctpInitCancel, ol, SctpInit, Cancel, puid, id, mID); @@ -623,9 +618,9 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPInit => (data) - #pragma mark + // + // SCTPInit => (data) + // AutoPUID mID; mutable RecursiveLock mLock; @@ -638,22 +633,22 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportForDataChannel - #pragma mark + // + // ISCTPTransportForDataChannel + // //------------------------------------------------------------------------- ISCTPTransportForSCTPTransportListener::ForListenerPtr ISCTPTransportForSCTPTransportListener::create( UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort - ) + ) noexcept { return ISCTPTransportFactory::singleton().create(listener, secureTransport, localPort); } //------------------------------------------------------------------------- - ElementPtr ISCTPTransportForDataChannel::toDebug(ForDataChannelPtr transport) + ElementPtr ISCTPTransportForDataChannel::toDebug(ForDataChannelPtr transport) noexcept { if (!transport) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(SCTPTransport, transport)->toDebug(); @@ -663,54 +658,57 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport - #pragma mark + // + // SCTPTransport + // //--------------------------------------------------------------------------- - const char *SCTPTransport::toString(InternalStates state) + const char *SCTPTransport::toString(InternalStates state) noexcept { switch (state) { - case InternalState_New: return "new"; - case InternalState_Connecting: return "connecting"; - case InternalState_ConnectingDisrupted: return "connecting disrupted"; - case InternalState_Ready: return "ready"; - case InternalState_Disconnected: return "disconnected"; - case InternalState_ShuttingDown: return "shutting down"; - case InternalState_Shutdown: return "shutdown"; + case InternalState_New: return "new"; + case InternalState_Connecting: return "connecting"; + case InternalState_ConnectingDisrupted: return "connecting disrupted"; + case InternalState_Ready: return "ready"; + case InternalState_Disconnected: return "disconnected"; + case InternalState_ShuttingDown: return "shutting down"; + case InternalState_Shutdown: return "shutdown"; } return "UNDEFINED"; } //------------------------------------------------------------------------- - ISCTPTransportTypes::States SCTPTransport::toState(InternalStates state) + ISCTPTransportTypes::States SCTPTransport::toState(InternalStates state) noexcept { switch (state) { - case InternalState_New: return ISCTPTransportTypes::State_New; - case InternalState_Connecting: return ISCTPTransportTypes::State_Connecting; - case InternalState_ConnectingDisrupted: return ISCTPTransportTypes::State_Connecting; - case InternalState_Ready: return ISCTPTransportTypes::State_Connected; - case InternalState_Disconnected: return ISCTPTransportTypes::State_Connected; - case InternalState_ShuttingDown: return ISCTPTransportTypes::State_Closed; - case InternalState_Shutdown: return ISCTPTransportTypes::State_Closed; + case InternalState_New: return ISCTPTransportTypes::State_New; + case InternalState_Connecting: return ISCTPTransportTypes::State_Connecting; + case InternalState_ConnectingDisrupted: return ISCTPTransportTypes::State_Connecting; + case InternalState_Ready: return ISCTPTransportTypes::State_Connected; + case InternalState_Disconnected: return ISCTPTransportTypes::State_Connected; + case InternalState_ShuttingDown: return ISCTPTransportTypes::State_Closed; + case InternalState_Shutdown: return ISCTPTransportTypes::State_Closed; } - ZS_THROW_NOT_IMPLEMENTED(String("state is not implemented:") + toString(state)) - return ISCTPTransportTypes::State_Closed; + ZS_ASSERT_FAIL("state is not implemented:"); + return ISCTPTransportTypes::State_Closed; } //------------------------------------------------------------------------- SCTPTransport::SCTPTransport( - const make_private &, - IMessageQueuePtr queue, - UseListenerPtr listener, - UseSecureTransportPtr secureTransport, - WORD localPort, - WORD remotePort - ) : + const make_private &, + IMessageQueuePtr queue, + ISCTPTransportDelegatePtr originalDelegate, + UseListenerPtr listener, + UseSecureTransportPtr secureTransport, + WORD localPort, + WORD remotePort + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), mSCTPInit(SCTPInit::singleton()), mMaxSessionsPerPort(ISettings::getUInt(ORTC_SETTING_SCTP_TRANSPORT_MAX_SESSIONS_PER_PORT)), + mSubscriptions(decltype(mSubscriptions)::create()), + mDataChannelSubscriptions(decltype(mDataChannelSubscriptions)::create()), mListener(listener), mSecureTransport(secureTransport), mDeliveryQueue(IORTCForInternal::queueORTCPipeline()), @@ -718,7 +716,7 @@ namespace ortc mLocalPort(localPort), mRemotePort(remotePort) { - ORTC_THROW_INVALID_PARAMETERS_IF(!secureTransport); + ZS_ASSERT(secureTransport); ZS_EVENTING_6( x, i, Detail, SctpTransportCreate, ol, SctpTransport, Start, @@ -732,18 +730,21 @@ namespace ortc ZS_LOG_DETAIL(debug("created")); - ORTC_THROW_INVALID_STATE_IF(!mSCTPInit) + ZS_ASSERT(mSCTPInit); + + if (originalDelegate) { + mDefaultSubscription = mSubscriptions.subscribe(originalDelegate, IORTCForInternal::queueDelegate()); + } } //------------------------------------------------------------------------- - void SCTPTransport::init() + void SCTPTransport::init() noexcept { AutoRecursiveLock lock(*this); - //IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); - ZS_LOG_DETAIL(debug("SCTP init")) + ZS_LOG_DETAIL(debug("SCTP init")); - auto secureTransport = mSecureTransport.lock(); + auto secureTransport = mSecureTransport.lock(); if (secureTransport) { mSecureTransportSubscription = secureTransport->subscribe(mThisWeak.lock()); } @@ -752,12 +753,12 @@ namespace ortc } //------------------------------------------------------------------------- - SCTPTransport::~SCTPTransport() + SCTPTransport::~SCTPTransport() noexcept { if (isNoop()) return; - ZS_LOG_DETAIL(log("destroyed")) - mThisWeak.reset(); + ZS_LOG_DETAIL(log("destroyed")); + mThisWeak.reset(); mThisSocket->reset(); cancel(); @@ -768,33 +769,33 @@ namespace ortc } //------------------------------------------------------------------------- - SCTPTransportPtr SCTPTransport::convert(ISCTPTransportPtr object) + SCTPTransportPtr SCTPTransport::convert(ISCTPTransportPtr object) noexcept { ISCTPTransportPtr original = ISCTPTransportTearAway::original(object); return ZS_DYNAMIC_PTR_CAST(SCTPTransport, original); } //------------------------------------------------------------------------- - SCTPTransportPtr SCTPTransport::convert(IDataTransportPtr object) + SCTPTransportPtr SCTPTransport::convert(IDataTransportPtr object) noexcept { ISCTPTransportPtr sctpTransport = ZS_DYNAMIC_PTR_CAST(ISCTPTransport, object); return convert(sctpTransport); } //------------------------------------------------------------------------- - SCTPTransportPtr SCTPTransport::convert(ForSettingsPtr object) + SCTPTransportPtr SCTPTransport::convert(ForSettingsPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransport, object); } //------------------------------------------------------------------------- - SCTPTransportPtr SCTPTransport::convert(ForDataChannelPtr object) + SCTPTransportPtr SCTPTransport::convert(ForDataChannelPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransport, object); } //------------------------------------------------------------------------- - SCTPTransportPtr SCTPTransport::convert(ForListenerPtr object) + SCTPTransportPtr SCTPTransport::convert(ForListenerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransport, object); } @@ -803,45 +804,67 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IStatsProvider - #pragma mark + // + // SCTPTransport => IStatsProvider + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr SCTPTransport::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr SCTPTransport::getStats(ZS_MAYBE_USED() const StatsTypeSet &stats) const noexcept { -#define TODO_COMPLETE 1 -#define TODO_COMPLETE 2 + ZS_MAYBE_USED(stats); +#pragma ZS_BUILD_NOTE("TODO","Implement getStats") return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } - //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransport - #pragma mark + // + // SCTPTransport => ISCTPTransport + // //------------------------------------------------------------------------- - ElementPtr SCTPTransport::toDebug(SCTPTransportPtr transport) + ElementPtr SCTPTransport::toDebug(SCTPTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); } + //------------------------------------------------------------------------- + PUID SCTPTransport::getID() const noexcept + { + AutoRecursiveLock lock(*this); + + // Caller has seen the real ID thus do not hide the real ID. + if (mObtainedID) return mID; + + // Ideally the redirect transport and this transport woud have the same + // ID but that's not possible. To the external world hide the ID of + // this transport's real ID if the redirect transport is in place. But + // do not hide the ID if the real ID has been revealed before the + // redirect was put into place. + if (mRedirectToExistingTransport) { + // Once a redirect is in place the redirect linkage cannot be broken. + return mRedirectToExistingTransport->getID(); + } + + // Caller has obtained real ID so this ID cannot change for this object. + mObtainedID = true; // mutuable + return mID; + } + //------------------------------------------------------------------------- ISCTPTransportPtr SCTPTransport::create( ISCTPTransportDelegatePtr delegate, IDTLSTransportPtr transport, WORD inLocalPort - ) throw (InvalidParameters, InvalidStateError) + ) noexcept(false) { ORTC_THROW_INVALID_PARAMETERS_IF(!transport); UseSecureTransportPtr useSecureTransport = DTLSTransport::convert(transport); - ASSERT(((bool)useSecureTransport)); + ZS_ASSERT(((bool)useSecureTransport)); auto dataTransport = useSecureTransport->getDataTransport(); ORTC_THROW_INVALID_STATE_IF(!dataTransport); @@ -856,12 +879,19 @@ namespace ortc inLocalPort = allocatedLocalPort.value(); } - SCTPTransportPtr pThis(make_shared(make_private{}, IORTCForInternal::queueORTC(), listener, useSecureTransport)); + SCTPTransportPtr pThis(make_shared(make_private{}, IORTCForInternal::queueORTC(), delegate, listener, useSecureTransport)); pThis->mThisWeak = pThis; pThis->mThisSocket = new SCTPTransportWeakPtr(pThis); ISCTPTransportPtr registeredTransport = pThis; + // A tear away is created to allow caller to hold an instance of the tear + // away as a means to ensure an instance of the listener is held as + // well as this object since both objects are needed. This object cannot + // hold an instance directly to the listener as the listener holds + // instances to every SCTP transport as that would cause a circular + // reference. Thus by using a tear away to hold the references to this + // object and the listener prevents the circular reference. auto tearAway = ISCTPTransportTearAway::create(registeredTransport, make_shared()); ORTC_THROW_INVALID_STATE_IF(!tearAway); @@ -869,7 +899,6 @@ namespace ortc ORTC_THROW_INVALID_STATE_IF(!tearAwayData); tearAwayData->mListener = listener; - tearAwayData->mDelegate = delegate; AutoRecursiveLock lock(*pThis); pThis->mTearAway = tearAway; @@ -880,42 +909,50 @@ namespace ortc } //------------------------------------------------------------------------- - ISCTPTransportTypes::States SCTPTransport::state() const + ISCTPTransportTypes::States SCTPTransport::state() const noexcept { AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->state(); return mLastReportedState; } //------------------------------------------------------------------------- - IDTLSTransportPtr SCTPTransport::transport() const + IDTLSTransportPtr SCTPTransport::transport() const noexcept { + // NOTE: Redirect and this object must share same secure transport. return DTLSTransport::convert(mSecureTransport.lock()); } //------------------------------------------------------------------------- - WORD SCTPTransport::port() const + WORD SCTPTransport::port() const noexcept { + // NOTE: Redirect and this object must share same secure port. return mLocalPort; } //------------------------------------------------------------------------- - WORD SCTPTransport::localPort() const + WORD SCTPTransport::localPort() const noexcept { + // NOTE: Redirect and this object must share same secure port. return mLocalPort; } //------------------------------------------------------------------------- - Optional SCTPTransport::remotePort() const + Optional SCTPTransport::remotePort() const noexcept { + // NOTE: Redirect and this object must share same secure port. return mRemotePort; } //------------------------------------------------------------------------- - ISCTPTransportTypes::PromiseWithSocketOptionsPtr SCTPTransport::getOptions(const SocketOptions &inWhichOptions) + ISCTPTransportTypes::PromiseWithSocketOptionsPtr SCTPTransport::getOptions(const SocketOptions &inWhichOptions) noexcept { + AutoRecursiveLock lock(*this); + + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->getOptions(inWhichOptions); + auto promise = PromiseWithSocketOptions::create(IORTCForInternal::queueDelegate()); - AutoRecursiveLock lock(*this); if ((isShuttingDown()) || (isShutdown())) { promise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "transport is closing or closed")); @@ -939,12 +976,14 @@ namespace ortc } //------------------------------------------------------------------------- - PromisePtr SCTPTransport::setOptions(const SocketOptions &inOptions) + PromisePtr SCTPTransport::setOptions(const SocketOptions &inOptions) noexcept { - auto promise = Promise::create(IORTCForInternal::queueDelegate()); - AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->setOptions(inOptions); + + auto promise = Promise::create(IORTCForInternal::queueDelegate()); + if ((isShuttingDown()) || (isShutdown())) { promise->reject(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "transport is closing or closed")); @@ -971,7 +1010,7 @@ namespace ortc void SCTPTransport::start( const Capabilities &remoteCapabilities, WORD inRemotePort - ) throw (InvalidStateError, InvalidParameters) + ) noexcept(false) { ZS_EVENTING_7( x, i, Detail, SctpTransportStart, ol, SctpTransport, Start, @@ -987,15 +1026,35 @@ namespace ortc ZS_LOG_DEBUG(log("start called") + remoteCapabilities.toDebug()); AutoRecursiveLock lock(*this); + + if (mRedirectToExistingTransport) { + mRedirectToExistingTransport->start(remoteCapabilities, inRemotePort); + return; + } + if ((isShuttingDown()) || (isShutdown())) { ORTC_THROW_INVALID_STATE("already shutting down"); } if (mCapabilities) { - ORTC_THROW_INVALID_STATE("already started"); + ORTC_THROW_INVALID_STATE_IF(!mStartedFromListener); + if (mStartedFromListener) { + // Not allowed to change capabilities after declaring the + // capabilities to the sctp transport listener. + ORTC_THROW_INVALID_STATE_IF(mCapabilities->mMaxMessageSize != remoteCapabilities.mMaxMessageSize); + ORTC_THROW_INVALID_STATE_IF(mCapabilities->mMaxSessionsPerPort != remoteCapabilities.mMaxSessionsPerPort); + } + ZS_LOG_DEBUG(log("already started")); + mStartedFromListener = false; + + // Needed to ensure any moved requests from a redirection get handled. + IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); + return; } + mStartedFromListener = false; + if (0 != inRemotePort) { mRemotePort = inRemotePort; } @@ -1019,50 +1078,152 @@ namespace ortc ORTC_THROW_INVALID_PARAMETERS("unable to allocate port, local port=" + string(mLocalPort) + ", remote port=" + string(remotePort)); } - auto usePThis = SCTPTransport::convert(forListener); - mLocalPort = localPort; mRemotePort = remotePort; + mCapabilities = make_shared(remoteCapabilities); + + // The SCTP transport used in the mapping of local:remote may already + // exist if the remote party initialized an SCTP transport before the + // local side has a chance to start its SCTP transport. This ensures + // this object remaps all requrests to an existing SCTP transport rather + // than creating a duplicate transport. + if (forListener != originalForListener) { + mRedirectToExistingTransport = SCTPTransport::convert(forListener); - auto originalTearAwayInterface = mTearAway.lock(); - auto tearAway = ISCTPTransportTearAway::tearAway(originalTearAwayInterface); - if (tearAway) { - tearAway->setDelegate(usePThis); - - auto tearAwayData = ISCTPTransportTearAway::data(originalTearAwayInterface); - if (tearAwayData) { - auto delegate = tearAwayData->mDelegate.lock(); - if ((!tearAwayData->mDefaultSubscription) && - (delegate)) { - tearAwayData->mDefaultSubscription = usePThis->subscribe(delegate); - tearAwayData->mDelegate.reset(); + if (mRedirectToExistingTransport) { + AutoRecursiveLock lock2(*mRedirectToExistingTransport); + + if ((mRedirectToExistingTransport->isShuttingDown()) || + (mRedirectToExistingTransport->isShutdown())) { + ORTC_THROW_INVALID_STATE("already shutting down"); } - } - } - if (forListener != originalForListener) { - cancel(); + // Need to move get/set options to new transport + { + for (auto iter = mGetSocketOptions.begin(); iter != mGetSocketOptions.end(); ++iter) { + auto &value = (*iter); + mRedirectToExistingTransport->mGetSocketOptions.push_back(value); + } + for (auto iter = mSetSocketOptions.begin(); iter != mSetSocketOptions.end(); ++iter) { + auto &value = (*iter); + mRedirectToExistingTransport->mSetSocketOptions.push_back(value); + } + + mGetSocketOptions.clear(); + mSetSocketOptions.clear(); + } + + // Need to move the existing data channels to the redirected transport. + { + for (auto iter = mSessions.begin(); iter != mSessions.end(); ++iter) { + auto &sessionID = (*iter).first; + auto &dataChannel = (*iter).second; + if (!dataChannel) continue; + + bool remapped = false; + + try { + SessionID tempID = sessionID; + UseDataChannelPtr channel = dataChannel; + + if (!mRedirectToExistingTransport->isSessionAvailable(sessionID)) goto skip_register; + mRedirectToExistingTransport->registerNewDataChannel(channel, tempID); + remapped = true; + } catch(const InvalidParameters &) { + goto skip_register; + } catch(const InvalidStateError &) { + goto skip_register; + } + + skip_register: + { + if (!remapped) { + mFilterSessionRequests.insert(sessionID); + dataChannel->notifyRemapFailure(); + continue; + } + + auto found = mAnnouncedIncomingDataChannels.find(dataChannel->getID()); + if (found != mAnnouncedIncomingDataChannels.end()) { + mRedirectToExistingTransport->mAnnouncedIncomingDataChannels[dataChannel->getID()] = dataChannel; + } + } + } + + // sessions being reset should also be moved to a new transport + for (auto iter = mPendingResetSessions.begin(); iter != mPendingResetSessions.end(); ++iter) { + auto &sessionID = (*iter).first; + auto &dataChannel = (*iter).second; + if (!dataChannel) continue; + + if (!mRedirectToExistingTransport->isSessionAvailable(sessionID)) { + mFilterSessionRequests.insert(sessionID); + dataChannel->notifyClosed(); + continue; + } + auto found = mAnnouncedIncomingDataChannels.find(dataChannel->getID()); + if (found != mAnnouncedIncomingDataChannels.end()) { + mRedirectToExistingTransport->mAnnouncedIncomingDataChannels[dataChannel->getID()] = dataChannel; + } + mRedirectToExistingTransport->mPendingResetSessions[sessionID] = dataChannel; + } + + // sessions queued to reset should also be moved to a new transport + for (auto iter = mQueuedResetSessions.begin(); iter != mQueuedResetSessions.end(); ++iter) { + auto &sessionID = (*iter).first; + auto &dataChannel = (*iter).second; + if (!dataChannel) continue; + + if (!mRedirectToExistingTransport->isSessionAvailable(sessionID)) { + mFilterSessionRequests.insert(sessionID); + dataChannel->notifyClosed(); + continue; + } + auto found = mAnnouncedIncomingDataChannels.find(dataChannel->getID()); + if (found != mAnnouncedIncomingDataChannels.end()) { + mRedirectToExistingTransport->mAnnouncedIncomingDataChannels[dataChannel->getID()] = dataChannel; + } + mRedirectToExistingTransport->mQueuedResetSessions[sessionID] = dataChannel; + } + + // everything is now moved + mSessions.clear(); + mPendingResetSessions.clear(); + mQueuedResetSessions.clear(); + mAnnouncedIncomingDataChannels.clear(); + + // finally is socket is setup then kill the socket + if (mSocket) { + usrsctp_close(mSocket); + mSocket = NULL; + usrsctp_deregister_address(mThisSocket); + } + } + + mRedirectToExistingTransportSubscription = mRedirectToExistingTransport->subscribe(mThisWeak.lock()); + mRedirectToExistingTransport->start(remoteCapabilities, inRemotePort); + } return; } - mCapabilities = make_shared(remoteCapabilities); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); } //------------------------------------------------------------------------- - void SCTPTransport::stop() + void SCTPTransport::stop() noexcept { ZS_EVENTING_1(x, i, Detail, SctpTransportStop, ol, SctpTransport, Stop, puid, id, mID); ZS_LOG_DEBUG(log("stop called")) AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->stop(); cancel(); } //------------------------------------------------------------------------- - ISCTPTransportSubscriptionPtr SCTPTransport::subscribe(ISCTPTransportDelegatePtr originalDelegate) + ISCTPTransportSubscriptionPtr SCTPTransport::subscribe(ISCTPTransportDelegatePtr originalDelegate) noexcept { - ZS_LOG_DETAIL(log("subscribing to transport state")) + ZS_LOG_DETAIL(log("subscribing to transport state")); AutoRecursiveLock lock(*this); @@ -1073,15 +1234,29 @@ namespace ortc if (delegate) { SCTPTransportPtr pThis = mThisWeak.lock(); - for (auto iter = mAnnouncedIncomingDataChannels.begin(); iter != mAnnouncedIncomingDataChannels.end(); ++iter) { - // NOTE: ID of data channels are always greater than last so order - // should be guarenteed. - auto dataChannel = (*iter).second; - delegate->onSCTPTransportDataChannel(mThisWeak.lock(), DataChannel::convert(dataChannel)); - } + if (mRedirectToExistingTransport) { + AutoRecursiveLock lock2(*mRedirectToExistingTransport); + + for (auto iter = mRedirectToExistingTransport->mAnnouncedIncomingDataChannels.begin(); iter != mRedirectToExistingTransport->mAnnouncedIncomingDataChannels.end(); ++iter) { + // NOTE: ID of data channels are always greater than last so order should be guarenteed. + auto dataChannel = (*iter).second; + delegate->onSCTPTransportDataChannel(pThis, DataChannel::convert(dataChannel)); + } + + if (State_New != mRedirectToExistingTransport->mLastReportedState) { + delegate->onSCTPTransportStateChange(pThis, mRedirectToExistingTransport->mLastReportedState); + } + } else { + for (auto iter = mAnnouncedIncomingDataChannels.begin(); iter != mAnnouncedIncomingDataChannels.end(); ++iter) { + // NOTE: ID of data channels are always greater than last so order + // should be guarenteed. + auto dataChannel = (*iter).second; + delegate->onSCTPTransportDataChannel(pThis, DataChannel::convert(dataChannel)); + } - if (State_New != mLastReportedState) { - delegate->onSCTPTransportStateChange(pThis, mLastReportedState); + if (State_New != mLastReportedState) { + delegate->onSCTPTransportStateChange(pThis, mLastReportedState); + } } } @@ -1096,18 +1271,23 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportForDataChannel - #pragma mark + // + // SCTPTransport => ISCTPTransportForDataChannel + // //------------------------------------------------------------------------- void SCTPTransport::registerNewDataChannel( UseDataChannelPtr &ioDataChannel, WORD &ioSessionID - ) + ) noexcept(false) { AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + mRedirectToExistingTransport->registerNewDataChannel(ioDataChannel, ioSessionID); + return; + } + UseDataChannelPtr dataChannel = ioDataChannel; WORD sessionID = ioSessionID; @@ -1210,12 +1390,14 @@ namespace ortc } //------------------------------------------------------------------------- - ISCTPTransportForDataChannelSubscriptionPtr SCTPTransport::subscribe(ISCTPTransportForDataChannelDelegatePtr originalDelegate) + ISCTPTransportForDataChannelSubscriptionPtr SCTPTransport::subscribe(ISCTPTransportForDataChannelDelegatePtr originalDelegate) noexcept { - ZS_LOG_DETAIL(log("datachannel subscribing to SCTP Transport")) + ZS_LOG_DETAIL(log("datachannel subscribing to SCTP Transport")); AutoRecursiveLock lock(*this); - + + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->subscribe(originalDelegate); + ISCTPTransportForDataChannelSubscriptionPtr subscription = mDataChannelSubscriptions.subscribe(originalDelegate, IORTCForInternal::queueORTC()); ISCTPTransportForDataChannelDelegatePtr delegate = mDataChannelSubscriptions.delegate(subscription, true); @@ -1236,8 +1418,10 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::isReady() const + bool SCTPTransport::isReady() const noexcept { + AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->isReady(); return InternalState_Ready == mCurrentState; } @@ -1245,13 +1429,19 @@ namespace ortc void SCTPTransport::announceIncoming( UseDataChannelPtr dataChannel, ParametersPtr params - ) + ) noexcept { - ZS_THROW_INVALID_ARGUMENT_IF(!dataChannel) - ZS_THROW_INVALID_ARGUMENT_IF(!params) + ZS_ASSERT(dataChannel); + ZS_ASSERT(params); AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + if (mFilterSessionRequests.end() != mFilterSessionRequests.find(params->mID.value())) return; + mRedirectToExistingTransport->announceIncoming(dataChannel, params); + return; + } + auto found = mSessions.find(params->mID.value()); if (found == mSessions.end()) { ZS_LOG_WARNING(Debug, log("cannot announce incoming session as it is not active") + params->toDebug()) @@ -1278,7 +1468,7 @@ namespace ortc } //------------------------------------------------------------------------- - PromisePtr SCTPTransport::sendDataNow(SCTPPacketOutgoingPtr packet) + PromisePtr SCTPTransport::sendDataNow(SCTPPacketOutgoingPtr packet) noexcept { ZS_EVENTING_8( x, i, Trace, SctpTransportSendOutgoingPacket, ol, SctpTransport, Send, @@ -1289,13 +1479,19 @@ namespace ortc bool, hasMaxRetransmits, packet->mMaxRetransmits.hasValue(), ulong, maxRetransmits, packet->mMaxRetransmits.value(), buffer, data, ((bool)packet->mBuffer) ? packet->mBuffer->BytePtr() : NULL, - size, size, ((bool)packet->mBuffer) ? SafeInt(packet->mBuffer->SizeInBytes()) : 0 + size, size, ((bool)packet->mBuffer) ? size_t((SafeInt(packet->mBuffer->SizeInBytes()))) : 0 ); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel::RejectReason, RejectReason) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel::RejectReason, RejectReason); + { AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + if (mFilterSessionRequests.end() != mFilterSessionRequests.find(packet->mSessionID)) return Promise::createRejected(RejectReason::create(UseHTTP::HTTPStatusCode_Conflict, "cannot send because of a remap conflict"), IORTCForInternal::queueORTC());; + return mRedirectToExistingTransport->sendDataNow(packet); + } + if ((isShuttingDown()) || (isShutdown())) { ZS_LOG_WARNING(Debug, log("cannot send data while shutting down / shutdown")) @@ -1340,7 +1536,7 @@ namespace ortc void SCTPTransport::requestShutdown( UseDataChannelPtr dataChannel, WORD sessionID - ) + ) noexcept { ZS_EVENTING_3( x, i, Detail, SctpTransportShutdownDataChannel, ol, SctpTransport, Info, @@ -1351,6 +1547,12 @@ namespace ortc AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + if (mFilterSessionRequests.end() != mFilterSessionRequests.find(sessionID)) return; + mRedirectToExistingTransport->requestShutdown(dataChannel, sessionID); + return; + } + if (isShutdown()) { ZS_LOG_WARNING(Trace, log("already shutdown transport")) dataChannel->notifyClosed(); @@ -1422,29 +1624,50 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportForSecureTransport - #pragma mark + // + // SCTPTransport => ISCTPTransportForSecureTransport + // //------------------------------------------------------------------------- SCTPTransport::ForListenerPtr SCTPTransport::create( UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort - ) + ) noexcept { - SCTPTransportPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), listener, secureTransport, localPort)); + SCTPTransportPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), ISCTPTransportDelegatePtr(), listener, secureTransport, localPort)); pThis->mThisWeak = pThis; pThis->mThisSocket = new SCTPTransportWeakPtr(pThis); pThis->init(); return pThis; } + //------------------------------------------------------------------------- + void SCTPTransport::startFromListener( + const Capabilities &remoteCapabilities, + WORD remotePort + ) noexcept(false) + { + AutoRecursiveLock lock(*this); + + if (mRedirectToExistingTransport) { + mRedirectToExistingTransport->startFromListener(remoteCapabilities, remotePort); + return; + } + + if (mCapabilities) { + ZS_LOG_DEBUG(log("already started from remote")); + return; + } + start(remoteCapabilities, remotePort); + mStartedFromListener = true; + } + //------------------------------------------------------------------------- bool SCTPTransport::handleDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_EVENTING_3( x, i, Trace, SctpTransportReceivedIncomingDataPacket, ol, SctpTransport, Receive, @@ -1461,6 +1684,8 @@ namespace ortc { AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->handleDataPacket(buffer, bufferLengthInBytes); + { if (isShutdown()) { ZS_LOG_WARNING(Debug, log("packet arrived after shutdown")) @@ -1486,15 +1711,14 @@ namespace ortc ); mPendingIncomingBuffers.push(make_shared(buffer, bufferLengthInBytes)); - return true; } } - return false; + return true; } //------------------------------------------------------------------------- - void SCTPTransport::notifyShutdown() + void SCTPTransport::notifyShutdown() noexcept { ZS_EVENTING_1(x, i, Detail, SctpTransportInternalShutdownEvent, ol, SctpTransport, InternalEvent, puid, id, mID); @@ -1505,15 +1729,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => friend SCTPInit - #pragma mark + // + // SCTPTransport => friend SCTPInit + // //------------------------------------------------------------------------- bool SCTPTransport::notifySendSCTPPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { // WARNING: DO NOT ENTER A LOCK AS IT COULD CAUSE A DEADLOCK. // usrsctp calls this method which has a lock and an attempt @@ -1535,17 +1759,60 @@ namespace ortc size, size, bufferLengthInBytes ); + // NOTE: No need to redirect to existing transport as same secure + // secure transport is used. return transport->sendDataPacket(buffer, bufferLengthInBytes); } + + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- + // + // SCTPTransport => ISCTPTransportDelegate + // + //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IWakeDelegate - #pragma mark + void SCTPTransport::onSCTPTransportStateChange( + ISCTPTransportPtr transport, + ISCTPTransportTypes::States state + ) + { + auto pThis = mThisWeak.lock(); + + ZS_EVENTING_1(x, i, Detail, SctpTransportInternalSCTPTransportStateChange, ol, SctpTransport, InternalEvent, puid, id, mID); + + AutoRecursiveLock lock(*this); + + // simulate redirect transport event as if it came from this transport + mSubscriptions.delegate()->onSCTPTransportStateChange(pThis, state); + } + + //------------------------------------------------------------------------- + void SCTPTransport::onSCTPTransportDataChannel( + ISCTPTransportPtr transport, + IDataChannelPtr channel + ) + { + auto pThis = mThisWeak.lock(); + + ZS_EVENTING_1(x, i, Detail, SctpTransportInternalSCTPTransportDataChannel, ol, SctpTransport, InternalEvent, puid, id, mID); + + AutoRecursiveLock lock(*this); + + // simulate redirect transport event as if it came from this transport + mSubscriptions.delegate()->onSCTPTransportDataChannel(pThis, channel); + } + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // SCTPTransport => IWakeDelegate + // //------------------------------------------------------------------------- void SCTPTransport::onWake() @@ -1561,9 +1828,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ITimerDelegate - #pragma mark + // + // SCTPTransport => ITimerDelegate + // //------------------------------------------------------------------------- void SCTPTransport::onTimer(ITimerPtr timer) @@ -1577,9 +1844,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportAsyncDelegate - #pragma mark + // + // SCTPTransport => ISCTPTransportAsyncDelegate + // //------------------------------------------------------------------------- void SCTPTransport::onIncomingPacket(SCTPPacketIncomingPtr packet) @@ -1592,7 +1859,7 @@ namespace ortc dword, timestamp, packet->mTimestamp, int, flags, packet->mFlags, buffer, data, ((bool)packet->mBuffer) ? packet->mBuffer->BytePtr() : NULL, - size, size, ((bool)packet->mBuffer) ? SafeInt(packet->mBuffer->SizeInBytes()) : 0 + size, size, ((bool)packet->mBuffer) ? size_t(SafeInt(packet->mBuffer->SizeInBytes())) : 0 ); ZS_LOG_TRACE(log("on incoming packet") + packet->toDebug()) @@ -1609,6 +1876,10 @@ namespace ortc ZS_THROW_INVALID_ASSUMPTION_IF(notification.sn_header.sn_length != packet->mBuffer->SizeInBytes()) AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + mRedirectToExistingTransport->handleNotificationPacket(notification); + return; + } handleNotificationPacket(notification); return; } @@ -1618,6 +1889,12 @@ namespace ortc { AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + if (mFilterSessionRequests.end() != mFilterSessionRequests.find(packet->mSessionID)) return; + mRedirectToExistingTransport->onIncomingPacket(packet); + return; + } + // scope: check active sessions { auto found = mSessions.find(packet->mSessionID); @@ -1676,7 +1953,7 @@ namespace ortc dword, timestamp, packet->mTimestamp, int, flags, packet->mFlags, buffer, data, ((bool)packet->mBuffer) ? packet->mBuffer->BytePtr() : NULL, - size, size, ((bool)packet->mBuffer) ? SafeInt(packet->mBuffer->SizeInBytes()) : 0 + size, size, ((bool)packet->mBuffer) ? size_t(SafeInt(packet->mBuffer->SizeInBytes())) : 0 ); ZS_LOG_TRACE(log("forwarding to data channel") + ZS_PARAM("data channel", dataChannel->getID()) + packet->toDebug()); dataChannel->handleSCTPPacket(packet); @@ -1689,6 +1966,10 @@ namespace ortc ZS_LOG_TRACE(log("on notified to shutdown")) AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) { + mRedirectToExistingTransport->onNotifiedToShutdown(); + return; + } cancel(); } @@ -1696,9 +1977,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IICETransportDelegate - #pragma mark + // + // SCTPTransport => IICETransportDelegate + // //------------------------------------------------------------------------- void SCTPTransport::onSecureTransportStateChanged( @@ -1723,12 +2004,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (internal) - #pragma mark + // + // SCTPTransport => (internal) + // //------------------------------------------------------------------------- - Log::Params SCTPTransport::log(const char *message) const + Log::Params SCTPTransport::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::SCTPTransport"); IHelper::debugAppend(objectEl, "id", mID); @@ -1736,23 +2017,25 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params SCTPTransport::slog(const char *message) + Log::Params SCTPTransport::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::SCTPTransport"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params SCTPTransport::debug(const char *message) const + Log::Params SCTPTransport::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr SCTPTransport::toDebug() const + ElementPtr SCTPTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); + if (mRedirectToExistingTransport) return mRedirectToExistingTransport->toDebug(); + ElementPtr resultEl = Element::create("ortc::SCTPTransport"); IHelper::debugAppend(resultEl, "id", mID); @@ -1813,21 +2096,26 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::isShuttingDown() const + bool SCTPTransport::isShuttingDown() const noexcept { return InternalState_ShuttingDown == mCurrentState; } //------------------------------------------------------------------------- - bool SCTPTransport::isShutdown() const + bool SCTPTransport::isShutdown() const noexcept { return InternalState_Shutdown == mCurrentState; } //------------------------------------------------------------------------- - void SCTPTransport::step() + void SCTPTransport::step() noexcept { - ZS_LOG_DEBUG(debug("step")) + ZS_LOG_DEBUG(debug("step")); + + if (mRedirectToExistingTransport) { + mRedirectToExistingTransport->step(); + return; + } if ((isShuttingDown()) || (isShutdown())) { @@ -1863,7 +2151,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::stepStartCalled() + bool SCTPTransport::stepStartCalled() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportStep, ol, SctpTransport, Step, puid, id, mID); @@ -1880,7 +2168,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::stepSecureTransport() + bool SCTPTransport::stepSecureTransport() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportStep, ol, SctpTransport, Step, puid, id, mID); @@ -1899,7 +2187,31 @@ namespace ortc } case ISecureTransportTypes::State_Connected: { - ZS_LOG_TRACE(log("secure transport already notified ready")) + ZS_LOG_TRACE(log("secure transport already notified ready")); + InternalStates currentState = mCurrentState; + switch (currentState) + { + case InternalState_New: + case InternalState_Connecting: + case InternalState_ConnectingDisrupted: + { + setState(InternalState_Connecting); + break; + } + case InternalState_Ready: + case InternalState_Disconnected: + { + setState(InternalState_Ready); + break; + } + case InternalState_ShuttingDown: + case InternalState_Shutdown: + { + ZS_LOG_WARNING(Trace, log("already shutting down")) + cancel(); + return false; + } + } break; } case ISecureTransportTypes::State_Disconnected: @@ -1938,13 +2250,11 @@ namespace ortc } } - - if (!mSettledRole) { + if (mSettledRole) { ZS_LOG_TRACE(log("role of secure transport already settled")) return true; } - ZS_LOG_DEBUG(log("secure transport notified ready")) mSettledRole = true; @@ -1960,7 +2270,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::stepOpen() + bool SCTPTransport::stepOpen() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportStep, ol, SctpTransport, Step, puid, id, mID); @@ -1974,11 +2284,11 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::stepDeliverIncomingPackets() + bool SCTPTransport::stepDeliverIncomingPackets() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportStep, ol, SctpTransport, Step, puid, id, mID); - ORTC_THROW_INVALID_STATE_IF(!mSocket) + ZS_ASSERT(mSocket); if (mPendingIncomingBuffers.size() < 1) { ZS_LOG_TRACE(log("no pending packets to deliver")) @@ -2006,7 +2316,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::stepConnected() + bool SCTPTransport::stepConnected() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportStep, ol, SctpTransport, Step, puid, id, mID); @@ -2020,7 +2330,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::stepResetStream() + bool SCTPTransport::stepResetStream() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportStep, ol, SctpTransport, Step, puid, id, mID); @@ -2082,7 +2392,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::cancel() + void SCTPTransport::cancel() noexcept { ZS_EVENTING_1(x, i, Detail, SctpTransportCancel, ol, SctpTransport, Cancel, puid, id, mID); @@ -2249,7 +2559,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::setState(InternalStates state) + void SCTPTransport::setState(InternalStates state) noexcept { if (state == mCurrentState) return; @@ -2275,7 +2585,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::setError(WORD errorCode, const char *inReason) + void SCTPTransport::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -2300,7 +2610,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::openConnectSCTPSocket() + bool SCTPTransport::openConnectSCTPSocket() noexcept { if (mSocket) return true; @@ -2332,7 +2642,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::openSCTPSocket() + bool SCTPTransport::openSCTPSocket() noexcept { mSocket = usrsctp_socket(AF_CONN, SOCK_STREAM, IPPROTO_SCTP, SCTPInit::OnSctpInboundPacket, NULL, 0, mThisSocket); if (!mSocket) { @@ -2352,7 +2662,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::prepareSocket(struct socket *sock) + bool SCTPTransport::prepareSocket(struct socket *sock) noexcept { // Make the socket non-blocking. Connect, close, shutdown etc will not // block the thread waiting for the socket operation to complete. @@ -2449,7 +2759,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::isSessionAvailable(WORD sessionID) + bool SCTPTransport::isSessionAvailable(WORD sessionID) noexcept { { auto found = mSessions.find(sessionID); @@ -2470,7 +2780,7 @@ namespace ortc bool SCTPTransport::attemptSend( const SCTPPacketOutgoing &inPacket, bool &outWouldBlock - ) + ) noexcept { outWouldBlock = false; @@ -2532,7 +2842,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::notifyWriteReady() + void SCTPTransport::notifyWriteReady() noexcept { if (!mConnected) { ZS_LOG_DEBUG(log("connected (as notified write ready)")) @@ -2557,7 +2867,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::handleNotificationPacket(const sctp_notification ¬ification) + void SCTPTransport::handleNotificationPacket(const sctp_notification ¬ification) noexcept { switch (notification.sn_header.sn_type) { @@ -2626,7 +2936,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::handleNotificationAssocChange(const sctp_assoc_change &change) + void SCTPTransport::handleNotificationAssocChange(const sctp_assoc_change &change) noexcept { switch (change.sac_state) { case SCTP_COMM_UP: @@ -2653,7 +2963,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransport::handleStreamResetEvent(const sctp_stream_reset_event &event) + void SCTPTransport::handleStreamResetEvent(const sctp_stream_reset_event &event) noexcept { if (mAttemptResetLater) { mAttemptResetLater = false; @@ -2741,7 +3051,7 @@ namespace ortc //------------------------------------------------------------------------- - bool SCTPTransport::internalGetOptions(SocketOptions &ioOptions) const + bool SCTPTransport::internalGetOptions(SocketOptions &ioOptions) const noexcept { AutoRecursiveLock lock(*this); @@ -2916,7 +3226,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransport::internalSetOptions(const SocketOptions &inOptions) + bool SCTPTransport::internalSetOptions(const SocketOptions &inOptions) noexcept { AutoRecursiveLock lock(*this); @@ -3066,12 +3376,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportFactory - #pragma mark + // + // ISCTPTransportFactory + // //------------------------------------------------------------------------- - ISCTPTransportFactory &ISCTPTransportFactory::singleton() + ISCTPTransportFactory &ISCTPTransportFactory::singleton() noexcept { return SCTPTransportFactory::singleton(); } @@ -3081,7 +3391,7 @@ namespace ortc UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort - ) + ) noexcept { if (this) {} return internal::SCTPTransport::create(listener, secureTransport, localPort); @@ -3092,7 +3402,7 @@ namespace ortc ISCTPTransportDelegatePtr delegate, IDTLSTransportPtr transport, WORD localPort - ) + ) noexcept { if (this) {} return internal::SCTPTransport::create(delegate, transport, localPort); @@ -3104,12 +3414,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportTypes::Parameters - #pragma mark + // + // ISCTPTransportTypes::Parameters + // //--------------------------------------------------------------------------- - ISCTPTransportTypes::Capabilities::Capabilities(ElementPtr elem) + ISCTPTransportTypes::Capabilities::Capabilities(ElementPtr elem) noexcept { if (!elem) return; @@ -3121,7 +3431,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISCTPTransportTypes::Capabilities::createElement(const char *objectName) const + ElementPtr ISCTPTransportTypes::Capabilities::createElement(const char *objectName) const noexcept { if (!objectName) objectName = "capabilities"; @@ -3139,13 +3449,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISCTPTransportTypes::Capabilities::toDebug() const + ElementPtr ISCTPTransportTypes::Capabilities::toDebug() const noexcept { return createElement("ortc::ISCTPTransportTypes::Capabilities"); } //--------------------------------------------------------------------------- - String ISCTPTransportTypes::Capabilities::hash() const + String ISCTPTransportTypes::Capabilities::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -3166,12 +3476,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportTypes::SocketOptions - #pragma mark + // + // ISCTPTransportTypes::SocketOptions + // //--------------------------------------------------------------------------- - bool ISCTPTransportTypes::SocketOptions::hasValue() const + bool ISCTPTransportTypes::SocketOptions::hasValue() const noexcept { if (mRTO.hasValue() || mAssocParams.hasValue() || @@ -3195,12 +3505,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportTypes - #pragma mark + // + // ISCTPTransportTypes + // //--------------------------------------------------------------------------- - const char *ISCTPTransportTypes::toString(States state) + const char *ISCTPTransportTypes::toString(States state) noexcept { switch (state) { case State_New: return "new"; @@ -3215,18 +3525,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransport - #pragma mark + // + // ISCTPTransport + // //--------------------------------------------------------------------------- - ElementPtr ISCTPTransport::toDebug(ISCTPTransportPtr transport) + ElementPtr ISCTPTransport::toDebug(ISCTPTransportPtr transport) noexcept { return internal::SCTPTransport::toDebug(internal::SCTPTransport::convert(transport)); } //--------------------------------------------------------------------------- - ISCTPTransportPtr ISCTPTransport::convert(IDataTransportPtr object) + ISCTPTransportPtr ISCTPTransport::convert(IDataTransportPtr object) noexcept { return internal::SCTPTransport::convert(object); } @@ -3236,7 +3546,7 @@ namespace ortc ISCTPTransportDelegatePtr delegate, IDTLSTransportPtr transport, WORD localPort - ) throw (InvalidParameters, InvalidStateError) + ) noexcept(false) { return internal::ISCTPTransportFactory::singleton().create(delegate, transport, localPort); } @@ -3246,13 +3556,13 @@ namespace ortc ISCTPTransportListenerDelegatePtr delegate, IDTLSTransportPtr transport, const Capabilities &remoteCapabilities - ) + ) noexcept { return internal::ISCTPTransportListenerFactory::singleton().listen(delegate, transport, remoteCapabilities); } //--------------------------------------------------------------------------- - ISCTPTransportTypes::CapabilitiesPtr ISCTPTransport::getCapabilities() + ISCTPTransportTypes::CapabilitiesPtr ISCTPTransport::getCapabilities() noexcept { return internal::ISCTPTransportListenerFactory::singleton().getCapabilities(); } diff --git a/ortc/cpp/ortc_SCTPTransportListener.cpp b/ortc/cpp/ortc_SCTPTransportListener.cpp index c893cea9..85e53f2e 100644 --- a/ortc/cpp/ortc_SCTPTransportListener.cpp +++ b/ortc/cpp/ortc_SCTPTransportListener.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -48,14 +50,9 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_sctp_datachannel) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_sctp_data_channel) } namespace ortc { @@ -74,37 +71,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransportListenerSettingsDefaults - #pragma mark + // + // SCTPTransportListenerSettingsDefaults + // class SCTPTransportListenerSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~SCTPTransportListenerSettingsDefaults() + ~SCTPTransportListenerSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static SCTPTransportListenerSettingsDefaultsPtr singleton() + static SCTPTransportListenerSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static SCTPTransportListenerSettingsDefaultsPtr create() + static SCTPTransportListenerSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -112,7 +109,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { //https://tools.ietf.org/html/draft-ietf-rtcweb-data-channel-13#section-6.6 ISettings::setUInt(ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE, 16 * 1024); @@ -127,7 +124,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installSCTPTransportListenerSettingsDefaults() + void installSCTPTransportListenerSettingsDefaults() noexcept { SCTPTransportListenerSettingsDefaults::singleton(); } @@ -136,9 +133,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPHelper - #pragma mark + // + // SCTPHelper + // struct SCTPListenerHelper { @@ -152,7 +149,7 @@ namespace ortc static DWORD createTuple( WORD localPort, WORD remotePort - ) + ) noexcept { DWORD result {}; @@ -170,7 +167,7 @@ namespace ortc DWORD localRemoteTupleID, WORD &outLocalPort, WORD &outRemotePort - ) + ) noexcept { WORD *pLocal = &(((WORD *)(&localRemoteTupleID))[0]); WORD *pRemote = &(((WORD *)(&localRemoteTupleID))[1]); @@ -186,7 +183,7 @@ namespace ortc Directions direction, WORD *outLocalPort = NULL, WORD *outRemotePort = NULL - ) + ) noexcept { if (outLocalPort) *outLocalPort = 0; if (outRemotePort) *outRemotePort = 0; @@ -238,7 +235,7 @@ namespace ortc } //------------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::SCTPListenerHelper"); return Log::Params(message, objectEl); @@ -249,12 +246,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerForSCTPTransport - #pragma mark + // + // ISCTPTransportListenerForSCTPTransport + // //------------------------------------------------------------------------- - ElementPtr ISCTPTransportListenerForSCTPTransport::toDebug(ForSCTPTransportPtr transport) + ElementPtr ISCTPTransportListenerForSCTPTransport::toDebug(ForSCTPTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(SCTPTransportListener, transport)->toDebug(); @@ -264,25 +261,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport - #pragma mark + // + // SCTPTransport + // //------------------------------------------------------------------------- SCTPTransportListener::SCTPTransportListener( const make_private &, IMessageQueuePtr queue, UseSecureTransportPtr secureTransport - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mSecureTransport(DTLSTransport::convert(secureTransport)), mMaxPorts(SafeInt(ISettings::getUInt(ORTC_SETTING_SCTP_TRANSPORT_LISTENER_MAX_PORTS))), mCurrentAllocationPort(SafeInt(ISettings::getUInt(ORTC_SETTING_SCTP_TRANSPORT_LISTENER_DEFAULT_PORT))), mMinAllocationPort(SafeInt(ISettings::getUInt(ORTC_SETTING_SCTP_TRANSPORT_LISTENER_MIN_PORT))), mMaxAllocationPort(SafeInt(ISettings::getUInt(ORTC_SETTING_SCTP_TRANSPORT_LISTENER_MAX_PORT))) { - ORTC_THROW_INVALID_PARAMETERS_IF(!secureTransport); + ZS_ASSERT(secureTransport); ZS_EVENTING_5( x, i, Detail, SctpTransportListenerCreate, ol, SctpTransportListener, Start, @@ -297,14 +295,14 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransportListener::init() + void SCTPTransportListener::init() noexcept { AutoRecursiveLock lock(*this); IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); } //------------------------------------------------------------------------- - SCTPTransportListener::~SCTPTransportListener() + SCTPTransportListener::~SCTPTransportListener() noexcept { if (isNoop()) return; @@ -316,19 +314,19 @@ namespace ortc } //------------------------------------------------------------------------- - SCTPTransportListenerPtr SCTPTransportListener::convert(ForSettingsPtr object) + SCTPTransportListenerPtr SCTPTransportListener::convert(ForSettingsPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransportListener, object); } //------------------------------------------------------------------------- - SCTPTransportListenerPtr SCTPTransportListener::convert(ForSCTPTransportPtr object) + SCTPTransportListenerPtr SCTPTransportListener::convert(ForSCTPTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransportListener, object); } //------------------------------------------------------------------------- - SCTPTransportListenerPtr SCTPTransportListener::convert(ForSecureTransportPtr object) + SCTPTransportListenerPtr SCTPTransportListener::convert(ForSecureTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransportListener, object); } @@ -338,19 +336,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransport - #pragma mark + // + // SCTPTransport => ISCTPTransport + // //------------------------------------------------------------------------- - ElementPtr SCTPTransportListener::toDebug(SCTPTransportListenerPtr object) + ElementPtr SCTPTransportListener::toDebug(SCTPTransportListenerPtr object) noexcept { if (!object) return ElementPtr(); return object->toDebug(); } //------------------------------------------------------------------------- - SCTPTransportListener::CapabilitiesPtr SCTPTransportListener::getCapabilities() + SCTPTransportListener::CapabilitiesPtr SCTPTransportListener::getCapabilities() noexcept { CapabilitiesPtr result(make_shared()); result->mMaxMessageSize = ISettings::getUInt(ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE); @@ -366,15 +364,15 @@ namespace ortc ISCTPTransportListenerDelegatePtr delegate, IDTLSTransportPtr transport, const Capabilities &remoteCapabilities - ) + ) noexcept(false) { - ORTC_THROW_INVALID_PARAMETERS_IF(!transport) + ORTC_THROW_INVALID_PARAMETERS_IF(!transport); UseSecureTransportPtr secureTransport = DTLSTransport::convert(transport); - ORTC_THROW_INVALID_PARAMETERS_IF(!secureTransport) + ORTC_THROW_INVALID_PARAMETERS_IF(!secureTransport); ForSecureTransportPtr dataTransport = secureTransport->getDataTransport(); - ORTC_THROW_INVALID_STATE_IF(!dataTransport) + ORTC_THROW_INVALID_STATE_IF(!dataTransport); auto listener = SCTPTransportListener::convert(dataTransport); ORTC_THROW_INVALID_STATE_IF(!listener); @@ -396,12 +394,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportListenerForSCTPTransport - #pragma mark + // + // SCTPTransport => ISCTPTransportListenerForSCTPTransport + // //------------------------------------------------------------------------- - WORD SCTPTransportListener::allocateLocalPort() + WORD SCTPTransportListener::allocateLocalPort() noexcept { AutoRecursiveLock lock(*this); @@ -415,7 +413,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransportListener::deallocateLocalPort(WORD previouslyAllocatedLocalPort) + void SCTPTransportListener::deallocateLocalPort(WORD previouslyAllocatedLocalPort) noexcept { if (0 == previouslyAllocatedLocalPort) return; deallocatePort(mAllocatedLocalPorts, previouslyAllocatedLocalPort); @@ -428,7 +426,7 @@ namespace ortc WORD &ioLocalPort, bool localPortWasPreallocated, WORD &ioRemotePort - ) + ) noexcept(false) { ORTC_THROW_INVALID_PARAMETERS_IF(!dtlsTransport); ORTC_THROW_INVALID_PARAMETERS_IF(!ioTransport); @@ -463,7 +461,7 @@ namespace ortc if (found != mTransports.end()) { ioTransport = (*found).second; - ZS_LOG_TRACE(log("found existing transport") + ZS_PARAM("transport", ioTransport->getID()) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("tuple id", tupleID)); + ZS_LOG_TRACE(log("found existing transport") + ZS_PARAM("transport", ioTransport->getRealID()) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("tuple id", tupleID)); if ((ioTransport->isShuttingDown()) || (ioTransport->isShutdown())) { @@ -483,7 +481,7 @@ namespace ortc word, remotePort, ioRemotePort ); - ZS_LOG_DEBUG(log("found existing transport") + ZS_PARAM("transport", ioTransport->getID()) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("tuple id", tupleID)); + ZS_LOG_DEBUG(log("found existing transport") + ZS_PARAM("transport", ioTransport->getRealID()) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("tuple id", tupleID)); return; } @@ -538,7 +536,7 @@ namespace ortc word, localPort, ioLocalPort, word, remotePort, ioRemotePort ); - ZS_LOG_DEBUG(log("registered local/remote port pairing") + ZS_PARAM("transport", ioTransport->getID()) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("tuple id", tupleID)); + ZS_LOG_DEBUG(log("registered local/remote port pairing") + ZS_PARAM("transport", ioTransport->getRealID()) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("tuple id", tupleID)); mTransports[tupleID] = ioTransport; } @@ -549,7 +547,7 @@ namespace ortc UseSCTPTransportPtr transport, WORD localPort, WORD remotePort - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -568,16 +566,16 @@ namespace ortc ZS_EVENTING_4( x, i, Detail, SctpTransportListenerSctpTransportEvent, ol, SctpTransportListener, InternalEvent, puid, id, mID, - puid, secureTransportId, transport->getID(), + puid, secureTransportId, transport->getRealID(), word, localPort, localPort, word, remotePort, remotePort ); - ZS_LOG_DEBUG(log("announcing incoming transport") + ZS_PARAM("transport", transport->getID())) + ZS_LOG_DEBUG(log("announcing incoming transport") + ZS_PARAM("transport", transport->getRealID())) mSubscriptions.delegate()->onSCTPTransport(SCTPTransport::convert(transport)); - mAnnouncedTransports[transport->getID()] = transport; + mAnnouncedTransports[transport->getRealID()] = transport; } //------------------------------------------------------------------------- @@ -585,12 +583,12 @@ namespace ortc UseSCTPTransport &transport, WORD localPort, WORD remotePort - ) + ) noexcept { ZS_EVENTING_4( x, i, Detail, SctpTransportListenerSctpTransportShutdownEvent, ol, SctpTransportListener, InternalEvent, puid, id, mID, - puid, sctpTransportId, transport.getID(), + puid, sctpTransportId, transport.getRealID(), word, localPort, localPort, word, remotePort, remotePort ); @@ -604,13 +602,13 @@ namespace ortc auto tuple = UseListenerHelper::createTuple(localPort, remotePort); - ZS_LOG_DETAIL(log("notified shutdown of SCTP transport") + ZS_PARAM("tuple", tuple) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("transport id", transport.getID())) + ZS_LOG_DETAIL(log("notified shutdown of SCTP transport") + ZS_PARAM("tuple", tuple) + ZS_PARAM("local port", localPort) + ZS_PARAM("remote port", remotePort) + ZS_PARAM("transport id", transport.getRealID())) { auto found = mTransports.find(tuple); if (found != mTransports.end()) { auto registeredTransport = (*found).second; - if (registeredTransport->getID() == transport.getID()) { + if (registeredTransport->getRealID() == transport.getRealID()) { deallocatePort(mAllocatedLocalPorts, localPort); deallocatePort(mAllocatedRemotePorts, remotePort); mTransports.erase(found); @@ -619,12 +617,12 @@ namespace ortc } { - auto found = mAnnouncedTransports.find(transport.getID()); + auto found = mAnnouncedTransports.find(transport.getRealID()); if (found != mAnnouncedTransports.end()) mAnnouncedTransports.erase(found); } { - auto found = mPendingTransports.find(transport.getID()); + auto found = mPendingTransports.find(transport.getRealID()); if (found != mPendingTransports.end()) mPendingTransports.erase(found); } @@ -635,12 +633,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportForSecureTransport - #pragma mark + // + // SCTPTransport => ISCTPTransportForSecureTransport + // //------------------------------------------------------------------------- - SCTPTransportListener::ForSecureTransportPtr SCTPTransportListener::create(UseSecureTransportPtr transport) + SCTPTransportListener::ForSecureTransportPtr SCTPTransportListener::create(UseSecureTransportPtr transport) noexcept { SCTPTransportListenerPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), transport)); pThis->mThisWeak = pThis; @@ -652,7 +650,7 @@ namespace ortc bool SCTPTransportListener::handleDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_EVENTING_3( x, i, Trace, SctpTransportListenerReceivedIncomingDataPacket, ol, SctpTransportListener, Receive, @@ -689,15 +687,15 @@ namespace ortc ZS_EVENTING_4( x, i, Detail, SctpTransportListenerSctpTransportCreatedEvent, ol, SctpTransportListener, Receive, puid, id, mID, - puid, sctpTransportId, transport->getID(), + puid, sctpTransportId, transport->getRealID(), word, localPort, localPort, word, remotePort, remotePort ); if (mRemoteCapabilities) { - transport->start(*mRemoteCapabilities, remotePort); + transport->startFromListener(*mRemoteCapabilities, remotePort); } else { - mPendingTransports[transport->getID()] = TransportPortPair(transport, remotePort); + mPendingTransports[transport->getRealID()] = TransportPortPair(transport, remotePort); } allocatePort(mAllocatedLocalPorts, localPort); allocatePort(mAllocatedRemotePorts, remotePort); @@ -710,7 +708,7 @@ namespace ortc ZS_EVENTING_4( x, i, Trace, SctpTransportListenerDeliverIncomingDataPacket, ol, SctpTransportListener, Receive, puid, id, mID, - puid, sctpTransportId, transport->getID(), + puid, sctpTransportId, transport->getRealID(), buffer, dataPacket, buffer, size,size, bufferLengthInBytes ); @@ -721,17 +719,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportListenerAsyncDelegate - #pragma mark + // + // SCTPTransport => ISCTPTransportListenerAsyncDelegate + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IWakeDelegate - #pragma mark + // + // SCTPTransport => IWakeDelegate + // //------------------------------------------------------------------------- void SCTPTransportListener::onWake() @@ -745,12 +743,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (internal) - #pragma mark + // + // SCTPTransport => (internal) + // //------------------------------------------------------------------------- - Log::Params SCTPTransportListener::log(const char *message) const + Log::Params SCTPTransportListener::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::SCTPTransportListener"); IHelper::debugAppend(objectEl, "id", mID); @@ -758,20 +756,20 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params SCTPTransportListener::slog(const char *message) + Log::Params SCTPTransportListener::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::SCTPTransportListener"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params SCTPTransportListener::debug(const char *message) const + Log::Params SCTPTransportListener::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr SCTPTransportListener::toDebug() const + ElementPtr SCTPTransportListener::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -808,20 +806,20 @@ namespace ortc } //------------------------------------------------------------------------- - bool SCTPTransportListener::isShuttingDown() const + bool SCTPTransportListener::isShuttingDown() const noexcept { return (bool)mGracefulShutdownReference; } //------------------------------------------------------------------------- - bool SCTPTransportListener::isShutdown() const + bool SCTPTransportListener::isShutdown() const noexcept { if (mGracefulShutdownReference) return false; return mShutdown; } //------------------------------------------------------------------------- - void SCTPTransportListener::step() + void SCTPTransportListener::step() noexcept { ZS_LOG_DEBUG(debug("step")) @@ -854,7 +852,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SCTPTransportListener::cancel() + void SCTPTransportListener::cancel() noexcept { ZS_EVENTING_1(x, i, Debug, SctpTransportListenerCancel, ol, SctpTransportListener, Cancel, puid, id, mID); @@ -888,11 +886,11 @@ namespace ortc mTransports.erase(current); { - auto found = mPendingTransports.find(transport->getID()); + auto found = mPendingTransports.find(transport->getRealID()); if (found != mPendingTransports.end()) mPendingTransports.erase(found); } { - auto found = mAnnouncedTransports.find(transport->getID()); + auto found = mAnnouncedTransports.find(transport->getRealID()); if (found != mAnnouncedTransports.end()) mAnnouncedTransports.erase(found); } continue; @@ -939,7 +937,7 @@ namespace ortc ISCTPTransportListenerSubscriptionPtr SCTPTransportListener::subscribe( ISCTPTransportListenerDelegatePtr originalDelegate, const Capabilities &remoteCapabilities - ) + ) noexcept { ZS_LOG_DETAIL(log("subscribing to transport listener")) @@ -955,7 +953,7 @@ namespace ortc { auto port = (*iter).second.second; UseSCTPTransportPtr transport = (*iter).second.first; - transport->start(*mRemoteCapabilities, port); + transport->startFromListener(*mRemoteCapabilities, port); } mPendingTransports.clear(); @@ -978,7 +976,7 @@ namespace ortc } //------------------------------------------------------------------------- - WORD SCTPTransportListener::allocateLocalPort(WORD remotePort) + WORD SCTPTransportListener::allocateLocalPort(WORD remotePort) noexcept { WORD maxSearching = mMaxAllocationPort - mMinAllocationPort; @@ -1020,7 +1018,7 @@ namespace ortc void SCTPTransportListener::allocatePort( AllocatedPortMap &useMap, WORD port - ) + ) noexcept { auto found = useMap.find(port); if (found == useMap.end()) { @@ -1036,7 +1034,7 @@ namespace ortc void SCTPTransportListener::deallocatePort( AllocatedPortMap &useMap, WORD port - ) + ) noexcept { auto found = useMap.find(port); if (found == useMap.end()) { @@ -1055,12 +1053,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportFactory - #pragma mark + // + // ISCTPTransportFactory + // //------------------------------------------------------------------------- - ISCTPTransportListenerFactory &ISCTPTransportListenerFactory::singleton() + ISCTPTransportListenerFactory &ISCTPTransportListenerFactory::singleton() noexcept { return SCTPTransportListenerFactory::singleton(); } @@ -1070,21 +1068,21 @@ namespace ortc ISCTPTransportListenerDelegatePtr delegate, IDTLSTransportPtr transport, const Capabilities &remoteCapabilities - ) + ) noexcept { if (this) {} return internal::SCTPTransportListener::listen(delegate, transport, remoteCapabilities); } //------------------------------------------------------------------------- - ISCTPTransportListenerFactory::ForSecureTransportPtr ISCTPTransportListenerFactory::create(UseSecureTransportPtr transport) + ISCTPTransportListenerFactory::ForSecureTransportPtr ISCTPTransportListenerFactory::create(UseSecureTransportPtr transport) noexcept { if (this) {} return internal::SCTPTransportListener::create(transport); } //------------------------------------------------------------------------- - ISCTPTransportFactory::CapabilitiesPtr ISCTPTransportListenerFactory::getCapabilities() + ISCTPTransportFactory::CapabilitiesPtr ISCTPTransportListenerFactory::getCapabilities() noexcept { if (this) {} return SCTPTransportListener::getCapabilities(); diff --git a/ortc/cpp/ortc_SRTPSDESTransport.cpp b/ortc/cpp/ortc_SRTPSDESTransport.cpp index e48fcca5..715229a9 100644 --- a/ortc/cpp/ortc_SRTPSDESTransport.cpp +++ b/ortc/cpp/ortc_SRTPSDESTransport.cpp @@ -1,4 +1,4 @@ -/* + /* Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. All rights reserved. @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -51,7 +53,7 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_srtp) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_srtp) } namespace ortc { @@ -70,37 +72,37 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransportSettingsDefaults - #pragma mark + // + // SRTPSDESTransportSettingsDefaults + // class SRTPSDESTransportSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~SRTPSDESTransportSettingsDefaults() + ~SRTPSDESTransportSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static SRTPSDESTransportSettingsDefaultsPtr singleton() + static SRTPSDESTransportSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static SRTPSDESTransportSettingsDefaultsPtr create() + static SRTPSDESTransportSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -108,14 +110,14 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { } }; //------------------------------------------------------------------------- - void installSRTPSDESTransportSettingsDefaults() + void installSRTPSDESTransportSettingsDefaults() noexcept { SRTPSDESTransportSettingsDefaults::singleton(); } @@ -124,15 +126,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => IStatsProvider - #pragma mark + // + // SRTPSDESTransport => IStatsProvider + // //------------------------------------------------------------------------- - IStatsProvider::PromiseWithStatsReportPtr SRTPSDESTransport::getStats(const StatsTypeSet &stats) const + IStatsProvider::PromiseWithStatsReportPtr SRTPSDESTransport::getStats(ZS_MAYBE_USED() const StatsTypeSet &stats) const noexcept { -#define TODO_COMPLETE 1 -#define TODO_COMPLETE 2 + ZS_MAYBE_USED(stats); +#pragma ZS_BUILD_NOTE("TODO","Implement getStats") return PromiseWithStatsReport::createRejected(IORTCForInternal::queueDelegate()); } @@ -140,9 +142,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport - #pragma mark + // + // SRTPSDESTransport + // //------------------------------------------------------------------------- SRTPSDESTransport::SRTPSDESTransport( @@ -150,14 +152,16 @@ namespace ortc IMessageQueuePtr queue, ISRTPSDESTransportDelegatePtr originalDelegate, IICETransportPtr iceTransport - ) : + ) noexcept(false) : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), + mSecureTransportSubscriptions(decltype(mSecureTransportSubscriptions)::create()), mICETransportRTP(ICETransport::convert(iceTransport)) { - ZS_LOG_DETAIL(debug("created")) + ZS_LOG_DETAIL(debug("created")); - ORTC_THROW_INVALID_PARAMETERS_IF(!mICETransportRTP) + ORTC_THROW_INVALID_PARAMETERS_IF(!mICETransportRTP); if (originalDelegate) { mDefaultSubscription = mSubscriptions.subscribe(originalDelegate, IORTCForInternal::queueDelegate()); @@ -168,7 +172,7 @@ namespace ortc void SRTPSDESTransport::init( const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -182,7 +186,7 @@ namespace ortc } //------------------------------------------------------------------------- - SRTPSDESTransport::~SRTPSDESTransport() + SRTPSDESTransport::~SRTPSDESTransport() noexcept { if (isNoop()) return; @@ -192,37 +196,37 @@ namespace ortc } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(ISRTPSDESTransportPtr object) + SRTPSDESTransportPtr SRTPSDESTransport::convert(ISRTPSDESTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, object); } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(ForRTPSenderPtr object) + SRTPSDESTransportPtr SRTPSDESTransport::convert(ForRTPSenderPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, object); } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(ForRTPReceiverPtr object) + SRTPSDESTransportPtr SRTPSDESTransport::convert(ForRTPReceiverPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, object); } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(ForICETransportPtr object) + SRTPSDESTransportPtr SRTPSDESTransport::convert(ForICETransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, object); } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(ForSRTPPtr object) + SRTPSDESTransportPtr SRTPSDESTransport::convert(ForSRTPPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, object); } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(ForRTPListenerPtr object) + SRTPSDESTransportPtr SRTPSDESTransport::convert(ForRTPListenerPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, object); } @@ -231,12 +235,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransport - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransport + // //------------------------------------------------------------------------- - ElementPtr SRTPSDESTransport::toDebug(SRTPSDESTransportPtr transport) + ElementPtr SRTPSDESTransport::toDebug(SRTPSDESTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -248,22 +252,22 @@ namespace ortc IICETransportPtr iceTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) + ) noexcept (false) { SRTPSDESTransportPtr pThis(make_shared(make_private{}, IORTCForInternal::queueORTC(), delegate, iceTransport)); - pThis->mThisWeak.lock(); + pThis->mThisWeak = pThis; pThis->init(encryptParameters, decryptParameters); return pThis; } //------------------------------------------------------------------------- - SRTPSDESTransportPtr SRTPSDESTransport::convert(IRTPTransportPtr rtpTransport) + SRTPSDESTransportPtr SRTPSDESTransport::convert(IRTPTransportPtr rtpTransport) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPSDESTransport, rtpTransport); } //------------------------------------------------------------------------- - ISRTPSDESTransportSubscriptionPtr SRTPSDESTransport::subscribe(ISRTPSDESTransportDelegatePtr originalDelegate) + ISRTPSDESTransportSubscriptionPtr SRTPSDESTransport::subscribe(ISRTPSDESTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -287,27 +291,27 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportPtr SRTPSDESTransport::transport() const + IICETransportPtr SRTPSDESTransport::transport() const noexcept { AutoRecursiveLock lock(*this); return ICETransport::convert(mICETransportRTP); } //------------------------------------------------------------------------- - IICETransportPtr SRTPSDESTransport::rtcpTransport() const + IICETransportPtr SRTPSDESTransport::rtcpTransport() const noexcept { AutoRecursiveLock lock(*this); return ICETransport::convert(fixRTCPTransport()); } //------------------------------------------------------------------------- - ISRTPSDESTransportTypes::ParametersPtr SRTPSDESTransport::getLocalParameters() + ISRTPSDESTransportTypes::ParametersPtr SRTPSDESTransport::getLocalParameters() noexcept { return UseSRTPTransport::getLocalParameters(); } //------------------------------------------------------------------------- - void SRTPSDESTransport::stop() + void SRTPSDESTransport::stop() noexcept { ZS_LOG_DEBUG(log("stop called")) @@ -319,20 +323,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransport - #pragma mark + // + // SRTPSDESTransport => ISecureTransport + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForRTPSender - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForRTPSender + // //------------------------------------------------------------------------- - ISecureTransportSubscriptionPtr SRTPSDESTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) + ISecureTransportSubscriptionPtr SRTPSDESTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to secure transport state")) @@ -358,8 +362,9 @@ namespace ortc } //------------------------------------------------------------------------- - ISecureTransportTypes::States SRTPSDESTransport::state(ISecureTransportTypes::States ignored) const + ISecureTransportTypes::States SRTPSDESTransport::state(ZS_MAYBE_USED() ISecureTransportTypes::States ignored) const noexcept { + ZS_MAYBE_USED(ignored); return mSecureTransportState; // no lock needed } @@ -369,7 +374,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_LOG_TRACE(log("sending packet") + ZS_PARAM("send over transport", IICETypes::toString(sendOverICETransport)) + ZS_PARAM("packet type", IICETypes::toString(packetType)) + ZS_PARAM("length", bufferLengthInBytes)) @@ -377,7 +382,7 @@ namespace ortc } //------------------------------------------------------------------------- - IICETransportPtr SRTPSDESTransport::getICETransport() const + IICETransportPtr SRTPSDESTransport::getICETransport() const noexcept { return ICETransport::convert(mICETransportRTP); } @@ -386,16 +391,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransportForICETransport - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransportForICETransport + // //------------------------------------------------------------------------- void SRTPSDESTransport::notifyAssociateTransportCreated( - IICETypes::Components associatedComponent, - ICETransportPtr assoicated - ) + ZS_MAYBE_USED() IICETypes::Components associatedComponent, + ZS_MAYBE_USED() ICETransportPtr assoicated + ) noexcept { + ZS_MAYBE_USED(associatedComponent); + ZS_MAYBE_USED(assoicated); } //------------------------------------------------------------------------- @@ -403,7 +410,7 @@ namespace ortc IICETypes::Components viaTransport, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_LOG_TRACE(log("handle receive packet") + ZS_PARAM("via component", IICETypes::toString(viaTransport)) + ZS_PARAM("length", bufferLengthInBytes)) @@ -421,7 +428,7 @@ namespace ortc void SRTPSDESTransport::handleReceivedSTUNPacket( IICETypes::Components viaComponent, STUNPacketPtr packet - ) + ) noexcept { ZS_LOG_TRACE(log("handle receive stun packet") + ZS_PARAM("via component", IICETypes::toString(viaComponent)) + packet->toDebug()) @@ -433,8 +440,7 @@ namespace ortc // scope: pre-validation check { AutoRecursiveLock lock(*this); -#define TODO_FIGURE_OUT_WHERE_TO_FORWARD_PACKET 1 -#define TODO_FIGURE_OUT_WHERE_TO_FORWARD_PACKET 2 +#pragma ZS_BUILD_NOTE("TODO","Any reason to forward on a STUN packet") } // WARNING: Forward packet to data channel or RTP listener outside of object lock @@ -444,9 +450,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForSRTPTransport - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForSRTPTransport + // //------------------------------------------------------------------------- bool SRTPSDESTransport::sendEncryptedPacket( @@ -454,7 +460,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { if (isShutdown()) { ZS_LOG_WARNING(Debug, log("cannot send packet on shutdown transport")) @@ -476,7 +482,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { if (isShutdown()) { ZS_LOG_WARNING(Debug, log("cannot receive packet on shutdown transport")) @@ -492,12 +498,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForRTPListener - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForRTPListener + // //------------------------------------------------------------------------- - RTPListenerPtr SRTPSDESTransport::getListener() const + RTPListenerPtr SRTPSDESTransport::getListener() const noexcept { return RTPListener::convert(mRTPListener); } @@ -507,9 +513,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransportAsyncDelegate - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransportAsyncDelegate + // //------------------------------------------------------------------------- void SRTPSDESTransport::onAttachRTCP() @@ -547,9 +553,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPTransportDelegate - #pragma mark + // + // SRTPSDESTransport => ISRTPTransportDelegate + // //------------------------------------------------------------------------- void SRTPSDESTransport::onSRTPTransportLifetimeRemaining( @@ -571,9 +577,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPTransportDelegate - #pragma mark + // + // SRTPSDESTransport => ISRTPTransportDelegate + // //------------------------------------------------------------------------- void SRTPSDESTransport::onICETransportStateChange( @@ -618,12 +624,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => (internal) - #pragma mark + // + // SRTPSDESTransport => (internal) + // //------------------------------------------------------------------------- - Log::Params SRTPSDESTransport::log(const char *message) const + Log::Params SRTPSDESTransport::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::SRTPSDESTransport"); IHelper::debugAppend(objectEl, "id", mID); @@ -631,13 +637,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params SRTPSDESTransport::debug(const char *message) const + Log::Params SRTPSDESTransport::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr SRTPSDESTransport::toDebug() const + ElementPtr SRTPSDESTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -668,19 +674,19 @@ namespace ortc } //------------------------------------------------------------------------- - bool SRTPSDESTransport::isShuttingDown() const + bool SRTPSDESTransport::isShuttingDown() const noexcept { return (bool)mGracefulShutdownReference; } //------------------------------------------------------------------------- - bool SRTPSDESTransport::isShutdown() const + bool SRTPSDESTransport::isShutdown() const noexcept { return mShutdown; } //------------------------------------------------------------------------- - void SRTPSDESTransport::step() + void SRTPSDESTransport::step() noexcept { if ((isShuttingDown()) || (isShutdown())) { @@ -697,7 +703,7 @@ namespace ortc } //------------------------------------------------------------------------- - bool SRTPSDESTransport::stepIceState() + bool SRTPSDESTransport::stepIceState() noexcept { auto state = mICETransportRTP->state(); @@ -723,7 +729,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SRTPSDESTransport::cancel() + void SRTPSDESTransport::cancel() noexcept { if (mShutdown) return; @@ -754,7 +760,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SRTPSDESTransport::setError(WORD errorCode, const char *inReason) + void SRTPSDESTransport::setError(WORD errorCode, const char *inReason) noexcept { String reason(inReason); if (reason.isEmpty()) { @@ -781,7 +787,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SRTPSDESTransport::setState(ISecureTransportTypes::States state) + void SRTPSDESTransport::setState(ISecureTransportTypes::States state) noexcept { if (state == mSecureTransportState) return; @@ -796,7 +802,7 @@ namespace ortc } //------------------------------------------------------------------------- - SRTPSDESTransport::UseICETransportPtr SRTPSDESTransport::fixRTCPTransport() const + SRTPSDESTransport::UseICETransportPtr SRTPSDESTransport::fixRTCPTransport() const noexcept { AutoRecursiveLock lock(*this); if (!mICETransportRTCP) { @@ -813,18 +819,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportFactory - #pragma mark + // + // ISRTPSDESTransportFactory + // //------------------------------------------------------------------------- - ISRTPSDESTransportFactory &ISRTPSDESTransportFactory::singleton() + ISRTPSDESTransportFactory &ISRTPSDESTransportFactory::singleton() noexcept { return SRTPSDESTransportFactory::singleton(); } //------------------------------------------------------------------------- - ISRTPSDESTransportFactory::ParametersPtr ISRTPSDESTransportFactory::getLocalParameters() + ISRTPSDESTransportFactory::ParametersPtr ISRTPSDESTransportFactory::getLocalParameters() noexcept { if (this) {} return internal::SRTPSDESTransport::getLocalParameters(); @@ -836,7 +842,7 @@ namespace ortc IICETransportPtr iceTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) + ) noexcept { if (this) {} return internal::SRTPSDESTransport::create(delegate, iceTransport, encryptParameters, decryptParameters); @@ -847,20 +853,20 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportTypes - #pragma mark + // + // ISRTPSDESTransportTypes + // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportTypes::CryptoParameters - #pragma mark + // + // ISRTPSDESTransportTypes::CryptoParameters + // //--------------------------------------------------------------------------- - ISRTPSDESTransportTypes::CryptoParameters::CryptoParameters(ElementPtr elem) + ISRTPSDESTransportTypes::CryptoParameters::CryptoParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -892,7 +898,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransportTypes::CryptoParameters::createElement(const char *objectName) const + ElementPtr ISRTPSDESTransportTypes::CryptoParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -924,13 +930,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransportTypes::CryptoParameters::toDebug() const + ElementPtr ISRTPSDESTransportTypes::CryptoParameters::toDebug() const noexcept { return createElement("ortc::ISRTPSDESTransportTypes::CryptoParameters"); } //--------------------------------------------------------------------------- - String ISRTPSDESTransportTypes::CryptoParameters::hash() const + String ISRTPSDESTransportTypes::CryptoParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -970,12 +976,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportTypes::Parameters - #pragma mark + // + // ISRTPSDESTransportTypes::Parameters + // //--------------------------------------------------------------------------- - ISRTPSDESTransportTypes::Parameters::Parameters(ElementPtr elem) + ISRTPSDESTransportTypes::Parameters::Parameters(ElementPtr elem) noexcept { if (!elem) return; @@ -994,7 +1000,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransportTypes::Parameters::createElement(const char *objectName) const + ElementPtr ISRTPSDESTransportTypes::Parameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1014,13 +1020,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransportTypes::Parameters::toDebug() const + ElementPtr ISRTPSDESTransportTypes::Parameters::toDebug() const noexcept { return createElement("ortc::ISRTPSDESTransportTypes::Parameters"); } //--------------------------------------------------------------------------- - String ISRTPSDESTransportTypes::Parameters::hash() const + String ISRTPSDESTransportTypes::Parameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1042,12 +1048,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportTypes::KeyParameters - #pragma mark + // + // ISRTPSDESTransportTypes::KeyParameters + // //--------------------------------------------------------------------------- - ISRTPSDESTransportTypes::KeyParameters::KeyParameters(ElementPtr elem) + ISRTPSDESTransportTypes::KeyParameters::KeyParameters(ElementPtr elem) noexcept { if (!elem) return; @@ -1059,7 +1065,7 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransportTypes::KeyParameters::createElement(const char *objectName) const + ElementPtr ISRTPSDESTransportTypes::KeyParameters::createElement(const char *objectName) const noexcept { ElementPtr elem = Element::create(objectName); @@ -1075,13 +1081,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransportTypes::KeyParameters::toDebug() const + ElementPtr ISRTPSDESTransportTypes::KeyParameters::toDebug() const noexcept { return createElement("ortc::ISRTPSDESTransportTypes::KeyParameters"); } //--------------------------------------------------------------------------- - String ISRTPSDESTransportTypes::KeyParameters::hash() const + String ISRTPSDESTransportTypes::KeyParameters::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1104,18 +1110,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransport - #pragma mark + // + // ISRTPSDESTransport + // //--------------------------------------------------------------------------- - ElementPtr ISRTPSDESTransport::toDebug(ISRTPSDESTransportPtr transport) + ElementPtr ISRTPSDESTransport::toDebug(ISRTPSDESTransportPtr transport) noexcept { return internal::SRTPSDESTransport::toDebug(internal::SRTPSDESTransport::convert(transport)); } //--------------------------------------------------------------------------- - ISRTPSDESTransportPtr ISRTPSDESTransport::convert(IRTPTransportPtr rtpTransport) + ISRTPSDESTransportPtr ISRTPSDESTransport::convert(IRTPTransportPtr rtpTransport) noexcept { return internal::SRTPSDESTransport::convert(rtpTransport); } @@ -1126,12 +1132,13 @@ namespace ortc IICETransportPtr iceTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) + ) noexcept { return internal::ISRTPSDESTransportFactory::singleton().create(delegate, iceTransport, encryptParameters, decryptParameters); } - ISRTPSDESTransport::ParametersPtr ISRTPSDESTransport::getLocalParameters() + //--------------------------------------------------------------------------- + ISRTPSDESTransport::ParametersPtr ISRTPSDESTransport::getLocalParameters() noexcept { return internal::ISRTPSDESTransportFactory::singleton().getLocalParameters(); } diff --git a/ortc/cpp/ortc_SRTPTransport.cpp b/ortc/cpp/ortc_SRTPTransport.cpp index 99a1951d..04a25dd2 100644 --- a/ortc/cpp/ortc_SRTPTransport.cpp +++ b/ortc/cpp/ortc_SRTPTransport.cpp @@ -29,6 +29,8 @@ */ +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + #include #include #include @@ -60,16 +62,9 @@ #endif //HAVE_TGMATH_H //libSRTP -#include "srtp.h" #include "srtp_priv.h" -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG - -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_srtp) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_srtp) } #define ORTC_SRTPTRANSPORT_ILLEGAL_MKI_LEGNTH (0xFFFF) @@ -93,9 +88,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // #ifndef SRTP_MASTER_KEY_LEN #define SRTP_MASTER_KEY_LEN (30) @@ -110,7 +105,7 @@ namespace ortc static size_t toRemainingPercent( size_t totalPackets, size_t maxPackets - ) + ) noexcept { if (0 == maxPackets) return 0; size_t consumed = (totalPackets * 100) / maxPackets; @@ -130,28 +125,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransportSettingsDefaults - #pragma mark + // + // SRTPTransportSettingsDefaults + // class SRTPTransportSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~SRTPTransportSettingsDefaults() + ~SRTPTransportSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static SRTPTransportSettingsDefaultsPtr singleton() + static SRTPTransportSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static SRTPTransportSettingsDefaultsPtr create() + static SRTPTransportSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -159,14 +154,14 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { } }; //------------------------------------------------------------------------- - void installSRTPTransportSettingsDefaults() + void installSRTPTransportSettingsDefaults() noexcept { SRTPTransportSettingsDefaults::singleton(); } @@ -175,12 +170,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportForSecureTransport - #pragma mark + // + // ISRTPTransportForSecureTransport + // //------------------------------------------------------------------------- - ISRTPTransportForSecureTransport::ParametersPtr ISRTPTransportForSecureTransport::getLocalParameters() + ISRTPTransportForSecureTransport::ParametersPtr ISRTPTransportForSecureTransport::getLocalParameters() noexcept { ParametersPtr params(make_shared()); @@ -216,7 +211,7 @@ namespace ortc } //------------------------------------------------------------------------- - ElementPtr ISRTPTransportForSecureTransport::toDebug(ForSecureTransportPtr transport) + ElementPtr ISRTPTransportForSecureTransport::toDebug(ForSecureTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return ZS_DYNAMIC_PTR_CAST(SRTPTransport, transport)->toDebug(); @@ -228,7 +223,7 @@ namespace ortc UseSecureTransportPtr transport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) + ) noexcept { return internal::ISRTPTransportFactory::singleton().create(delegate, transport, encryptParameters, decryptParameters); } @@ -238,12 +233,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport - #pragma mark + // + // SRTPTransport + // //------------------------------------------------------------------------- - bool SRTPTransport::MKIValueCompare::operator() (const SecureByteBlockPtr &op1, const SecureByteBlockPtr &op2) const + bool SRTPTransport::MKIValueCompare::operator() (const SecureByteBlockPtr &op1, const SecureByteBlockPtr &op2) const noexcept { if (!op1) { if (!op2) return false; @@ -255,7 +250,7 @@ namespace ortc } //------------------------------------------------------------------------- - const char *SRTPTransport::toString(Directions state) + const char *SRTPTransport::toString(Directions state) noexcept { switch (state) { case Direction_Encrypt: return "encrypt"; @@ -268,9 +263,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPInit - #pragma mark + // + // SRTPInit + // class SRTPInit : public ISingletonManagerDelegate { @@ -279,26 +274,26 @@ namespace ortc public: //----------------------------------------------------------------------- - SRTPInit(const make_private &) + SRTPInit(const make_private &) noexcept { ZS_LOG_BASIC(log("created")) } protected: //----------------------------------------------------------------------- - void init() + void init() noexcept { AutoRecursiveLock lock(mLock); int err = srtp_init(); - mInitialized = (err == err_status_ok); + mInitialized = (err == srtp_err_status_ok); if (!mInitialized) { ZS_LOG_ERROR(Trace, log("Failed to init SRTP") + ZS_PARAM("error", err)) } } //----------------------------------------------------------------------- - static SRTPInitPtr create() + static SRTPInitPtr create() noexcept { SRTPInitPtr pThis(make_shared(make_private{})); pThis->mThisWeak = pThis; @@ -308,7 +303,7 @@ namespace ortc public: //----------------------------------------------------------------------- - ~SRTPInit() + ~SRTPInit() noexcept { mThisWeak.reset(); ZS_LOG_BASIC(log("destroyed")) @@ -316,7 +311,7 @@ namespace ortc } //----------------------------------------------------------------------- - static SRTPInitPtr singleton() + static SRTPInitPtr singleton() noexcept { AutoRecursiveLock lock(*IHelper::getGlobalLock()); static SingletonLazySharedPtr singleton(create()); @@ -333,23 +328,23 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPInit => ISingletonManagerDelegate - #pragma mark + // + // SRTPInit => ISingletonManagerDelegate + // - virtual void notifySingletonCleanup() override + virtual void notifySingletonCleanup() noexcept override { // ignored } protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPInit => (internal) - #pragma mark + // + // SRTPInit => (internal) + // //----------------------------------------------------------------------- - Log::Params log(const char *message) const + Log::Params log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::SRTPInit"); IHelper::debugAppend(objectEl, "id", mID); @@ -357,19 +352,19 @@ namespace ortc } //----------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { return Log::Params(message, "ortc::SRTPInit"); } //----------------------------------------------------------------------- - Log::Params debug(const char *message) const + Log::Params debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //----------------------------------------------------------------------- - virtual ElementPtr toDebug() const + virtual ElementPtr toDebug() const noexcept { AutoRecursiveLock lock(mLock); ElementPtr resultEl = Element::create("ortc::SRTPInit"); @@ -380,7 +375,7 @@ namespace ortc } //----------------------------------------------------------------------- - void cancel() + void cancel() noexcept { ZS_LOG_DEBUG(log("cancel called")) @@ -396,9 +391,9 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPInit => (data) - #pragma mark + // + // SRTPInit => (data) + // AutoPUID mID; mutable RecursiveLock mLock; @@ -415,9 +410,10 @@ namespace ortc UseSecureTransportPtr secureTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) throw(InvalidParameters) : + ) noexcept(false) : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), + mSubscriptions(decltype(mSubscriptions)::create()), mSecureTransport(secureTransport), mSRTPInit(SRTPInit::singleton()) { @@ -499,14 +495,12 @@ namespace ortc memset(&policy, 0, sizeof(policy)); if (CS_AES_CM_128_HMAC_SHA1_80 == mParams[loop].mCryptoSuite) { - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); - } - else if (CS_AES_CM_128_HMAC_SHA1_32 == mParams[loop].mCryptoSuite) { - crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32, - crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80 - } - else { + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); + } else if (CS_AES_CM_128_HMAC_SHA1_32 == mParams[loop].mCryptoSuite) { + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32, + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80 + } else { ZS_LOG_WARNING(Detail, log("crypto suite is not understood") + mParams[loop].toDebug()) ORTC_THROW_INVALID_PARAMETERS("Crypto suite is not understood: " + mParams[loop].mCryptoSuite) } @@ -525,7 +519,7 @@ namespace ortc policy.next = NULL; int err = srtp_create(&keyingMaterial->mSRTPSession, &policy); - if (err != err_status_ok) { + if (err != srtp_err_status_ok) { keyingMaterial->mSRTPSession = NULL; ZS_LOG_ERROR(Debug, log("Failed to create SRTP session, err=") + ZS_PARAM("err=", err)) ORTC_THROW_INVALID_PARAMETERS("Failed to create SRTP session") @@ -565,14 +559,14 @@ namespace ortc } //------------------------------------------------------------------------- - void SRTPTransport::init() + void SRTPTransport::init() noexcept { //AutoRecursiveLock lock(*this); //IWakeDelegateProxy::create(mThisWeak.lock())->onWake(); } //------------------------------------------------------------------------- - SRTPTransport::~SRTPTransport() + SRTPTransport::~SRTPTransport() noexcept { if (isNoop()) return; @@ -584,13 +578,13 @@ namespace ortc } //------------------------------------------------------------------------- - SRTPTransportPtr SRTPTransport::convert(ISRTPTransportPtr object) + SRTPTransportPtr SRTPTransport::convert(ISRTPTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPTransport, object); } //------------------------------------------------------------------------- - SRTPTransportPtr SRTPTransport::convert(ForSecureTransportPtr object) + SRTPTransportPtr SRTPTransport::convert(ForSecureTransportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPTransport, object); } @@ -600,20 +594,20 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ISRTPTransport - #pragma mark + // + // SRTPTransport => ISRTPTransport + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ISRTPTransportForSecureTransport - #pragma mark + // + // SRTPTransport => ISRTPTransportForSecureTransport + // //------------------------------------------------------------------------- - ElementPtr SRTPTransport::toDebug(SRTPTransportPtr transport) + ElementPtr SRTPTransport::toDebug(SRTPTransportPtr transport) noexcept { if (!transport) return ElementPtr(); return transport->toDebug(); @@ -625,7 +619,7 @@ namespace ortc UseSecureTransportPtr transport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) throw(InvalidParameters) + ) noexcept(false) { SRTPTransportPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), delegate, transport, encryptParameters, decryptParameters)); pThis->mThisWeak = pThis; @@ -634,7 +628,7 @@ namespace ortc } //------------------------------------------------------------------------- - ISRTPTransportSubscriptionPtr SRTPTransport::subscribe(ISRTPTransportDelegatePtr originalDelegate) + ISRTPTransportSubscriptionPtr SRTPTransport::subscribe(ISRTPTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -662,7 +656,7 @@ namespace ortc IICETypes::Components viaTransport, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { UseSecureTransportPtr transport; SecureByteBlockPtr decryptedBuffer; @@ -736,8 +730,8 @@ namespace ortc return false; } - ASSERT(((bool)material.mTempMKIHolder)) // must be present - ASSERT(material.mMKILength == material.mTempMKIHolder->SizeInBytes()) // must be identical + ZS_ASSERT(((bool)material.mTempMKIHolder)); // must be present + ZS_ASSERT(material.mMKILength == material.mTempMKIHolder->SizeInBytes()); // must be identical memcpy(material.mTempMKIHolder->BytePtr(), packetMKI, material.mTempMKIHolder->SizeInBytes()); @@ -766,7 +760,7 @@ namespace ortc // NOTE: oldKey and nextKey might be null if there is no older key or // next key. However, currentKey must be valid. - ASSERT(((bool)usedKeys[UsedKey_Current])) + ZS_ASSERT(((bool)usedKeys[UsedKey_Current])); if (!usedKeys[UsedKey_Current]) { ZS_LOG_ERROR(Debug, log("no keying material found to decrypt packet") + ZS_PARAM("buffer length in bytes", bufferLengthInBytes)) @@ -774,7 +768,7 @@ namespace ortc } } - ASSERT(((bool)transport)) + ZS_ASSERT(((bool)transport)); if (material.mMKILength > 0) { // As part of the decryption process, the MKI value must be stripped from @@ -814,11 +808,11 @@ namespace ortc AutoLock lock(usedKeys[loop]->mSRTPSessionLock); int err = (component == IICETypes::Component_RTP ? srtp_unprotect(usedKeys[loop]->mSRTPSession, decryptedBuffer->BytePtr(), &out_len) : srtp_unprotect_rtcp(usedKeys[loop]->mSRTPSession, decryptedBuffer->BytePtr(), &out_len)); - if (err == err_status_replay_fail) { + if (err == srtp_err_status_replay_fail) { return true; } - if (err != err_status_ok) { + if (err != srtp_err_status_ok) { ZS_LOG_WARNING(Trace, log("cannot use current keying material, trying with next key") + usedKeys[loop]->toDebug()) continue; } @@ -840,7 +834,7 @@ namespace ortc return false; } - ASSERT(((bool)usedKeys[decryptedWithKey])); + ZS_ASSERT(((bool)usedKeys[decryptedWithKey])); // need to update the usage of the key (depending on which key was acutally used for decrypting) { @@ -862,10 +856,10 @@ namespace ortc } } - ASSERT(((bool)decryptedBuffer)); - ASSERT(out_len > 0); + ZS_ASSERT(((bool)decryptedBuffer)); + ZS_ASSERT(out_len > 0); - ASSERT(out_len <= SafeInt(decryptedBuffer->SizeInBytes())); + ZS_ASSERT(out_len <= SafeInt(decryptedBuffer->SizeInBytes())); ZS_LOG_INSANE(log("forwarding packet to secure transport") + ZS_PARAM("via", IICETypes::toString(viaTransport)) + ZS_PARAM("component", IICETypes::toString(component)) + ZS_PARAM("buffer length in bytes", decryptedBuffer->SizeInBytes())); @@ -887,7 +881,7 @@ namespace ortc IICETypes::Components packetType, // is packet RTP or RTCP const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { ZS_EVENTING_5( x, i, Trace, SrtpTransportSendOutgoingPacketAndEncrypt, ol, SrtpTransport, Send, @@ -932,7 +926,7 @@ namespace ortc keyingMaterial = material.mKeyList.front(); - ASSERT(((bool)keyingMaterial)) + ZS_ASSERT(((bool)keyingMaterial)) if (keyingMaterial->mTotalPackets[packetType] + 1 > keyingMaterial->mLifetime) { ZS_LOG_WARNING(Debug, log("cannot use keying material as it's lifetime is exhausted") + keyingMaterial->toDebug()) @@ -972,7 +966,7 @@ namespace ortc //} } - if (err != err_status_ok) { + if (err != srtp_err_status_ok) { ZS_LOG_WARNING(Debug, log("cannot use current keying material for encryption") + keyingMaterial->toDebug()) return false; } @@ -991,10 +985,10 @@ namespace ortc } - ASSERT(((bool)transport)); - ASSERT(((bool)encryptedBuffer)); + ZS_ASSERT(((bool)transport)); + ZS_ASSERT(((bool)encryptedBuffer)); - ASSERT(out_len <= SafeInt(encryptedBuffer->SizeInBytes())); + ZS_ASSERT(out_len <= SafeInt(encryptedBuffer->SizeInBytes())); // do NOT call this method from within a lock ZS_EVENTING_6( @@ -1013,9 +1007,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => IWakeDelegate - #pragma mark + // + // SRTPTransport => IWakeDelegate + // //------------------------------------------------------------------------- void SRTPTransport::onWake() @@ -1029,9 +1023,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ITimerDelegate - #pragma mark + // + // SRTPTransport => ITimerDelegate + // //------------------------------------------------------------------------- void SRTPTransport::onTimer(ITimerPtr timer) @@ -1045,21 +1039,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ISRTPTransportAsyncDelegate - #pragma mark + // + // SRTPTransport => ISRTPTransportAsyncDelegate + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => (internal) - #pragma mark + // + // SRTPTransport => (internal) + // //------------------------------------------------------------------------- - Log::Params SRTPTransport::log(const char *message) const + Log::Params SRTPTransport::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::SRTPTransport"); IHelper::debugAppend(objectEl, "id", mID); @@ -1067,20 +1061,20 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params SRTPTransport::slog(const char *message) + Log::Params SRTPTransport::slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::SRTPTransport"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - Log::Params SRTPTransport::debug(const char *message) const + Log::Params SRTPTransport::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr SRTPTransport::toDebug() const + ElementPtr SRTPTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1108,7 +1102,7 @@ namespace ortc } //------------------------------------------------------------------------- - void SRTPTransport::cancel() + void SRTPTransport::cancel() noexcept { //....................................................................... mSRTPInit.reset(); @@ -1127,7 +1121,7 @@ namespace ortc Directions direction, IICETypes::Components component, KeyingMaterialPtr &keyingMaterial - ) + ) noexcept { size_t &totalKeyPackets = (keyingMaterial->mTotalPackets[component]); size_t lifetimeKey = (keyingMaterial->mLifetime); @@ -1162,7 +1156,7 @@ namespace ortc } //------------------------------------------------------------------------- - size_t SRTPTransport::parseLifetime(const String &lifetime) throw(InvalidParameters) + size_t SRTPTransport::parseLifetime(const String &lifetime) noexcept(false) { ORTC_THROW_INVALID_PARAMETERS_IF(lifetime.isEmpty()) @@ -1205,21 +1199,18 @@ namespace ortc ) #endif //HAVE_TGMATH_H ; - } - catch (...) { + } catch (...) { ZS_LOG_ERROR(Detail, slog("unable to parse lifetime") + ZS_PARAM("lifetime", lifetime)) ORTC_THROW_INVALID_PARAMETERS("unable to parse lifetime:" + lifetime) } - ASSERT(false) // should never hit this point - return 0; } //------------------------------------------------------------------------- SecureByteBlockPtr SRTPTransport::convertIntegerToBigEndianEncodedBuffer( const String &base10Value, size_t maxByteLength - ) throw(InvalidParameters) + ) noexcept(false) { SecureByteBlockPtr output(make_shared(maxByteLength)); @@ -1246,12 +1237,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport::KeyingMaterial - #pragma mark + // + // SRTPTransport::KeyingMaterial + // //------------------------------------------------------------------------- - ElementPtr SRTPTransport::KeyingMaterial::toDebug() const + ElementPtr SRTPTransport::KeyingMaterial::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::SRTPTransport::KeyingMaterial"); @@ -1277,7 +1268,7 @@ namespace ortc } //------------------------------------------------------------------------- - String SRTPTransport::KeyingMaterial::hash() const + String SRTPTransport::KeyingMaterial::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1302,12 +1293,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport::DirectionMaterial - #pragma mark + // + // SRTPTransport::DirectionMaterial + // //------------------------------------------------------------------------- - ElementPtr SRTPTransport::DirectionMaterial::toDebug() const + ElementPtr SRTPTransport::DirectionMaterial::toDebug() const noexcept { ElementPtr resultEl = Element::create("ortc::SRTPTransport::DirectionMaterial"); @@ -1334,7 +1325,7 @@ namespace ortc } //------------------------------------------------------------------------- - String SRTPTransport::DirectionMaterial::hash() const + String SRTPTransport::DirectionMaterial::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1367,12 +1358,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportFactory - #pragma mark + // + // ISRTPTransportFactory + // //------------------------------------------------------------------------- - ISRTPTransportFactory &ISRTPTransportFactory::singleton() + ISRTPTransportFactory &ISRTPTransportFactory::singleton() noexcept { return SRTPTransportFactory::singleton(); } @@ -1383,7 +1374,7 @@ namespace ortc UseSecureTransportPtr transport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) + ) noexcept { if (this) {} return internal::SRTPTransport::create(delegate, transport, encryptParameters, decryptParameters); diff --git a/ortc/cpp/ortc_StatsReport.cpp b/ortc/cpp/ortc_StatsReport.cpp index a1acf203..3b8ec75a 100644 --- a/ortc/cpp/ortc_StatsReport.cpp +++ b/ortc/cpp/ortc_StatsReport.cpp @@ -52,15 +52,10 @@ #include -#ifdef _DEBUG -#define ASSERT(x) ZS_THROW_BAD_STATE_IF(!(x)) -#else -#define ASSERT(x) -#endif //_DEBUG using namespace date; -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_stats) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_stats) } namespace ortc { @@ -79,19 +74,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- - static Log::Params slog(const char *message) + static Log::Params slog(const char *message) noexcept { ElementPtr objectEl = Element::create("ortc::StatsReport"); return Log::Params(message, objectEl); } //------------------------------------------------------------------------- - static double getTimestamp(const Time &originalTimestamp) + static double getTimestamp(const Time &originalTimestamp) noexcept { // Time since 1970-01-01T00:00:00Z in milliseconds. auto t = day_point(jan / 1 / 1601); @@ -102,7 +97,7 @@ namespace ortc } //------------------------------------------------------------------------- - static void reportInt32(const char *reportID, double timestamp, const char *statName, int32_t value) + static void reportInt32(const char *reportID, double timestamp, const char *statName, int32_t value) noexcept { ZS_EVENTING_4( x, i, Debug, StatsReportInt32, ols, Stats, Info, @@ -116,7 +111,7 @@ namespace ortc } //------------------------------------------------------------------------- - static void reportInt64(const char *reportID, double timestamp, const char *statName, int64_t value) + static void reportInt64(const char *reportID, double timestamp, const char *statName, int64_t value) noexcept { ZS_EVENTING_4( x, i, Debug, StatsReportInt64, ols, Stats, Info, @@ -131,7 +126,7 @@ namespace ortc } //------------------------------------------------------------------------- - static void reportFloat(const char *reportID, double timestamp, const char *statName, float value) + static void reportFloat(const char *reportID, double timestamp, const char *statName, float value) noexcept { ZS_EVENTING_4( x, i, Debug, StatsReportFloat, ols, Stats, Info, @@ -146,7 +141,7 @@ namespace ortc } //------------------------------------------------------------------------- - static void reportBool(const char *reportID, double timestamp, const char *statName, bool value) + static void reportBool(const char *reportID, double timestamp, const char *statName, bool value) noexcept { ZS_EVENTING_4( x, i, Debug, StatsReportBool, ols, Stats, Info, @@ -160,7 +155,7 @@ namespace ortc } //------------------------------------------------------------------------- - static void reportString(const char *reportID, double timestamp, const char *statName, const char *value) + static void reportString(const char *reportID, double timestamp, const char *statName, const char *value) noexcept { ZS_EVENTING_4( x, i, Debug, StatsReportString, ols, Stats, Info, @@ -178,28 +173,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReportSettingsDefaults - #pragma mark + // + // StatsReportSettingsDefaults + // class StatsReportSettingsDefaults : public ISettingsApplyDefaultsDelegate { public: //----------------------------------------------------------------------- - ~StatsReportSettingsDefaults() + ~StatsReportSettingsDefaults() noexcept { ISettings::removeDefaults(*this); } //----------------------------------------------------------------------- - static StatsReportSettingsDefaultsPtr singleton() + static StatsReportSettingsDefaultsPtr singleton() noexcept { static SingletonLazySharedPtr singleton(create()); return singleton.singleton(); } //----------------------------------------------------------------------- - static StatsReportSettingsDefaultsPtr create() + static StatsReportSettingsDefaultsPtr create() noexcept { auto pThis(make_shared()); ISettings::installDefaults(pThis); @@ -207,7 +202,7 @@ namespace ortc } //----------------------------------------------------------------------- - virtual void notifySettingsApplyDefaults() override + virtual void notifySettingsApplyDefaults() noexcept override { // ISettings::setUInt(ORTC_SETTING_STATS_REPORT_, 0); } @@ -215,7 +210,7 @@ namespace ortc }; //------------------------------------------------------------------------- - void installStatsReportSettingsDefaults() + void installStatsReportSettingsDefaults() noexcept { StatsReportSettingsDefaults::singleton(); } @@ -224,12 +219,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportForInternal - #pragma mark + // + // IStatsReportForInternal + // //------------------------------------------------------------------------- - StatsReportPtr IStatsReportForInternal::create(const StatMap &stats) + StatsReportPtr IStatsReportForInternal::create(const StatMap &stats) noexcept { return IStatsReportFactory::singleton().create(stats); } @@ -238,7 +233,7 @@ namespace ortc IStatsReportForInternal::PromiseWithStatsReportPtr IStatsReportForInternal::collectReports( const PromiseWithStatsReportList &promises, PromiseWithStatsReportPtr previouslyCreatedPromiseToResolve - ) + ) noexcept { return IStatsReportFactory::singleton().collectReports(promises, previouslyCreatedPromiseToResolve); } @@ -247,16 +242,16 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport - #pragma mark + // + // StatsReport + // //------------------------------------------------------------------------- StatsReport::StatsReport( const make_private &, IMessageQueuePtr queue, const StatMap &stats - ) : + ) noexcept : MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()), mStats(stats) @@ -265,7 +260,7 @@ namespace ortc } //------------------------------------------------------------------------- - void StatsReport::init() + void StatsReport::init() noexcept { } @@ -273,7 +268,7 @@ namespace ortc void StatsReport::init( PromiseWithStatsReportPtr resolvePromise, const PromiseWithStatsReportList &promises - ) + ) noexcept { bool resolveNow = false; auto pThis = mThisWeak.lock(); @@ -301,7 +296,7 @@ namespace ortc } //------------------------------------------------------------------------- - StatsReport::~StatsReport() + StatsReport::~StatsReport() noexcept { if (isNoop()) return; @@ -312,13 +307,13 @@ namespace ortc } //------------------------------------------------------------------------- - StatsReportPtr StatsReport::convert(IStatsReportPtr object) + StatsReportPtr StatsReport::convert(IStatsReportPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(StatsReport, object); } //------------------------------------------------------------------------- - StatsReportPtr StatsReport::convert(ForInternalPtr object) + StatsReportPtr StatsReport::convert(ForInternalPtr object) noexcept { return ZS_DYNAMIC_PTR_CAST(StatsReport, object); } @@ -327,19 +322,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => IStatsReport - #pragma mark + // + // StatsReport => IStatsReport + // //------------------------------------------------------------------------- - ElementPtr StatsReport::toDebug(StatsReportPtr report) + ElementPtr StatsReport::toDebug(StatsReportPtr report) noexcept { if (!report) return ElementPtr(); return report->toDebug(); } //------------------------------------------------------------------------- - IStatsReportTypes::IDListPtr StatsReport::getStatesIDs() const + IStatsReportTypes::IDListPtr StatsReport::getStatesIDs() const noexcept { IDListPtr result(make_shared()); AutoRecursiveLock lock(*this); @@ -351,7 +346,7 @@ namespace ortc } //------------------------------------------------------------------------- - IStatsReportTypes::StatsPtr StatsReport::getStats(const char *id) const + IStatsReportTypes::StatsPtr StatsReport::getStats(const char *id) const noexcept { AutoRecursiveLock lock(*this); @@ -365,12 +360,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => IStatsReportForInternal - #pragma mark + // + // StatsReport => IStatsReportForInternal + // //------------------------------------------------------------------------- - StatsReportPtr StatsReport::create(const StatMap &stats) + StatsReportPtr StatsReport::create(const StatMap &stats) noexcept { StatsReportPtr pThis(make_shared(make_private {}, IORTCForInternal::queueORTC(), stats)); pThis->mThisWeak = pThis; @@ -382,7 +377,7 @@ namespace ortc StatsReport::PromiseWithStatsReportPtr StatsReport::collectReports( const PromiseWithStatsReportList &promises, PromiseWithStatsReportPtr previouslyCreatedPromiseToResolve - ) + ) noexcept { StatsReportPtr pThis(make_shared(make_private{}, IORTCForInternal::queueORTC(), StatMap())); pThis->mThisWeak = pThis; @@ -398,9 +393,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => IPromiseSettledDelegate - #pragma mark + // + // StatsReport => IPromiseSettledDelegate + // //------------------------------------------------------------------------- void StatsReport::onPromiseSettled(PromisePtr promise) @@ -446,12 +441,12 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => (internal) - #pragma mark + // + // StatsReport => (internal) + // //------------------------------------------------------------------------- - Log::Params StatsReport::log(const char *message) const + Log::Params StatsReport::log(const char *message) const noexcept { ElementPtr objectEl = Element::create("ortc::StatsReport"); IHelper::debugAppend(objectEl, "id", mID); @@ -459,13 +454,13 @@ namespace ortc } //------------------------------------------------------------------------- - Log::Params StatsReport::debug(const char *message) const + Log::Params StatsReport::debug(const char *message) const noexcept { return Log::Params(message, toDebug()); } //------------------------------------------------------------------------- - ElementPtr StatsReport::toDebug() const + ElementPtr StatsReport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -498,7 +493,7 @@ namespace ortc } //------------------------------------------------------------------------- - void StatsReport::cancel() + void StatsReport::cancel() noexcept { //....................................................................... // final cleanup @@ -511,18 +506,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportFactory - #pragma mark + // + // IStatsReportFactory + // //------------------------------------------------------------------------- - IStatsReportFactory &IStatsReportFactory::singleton() + IStatsReportFactory &IStatsReportFactory::singleton() noexcept { return StatsReportFactory::singleton(); } //------------------------------------------------------------------------- - StatsReportPtr IStatsReportFactory::create(const StatMap &stats) + StatsReportPtr IStatsReportFactory::create(const StatMap &stats) noexcept { if (this) {} return internal::StatsReport::create(stats); @@ -532,7 +527,7 @@ namespace ortc IStatsReportFactory::PromiseWithStatsReportPtr IStatsReportFactory::collectReports( const PromiseWithStatsReportList &promises, PromiseWithStatsReportPtr previouslyCreatedPromiseToResolve - ) + ) noexcept { if (this) {} return internal::StatsReport::collectReports(promises, previouslyCreatedPromiseToResolve); @@ -545,12 +540,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes - #pragma mark + // + // IStatsReportTypes + // //--------------------------------------------------------------------------- - Optional IStatsReportTypes::toStatsType(const char *type) + Optional IStatsReportTypes::toStatsType(const char *type) noexcept { String str(type); for (IStatsReportTypes::StatsTypes index = IStatsReportTypes::StatsType_First; index <= IStatsReportTypes::StatsType_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -561,7 +556,7 @@ namespace ortc } //--------------------------------------------------------------------------- - const char *IStatsReportTypes::toString(StatsTypes type) + const char *IStatsReportTypes::toString(StatsTypes type) noexcept { switch (type) { @@ -587,14 +582,14 @@ namespace ortc } //--------------------------------------------------------------------------- - const char *IStatsReportTypes::toString(const Optional &type) + const char *IStatsReportTypes::toString(const Optional &type) noexcept { if (!type.hasValue()) return ""; return toString(type.value()); } //--------------------------------------------------------------------------- - Optional IStatsReportTypes::toCandidatePairState(const char *type) + Optional IStatsReportTypes::toCandidatePairState(const char *type) noexcept { String str(type); for (IStatsReportTypes::StatsICECandidatePairStates index = IStatsReportTypes::StatsICECandidatePairState_First; index <= IStatsReportTypes::StatsICECandidatePairState_Last; index = static_cast(static_cast::type>(index) + 1)) { @@ -605,7 +600,7 @@ namespace ortc } //--------------------------------------------------------------------------- - const char *IStatsReportTypes::toString(StatsICECandidatePairStates state) + const char *IStatsReportTypes::toString(StatsICECandidatePairStates state) noexcept { switch (state) { @@ -621,7 +616,7 @@ namespace ortc } //--------------------------------------------------------------------------- - bool IStatsReportTypes::StatsTypeSet::hasStatType(StatsTypes type) const + bool IStatsReportTypes::StatsTypeSet::hasStatType(StatsTypes type) const noexcept { if (size() < 1) return true; @@ -634,19 +629,19 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::Stats - #pragma mark + // + // IStatsReportTypes::Stats + // //--------------------------------------------------------------------------- - IStatsReportTypes::Stats::Stats() : + IStatsReportTypes::Stats::Stats() noexcept : mTimestamp(zsLib::now()), mStatsType(IStatsReportTypes::StatsType_First) { } //--------------------------------------------------------------------------- - IStatsReportTypes::Stats::Stats(const Stats &op2) : + IStatsReportTypes::Stats::Stats(const Stats &op2) noexcept : mTimestamp(op2.mTimestamp), mStatsType(op2.mStatsType), mStatsTypeOther(op2.mStatsTypeOther), @@ -655,7 +650,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::Stats::Stats(ElementPtr rootEl) + IStatsReportTypes::Stats::Stats(ElementPtr rootEl) noexcept { if (!rootEl) return; @@ -672,7 +667,34 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::StatsPtr IStatsReportTypes::Stats::create(ElementPtr rootEl) + IStatsReportTypes::StatsPtr IStatsReportTypes::Stats::create(const Stats &source) noexcept + { + if (!source.mStatsType.hasValue()) return make_shared(source); + switch (source.mStatsType.value()) + { + case StatsType_InboundRTP: return make_shared(dynamic_cast(source)); + case StatsType_OutboundRTP: return make_shared(dynamic_cast(source)); + case StatsType_Codec: return make_shared(dynamic_cast(source)); + case StatsType_SCTPTransport: return make_shared(dynamic_cast(source)); + case StatsType_DataChannel: return make_shared(dynamic_cast(source)); + case StatsType_Stream: return make_shared(dynamic_cast(source)); + case StatsType_Track: return make_shared(dynamic_cast(source)); + case StatsType_ICEGatherer: return make_shared(dynamic_cast(source)); + case StatsType_ICETransport: return make_shared(dynamic_cast(source)); + case StatsType_DTLSTransport: return make_shared(dynamic_cast(source)); + case StatsType_SRTPTransport: return make_shared(dynamic_cast(source)); + case StatsType_Certificate: return make_shared(dynamic_cast(source)); + case StatsType_Candidate: return make_shared(dynamic_cast(source)); + case StatsType_CandidatePair: return make_shared(dynamic_cast(source)); + case StatsType_LocalCandidate: return make_shared(dynamic_cast(source)); + case StatsType_RemoteCandidate: return make_shared(dynamic_cast(source)); + } + + return StatsPtr(); + } + + //--------------------------------------------------------------------------- + IStatsReportTypes::StatsPtr IStatsReportTypes::Stats::create(ElementPtr rootEl) noexcept { if (!rootEl) return StatsPtr(); @@ -703,13 +725,13 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::StatsPtr IStatsReportTypes::Stats::convert(AnyPtr any) + IStatsReportTypes::StatsPtr IStatsReportTypes::Stats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Stats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::Stats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::Stats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Element::create(objectName); @@ -723,13 +745,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::Stats::toDebug() const + ElementPtr IStatsReportTypes::Stats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::Stats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::Stats::hash() const + String IStatsReportTypes::Stats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -745,7 +767,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::Stats::eventTrace() const + void IStatsReportTypes::Stats::eventTrace() const noexcept { auto timestamp = internal::getTimestamp(mTimestamp); eventTrace(timestamp); @@ -753,7 +775,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::Stats::eventTrace(double timestamp) const + void IStatsReportTypes::Stats::eventTrace(double timestamp) const noexcept { internal::reportString(mID, timestamp, "statsType", statsType()); } @@ -762,12 +784,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::RTPStreamStats - #pragma mark + // + // IStatsReportTypes::RTPStreamStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::RTPStreamStats::RTPStreamStats(const RTPStreamStats &op2) : + IStatsReportTypes::RTPStreamStats::RTPStreamStats(const RTPStreamStats &op2) noexcept : Stats(op2), mSSRC(op2.mSSRC), mAssociatedStatID(op2.mAssociatedStatID), @@ -784,7 +806,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::RTPStreamStats::RTPStreamStats(ElementPtr rootEl) : + IStatsReportTypes::RTPStreamStats::RTPStreamStats(ElementPtr rootEl) noexcept : Stats(rootEl) { if (!rootEl) return; @@ -803,20 +825,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::RTPStreamStatsPtr IStatsReportTypes::RTPStreamStats::create(ElementPtr rootEl) + IStatsReportTypes::RTPStreamStatsPtr IStatsReportTypes::RTPStreamStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return RTPStreamStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::RTPStreamStatsPtr IStatsReportTypes::RTPStreamStats::convert(AnyPtr any) + IStatsReportTypes::RTPStreamStatsPtr IStatsReportTypes::RTPStreamStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(RTPStreamStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::RTPStreamStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::RTPStreamStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -838,13 +860,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::RTPStreamStats::toDebug() const + ElementPtr IStatsReportTypes::RTPStreamStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::RTPStreamStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::RTPStreamStats::hash() const + String IStatsReportTypes::RTPStreamStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -878,7 +900,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::RTPStreamStats::eventTrace(double timestamp) const + void IStatsReportTypes::RTPStreamStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -901,12 +923,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::Codec - #pragma mark + // + // IStatsReportTypes::Codec + // //--------------------------------------------------------------------------- - IStatsReportTypes::Codec::Codec(const Codec &op2) : + IStatsReportTypes::Codec::Codec(const Codec &op2) noexcept : Stats(op2), mPayloadType(op2.mPayloadType), mCodec(op2.mCodec), @@ -917,7 +939,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::Codec::Codec(ElementPtr rootEl) : + IStatsReportTypes::Codec::Codec(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_Codec; @@ -932,20 +954,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::CodecPtr IStatsReportTypes::Codec::create(ElementPtr rootEl) + IStatsReportTypes::CodecPtr IStatsReportTypes::Codec::create(ElementPtr rootEl) noexcept { if (!rootEl) return CodecPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::CodecPtr IStatsReportTypes::Codec::convert(AnyPtr any) + IStatsReportTypes::CodecPtr IStatsReportTypes::Codec::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(Codec, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::Codec::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::Codec::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -961,13 +983,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::Codec::toDebug() const + ElementPtr IStatsReportTypes::Codec::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::Codec"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::Codec::hash() const + String IStatsReportTypes::Codec::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -990,7 +1012,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::Codec::eventTrace(double timestamp) const + void IStatsReportTypes::Codec::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1009,12 +1031,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::InboundRTPStreamStats - #pragma mark + // + // IStatsReportTypes::InboundRTPStreamStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::InboundRTPStreamStats::InboundRTPStreamStats(const InboundRTPStreamStats &op2) : + IStatsReportTypes::InboundRTPStreamStats::InboundRTPStreamStats(const InboundRTPStreamStats &op2) noexcept : RTPStreamStats(op2), mPacketsReceived(op2.mPacketsReceived), mBytesReceived(op2.mBytesReceived), @@ -1026,7 +1048,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::InboundRTPStreamStats::InboundRTPStreamStats(ElementPtr rootEl) : + IStatsReportTypes::InboundRTPStreamStats::InboundRTPStreamStats(ElementPtr rootEl) noexcept : RTPStreamStats(rootEl) { mStatsType = IStatsReportTypes::StatsType_InboundRTP; @@ -1042,20 +1064,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::InboundRTPStreamStatsPtr IStatsReportTypes::InboundRTPStreamStats::create(ElementPtr rootEl) + IStatsReportTypes::InboundRTPStreamStatsPtr IStatsReportTypes::InboundRTPStreamStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return InboundRTPStreamStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::InboundRTPStreamStatsPtr IStatsReportTypes::InboundRTPStreamStats::convert(AnyPtr any) + IStatsReportTypes::InboundRTPStreamStatsPtr IStatsReportTypes::InboundRTPStreamStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(InboundRTPStreamStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::InboundRTPStreamStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::InboundRTPStreamStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = RTPStreamStats::createElement(objectName); @@ -1072,13 +1094,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::InboundRTPStreamStats::toDebug() const + ElementPtr IStatsReportTypes::InboundRTPStreamStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::InboundRTPStreamStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::InboundRTPStreamStats::hash() const + String IStatsReportTypes::InboundRTPStreamStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1103,7 +1125,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::InboundRTPStreamStats::eventTrace(double timestamp) const + void IStatsReportTypes::InboundRTPStreamStats::eventTrace(double timestamp) const noexcept { RTPStreamStats::eventTrace(timestamp); @@ -1114,7 +1136,7 @@ namespace ortc internal::reportFloat(mID, timestamp, "fractionLost", static_cast(mFractionLost)); internal::reportInt64(mID, timestamp, "endToEndDelay", SafeInt(mEndToEndDelay.count())); #ifndef ORTC_EXCLUDE_WEBRTC_COMPATIBILITY_STATS - internal::reportInt64(mID, timestamp, "winrtEndToEndDelayMs", SafeInt(mEndToEndDelay.count())); + internal::reportInt64(mID, timestamp, "winuwpEndToEndDelayMs", SafeInt(mEndToEndDelay.count())); internal::reportInt32(mID, timestamp, "googFirsReceived", SafeInt(mFIRCount)); internal::reportInt32(mID, timestamp, "googPlisReceived", SafeInt(mPLICount)); internal::reportInt32(mID, timestamp, "googNacksReceived", SafeInt(mNACKCount)); @@ -1125,12 +1147,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::OutboundRTPStreamStats - #pragma mark + // + // IStatsReportTypes::OutboundRTPStreamStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::OutboundRTPStreamStats::OutboundRTPStreamStats(const OutboundRTPStreamStats &op2) : + IStatsReportTypes::OutboundRTPStreamStats::OutboundRTPStreamStats(const OutboundRTPStreamStats &op2) noexcept : RTPStreamStats(op2), mPacketsSent(op2.mPacketsSent), mBytesSent(op2.mBytesSent), @@ -1140,7 +1162,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::OutboundRTPStreamStats::OutboundRTPStreamStats(ElementPtr rootEl) : + IStatsReportTypes::OutboundRTPStreamStats::OutboundRTPStreamStats(ElementPtr rootEl) noexcept : RTPStreamStats(rootEl) { mStatsType = IStatsReportTypes::StatsType_OutboundRTP; @@ -1154,20 +1176,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::OutboundRTPStreamStatsPtr IStatsReportTypes::OutboundRTPStreamStats::create(ElementPtr rootEl) + IStatsReportTypes::OutboundRTPStreamStatsPtr IStatsReportTypes::OutboundRTPStreamStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return OutboundRTPStreamStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::OutboundRTPStreamStatsPtr IStatsReportTypes::OutboundRTPStreamStats::convert(AnyPtr any) + IStatsReportTypes::OutboundRTPStreamStatsPtr IStatsReportTypes::OutboundRTPStreamStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(OutboundRTPStreamStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::OutboundRTPStreamStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::OutboundRTPStreamStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = RTPStreamStats::createElement(objectName); @@ -1182,13 +1204,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::OutboundRTPStreamStats::toDebug() const + ElementPtr IStatsReportTypes::OutboundRTPStreamStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::OutboundRTPStreamStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::OutboundRTPStreamStats::hash() const + String IStatsReportTypes::OutboundRTPStreamStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1208,7 +1230,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::OutboundRTPStreamStats::eventTrace(double timestamp) const + void IStatsReportTypes::OutboundRTPStreamStats::eventTrace(double timestamp) const noexcept { RTPStreamStats::eventTrace(timestamp); @@ -1229,12 +1251,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::SCTPTransportStats - #pragma mark + // + // IStatsReportTypes::SCTPTransportStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::SCTPTransportStats::SCTPTransportStats(const SCTPTransportStats &op2) : + IStatsReportTypes::SCTPTransportStats::SCTPTransportStats(const SCTPTransportStats &op2) noexcept : Stats(op2), mDataChannelsOpened(op2.mDataChannelsOpened), mDataChannelsClosed(op2.mDataChannelsClosed) @@ -1242,7 +1264,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::SCTPTransportStats::SCTPTransportStats(ElementPtr rootEl) : + IStatsReportTypes::SCTPTransportStats::SCTPTransportStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_SCTPTransport; @@ -1254,20 +1276,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::SCTPTransportStatsPtr IStatsReportTypes::SCTPTransportStats::create(ElementPtr rootEl) + IStatsReportTypes::SCTPTransportStatsPtr IStatsReportTypes::SCTPTransportStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return SCTPTransportStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::SCTPTransportStatsPtr IStatsReportTypes::SCTPTransportStats::convert(AnyPtr any) + IStatsReportTypes::SCTPTransportStatsPtr IStatsReportTypes::SCTPTransportStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(SCTPTransportStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::SCTPTransportStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::SCTPTransportStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -1280,13 +1302,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::SCTPTransportStats::toDebug() const + ElementPtr IStatsReportTypes::SCTPTransportStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::SCTPTransportStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::SCTPTransportStats::hash() const + String IStatsReportTypes::SCTPTransportStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1302,7 +1324,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::SCTPTransportStats::eventTrace(double timestamp) const + void IStatsReportTypes::SCTPTransportStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1315,12 +1337,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::MediaStreamStats - #pragma mark + // + // IStatsReportTypes::MediaStreamStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamStats::MediaStreamStats(const MediaStreamStats &op2) : + IStatsReportTypes::MediaStreamStats::MediaStreamStats(const MediaStreamStats &op2) noexcept : Stats(op2), mStreamID(op2.mStreamID), mTrackIDs(op2.mTrackIDs) @@ -1328,7 +1350,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamStats::MediaStreamStats(ElementPtr rootEl) : + IStatsReportTypes::MediaStreamStats::MediaStreamStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_Stream; @@ -1353,20 +1375,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamStatsPtr IStatsReportTypes::MediaStreamStats::create(ElementPtr rootEl) + IStatsReportTypes::MediaStreamStatsPtr IStatsReportTypes::MediaStreamStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return MediaStreamStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamStatsPtr IStatsReportTypes::MediaStreamStats::convert(AnyPtr any) + IStatsReportTypes::MediaStreamStatsPtr IStatsReportTypes::MediaStreamStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::MediaStreamStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::MediaStreamStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -1389,13 +1411,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::MediaStreamStats::toDebug() const + ElementPtr IStatsReportTypes::MediaStreamStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::MediaStreamStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::MediaStreamStats::hash() const + String IStatsReportTypes::MediaStreamStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1417,7 +1439,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::MediaStreamStats::eventTrace(double timestamp) const + void IStatsReportTypes::MediaStreamStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1425,7 +1447,7 @@ namespace ortc internal::reportInt32(mID, timestamp, "tracks", SafeInt(mTrackIDs.size())); unsigned long index = 0; for (auto iter = mTrackIDs.begin(); iter != mTrackIDs.end(); ++iter, ++index) { - auto &trackID = (*iter); + //auto &trackID = (*iter); internal::reportString(mID, timestamp, (String("trackId") + string(index)).c_str(), mStreamID); } } @@ -1434,12 +1456,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::MediaStreamTrackStats - #pragma mark + // + // IStatsReportTypes::MediaStreamTrackStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamTrackStats::MediaStreamTrackStats(const MediaStreamTrackStats &op2) : + IStatsReportTypes::MediaStreamTrackStats::MediaStreamTrackStats(const MediaStreamTrackStats &op2) noexcept : Stats(op2), mTrackID(op2.mTrackID), mRemoteSource(op2.mRemoteSource), @@ -1459,7 +1481,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamTrackStats::MediaStreamTrackStats(ElementPtr rootEl) : + IStatsReportTypes::MediaStreamTrackStats::MediaStreamTrackStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_Track; @@ -1501,20 +1523,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamTrackStatsPtr IStatsReportTypes::MediaStreamTrackStats::create(ElementPtr rootEl) + IStatsReportTypes::MediaStreamTrackStatsPtr IStatsReportTypes::MediaStreamTrackStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return MediaStreamTrackStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::MediaStreamTrackStatsPtr IStatsReportTypes::MediaStreamTrackStats::convert(AnyPtr any) + IStatsReportTypes::MediaStreamTrackStatsPtr IStatsReportTypes::MediaStreamTrackStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(MediaStreamTrackStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::MediaStreamTrackStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::MediaStreamTrackStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -1550,13 +1572,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::MediaStreamTrackStats::toDebug() const + ElementPtr IStatsReportTypes::MediaStreamTrackStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::MediaStreamTrackStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::MediaStreamTrackStats::hash() const + String IStatsReportTypes::MediaStreamTrackStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1602,7 +1624,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::MediaStreamTrackStats::eventTrace(double timestamp) const + void IStatsReportTypes::MediaStreamTrackStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1646,12 +1668,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::DataChannelStats - #pragma mark + // + // IStatsReportTypes::DataChannelStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::DataChannelStats::DataChannelStats(const DataChannelStats &op2) : + IStatsReportTypes::DataChannelStats::DataChannelStats(const DataChannelStats &op2) noexcept : Stats(op2), mLabel(op2.mLabel), mProtocol(op2.mProtocol), @@ -1665,7 +1687,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::DataChannelStats::DataChannelStats(ElementPtr rootEl) : + IStatsReportTypes::DataChannelStats::DataChannelStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_DataChannel; @@ -1691,20 +1713,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::DataChannelStatsPtr IStatsReportTypes::DataChannelStats::create(ElementPtr rootEl) + IStatsReportTypes::DataChannelStatsPtr IStatsReportTypes::DataChannelStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return DataChannelStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::DataChannelStatsPtr IStatsReportTypes::DataChannelStats::convert(AnyPtr any) + IStatsReportTypes::DataChannelStatsPtr IStatsReportTypes::DataChannelStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(DataChannelStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::DataChannelStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::DataChannelStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -1723,13 +1745,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::DataChannelStats::toDebug() const + ElementPtr IStatsReportTypes::DataChannelStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::DataChannelStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::DataChannelStats::hash() const + String IStatsReportTypes::DataChannelStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1758,7 +1780,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::DataChannelStats::eventTrace(double timestamp) const + void IStatsReportTypes::DataChannelStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1776,12 +1798,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICEGathererStats - #pragma mark + // + // IStatsReportTypes::ICEGathererStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::ICEGathererStats::ICEGathererStats(const ICEGathererStats &op2) : + IStatsReportTypes::ICEGathererStats::ICEGathererStats(const ICEGathererStats &op2) noexcept : Stats(op2), mBytesSent(op2.mBytesSent), mBytesReceived(op2.mBytesReceived), @@ -1790,7 +1812,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICEGathererStats::ICEGathererStats(ElementPtr rootEl) : + IStatsReportTypes::ICEGathererStats::ICEGathererStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_ICEGatherer; @@ -1803,20 +1825,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICEGathererStatsPtr IStatsReportTypes::ICEGathererStats::create(ElementPtr rootEl) + IStatsReportTypes::ICEGathererStatsPtr IStatsReportTypes::ICEGathererStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return ICEGathererStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::ICEGathererStatsPtr IStatsReportTypes::ICEGathererStats::convert(AnyPtr any) + IStatsReportTypes::ICEGathererStatsPtr IStatsReportTypes::ICEGathererStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(ICEGathererStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICEGathererStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::ICEGathererStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -1830,13 +1852,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICEGathererStats::toDebug() const + ElementPtr IStatsReportTypes::ICEGathererStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::ICEGathererStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::ICEGathererStats::hash() const + String IStatsReportTypes::ICEGathererStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1855,7 +1877,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::ICEGathererStats::eventTrace(double timestamp) const + void IStatsReportTypes::ICEGathererStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1869,12 +1891,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICETransportStats - #pragma mark + // + // IStatsReportTypes::ICETransportStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::ICETransportStats::ICETransportStats(const ICETransportStats &op2) : + IStatsReportTypes::ICETransportStats::ICETransportStats(const ICETransportStats &op2) noexcept : Stats(op2), mBytesSent(op2.mBytesSent), mBytesReceived(op2.mBytesReceived), @@ -1885,7 +1907,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICETransportStats::ICETransportStats(ElementPtr rootEl) : + IStatsReportTypes::ICETransportStats::ICETransportStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_ICETransport; @@ -1900,20 +1922,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICETransportStatsPtr IStatsReportTypes::ICETransportStats::create(ElementPtr rootEl) + IStatsReportTypes::ICETransportStatsPtr IStatsReportTypes::ICETransportStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return ICETransportStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::ICETransportStatsPtr IStatsReportTypes::ICETransportStats::convert(AnyPtr any) + IStatsReportTypes::ICETransportStatsPtr IStatsReportTypes::ICETransportStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(ICETransportStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICETransportStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::ICETransportStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -1929,13 +1951,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICETransportStats::toDebug() const + ElementPtr IStatsReportTypes::ICETransportStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::ICETransportStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::ICETransportStats::hash() const + String IStatsReportTypes::ICETransportStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -1958,7 +1980,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::ICETransportStats::eventTrace(double timestamp) const + void IStatsReportTypes::ICETransportStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -1974,12 +1996,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::DTLSTransportStats - #pragma mark + // + // IStatsReportTypes::DTLSTransportStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::DTLSTransportStats::DTLSTransportStats(const DTLSTransportStats &op2) : + IStatsReportTypes::DTLSTransportStats::DTLSTransportStats(const DTLSTransportStats &op2) noexcept : Stats(op2), mLocalCertificateID(op2.mLocalCertificateID), mRemoteCertificateID(op2.mRemoteCertificateID) @@ -1987,7 +2009,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::DTLSTransportStats::DTLSTransportStats(ElementPtr rootEl) : + IStatsReportTypes::DTLSTransportStats::DTLSTransportStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_DTLSTransport; @@ -1999,20 +2021,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::DTLSTransportStatsPtr IStatsReportTypes::DTLSTransportStats::create(ElementPtr rootEl) + IStatsReportTypes::DTLSTransportStatsPtr IStatsReportTypes::DTLSTransportStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return DTLSTransportStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::DTLSTransportStatsPtr IStatsReportTypes::DTLSTransportStats::convert(AnyPtr any) + IStatsReportTypes::DTLSTransportStatsPtr IStatsReportTypes::DTLSTransportStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(DTLSTransportStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::DTLSTransportStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::DTLSTransportStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -2025,13 +2047,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::DTLSTransportStats::toDebug() const + ElementPtr IStatsReportTypes::DTLSTransportStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::DTLSTransportStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::DTLSTransportStats::hash() const + String IStatsReportTypes::DTLSTransportStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2048,7 +2070,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::DTLSTransportStats::eventTrace(double timestamp) const + void IStatsReportTypes::DTLSTransportStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -2061,18 +2083,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::SRTPTransportStats - #pragma mark + // + // IStatsReportTypes::SRTPTransportStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::SRTPTransportStats::SRTPTransportStats(const SRTPTransportStats &op2) : + IStatsReportTypes::SRTPTransportStats::SRTPTransportStats(const SRTPTransportStats &op2) noexcept : Stats(op2) { } //--------------------------------------------------------------------------- - IStatsReportTypes::SRTPTransportStats::SRTPTransportStats(ElementPtr rootEl) : + IStatsReportTypes::SRTPTransportStats::SRTPTransportStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_SRTPTransport; @@ -2081,20 +2103,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::SRTPTransportStatsPtr IStatsReportTypes::SRTPTransportStats::create(ElementPtr rootEl) + IStatsReportTypes::SRTPTransportStatsPtr IStatsReportTypes::SRTPTransportStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return SRTPTransportStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::SRTPTransportStatsPtr IStatsReportTypes::SRTPTransportStats::convert(AnyPtr any) + IStatsReportTypes::SRTPTransportStatsPtr IStatsReportTypes::SRTPTransportStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(SRTPTransportStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::SRTPTransportStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::SRTPTransportStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -2104,13 +2126,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::SRTPTransportStats::toDebug() const + ElementPtr IStatsReportTypes::SRTPTransportStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::SRTPTransportStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::SRTPTransportStats::hash() const + String IStatsReportTypes::SRTPTransportStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2124,7 +2146,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::SRTPTransportStats::eventTrace(double timestamp) const + void IStatsReportTypes::SRTPTransportStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); } @@ -2134,12 +2156,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICECandidateAttributes - #pragma mark + // + // IStatsReportTypes::ICECandidateAttributes + // //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidateAttributes::ICECandidateAttributes(const ICECandidateAttributes &op2) : + IStatsReportTypes::ICECandidateAttributes::ICECandidateAttributes(const ICECandidateAttributes &op2) noexcept : Stats(op2), mRelatedID(op2.mRelatedID), mIPAddress(op2.mIPAddress), @@ -2152,7 +2174,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidateAttributes::ICECandidateAttributes(ElementPtr rootEl) : + IStatsReportTypes::ICECandidateAttributes::ICECandidateAttributes(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_Candidate; @@ -2181,20 +2203,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidateAttributesPtr IStatsReportTypes::ICECandidateAttributes::create(ElementPtr rootEl) + IStatsReportTypes::ICECandidateAttributesPtr IStatsReportTypes::ICECandidateAttributes::create(ElementPtr rootEl) noexcept { if (!rootEl) return ICECandidateAttributesPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidateAttributesPtr IStatsReportTypes::ICECandidateAttributes::convert(AnyPtr any) + IStatsReportTypes::ICECandidateAttributesPtr IStatsReportTypes::ICECandidateAttributes::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(ICECandidateAttributes, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICECandidateAttributes::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::ICECandidateAttributes::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -2212,13 +2234,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICECandidateAttributes::toDebug() const + ElementPtr IStatsReportTypes::ICECandidateAttributes::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::ICECandidateAttributes"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::ICECandidateAttributes::hash() const + String IStatsReportTypes::ICECandidateAttributes::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2245,7 +2267,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::ICECandidateAttributes::eventTrace(double timestamp) const + void IStatsReportTypes::ICECandidateAttributes::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -2262,12 +2284,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::ICECandidatePairStats - #pragma mark + // + // IStatsReportTypes::ICECandidatePairStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidatePairStats::ICECandidatePairStats(const ICECandidatePairStats &op2) : + IStatsReportTypes::ICECandidatePairStats::ICECandidatePairStats(const ICECandidatePairStats &op2) noexcept : Stats(op2), mTransportID(op2.mTransportID), mLocalCandidateID(op2.mLocalCandidateID), @@ -2286,7 +2308,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidatePairStats::ICECandidatePairStats(ElementPtr rootEl) : + IStatsReportTypes::ICECandidatePairStats::ICECandidatePairStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_CandidatePair; @@ -2321,20 +2343,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidatePairStatsPtr IStatsReportTypes::ICECandidatePairStats::create(ElementPtr rootEl) + IStatsReportTypes::ICECandidatePairStatsPtr IStatsReportTypes::ICECandidatePairStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return ICECandidatePairStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::ICECandidatePairStatsPtr IStatsReportTypes::ICECandidatePairStats::convert(AnyPtr any) + IStatsReportTypes::ICECandidatePairStatsPtr IStatsReportTypes::ICECandidatePairStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(ICECandidatePairStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICECandidatePairStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::ICECandidatePairStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -2358,13 +2380,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::ICECandidatePairStats::toDebug() const + ElementPtr IStatsReportTypes::ICECandidatePairStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::ICECandidatePairStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::ICECandidatePairStats::hash() const + String IStatsReportTypes::ICECandidatePairStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2401,7 +2423,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::ICECandidatePairStats::eventTrace(double timestamp) const + void IStatsReportTypes::ICECandidatePairStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -2424,12 +2446,12 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes::CertificateStats - #pragma mark + // + // IStatsReportTypes::CertificateStats + // //--------------------------------------------------------------------------- - IStatsReportTypes::CertificateStats::CertificateStats(const CertificateStats &op2) : + IStatsReportTypes::CertificateStats::CertificateStats(const CertificateStats &op2) noexcept : Stats(op2), mFingerprint(op2.mFingerprint), mFingerprintAlgorithm(op2.mFingerprintAlgorithm), @@ -2439,7 +2461,7 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::CertificateStats::CertificateStats(ElementPtr rootEl) : + IStatsReportTypes::CertificateStats::CertificateStats(ElementPtr rootEl) noexcept : Stats(rootEl) { mStatsType = IStatsReportTypes::StatsType_Certificate; @@ -2453,20 +2475,20 @@ namespace ortc } //--------------------------------------------------------------------------- - IStatsReportTypes::CertificateStatsPtr IStatsReportTypes::CertificateStats::create(ElementPtr rootEl) + IStatsReportTypes::CertificateStatsPtr IStatsReportTypes::CertificateStats::create(ElementPtr rootEl) noexcept { if (!rootEl) return CertificateStatsPtr(); return make_shared(rootEl); } //--------------------------------------------------------------------------- - IStatsReportTypes::CertificateStatsPtr IStatsReportTypes::CertificateStats::convert(AnyPtr any) + IStatsReportTypes::CertificateStatsPtr IStatsReportTypes::CertificateStats::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(CertificateStats, any); } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::CertificateStats::createElement(const char *objectName) const + ElementPtr IStatsReportTypes::CertificateStats::createElement(const char *objectName) const noexcept { ElementPtr rootEl = Stats::createElement(objectName); @@ -2481,13 +2503,13 @@ namespace ortc } //--------------------------------------------------------------------------- - ElementPtr IStatsReportTypes::CertificateStats::toDebug() const + ElementPtr IStatsReportTypes::CertificateStats::toDebug() const noexcept { return Element::create("ortc::IStatsReportTypes::CertificateStats"); } //--------------------------------------------------------------------------- - String IStatsReportTypes::CertificateStats::hash() const + String IStatsReportTypes::CertificateStats::hash() const noexcept { auto hasher = IHasher::sha1(); @@ -2508,7 +2530,7 @@ namespace ortc } //--------------------------------------------------------------------------- - void IStatsReportTypes::CertificateStats::eventTrace(double timestamp) const + void IStatsReportTypes::CertificateStats::eventTrace(double timestamp) const noexcept { Stats::eventTrace(timestamp); @@ -2522,18 +2544,18 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportTypes - #pragma mark + // + // IStatsReportTypes + // //--------------------------------------------------------------------------- - ElementPtr IStatsReport::toDebug(IStatsReportPtr report) + ElementPtr IStatsReport::toDebug(IStatsReportPtr report) noexcept { return internal::StatsReport::toDebug(internal::StatsReport::convert(report)); } //--------------------------------------------------------------------------- - IStatsReportPtr IStatsReport::convert(AnyPtr any) + IStatsReportPtr IStatsReport::convert(AnyPtr any) noexcept { return ZS_DYNAMIC_PTR_CAST(IStatsReport, any); } diff --git a/ortc/cpp/ortc_webrtc.cpp b/ortc/cpp/ortc_webrtc.cpp index 5ee4b29d..58e0b609 100644 --- a/ortc/cpp/ortc_webrtc.cpp +++ b/ortc/cpp/ortc_webrtc.cpp @@ -33,13 +33,13 @@ #include -namespace ortc { ZS_DECLARE_SUBSYSTEM(ortclib_webrtc) } +namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_webrtc) } namespace ortc { namespace internal { - void webrtcTrace(Log::Severity severity, Log::Level level, const char *message) + void webrtcTrace(Log::Severity severity, Log::Level level, const char *message) noexcept { ZS_LOG_WITH_SEVERITY(severity, level, message); } diff --git a/ortc/idl/Capabilities.idl b/ortc/idl/Capabilities.idl new file mode 100644 index 00000000..386d2c33 --- /dev/null +++ b/ortc/idl/Capabilities.idl @@ -0,0 +1,135 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The minimum and maximum legal values for an integer value. + /// + [dictionary] + struct LongRange + { + /// + /// Gets or sets the minimum value of this property. + /// + long min; + /// + /// Gets or sets the maximum legal value of this property. + /// + long max; + + /// + /// Constructs a new minimum and maximum legal range for an integer value. + /// + [constructor, default] + void LongRange(); + + /// + /// Constructs a minimum and maximum legal range given an integer value. + /// + [constructor, default, altname(LongRangeWithValue)] + void LongRange(long value); + + /// + /// Constructs a minimum and maximum legal range given an integer minimum and maximum value. + /// + [constructor, default, altname(LongRangeWithLimits)] + void LongRange(long minimum, long maximum); + + /// + /// Constructs a minimum and maximum legal range given a JSON object. + /// + [constructor, altname(LongRangeWithJson)] + void LongRange(Json json); + + /// + /// Convert the integer range into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the integer range. + /// + string hash(); + }; + + /// + /// The minimum and maximum legal values for an real value. + /// + [dictionary] + struct DoubleRange + { + /// + /// Gets or sets the minimum value of this property. + /// + double min; + /// + /// Gets or sets the maximum legal value of this property. + /// + double max; + + /// + /// Constructs a new minimum and maximum legal range for a real value. + /// + [constructor, default] + void DoubleRange(); + + /// + /// Constructs a minimum and maximum legal range given a real value. + /// + [constructor, default, altname(DoubleRangeWithValue)] + void DoubleRange(double value); + + /// + /// Constructs a minimum and maximum legal range given a real minimum and maximum value. + /// + [constructor, default, altname(DoubleRangeWithLimits)] + void DoubleRange(double minimum, double maximum); + + /// + /// Constructs a minimum and maximum legal range given a JSON object. + /// + [constructor, altname(DoubleRangeWithJson)] + void DoubleRange(Json json); + + /// + /// Convert the real number range into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of a real value range. + /// + string hash(); + } + + } +} diff --git a/ortc/idl/Certificate.idl b/ortc/idl/Certificate.idl new file mode 100644 index 00000000..e846b4b5 --- /dev/null +++ b/ortc/idl/Certificate.idl @@ -0,0 +1,147 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The RTCDtlsFingerprint object includes the hash function algorithm and + /// certificate fingerprint as described in [RFC4572]. + /// + [dictionary] + struct RTCDtlsFingerprint + { + /// + /// Gets or sets one of the the hash function algorithms defined in the + /// 'Hash function Textual Names' registry, initially specified in + /// [RFC4572] Section 8. As noted in [draft-ietf-rtcweb-jsep] Section + /// 5.2.1, the digest algorithm used for the fingerprint matches that + /// used in the certificate signature. + /// + string algorithm; + /// + /// The value of the certificate fingerprint in lowercase hex string as + /// expressed utilizing the syntax of 'fingerprint' in [RFC4572] Section + /// 5. + /// + string value; + + /// + /// Construct a new empty fingerprint instance. + /// + [constructor] + void RTCDtlsFingerprint(); + + /// + /// Construct a new fingerprint instance by cloning existing fingerprint. + /// + [constructor, altname(RTCDtlsFingerprintClone)] + void RTCDtlsFingerprint(RTCDtlsFingerprint source); + + /// + /// Construct a new fingerprint instance from a JSON object. + /// + [constructor, default, altname(RTCDtlsFingerprintWithJson)] + void RTCDtlsFingerprint(Json json); + + /// + /// Convert a fingerprint to a JSON object. + /// + Json toJson(); + /// + /// Get a hash of the fingerprint. + /// + string hash(); + }; + + /// + /// The RTCCertificate interface enables the certificates used by an + /// RTCDtlsTransport in its constructor. + /// + interface RTCCertificate + { + typedef zs::PromiseWith PromiseWithCertificate; + + /// + /// The GenerateCertificate method causes the user agent to create and + /// store an X.509 certificate [ISO/IEC 9594-8:1997] and corresponding + /// private key. + /// + /// An awaitable newly generated certificate. + [static] + PromiseWithCertificate generateCertificate() throws (NotImplemented); + + /// + /// The GenerateCertificate method causes the user agent to create and + /// store an X.509 certificate [ISO/IEC 9594-8:1997] and corresponding + /// private key. + /// + /// An awaitable newly generated certificate. + [static, default, altname(generateCertificateWithAlgorithm)] + PromiseWithCertificate generateCertificate( + /// + //// This argument is used to control how the private key associated + /// with the certificate is generated. + /// + string keygenAlgorithm + ) throws(NotImplemented); + + [static, altname(generateCertificateWithJson)] + PromiseWithCertificate generateCertificate(Json keygenAlgorithm); + + [constructor, delete] + void RTCCertificate(); + + /// + /// Gets the unique object identifier for the certificate object. + /// + [getter] + puid objectId; + + /// + /// Gets the expiry after which the certificate will be considered + /// invalid by the browser. After this time, attempts to construct an + /// RTCDtlsTransport object using this certificate will fail. + /// + [getter] + Time expires; + + /// + /// Gets the fingerprint of the certificate. As noted in + /// [draft-ietf-rtcweb-jsep] Section 5.2.1, the digest algorithm used + /// for the fingerprint matches that used in the certificate signature. + /// + [getter] + RTCDtlsFingerprint fingerprint; + }; + } +} diff --git a/ortc/idl/Constraints.idl b/ortc/idl/Constraints.idl new file mode 100644 index 00000000..713b987f --- /dev/null +++ b/ortc/idl/Constraints.idl @@ -0,0 +1,444 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// This object represents the constrainable boolean parameters. + /// + [dictionary] + struct ConstrainBooleanParameters { + /// + /// Gets or sets the exact required value for this property. + /// + [optional] + bool exact; + /// + /// Gets or sets the ideal (target) value for this property. + /// + [optional] + bool ideal; + + /// + /// Constructs a new constrainable boolean parameters. + /// + [constructor, default] + void ConstrainBooleanParameters(); + /// + /// Constructs a new constrainable boolean parameters by cloning existing constrainable parameters. + /// + [constructor, altname(ConstrainBooleanParametersClone)] + void ConstrainBooleanParameters(ConstrainBooleanParameters source); + /// + /// Constructs a new constrainable boolean parameters from a JSON object. + /// + [constructor, default, altname(ConstrainBooleanParametersWithJson)] + void ConstrainBooleanParameters(Json json); + + /// + /// Convert the constrainable boolean parameters into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the constrainable boolean parameters. + /// + string hash(); + }; + + /// + /// This object represents the constrainable boolean values. + /// + [dictionary] + struct ConstrainBoolean + { + /// + /// Gets or sets the exact boolean value required. Use this value must + /// be mutually exclusively set from Parameters. + /// + [optional] + bool value; + /// + /// Gets or sets the boolean constrainable value parameters. + /// + [optional] + ConstrainBooleanParameters parameters; + + /// + /// Constructs a new constrainable boolean value. + /// + [constructor, default] + void ConstrainBoolean(); + /// + /// Constructs a new constrainable boolean value by cloning existing constrainable parameters. + /// + [constructor, altname(ConstrainBooleanClone)] + void ConstrainBoolean(ConstrainBoolean source); + /// + /// Constructs a new constrainable boolean value from a JSON object. + /// + [constructor, default, altname(ConstrainBooleanWithJson)] + void ConstrainBoolean(Json json); + + /// + /// Convert the constrainable boolean value into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the constrainable boolean value. + /// + string hash(); + }; + + /// + /// This object represents the constrainable minimum, maximum, exact, or + /// ideal integer values. + /// + [dictionary] + struct ConstrainLongRange { + /// + /// Gets or sets the minimum value of this property. + /// + [optional] + long min; + /// + /// Gets or sets the maximum legal value of this property. + /// + [optional] + long max; + /// + /// Gets or sets the exact required value for this property. + /// + [optional] + long exact; + /// + /// Gets or sets the ideal (target) value for this property. + /// + [optional] + long ideal; + + /// + /// Constructs a new constrainable long range. + /// + [constructor, default] + void ConstrainLongRange(); + /// + /// Constructs a new constrainable long range by cloning existing constrainable range. + /// + [constructor, altname(ConstrainLongRangeClone)] + void ConstrainLongRange(ConstrainLongRange source); + /// + /// Constructs a new constrainable long range from a JSON object. + /// + [constructor, default, altname(ConstrainLongRangeWithJson)] + void ConstrainLongRange(Json json); + + /// + /// Convert the constrainable long range into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the contrainable long range. + /// + string hash(); + }; + + /// + /// This object represents the constrainable integer values. + /// + [dictionary] + struct ConstrainLong { + /// + /// Gets or sets the exact integer value required. This value must be + /// mutually exclusively set from Range. + /// + [optional] + long value; + /// + /// Gets or sets the constrainable integer range values. + /// + [optional] + ConstrainLongRange range; + + /// + /// Constructs a new constrainable long value. + /// + [constructor, default] + void ConstrainLong(); + /// + /// Constructs a new constrainable long value by cloning existing constrainable value. + /// + [constructor, altname(ConstrainLongClone)] + void ConstrainLong(ConstrainLong source); + /// + /// Constructs a new constrainable long value from a JSON object. + /// + [constructor, default, altname(ConstrainLongWithJson)] + void ConstrainLong(Json json); + + /// + /// Convert the constrainable long value into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the constrainable long value. + /// + string hash(); + }; + + /// + /// This object represents the constrainable minimum, maximum, exact, or + /// ideal real values. + /// + [dictionary] + struct ConstrainDoubleRange { + /// + /// Gets or sets the minimum value of this property. + /// + [optional] + double min; + /// + /// Gets or sets the maximum legal value of this property. + /// + [optional] + double max; + /// + /// Gets or sets the exact required value for this property. + /// + [optional] + double exact; + /// + /// Gets or sets the ideal (target) value for this property. + /// + [optional] + double ideal; + + /// + /// Constructs a new constrainable real range. + /// + [constructor, default] + void ConstrainDoubleRange(); + /// + /// Constructs a new constrainable real range by cloning existing constrainable range. + /// + [constructor, altname(ConstrainDoubleRangeClone)] + void ConstrainDoubleRange(ConstrainDoubleRange source); + /// + /// Constructs a new constrainable real range from a JSON object. + /// + [constructor, default, altname(ConstrainDoubleRangeWithJson)] + void ConstrainDoubleRange(Json json); + + /// + /// Convert the constrainable real range into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the constrainable real range. + /// + string hash(); + }; + + /// + /// This object represents the constrainable real values. + /// + [dictionary] + struct ConstrainDouble { + /// + /// Gets or sets the exact real value required. This value must be + /// mutually exclusively set from Range. + /// + [optional] + double value; + /// + /// Gets or sets the constrainable real range values. + /// + [optional] + ConstrainDoubleRange range; + + /// + /// Constructs a new constrainable real value. + /// + [constructor, default] + void ConstrainDouble(); + /// + /// Constructs a new constrainable real value by cloning existing constrainable value. + /// + [constructor, altname(ConstrainDoubleClone)] + void ConstrainDouble(ConstrainDouble source); + /// + /// Constructs a new constrainable real value from a JSON object. + /// + [constructor, default, altname(ConstrainDoubleWithJson)] + void ConstrainDouble(Json json); + + /// + /// Convert the constrainable real value into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the contrainable real value. + /// + string hash(); + }; + + /// + /// This object represents a single string value or a list of string + /// values. + /// + [dictionary] + struct StringOrStringList { + /// + /// Gets or sets a specific constrainable string value. This value must + /// be mutally exclusively set from Values; + /// + [optional] + string value; + /// + /// Gets or sets the constrainable string values. + /// + [optional] + StringList values; + + /// + /// Constructs a new string or string list. + /// + [constructor, default] + void StringOrStringList(); + /// + /// Constructs a new string or string list from an existing string or string list. + /// + [constructor, altname(StringOrStringListClone)] + void StringOrStringList(StringOrStringList source); + /// + /// Constructs a new string or string list from a JSON object. + /// + [constructor, default, altname(StringOrStringListWithJson)] + void StringOrStringList(Json json); + + /// + /// Convert the string or string list into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the string or string list. + /// + string hash(); + }; + + /// + /// This object represents the constrainable string parameters. + /// + [dictionary] + struct ConstrainStringParameters { + /// + /// Gets or sets the exact required value for this property. + /// + [optional] + StringOrStringList exact; + /// + /// Gets or sets the ideal (target) value for this property. + /// + [optional] + StringOrStringList ideal; + + /// + /// Constructs a new constrainable string parameters. + /// + [constructor, default] + void ConstrainStringParameters(); + /// + /// Constructs a new constrainable string parameters from an existing constrainable parameters. + /// + [constructor, altname(ConstrainStringParametersClone)] + void ConstrainStringParameters(ConstrainStringParameters source); + /// + /// Constructs a new constrainable string parameters from a JSON object. + /// + [constructor, default, altname(ConstrainStringParametersWithJson)] + void ConstrainStringParameters(Json json); + + /// + /// Convert the constrainable string parameters into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the constrainable string parameters. + /// + string hash(); + }; + + /// + /// This object represents the constrainable string values. + /// + [dictionary] + struct ConstrainString { + /// + /// Gets or sets the exact string value(s) required. This value must be + /// mutually exclusively set from Parameters. + /// + [optional] + StringOrStringList value; + /// + /// Gets or sets the string constrainable value parameters. + /// + [optional] + ConstrainStringParameters parameters; + + /// + /// Constructs a new constrainable string value. + /// + [constructor, default] + void ConstrainString(); + /// + /// Constructs a new constrainable string value from an existing constrainable value. + /// + [constructor, altname(ConstrainStringClone)] + void ConstrainString(ConstrainString source); + /// + /// Constructs a new constrainable string value from a JSON object. + /// + [constructor, default, altname(ConstrainStringWithJson)] + void ConstrainString(Json json); + + /// + /// Convert the constrainable string value into a JSON object. + /// + Json toJson(); + /// + /// Get a hash value of the constrainable string value. + /// + string hash(); + }; + + } +} diff --git a/ortc/idl/DataChannel.idl b/ortc/idl/DataChannel.idl new file mode 100644 index 00000000..43973fc0 --- /dev/null +++ b/ortc/idl/DataChannel.idl @@ -0,0 +1,285 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + interface RTCDataTransport + { + [constructor, delete] + void RTCDataTransport(); + }; + + /// + /// An RTCDataChannel can be configured to operate in different + /// reliability modes. A reliable channel ensures that the data is + /// delivered at the other peer through retransmissions. An unreliable + /// channel is configured to either limit the number of retransmissions + /// (maxRetransmits ) or set a time during which transmissions (including + /// retransmissions) are allowed (maxPacketLifeTime). These properties + /// can not be used simultaneously and an attempt to do so will result in + /// an error. Not setting any of these properties results in a reliable + /// channel. + /// + [dictionary] + struct RTCDataChannelParameters + { + /// + /// Gets or sets a label that can be used to distinguish this + /// RTCDataChannel object from other RTCDataChannel objects. + /// + string label; + /// + /// Gets or sets the if the RTCDataChannel is ordered, and false if out + /// of order delivery is allowed. + /// + bool ordered = true; + /// + /// Gets or sets the maxPacketLifetime attribute represents the length + /// of the time window (in milliseconds) during which retransmissions + /// may occur in unreliable mode. A value of 0 means not used. + /// + Milliseconds maxPacketLifetime; + /// + /// Gets or sets the maxRetransmits attribute returns the maximum number + /// of retransmissions that are attempted in unreliable mode if set. + /// + uint32 maxRetransmits; + /// + /// Custom definition of the protocol being carried over the data channel. + /// + string protocol; + /// + /// Gets or sets an indicator if the this RTCDataChannel was negotiated + /// by the application. If true, the application negotiated the + /// RTCDataChannel, otherwise the value is false. + /// + bool negotiated; + /// + /// The id attribute returns the id for this RTCDataChannel if set. + /// + [optional] + uint16 id; + + /// + /// Constructs an instance of an RTCDataChannelParameters instance. + /// + [constructor, default] + void RTCDataChannelParameters(); + /// + /// Constructs an instance of an RTCDataChannelParameters instance cloning from an existing instance. + /// + [constructor, altname(RTCDataChannelParametersClone)] + void RTCDataChannelParameters(RTCDataChannelParameters source); + /// + /// Constructs an instance of an RTCDataChannelParameters instance from a JSON object. + /// + [constructor, default, altname(RTCDataChannelParametersWithJson)] + void RTCDataChannelParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCDataChannelStateChangeEvent represents the ready state event + /// fired when the RTCDataChannel state is changed. + /// + struct RTCDataChannelStateChangeEvent + { + [constructor, delete] + void RTCDataChannelStateChangeEvent(); + + /// + /// The RTCDataChannelState that cased the event to fire. + /// + [getter] + RTCDataChannelState state; + }; + + /// + /// RTCMessageEvent represents the event data when a message from the + /// RTCDataChannel is fired. + /// + struct RTCMessageEvent + { + [constructor, delete] + void RTCMessageEvent(); + + /// + /// Gets the binary message being sent. Only set if the data was binary. + /// + [getter] + binary binary; + + /// + /// Gets the binary message being sent. Only set if the data was text. + /// + [getter] + string text; + }; + + /// + /// An RTCDataChannel class instance allows sending data messages to/from + /// the remote peer. + /// + interface RTCDataChannel : RTCStatsProvider + { + /// + /// Constructs an instance of RTCDataChannel object from a + /// RTCDataTransport object and an RTCDataChannelParameters object. + /// + [constructor] + void RTCDataChannel(RTCDataTransport transport, RTCDataChannelParameters params) throws (InvalidParameters, InvalidStateError); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets or sets the related transport object. + /// + [getter] + RTCDataTransport transport; + + /// + /// Gets or sets the parameters applying to this data channel. + /// + [getter] + RTCDataChannelParameters parameters; + + /// + /// Gets or sets the state of the RTCDataChannel object. It must return + /// the value to which the user agent last set it (as defined by the + /// processing model algorithms). + /// + [getter] + RTCDataChannelState readyState; + + /// + /// Gets the number of bytes of application data (UTF-8 text and binary + /// data) that have been queued using send() but that, as of the last + /// time the event loop started executing a task, had not yet been + /// transmitted to the network. + /// + [getter] + size_t bufferedAmount; + + /// + /// Gets or sets the threshold at which the BufferedAmount is considered + /// to be low. When the bufferedAmount decreases from above this + /// threshold to equal or below it, the bufferedamountlow event fires. + /// The bufferedAmountLowThreshold is initially zero on each new + /// RTCDataChannel, but the application may change its value at any + /// time. + /// + [getter, setter] + size_t bufferedAmountLowThreshold; + + /// + /// Gets or sets the binaryType attribute. On getting, return the value + /// to which it was last set. On setting, the user agent must set the + /// IDL attribute to the new value. When an RTCDataChannel object is + /// constructed, the binaryType attribute must be initialized to the + /// string 'blob'. This attribute controls how binary data is exposed to + /// scripts. + /// + [getter, setter] + string binaryType; + + /// + /// Closes the RTCDataChannel. + /// + void close(); + + /// + /// The Send() method is overloaded to handle different data argument + /// types. This Send() method transmits a string to the remote peer. + /// + [default, altname(sendWithString)] + void send(string text) throws (InvalidParameters, InvalidStateError); + /// + /// The Send() method is overloaded to handle different data argument + /// types. This Send() method transmits a binary blob to the remote + /// peer. + /// + [altname(sendWithBinary)] + void send(binary data) throws (InvalidParameters, InvalidStateError); + + /// + /// The event handler when the state of the RTCDataChannel is open. + /// + [event] + void onOpen(); + + /// + /// The event handler when the state of the RTCDataChannel is closed. + /// + [event] + void onClose(); + + /// + /// The event handler when the state of the RTCDataChannel object + //// changes. + /// + [event] + void onStateChange(RTCDataChannelStateChangeEvent event); + + /// + /// The error event handler for the RTCDataChannel. + /// + [event] + void onError(ErrorEvent event); + + /// + /// The event handler when the BufferedAmount falls below the + /// BufferedAmountLowThreshold. + /// + [event] + void onBufferedAmountLow(); + + /// + /// The event handler when data from the remote peer arrives. + /// + [event] + void onMessage(RTCMessageEvent event); + }; + } +} diff --git a/ortc/idl/DtlsTransport.idl b/ortc/idl/DtlsTransport.idl new file mode 100644 index 00000000..c7702fe7 --- /dev/null +++ b/ortc/idl/DtlsTransport.idl @@ -0,0 +1,209 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The RTCDtlsParameters object includes information relating to DTLS + /// configuration. + /// + [dictionary] + struct RTCDtlsParameters + { + typedef std::list FingerprintList; + + /// + /// The DTLS role, with a default of Auto. + /// + RTCDtlsRole role = auto; + /// + /// Sequence of fingerprints, one fingerprint for each certificate. + /// + FingerprintList fingerprints; + + /// + /// Construct a new empty RTCDtlsParameters object. + /// + [constructor, default] + void RTCDtlsParameters(); + /// + /// Construct a new RTCDtlsParameters object by cloning the contents of an existing object. + /// + [constructor, altname(RTCDtlsParametersClone)] + void RTCDtlsParameters(RTCDtlsParameters source); + /// + /// Construct an RTCDtlsParameters from a JSON object. + /// + [constructor, default, altname(RTCDtlsParametersWithJson)] + void RTCDtlsParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// Contains a single binary array of certificate data. + /// + struct RTCDtlsCertificateBinary + { + [constructor, delete] + void RTCDtlsCertificateBinary(); + + [getter] + binary certificate; + }; + + /// + /// The OnStateChange event of the RTCDtlsTransport object uses the + /// RTCDtlsTransportStateChangeEvent interface. + /// + struct RTCDtlsTransportStateChangeEvent + { + [constructor, delete] + void RTCDtlsTransportStateChangeEvent(); + + /// + /// Gets the new RTCDtlsTransportState that caused the event. + /// + [getter] + RTCDtlsTransportState state; + }; + + /// + /// The RTCDtlsTransport object includes information relating to Datagram + /// Transport Layer Security (DTLS) transport. + /// + interface RTCDtlsTransport : RTCDataTransport, + RTCRtpTransport, + RTCRtcpTransport, + RTCStatsProvider + { + typedef std::list CertificateList; + typedef std::list BinaryList; + + /// + /// A RTCDtlsTransport instance is constructed using an RTCIceTransport + /// and a sequence of RTCCertificate objects. If certificates is + /// non-empty, check that the expires attribute of each RTCCertificate + /// object is in the future. If a certificate has expired, throw an + /// InvalidParameter exception; otherwise, store the certificates. + /// + [constructor] + void RTCDtlsTransport( + RTCIceTransport iceTransport, + CertificateList certificates + ) throws (InvalidParameters, InvalidStateError); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the certificates provided in the constructor. + /// + [getter] + CertificateList certificates; + + /// + /// The associated RTCIceTransport instance. + /// + [getter] + RTCIceTransport transport; + + /// + /// The current state of the DTLS transport. + /// + [getter] + RTCDtlsTransportState state; + + /// + /// Gets the DTLS parameters of the local RTCDtlsTransport. If multiple + /// certificates were provided in the constructor, then multiple + /// fingerprints will be returned, one for each certificate. + /// + [getter] + RTCDtlsParameters localParameters; + /// + /// Gets the remote DTLS parameters passed in the Start() method. + /// Prior to calling start(), null is returned. + /// + [getter] + RTCDtlsParameters remoteParameters(); + + /// + /// Returns the certificate chain in use by the remote side, with each + /// certificate encoded in binary Distinguished Encoding Rules (DER) + /// [X690]. GetRemoteCertificates() returns an empty list prior to + /// selection of the remote certificate, which is completed once + /// RTCDtlsTransportState transitions to "Connected". + /// + BinaryList getRemoteCertificates(); + + /// + /// Start DTLS transport negotiation with the parameters of the remote + /// DTLS transport, including verification of the remote fingerprint, + /// then once the DTLS transport session is established, negotiate a + /// DTLS-SRTP [RFC5764] session to establish keys so as protect media + /// using SRTP [RFC3711]. Since symmetric RTP [RFC4961] is utilized, + /// the DTLS-SRTP session is bi-directional. + /// + void start(RTCDtlsParameters remoteParameters) throws (InvalidStateError, InvalidParameters); + /// + /// Stops and closes the RTCDtlsTransport object. Calling stop() when + /// state is "closed" has no effect. + /// + void stop(); + + /// + /// This event handler, uses the RTCDtlsTransportStateChangedEvent + /// interface. It is called any time the RTCDtlsTransportState changes. + /// + [event] + void onStateChange(RTCDtlsTransportStateChangeEvent event); + + /// + /// This event is fired on reception of a DTLS error alert. + /// + [event] + void onError(ErrorEvent event); + }; + } +} diff --git a/ortc/idl/DtmfSender.idl b/ortc/idl/DtmfSender.idl new file mode 100644 index 00000000..34a04d22 --- /dev/null +++ b/ortc/idl/DtmfSender.idl @@ -0,0 +1,155 @@ +/* + +Copyright (c) 2017, Optical Tone Ltd. +All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace ortc + { + /// + /// The RTCDTMFToneChangeEvent dictionary provides information on the DTMF tone causing a tonechange event. + /// + struct RTCDtmfToneChangeEvent + { + [constructor, delete] + void RTCDtmfToneChangeEvent(); + + /// + /// Gets the character for the tone that has just begun playout (see insertDtmf()). If the + /// value is the empty string, it indicates that the toneBuffer is an empty string and that + /// the previous tones have completed playback. + /// + [getter] + string tone; + }; + + /// + /// An RTCDtmfSender instance allows sending DTMF tones to/from the remote + /// peer, as per [RFC4733]. + /// + interface RTCDtmfSender + { + /// + /// Construct an instance of the RTCDtmfSender associated to an + /// RTCRtpSender. + /// + [constructor] + void RTCDtmfSender(RTCRtpSender sender) throws (InvalidStateError); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets whether the RTCDtmfSender is capable of sending DTMF. + /// + bool canInsertDtmf(); + + /// + /// The InsertDTMF() method is used to send DTMF tones. Since DTMF tones + /// cannot be sent without configuring the DTMF codec, if InsertDTMF() + /// is called prior to sender.Send(parameters), or if + /// sender.Send(parameters) was called but parameters did not include + /// the DTMF codec, throw an InvalidStateError exception. + /// + [default] + void insertDtmf(string tones) throws(InvalidStateError, InvalidParameters); + + /// + /// The InsertDTMF() method is used to send DTMF tones. Since DTMF tones + /// cannot be sent without configuring the DTMF codec, if InsertDTMF() + /// is called prior to sender.Send(parameters), or if + /// sender.Send(parameters) was called but parameters did not include + /// the DTMF codec, throw an InvalidStateError exception. + /// + [altname(insertDtmfWithDuration)] + void insertDtmf( + string tones, + Milliseconds duration + ) throws (InvalidStateError, InvalidParameters); + + /// + /// The InsertDTMF() method is used to send DTMF tones. Since DTMF tones + /// cannot be sent without configuring the DTMF codec, if InsertDTMF() + /// is called prior to sender.Send(parameters), or if + /// sender.Send(parameters) was called but parameters did not include + /// the DTMF codec, throw an InvalidStateError exception. + /// + [altname(insertDtmfWithDurationAndGap)] + void insertDtmf( + string tones, + Milliseconds duration, + Milliseconds interToneGap + ) throws (InvalidStateError, InvalidParameters); + + /// + /// Gets the RTCRtpSender instance. + /// + [getter] + RTCRtpSender sender; + + /// + /// Gets the toneBuffer attribute returns a list of the tones remaining + /// to be played out. + /// + [getter] + string toneBuffer; + + /// + /// Get the duration attribute returns the current tone duration value + /// in milliseconds. This value will be the value last set via the + /// InsertDTMF() method, or the default value of 100 ms if + /// InsertDTMF() was called without specifying the duration. + /// + [getter] + Milliseconds duration; + + /// + /// Gets the interToneGap attribute returns the current value of the + /// between-tone gap. This value will be the value last set via the + /// InsertDTMF() method, or the default value of 70 ms if InsertDTMF() + /// was called without specifying the interToneGap. + /// + [getter] + Milliseconds interToneGap; + + /// + /// The OnToneChange event handler uses the RTCDTMFToneChangeEvent + /// interface to return the character for each tone as it is played out. + /// + [event] + void onToneChange(RTCDtmfToneChangeEvent event); + }; + + } +} diff --git a/ortc/idl/IceGatherer.idl b/ortc/idl/IceGatherer.idl new file mode 100644 index 00000000..ef586fd2 --- /dev/null +++ b/ortc/idl/IceGatherer.idl @@ -0,0 +1,405 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// ICE interface policy information. + /// + [dictionary] + struct RTCIceGatherInterfacePolicy + { + /// + /// Gets or sets the string form of the RTCIceGatherInterfaceType enums + /// to specify which interface types this policy object applies. + /// + string interfaceType; + /// + /// Gets or sets the candidate filter policy to apply to the specified + /// interface types. + /// + RTCIceGatherFilterPolicy gatherPolicy = none; + + /// + /// Constructs a new empty RTCIceGatherInterfacePolicy object. + /// + [constructor, default] + void RTCIceGatherInterfacePolicy(); + /// + /// Constructs a new RTCIceGatherInterfacePolicy object cloning the data from an existing object. + /// + [constructor, altname(RTCIceGatherInterfacePolicyClone)] + void RTCIceGatherInterfacePolicy(RTCIceGatherInterfacePolicy source); + /// + /// Constructs a new RTCIceGatherInterfacePolicy object extracting the data from a JSON object. + /// + [constructor, default, altname(RTCIceGatherInterfacePolicyWithJson)] + void RTCIceGatherInterfacePolicy(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// ICE server information. + /// + [dictionary] + struct RTCIceServer + { + /// + /// Gets or sets the STUN or TURN URI(s) as defined in [RFC7064] and [RFC7065] or other + /// URI types. + /// + StringList urls; + /// + /// Gets or sets the username to use with that TURN server, if this + /// RTCIceServer object represents a TURN Server. + /// + string username; + /// + /// Gets or sets the TURN server credential, if this RTCIceServer object + /// represents a TURN Server. + /// + string credential; + /// + /// Gets or sets how credential should be used when that TURN server + /// requests authorization, if this RTCIceServer object represents a + /// TURN Server. + /// + RTCIceCredentialType credentialType = password; + + /// + /// Constructs an empty instance of an RTCIceServer object. + /// + [constructor, default] + void RTCIceServer(); + /// + /// Constructs an instance of an RTCIceServer object by cloning the data from an existing object. + /// + [constructor, altname(RTCIceServerClone)] + void RTCIceServer(RTCIceServer source); + /// + /// Constructs an instance of an RTCIceServer object by extracting the data from a JSON object. + /// + [constructor, default, altname(RTCIceServerWithJson)] + void RTCIceServer(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCIceGatherOptions provides options relating to the gathering of ICE + /// candidates. + /// + [dictionary] + struct RTCIceGatherOptions + { + typedef std::list InterfacePolicyList; + typedef std::list ServerList; + + /// + /// Gets or sets the option to specify continuous gathering mode. + /// + /// If true, then the RTCIceGatherer will gather all candidates + /// available "for now" and fire a RTCIceGathererCandidateCompleteEvent. + /// However, should more candidates be discovered or Gather() get called + /// again after the the RTCIceGathererCandidateCompleteEvent then the + /// RTCIceGatherer is allowed to go back into the Gatherering state and + /// fire newly discovered candidates until another fired + /// RTCIceGathererCandidateCompleteEvent occurs. + /// + /// If false, then the RTCIceGatherer will not be able to discover any + /// new candidates after going into the Complete state, or go back + /// into the Gatherering state. + /// + bool continuousGathering = true; + /// + /// Gets or sets the ICE gather policy per interface type. + /// + InterfacePolicyList interfacePolicies; + /// + /// Gets or sets additional ICE servers to be configured. Since + /// implementations may provide default ICE servers, and applications + /// can desire to restrict communications to the local LAN, iceServers + /// need not be set. + /// + ServerList iceServers; + + /// + /// Constructs a new instance of an empty RTCIceGatherOptions object. + /// + [constructor, default] + void RTCIceGatherOptions(); + /// + /// Constructs a new instance of an RTCIceGatherOptions object by cloning the contents of an existing object. + /// + [constructor, altname(RTCIceGatherOptionsClone)] + void RTCIceGatherOptions(RTCIceGatherOptions source); + /// + /// Constructs a new instance of an RTCIceGatherOptions object by extracting the data from a JSON object. + /// + [constructor, default, altname(RTCIceGatherOptionsWithJson)] + void RTCIceGatherOptions(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// This object represents the error event when the RTCIceGatherer object + /// has experienced an ICE gathering failure (such as an authentication + /// failure with TURN credentials). + /// + struct RTCIceGathererIceErrorEvent + { + [constructor, delete] + void RTCIceGathererIceErrorEvent(); + + /// + /// Gets the RTCIceCandidate used to communicate with the STUN or TURN + /// server. On a multihomed system, multiple interfaces may be sed to + /// contact the server, and this attribute allows the application to + /// figure out on which one the failure occurred. + /// + [getter, nullable] + RTCIceCandidate hostCandidate; + /// + /// Gets the STUN or TURN URL identifying the server on which the + /// failure ocurred. + /// + [getter] + string url; + /// + /// Gets the numeric STUN error code returned by the STUN or TURN + /// server. If the server could not be reached on all interfaces, + /// ErrorCode will be set to a TBD value in the 7XX range, as this does + /// not conflict with the STUN error code range, and HostCandidate will + /// be null. + /// + [getter] + uint16 errorCode; + /// + /// Gets the STUN reason text returned by the STUN or TURN server. + /// + [getter] + string errorText; + }; + + /// + /// This object represents the event for when the RTCIceGathererState + /// changed. + /// + struct RTCIceGathererStateChangeEvent + { + [constructor, delete] + void RTCIceGathererStateChangeEvent(); + + /// + /// Gets the new RTCIceGathererState that caused the event. + /// + [getter] + RTCIceGathererState state; + }; + + /// + /// This object represents the event for when a new RTCIceGathererCandidate + /// is made available (or is gone). + /// + struct RTCIceGathererCandidateEvent + { + [constructor, delete] + void RTCIceGathererCandidateEvent(); + /// + /// Gets the ICE candidate that caused the event. + /// + [getter] + RTCIceCandidate candidate; + /// + /// Gets the URL of the server from which the candidate was obtained. + /// + [getter] + string url; + }; + + /// + /// This object represents the event for when a new + /// RTCIceCandidateComplete is made available. + /// + struct RTCIceGathererCandidateCompleteEvent + { + [constructor, delete] + void RTCIceGathererCandidateCompleteEvent(); + + /// + /// Gets the ICE candidate that caused the event. + /// + [getter] + RTCIceCandidateComplete candidate; + }; + + /// + /// The RTCIceGatherer gathers local host, server reflexive and relay + /// candidates, as well as enabling the retrieval of local Interactive + /// Connectivity Establishment (ICE) parameters which can be exchanged in + /// signaling. By enabling an endpoint to use a set of local candidates to + /// construct multiple RTCIceTransport objects, the RTCIceGatherer enables + /// support for scenarios such as parallel forking. + /// + interface RTCIceGatherer : RTCStatsProvider + { + typedef std::list CandidateList; + + /// + /// Constructs an instance of an RTCIceGatherer. + /// + [constructor] + void RTCIceGatherer(RTCIceGatherOptions options) throws(InvalidParameters); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the component-id of the RTCIceGatherer object. In + /// RTCIceGatherer objects returned by createAssociatedGatherer() the + /// value of component is "RTCP". In all other RTCIceGatherer objects, + /// the value of component is "RTP". + /// + [getter] + RTCIceComponent component; + + /// + /// Gets the current state of the ICE gatherer. + /// + [getter] + RTCIceGathererState state; + + /// + /// Obtain the ICE parameters of the RTCIceGatherer. + /// + [getter] + RTCIceParameters localParameters; + /// + /// Retrieve the sequence of valid local candidates associated with the + /// RTCIceGatherer. This retrieves all unpruned local candidates + /// currently known (except for peer reflexive candidates), even if an + /// onlocalcandidate event hasn't been processed yet. Prior to calling + /// Gather() an empty list will be returned. + /// + [getter] + CandidateList localCandidates; + + /// + /// Create an associated RTCIceGatherer for RTCP, with the same + /// RTCIceParameters and RTCIceGatherOptions. If state is "closed", + /// throw an InvalidStateError exception. If an RTCIceGatherer calls the + /// method more than once, or if component is "RTCP", throw an + /// InvalidStateError exception. + /// + RTCIceGatherer createAssociatedGatherer() throws (InvalidStateError); + + /// + /// Gather ICE candidates. Utilize the value of options passed in the constructor. + /// + [default] + void gather(); + + /// + /// Gather ICE candidates with the options specified. + /// + [altname(gatherWithOptions)] + void gather(RTCIceGatherOptions options); + + /// + /// Prunes all local candidates, and closes the port. Associated + /// RTCIceTransport objects transition to the "disconnected" state + /// (unless they were in the "failed" state). Calling close() when state + /// is "closed" has no effect. + /// + void close(); + + /// + /// The RTCIceGathererState changed. + /// + [event] + void onStateChange(RTCIceGathererStateChangeEvent event); + + /// + /// A new RTCIceGathererCandidate is made available. + /// + [event] + void onLocalCandidate(RTCIceGathererCandidateEvent event); + + /// + /// A new RTCIceCandidateComplete is made available. + /// + [event] + void onLocalCandidateComplete(RTCIceGathererCandidateCompleteEvent event); + + /// + /// A new RTCIceGathererCandidate is no longer available. + /// + [event] + void onLocalCandidateGone(RTCIceGathererCandidateEvent event); + + /// + /// The RTCIceGatherer object has experienced an ICE gathering failure + /// (such as an authentication failure with TURN credentials). + /// + [event] + void onError(RTCIceGathererIceErrorEvent event); + }; + + } +} diff --git a/ortc/idl/IceTransport.idl b/ortc/idl/IceTransport.idl new file mode 100644 index 00000000..c1c1d299 --- /dev/null +++ b/ortc/idl/IceTransport.idl @@ -0,0 +1,294 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// An abstract object representing an RTP transport. + /// + interface RTCRtpTransport + { + [constructor, delete] + void RTCRtpTransport(); + }; + /// + /// An abstract object representing an RTCP transport. + /// + interface RTCRtcpTransport + { + [constructor, delete] + void RTCRtcpTransport(); + }; + + /// + /// This object represents the event data associated when the + /// RTCIceTransportState changes. + /// + struct RTCIceTransportStateChangeEvent + { + [constructor, delete] + void RTCIceTransportStateChangeEvent(); + + /// + /// Gets the RTCIceTransportState state at the time the event fired. + /// + [getter] + RTCIceTransportState state; + }; + + /// + /// This object represents the candidate pair events changes the + /// RTCIceTransport object uses the RTCIceCandidatePairChangeEvent + /// interface. + /// + struct RTCIceCandidatePairChangeEvent + { + [constructor, delete] + void RTCIceCandidatePairChangeEvent(); + + /// + /// Gets the selected RTCIceCandidatePair that caused the event. + /// + [getter] + RTCIceCandidatePair candidatePair; + }; + + /// + /// The RTCIceTransport allows an application access to information about + /// the Interactive Connectivity Establishment(ICE) transport over which + /// packets are sent and received. In particular, ICE manages + /// peer - to - peer connections which involve state which the + /// application may want to access. + /// + interface RTCIceTransport : RTCRtcpTransport, + RTCStatsProvider + { + typedef std::list CandidateList; + + /// + /// Constructs an instance of the RTCIceTransport object. + /// + [constructor, default] + void RTCIceTransport(); + + /// + /// Constructs an instance of the RTCIceTransport object using the + /// specified RTCIceGatherer. + /// + [constructor, altname(RTCIceTransportWithGatherer)] + void RTCIceTransport(RTCIceGatherer gatherer) throws (InvalidParameters, InvalidStateError); + + /// + /// Gets an unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the iceGatherer attribute is set to the value of gatherer if + /// passed in the constructor or in the latest call to Start(). + /// + [getter] + RTCIceGatherer gatherer; + + /// + /// Gets the current role of the ICE transport. + /// + [getter] + RTCIceRole role; + + /// + /// Gets the component-id of the RTCIceTransport object. In + /// RTCIceTransport objects returned by CreateAssociatedTransport(), the + /// value of component is "RTCP". In all other RTCIceTransport objects, + /// the value of component is "RTP". + /// + [getter] + RTCIceComponent component; + + /// + /// Gets the current state of the ICE transport. + /// + [getter] + RTCIceTransportState state; + + /// + /// Gets the sequence of candidates associated with the remote + /// RTCIceTransport. Only returns the candidates previously added using + /// SetRemoteCandidates() or AddRemoteCandidate(). If there are no + /// remote candidates, an empty list is returned. + /// + [getter] + CandidateList remoteCandidates; + /// + /// Gets the selected candidate pair on which packets are sent. If + /// there is no selected pair yet, or consent [RFC7675] is lost on the + /// selected pair, nullptr is returned. + /// + [getter] + RTCIceCandidatePair selectedCandidatePair; + + /// + /// The first time Start() is called, candidate connectivity checks are + /// started and the ICE transport attempts to connect to the remote + /// RTCIceTransport. If start() is called with invalid parameters, throw + /// an InvalidParameters exception. For example, if gatherer.component + /// has a value different from iceTransport.component, throw an + /// InvalidParameters exception. If state or gatherer.state is "closed", + /// throw an InvalidStateError exception. When start() is called again, + /// RTCIceTransportState transitions to the "connected" state, all + /// remote candidates are flushed, and AddRemoteCandidate() or + /// SetRemoteCandidates() must be called to add the remote candidates + /// back or replace them. + /// + void start( + RTCIceGatherer gatherer, + RTCIceParameters remoteParameters, + ) throws (InvalidParameters, InvalidStateError); + + /// + /// The first time Start() is called, candidate connectivity checks are + /// started and the ICE transport attempts to connect to the remote + /// RTCIceTransport. If start() is called with invalid parameters, throw + /// an InvalidParameters exception. For example, if gatherer.component + /// has a value different from iceTransport.component, throw an + /// InvalidParameters exception. If state or gatherer.state is "closed", + /// throw an InvalidStateError exception. When start() is called again, + /// RTCIceTransportState transitions to the "connected" state, all + /// remote candidates are flushed, and AddRemoteCandidate() or + /// SetRemoteCandidates() must be called to add the remote candidates + /// back or replace them. + /// + [default, altname(startWithRole)] + void start( + RTCIceGatherer gatherer, + RTCIceParameters remoteParameters, + RTCIceRole role + ) throws(InvalidParameters, InvalidStateError); + + /// + /// The first time Start() is called, candidate connectivity checks are + /// started and the ICE transport attempts to connect to the remote + /// RTCIceTransport. If start() is called with invalid parameters, throw + /// an InvalidParameters exception. For example, if gatherer.component + /// has a value different from iceTransport.component, throw an + /// InvalidParameters exception. If state or gatherer.state is "closed", + /// throw an InvalidStateError exception. When start() is called again, + /// RTCIceTransportState transitions to the "connected" state, all + /// remote candidates are flushed, and AddRemoteCandidate() or + /// SetRemoteCandidates() must be called to add the remote candidates + /// back or replace them. + /// + [altname(startWithOptions)] + void start( + RTCIceGatherer gatherer, + RTCIceParameters remoteParameters, + RTCIceTransportOptions options + ) throws(InvalidParameters, InvalidStateError); + + /// + /// Stops and closes the current object. Also removes the object from + /// the RTCIceTransportController. Calling stop() when state is "closed" + /// has no effect. + /// + void stop(); + + /// + /// Get the current ICE parameters of the remote RTCIceTransport. + /// + [getter] + RTCIceParameters remoteParameters; + + /// + /// Create an associated RTCIceTransport for RTCP. If called more than + /// once for the same component, or if state is "closed", throw an + /// InvalidStateError exception. If called when component is "RTCP", + /// throw an InvalidStateError exception. + /// + RTCIceTransport createAssociatedTransport(); + + /// + /// Add a remote candidate associated with the remote RTCIceTransport. + /// If state is "closed", throw an InvalidStateError exception. + /// + void addRemoteCandidate(RTCIceGathererCandidate remoteCandidate) throws (InvalidStateError, InvalidParameters); + /// + /// Set the sequence of candidates associated with the remote + /// RTCIceTransport. If state is "closed", throw an InvalidStateError + /// exception. + /// + void setRemoteCandidates(CandidateList remoteCandidates) throws (InvalidStateError, InvalidParameters); + void removeRemoteCandidate(RTCIceGathererCandidate remoteCandidate) throws (InvalidStateError, InvalidParameters); + + /// + /// Keep a particular local/remote candidate path alive with keep-alives to ensure the path is always kept alive. + /// + [default] + void keepWarm(RTCIceCandidatePair candidatePair) throws (InvalidStateError); + /// + /// Tell engine to keep a particular local/remote candidate path alive or not to ensure the path is always kept alive. + /// + [altname(setKeepWarm)] + void keepWarm( + RTCIceCandidatePair candidatePair, + bool keepWarm + ) throws (InvalidStateError); + + /// + /// The RTCIceTransportState changed. + /// + [event] + void onStateChange(RTCIceTransportStateChangeEvent event); + + /// + /// A new RTCIceCandidatePair is available. + /// + [event] + void onCandidatePairAvailable(RTCIceCandidatePairChangeEvent event); + + /// + /// A previous RTCIceCandidatePair is gone. + /// + [event] + void onCandidatePairGone(RTCIceCandidatePairChangeEvent event); + + /// + /// The selected RTCIceCandidatePair changed. + /// + [event] + void onCandidatePairChange(RTCIceCandidatePairChangeEvent event); + }; + + } +} + diff --git a/ortc/idl/IceTransportController.idl b/ortc/idl/IceTransportController.idl new file mode 100644 index 00000000..568ebc20 --- /dev/null +++ b/ortc/idl/IceTransportController.idl @@ -0,0 +1,90 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The RTCIceTransportController object assists in the managing of ICE + /// freezing and bandwidth estimation. + /// + interface RTCIceTransportController + { + typedef std::list IceTransportList; + + /// + /// Constructs an instance of the RTCIceTransportController. + /// + [constructor] + void RTCIceTransportController(); + + /// + /// Get a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the RTCIceTransport with a component of "RTP". If + /// addTransport() has not been called, an empty list is returned. + /// + [getter] + IceTransportList transports; + + /// + /// Adds transport to the RTCIceTransportController object for the + /// purposes of managing ICE freezing and sharing bandwidth estimation. + /// Since addTransport manages ICE freezing, candidate pairs that are + /// not in the frozen state maintain their state when + /// AddTransport(transport) is called. RTCIceTransport objects will be + /// unfrozen according to their index. The added transport is inserted + /// as the final index. + /// + /// If transport.state is "closed", throw an InvalidStateError + /// exception. If transport has already been added to another + /// RTCIceTransportController object, or if transport.component is + /// "RTCP", throw an InvalidStateError exception. + /// + void addTransport(RTCIceTransport transport) throws (InvalidParameters, InvalidStateError); + /// + /// The transport is inserted at index. If index is greater than the + /// current number of RTCIceTransports with a component of "RTP", + /// throw an InvalidParameters exception. + /// + [altname(addTransportWithIndex)] + void addTransport( + RTCIceTransport transport, + size_t index + ) throws (InvalidParameters, InvalidStateError); + }; + } +} diff --git a/ortc/idl/IceTypes.idl b/ortc/idl/IceTypes.idl new file mode 100644 index 00000000..9e301550 --- /dev/null +++ b/ortc/idl/IceTypes.idl @@ -0,0 +1,312 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// An base object representing a gathered ICE candidate. + /// + struct RTCIceGathererCandidate + { + [constructor, delete] + void RTCIceGathererCandidate(); + + /// + /// Gets or sets the the component of the ICE candidate to indicate + /// if the candidate is related to RTP or RTCP. + /// + [getter] + RTCIceComponent component; + + /// + /// Return a new instance of an RTCIceGathererCandidate by extracting out the candidate + /// information from the JSON object. + /// + [static, default] + RTCIceGathererCandidate create(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCIceCandidate object includes information relating to an ICE + /// candidate. + /// + struct RTCIceCandidate : RTCIceGathererCandidate + { + /// + /// Gets or sets the type of interface this candidate was gathered from. + /// + [getter] + string interfaceType; + /// + /// Gets or sets a unique identifier that allows ICE to correlate + /// candidates that appear on multiple RTCIceTransports. + /// + [getter] + string foundation; + /// + /// Gets or sets the assigned usage priority of the candidate. This + /// priority represents the priority to choose this candidate over other + /// candidates as described in [RFC5245]. If + /// RTCIceParameters.UseUnfreezePriority is false then this priority + /// also represents the priority in which to unfreeze ICE candidates. + /// This is automatically populated by the RTC engine and/or browser. + /// + [getter] + uint32 priority; + /// + /// Gets or sets the unfreeze priority. If + /// RTCIceParameters.UseUnfreezePriority is true then this priority is + /// used to determine the unfreezing search order in which to check ICE + /// candidates. The higher priority candidates will be searched as + /// possible pairings before lower priority candidates. This is a + /// useful option as setting up a connection via a relay may be faster + /// than exhaustively searching for the most optimal candidate pairing + /// which is determined by standard Priority. + /// + /// + [getter] + uint32 unfreezePriority; + /// + /// Gets or sets the protocol of the candidate (UDP/TCP). + /// + [getter] + RTCIceProtocol protocol; + /// + /// Gets or sets the IP address of the candidate. + /// + [getter] + string ip; + /// + /// Gets or sets the port for the candidate. + /// + [getter] + uint16 port; + /// + /// Gets or sets the type of candidate. + /// + [getter] + RTCIceCandidateType candidateType; + /// + /// Gets or sets the type of TCP candidate. + /// + [getter] + RTCIceTcpCandidateType tcpType; + /// + /// Gets or sets the related address if not a host candidate type. For + /// candidates that are derived from others, such as relay or reflexive + /// candidates, the relatedAddress refers to the candidate that these + /// are derived from. For host candidates, the RelatedAddress is set to + /// the empty string. + /// + [getter] + string relatedAddress; + /// + /// Gets or sets the related port if not a host candidate type. For + /// candidates that are derived from others, such as relay or reflexive + /// candidates, the relatedPort refers to the host candidate that these + /// are derived from. For host candidates, the RelatedPort is null. + /// + [getter] + uint16 relatedPort; + }; + + /// + /// A candidate representing the completed state of the ICE gathering process + /// which can be marshalled and sent to the remote party to inform of the + /// local gathering completion process. + /// + struct RTCIceCandidateComplete : RTCIceGathererCandidate + { + /// + /// This attribute is always present and set to true, indicating that + /// ICE candidate gathering is complete. + /// + [getter] + bool complete; + }; + + /// + /// The local RTCIceParameters object includes the ICE username fragment + /// and password and other ICE-related parameters. The RTCIceParameters + /// object corresponding to a remote peer may also include an iceLite + /// attribute (set to "true" if the remote peer only supports ICE-lite). + /// + [dictionary] + struct RTCIceParameters + { + /// + /// Set this value to true if the remote ICE implementation also + /// supports the separation of candidate choice priority versus + /// the priority to unfreeze the candidates. This allows the ICE engine + /// to search for a candidate that is more likely to work before trying + /// to find the most optimal candidate to use long term. + /// + bool useUnfreezePriority; + /// + /// The ICE username fragment. + /// + string usernameFragment; + /// + /// The ICE password. + /// + string password; + /// + /// If only ICE-lite is supported (true) or not (false or unset). Since + /// [draft-ietf-rtcweb-transports] Section 3.4 requires client RTC + /// engines/browsers support for full ICE, IceLite will only be "true" + /// for a remote peer such as a gateway. GetLocalParameters().IceLite + /// will not return true. + /// + bool iceLite; + + /// + /// Constructs an empty instance of an RTCIceParameters object. + /// + [constructor, default] + void RTCIceParameters(); + /// + /// Constructs an instance of an RTCIceParameters object by cloning the contents of an existing object. + /// + [constructor, altname(RTCIceParametersClone)] + void RTCIceParameters(RTCIceParameters source); + /// + /// Constructs an instance of an RTCIceParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceParametersWithJson)] + void RTCIceParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCIceCandidatePair contains the currently selected ICE candidate + /// pair. + /// + struct RTCIceCandidatePair + { + /// + /// Gets or sets the local ICE candidate. + /// + RTCIceCandidate local; + /// + /// Gets or sets the remote ICE candidate. + /// + RTCIceCandidate remote; + + /// + /// Constructs an empty instance of an RTCIceCandidatePair object. + /// + [constructor, default] + void RTCIceCandidatePair(); + /// + /// Constructs an instance of an RTCIceCandidatePair object by cloning the contents of an existing object. + /// + [constructor, altname(RTCIceCandidatePairClone)] + void RTCIceCandidatePair(RTCIceCandidatePair source); + /// + /// Constructs an instance of an RTCIceCandidatePair object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceCandidatePairWithJson)] + void RTCIceCandidatePair(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCIceTransportOptions represents the ICE transport options + /// specified for the RTCIceTransport object. + /// + [dictionary] + struct RTCIceTransportOptions + { + /// + /// Gets or sets if aggressive ICE nomination should be used. If true, + /// the RTCIceTransport will use aggressive ICE nomination. If false, + /// the RTCICeTransport will use regular ICE nomination. + /// + bool aggressiveIce; + /// + /// Gets of sets the ICE role to use for the ICE transport. + /// + RTCIceRole role = controlled; + + /// + /// Constructs an empty instance of an RTCIceTransportOptions object. + /// + [constructor, default] + void RTCIceTransportOptions(); + /// + /// Constructs an instance of an RTCIceTransportOptions object by cloning data from an existing object. + /// + [constructor, altname(RTCIceTransportOptionsClone)] + void RTCIceTransportOptions(RTCIceTransportOptions source); + /// + /// Constructs an instance of an RTCIceTransportOptions object by extracting object data from a JSON object. + /// + [constructor, altname(RTCIceTransportOptionsWithJson)] + void RTCIceTransportOptions(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + } +} diff --git a/ortc/idl/Identity.idl b/ortc/idl/Identity.idl new file mode 100644 index 00000000..a01eb286 --- /dev/null +++ b/ortc/idl/Identity.idl @@ -0,0 +1,145 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The RTCIdentityAssertion dictionary provides information about an identity assertion. + /// + [dictionary] + struct RTCIdentityAssertion + { + /// + /// Gets or sets a domain name representing the identity provider. + /// + string idp; + /// + /// Gets or sets a representation of the verified peer identity conforming to [RFC5322]. + /// This identity will have been verified via the procedures described in [RTCWEB-SECURITY-ARCH]. + /// See https://tools.ietf.org/html/draft-ietf-rtcweb-security-arch-12 for more information. + /// + string name; + }; + + /// + /// The RTCIdentityResult is a base64 JSON encoded assertion. + /// + [dictionary] + struct RTCIdentityResult + { + /// + /// Gets or sets the base64 and JSON encoded assertion. + /// + string assertion; + }; + + /// + /// The RTCIdentityError dictionary provides information relating to error responses. + /// + [dictionary] + struct RTCIdentityError + { + /// + /// Gets or sets the domain name of the identity provider that is providing the error response. + /// + string idp; + /// + /// Gets or sets the IdP protocol that is in use. + /// + string protocol; + /// + /// Gets or sets an IdP that is unable to generate an identity assertion due to a lack of sufficient + /// user authentication information can provide a URL to a page where the user can complete + /// authentication. If the IdP provides this URL, this attribute includes the value provided by the IdP. + /// + string loginUrl; + }; + + typedef zs::PromiseRejectionReason PromiseRejectionIdentityError; + + interface RTCIdentity + { + typedef PromiseWith PromiseWithResult; + typedef PromiseWith PromiseWithAssertion; + + [constructor] + void RTCIdentity(RTCDtlsTransport transport); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the peer identity assertion information if an identity assertion was provided and verified. + /// Once this value is set to a value, it cannot change. + /// + [getter] + RTCIdentityAssertion peerIdentity; + + /// + /// Sets the identity provider to be used for a given RTCIdentity object, and initiates the process of + /// obtaining an identity assertion. + /// + [default] + PromiseWithResult getIdentityAssertion(string provider); + + /// + /// Sets the identity provider to be used for a given RTCIdentity object, and initiates the process of + /// obtaining an identity assertion. + /// + [altname(getIdentityAssertionWithProtocol)] + PromiseWithResult getIdentityAssertion( + string provider, + string protocol + ); + + /// + /// Sets the identity provider to be used for a given RTCIdentity object, and initiates the process of + /// obtaining an identity assertion. + /// + [altname(getIdentityAssertionWithProtocolAndUsername)] + PromiseWithResult getIdentityAssertion( + string provider, + string protocol, + string username + ); + + /// + /// Validates the identity assertion. + /// + PromiseWithAssertion setIdentityAssertion(string assertion); + }; + } +} diff --git a/ortc/idl/Logger.idl b/ortc/idl/Logger.idl new file mode 100644 index 00000000..4a6045b5 --- /dev/null +++ b/ortc/idl/Logger.idl @@ -0,0 +1,365 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + using namespace zs; + + namespace log + { + /// + /// The level represents the detail level used when logging. + /// + enum Level + { + /// + /// Do not log any log messages. + /// + none, + /// + /// Log only the most important logger information. + /// + basic, + /// + /// Log a few more details from the logger information. + /// + detail, + /// + /// Log a level appropriate to debug the engine. + /// + debug, + /// + /// Log a level to trace the code path within the engine. + /// + trace, + /// + /// Log every possible mundane detail possible. + /// + insane + }; + + /// + /// The component represents the area of code that is capable of + /// logging. + /// + enum Component + { + /// + /// All components. + /// + all, + /// + /// The low level socket, asynchronous eventing, and OS abstraction + /// library. + /// + zslib, + /// + /// The socket abstraction library. + /// + socket, + /// + /// The eventing services library (ETW). + /// + eventing, + /// + /// The servers support library for the ORTC library. + /// + services, + /// + /// The DNS services support library for the ORTC library. + /// + dns, + /// + /// The TURN services support library for the ORTC library. + /// + turn, + /// + /// The HTTP services support library for the ORTC library. + /// + http, + /// + /// The logger tracer at the services layer. + /// + logger, + /// + /// The wire level tracing of services support for the ORTC library. + /// This component also includes the details of the STUN packet(s). + /// + wire, + /// + /// All STUN related request processing (minus the STUN on the wire). + /// + stun, + /// + /// The C++ ORTC library (for all objects who don't have their own + /// trace level). + /// + ortc, + /// + /// The C++ ORTC media area. + /// + webrtc, + /// + /// The C++ ORTC DTLS transport object. + /// + dtlsTransport, + /// + /// The C++ ORTC ICE gatherer object. + /// + iceGatherer, + /// + /// The C++ ORTC ICE gatherer router object. + /// + iceGathererRouter, + /// + /// The C++ ORTC ICE transport object. + /// + iceTransport, + /// + /// The C++ ORTC ICE transport controller object. + /// + iceTransportController, + /// + /// The C++ ORTC media devices object. + /// + mediaDevices, + /// + /// The C++ ORTC media stream track object. + /// + mediaStreamTrack, + /// + /// The C++ ORTC rtp / rtcp packet related traces. + /// + rtpRtcpPacket, + /// + /// The C++ ORTC rtp listener object. + /// + rtpListener, + /// + /// The C++ ORTC rtp listener object. + /// + rtpMediaEngine, + /// + /// The C++ ORTC rtp receiver object. + /// + rtpReceiver, + /// + /// The C++ ORTC rtp sender object. + /// + rtpSender, + /// + /// The C++ ORTC rtp type structure tracing (parsers, helpers and + /// other). + /// + rtpTypes, + /// + /// The C++ SCTP and data channel related objects. + /// + sctpDataChannel, + /// + /// The C++ SRTP related objects. + /// + srtp, + /// + /// The C++ SRTP related objects. + /// + stats, + /// + /// The C++ ORTC Adapter library. + /// + adapter, + }; + } + + /// + /// An API used to control the logging engine within the ORTC library. + /// + [static] + interface Logger + { + /// + /// Set the log level for a specific component. + /// + [static, default] + void setLogLevel(log::Component component, log::Level level); + + /// + /// Sets the log level for a component by its component string name. + /// + [static, altname(setLogLevelByName)] + void setLogLevel(string component, log::Level level); + + /// + /// Output log information to the standard out and optionally colorize + /// the output using ANSI color codes. + /// + [static] + void installStdOutLogger(bool colorizeOutput); + /// + /// Output the log information to a file and optional colorize the + /// file output using ANSI color codes. + /// + [static] + void installFileLogger(string fileName, bool colorizeOutput); + /// + /// Listen for an incoming telnet connections and output the logging + /// information to the incoming telnet connection. + /// + [static] + void installTelnetLogger( + uint16 listenPort, + Seconds maxWaitForSocketToBeAvailable, + bool colorizeOutput + ); + + /// + /// Create an outgoing telnet connection to connect to a telnet server + /// and output the logging information to the telnet server. + /// + [static] + void installOutgoingTelnetLogger( + string serverHostWithPort, + bool colorizeOutput, + string sendStringUponConnection + ); + /// + /// Log to the connected debugger logger instance. + /// + [static] + void installDebuggerLogger(); + + /// + /// Returns true if the telnet logger is listening. + /// + [static] + bool isTelnetLoggerListening(); + /// + /// Returns true if a telnet logger client is connected. + /// + [static] + bool isTelnetLoggerConnected(); + /// + /// Returns true if the telnet logger has an outgoing client connected + /// telnet logger session. + /// + [static] + bool isOutgoingTelnetLoggerConnected(); + + /// + /// Uninstall the logger outputting to standard out. + /// + [static] + void uninstallStdOutLogger(); + /// + /// Uninstall the logger outputting to a file. + /// + [static] + void uninstallFileLogger(); + /// + /// Uninstall the telnet listening logger. + /// + [static] + void uninstallTelnetLogger(); + /// + /// Uninstall the outgoing client telnet logger. + /// + [static] + void uninstallOutgoingTelnetLogger(); + /// + /// Uninstall the logger outputting to a connected debugger. + /// + [static] + void uninstallDebuggerLogger(); + + /// + /// Set the default eventing level for all components. + /// + [static, default] + void setDefaultEventingLevel(log::Component component, log::Level level); + + /// + /// Sets the log eventing for a component by its component string name. + /// + [static, altname(setDefaultEventingLevelByName)] + void setDefaultEventingLevel(string component, log::Level level); + + /// + /// Set the eventing level for a specific component. + /// + [static, default] + void setEventingLevel(log::Component component, log::Level level); + + /// + /// Sets the log eventing for a component by its component string name. + /// + [static, altname(setEventingLevelByName)] + void setEventingLevel(string component, log::Level level); + + /// + /// Listen for an incoming eventing connection and output the eventing + /// information to the incoming eventing connection. Both the eventing + /// listener and connecting to an eventing server cannot be enabled + /// at the same time. + /// + [static] + void installEventingListener( + string sharedSecret, + uint16 listenPort, + Seconds maxWaitForSocketToBeAvailable + ); + + /// + /// Create an outgoing eventing connection to an eventing server and + /// output the eventing information to the server. Both the eventing + /// listener and connecting to an eventing server cannot be enabled + /// at the same time. + /// + [static] + void connectToEventingServer( + string sharedSecret, + string serverHostWithPort + ); + + /// + /// Uninstall the eventing listener. + /// + [static] + void uninstallEventingListener(); + /// + /// Uninstall the outgoing client telnet logger. + /// + [static] + void disconnectEventingServer(); + }; + } +} diff --git a/ortc/idl/MediaDevices.idl b/ortc/idl/MediaDevices.idl new file mode 100644 index 00000000..74fbc7d9 --- /dev/null +++ b/ortc/idl/MediaDevices.idl @@ -0,0 +1,277 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// MediaTrackSupportedConstraints represents the list of constraints + /// recognized by a User Agent for controlling the Capabilities of a + /// MediaStreamTrack object.This dictionary is used as a function return + /// value, and never as an operation argument. + /// + [dictionary] + struct MediaTrackSupportedConstraints + { + /// + /// The width or width range, in pixels. As a capability, the range should span the + /// video source's pre-set width values with min being the smallest width and max + /// being the largest width. + /// + bool width; + /// + /// The height or height range, in pixels. As a capability, the range should span + /// the video source's pre-set height values with min being the smallest height and + /// max being the largest height. + /// + bool height; + /// + /// The exact aspect ratio (width in pixels divided by height in pixels, represented + /// as a double rounded to the tenth decimal place) or aspect ratio range. + /// + bool aspectRatio; + /// + /// The exact frame rate (frames per second) or frame rate range. If this frame + /// rate cannot be determined (e.g. the source does not natively provide a frame rate, + /// or the frame rate cannot be determined from the source stream), then this value + /// must refer to the User Agent's vsync display rate. + /// + bool frameRate; + /// + /// This string (or each string, when a list) should be one of the members of + /// VideoFacingMode. The members describe the directions that the camera can + /// face, as seen from the user's perspective. Note that getConstraints may + /// not return exactly the same string for strings not in this enum. This + /// preserves the possibility of using a future version of enum for + /// this property. + /// + bool facingMode; + /// + /// The volume or volume range, as a multiplier of the linear audio sample + /// values. A volume of 0.0 is silence, while a volume of 1.0 is the maximum + /// supported volume. A volume of 0.5 will result in an approximately 6 dBSPL + /// change in the sound pressure level from the maximum volume. Note that any + /// ConstraintSet that specifies values outside of this range of 0 to 1 can + /// never be satisfied. + /// + bool volume; + /// + /// The sample rate in samples per second for the audio data. + /// + bool sampleRate; + /// + /// The linear sample size in bits. This constraint can only be satisfied for + /// audio devices that produce linear samples. + /// + bool sampleSize; + /// + /// When one or more audio streams is being played in the processes of + /// various microphones, it is often desirable to attempt to remove the + /// sound being played from the input signals recorded by the microphones. + /// This is referred to as echo cancellation. There are cases where it is + /// not needed and it is desirable to turn it off so that no audio artifacts + /// are introduced. This allows applications to control this behavior. + /// + bool echoCancellation; + /// + /// The latency or latency range, in seconds. The latency is the time + /// between start of processing (for instance, when sound occurs in + /// the real world) to the data being available to the next step in + /// the process. Low latency is critical for some applications; high + /// latency may be acceptable for other applications because it helps + /// with power constraints. The number is expected to be the target + /// latency of the configuration; the actual latency may show some + /// variation from that. + /// + bool latency; + /// + /// The number of independent channels of sound that the audio data contains, + /// i.e. the number of audio samples per sample frame. + /// + bool channelCount; + /// + /// The origin-unique identifier for the source of the MediaStreamTrack. + /// + bool deviceId; + /// + /// The browsing session-unique group identifier for the source of the MediaStreamTrack. + /// + bool groupId; + + /// + /// Constructs an empty instance of a MediaTrackSupportedConstraints object. + /// + [constructor, default] + void MediaTrackSupportedConstraints(); + /// + /// Constructs an instance of a MediaTrackSupportedConstraints object by cloning an existing object. + /// + [constructor, altname(MediaTrackSupportedConstraintsClone)] + void MediaTrackSupportedConstraints(MediaTrackSupportedConstraints source); + /// + /// Constructs an instance of a MediaTrackSupportedConstraints object by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaTrackSupportedConstraintsWithJson)] + void MediaTrackSupportedConstraints(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// Media device information representing the User Agent's available + /// media input and output devices. + /// + [dictionary] + struct MediaDeviceInfo + { + /// + /// Describes the kind of the represented device. + /// + MediaDeviceKind kind = audioInput; + /// + /// A label describing this device (for example "External USB Webcam"). + /// If the device has no associated label, then this attribute must + /// return the empty string. + /// + string label; + /// + /// A unique identifier for the represented device. + /// + string deviceId; + /// + /// Returns the group identifier of the represented device. Two devices + /// have the same group identifier if they belong to the same physical + /// device; for example a monitor with a built-in camera and microphone. + /// + string groupId; + + /// + /// Constructs an empty instance of a MediaDeviceInfo object. + /// + [constructor, default] + void MediaDeviceInfo(); + /// + /// Constructs an instance of a MediaDeviceInfo object by cloning object data from an existing object. + /// + [constructor, altname(MediaDeviceInfoClone)] + void MediaDeviceInfo(MediaDeviceInfo source); + /// + /// Constructs an instance of a MediaDeviceInfo object by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaDeviceInfoWithJson)] + void MediaDeviceInfo(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + interface MediaDevices + { + typedef std::list DeviceList; + typedef std::list TrackList; + typedef zs::PromiseWith PromiseWithDeviceList; + typedef zs::PromiseWith PromiseWithTrackList; + + [constructor, delete] + void MediaDevices(); + + /// + /// Gets the media devices singleton object. + /// + [static, getter] + MediaDevices singleton; + + /// + /// Returns a dictionary whose members are the constrainable properties + /// known to the User Agent. A supported constrainable property must be + /// represented and any constrainable properties not supported by the + /// User Agent must not be present in the returned dictionary. The + /// values returned represent what the browser implements and will not + /// change during a browsing session. + /// + /// MediaTrackSupportedConstraints + [static] + MediaTrackSupportedConstraints getSupportedConstraints(); + + /// + /// Collects information about the User Agent's available media input + /// and output devices. + /// + /// IAsyncOperation vector list of MediaDeviceInfo + [static] + PromiseWithDeviceList enumerateDevices(); + + /// + /// Grant access to the user for permission to use their Web cam or + /// other video or audio input. + /// + [static] + PromiseWithTrackList getUserMedia(MediaStreamConstraints constraints); + + /// + /// The set of media devices, available to the User Agent, has changed. + /// The current list devices can be retrieved with the + /// EnumerateDevices() method. + /// + /// + [event] + void onDeviceChange(); + }; + + /// + /// Interface for controlling the behavior of media. + /// + [special, static] + interface MediaControl + { + /// + /// Gets or sets the media engine the application orientation has changed. + /// + [static, getter, setter] + Any displayOrientation; + }; + + } +} diff --git a/ortc/idl/MediaStreamTrack.idl b/ortc/idl/MediaStreamTrack.idl new file mode 100644 index 00000000..878721fe --- /dev/null +++ b/ortc/idl/MediaStreamTrack.idl @@ -0,0 +1,780 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// Capabilities is a dictionary containing one or more key-value pairs, + /// where each key must be a constrainable property, and each value must + /// be a subset of the set of values allowed for that property. The exact + /// type of the value expression depends on the type of the property. + /// The Capabilities dictionary specifies which constrainable properties + /// that can be applied, as constraints, to the constrainable object. + /// + [dictionary] + struct MediaTrackCapabilities + { + typedef std::list BoolList; + + /// + /// The width or width range, in pixels. As a capability, the range should span the + /// video source's pre-set width values with min being the smallest width and max + /// being the largest width. + /// + [optional] + LongRange width; + /// + /// The height or height range, in pixels. As a capability, the range should span + /// the video source's pre-set height values with min being the smallest height and + /// max being the largest height. + /// + [optional] + LongRange height; + /// + /// The exact aspect ratio (width in pixels divided by height in pixels, represented + /// as a double rounded to the tenth decimal place) or aspect ratio range. + /// + [optional] + DoubleRange aspectRatio; + /// + /// The exact frame rate (frames per second) or frame rate range. If this frame + /// rate cannot be determined (e.g. the source does not natively provide a frame rate, + /// or the frame rate cannot be determined from the source stream), then this value + /// must refer to the User Agent's vsync display rate. + /// + [optional] + DoubleRange frameRate; + /// + /// This string (or each string, when a list) should be one of the members of + /// VideoFacingMode. The members describe the directions that the camera can + /// face, as seen from the user's perspective. Note that getConstraints may + /// not return exactly the same string for strings not in this enum. This + /// preserves the possibility of using a future version of enum for + /// this property. + /// + StringList facingMode; + /// + /// The volume or volume range, as a multiplier of the linear audio sample + /// values. A volume of 0.0 is silence, while a volume of 1.0 is the maximum + /// supported volume. A volume of 0.5 will result in an approximately 6 dBSPL + /// change in the sound pressure level from the maximum volume. Note that any + /// ConstraintSet that specifies values outside of this range of 0 to 1 can + /// never be satisfied. + /// + [optional] + DoubleRange volume; + /// + /// The sample rate in samples per second for the audio data. + /// + [optional] + LongRange sampleRate; + /// + /// The linear sample size in bits. This constraint can only be satisfied for + /// audio devices that produce linear samples. + /// + [optional] + LongRange sampleSize; + /// + /// When one or more audio streams is being played in the processes of + /// various microphones, it is often desirable to attempt to remove the + /// sound being played from the input signals recorded by the microphones. + /// This is referred to as echo cancellation. There are cases where it is + /// not needed and it is desirable to turn it off so that no audio artifacts + /// are introduced. This allows applications to control this behavior. + /// + BoolList echoCancellation; + /// + /// The latency or latency range, in seconds. The latency is the time + /// between start of processing (for instance, when sound occurs in + /// the real world) to the data being available to the next step in + /// the process. Low latency is critical for some applications; high + /// latency may be acceptable for other applications because it helps + /// with power constraints. The number is expected to be the target + /// latency of the configuration; the actual latency may show some + /// variation from that. + /// + [optional] + DoubleRange latency; + /// + /// The number of independent channels of sound that the audio data contains, + /// i.e. the number of audio samples per sample frame. + /// + [optional] + LongRange channelCount; + + /// + /// The origin-unique identifier for the source of the MediaStreamTrack. + /// + string deviceId; + /// + /// The browsing session-unique group identifier for the source of the MediaStreamTrack. + /// + string groupId; + + /// + /// Constructs an empty instance of a MediaTrackCapabilities object. + /// + [constructor, default] + void MediaTrackCapabilities(); + /// + /// Constructs an instance of a MediaTrackCapabilities object by cloning object data from an existing object. + /// + [constructor, altname(MediaTrackCapabilitiesClone)] + void MediaTrackCapabilities(MediaTrackCapabilities source); + /// + /// Constructs an instance of a MediaTrackCapabilities object by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaTrackCapabilitiesWithJson)] + void MediaTrackCapabilities(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// Settings is a dictionary containing one or more key-value pairs. + /// It must contain each key returned in GetCapabilities(). There must be + /// a single value for each key and the value must be a member of the set + /// defined for that property by getCapabilities(). The Settings + /// dictionary contains the actual values that the User Agent has chosen + /// for the object's constrainable properties. The exact syntax of the + /// value depends on the type of the property. + /// + [dictionary] + struct MediaTrackSettings + { + /// + /// The width or width range, in pixels. As a capability, the range should span the + /// video source's pre-set width values with min being the smallest width and max + /// being the largest width. + /// + [optional] + long width; + /// + /// The height or height range, in pixels. As a capability, the range should span + /// the video source's pre-set height values with min being the smallest height and + /// max being the largest height. + /// + [optional] + long height; + /// + /// The exact aspect ratio (width in pixels divided by height in pixels, represented + /// as a double rounded to the tenth decimal place) or aspect ratio range. + /// + [optional] + double aspectRatio; + /// + /// The exact frame rate (frames per second) or frame rate range. If this frame + /// rate cannot be determined (e.g. the source does not natively provide a frame rate, + /// or the frame rate cannot be determined from the source stream), then this value + /// must refer to the User Agent's vsync display rate. + /// + [optional] + double frameRate; + /// + /// This string (or each string, when a list) should be one of the members of + /// VideoFacingMode. The members describe the directions that the camera can + /// face, as seen from the user's perspective. Note that getConstraints may + /// not return exactly the same string for strings not in this enum. This + /// preserves the possibility of using a future version of enum for + /// this property. + /// + [optional] + string facingMode; + /// + /// The volume or volume range, as a multiplier of the linear audio sample + /// values. A volume of 0.0 is silence, while a volume of 1.0 is the maximum + /// supported volume. A volume of 0.5 will result in an approximately 6 dBSPL + /// change in the sound pressure level from the maximum volume. Note that any + /// ConstraintSet that specifies values outside of this range of 0 to 1 can + /// never be satisfied. + /// + [optional] + double volume; + /// + /// The sample rate in samples per second for the audio data. + /// + [optional] + long sampleRate; + /// + /// The linear sample size in bits. This constraint can only be satisfied for + /// audio devices that produce linear samples. + /// + [optional] + long sampleSize; + /// + /// When one or more audio streams is being played in the processes of + /// various microphones, it is often desirable to attempt to remove the + /// sound being played from the input signals recorded by the microphones. + /// This is referred to as echo cancellation. There are cases where it is + /// not needed and it is desirable to turn it off so that no audio artifacts + /// are introduced. This allows applications to control this behavior. + /// + [optional] + bool echoCancellation; + /// + /// The latency or latency range, in seconds. The latency is the time + /// between start of processing (for instance, when sound occurs in + /// the real world) to the data being available to the next step in + /// the process. Low latency is critical for some applications; high + /// latency may be acceptable for other applications because it helps + /// with power constraints. The number is expected to be the target + /// latency of the configuration; the actual latency may show some + /// variation from that. + /// + [optional] + double latency; + /// + /// The number of independent channels of sound that the audio data contains, + /// i.e. the number of audio samples per sample frame. + /// + [optional] + long channelCount; + /// + /// The origin-unique identifier for the source of the MediaStreamTrack. + /// + + [optional] + string deviceId; + /// + /// The browsing session-unique group identifier for the source of the MediaStreamTrack. + /// + [optional] + string groupId; + + /// + /// Constructs an empty MediaTrackSettings object instance. + /// + [constructor, default] + void MediaTrackSettings(); + /// + /// Constructs an MediaTrackSettings object instance by cloning object data from an existing object. + /// + [constructor, altname(MediaTrackSettingsClone)] + void MediaTrackSettings(MediaTrackSettings source); + /// + /// Constructs an MediaTrackSettings object instance by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaTrackSettingsWithJson)] + void MediaTrackSettings(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// Each member of a ConstraintSet corresponds to a constrainable property + /// and specifies a subset of the property's legal Capability values. + /// Applying a ConstraintSet instructs the User Agent to restrict the + /// settings of the corresponding constrainable properties to the + /// specified values or ranges of values. A given property may occur both + /// in the basic Constraints set and in the advanced ConstraintSets list, + /// and may occur at most once in each ConstraintSet in the advanced list. + /// + [dictionary] + struct MediaTrackConstraintSet + { + /// + /// The width or width range, in pixels. As a capability, the range + /// should span the video source's pre-set width values with min being + /// the smallest width and max being the largest width. + /// + ConstrainLong width; + /// + /// The height or height range, in pixels. As a capability, the range + /// should span the video source's pre-set height values with min being + /// the smallest height and max being the largest height. + /// + ConstrainLong height; + /// + /// The exact aspect ratio (width in pixels divided by height in pixels, + /// represented as a double rounded to the tenth decimal place) or + /// aspect ratio range. + /// + ConstrainDouble aspectRatio; + /// + /// The exact frame rate (frames per second) or frame rate range. If + /// this frame rate cannot be determined (e.g. the source does not + /// natively provide a frame rate, or the frame rate cannot be + /// determined from the source stream), then this value must refer to + /// the User Agent's vsync display rate. + /// + ConstrainDouble frameRate; + /// + /// This string (or each string, when a list) should be one of the + /// members of VideoFacingModeEnum. The members describe the directions + /// that the camera can face, as seen from the user's perspective. Note + /// that getConstraints may not return exactly the same string for + /// strings not in this enum. This preserves the possibility of using a + /// future version of WebIDL enum for this property. + /// + ConstrainString facingMode; + /// + /// The volume or volume range, as a multiplier of the linear audio + /// sample values. A volume of 0.0 is silence, while a volume of 1.0 is + /// the maximum supported volume. A volume of 0.5 will result in an + /// approximately 6 dBSPL change in the sound pressure level from the + /// maximum volume. Note that any ConstraintSet that specifies values + /// outside of this range of 0 to 1 can never be satisfied. + /// + ConstrainDouble volume; + /// + /// The sample rate in samples per second for the audio data. + /// + ConstrainLong sampleRate; + /// + /// The linear sample size in bits. This constraint can only be + /// satisfied for audio devices that produce linear samples. + /// + ConstrainLong sampleSize; + /// + /// When one or more audio streams is being played in the processes of + /// various microphones, it is often desirable to attempt to remove the + /// sound being played from the input signals recorded by the + /// microphones. This is referred to as echo cancellation. There are + /// cases where it is not needed and it is desirable to turn it off so + /// that no audio artifacts are introduced. This allows applications to + /// control this behavior. + /// + ConstrainBoolean echoCancellation; + /// + /// The latency or latency range, in seconds. The latency is the time + /// between start of processing (for instance, when sound occurs in the + /// real world) to the data being available to the next step in the + /// process. Low latency is critical for some applications; high latency + /// may be acceptable for other applications because it helps with power + /// constraints. The number is expected to be the target latency of the + /// configuration; the actual latency may show some variation from that. + /// + ConstrainDouble latency; + /// + /// The number of independent channels of sound that the audio data + /// contains, i.e. the number of audio samples per sample frame. + /// + ConstrainLong channelCount; + /// + /// The origin-unique identifier for the source of the MediaStreamTrack. + /// The same identifier must be valid between browsing sessions of this + /// origin, but must also be different for other origins. Some sort of + /// GUID is recommended for the identifier. Note that the setting of + /// this property is uniquely determined by the source that is attached + /// to the MediaStreamTrack. In particular, getCapabilities() will + /// return only a single value for deviceId. This property can therefore + /// be used for initial media selection with getUserMedia(). However, + /// it is not useful for subsequent media control with + /// applyConstraints(), since any attempt to set a different value will + /// result in an unsatisfiable ConstraintSet. + /// + ConstrainString deviceId; + /// + /// The browsing session-unique group identifier for the source of the + /// MediaStreamTrack. Two devices have the same group identifier if they + /// belong to the same physical device; for example, the audio input and + /// output devices representing the speaker and microphone of the same + /// headset would have the same groupId. Note that the setting of this + /// property is uniquely determined by the source that is attached to + /// the MediaStreamTrack. In particular, getCapabilities() will return + /// only a single value for groupId. Since this property is not stable + /// between browsing sessions its usefulness for initial media selection + /// with getUserMedia() is limited. It is not useful for subsequent + /// media control with applyConstraints(), since any attempt to set a + /// different value will result in an unsatisfiable ConstraintSet. + /// + ConstrainString groupId; + + /// + /// Constructs an empty MediaTrackConstraintSet object instance. + /// + [constructor, default] + void MediaTrackConstraintSet(); + /// + /// Constructs an MediaTrackConstraintSet object instance by cloning object data an existing object. + /// + [constructor, altname(MediaTrackConstraintSetClone)] + void MediaTrackConstraintSet(MediaTrackConstraintSet source); + /// + /// Constructs an MediaTrackConstraintSet object instance by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaTrackConstraintSetWithJson)] + void MediaTrackConstraintSet(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// MediaTrackConstraints represents a set of media stream track constraints to be applied to a MediaStreamTrack. + /// + [dictionary] + struct MediaTrackConstraints : MediaTrackConstraintSet + { + typedef std::list ConstraintSetList; + + /// + /// Gets or sets the advanced list of ConstraintSets that the User Agent + /// must attempt to satisfy, in order, skipping only those that cannot + /// be satisfied. The order of these ConstraintSets is significant. In + /// particular, when they are passed as an argument to applyConstraints, + /// the User Agent must try to satisfy them in the order that is + /// specified. Thus if optional ConstraintSets C1 and C2 can be + /// satisfied individually, but not together, then whichever of C1 and + /// C2 is first in this list will be satisfied, and the other will not. + /// The User Agent must attempt to satisfy all optional ConstraintSets + /// in the list, even if some cannot be satisfied. Thus, in the + /// preceding example, if optional constraint C3 is specified after C1 + /// and C2, the User Agent will attempt to satisfy C3 even though C2 + /// cannot be satisfied. Note that a given property name may occur only + /// once in each ConstraintSet but may occur in more than one + /// ConstraintSet. + /// + ConstraintSetList advanced; + + /// + /// Constructs an empty instance of the MediaTrackConstraints object. + /// + [constructor, default] + void MediaTrackConstraints(); + /// + /// Constructs an instance of the MediaTrackConstraints object by cloning object data from an existing object. + /// + [constructor, altname(MediaTrackConstraintsClone)] + void MediaTrackConstraints(MediaTrackConstraints source); + /// + /// Constructs an instance of the MediaTrackConstraints object by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaTrackConstraintsWithJson)] + void MediaTrackConstraints(Json json); + }; + + /// + /// The MediaStreamConstraints dictionary is used to instruct the User + /// Agent what sort of MediaStreamTracks to include in the MediaStream + /// returned by GetUserMedia(). + /// + [dictionary] + struct MediaStreamConstraints + { + /// + /// If set, it requests that the returned MediaStream contain an audio + /// track. If a Constraints structure is provided, it further specifies + /// the nature and settings of the audio Track. If not set, the + /// MediaStream must not contain an audio Track. + /// + [optional, nullable] + MediaTrackConstraints audio; + /// + /// If set, it requests that the returned MediaStream contain a video + /// track. If a Constraints structure is provided, it further specifies + /// the nature and settings of the video Track. If not set, the + /// MediaStream must not contain a video Track. + /// + [optional, nullable] + MediaTrackConstraints video; + + /// + /// Constructs an empty instance of the MediaStreamConstraints object. + /// + [constructor, default] + void MediaStreamConstraints(); + /// + /// Constructs an instance of the MediaStreamConstraints object by cloning object data from an existing object. + /// + [constructor, altname(MediaStreamConstraintsClone)] + void MediaStreamConstraints(MediaStreamConstraints source); + /// + /// Constructs an instance of the MediaStreamConstraints object by extracting object data from a JSON object. + /// + [constructor, default, altname(MediaStreamConstraintsWithJson)] + void MediaStreamConstraints(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The constraint attribute is set to the name of any one of the + /// constraints that caused the error, if any. + /// + [dictionary] + struct OverconstrainedError + { + /// + /// Gets a string representing one of the error type names. + /// + string name; + /// + /// The constraint property name where the error originated. + /// + string constraint; + /// + /// A message describing the error condition for the constraint. + /// + string message; + }; + typedef PromiseRejectionReason PromiseRejectionReasonOverconstrainedError; + + /// + /// This error event fires for each affected track (when multiple tracks + /// share the same source) after the User Agent has evaluated the current + /// constraints against a given source and is not able to configure the + /// source within the limitations established by the intersection of + /// imposed constraints. + /// + /// Due to being over - constrained, the User Agent must mute each + /// affected track. + /// + /// The affected track(s) will remain muted until the application adjusts + /// the constraints to accommodate the source's current effective + /// capabilities. + /// + struct OverconstrainedErrorEvent + { + /// + /// Gets the OverconstrainedError describing the error associated with + /// the event (if any). + /// + [getter] + OverconstrainedError error; + }; + + /// + /// MediaSource represents an object holder for a platform specific media source. + /// + [special] + struct MediaSource + { + /// + /// Gets or sets the platform specific media source. + /// + [getter, setter] + zs::Any source; + + /// + /// Gets or sets the media track associated to the media source. + /// + [getter] + zs::Any track; + }; + + /// + /// A MediaStreamTrack object represents a media source in the User Agent. + /// An example source is a device connected to the User Agent. Other + /// specifications may define sources for MediaStreamTrack that override + //// the behavior specified here. Several MediaStreamTrack objects can + //// represent the same media source, e.g., when the user chooses the same + //// camera in the UI shown by two consecutive calls to getUserMedia() . + /// + interface MediaStreamTrack + { + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets a kind attribute that must return the string "Audio" if this + /// object represents an audio track or "Video" if this object + /// represents a video track. + /// + [getter] + MediaStreamTrackKind kind; + + /// + /// Gets a User Agent generated an identifier string. + /// + [getter] + string id; + + /// + /// Gets a unique identifier for the represented device. + /// + [getter] + string deviceId; + + /// + /// Gets the label of the object's corresponding source, if any. If + /// the corresponding source has or had no label, the attribute must + /// instead return the empty string.. + /// User Agents may label audio and video sources (e.g., "Internal + /// microphone" or "External USB Webcam"). + /// + [getter] + string label; + + /// + /// Gets or sets the enabled state for the object. On getting, the + /// attribute must return the value to which it was last set. On + /// setting, it must be set to the new value. + /// + [getter, setter] + bool enabled; + + /// + /// Gets or sets the muted state of the object. + /// + /// true if the track is muted, and false otherwise. + [getter, setter] + bool muted; + + /// + /// Gets if the track source origin is local or remote. + /// + /// true if the source origin is remote, otherwise false + [getter] + bool remote; + + /// + /// Gets the state of the track. + /// + /// The value as most recently set by the User Agent. + [getter] + MediaStreamTrackState readyState; + + /// + /// Gets or sets a MediaSource capable of being rendered to an output + /// window based upon the current track. + /// + [getter] + MediaSource source; + + [constructor, delete] + void MediaStreamTrack(); + + /// + /// Clones this MediaStreamTrack. + /// + MediaStreamTrack clone(); + + /// When a MediaStreamTrack object's stop() method is invoked, the User Agent must run following steps: + /// 1. Let track be the current MediaStreamTrack object. + /// 2. Notify track's source that track is ended. + /// A source that is notified of a track ending will be stopped, + /// unless other MediaStreamTrack objects depend on it + /// 3. Set track's readyState attribute to ended. + void stop(); + + /// + /// Returns the dictionary of the names of the constrainable properties + /// that the object supports. + MediaTrackCapabilities getCapabilities(); + /// + /// Returns the Constraints that were the argument to the most recent + /// successful call of ApplyConstraints(), maintaining the order in + /// which they were specified. Note that some of the optional + /// ConstraintSets returned may not be currently satisfied. To check + /// which ConstraintSets are currently in effect, the application should + /// use GetSettings. + /// + MediaTrackConstraints getConstraints(); + /// + /// Returns the current settings of all the constrainable properties of + /// the object, whether they are platform defaults or have been set by + /// ApplyConstraints(). Note that the actual setting of a property must + /// be a single value. + /// + MediaTrackSettings getSettings(); + + /// + /// The User Agent may choose new settings for the constrainable + /// properties of the object at any time. When it does so it must + /// attempt to satisfy the current Constraints + /// + zs::Promise applyConstraints(MediaTrackConstraints constraints) throws(InvalidParameters); + + /// + /// The MediaStreamTrack object's source is temporarily unable to + /// provide data. + /// + [event] + void onMute(); + + /// + /// The MediaStreamTrack object's source is live again after having been + /// temporarily unable to provide data. + /// + [event] + void onUnmute(); + + /// + /// The MediaStreamTrack object's source will no longer provide any + /// data, either because the user revoked the permissions, or because + /// the source device has been ejected, or because the remote peer + /// permanently stopped sending data. + /// + [event] + void onEnded(); + + /// + /// This error event fires for each affected track(when multiple tracks + /// share the same source) after the User Agent has evaluated the + /// current constraints against a given source and is not able to + /// configure the source within the limitations established by the + /// intersection of imposed constraints. + /// + /// Due to being over - constrained, the User Agent must mute each + /// affected track. + /// + /// The affected track(s) will remain muted until the application + /// adjusts the constraints to accommodate the source's current + /// effective capabilities. + /// + [event] + void onOverConstrained(OverconstrainedErrorEvent event); + }; + } +} diff --git a/ortc/idl/Ortc.idl b/ortc/idl/Ortc.idl new file mode 100644 index 00000000..485d2bfd --- /dev/null +++ b/ortc/idl/Ortc.idl @@ -0,0 +1,189 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + using namespace zs; + + typedef zs::exceptions::InvalidArgument InvalidParameters; + typedef zs::exceptions::BadState InvalidStateError; + typedef zs::exceptions::NotSupported NotSupported; + typedef zs::exceptions::NotImplemented NotImplemented; + typedef zs::exceptions::UnexpectedError Unexpected; + + /// + /// A message queue for receiving delegate events. + /// + [special] + interface EventQueue + { + /// + /// Constructs an event queue object. + /// + [constructor, delete] + void EventQueue(); + + /// + /// Constructs an event queue object from a native queue type. + /// + [constructor, default] + void EventQueue(Any queue); + + /// + /// The default windows message queue for the system GUI thread. + /// + [static] + EventQueue getDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + [static, getter, setter] + EventQueue singleton; + + /// + /// Gets a native queue from an event queue object. + /// + [getter] + Any queue; + }; + + [special, static, platform(webhidden)] + interface EventQueueMaker + { + /// + /// Creates an event queue object from a native queue type. + /// + [static] + EventQueue bindQueue(Any queue); + /// + /// Extracts a native queue from an event queue object. + /// + [static] + Any extractQueue(EventQueue queue); + }; + + /// + /// An object representation of a JSON blob. + /// + interface Json + { + /// + /// Construct an object representation of a JSON blob from a string. + /// + [constructor] + void Json(string jsonString); + + /// + /// Convert the JSON object into a string. + /// + string toString(); + }; + + /// + /// Setup methods for the ORTC Lib stack. + /// + [static] + interface OrtcLib + { + /// + /// Initialize the ORTC stack. + /// + [static, default] + void setup(); + + /// + /// Initialize the ORTC stack with a target event queue for delegate events. + /// + [static, altname(setupWithQueue)] + void setup(EventQueue queue); + + /// + /// Gets or sets the NTP server time discovered in milliseconds since + /// NTP epoch. This property must only be set at the actual moment when + /// the server time was discovered to ensure the NTP clock is as closed + /// to accurate as possible. + /// + [static] + Milliseconds ntpServerTime; + + /// + /// Starts media engine trancing system. The collected traces can be + /// saved to file or sent to TCP listener. Traces can be visualised + /// further by importing the data into Chrome browser tool that can be + /// accessed using following option - chrome://tracing. + /// This method starts the tracing engine. + /// + [static] + void startMediaTracing(); + /// + /// Stops media tracing process. + /// + [static] + void stopMediaTracing(); + /// + /// Indicates whether tracing system is activated. + /// + [static] + bool isMediaTracing(); + /// + /// Saves media trace data to the file specified by filename. + /// + [static] + bool saveMediaTrace(string filename); + /// + /// Sends all traced data to TCP listener specified by host name and port. + /// + [static, altname(saveMediaTraceWithHostPort)] + bool saveMediaTrace(string host, int port); + + /// + /// Notify the application is going to the background. + /// + [static] + zs::Promise notifyGoingToBackground(); + + /// + /// Notify the application is going to the background immediately. + /// + [static] + void notifyGoingToBackgroundNow(); + + /// + /// Notify the application is returning from the background. + /// + [static] + void notifyReturningFromBackground(); + }; + } +} diff --git a/ortc/idl/RtpListener.idl b/ortc/idl/RtpListener.idl new file mode 100644 index 00000000..1eedd1e7 --- /dev/null +++ b/ortc/idl/RtpListener.idl @@ -0,0 +1,127 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// This object is fired when the RTCRtpListener detects an RTP stream + /// that is not configured to be processed by an existing RTCRtpReceiver + /// object. + /// + struct RTCRtpUnhandledEvent + { + /// + /// Gets the SSRC in the RTP stream triggering the OnUnhandledRtp event. + /// + [getter] + SsrcType ssrc; + /// + /// Gets the Payload Type value in the RTP stream triggering the + /// OnUnhandledRtp event. + /// + [getter] + PayloadType payloadType; + /// + /// Gets the value of the MID RTP header extension [BUNDLE] in + /// the RTP stream triggering the OnUnhandledRtp event if present. + /// + [getter] + string muxId; + /// + /// Gets the value of the RID RTP header extension [RID] in the + /// RTP stream triggering the OnUnhandledRtp event if present. + /// + [getter] + string rid; + }; + + /// + /// The RTCRtpListener listens to RTP packets received from the + /// RTCDtlsTransport, determining whether an incoming RTP stream is + /// configured to be processed by an existing RTCRtpReceiver object. If no + /// match is found, the unhandledrtp event is fired. This can be due to + /// packets having an unknown SSRC, payload type or any other error that + /// makes it impossible to attribute an RTP packet to a specific + /// RTCRtpReceiver object. The event is not fired once for each arriving + /// packet; multiple discarded packets for the same SSRC should result in + /// a single event. + /// + interface RTCRtpListener : RTCStatsProvider + { + typedef std::list HeaderExtensionParametersList; + + /// + /// Construct an instance of RTCRtpListener from an RTCDtlsTransport + /// object. + /// + [constructor] + void RTCRtpListener(RTCRtpTransport transport); + [constructor, altname(RTCRtpListenerWithHeaderExtensions)] + /// + /// Construct an instance of RTCRtpListener from an RTCDtlsTransport + /// object and the mapped header extensions to properly interpret + /// RTP header extensions. + /// + void RTCRtpListener( + RTCRtpTransport transport, + HeaderExtensionParametersList headerExtensions + ) throws(InvalidParameters); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the RTP RTPDtlsTransport or RTPSrtpSdesTransport instance. + /// + [getter] + RTCRtpTransport transport; + + /// + /// Set a list of header extensions that can be interpreted by the listener + /// on incoming RTP packets. + /// + void setHeaderExtensions(HeaderExtensionParametersList headerExtensions) throws(InvalidParameters); + + /// + /// The event handler emits the RTCRtpUnhandledEvent, which is fired + /// when the RTCRtpListener detects an RTP stream that is not configured + /// to be processed by an existing RTCRtpReceiver object. + /// + [event] + void onUnhandled(RTCRtpUnhandledEvent event); + }; + } +} diff --git a/ortc/idl/RtpReceiver.idl b/ortc/idl/RtpReceiver.idl new file mode 100644 index 00000000..a58cb729 --- /dev/null +++ b/ortc/idl/RtpReceiver.idl @@ -0,0 +1,232 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The RTCRtpContributingSource object contains information about a + /// contributing source. Each time an RTP packet is received, the + /// RTCRtpContributingSource objects are updated. If the RTP packet + /// contains CSRCs, then the RTCRtpContributingSource objects + /// corresponding to those CSRCs are updated, and the level values for + /// those CSRCs are updated based on the mixer-client header extension + /// [RFC6464] if present. If the RTP packet contains no CSRCs, then the + /// RTCRtpContributingSource object corresponding to the SSRC is updated, + /// and the level value for the SSRC is updated based on the client-mixer + /// header extension [RFC6464] if present. + /// + [dictionary] + struct RTCRtpContributingSource + { + /// + /// Gets the timestamp indicating the time of reception of the most + /// recent RTP packet containing the source. The timestamp corresponds + /// to a local clock. + /// + Time timestamp; + /// + /// Gets the CSRC or SSRC value of the contributing source. + /// + SsrcType csrc; + /// + /// The audio level contained in the last RTP packet received from this + /// source. If the source was set from an SSRC, this will be the level + /// value in [RFC6464]. If the source was set from a CSRC, this will be + /// the level value in [RFC6465]. Both [RFC6464] and [RFC6465] define + /// the level as a integral value from 0 to 127 representing the audio + /// level in negative decibels relative to the loudest signal that they + /// system could possibly encode. Thus, 0 represents the loudest signal + /// the system could possibly encode, and 127 represents silence. + /// + uint8 audioLevel; + /// + /// Gets whether the last RTP packet received from this source contains + /// voice activity ("true") or not ("false"). Since the "V" bit is + /// supported in [RFC6464] but not [RFC6465], the voiceActivityFlag + /// attribute will only be set when receivers enable the client-mixer + /// header extension (setting the vad attribute to "true"), and when RTP + /// packets are received from senders enabling the client-mixer header + /// extension (setting the vad attribute to "true"). + /// + [optional] + bool voiceActivityFlag; + + /// + /// Constructs an empty instance of an RTCRtpContributingSource. + /// + [constructor, default] + void RTCRtpContributingSource(); + + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCRtpReceiver includes information relating to the RTP receiver. + /// + interaction RTCRtpReceiver : RTCStatsProvider + { + typedef std::list ContributingSourceList; + + /// + /// Constructs an instance of RTCRtpReceiver from a value of kind and an + /// RTCDtlsTransport object. If an attempt is made to construct an + /// RTCRtpReceiver object with transport.State "closed", throw an + /// InvalidStateError exception. Upon construction, Track is set, and + /// the value of track.Kind is determined based on the value of kind + /// passed in the constructor. + /// + [constructor] + void RTCRtpReceiver( + MediaStreamTrackKind kind, + RTCRtpTransport transport, + ) throws (InvalidParameters, InvalidStateError); + /// + /// Constructs an instance of RTCRtpReceiver from a value of kind and an + /// RTCDtlsTransport object. If an attempt is made to construct an + /// RTCRtpReceiver object with transport.State or rtcpTransport.State + /// "closed", throw an InvalidStateError exception. Upon construction, + /// Track is set, and the value of track.Kind is determined based on + /// the value of kind passed in the constructor. + /// + [constructor, altname(RTCRtpReceiverWithRtcpTransport)] + void RTCRtpReceiver( + MediaStreamTrackKind kind, + RTCRtpTransport transport, + RTCRtcpTransport rtcpTransport + ) throws(InvalidParameters, InvalidStateError); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the associated MediaStreamTrack instance. Upon construction, Track + /// is set. The value of track.kind is determined based on the value of + /// kind passed in the constructor. + /// + [getter] + MediaStreamTrack track; + + /// + /// Gets the associated RTP RTCDtlsTransport instance. + /// + [getter] + RTCRtpTransport transport; + + /// + /// Gets the RTCDtlsTransport instance over which RTCP is sent and + /// received. When BUNDLE is used, many RTCRtpReceiver objects will + /// share one rtcpTransport and will all send and receive RTCP over the + /// same RTCDtlsTransport. When RTCP mux is used, rtcpTransport will be + /// null, and both RTP and RTCP traffic will flow over the + /// RTCDtlsTransport transport. + /// + [getter, nullable] + RTCRtcpTransport rtcpTransport; + + /// + /// Set the RTP RTCDtlsTransport. If the last call to + /// receive(parameters) had parameters.Rtcp.Mux set to false, throw an + /// InvalidParameters exception. If SetTransport() is called and + /// transport.State is "closed", throw an InvalidParameters exception. + /// + void setTransport(RTCRtpTransport transport) throws (InvalidParameters, InvalidStateError); + /// + /// Set the RTP RTCSrtpSdesTransport. If the last call to + /// receive(parameters) had parameters.Rtcp.Mux set to false, throw an + /// InvalidParameters exception. + /// + [altname(setTransportWithRtcpTransport)] + void setTransport( + RTCRtpTransport transport, + RTCRtcpTransport rtcpTransport + ) throws(InvalidParameters, InvalidStateError); + + /// + /// Obtain the receiver capabilities, based on kind. Capabilities such + /// as retransmission [RFC4588], redundancy [RFC2198], and Forward Error + /// Correction that do not have an associated value of kind are always + /// included, regardless of the value of kind passed to + /// GetCapabilities(). + /// + [static] + RTCRtpCapabilities getCapabilities([optional] MediaStreamTrackKind kind); + + /// + /// Media to be received is controlled by parameters. If + /// Receive(parameters) is called with invalid parameters, throw an + /// InvalidParameters exception. If rtcpTransport is not set and + /// Receive(parameters) is called with parameters.rtcp.mux set to false, + /// throw an InvalidParameters exception. The Receive() method does not + /// update parameters based on what is currently being received, so that + /// the value of parameters remains that last passed to the Receive() + /// method. The RTCRtpReceiver object starts receiving when Receive() is + /// called for the first time, and changes the receiving parameters when + /// Receive() is called again. The RTCRtpReceiver object stops receiving + /// when Stop() is called. For each value of i from 0 to the number of + /// codecs, check that each value of parameters.codecs[i].name not equal + /// to "red", "rtx" or a forward error correction codec is included in + /// GetCapabilities(kind).codecs[j].name, where j goes from 0 to the + /// number of codecs, and kind takes the value passed in the + /// RTCRtpReceiver constructor. If no match is found for any value of i, + /// throw an InvalidParameters exception. SSRC mis-usage also results in + /// an InvalidParameters exception. + /// + zs::Promise receive(RTCRtpParameters parameters) throws (InvalidParameters, InvalidStateError); + /// + /// Stops receiving the track on the wire. Stop is final like + /// MediaStreamTrack. + /// + void stop(); + + /// + /// Returns an RTCRtpContributingSource object for each unique CSRC or + /// SSRC received by this RTCRtpReceiver. The browser must keep + /// information from RTP packets received in the last 10 seconds. If no + /// contributing sources are available, an empty list is returned. + /// + ContributingSourceList getContributingSources(); + + /// + /// Solely used by the H.264/UC codec; for a receiver to request an SSRC from a sender (and not implemented by this client). + /// + void requestSendCsrc(SsrcType csrc); + }; + + } +} diff --git a/ortc/idl/RtpSender.idl b/ortc/idl/RtpSender.idl new file mode 100644 index 00000000..6f5b3096 --- /dev/null +++ b/ortc/idl/RtpSender.idl @@ -0,0 +1,205 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// This object is fired if an SSRC conflict is detected within the RTP + /// session or an SSRC misconfiguration is detected after Send() or + /// Receive() returns or when SetTransport() is called. + /// + struct RTCSsrcConflictEvent + { + [constructor, delete] + void RTCSsrcConflictEvent(); + + /// + /// Gets the ssrc attribute represents the conflicting SSRC that caused + /// the event. + /// + [getter] + SsrcType ssrc; + }; + + /// + /// The RTCRtpSender includes information relating to the RTP sender. + /// + interface RTCRtpSender : RTCStatsProvider + { + /// + /// Constructs an instance of an RTCRtpSender from an MediaStreamTrack + /// object and associated to an RTCDtlsTransport. If an attempt is made + /// to construct an RTCRtpSender object with transport.State + /// "closed", or if track.readyState is "ended", throw an + /// InvalidStateError exception. + /// + [constructor] + void RTCRtpSender( + MediaStreamTrack track, + RTCRtpTransport transport, + ) throws (InvalidParameters, InvalidStateError); + + /// + /// Constructs an instance of an RTCRtpSender from an MediaStreamTrack + /// object and associated to an RTCDtlsTransport. If an attempt is made + /// to construct an RTCRtpSender object with transport.State or + /// rtcpTransport.State "closed", or if track.readyState is "ended", + /// throw an InvalidStateError exception. + /// + [constructor, altname(RTCRtpSenderWithRtcpTransport)] + void RTCRtpSender( + MediaStreamTrack track, + RTCRtpTransport transport, + RTCRtcpTransport rtcpTransport + ) throws(InvalidParameters, InvalidStateError); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Get the associated MediaStreamTrack instance. + /// + [getter] + MediaStreamTrack track; + + /// + /// Gets the RTCDtlsTransport instance over which RTCP is sent and + /// received. When BUNDLE is used, many RTCRtpSender objects will share + /// one rtcpTransport and will all send and receive RTCP over the same + // RTCDtlsTransport. When RTCP mux is used, rtcpTransport will be null, + /// and both RTP and RTCP traffic will flow over the RTCDtlsTransport + /// transport. + /// + [getter] + RTCRtpTransport transport; + + /// + /// Gets the associated RTCP RTCDtlsTransport instance if one was + /// provided in the constructor. When RTCP mux is used, rtcpTransport + /// will be null, and both RTP and RTCP traffic will flow over the + /// RTCDtlsTransport transport. + /// + [getter, nullable] + RTCRtcpTransport rtcpTransport; + + /// + /// Set the RTP RTCDtlsTransport. If the last call to + /// sender.Send(parameters) had parameters.rtcp.mux set to false, + /// throw an InvalidParameters exception. If SetTransport() is called + /// when transport.State is "closed", throw an InvalidStateError + /// exception. + /// + void setTransport( + RTCRtpTransport transport, + ) throws (InvalidParameters, InvalidStateError); + /// + /// Set the RTP RTCDtlsTransport and RTCP RTCDtlsTransport. If + /// SetTransport() is called when transport.State or rtcpTransport.State + /// is "closed", throw an InvalidStateError exception. + /// + [altname(setTransportWithRtcpTransport)] + void setTransport( + RTCRtpTransport transport, + RTCRtcpTransport rtcpTransport + ) throws(InvalidParameters, InvalidStateError); + + /// + /// Attempts to replace the track being sent with another track provided. + /// + zs::Promise setTrack(MediaStreamTrack track) throws(InvalidParameters, InvalidStateError); + + /// + /// Obtain the sender capabilities, based on kind. Capabilities such as + /// retransmission [RFC4588], redundancy [RFC2198], and Forward Error + /// Correction that do not have an associated value of kind are always + /// included, regardless of the value of kind passed to + /// GetCapabilities(). + /// + [static] + RTCRtpCapabilities getCapabilities([optional] MediaStreamTrackKind kind); + + /// + /// Media to be sent is controlled by parameters. If Send() is called + /// with invalid parameters, throw an InvalidParameters exception. If + /// rtcpTransport is not set and Send(parameters) is called with + /// parameters.rtcp.mux set to "false", throw an InvalidParameters + /// exception. For each value of i from 0 to the number of encodings, + /// check whether parameters.encodings[i].codecPayloadType corresponds + /// to a value of parameters.codecs[j].payloadType where j goes from 0 + /// to the number of codecs. If parameters.codecs[j].name is equal to + /// "red", "cn", "dtmf", "rtx" or a forward error correction codec, + /// throw an InvalidParameters exception. For each value of i from 0 to + /// the number of codecs, check that each value of + /// parameters.codecs[i].name not equal to "red", "rtx" or a forward + /// error correction codec is included in + /// GetCapabilities(track.kind).codecs[j].name, where j goes from 0 to + /// the number of codecs. If a match is not found for any value of i, + /// throw an InvalidParameters exception. If parameters.encodings is + /// unset, the browser behaves as though a single encodings[0] entry was + /// provided, with encodings[0].ssrc set to a browser-determined value, + /// encodings[0].active set to "true", encodings[0].codecPayloadType set + /// to codecs[j].payloadType where j is the index of the first codec + /// that is not "cn", "dtmf", "red", "rtx" or a forward error correction + /// codec, and all the other parameters.encodings[0] attributes (e.g. + /// fec, rtx, priority, maxBitrate, minQuality, resolutionScale,etc.) + /// unset. Calling Send(parameters) does not update parameters based on + /// what is currently being sent. The RTCRtpSender object starts sending + /// when Send() is called for the first time, and changes the sending + /// parameters when send() is called again. The RTCRtpSender object + /// stops sending when stop() is called. SSRC mis-usage results in an + /// InvalidParameters exception. + /// + zs::Promise send(RTCRtpParameters parameters) throws (InvalidParameters, InvalidStateError); + + /// + /// Stops sending the track on the wire, and sends an RTCP BYE. Stop is + /// final as in + /// + void stop(); + + /// + /// The OnSsrcConflict event handler, of event handler type + /// RTCSsrcConflictEvent, is fired if an SSRC conflict is detected + /// within the RTP session or an SSRC misconfiguration is detected + /// after Send() or Receive() returns or when SetTransport() is called. + /// In this situation, the RTCRtpSender automatically sends an RTCP BYE + /// on the conflicted SSRC, if RTP packets were sent using that SSRC. + /// + [event] + void onSsrcConflict(RTCSsrcConflictEvent conflict); + }; + } +} diff --git a/ortc/idl/RtpTypes.idl b/ortc/idl/RtpTypes.idl new file mode 100644 index 00000000..b00d575c --- /dev/null +++ b/ortc/idl/RtpTypes.idl @@ -0,0 +1,1424 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// A base object type representing codec capability objects available for a given codec. + /// + [dictionary] + struct RTCRtpCodecCapabilityOptions + { + [constructor, delete] + void RTCRtpCodecCapabilityOptions(); + }; + + /// + /// A base object type representing codec capability parameters for a given object. + /// + [dictionary] + struct RTCRtpCodecCapabilityParameters + { + [constructor, delete] + void RTCRtpCodecCapabilityParameters(); + }; + + [dictionary] + struct RTCRtpCodecParameterSettings + { + [constructor, delete] + void RTCRtpCodecParameterSettings(); + }; + + /// + /// RTCRtcpFeedback provides information on RTCP feedback messages. + /// + [dictionary] + struct RTCRtcpFeedback + { + /// + /// Gets or sets valid values for type are the "RTCP Feedback" Attribute + /// Values enumerated in [iana.org/assignments/sdp-parameters/sdp-parameters.xhtml#sdp-parameters-14] + /// ("ack", "ccm", "nack", etc.), as well as "goog-remb" + /// [draft-alvestrand-rmcat-remb] and "transport-cc" + /// [draft-holmer-rmcat-transport-wide-cc-extensions]. + /// + string type; + /// + /// Gets or sets the parameters associated with the Type. For a type of + /// "ack" or "nack", valid values for parameter are the "ack" and "nack" + /// Attribute Values enumerated in + /// [iana.org/assignments/sdp-parameters/sdp-parameters.xhtml#sdp-parameters-15] + /// ("sli", "rpsi", etc.). For the Generic NACK feedback message defined + /// in [RFC4585] Section 6.2.1, the type attribute is set to "nack" and + /// the parameter attribute is unset. For a type of "ccm", valid values + /// for parameter are the "Codec Control Messages" enumerated in + /// [iana.org/assignments/sdp-parameters/sdp-parameters.xhtml#sdp-parameters-19] + /// ("fir", "tmmbr" (includes "tmmbn"), etc.). + /// + string parameter; + + /// + /// Constructs an empty instance of a RTCRtcpFeedback object. + /// + [constructor, default] + void RTCRtcpFeedback(); + /// + /// Constructs an instance of a RTCRtcpFeedback object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtcpFeedbackClone)] + void RTCRtcpFeedback(RTCRtcpFeedback source); + /// + /// Constructs an instance of a RTCRtcpFeedback object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtcpFeedbackWithJson)] + void RTCRtcpFeedback(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCRtpCodecCapability provides information on the capabilities of a + /// codec. + /// + [dictionary] + struct RTCRtpCodecCapability + { + typedef std::list RtcpFeedbackList; + + /// + /// Gets or sets the MIME media type. Valid types are listed in + /// [iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2]. + /// + string name; + /// + /// Gets or sets the media supported by the codec: "audio", "video" or + /// "" for both. + /// + string kind; + /// + /// Gets or sets the codec clock rate expressed in Hertz. If unset, the + /// codec is applicable to any clock rate. + /// + [optional] + unsigned long clockRate; + /// + /// Gets or sets the preferred RTP payload type for the codec denoted by + /// RTCRtpCodecCapability.name. This attribute was added to make it + /// possible for the sender and receiver to pick a matching payload type + /// when creating sender and receiver parameters. When returned by + /// RTCRtpSender.GetCapabilities(), + /// RTCRtpCapabilities.Codecs.PreferredPayloadtype represents the + /// preferred RTP payload type for sending. When returned by + /// RTCRtpReceiver.GetCapabilities(), + /// RTCRtpCapabilities.Codecs.PreferredPayloadtype represents the + /// preferred RTP payload type for receiving. To avoid payload type + /// conflicts, each value of preferredPayloadType must be unique. + /// + PayloadType preferredPayloadType; + /// + /// Gets or sets the preferred duration of media represented by a packet + /// in milliseconds for the RTCRtpSender or RTCRtpReceiver. + /// + Milliseconds pTime; + /// + /// Gets or sets the maximum packetization time supported by the + /// RTCRtpReceiver. + /// + Milliseconds maxPTime; + /// + /// Gets or sets the number of channels supported (e.g. two for stereo). + /// For video, this attribute is unset. + /// + [optional] + unsigned long numChannels; + /// + /// Gets or sets the transport layer and codec-specific feedback + /// messages for this codec. + /// + RtcpFeedbackList rtcpFeedback; + /// + /// Gets or sets the codec-specific parameters that must be signaled to + /// the remote party. + /// + [dynamic] + RTCRtpCodecCapabilityParameters parameters; // OpusCodecCapabilityParameters, VP8CodecCapabilityParameters, H264CodecCapabilityParameters, RTXCodecCapabilityParameters, FlexFECCodecCapabilityParameters + /// + /// Gets or sets the codec-specific parameters available for signaling. + /// + [dynamic] + RTCRtpCodecCapabilityOptions options; // OpusCodecCapabilityOptions + /// + /// Gets or sets the maximum number of temporal layer extensions + /// supported by this codec (e.g. a value of 1 indicates support for up + /// to 2 temporal layers). A value of 0 indicates no support for + /// temporal scalability. + /// + unsigned short maxTemporalLayers; + /// + /// Gets or sets the maximum number of spatial layer extensions + /// supported by this codec (e.g. a value of 1 indicates support for up + /// to 2 spatial layers). A value of 0 indicates no support for spatial + /// scalability. + /// + unsigned short maxSpatialLayers; + /// + /// Gets or sets whether the implementation can send SVC layers + /// utilizing distinct SSRCs. Unset for audio codecs. For video codecs, + /// only set if the codec supports scalable video coding with multiple + /// streams. + /// + bool svcMultiStreamSupport; + + /// + /// Constructs an empty instance of an RTCRtpCodecCapability object. + /// + [constructor, default] + void RTCRtpCodecCapability(); + /// + /// Constructs an instance of an RTCRtpCodecCapability object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpCodecCapabilityClone)] + void RTCRtpCodecCapability(RTCRtpCodecCapability source); + /// + /// Constructs an instance of an RTCRtpCodecCapability object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpCodecCapabilityWithJson)] + void RTCRtpCodecCapability(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCRtpHeaderExtension dictionary enables a header extension to be + /// configured for use within an RTCRtpSender or RTCRtpReceiver. + /// + [dictionary] + struct RTCRtpHeaderExtension + { + /// + /// Gets or sets the media supported by the header extension: "audio" + /// for an audio codec, "video" for a video codec, and "" for both. + /// + string kind; + /// + /// Gets or sets the URI of the RTP header extension, as defined in + /// [RFC5285]. + /// + string uri; + /// + /// Gets or sets the preferred ID value that goes in the packet. + /// + uint16 preferredId; + /// + /// Gets or sets if it is preferred that the value in the header be + /// encrypted as per [RFC6904] if true. Default is to prefer + /// unencrypted. + /// + bool preferredEncrypt; + + /// + /// Constructs an empty instance of an RTCRtpHeaderExtension object. + /// + [constructor, default] + void RTCRtpHeaderExtension(); + /// + /// Constructs an instance of an RTCRtpHeaderExtension object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpHeaderExtensionClone)] + void RTCRtpHeaderExtension(RTCRtpHeaderExtension source); + /// + /// Constructs an instance of an RTCRtpHeaderExtension object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpHeaderExtensionWithJson)] + void RTCRtpHeaderExtension(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + + /// + /// The RTCRtpCapabilities object expresses the capabilities of + /// RTCRtpSender and RTCRtpReceiver objects. + /// + [dictionary] + struct RTCRtpCapabilities + { + typedef string FecMechanism; + typedef std::list CodecCapabilityList; + typedef std::list HeaderExtensionsList; + typedef std::list FecMechanismList; + + /// + /// Gets or sets the supported codecs. + /// + CodecCapabilityList codecs; + /// + /// + HeaderExtensionsList headerExtensions; + /// + /// Gets or sets the supported Forward Error Correction (FEC) + /// mechanisms. Values include "red", "red+ulpfec" and "flexfec". + /// [draft-ietf-rtcweb-fec] summarizes requirements relating to FEC + /// mechanisms. + /// + FecMechanismList fecMechanisms; + + /// + /// Constructs an empty instance of an RTCRtpCapabilities object. + /// + [constructor, default] + void RTCRtpCapabilities(); + /// + /// Constructs an instance of an RTCRtpCapabilities object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpCapabilitiesClone)] + void RTCRtpCapabilities(RTCRtpCapabilities source); + /// + /// Constructs an instance of an RTCRtpCapabilities object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpCapabilitiesWithJson)] + void RTCRtpCapabilities(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The following capability options are defined for Opus: + /// + [dictionary] + struct RTCRtpOpusCodecCapabilityOptions : RTCRtpCodecCapabilityOptions + { + // sender capabilities + /// + /// Gets or sets the default value for the encoder's computational + /// complexity. The supported range is 0-10 with 10 representing the + /// highest complexity. + /// + [optional] + unsigned long complexity; + /// + /// Gets or sets the default value for the type of signal being encoded. + /// Possible values are string version of enum OpusCodecSignal. + /// + [optional] + RTCRtpOpusCodecCapabilityOptionsSignal signal; + /// + /// Gets or sets the default value for the encoder's intended + /// application. Possible values are string version of enum + /// OpusCodecApplication. + /// + [optional] + RTCRtpOpusCodecCapabilityOptionsApplication application; + /// + /// Gets or sets the default value for the encoder's expected packet + /// loss percentage. Possible values are 0-100. + /// + [optional] + unsigned long packetLossPerc; + /// + /// Gets or sets the default value for whether prediction is disabled, + /// making frames almost complete independent (if true) or not (if false). + /// + [optional] + bool predictionDisabled; + + /// + /// Constructs an empty instance of an RTCRtpOpusCodecCapabilityOptions object. + /// + [constructor, default] + void RTCRtpOpusCodecCapabilityOptions(); + /// + /// Constructs an instance of an RTCRtpOpusCodecCapabilityOptions object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpOpusCodecCapabilityOptionsClone)] + void RTCRtpOpusCodecCapabilityOptions(RTCRtpOpusCodecCapabilityOptions source); + /// + /// Constructs an instance of an RTCRtpOpusCodecCapabilityOptions object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpOpusCodecCapabilityOptionsWithJson)] + void RTCRtpOpusCodecCapabilityOptions(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + // https://tools.ietf.org/html/rfc7587#section-6.1 + /// + /// The following optional capability parameters are defined for "opus", + /// as noted in [RFC7587] Section 6.1: + /// + [dictionary] + struct RTCRtpOpusCodecCapabilityParameters : RTCRtpCodecCapabilityParameters + { + /// + /// Gets or sets a hint about the maximum output sampling rate that the + /// receiver is capable of rendering in Hz. + /// + [optional] + unsigned long maxPlaybackRate; + /// + /// Gets or sets the maximum average receive bitrate of a session in + /// bits per second (bits/s). + /// + [optional] + unsigned long maxAverageBitrate; + /// + /// Gets or sets of whether the decoder prefers receiving stereo or + /// mono signals. + /// + [optional] + bool stereo; + /// + /// Gets or sets if the decoder prefers the use of constant bitrate (if + /// true) or variable bitrate (if false). + /// + [optional] + bool cbr; + /// + /// Gets or sets if the decoder has the capability to take advantage of + /// Opus in-band fec (if true) or not (if false). + /// + [optional] + bool useInbandFec; + /// + /// Gets or sets if the decoder prefers the use of DTX (if true) or not + /// (if false). + /// + [optional] + bool useDtx; + + // sender capability parameters + + /// + /// A hint about the maximum input sampling rate that the sender is + /// likely to produce. + /// + [optional] + unsigned long sPropMaxCaptureRate; + /// + /// Gets or sets whether the sender is likely to produce stereo audio. + /// + [optional] + bool sPropStereo; + + /// + /// Constructs an empty instance of an RTCRtpOpusCodecCapabilityParameters object. + /// + [constructor, default] + void RTCRtpOpusCodecCapabilityParameters(); + /// + /// Constructs an instance of an RTCRtpOpusCodecCapabilityParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpOpusCodecCapabilityParametersSource)] + void RTCRtpOpusCodecCapabilityParameters(RTCRtpOpusCodecCapabilityParameters source); + /// + /// Constructs an instance of an RTCRtpOpusCodecCapabilityParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpOpusCodecCapabilityParametersWithJson)] + void RTCRtpOpusCodecCapabilityParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + // https://tools.ietf.org/html/rfc7741#section-6.1 + /// + /// The following receiver capability parameters are defined for "vp8", as + /// noted in [RFC7741] Section 6.1: + /// + [dictionary] + struct RTCRtpVp8CodecCapabilityParameters : RTCRtpCodecCapabilityParameters, + RTCRtpCodecParameterSettings + { + /// + /// Gets or sets the maximum frame rate in frames per second that the + /// decoder is capable of decoding. + /// + [optional] + unsigned long maxFr; + /// + /// Gets or sets the maximum frame size in macro-blocks that the decoder + /// is capable of decoding. + /// + [optional] + unsigned long long maxFs; + + /// + /// Constructs an empty instance of an RTCRtpVp8CodecCapabilityParameters object. + /// + [constructor, default] + void RTCRtpVp8CodecCapabilityParameters(); + /// + /// Constructs an instance of an RTCRtpVp8CodecCapabilityParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpVp8CodecCapabilityParametersClone)] + void RTCRtpVp8CodecCapabilityParameters(RTCRtpVp8CodecCapabilityParameters source); + /// + /// Constructs an instance of an RTCRtpVp8CodecCapabilityParameters object by extrating object data from a JSON object. + /// + [constructor, default, altname(RTCRtpVp8CodecCapabilityParametersWithJson)] + void RTCRtpVp8CodecCapabilityParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + // https://tools.ietf.org/html/rfc7742#section-6.2 + /// + /// The following capability parameters are defined for "h264", as noted + /// in [RFC6184] Section 8.1, and [draft-ietf-rtcweb-video] Section 6.2. + /// + [dictionary] + struct RTCRtpH264CodecCapabilityParameters : RTCRtpCodecCapabilityParameters, + RTCRtpCodecParameterSettings + { + typedef std::list PacketizationModeList; + + /// + /// Gets or sets the maximum capability of the decoder (for an + /// RTCRtpReceiver) or the encoder (for an RTCRtpSender). It must be + /// supported, as noted in [draft-ietf-rtcweb-video] Section 6.2. + /// + [optional] + unsigned long profileLevelId; + /// + /// A sequence of unsigned shorts, each ranging from 0 to 2, indicating + /// supported packetizationMode values. As noted in + /// [draft-ietf-rtcweb-video] Section 6.2, support for packetization + /// mode 1 is mandatory. + /// + PacketizationModeList packetizationModes; + + /// + /// Gets or sets an integer indicating the maximum macro-block processing + /// rate in units of macro-blocks per second. + /// + [optional] + unsigned long long maxMbps; + /// + /// Gets or sets an integer indicating the maximum static macro-block + /// processing rate in units of static macro-blocks per second, under the + /// hypothetical assumption that all macro-blocks are static macro-blocks. + /// + [optional] + unsigned long long maxSMbps; + /// + /// Gets or sets an integer indicating the maximum frame size in units + /// of macro-blocks. + /// + [optional] + unsigned long long maxFs; + /// + /// Gets or sets an integer indicating the maximum coded picture buffer + /// size in units of 1000 bits for the VCL HRD parameters and in units + /// of 1200 bits for the NAL HRD parameters. + /// + [optional] + unsigned long long maxCpb; + /// + /// Gets or sets an integer indicating the maximum decoded picture + /// buffer size in units of 8 / 3 macro-blocks. + /// + [optional] + unsigned long long maxDpb; + /// + /// Gets or sets an integer indicating the maximum video bitrate in + /// units of 1000 bits per second for the VCL HRD parameters and in + /// units of 1200 bits per second for the NAL HRD parameters. + /// + [optional] + unsigned long long maxBr; + + /// + /// Constructs an empty instance of an RTCRtpH264CodecCapabilityParameters object. + /// + [constructor, default] + void RTCRtpH264CodecCapabilityParameters(); + /// + /// Constructs an instance of an RTCRtpH264CodecCapabilityParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpH264CodecCapabilityParametersClone)] + void RTCRtpH264CodecCapabilityParameters(RTCRtpH264CodecCapabilityParameters source); + /// + /// Constructs an instance of an RTCRtpH264CodecCapabilityParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpH264CodecCapabilityParametersWithJson)] + void RTCRtpH264CodecCapabilityParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + // https://tools.ietf.org/html/rfc4588#section-8.1 + /// + /// The following capability is defined for "rtx", as noted in [RFC4588] + /// Section 8.6: + /// + [dictionary] + struct RTCRtpRtxCodecCapabilityParameters : RTCRtpCodecCapabilityParameters, + RTCRtpCodecParameterSettings + { + /// + /// Gets or sets the associated payload type of the original stream + /// being retransmitted, as defined in [RFC4588]. + /// + PayloadType apt; + /// + /// Gets or sets the default time in milliseconds (measured from the + /// time a packet was first sent) that the sender keeps an RTP packet + /// in its buffers available for retransmission, as defined in + /// [RFC4588]. + /// + Milliseconds rtxTime; + + /// + /// Constructs an empty instance of an RTCRtpRtxCodecCapabilityParameters object. + /// + [constructor, default] + void RTCRtpRtxCodecCapabilityParameters(); + /// + /// Constructs an instance of an RTCRtpRtxCodecCapabilityParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpRtxCodecCapabilityParametersClone)] + void RTCRtpRtxCodecCapabilityParameters(RTCRtpRtxCodecCapabilityParameters source); + /// + /// Constructs an instance of an RTCRtpRtxCodecCapabilityParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpRtxCodecCapabilityParametersWithJson)] + void RTCRtpRtxCodecCapabilityParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The following capabilities are defined for "flexfec", as noted in + /// [draft-ietf-rtcweb-fec] Section 5.1.1: + /// + [dictionary] + struct RTCRtpFlexFecCodecCapabilityParameters : RTCRtpCodecCapabilityParameters, + RTCRtpCodecParameterSettings + { + /// + /// Gets or sets the default time that spans the source packets and the + /// corresponding repair packets, in microseconds. + /// + Microseconds repairWindow; + + /// + /// Gets or sets the default number of columns of the source block that + /// are protected by this FEC block, aka L value. + /// + [optional] + unsigned long columns; + /// + /// Gets or sets the default number of rows of the source block that are + /// protected by this FEC block, aka D value. + /// + [optional] + unsigned long rows; + /// + /// Gets or sets the default type of protection for the sender: 0 for + /// 1-D interleaved FEC protection, 1 for 1-D non-interleaved FEC + /// protection, and 2 for 2-D parity FEC protection. The value of 3 is + /// reserved for future use. + /// + [optional] + RTCRtpFlexFecCodecCapabilityParametersToP toP; + + /// + /// Constructs an empty instance of an RTCRtpFlexFecCodecCapabilityParameters object. + /// + [constructor, default] + void RTCRtpFlexFecCodecCapabilityParameters(); + /// + /// Constructs an instance of an RTCRtpFlexFecCodecCapabilityParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpFlexFecCodecCapabilityParametersClone)] + void RTCRtpFlexFecCodecCapabilityParameters(RTCRtpFlexFecCodecCapabilityParameters source); + /// + /// Constructs an instance of an RTCRtpFlexFecCodecCapabilityParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpFlexFecCodecCapabilityParametersWithJson)] + void RTCRtpFlexFecCodecCapabilityParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCRtcpParameters provides information on RTCP settings. + /// + [dictionary] + struct RTCRtcpParameters { + /// + /// Gets or sets the SSRC to be used in the "SSRC of packet sender" + /// field defined in [RFC3550] Section 6.4.2 (Receiver Report) and + /// [RFC4585] Section 6.1 (Feedback Messages), as well as the "SSRC" + /// field defined in [RFC3611] Section 2 (Extended Reports). It can only + /// be set for an RTCRtpReceiver. + /// + SsrcType ssrc; + /// + /// Gets or sets the Canonical Name (CNAME) used by RTCP (e.g. in SDES + /// messages). Guidelines for CNAME generation are provided in + /// [draft-ietf-rtcweb-rtp-usage] Section 4.9 and [RFC7022]. + /// + string cName; + /// + /// Gets or sets whether reduced size RTCP [RFC5506] is configured + /// (if true) or compound RTCP as specified in [RFC3550] (if false). + /// + bool reducedSize; + /// + /// Gets or sets whether RTP and RTCP are multiplexed, as specified in + /// [RFC5761]. The default is true. If set to false, the RTCIceTransport + /// must have an associated RTCIceTransport object with a component of + /// "RTCP", in which case RTCP will be sent on the associated + /// RTCIceTransport. + /// + bool mux = true; + + /// + /// Creates an empty instance of an RTCRtcpParameters object. + /// + [constructor, default] + void RTCRtcpParameters(); + /// + /// Constructs an instance of an RTCRtcpParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtcpParametersClone)] + void RTCRtcpParameters(RTCRtcpParameters source); + /// + /// Constructs an instance of an RTCRtcpParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtcpParametersWithJson)] + void RTCRtcpParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCRtpCodecParameters provides information on codec settings. + /// + [dictionary] + struct RTCRtpCodecParameters + { + typedef std::list RtcpFeedbackList; + + [constructor, delete] + void RTCRtpCodecParameters(); + + /// + /// Gets or sets the MIME media type. Valid types are listed in + /// [www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2]. + /// The name must always be provided. + /// + string name; + /// + /// Gets or sets the value that goes in the RTP Payload Type Field + /// [RFC3550]. The payloadType must always be provided, and must be + /// unique. + /// + PayloadType payloadType; + /// + /// Gets or sets the codec clock rate expressed in Hertz, null if unset. + /// + [optional] + unsigned long clockRate; + /// + /// Gets or sets the duration of media represented by a packet in + /// milliseconds for the RTCRtpSender. If unset, the RTCRtpSender may + /// select any value up to maxptime. + /// + Milliseconds pTime; + /// + /// Gets or sets the maximum packetization time set on the RTCRtpSender. + /// Not specified if unset. If Ptime is also set, Maxptime is ignored. + /// + Milliseconds maxPTime; + /// + /// Gets or sets the number of channels supported (e.g. two for stereo). + /// If unset for audio, use the codec default. For video, this can be + /// left unset. + /// + [optional] + unsigned long numChannels; + /// + /// + RtcpFeedbackList rtcpFeedback; + /// + /// Gets or sets the codec-specific parameters available for signaling. + /// + [dynamic] + RTCRtpCodecParameterSettings parameters; // see OpusCodecParameters, RTXCodecParameters, REDCodecParameters, FlexFECCodecParameters for definitions + + /// + /// Constructs an empty instance of an RTCRtpCodecParameters object. + /// + [constructor, default] + void RTCRtpCodecParameters(); + /// + /// Constructs an instance of an RTCRtpCodecParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpCodecParametersClone)] + void RTCRtpCodecParameters(RTCRtpCodecParameters source); + /// + /// Constructs an instance of an RTCRtpCodecParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpCodecParametersWithJson)] + void RTCRtpCodecParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCRtpHeaderExtension dictionary configures the header extensions + /// for use within an RTCRtpSender or RTCRtpReceiver. + /// + [dictionary] + struct RTCRtpHeaderExtensionParameters + { + /// + /// Gets or sets the URI of the RTP header extension, as defined in + /// [RFC5285]. + /// + string uri; + /// + /// Gets or sets the value that goes in the packet. + /// + uint16 id; + /// + /// Gets or sets the value in the header is encrypted as per [RFC6904], + /// if true. Default is unencrypted. + /// + bool encrypt; + + /// + /// Constructs an empty instance of an RTCRtpHeaderExtensionParameters object. + /// + [constructor, default] + void RTCRtpHeaderExtensionParameters(); + /// + /// Constructs an instance of an RTCRtpHeaderExtensionParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpHeaderExtensionParametersClone)] + void RTCRtpHeaderExtensionParameters(RTCRtpHeaderExtensionParameters source); + /// + /// Constructs an instance of an RTCRtpHeaderExtensionParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpHeaderExtensionParametersWithJson)] + void RTCRtpHeaderExtensionParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCRtpFecParameters represents the FEC sets for a particular + /// encoding. + /// + [dictionary] + struct RTCRtpFecParameters + { + /// + /// Gets or sets the SSRC to use for FEC. If unset in an RTCRtpSender + /// object, the ORTC engine will choose. + /// + [optional] + SsrcType ssrc; + /// + /// Gets or sets the Forward Error Correction (FEC) mechanism to use: + /// "red", "red+ulpfec" or "flexfec". + /// + string mechanism; + + /// + /// Constructs an empty instance of an RTCRtpFecParameters object. + /// + [constructor, default] + void RTCRtpFecParameters(); + /// + /// Constructs an instance of an RTCRtpFecParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpFecParametersClone)] + void RTCRtpFecParameters(RTCRtpFecParameters source); + /// + /// Constructs an instance of an RTCRtpFecParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpFecParametersWithJson)] + void RTCRtpFecParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCRtpRtxParameters represents the RTX sets for a particular + /// encoding. + /// + [dictionary] + struct RTCRtpRtxParameters + { + /// + /// Gets or sets the SSRC to use for retransmission, as specified in + /// [RFC4588]. If unset when passed to RTCRtpSender.Send(), the + /// ORTC engine will choose. + /// + [optional] + SsrcType ssrc; + + /// + /// Constructs an empty instance of an RTCRtpRtxParameters object. + /// + [constructor, default] + void RTCRtpRtxParameters(); + /// + /// Constructs an instance of an RTCRtpRtxParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpRtxParametersClone)] + void RTCRtpRtxParameters(RTCRtpRtxParameters source); + /// + /// Constructs an instance of an RTCRtpRtxParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpRtxParametersWithJson)] + void RTCRtpRtxParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCRtpEncodingParameters provides information relating to the + /// encoding. + /// + [dictionary] + struct RTCRtpEncodingParameters + { + typedef string EncodingId; + typedef std::list EncodingIdList; + + /// + /// Gets or sets the SSRC for this layering/encoding. + /// + [optional] + SsrcType ssrc; + /// + /// Gets or sets the codec payload type per-encoding. If unset, the + /// ORTC engine will choose the first codec in parameters. Codecs[] of + /// the appropriate kind. + /// + [optional] + PayloadType codecPayloadType; + /// + /// Gets or sets the FEC mechanism. + /// + [optional] + RTCRtpFecParameters fec; + /// + /// Gets or sets the RTX [RFC4588] parameters. + /// + [optional] + RTCRtpRtxParameters rtx; + /// + /// Gets or sets the priority of this encoding. + /// + [optional] + RTCRtpPriorityType priority; + /// + /// Gets or sets the maximum bitrate ramp up for resolution/quality/ + /// framerate, if set. + /// + [optional] + unsigned long long maxBitrate; + /// + /// Gets or sets the minimum quality to never send less than. + /// + [optional] + double minQuality; + /// + /// Gets or sets the video's resolution will be scaled down in each + /// dimension by the given value before sending, if the sender's kind is + /// "video". + /// + [optional] + double resolutionScale; + /// + /// Gets or sets the inverse of the input framerate fraction to be + /// encoded. + /// + [optional] + double framerateScale; + /// + /// Gets or sets an indicates whether this encoding is actively being + /// sent for the RTCRtpSender. Setting it to false causes this + /// encoding to no longer be sent. + /// + bool active = true; + /// + /// Gets or sets an identifier for the encoding object. + /// + EncodingId encodingId; + /// + /// Gets or sets the EncodingIds on which this layer depends. + /// + EncodingIdList dependencyEncodingIds; + + /// + /// Constructs an empty instance of the RTCRtpEncodingParameters. + /// + [constructor, default] + void RTCRtpEncodingParameters(); + /// + /// Constructs an instance of an RTCRtpEncodingParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpEncodingParametersClone)] + void RTCRtpEncodingParameters(RTCRtpEncodingParameters source); + /// + /// Constructs an instance of an RTCRtpEncodingParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpEncodingParametersWithJson)] + void RTCRtpEncodingParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCRtpParameters contains the RTP stack settings. + /// + [dictionary] + struct RTCRtpParameters + { + typedef std::list CodecParametersList; + typedef std::list HeaderExtensionParametersList; + typedef std::list EncodingParametersList; + + /// + /// Gets or sets the muxId assigned to the RTP stream, if any. + /// + string muxId; + /// + /// Gets or sets the codecs to send or receive (could include RED + /// [RFC2198], RTX [RFC4588] and CN [RFC3389]). codecs must be set for + /// an RTCRtpParameters object to be a valid argument passed to Send() + /// or Receive(). + /// + CodecParametersList codecs; + /// + /// Gets or sets the header extensions. If unset, no header extensions + /// are configured. + /// + HeaderExtensionParametersList headerExtensions; + /// + /// Gets or sets the "encodings" or "layers" to be used for things like + /// simulcast, Scalable Video Coding, RTX, FEC, etc. + /// + EncodingParametersList encodings; + /// + /// Gets or sets the parameters to configure RTCP. + /// + RTCRtcpParameters rtcp; + /// + /// Gets or sets the degradation preference when bandwidth is + /// constrained and the RTCRtpSender needs to choose between degrading + /// resolution or degrading framerate. + /// + RTCRtpDegradationPreference degredationPreference = balanced; + + /// + /// Constructs an empty instance of an RTCRtpParameters object. + /// + [constructor, default] + void RTCRtpParameters(); + /// + /// Constructs an instance of an RTCRtpParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpParametersClone)] + void RTCRtpParameters(RTCRtpParameters source); + /// + /// Constructs an instance of an RTCRtpParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpParametersWithJson)] + void RTCRtpParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The following settings are defined for "opus". + /// + [dictionary] + struct RTCRtpOpusCodecParameterSettings : RTCRtpCodecParameterSettings + { + // sender parameters + + /// + /// Gets or sets the maximum output sampling rate of the encoder in Hz. + /// + [optional] + unsigned long maxPlaybackRate; + /// + /// Gets or sets the maximum average receive bitrate of a session in bits + /// per second (bits/s). + /// + [optional] + unsigned long maxAverageBitrate; + /// + /// + [optional] + bool stereo; + /// + /// Gets or sets if the encoder is configured to generate constant + /// bitrate (if true) or variable bitrate (if false). + /// + [optional] + bool cbr; + /// + /// Gets or sets if the encoder is configured to generate Opus in-band + /// fec (if true) or not (if false). + /// + [optional] + bool useInbandFec; + /// + /// Gets or sets if the encoder is configured to use DTX (if true) or + /// not (if false). + /// + [optional] + bool useDtx; + + /// + /// Gets or sets the encoder's computational complexity. The supported + // range is 0-10 with 10 representing the highest complexity. + /// + [optional] + unsigned long complexity; + /// + /// Gets or sets the type of signal being encoded. Possible values are + /// the string form of the enum OpusCodecSignal. + /// + [optional] + RTCRtpOpusCodecCapabilityOptionsSignal signal; + /// + /// Gets or sets the encoder's intended application. Possible values are + /// the string form of the enum OpusCodecApplication. + /// + [optional] + RTCRtpOpusCodecCapabilityOptionsApplication application; + /// + /// Gets or sets the encoder's expected packet loss percentage. Possible + /// values are 0-100. + /// + [optional] + unsigned long packetLossPerc; + /// + /// Gets or sests whether prediction is disabled, making frames almost + /// complete independent (if true) or not (if false). + /// + [optional] + bool predictionDisabled; + + // receiver parameters + + /// + /// Gets or sets the maximum input sampling rate produced by the sender. + /// + [optional] + unsigned long sPropMaxCaptureRate; + /// + /// Gets or sets whether the sender is likely to produce stereo audio. + /// + [optional] + bool sPropStereo; + + /// + /// Constructs an empty instance of an RTCRtpOpusCodecParameterSettings object. + /// + [constructor, default] + void RTCRtpOpusCodecParameterSettings(); + /// + /// Constructs an instance of an RTCRtpOpusCodecParameterSettings object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpOpusCodecParameterSettingsClone)] + void RTCRtpOpusCodecParameterSettings(RTCRtpOpusCodecParameterSettings source); + /// + /// Constructs an instance of an RTCRtpOpusCodecParameterSettings object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpOpusCodecParameterSettingsWithJson)] + void RTCRtpOpusCodecParameterSettings(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + [dictionary] + struct RTCRtpVp8CodecParameterSettings : RTCRtpVp8CodecCapabilityParameters + { + /// + /// Constructs an empty instance of an RTCRtpVp8CodecParameterSettings object. + /// + [constructor, default] + void RTCRtpVp8CodecParameterSettings(); + /// + /// Constructs an instance of an RTCRtpVp8CodecParameterSettings object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpVp8CodecParameterSettingsClone)] + void RTCRtpVp8CodecParameterSettings(RTCRtpVp8CodecParameterSettings source); + /// + /// Constructs an instance of an RTCRtpVp8CodecParameterSettings object by extrating object data from a JSON object. + /// + [constructor, default, altname(RTCRtpVp8CodecParameterSettingsWithJson)] + void RTCRtpVp8CodecParameterSettings(Json json); + }; + + [dictionary] + struct RTCRtpH264CodecParameterSettings : RTCRtpH264CodecCapabilityParameters + { + /// + /// Constructs an empty instance of an RTCRtpH264CodecParameterSettings object. + /// + [constructor, default] + void RTCRtpH264CodecParameterSettings(); + /// + /// Constructs an instance of an RTCRtpH264CodecParameterSettings object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpH264CodecParameterSettingsClone)] + void RTCRtpH264CodecParameterSettings(RTCRtpH264CodecParameterSettings source); + /// + /// Constructs an instance of an RTCRtpH264CodecParameterSettings object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpH264CodecParameterSettingsWithJson)] + void RTCRtpH264CodecParameterSettings(Json json); + }; + + [dictionary] + struct RTCRtpRtxCodecParameterSettings : RTCRtpRtxCodecCapabilityParameters + { + /// + /// Constructs an empty instance of an RTCRtpRtxCodecParameterSettings object. + /// + [constructor, default] + void RTCRtpRtxCodecParameterSettings(); + /// + /// Constructs an instance of an RTCRtpRtxCodecParameterSettings object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpRtxCodecParameterSettingsClone)] + void RTCRtpRtxCodecParameterSettings(RTCRtpRtxCodecParameterSettings source); + /// + /// Constructs an instance of an RTCRtpRtxCodecParameterSettings object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpRtxCodecParameterSettingsWithJson)] + void RTCRtpRtxCodecParameterSettings(Json json); + }; + + [dictionary] + struct RTCRtpFlexFecCodecParameterSettings : RTCRtpFlexFecCodecCapabilityParameters + { + /// + /// Constructs an empty instance of an RTCRtpFlexFecCodecParameterSettings object. + /// + [constructor, default] + void RTCRtpFlexFecCodecParameterSettings(); + /// + /// Constructs an instance of an RTCRtpFlexFecCodecParameterSettings object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpFlexFecCodecParameterSettingsClone)] + void RTCRtpFlexFecCodecParameterSettings(RTCRtpFlexFecCodecParameterSettings source); + /// + /// Constructs an instance of an RTCRtpFlexFecCodecParameterSettings object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpFlexFecCodecParameterSettingsWithJson)] + void RTCRtpFlexFecCodecParameterSettings(Json json); + }; + + /// + /// The following setting is defined for "red", as noted in [RFC2198] + /// Section 5. + /// + [dictionary] + struct RTCRtpRedCodecParameterSettings : RTCRtpCodecParameterSettings + { + typedef std::list PayloadTypeList; + + /// + /// Gets or sets sequence of payload types to be encapsulated in RED, + /// each of which must be unique. If payloadTypes is unset, this means + /// that any codec other than "red" or "rtx" can be encapsulated in + /// RED. + /// + PayloadTypeList payloadTypes; + + /// + /// Constructs an empty instance of an RTCRtpRedCodecParameterSettings object. + /// + [constructor, default] + void RTCRtpRedCodecParameterSettings(); + /// + /// Constructs an instance of an RTCRtpRedCodecParameterSettings object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpRedCodecParameterSettingsClone)] + void RTCRtpRedCodecParameterSettings(RTCRtpRedCodecParameterSettings source); + /// + /// Constructs an instance of an RTCRtpRedCodecParameterSettings object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpRedCodecParameterSettingsWithJson)] + void RTCRtpRedCodecParameterSettings(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + } +} diff --git a/ortc/idl/SctpTransport.idl b/ortc/idl/SctpTransport.idl new file mode 100644 index 00000000..639799b9 --- /dev/null +++ b/ortc/idl/SctpTransport.idl @@ -0,0 +1,268 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + interface RTCSctpTransport; + + /// + /// Event indicating a new incoming SCTP transport. + /// + struct RTCSctpTransportListenerEvent + { + [constructor, delete] + void RTCSctpTransportListenerEvent(); + + /// + /// Gets the new incoming SCTP transport. + /// + [getter] + RTCSctpTransport transport; + }; + + interface RTCSctpTransportListener + { + [constructor, delete] + void RTCSctpTransportListener(); + + /// + /// Events when the a new SCTP transport has arrived. + /// + [event] + void onTransport(RTCSctpTransportListenerEvent event); + }; + + /// + /// The RTCSctpCapabilities represents object represents the capabilities + /// of SCTP transport. + /// + [dictionary] + struct RTCSctpCapabilities + { + /// + /// Gets or sets the maximum message size. + /// + size_t maxMessageSize; + + /// + /// Gets or sets the minimum SCTP port. + /// + uint16 minPort; + /// + /// Gets or sets the maximum SCTP port. + /// + uint16 maxPort; + /// + /// Gets or sets the maximum SCTP ports that can be used simultaneously. + /// + uint16 maxUsablePorts; + /// + /// Gets or sets the maximum sessions allowed per port. + /// + uint16 maxSessionsPerPort; + + /// + /// Constructs an empty instance of an RTCSctpCapabilities object. + /// + [constructor, default] + void RTCSctpCapabilities(); + /// + /// Constructs an instance of an RTCSctpCapabilities object by cloning object data from an existing object. + /// + [constructor, altname(RTCSctpCapabilitiesClone)] + void RTCSctpCapabilities(RTCSctpCapabilities source); + /// + /// Constructs an instance of an RTCSctpCapabilities object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSctpCapabilitiesWithJson)] + void RTCSctpCapabilities(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// RTCSctpTransportStateChangeEvent represents the state event + /// fired when the RTCSctpTransport state is changed. + /// + struct RTCSctpTransportStateChangeEvent + { + [constructor, delete] + void RTCSctpTransportStateChangeEvent(); + + /// + /// The RTCSctpTransportState that cased the event to fire. + /// + [getter] + RTCSctpTransportState state; + }; + + /// + /// If the remote peers sets RTCDataChannelParameters.Negotiated to false, + /// then the event will fire indicating a new RTCDataChannel object has + /// been constructed to connect with the RTCDataChannel constructed by the + /// remote peer. + /// + struct RTCDataChannelEvent + { + [constructor, delete] + void RTCDataChannelEvent(); + + /// + /// Gets the RTCDataChannel that was constructed when upon receiving a + /// new RTCDataChannel from a remote peer. + /// + [getter] + RTCDataChannel dataChannel; + }; + + /// + /// The RTCSctpTransport includes information relating to Stream Control + /// Transmission Protocol (SCTP) transport. + /// + interface RTCSctpTransport : RTCStatsProvider, + RTCDataTransport + { + /// + /// Constructs an instance of RTCSctpTransport from an RTCDtlsTransport + /// object (with a default of 5000, or the next unused port). + /// + [constructor] + void RTCSctpTransport(RTCDtlsTransport transport) throws (InvalidParameters, InvalidStateError); + + /// + /// Constructs an instance of RTCSctpTransport from an RTCDtlsTransport + /// object, and a port number. + /// + [constructor, altname(RTCSctpTransportWithLocalPort)] + void RTCSctpTransport( + RTCDtlsTransport transport, + uint16 localPort + ) throws (InvalidParameters, InvalidStateError); + + /// + /// Listen for incoming RTCSctpTransport objects port mappings for new SCTP transports. + /// + [static] + RTCSctpTransportListener listen( + RTCDtlsTransport transport, + RTCSctpCapabilities remoteCapabilities + ) throws(InvalidParameters); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Retrieves the RTCSctpCapabilities of the RTCSctpTransport instance. + /// + [static] + RTCSctpCapabilities getCapabilities(); + + /// + /// Gets the RTCDtlsTransport instance the RTCSctpTransport object is + /// sending over. + /// + [getter] + RTCDtlsTransport transport; + + /// + /// Gets the current state of the RTCSctpTransport object. + /// + [getter] + RTCSctpTransportState state; + + /// + /// Gets the SCTP local port number used by the data channel. + /// + [getter] + uint16 port; + + /// + /// Gets the SCTP local port number used by the data channel. + /// + [getter] + uint16 localPort; + + /// + /// Gets the SCTP remote port number used by the data channel if available. + /// + [getter, optional] + uint16 remotePort; + + /// + /// Starts the SCTP transport providing the capabilities of remote + /// SCTP transport. + /// + [default] + void start(RTCSctpCapabilities remoteCapabilities) throws (InvalidStateError, InvalidParameters); + /// + /// Starts the SCTP transport providing the capabilities of remote + /// SCTP transport and remote port. + /// + [altname(startWithPort)] + void start( + RTCSctpCapabilities remoteCapabilities, + uint16 remotePort + ) throws (InvalidStateError, InvalidParameters); + + /// + /// Stops the RTCSctpTransport instance. + /// + void stop(); + + /// + /// Events when the state of the RTCSctpTransport state changes. + /// + [event] + void onStateChange(RTCSctpTransportStateChangeEvent state); + + /// + /// If the remote peers sets RTCDataChannelParameters.negotiated to + /// false, then this event will fire indicating a new RTCDataChannel + /// object has been constructed to connect with the RTCDataChannel + /// constructed by the remote peer. + /// + [event] + void onDataChannel(RTCDataChannelEvent dataChannel); + }; + } +} diff --git a/ortc/idl/Settings.idl b/ortc/idl/Settings.idl new file mode 100644 index 00000000..08178802 --- /dev/null +++ b/ortc/idl/Settings.idl @@ -0,0 +1,105 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// Controls the detailed settings of how the ORTC engine operates. + /// + [static] + interface Settings + { + /// + /// Apply all the default settings for how the ORTC engine should + /// behave. + /// + [static] + void applyDefaults(); + + /// + /// Apply a collection of json based settings. + /// + [static] + bool apply(Json jsonSettings); + + /// + /// Apply a specific string setting with a key and value. + /// + [static] + void setString(string key, string value); + + /// + /// Apply a specific integer setting with a key and value. + /// + [static] + void setInt(string key, int64 value); + + /// + /// Apply a specific unsigned integer setting with a key and value. + /// + [static] + void setUInt(string key, uint64 value); + + /// + /// Apply a specific boolean setting with a key and value. + /// + [static] + void setBool(string key, bool value); + + /// + /// Apply a specific floating point setting with a key and value. + /// + [static] + void setFloat(string key, float value); + + /// + /// Apply a specific double floating point setting with a key and value. + /// + [static] + void setDouble(string key, double value); + + /// + /// Clear a specific setting by its key. + /// + [static] + void clear(string key); + + /// + /// Clear all known settings. + /// + [static] + void clearAll(); + }; + + } +} diff --git a/ortc/idl/SrtpSdesTransport.idl b/ortc/idl/SrtpSdesTransport.idl new file mode 100644 index 00000000..5c9ae1fb --- /dev/null +++ b/ortc/idl/SrtpSdesTransport.idl @@ -0,0 +1,278 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace ortc + { + /// + /// The RTCSrtpKeyParam objects defines the keying material needed for a + /// SRTP SDES session. + /// + [dictionary] + struct RTCSrtpSdesKeyParameters + { // see RFC 4568 sect 9.2 + /// + /// Gets or sets the key method to be utilized, in the syntax defined + /// for 'srtp-key-method' in [RFC4568] Section 9.2. + /// + string keyMethod; // must be "inline" + /// + /// Gets or sets the key and salt to be utilized, in the syntax defined + /// for 'key-salt' in [RFC4568] Sections 9.2. + /// + string keySalt; // key + salt, base 64 encoded e.g. base64(16 bytes + 14 bytes) + /// + /// Gets or sets the key lifetime to be utilized, in the syntax defined + /// for 'lifetime' in [RFC4568] Section 9.2. + /// + string lifetime; // must be "2^n" where n is the max number of packets to flow throw the transport + /// + /// Gets or sets the master key index to be utilized, in the syntax + /// defined for 'mki-value' in [RFC4568] Section 9.2. + /// + string mkiValue; // base 10 expressed value of Master Key Identifier (MKI) converted to string + /// + /// Gets or sets the master key index length to be utilized, in the + /// syntax defined for 'mki-length' in [RFC4568] Section 9.2. + /// + uint16 mkiLength; // number of bytes allocated on each SRTP packet for Master Key Identifier (MKI) [max = 128 bytes] + + /// + /// Constructs an empty instance of an RTCSrtpSdesKeyParameters object. + /// + [constructor, default] + void RTCSrtpSdesKeyParameters(); + /// + /// Constructs an instance of an RTCSrtpSdesKeyParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCSrtpSdesKeyParametersClone)] + void RTCSrtpSdesKeyParameters(RTCSrtpSdesKeyParameters source); + /// + /// Constructs an instance of an RTCSrtpSdesKeyParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSrtpSdesKeyParametersWithJson)] + void RTCSrtpSdesKeyParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSrtpSdesCryptoParameters object includes information relating + /// to SRTP/SDES cryptographic configuration. + /// + [dictionary] + struct RTCSrtpSdesCryptoParameters + { // see RFC 4568 sect 9.2 + typedef std::list KeyParametersList; + typedef StringList SessionParamList; + + /// + /// Gets or sets the tag identifying the parameters set, in the syntax + /// defined for 'tag' in [RFC4568] Section 9.1. + /// + uint16 tag; + /// + /// Gets or sets the the cipher-suite to be utilized, in the syntax + /// defined for 'srtp-crypto-suite' in [RFC4568] Section 9.2; + /// + string cryptoSuite; + /// + /// Gets or sets the key parameters to be utilized, as described in + /// [RFC4568] Section 6.1. Calls to + /// RTCSrtpSdesTransport.GetLocalParameters should return only a single + /// RTCSrtpKeyParam dictionary entry. + /// + KeyParametersList keyParams; + /// + /// Gets or sets a sequence of session parameters to be utilized, each + /// in the syntax defined for 'session-param' in [RFC4568] Section 9.1; + /// + SessionParamList sessionParams; + + /// + /// Constructs an empty instance of an RTCSrtpSdesCryptoParameters object. + /// + [constructor, default] + void RTCSrtpSdesCryptoParameters(); + /// + /// Constructs an instance of an RTCSrtpSdesCryptoParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCSrtpSdesCryptoParametersClone)] + void RTCSrtpSdesCryptoParameters(RTCSrtpSdesCryptoParameters source); + /// + /// Constructs an instance of an RTCSrtpSdesCryptoParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSrtpSdesCryptoParametersWithJson)] + void RTCSrtpSdesCryptoParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSrtpSdesParameters object includes information relating to + /// SRTP/SDES configuration. + /// + [dictionary] + struct RTCSrtpSdesParameters + { + typedef std::list CryptoParametersList; + + /// + /// Gets or sets a sequence of cryptographic parameters. + /// + CryptoParametersList cryptoParams; + + /// + /// Constructs an empty instance of an RTCSrtpSdesParameters object. + /// + [constructor, default] + void RTCSrtpSdesParameters(); + /// + /// Constructs an instance of an RTCSrtpSdesParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCSrtpSdesParametersClone)] + void RTCSrtpSdesParameters(RTCSrtpSdesParameters source); + /// + /// Constructs an instance of an RTCSrtpSdesParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSrtpSdesParametersWithJson)] + void RTCSrtpSdesParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// This is the event data associated with the + /// transport.OnLifetimeRemaining event handler. + /// + struct RTCSrtpSdesTransportLifetimeRemainingEvent + { + [constructor, delete] + void RTCSrtpSdesTransportLifetimeRemainingEvent(); + + /// + /// Gets the least percentage remaining of all the keys in the + /// SDES/SRTP transport. + /// + [getter] + unsigned long leastLifetimeRemainingPercentageForAllKeys; + /// + /// Gets the overall percentage of life remaining of all the keys in the + /// SDES/SRTP transport. + /// + [getter] + unsigned long overallLifetimeRemainingPercentage; + }; + + /// + /// The RTCSrtpSdesTransport includes information relating to SRTP/SDES + /// transport. + /// + interface RTCSrtpSdesTransport : RTCRtpTransport, + RTCStatsProvider + { + /// + /// Constructs an instance of an RTCSrtpSdesTransport object using the specified ICE transport and cryptographic parameters. + /// + [constructor] + void RTCSrtpSdesTransport( + RTCIceTransport iceTransport, + RTCSrtpSdesCryptoParameters encryptParameters, + RTCSrtpSdesCryptoParameters decryptParameters + ) throws (InvalidParameters, InvalidStateError); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the associated RTP RTCIceTransport as passed into the constructor. + /// + [getter] + RTCIceTransport transport; + /// + /// Gets the associated RTCP RTCIceTransport as passed into the constructor. + /// + [getter] + RTCIceTransport rtcpTransport; + + /// + /// Obtain the local SRTP/SDES parameter sets. + /// + [static] + RTCSrtpSdesParameters getLocalParameters(); + + /// + /// Stops sending or receiving any further encrypted RTP/RTCP data over the associated ICE transport. + /// + void stop(); + + /// + /// This event is fired when the lifetime of the keying material + /// percentage remaining has changed. + /// + [event] + void onLifetimeRemaining(RTCSrtpSdesTransportLifetimeRemainingEvent event); + + /// + /// This event is fired on reception of an error. + /// + [event] + void onError(ErrorEvent event); + }; + + } +} diff --git a/ortc/idl/StatsProvider.idl b/ortc/idl/StatsProvider.idl new file mode 100644 index 00000000..e257fe36 --- /dev/null +++ b/ortc/idl/StatsProvider.idl @@ -0,0 +1,57 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// The RTCStatsProvider interface enables the retrieval of statistics. + /// + interface RTCStatsProvider + { + typedef zs::PromiseWith PromiseWithStatsReport; + + [constructor, delete] + void RTCStatsProvider(); + + /// + /// Gets an awaitable RTCStatsReport object that will contain a set of + /// statistics objects for the inspected object. A null RTCStatsReport + /// return is possible if the object declined the request to inspect + /// statistics at this time. An RTCStatsReport containing no statistics + /// objects indicates that no inspectable statistics are available at + /// this time. + /// + PromiseWithStatsReport getStats(RTCStatsTypeSet statTypes) throws (InvalidParameters, InvalidStateError); + }; + } +} diff --git a/ortc/idl/StatsReport.idl b/ortc/idl/StatsReport.idl new file mode 100644 index 00000000..c9741182 --- /dev/null +++ b/ortc/idl/StatsReport.idl @@ -0,0 +1,1031 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + typedef uint32 SsrcType; + typedef uint8 PayloadType; + typedef std::list SsrcTypeList; + + /// + /// The RTCStatsTypeSet contains a list of stats types to be collected. + /// + struct RTCStatsTypeSet + { + typedef std::set EnumSet; + + /// + /// Constructs an empty instance of an RTCStatsTypeSet object. + /// + [constructor, default] + void RTCStatsTypeSet(); + /// + /// Constructs an instance of an RTCStatsTypeSet object given a set of types types to collect. + /// + [constructor, altname(RTCStatsTypeSetWithValues)] + void RTCStatsTypeSet(EnumSet values); + + bool hasStatType(RTCStatsType type); + }; + + /// + /// The RTCStats contains statistics information related to an inspected + /// object. + /// + struct RTCStats + { + /// + /// Gets or sets the timestamp when this statistic object was generated. + /// + [getter] + Time timestamp; + /// + /// Gets or sets the type of statistics object contained within this + /// RTCStats object. + /// + [optional, getter] + RTCStatsType statsType; + /// + /// Gets or sets the type of statistics object when the type is not a + /// pre-known type. + /// + [getter] + string statsTypeOther; + /// + /// Gets or sets the identifier for the RTCStats object. The identifier + /// is unique within a RTCStatsReport but is not guaranteed to be unique + /// across RTCStatsReports. + /// + [getter] + string id; + + /// + /// Constructs an empty instance of an RTCStats object. + /// + [constructor, default] + void RTCStats(); + /// + /// Constructs an instance of an RTCStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCStatsClone)] + void RTCStats(RTCStats source); + /// + /// Constructs an instance of an RTCStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCStatsWithJson)] + void RTCStats(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + + struct RTCRtpStreamStats : RTCStats + { + /// + /// Gets or sets the SSRC for the RTP stream. + /// + [optional, getter] + SsrcType ssrc; + /// + /// Gets or sets the associated stats identifier for looking up the + /// corresponding (local/remote) RTCStats object for a given SSRC. + /// + [getter] + string associatedStatId; + /// + /// Gets or sets if the measurements are calculated locally ore + /// remotely. false indicates that the statistics are measured + /// locally, while true indicates that the measurements were done + /// at the remote endpoint and reported in an RTCP RR/XR. + /// + [getter] + bool isRemote; + /// + /// Gets or sets the media type, either "audio" or "video". This must + /// match the media type part of the information in the corresponding + /// codec member of RTCCodec. + /// + [getter] + string mediaType; + /// + /// Gets or sets the media stream tracks ID associated with this RTP + /// stream stats object. + /// + [getter] + string mediaTrackId; + /// + /// Gets or sets the transport ID associated with this RTP media + /// stream stats object. It is a unique identifier that is associated + /// to the object that was inspected to produce the RTCTransportStats + /// associated with this RTP stream. + /// + [getter] + string transportId; + /// + /// Gets or set the codec ID associated with this RTP media stream stats + /// object. + /// + [getter] + string codecId; + /// + /// Gets or sets the total number of Full Intra Request (FIR) packets + /// received by the sender. This metric is only valid for video and is + /// sent by receiver. Calculated as defined in [RFC5104] section 4.3.1. + /// and does not use the metric indicated in [RFC2032], because it was + /// deprecated by [RFC4587]. + /// + [getter] + unsigned long firCount; + /// + /// Gets or sets the total number of Packet Loss Indication (PLI) + /// packets received by the sender and is sent by receiver. Calculated + /// as defined in [RFC4585] section 6.3.1. + /// + [getter] + unsigned long pliCount; + /// + /// Gets or sets the total number of Negative ACKnowledgement (NACK) + /// packets received by the sender and is sent by receiver. Calculated + /// as defined in [RFC4585] section 6.2.1. + /// + [getter] + unsigned long nackCount; + /// + /// Gets or sets the total number of Slice Loss Indication (SLI) packets + /// received by the sender. This metric is only valid for video and is + /// sent by receiver. Calculated as defined in [RFC4585] section 6.3.2. + /// + [getter] + unsigned long sliCount; + + /// + /// Constructs an empty instance of an RTCRtpStreamStats object. + /// + [constructor, default] + void RTCRtpStreamStats(); + /// + /// Constructs an instance of an RTCRtpStreamStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCRtpStreamStatsClone)] + void RTCRtpStreamStats(RTCRtpStreamStats source); + /// + /// Constructs an instance of an RTCRtpStreamStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCRtpStreamStatsWithJson)] + void RTCRtpStreamStats(Json json); + }; + + /// + /// The RTCCodec object contains information about the codec associated + /// with an RTP stream. + /// + struct RTCCodec : RTCStats + { + /// + /// Gets or sets the payload type as used in RTP encoding. + /// + [optional, getter] + PayloadType payloadType; + /// + /// Gets or sets the IANA name of the codec associated with the RTP + /// stream. For example, "vp8" for "video/vp8" or equivalent. + /// + [getter] + string codec; + /// + /// Gets or sets the media sampling rate. + /// + [getter] + unsigned long clockRate; + /// + /// Gets or sets the number of audio channels used by the codec. For + /// example, 2 for stereo, 1 for mono, and missing for non-audio codecs. + /// + [optional, getter] + unsigned long channels; + /// + /// Gets or sets the SDP description line. + /// + [getter] + string parameters; + + /// + /// Constructs an empty instance of an RTCCodec object. + /// + [constructor, default] + void RTCCodec(); + /// + /// Constructs an instance of an RTCCodec object by cloning object data from an existing object. + /// + [constructor, altname(RTCCodecClone)] + void RTCCodec(RTCCodec source); + /// + /// Constructs an instance of an RTCCodec object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCCodecWithJson)] + void RTCCodec(Json json); + }; + + /// + /// The RTCInboundRTPStreamStats object represents the measurement metrics + /// for the incoming RTP media stream. + /// + struct RTCInboundRtpStreamStats : RTCRtpStreamStats + { + /// + /// Gets or sets the total number of RTP packets received for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long packetsReceived; + [getter] + /// + /// Gets or sets the total number of bytes received for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1. + /// + unsigned long long bytesReceived; + /// + /// Gets or sets the total number of RTP packets lost for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long packetsLost; + /// + /// Gets or sets the packet jitter measured in seconds for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1. + /// + [getter] + double jitter; + /// + /// Gets or sets the fraction packet loss reported for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1 and Appendix A.3. + /// + [getter] + double fractionLost; + /// + /// Gets or sets the end to end media delay in milliseconds. This value + /// represents the total duration between the time the media sampling was + /// captured to the time the media sampling was rendered. + /// + [getter] + Milliseconds endToEndDelay; + + /// + /// Constructs an empty instance of an RTCInboundRtpStreamStats object. + /// + [constructor, default] + void RTCInboundRtpStreamStats(); + /// + /// Constructs an instance of an RTCInboundRtpStreamStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCInboundRtpStreamStatsClone)] + void RTCInboundRtpStreamStats(RTCInboundRtpStreamStats source); + /// + /// Constructs an instance of an RTCInboundRtpStreamStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCInboundRtpStreamStatsWithJson)] + void RTCInboundRtpStreamStats(Json json); + }; + + /// + /// The RTCOutboundRTPStreamStats object represents the measurement + /// metrics for the outgoing media stream. + /// + struct RTCOutboundRtpStreamStats : RTCRtpStreamStats + { + /// + /// Gets or sets the total number of RTP packets sent for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long packetsSent; + /// + /// Gets or sets the total number of bytes sent for this SSRC. + /// Calculated as defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long long bytesSent; + /// + /// Gets or sets the presently configured bitrate target of this SSRC, + /// in bits per second. Typically this is a configuration parameter + /// provided to the codec's encoder. + /// + [getter] + double targetBitrate; + /// + /// Gets or sets the estimated round trip time (seconds) for this SSRC + /// based on the RTCP timestamp. Calculated as defined in [RFC3550] + /// section 6.4.1. + /// + [getter] + double roundTripTime; + + /// + /// Constructs an empty instance of an RTCOutboundRtpStreamStats object. + /// + [constructor, default] + void RTCOutboundRtpStreamStats(); + /// + /// Constructs an instance of an RTCOutboundRtpStreamStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCOutboundRtpStreamStatsClone)] + void RTCOutboundRtpStreamStats(RTCOutboundRtpStreamStats source); + /// + /// Constructs an instance of an RTCOutboundRtpStreamStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCOutboundRtpStreamStatsWithJson)] + void RTCOutboundRtpStreamStats(Json json); + }; + + struct RTCSctpTransportStats : RTCStats + { + /// + /// Gets or sets the number of unique datachannels opened. + /// + [getter] + unsigned long dataChannelsOpened; + /// + /// Gets or sets the number of unique datachannels closed. + /// + [getter] + unsigned long dataChannelsClosed; + + /// + /// Constructs an empty instance of an RTCSctpTransportStats object. + /// + [constructor, default] + void RTCSctpTransportStats(); + /// + /// Constructs an instance of an RTCSctpTransportStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCSctpTransportStatsClone)] + void RTCSctpTransportStats(RTCSctpTransportStats source); + /// + /// Constructs an instance of an RTCSctpTransportStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSctpTransportStatsWithJson)] + void RTCSctpTransportStats(Json json); + }; + + /// + /// The RTCMediaStreamStats object contains the statistics for the + /// RTCMediaStream object. + /// + struct RTCMediaStreamStats : RTCStats + { + /// + /// Gets or sets the stream.id property. + /// + [getter] + string streamId; + /// + /// Gets or sets the the id of the media stream track stats object, not + /// the track.id. + /// + [getter] + StringList trackIds; + + /// + /// Constructs an empty instance of an RTCMediaStreamStats object. + /// + [constructor, default] + void RTCMediaStreamStats(); + /// + /// Constructs an instance of an RTCMediaStreamStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCMediaStreamStatsClone)] + void RTCMediaStreamStats(RTCMediaStreamStats source); + /// + /// Constructs an instance of an RTCMediaStreamStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCMediaStreamStatsWithJson)] + void RTCMediaStreamStats(Json json); + }; + + + /// + /// The RTCMediaStreamTrackStats object contains the statistics for the + /// RTCMediaStreamTrack object. + /// + struct RTCMediaStreamTrackStats : RTCStats + { + /// + /// Gets or sets the track.id property. + /// + [getter] + string trackId; + /// + /// Gets or sets if this source represents a local or remote media + /// stream track source. The value is true for remote, false for local. + /// + [getter] + bool remoteSource; + /// + /// Gets or sets the SSRCs associated with this media stream track stats + /// object. + /// + [getter] + SsrcTypeList ssrcIds; + /// + /// Gets or sets the width value for video. The property only makes + /// sense for video media streams and represents the width of the video + /// frame for this SSRC. + /// + [getter] + unsigned long frameWidth; + /// + /// Gets or sets the height value for video. The property only makes + /// sense for video media streams and represents the height of the video + /// frame for this SSRC. + /// + [getter] + unsigned long frameHeight; + /// + /// Gets or sets the video frames per second. Only valid for video. + /// + [getter] + double framesPerSecond; + /// + /// Gets or sets the total number of frames sent for this SSRC. Only + /// valid for video. + /// + [getter] + unsigned long framesSent; + /// + /// Gets or sets the total number of frames received for this SSRC. Only + /// valid for video and when RemoteSource is set to true. + /// + [getter] + unsigned long framesReceived; + /// + /// Gets or sets the total number of frames correctly decoded for this + /// SSRC. Only valid for video. Same definition as totalVideoFrames in + /// Section 5 of [http://www.w3.org/TR/media-source/]. + /// + [getter] + unsigned long framesDecoded; + /// + /// Gets or sets the total number of frames dropped. Only valid for + /// video. Same definition as droppedVideoFrames in Section 5 of + /// [http://www.w3.org/TR/media-source/]. + /// + [getter] + unsigned long framesDropped; + /// + /// Gets or sets the total number of frames determined to be corrupted. + /// Only valid for video. Same definition as corruptedVideoFrames in + /// Section 5 of [http://www.w3.org/TR/media-source/]. + /// + [getter] + unsigned long framesCorrupted; + /// + /// Gets or sets the audio level. Only valid for audio, and the value is + /// between 0..1 (linear), where 1.0 represents 0 dBov. Calculated as + /// defined in [RFC6464]. + /// + [getter] + double audioLevel; + /// + /// Gets or sets the echo return loss calculated in decibels, as defined + /// in [https://www.itu.int/rec/T-REC-G.168/en] (2012) section 3.14. + /// Only present on audio tracks sourced from a microphone where echo + /// cancellation is applied. + /// + [getter] + double echoReturnLoss; + /// + /// Gets or sets the echo return loss enhancement as calculated in + /// decibels, as defined in [https://www.itu.int/rec/T-REC-G.168/en] + /// (2012) section 3.15.Only present on audio tracks sourced from a + /// microphone where echo cancellation is applied. + /// + [getter] + double echoReturnLossEnhancement; + + /// + /// Constructs an empty instance of an RTCMediaStreamTrackStats object. + /// + [constructor, default] + void RTCMediaStreamTrackStats(); + /// + /// Constructs an instance of an RTCMediaStreamTrackStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCMediaStreamTrackStatsClone)] + void RTCMediaStreamTrackStats(RTCMediaStreamTrackStats source); + /// + /// Constructs an instance of an RTCMediaStreamTrackStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCMediaStreamTrackStatsWithJson)] + void RTCMediaStreamTrackStats(Json json); + }; + + /// + /// The RTCDataChannelStats object contains the statistics related to the + /// associated RTCDataChannel object. + /// + struct RTCDataChannelStats : RTCStats + { + /// + /// Gets or sets the data channel label. + /// + [getter] + string label; + /// + /// Gets or sets the data channel protocol. + /// + [getter] + string protocol; + /// + /// Gets or sets the "id" of the RTCDataChannel object. + /// + [getter] + long dataChannelId; + /// + /// Gets or sets the RTCDataChannelState for the RTCDataChannel object. + /// + [getter] + RTCDataChannelState state; + /// + /// Gets or sets the total number of API "message" events sent. + /// + [getter] + unsigned long messagesSent; + /// + /// Gets or sets the total number of payload bytes sent on this + /// RTCDatachannel, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + /// + /// Gets or sets the total number of bytes received on this + /// RTCDatachannel, i.e., not including headers or padding. + /// + [getter] + unsigned long messagesReceived; + /// + /// Gets or sets the total number of bytes received on this + /// RTCDatachannel, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + + /// + /// Constructs an empty instance of an RTCDataChannelStats object. + /// + [constructor, default] + void RTCDataChannelStats(); + /// + /// Constructs an instance of an RTCDataChannelStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCDataChannelStatsClone)] + void RTCDataChannelStats(RTCDataChannelStats source); + /// + /// Constructs an instance of an RTCDataChannelStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCDataChannelStatsWithJson)] + void RTCDataChannelStats(Json json); + }; + + /// + /// The RTCIceGathererStats object contains the statistics information + /// related to the RTCIceGatherer object. + /// + struct RTCIceGathererStats : RTCStats + { + /// + /// Gets or sets the total number of bytes received on this + /// RTCIceGatherer, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + /// + /// Gets or sets the total number of payload bytes sent on this + /// RTCIceGatherer, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + /// + /// Gets or sets the RTCIceGathererStats identifier for the associated + /// RTCP RTCIceGatherer (if applicable). + /// + [getter] + string rtcpGathererStatsId; + + /// + /// Constructs an empty instance of an RTCIceGathererStats object. + /// + [constructor, default] + void RTCIceGathererStats(); + /// + /// Constructs an instance of an RTCIceGathererStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCIceGathererStatsClone)] + void RTCIceGathererStats(RTCIceGathererStats source); + /// + /// Constructs an instance of an RTCIceGathererStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceGathererStatsWithJson)] + void RTCIceGathererStats(Json json); + }; + + /// + /// The RTCIceTransportStats object contains the statistics related to the + /// RTCIceTransport object. + /// + struct RTCIceTransportStats : RTCStats + { + /// + /// Gets or sets the total number of bytes received on this + /// RTCIceTransport, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + /// + /// Gets or sets the total number of payload bytes sent on this + /// RTCIceTransport, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + /// + /// Gets or sets the RTCIceGathererStats identifier for the associated + /// RTCP RTCIceTransport (if applicable). + /// + [getter] + string rtcpTransportStatsId; + /// + /// Gets or sets if the connection is active. Set to true when transport + /// is active. + /// + [getter] + bool activeConnection; + /// + /// Gets or sets a unique identifier that is associated to the object + /// that was inspected to produce the RTCIceCandidatePairStats + /// associated with this transport. + /// + [getter] + string selectedCandidatePairId; + + /// + /// Constructs an empty instance of an RTCIceTransportStats object. + /// + [constructor, default] + void RTCIceTransportStats(); + /// + /// Constructs an instance of an RTCIceTransportStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCIceTransportStatsClone)] + void RTCIceTransportStats(RTCIceTransportStats source); + /// + /// Constructs an instance of an RTCIceTransportStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceTransportStatsWithJson)] + void RTCIceTransportStats(Json json); + }; + + /// + /// The RTCDtlsTransportStats object contains the statistics related to the + /// RTCDtlsTransport object. + /// + struct RTCDtlsTransportStats : RTCStats + { + /// + /// Gets or sets the local certificate stats object identifier. + /// + [getter] + string localCertificateId; + /// + /// Gets or sets the remote certificate stats object identifier. + /// + [getter] + string remoteCertificateId; + + /// + /// Constructs an empty instance of an RTCDtlsTransportStats object. + /// + [constructor, default] + void RTCDtlsTransportStats(); + /// + /// Constructs an instance of an RTCDtlsTransportStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCDtlsTransportStatsClone)] + void RTCDtlsTransportStats(RTCDtlsTransportStats source); + /// + /// Constructs an instance of an RTCDtlsTransportStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCDtlsTransportStatsWithJson)] + void RTCDtlsTransportStats(Json json); + }; + + /// + /// The RTCSrtpTransportStats object contains the statistics related to the + /// RTCSrtpSdesTransport object. + /// + struct RTCSrtpTransportStats : RTCStats + { + /// + /// Constructs an empty instance of an RTCInboundRtpStreamStats object. + /// + [constructor, default] + void RTCSrtpTransportStats(); + /// + /// Constructs an instance of an RTCSrtpTransportStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCSrtpTransportStatsClone)] + void RTCSrtpTransportStats(RTCSrtpTransportStats source); + /// + /// Constructs an instance of an RTCSrtpTransportStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSrtpTransportStatsWithJson)] + void RTCSrtpTransportStats(Json json); + }; + + /// + /// RTCIceCandidateAttributes reflects the properties of a candidate in + /// Section 15.1 of [RFC5245]. + /// + struct RTCIceCandidateAttributes : RTCStats + { + /// + /// Gets or sets a unique identifier that is associated to the object + /// that was inspected to produce the RTCTransportStats associated with + /// this candidate. + /// + [getter] + string relatedId; + /// + /// Gets or sets the IP address of the candidate, allowing for IPv4 + /// addresses, IPv6 addresses, and fully qualified domain names + /// (FQDNs). See [RFC5245] section 15.1 for details. + /// + [getter] + string ipAddress; + /// + /// Gets or sets the port number of the candidate. + /// + [getter] + unsigned long portNumber; + /// + /// Gets or sets the transport type. Valid values for transport is one o + /// udp and tcp. Based on the "transport" defined in [RFC5245] section + /// 15.1. + /// + [getter] + string transport; + /// + /// Gets or sets the enumeration RTCStatsIceCandidateType based on the + /// cand-type defined in [RFC5245] section 15.1. + /// + [getter] + RTCIceCandidateType candidateType; + /// + /// Gets or sets the candidate priority as calculated as defined in + /// [RFC5245] section 15.1. + /// + [getter] + unsigned long priority; + /// + /// Gets or sets the URL of the TURN or STUN server indicated in the + /// RTCIceServers that translated this IP address. + /// + [getter] + string addressSourceUrl; + + /// + /// Constructs an empty instance of an RTCIceCandidateAttributes object. + /// + [constructor, default] + void RTCIceCandidateAttributes(); + /// + /// Constructs an instance of an RTCIceCandidateAttributes object by cloning object data from an existing object. + /// + [constructor, altname(RTCIceCandidateAttributesClone)] + void RTCIceCandidateAttributes(RTCIceCandidateAttributes source); + /// + /// Constructs an instance of an RTCIceCandidateAttributes object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceCandidateAttributesWithJson)] + void RTCIceCandidateAttributes(Json json); + }; + + /// + /// + struct RTCIceCandidatePairStats : RTCStats + { + /// + /// Gets or sets a unique identifier that is associated to the object + /// that was inspected to produce the RTCTransportStats associated with + /// this candidate pair. + /// + [getter] + string transportId; + /// + /// Gets or sets a unique identifier that is associated to the object + /// that was inspected to produce the RTCIceCandidateAttributes for the + /// local candidate associated with this candidate pair. + /// + [getter] + string localCandidateId; + /// + /// Gets or sets a unique identifier that is associated to the object + /// that was inspected to produce the RTCIceCandidateAttributes for the + /// remote candidate associated with this candidate pair. + /// + [getter] + string remoteCandidateId; + /// + /// Gets or sets the state of the checklist for the local and remote + /// candidates in a pair. + /// + [getter] + RTCIceCandidatePairState state; + /// + /// Gets or sets the calculated candidate pair priority as as defined in + /// [RFC5245] section 5.7.2. + /// + [getter] + unsigned long long priority; + /// + /// Gets or sets the nominated flag described in Section 7.1.3.2.4 of [RFC5245]. + /// + [getter] + bool nominated; + /// + /// Gets or sets if the candidate pair has received an ACK to an ICE + /// request. + /// + [getter] + bool writable; + /// + /// Gets or sets if the candidate pair has received a valid incoming + /// ICE request. + /// + [getter] + bool readable; + /// + /// Gets or sets the total number of payload bytes sent on this + /// candidate pair, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + /// + /// Gets or sets the total number of payload bytes received on this + /// candidate pair, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + /// + /// Gets or sets the RTT computed by the STUN connectivity checks + /// [draft-reddy-tram-stun-path-data]. + /// + [getter] + double roundTripTime; + /// + /// Gets or sets the available outgoing bitrate measured in Bits per + /// second, and is implementation dependent. It may be calculated by the + /// underlying congestion control. + /// + [getter] + double availableOutgoingBitrate; + /// + /// Gets or sets the available incoming bitrate measured in Bits per + /// second, and is implementation dependent. It may be calculated by the + /// underlying congestion control. + /// + [getter] + double availableIncomingBitrate; + + /// + /// Constructs an empty instance of an RTCIceCandidatePairStats object. + /// + [constructor, default] + void RTCIceCandidatePairStats(); + /// + /// Constructs an instance of an RTCIceCandidatePairStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCIceCandidatePairStatsClone)] + void RTCIceCandidatePairStats(RTCIceCandidatePairStats source); + /// + /// Constructs an instance of an RTCIceCandidatePairStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceCandidatePairStatsWithJson)] + void RTCIceCandidatePairStats(Json json); + }; + + + /// + /// The RTCCertificateStats contains the statistics information related + /// to an RTCCertificate object. + /// + struct RTCCertificateStats : RTCStats + { + /// + /// Gets or sets the the fingerprint value as defined in Section 5 of + /// [RFC4572]. + /// + [getter] + string fingerprint; + /// + /// Gets or sets the fingerprint algorithm used with this certificate. + /// For instance, "sha-256". + /// + [getter] + string fingerprintAlgorithm; + /// + /// Gets or sets the DER-encoded, base-64 representation of a + /// certificate. + /// + [getter] + string base64Certificate; + /// + /// Gets or sets the issuer certificate identifier associates with this + /// RTCCertificateStats object. + /// + [getter] + string issuerCertificateId; + + /// + /// Constructs an empty instance of an RTCCertificateStats object. + /// + [constructor, default] + void RTCCertificateStats(); + /// + /// Constructs an instance of an RTCCertificateStats object by cloning object data from an existing object. + /// + [constructor, altname(RTCCertificateStatsClone)] + void RTCCertificateStats(RTCCertificateStats source); + /// + /// Constructs an instance of an RTCCertificateStats object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCCertificateStatsWithJson)] + void RTCCertificateStats(Json json); + }; + + /// + /// The RTCStatsReport contains a collection of statistic object for + /// statistics for the inspected objects. + /// + interaction RTCStatsReport + { + typedef StringList IdList; + + [constructor, delete] + void RTCStatsReport(); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the list of statistics object identifiers contained within this + /// stats report. + /// + [getter] + IdList statsIds; + /// + /// Gets an RTCStats object for the specified statistic object + /// identifier. + /// + RTCStats getStats(string id); + }; + } +} diff --git a/ortc/idl/adapter/MediaStream.idl b/ortc/idl/adapter/MediaStream.idl new file mode 100644 index 00000000..433b1cf6 --- /dev/null +++ b/ortc/idl/adapter/MediaStream.idl @@ -0,0 +1,156 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + namespace adapter + { + /// + /// The two main components in the MediaStream API are the + /// MediaStreamTrack and MediaStream interfaces. The MediaStreamTrack + /// object represents media of a single type that originates from one + /// media source in the User Agent, e.g. video produced by a web camera. + /// A MediaStream is used to group several MediaStreamTrack objects into + /// one unit that can be recorded or rendered in a media element. + /// + interface MediaStream : RTCStatsProvider + { + typedef std::list MediaStreamTrackList; + + /// + /// Constructs an empty MediaStream object. + /// + [constructor, default] + void MediaStream(); + /// + /// Constructs an instance of an MediaStream and clones the tracks + /// from the original MediaStream. + /// + [constructor, altname(MediaStreamClone)] + void MediaStream(MediaStream source); + /// + /// Constructs an instance of an MediaStream containing a list of + /// MediaStreamTracks supplied. + /// + [constructor, default, altname(MediaStreamWithTracks)] + void MediaStream(MediaStreamTrackList tracks); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the media stream identifier. When a MediaStream object is + /// created, the engine must generate an identifier string, and must + /// initialize the object's id attribute to that string. A good + /// practice is to use a UUID [RFC4122], which is 36 characters long + /// in its canonical form. To avoid fingerprinting, implementations + /// should use the forms in section 4.4 or 4.5 of [RFC4122] when + /// generating UUIDs. + /// + [getter] + string id; + + /// + /// Gets an indicator if this MediaStream is active. + /// + [getter] + bool active; + + /// + /// Returns a sequence of MediaStreamTrack objects representing all + /// the tracks in this stream. + /// + [getter] + MediaStreamTrackList tracks; + /// + /// Gets a sequence of MediaStreamTrack objects representing the + /// audio tracks in this stream. + /// + [getter] + MediaStreamTrackList audioTracks; + [getter] + /// + /// Gets a sequence of MediaStreamTrack objects representing the + /// video tracks in this stream. + /// + MediaStreamTrackList videoTracks; + /// + /// The GetTrackById() method must return either a MediaStreamTrack + /// object from this stream's track set whose id is equal to trackId, + /// or null, if no such track exists. + /// + MediaStreamTrack getTrackById(string id); + + /// + /// Gets the number of media stream tracks contained within the media + /// stream. + /// + [getter] + size_t count; + + /// + /// Adds the given MediaStreamTrack to this MediaStream. + /// + void addTrack(MediaStreamTrack track) throws (InvalidParameters); + /// + /// Removes the given MediaStreamTrack object from this MediaStream. + /// + void removeTrack(MediaStreamTrack track); + + /// + /// Clones the given MediaStream and all its tracks. + /// + MediaStream clone(); + + /// + /// This event fires when a new MediaStreamTrack has been added to + /// this stream. Note that this event is not fired when the script + /// directly modifies the tracks of a MediaStream. + /// + [event] + void onAddTrack(MediaStreamTrack track); + /// + /// This event fires when a MediaStreamTrack has been removed from + /// this stream. Note that this event is not fired when the script + /// directly modifies the tracks of a MediaStream. + /// + [event] + void onRemoveTrack(MediaStreamTrack track); + }; + + } + } +} diff --git a/ortc/idl/adapter/PeerConnection.idl b/ortc/idl/adapter/PeerConnection.idl new file mode 100644 index 00000000..87de91a5 --- /dev/null +++ b/ortc/idl/adapter/PeerConnection.idl @@ -0,0 +1,621 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + namespace adapter + { + /// + /// The RTCConfiguration defines a set of parameters to configure how + /// the peer to peer communication established via RTCPeerConnection is + /// established or re-established. + /// + [dictionary] + struct RTCConfiguration + { + typedef std::list CertificateList; + + /// + /// Gets or sets the ice gatherer policy as well as an array of + /// objects describing servers available to be used by ICE, such as + /// STUN and TURN server. + /// + RTCIceGatherOptions gatherOptions; + /// + /// Gets or sets the signaling mode as either JSON based or SDP based. + /// The signaling type must be specified as Json, SdpOffer, or + /// SdpAnswer. + /// + RTCPeerConnectionSignalingMode signalingMode = json; + /// + /// Gets or sets if the SRTP/SDES should be used with the peer + /// connection. + /// + bool negotiateSrtpSdes; + + /// + /// Gets or sets a media-bundling policy to use when gathering ICE. + /// candidates. + /// + RTCBundlePolicy bundlePolicy = balanced; + /// + /// Gets or sets rtcp-mux policy to use when gathering ICE candidates. + /// + RTCRtcpMuxPolicy rtcpMuxPolicy = require; + /// + /// Gets or sets a list of certificates that the RTCPeerConnection + /// uses to authenticate. + /// + CertificateList certificates; + /// + /// Gets or sets the size of the prefetched ICE pool as defined in + /// [draft-ietf-rtcweb-jsep-14] (section 3.4.4. and section 4.1.1.). + /// + size_t iceCandidatePoolSize; + + /// + /// Consturcts an instance of an RTCConfiguration object. + /// authenticate. + /// + [constructor, default] + void RTCConfiguration(); + /// + /// Constructs an instance of an RTCConfiguration object by cloning object data from an existing object. + /// + [constructor, altname(RTCConfigurationClone)] + void RTCConfiguration(RTCConfiguration source); + }; + + /// + /// Base object for offer, answer and capability options during RTCPeerConnection exchanges. + /// + [dictionary] + struct RTCOfferAnswerOptions + { + [constructor, delete] + void RTCOfferAnswerOptions(); + + /// + /// Gets or sets if VAD is enabled. Many codecs and systems are + /// capable of detecting "silence" and changing their behavior in this + /// case by doing things such as not transmitting any media. In many + /// cases, such as when dealing with emergency calling or sounds other + /// than spoken voice, it is desirable to be able to turn off this + /// behavior. This option allows the application to provide + /// information about whether it wishes this type of processing + /// enabled or disabled. + /// + bool voiceActivityDetection = true; + }; + + /// + /// The RTCOfferOptions object contains configuration options related + /// to an offer. + /// + [dictionary] + struct RTCOfferOptions : RTCOfferAnswerOptions + { + /// + /// Gets or sets if the ice gatherer should be restarted. When the + /// value of this dictionary member is true, the generated description + /// will have ICE credentials that are different from the current + /// credentials(as visible in the localDescription attribute's SDP). + /// Applying the generated description will restart ICE. + /// + bool iceRestart; + }; + + /// + /// The RTCAnswerOptions object contains configuration options related + /// to an answer. + /// + [dictionary] + struct RTCAnswerOptions : RTCOfferAnswerOptions + { + }; + + /// + /// The RTCCapabilityOptions object contains configuration options related + /// to capability options as part of a capabilities signaling exchange. + /// + [dictionary] + struct RTCCapabilityOptions : RTCOfferAnswerOptions + { + }; + + /// + /// The RTCMediaStreamTrackConfiguration contains the information needed + /// to configure the tracks to send over the RTP transport. + /// + [dictionary] + struct RTCMediaStreamTrackConfiguration + { + /// + /// Gets or sets the RTP capabilities associated with the media + /// stream track configuration. + /// + RTCRtpCapabilities capabilities; + /// + /// Gets or sets the RTP parameters associated with the media + /// stream track configuration. + /// + RTCRtpParameters parameters; + + /// + /// Constructs an empty instance of an RTCMediaStreamTrackConfiguration object. + /// + [constructor, default] + void RTCMediaStreamTrackConfiguration(); + /// + /// Constructs an instance of an RTCMediaStreamTrackConfiguration object by cloning object data from an existing object. + /// + [constructor, altname(RTCMediaStreamTrackConfigurationClone)] + void RTCMediaStreamTrackConfiguration(RTCMediaStreamTrackConfiguration source); + }; + + /// + /// The RTCPeerConnectionIceErrorEvent object is fired when an error + /// connecting to a STUN or TURN server is detected. + /// + interface RTCPeerConnectionIceErrorEvent + { + [constructor, delete] + void RTCPeerConnectionIceErrorEvent(); + + /// + /// Gets the local candidate used to communicate with the STUN or TURN + /// server. + /// + [getter] + RTCIceCandidate hostCandidate; + /// + /// Gets the STUN or TURN URL that identifies the STUN or TURN server + /// for which the failure occurred. + /// + [getter] + string url; + /// + /// Gets the errorCode attribute is the numeric STUN error code + /// returned by the STUN or TURN server. + /// + [getter, optional] + uint16 errorCode; + /// + /// Gets the errorText attribute is the STUN reason text returned by + /// the STUN or TURN server. + /// + [getter] + string errorText; + }; + + /// + /// This event fires whenever a new ICE candidate has been discovered. + /// + struct RTCPeerConnectionIceEvent + { + [constructor, delete] + void RTCPeerConnectionIceEvent(); + + /// + /// Gets the RTCIceCandidate object with the new ICE candidate that + /// caused the event. + /// + [getter] + RTCIceCandidate candidate; + /// + /// Gets the STUN or TURN URL that identifies the STUN or TURN server + /// used to gather this candidate. If the candidate was not gathered + /// from a STUN or TURN server, this parameter will be set to null. + /// + [getter] + string uri; + }; + + /// + /// The RTCTrackEvent is fired when a new remote track is detected. + /// + struct RTCTrackEvent + { + typedef std::list MediaStreamList; + + [constructor, delete] + void RTCTrackEvent(); + + /// + /// Gets the RTCRtpReceiver object associated with the event. + /// + [getter] + RTCRtpReceiver receiver; + /// + /// Gets the MediaStreamTrack object that is associated with the + /// RTCRtpReceiver identified by receiver. + /// + [getter] + MediaStreamTrack track; + /// + /// Gets an array of MediaStream objects representing the MediaStreams + /// that this event's track is a part of. + /// + [getter] + MediaStreamList mediaStreams; + }; + + /// + /// The general operation of the RTCPeerConnection is described in + /// [draft-ietf-rtcweb-jsep]. + /// + interface RTCPeerConnection : RTCStatsProvider + { + typedef std::list MediaStreamList; + typedef PromiseWith PromiseWithDescription; + typedef std::list ServerList; + typedef std::list SenderList; + typedef std::list ReceiverList; + typedef PromiseWith PromiseWithSender; + typedef PromiseWith PromiseWithDataChannel; + + /// + /// Constructs an instance of an RTCPeerConnection object. + /// + [default, constructor] + void RTCPeerConnection(); + + /// + /// Constructs an instance of an RTCPeerConnection object with + /// configuration options specified. + /// + [constructor, altname(RTCPeerConnectionWithConfiguration)] + void RTCPeerConnection(RTCConfiguration configuration); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// The CreateOffer method generates a blob of SDP that contains an + /// [RFC3264] offer with the supported configurations for the session, + /// including descriptions of the local MediaStreamTracks attached to + /// this RTCPeerConnection, the codec/RTP/RTCP options supported by + /// this implementation, and any candidates that have been gathered by + /// the ICE Agent. The options parameter may be supplied to provide + /// additional control over the offer generated. + /// + [default] + PromiseWithDescription createOffer(); + /// + /// The CreateOffer method generates a blob of SDP that contains an + /// [RFC3264] offer with the supported configurations for the session, + /// including descriptions of the local MediaStreamTracks attached to + /// this RTCPeerConnection, the codec/RTP/RTCP options supported by + /// this implementation, and any candidates that have been gathered by + /// the ICE Agent. The options parameter may be supplied to provide + /// additional control over the offer generated. + /// + [altname(createOfferWithOptions)] + PromiseWithDescription createOffer(RTCOfferOptions options); + /// + /// The CreateAnswer method generates an [RFC3264] answer with the + /// supported configuration for the session that is compatible with + /// the parameters in the remote configuration. Like createOffer, the + /// returned blob contains descriptions of the local MediaStreamTracks + /// attached to this RTCPeerConnection, the codec/RTP/RTCP options + /// negotiated for this session, and any candidates that have been + /// gathered by the ICE Agent. The options parameter may be supplied + /// to provide additional control over the generated answer. + /// + [default] + PromiseWithDescription createAnswer(); + /// + /// The CreateAnswer method generates an [RFC3264] answer with the + /// supported configuration for the session that is compatible with + /// the parameters in the remote configuration. Like createOffer, the + /// returned blob contains descriptions of the local MediaStreamTracks + /// attached to this RTCPeerConnection, the codec/RTP/RTCP options + /// negotiated for this session, and any candidates that have been + /// gathered by the ICE Agent. The options parameter may be supplied + /// to provide additional control over the generated answer. + /// + [altname(createAnswerWithOptions)] + PromiseWithDescription createAnswer(RTCAnswerOptions options); + + /// + /// When operating in JSON signaling type, this method gets the local + /// description which consists of ICE transport parameters, secure + /// transport parameters, and RTP/RTCP capabilities without needing + /// shared negioated state with an offer answer exchange. In this + /// signaling model, each side creates it's capabilities (and + /// parameters) and exchanges with the remote party. + /// + [default] + PromiseWithDescription createCapabilities(); + /// + /// When operating in JSON signaling type, this method gets the local + /// description which consists of ICE transport parameters, secure + /// transport parameters, and RTP/RTCP capabilities without needing + /// shared negioated state with an offer answer exchange. In this + /// signaling model, each side creates it's capabilities (and + /// parameters) and exchanges with the remote party. + /// + [altname(createCapabilitiesWithOptions)] + PromiseWithDescription createCapabilities(RTCCapabilityOptions options); + + /// + /// The SetLocalDescription() method instructs the RTCPeerConnection + /// to apply the supplied RTCSessionDescriptionInit as the local + /// description. + /// + Promise setLocalDescription(RTCSessionDescription description); + + /// + /// Gets the PendingLocalDescription if it is not null and otherwise + /// it must return CurrentLocalDescription. + /// + [getter] + RTCSessionDescription localDescription; + /// + /// Gets the local RTCSessionDescription that was successfully + /// negotiated the last time theRTCPeerConnection transitioned into + /// the stable state plus any local candidates that have been + /// generated by the ICE Agent since the offer or answer was created. + /// This attribute is updated by SetLocalDescription(). + /// + [getter] + RTCSessionDescription currentDescription; + /// + /// Gets a local RTCSessionDescription that is in the process of being + /// negotiated plus any local candidates that have been generated by + /// the ICE Agent since the offer or answer was created. If the + /// RTCPeerConnection is in the stable state, the value is null. This + /// attribute is updated by setLocalDescription(). + /// + [getter] + RTCSessionDescription pendingDescription; + + /// + /// The SetRemoteDescription() method instructs the RTCPeerConnection + /// to apply the supplied RTCSessionDescriptionInit as the remote + /// offer or answer (or remote description if in JSON signalling). + /// This API may change the local media state. + /// + Promise setRemoteDescription(RTCSessionDescription description); + /// + /// Gets the PendingRemoteDescription if it is not null and otherwise + /// it must return currentRemoteDescription. + /// + [getter] + RTCSessionDescription remoteDescription; + /// + /// Gets the last remote RTCSessionDescription that was successfully + /// negotiated the last time theRTCPeerConnection transitioned into + /// the stable state plus any remote candidates that have been + /// supplied via AddIceCandidate() since the offer or answer was + /// created. This attribute is updated by SetRemoteDescription(). + /// + [getter] + RTCSessionDescription currentRemoteDescription; + /// + /// Gets a remote RTCSessionDescription that is in the process of + /// being negotiated, completed with any remote candidates that have + /// been supplied via AddIceCandidate() since the offer or answer was + /// created. If the RTCPeerConnection is in the stable state, the + /// value is null. This attribute is updated by + /// SetRemoteDescription(). + /// + [getter] + RTCSessionDescription pendingRemoteDescription; + /// + /// The AddIceCandidate() method provides a remote candidate to the + /// ICE Agent. In addition to being added to the remote description, + /// connectivity checks will be sent to the new candidates as long as + /// the ICE Transports setting is not set to none. This call will + /// result in a change to the ICE connection state, and may result in + /// a change to media state if it results in different connectivity + /// being established. The only members of candidate used by this + /// method are candidate, sdpMid and sdpMLineIndex; the rest are + /// ignored. + /// + void addIceCandidate(RTCIceCandidate candidate); + + /// + /// Gets the RTCPeerConnection object's signaling state. + /// + [getter] + RTCSignalingState signalingState; + /// + /// Gets the ICE gathering state of the RTCPeerConnection instance. + /// + [getter] + RTCIceGathererState iceGatheringState; + + /// + /// Gets the ICE connection state of the RTCPeerConnection instance. + /// + [getter] + RTCIceConnectionState iceConnectionState; + /// + /// Gets the aggregate of the states of the DtlsTransports and + /// IceTransports of the RTCPeerConnection, as describe in the values + /// of the RTCPeerConnectionState enum. + /// + [getter] + RTCPeerConnectionState connectionState; + /// + /// Gets whether the remote peer is able to accept trickled ICE + /// candidates [draft-ietf-ice-trickle-01]. + /// + [getter] + bool canTrickleCandidates; + + /// + /// Gets a list of ICE servers that are configured into the engine. + /// An engine/browser might be configured to use local or private + /// STUN or TURN servers. This method allows an application to learn + /// about these servers and optionally use them. + /// + ServerList getDefaultIceServers(); + + /// + /// Gets or sets an RTCConfiguration object representing the current + /// configuration of this RTCPeerConnection object. + /// + [getter, setter] + RTCConfiguration getConfiguration; + + /// + /// Closes the RTCPeerConnection object. + /// + void close(); + + /// + /// Returns a sequence of RTCRtpSender objects representing the RTP + /// senders that are currently attached to this RTCPeerConnection + /// object. + /// + SenderList getSenders(); + /// + /// Returns a sequence of RTCRtpReceiver objects representing the RTP + /// receivers that are currently attached to this RTCPeerConnection + /// object. + /// + ReceiverList getReceivers(); + + /// + /// Adds a new track to the RTCPeerConnection. + /// + [default] + PromiseWithSender addTrack(MediaStreamTrack track); + /// + /// Adds a new track to the RTCPeerConnection and specifies how the + /// track must be encoded. + /// + [altname(addTrackWithConfiguration)] + PromiseWithSender addTrack( + MediaStreamTrack track, + RTCMediaStreamTrackConfiguration config + ); + /// + /// Adds a new track to the RTCPeerConnection, and indicates that it + /// is contained in the specified MediaStreams. + /// + [altname(addTrackWithStreams)] + PromiseWithSender addTrack( + MediaStreamTrack track, + MediaStreamList mediaStreams, + RTCMediaStreamTrackConfiguration config + ); + + /// + /// Stops sending media from sender. The RTCRtpSender will still + /// appear in GetSenders(). + /// + void removeTrack(RTCRtpSender sender); + + /// + /// Creates a new RTCDataChannel object with the given data channel + /// parameters. + /// + PromiseWithDataChannel createDataChannel(RTCDataChannelParameters parameters); + + /// + /// The engine wishes to inform the application that session + /// negotiation needs to be done (e.g. a CreateOffer() call followed + /// by SetLocalDescription). Alternatively, CreateCapabilities() can + /// be called for JSON style signaling. + /// + [event] + void onNegotiationNeeded(); + + /// + /// A new RTCIceCandidate is made available to the script. + /// + [event] + void onIceCandidate(RTCPeerConnectionIceEvent event); + + /// + /// A failure occured when gathering ICE candidates. + /// + [event] + void onIceCandidateError(RTCPeerConnectionIceErrorEvent event); + + /// + /// The signaling state has changed. This state change is the result + /// of either setLocalDescription() or setRemoteDescription() being + /// invoked. + /// + [event] + void onSignalingStateChange(); + + /// + /// The RTCPeerConnection's ICE connection state has changed. + /// + [event] + void onIceConnectionStateChange(); + + /// + /// The RTCPeerConnection's ICE gathering state has changed. + /// + [event] + void onIceGatheringStateChange(); + + /// + /// The RTCPeerConnection ConnectionState has changed. + /// + [event] + void onConnectionStateChange(); + + /// + /// A new incoming MediaStreamTrack has been created, and an + /// associated RTCRtpReceiver has been added to the set of receivers. + /// + [event] + void onTrack(RTCTrackEvent event); + + /// + /// An incoming MediaStreamTrack has disappeared, and the associated + /// RTCRtpReceiver is now removed. + /// + [event] + void onTrackGone(RTCTrackEvent event); + + /// + /// A new RTCDataChannel is dispatched to the script in response to + /// the other peer creating a channel. + /// + [event] + void onDataChannel(RTCDataChannelEvent event); + }; + } + } +} diff --git a/ortc/idl/adapter/SessionDescription.idl b/ortc/idl/adapter/SessionDescription.idl new file mode 100644 index 00000000..13de5cef --- /dev/null +++ b/ortc/idl/adapter/SessionDescription.idl @@ -0,0 +1,1136 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + namespace adapter + { + /// + /// The RTCSessionDescriptionConnectionDataDetails object describes the + /// RTP/RTCP connection data at the session or media level or the + /// unicast address information for the origin at the session level as + /// described in [RFC4566] Section 5.7 for RTP and [RFC3605] Section 2.1 + /// for RTCP and [RFC4566] Section 5.2 for the origin's unicast address. + /// + /// + /// + /// o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5 + /// + /// + /// c=IN IP4 224.2.17.12/127 + /// + /// + /// a=rtcp:53020 + /// + /// + /// a=rtcp:53020 IN IP4 126.16.64.4 + /// + /// + [dictionary] + struct RTCSessionDescriptionConnectionDataDetails + { + /// + /// Gets or sets the port for RTP or RTCP. For RTP at the media level + /// this is the media description's port as described in [RFC4566] + /// Section 5.14. For RTCP, the port is the RTCP port to use for the + /// connection as described in [RFC3605] Section 2.1. This value is + /// null and not used for origin unicast address or at the session + /// level's connection address. + /// + [optional] + uint16 port; + /// + /// Gets or sets the network type as described in [RFC4566] Section + /// 8.2.6. The value "IN" represents the Internet. + /// + string netType; + /// + /// Gets or sets the address type as described in [RFC4566] Section + /// 8.2.7. The value "IP4" represents the IPv4 and "IP6" represents + /// IPv6. + /// + string addrType; + /// + /// Gets or sets the connection address as described in [RFC4566] + /// Section 5.7 for session or media level connection data or the + /// unicast address for the session level origin as describe in + /// [RFC4566] Section 5.2 + /// + string connectionAddress; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionConnectionDataDetails object. + /// + [constructor, default] + void RTCSessionDescriptionConnectionDataDetails(); + /// + /// Constructs an instance of an RTCSessionDescriptionConnectionDataDetails object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionConnectionDataDetailsClone)] + void RTCSessionDescriptionConnectionDataDetails(RTCSessionDescriptionConnectionDataDetails source); + /// + /// Constructs an instance of an RTCSessionDescriptionConnectionDataDetails object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionConnectionDataDetailsWithJson)] + void RTCSessionDescriptionConnectionDataDetails(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSessionDescriptionConnectionData object describes the + /// connection data information as described in [RFC4566] Section 5.7 + /// for RTP and [RFC3605] Section 2.1 for RTCP (at either the session + /// level or the media level). + /// + [dictionary] + struct RTCSessionDescriptionConnectionData + { + /// + /// Gets or sets the RTP connection data information "c=" as described + /// in [RFC4566] Section 5.7. + /// + RTCSessionDescriptionConnectionDataDetails rtp; + /// + /// Gets or sets the RTCP connection data information "a=rtcp" as + /// described in [RFC3605] Section 2.1. + /// + RTCSessionDescriptionConnectionDataDetails rtcp; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionConnectionData object. + /// + [constructor, default] + void RTCSessionDescriptionConnectionData(); + /// + /// Constructs an instance of an RTCSessionDescriptionConnectionData object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionConnectionDataClone)] + void RTCSessionDescriptionConnectionData(RTCSessionDescriptionConnectionData source); + /// + /// Constructs an instance of an RTCSessionDescriptionConnectionData object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionConnectionDataWithJson)] + void RTCSessionDescriptionConnectionData(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSessionDescriptionTransportParameters represents the ICE + /// and secure transport parameters for a transport as well as any + /// candidates that are signaled as part of the session description for + /// a given transport. + /// + [dictionary] + struct RTCSessionDescriptionTransportParameters + { + typedef std::list CandidateList; + + /// + /// Gets or sets all the ICE parameters needed to configure the ICE + /// ICE transport as described in [RFC5245]. + /// + RTCIceParameters iceParameters; + /// + /// Gets or sets the DTLS parameters need to configure the DTLS + /// transport as described in [RFC4572] and [RFC5763]. + /// + RTCDtlsParameters dtlsParameters; + /// + /// Gets or sets the SRTP/SDES parameters as described in [RFC4568]. + /// This transport is mutually exclusive with the DTLS transport and + /// must always be set null for RTCP transports. + /// + RTCSrtpSdesParameters srtpSdesParameters; + /// + /// Gets or sets the list of ICE candidates as described in [RFC5245]. + /// + CandidateList iceCandidates; + /// + /// Gets or sets if the end-of-candidates flag as described in + /// [draft-ietf-ice-trickle] Section 10. + /// + bool endOfCandidates; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionTransportParameters object. + /// + [constructor, default] + void RTCSessionDescriptionTransportParameters(); + /// + /// Constructs an instance of an RTCSessionDescriptionTransportParameters object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionTransportParametersClone)] + void RTCSessionDescriptionTransportParameters(RTCSessionDescriptionTransportParameters source); + /// + /// Constructs an instance of an RTCSessionDescriptionTransportParameters object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionTransportParametersWithJson)] + void RTCSessionDescriptionTransportParameters(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSessionDescriptionTransport object represents the ICE and + /// secure transport parameters for RTP and optionally RTCP if non-muxed + /// RTP/RTCP data is used. + /// + [dictionary] + struct RTCSessionDescriptionTransport + { + /// + /// Gets or sets a unique identifier for the transport. For SDP, + /// this is the mid identification tag as defined in [RFC5888] Section + /// 4 for the media line's transport or the primary bundled transport + /// transport media line identifier. + /// + /// + /// + /// m=audio 30000 RTP/AVP 0 + /// a=mid:1 + /// m=video 30002 RTP/AVP 31 + /// a=mid:2 + /// + /// + string transportId; + /// + /// Gets or sets the RTP transport information for use with RTP and + /// RTCP media in the case of muxed RTP/RTCP and only the RTP media + /// in the non-muxed scenario. This contains the information for ICE + /// and the secure transport. + /// + RTCSessionDescriptionTransportParameters rtp; + /// + /// Gets or sets the RTCP transport information for use with RTCP if + /// non-muxed RTCP data is used otherwise the value is null. This + /// contains the ICE transport information and secure transport + /// information for use with RTCP. + /// + RTCSessionDescriptionTransportParameters rtcp; + /// + /// Gets or sets the mux policy for the transport. Mux is preferred + /// when possible. + /// + bool useMux; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionTransport object. + /// object. + /// + [constructor, default] + void RTCSessionDescriptionTransport(); + /// + /// Constructs an instance of an RTCSessionDescriptionTransport object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionTransportClone)] + void RTCSessionDescriptionTransport(RTCSessionDescriptionTransport source); + /// + /// Constructs an instance of an RTCSessionDescriptionTransport object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionTransportWithJson)] + void RTCSessionDescriptionTransport(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// Gets or sets the media line detailed information associated with a + /// type of media and related capabilities for the media on a particular + /// transport as describe in [RFC4566] Section 5.14 as well as in + /// [draft-ietf-rtcweb-jsep-14]. + /// + [dictionary] + struct RTCSessionDescriptionMediaLineDetails + { + /// + /// Gets or sets the internal index of a media line based upon its + /// order within the entire session. This is used only when the + /// media line has no identifier. This value is used internally + /// to coordinate matching m lines for SDP negotiation but otherwise + /// is not recommended. + /// + [optional] + size_t internalIndex; + /// + /// Gets or sets the private transport to use when the media line + /// cannot be bundled withinn the session. This is allows a legacy + /// systems that are not capable of bundling media lines together an + /// option of including their own private alternative non-bundled + /// transport as described in + /// [draft-ietf-mmusic-sdp-bundle-negotiation]. If the media line's + /// TransportId and PrivateTransportId are identical then this + /// transport either is part of a bundle or the transport will be used + /// privately and exclusively by this transport depending on what is + /// negotiated. If these values differ then the media line will be + /// either bundled into a single transport or use a private transport. + /// + string privateTransportID; + + /// + /// Gets or sets the protocol for use with DTLS and RTP as descibed in + /// [RFC5764] Section 8 or for DTLS and SCTP as described in + /// [draft-ietf-mmusic-sctp-sdp] Section 7 and 8. The following values + /// match any values are are legal for RTP "RTP/[S]AVP[F]" and + /// "(UDP/TCP)/TLS/RTP/SAVP[F]" and for SCTP the values are + /// "UDP/DTLS/SCTP", "TCP/DTLS/SCTP", or "DTLS/SCTP + /// + string protocol; + + /// + /// Gets or sets the media line connection information as described in + /// [RFC4566] Section 5.7 for RTP and [RFC3605] Section 2.1 for RTCP. + /// + RTCSessionDescriptionConnectionData connectionData; + /// + /// Gets or sets the media direction flow expectations for the media + /// line as described in [RFC4566] Section 6. + /// + RTCSessionDescriptionMediaDirection mediaDirection = sendReceive; + + /// + /// Constructs and instance of an + /// RTCSessionDescriptionMediaLineDetails object. + /// + [constructor, default] + void RTCSessionDescriptionMediaLineDetails(); + /// + /// Constructs an instance of an RTCSessionDescriptionMediaLineDetails object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionMediaLineDetailsClone)] + void RTCSessionDescriptionMediaLineDetails(RTCSessionDescriptionMediaLineDetails source); + /// + /// Constructs an instance of an RTCSessionDescriptionMediaLineDetails object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionMediaLineDetailsWithJson)] + void RTCSessionDescriptionMediaLineDetails(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + [dictionary] + struct RTCSessionDescriptionMediaLine + { + [constructor, delete] + void RTCSessionDescriptionMediaLine(); + + /// + /// Gets or sets the media identifier for the media line as described + /// in [RFC5888] Section 4. + /// + string id; + /// + /// Gets or sets the transport identifier for the media line. Multiple + /// media lines can point to the same transport id so long as the + /// payload type or RTP header extension IDs are not redefined within + /// the same transport in the same direction for JSON or any direction + /// for SDP. All media lines that share the same transport id are + /// grouped together into the same bundle as described in + /// [draft-ietf-mmusic-sdp-bundle-negotiation]. + /// + /// + /// + /// v=0 + /// o=alice 2890844526 2890844526 IN IP4 atlanta.example.com + /// s= + /// c=IN IP4 atlanta.example.com + /// t=0 0 + /// a=group:BUNDLE foo bar + /// m=audio 10000 RTP/AVP 0 8 97 + /// b=AS:200 + /// a=mid:foo + /// a=rtpmap:0 PCMU/8000 + /// a=rtpmap:8 PCMA/8000 + /// a=rtpmap:97 iLBC/8000 + /// a=extmap 1 urn:ietf:params:rtp-hdrext:sdes:mid + /// m=video 10002 RTP/AVP 31 32 + /// b=AS:1000 + /// a=mid:bar + /// a=rtpmap:31 H261/90000 + /// a=rtpmap:32 MPV/90000 + /// a=extmap 1 urn:ietf:params:rtp-hdrext:sdes:mid + /// + /// + string transportId; + + /// + /// Gets or sets the RTP media type. This value must be either "audio" + /// or "video". + /// + string mediaType; + /// + /// Gets or sets the details of the media line which are required for + /// SDP but optional for JSON based signalling. If not usedt his value + /// must be null. + /// + RTCSessionDescriptionMediaLineDetails details; + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSessionDescriptionRtpMediaLine object represents the media + /// capabilities and properties associated with a particular media type + /// on a given transport. Multiple media lines are legally allowed to + /// be bundled within the same transport so long as the payload type + /// and/or RTP header extension IDs are not remapped to mean + /// different codecs or header extension URIs within the same transport + /// for the same direction for JSOn or any direction for SDP. In SDP, + /// a media line is required per sender and the if the media line is + /// send receive the both sides should attempt to map their respective + /// senders to the same media line. + /// + /// + /// + /// m=audio 56500 UDP/TLS/RTP/SAVPF 96 0 8 97 98 + /// c=IN IP4 192.0.2.1 + /// a=sendrecv + /// a=mid:a1 + /// m=video 56502 UDP/TLS/RTP/SAVPF 100 101 + /// c=IN IP4 192.0.2.1 + /// a=rtcp:56503 IN IP4 192.0.2.1 + /// a=sendonly + /// a=mid:v1 + /// m=audio 56500 TCP/DTLS/RTP/SAVPF 96 0 8 97 98 + /// c=IN IP4 192.0.2.1 + /// a=sendrecv + /// a=mid:a2 + /// + /// + [dictionary] + struct RTCSessionDescriptionRtpMediaLine : RTCSessionDescriptionMediaLine + { + /// + /// Gets or sets the sender RTP capabilities described for this media + /// line. The usage of each codec is optional within the parameters of + /// a sender within the media line but the payload type must not + /// be changed within the same media line. The RTP header extension + /// IDs specified within the capabilies do not need to be used within + /// the RTP parameters but the mapping between RTP header extension + /// ID and header extension value must not be changed within the RTP + /// parameters. + /// + RTCRtpCapabilities senderCapabilities; + /// + /// Gets or sets the sender RTP capabilities described for this media + /// line. The usage of each codec is optional within the parameters of + /// a sender within the media line but the payload type must not + /// be changed within the same media line. The RTP header extension + /// IDs specified within the capabilies do not need to be used within + /// the RTP parameters but the mapping between RTP header extension + /// ID and header extension value must not be changed within the RTP + /// parameters. + /// + RTCRtpCapabilities receiverCapabilities; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionRtpMediaLine object. + /// + [constructor, default] + void RTCSessionDescriptionRtpMediaLine(); + /// + /// Constructs an instance of an RTCSessionDescriptionRtpMediaLine object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionRtpMediaLineClone)] + void RTCSessionDescriptionRtpMediaLine(RTCSessionDescriptionRtpMediaLine source); + /// + /// Constructs an instance of an RTCSessionDescriptionRtpMediaLine object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionRtpMediaLineWithJson)] + void RTCSessionDescriptionRtpMediaLine(Json json); + }; + + /// + /// The RTCSessionDescriptionSctpMediaLine object represents the media + /// lines related to an SCTP transport assoacated to an ICE/secure + /// transport on a given SCTP port. Multiple data channels can + /// operate over the same SCTP transport thus creating multiple + /// SCTP transports is not needed unless for application specific logic + /// reasons. + /// + /// + /// + /// m=application 0 UDP/DTLS/SCTP webrtc-datachannel + /// c=IN IP4 0.0.0.0 + /// a=bundle-only + /// a=mid:d1 + /// a=fmtp:webrtc-datachannel max-message-size=65536 + /// a=sctp-port 5000 + /// + /// + [dictionary] + struct RTCSessionDescriptionSctpMediaLine : RTCSessionDescriptionMediaLine + { + /// + /// Gets or sets the SCTP transport's capabilities associated with + /// the SCTP transport. + /// + RTCSctpCapabilities capabilities; + /// + /// Gets or sets the SCTP transport port associated with the SCTP + /// transport. This is required for SDP based singaling but is + /// optional for JSON based signaling but requires the engine support + /// listening for incoming SCTP transports on any port within the + /// transport. Only one non-specified port (null value) is allowed per + /// transport and all non-signaled SCTP transport must share the same + /// SCTP capabilities for the transport. Setting to null implies + /// the SCTP transport is capable of listening for incoming SCTP + /// transport connections. + /// + [optional] + uint16 port; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionSctpMediaLine object. + /// + [constructor, default] + void RTCSessionDescriptionSctpMediaLine(); + /// + /// Constructs an instance of an RTCSessionDescriptionSctpMediaLine object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionSctpMediaLineClone)] + void RTCSessionDescriptionSctpMediaLine(RTCSessionDescriptionSctpMediaLine source); + /// + /// Constructs an instance of an RTCSessionDescriptionSctpMediaLine object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionSctpMediaLineWithJson)] + void RTCSessionDescriptionSctpMediaLine(Json json); + }; + + /// + /// The RTCSessionDescriptionRtpSenderDetails object represents the + /// sender details that are typically only related to SDP properties for + /// a specific sender. + /// + [dictionary] + struct RTCSessionDescriptionRtpSenderDetails + { + /// + /// Gets or sets the associated internal index of a media line + /// associated with a sender based upon the media line order within + /// the entire session. This is used only when the media line has no + /// identifier. This value is used internally to coordinate matching + /// m (media) lines for SDP negotiation but otherwise is not + /// recommended. + /// + [optional] + size_t internalRtpMediaLineIndex; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionRtpSenderDetails object. + /// + [constructor, default] + void RTCSessionDescriptionRtpSenderDetails(); + /// + /// Constructs an instance of an RTCSessionDescriptionRtpSenderDetails object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionRtpSenderDetailsClone)] + void RTCSessionDescriptionRtpSenderDetails(RTCSessionDescriptionRtpSenderDetails source); + /// + /// Constructs an instance of an RTCSessionDescriptionRtpSenderDetails object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionRtpSenderDetailsWithJson)] + void RTCSessionDescriptionRtpSenderDetails(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSessionDescriptionRtpSender object represents the sender + /// parameters for an encoded audio or video media stream track. + /// + [dictionary] + struct RTCSessionDescriptionRtpSender + { + typedef string MediaStreamId; + typedef std::set MediaStreamSet; + + /// + /// Gets or sets the sender identifier. In the case of SDP based + /// signaling this value must correspond to the media stream track + /// identifier that the remote party will adopt as it's media + /// stream track identification as described in + /// [draft-ietf-mmusic-msid] Section 2, i.e. the "msid-appdata" value. + /// + string id; + /// + /// Gets or sets the sender details associated with this sender. These + /// values are typically only used within the context of SDP and + /// thus property may be null if unused. + /// + RTCSessionDescriptionRtpSenderDetails details; + /// + /// Gets or sets the associated media line. In the case of SDP + /// signaling only one sender is allowed to be associated to a single + /// media line at a time. In the case of JSON, multiple senders are + /// allowed to be associated to a single media line. The sender media + /// type and media line media type must be identical. + /// + string rtpMediaLineId; + /// + /// Gets or sets the configuration parameters associated with the + /// RTCRtpSender. + /// + RTCRtpParameters parameters; + /// + /// Gets or sets the media stream track id associated with the + /// sender. This property should match the media stream track object + /// associated with the RTCRtpSender unless the RTCRtpSender's + /// track was chaneged without informing the associated + /// RTCRtpPeerConnection object. + /// + string mediaStreamTrackId; + /// + /// Gets or sets the media stream group IDs associated with the media + /// line [RFC5888] Section 5. All media lines that share the same + /// group identification are considered part of the same group and + /// thus are part of the same media stream. + /// + /// + /// + /// v=0 + /// o=- 6729291447651054566 1 IN IP4 0.0.0.0 + /// s=- + /// t=0 0 + /// a=group:BUNDLE a1 v1 + /// m=audio 20000 UDP/TLS/RTP/SAVPF 96 0 8 97 98 + /// c=IN IP4 192.0.2.2 + /// a=mid:a1 + /// a=rtcp:20000 IN IP4 192.0.2.2 + /// a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 + /// PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 + /// a=msid:fdsafjdksajlfEjalkfjDlskajaflJakfjd1 + /// PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1a0 + /// ... + /// m=video 20000 UDP/TLS/RTP/SAVPF 100 101 + /// c=IN IP4 192.0.2.2 + /// a=rtcp 20001 IN IP4 192.0.2.2 + /// a=mid:v1 + /// a=msid:PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1 + /// PI39StLS8W7ZbQl1sJsWUXkr3Zf12fJUvzQ1v0 + /// + /// + MediaStreamSet mediaStreamIds; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionRtpSender object. + /// + [constructor, default] + void RTCSessionDescriptionRtpSender(); + /// + /// Constructs an instance of an RTCSessionDescriptionRtpSender object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionRtpSenderClone)] + void RTCSessionDescriptionRtpSender(RTCSessionDescriptionRtpSender source); + /// + /// Constructs an instance of an RTCSessionDescriptionRtpSender object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionRtpSenderWithJson)] + void RTCSessionDescriptionRtpSender(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The Session description version of an RTCIceCandidate object + /// includes information relating to an ICE candidate. + /// + [dictionary] + struct RTCIceCandidate + { + /// + /// Gets or sets the identifier of the "media stream identification" + /// as defined in [RFC5888] for the media component this candidate is + /// associated with. + /// + string mid; + /// + /// Gets or sets the identifier of the "media stream identification" + /// as defined in [RFC5888] for the media component this candidate is + /// associated with. + /// + [getter, setter] + string sdpMid; + /// + /// Gets or sets the index (starting at zero) of the media description + /// in the SDP this candidate is associated with. + /// + [optional] + size_t sdpMLineIndex; + /// + /// Gets or sets the candidate-attribute as defined in section 15.1 of + /// [RFC5245]. + /// + RTCIceGathererCandidate candidate; + + /// + /// Constructs an empty instance of an RTCIceCandidate object. + /// + [constructor, default] + void RTCIceCandidate(); + /// + /// Constructs an instance of an RTCIceCandidate object by cloning object data from an existing object. + /// + [constructor, altname(RTCIceCandidateClone)] + void RTCIceCandidate(RTCIceCandidate source); + /// + /// Constructs an instance of an RTCIceCandidate object by extracting object data from a JSON object. + /// + [constructor, altname(RTCIceCandidateWithJson)] + void RTCIceCandidate(Json json) throws (InvalidParameters); + + /// + /// A helper routine to easily converty from a SDP-candidate string to + /// an RTCIceCandidate object. + /// + [static, obsolete("Use FromSdpStringWithMid instead.")] + RTCIceCandidate fromSdpStringWithMLineIndex( + string sdp, + size_t mlineIndex + ) throws (InvalidParameters); + /// + /// A helper routine to easily converty from a SDP-candidate string to + /// an RTCIceCandidate object. + /// + [static] + RTCIceCandidate fromSdpStringWithMid( + string sdp, + string mid + ) throws (InvalidParameters); + + /// + /// A helper routine to easily convert to a SDP-candidate string. + /// + string toSdp(); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + + /// + /// The RTCSessionDescriptionDescriptionDetails represents the session + /// level properties typically contained within an SDP origin or + /// other session level properties. + /// + /// + /// + /// o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5 + /// t=3034423619 3042462419 + /// s=SDP Seminar + /// c=IN IP4 224.2.17.12/127 + /// a=rtcp:53020 + /// + /// + /// o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5 + /// t=0 0 + /// s=- + /// c=IN IP4 224.2.17.12/127 + /// a=rtcp:53020 IN IP4 126.16.64.4 + /// + /// + [dictionary] + struct RTCSessionDescriptionDescriptionDetails + { + /// + /// Gets or sets the user's login on the originating host, or it is "-" + /// if the originating host does not support the concept of user IDs. + /// This is the origin's username as described in [RFC4566] Section + /// 5.2. + /// + string username = "-"; + /// + /// Gets or sets a numeric string such that the tuple of username, + /// sess - id, nettype, addrtype, and unicast - address forms a + /// globally unique identifier for the session. This is the origin's + /// sess-id as described in [RFC4566] Section 5.2. + /// + unsigned long long sessionId; + /// + /// Gets or sets a version number for this session description. This + /// is the origin's sess-version as described in [RFC4566] Section + /// 5.2. + /// + unsigned long long sessionVersion; + /// + /// Gets or sets the unicast address information for a session. This + /// represents the origin's nettype, addrtype, unicast-address as + /// described in [RFC4566] Section 5.2. + /// + RTCSessionDescriptionConnectionDataDetails unicaseAddress; + /// + /// Gets or sets the textual session name as described in [RFC4566] + /// Section 5.3. + /// + string sessionName; + /// + /// Gets or sets the start time of the session in NTP format as + /// described in [RFC4566] Section 5.9. A value of 0 has an unknown + /// start time. + /// + uint64 startTime; + /// + /// Gets or sets the start end of the session in NTP format as + /// described in [RFC4566] Section 5.9. A value of 0 has an unbounded + /// end time. + /// + uint64 endTime; + /// + /// Gets or sets the connection data associated with the session as + /// described in [RFC4566] Section 5.7 for RTP and [RFC3605] + /// Section 2.1 for RTCP (at the session level). + /// + RTCSessionDescriptionConnectionData connectionData; // optional; can be null; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionDescriptionDetails object. + /// + [constructor, default] + void RTCSessionDescriptionDescriptionDetails(); + /// + /// Constructs an instance of an RTCSessionDescriptionDescriptionDetails object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionDescriptionDetailsClone)] + void RTCSessionDescriptionDescriptionDetails(RTCSessionDescriptionDescriptionDetails source); + /// + /// Constructs an instance of an RTCSessionDescriptionDescriptionDetails object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionDescriptionDetailsWithJson)] + void RTCSessionDescriptionDescriptionDetails(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + + /// + /// The RTCSessionDescriptionDescription represents a descriptive + /// format capable of carrying either media SDP [RFC4566] or JSON-style + /// media descriptions. The media descriptions contain information about + /// the session, all transports, media lines with media capabilities, + /// and senders related to the media lines. This format can be + /// converted to/from SDP and JSON. + /// + /// + /// + /// { + /// "session": { + /// "transports": { + /// "transport": { + /// "id": "transport1", + /// "rtp": { + /// "ice": { + /// "parameters": { + /// "usernameFragment": "ufrag1", + /// "password": "password1", + /// "useUnfreezePriority": "true", + /// "iceLite": "false" + /// } + /// }, + /// "dtls": { + /// "parameters": { + /// "role": "auto", + /// "fingerprints": { + /// "fingerprint": [ + /// "AB:32:...", + /// "FF:EE:..." + /// ] + /// } + /// } + /// }, + /// "sdesSrtp": { "parameters": "..." }, + /// "iceCandidates": { + /// "iceCandidate": [ + /// { + /// "mid": "a1", + /// "index": "0", + /// "component": "rtp", + /// "candidate": {...} + /// }, + /// { + /// "mid": "a1", + /// "index": "0", + /// "component": "rtp", + /// "candidateComplete": { complete: "true" } + /// } + /// ] + /// } + /// }, + /// "rtcp": {...} + /// } + /// } + /// }, + /// "rtpMediaLines" : { + /// "rtpMediaLine": { + /// }, + /// ... + /// }, + /// "sctpMediaLines" : { + /// "sctpMediaLine": { + /// }, + /// ... + /// }, + /// "rtpSenders" : { + /// "rtpSender": { + /// }, + /// ... + /// }, + /// } + /// + /// + [dictionary] + struct RTCSessionDescriptionDescription + { + typedef std::list TransportList; + typedef std::list RtpMediaList; + typedef std::list SctpMediaList; + typedef std::list RtpSenderList; + + /// + /// Gets or sets the detailed session information (which is typically + /// related to SDP-only [RFC4566]. This value can be null if is it + /// not needed. + /// + RTCSessionDescriptionDescriptionDetails details; + + /// + /// Gets or sets a list of transports associated with the session. + /// These transports include the ICE and secure transport properties. + /// + TransportList transports; + /// + /// Gets or sets a list of media capabilities which are associated + /// with transports. These media lines describe the intention of the + /// media flow and the capabilities and configuration expectations of + /// the media. + /// + RtpMediaList rtpMediaLines; + /// + /// Gets or sets a list of SCTP data transports associated with + /// the wire transports. + /// + SctpMediaList sctpMediaLines; + /// + /// Gets or sets a list of RTP senders associated with a + /// configurated media line. + /// + RtpSenderList rtpSenders; + + /// + /// Constructs an empty instance of an RTCSessionDescriptionDescription object. + /// + [constructor, default] + void RTCSessionDescriptionDescription(); + /// + /// Constructs an instance of an RTCSessionDescriptionDescription object by cloning object data from an existing object. + /// + [constructor, altname(RTCSessionDescriptionDescriptionClone)] + void RTCSessionDescriptionDescription(RTCSessionDescriptionDescription source); + /// + /// Constructs an instance of an RTCSessionDescriptionDescription object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCSessionDescriptionDescriptionWithJson)] + void RTCSessionDescriptionDescription(Json json); + + /// + /// A helper routine to convert the object's data to structured JSON object data. + /// + Json toJson(); + /// + /// Return a hash of the data contained within the object. + /// + string hash(); + }; + + /// + /// The RTCSessionDescription class is used by RTCPeerConnection to + /// expose local and remote session descriptions. + /// + interface RTCSessionDescription + { + /// + /// Constructs an instance of an RTCSessionDescription from a string + /// representation of the session description. + /// + [constructor, default, altname(RTCSessionDescriptionWithString)] + void RTCSessionDescription( + RTCSessionDescriptionSignalingType type, + string description + ) throws (InvalidParameters, InvalidStateError); + + /// + /// Constructs an instance of an RTCSessionDescription from a + /// structured session description. + /// + [constructor, altname(RTCSessionDescriptionWithDescription)] + void RTCSessionDescription( + RTCSessionDescriptionSignalingType type, + RTCSessionDescriptionDescription description + ) throws(InvalidParameters, InvalidStateError); + + /// + /// Helper routine to convert RTP capabilities into the appropriate + /// matching RTP parameters. + /// + [static] + RTCRtpParameters convertCapabilitiesToParameters(RTCRtpCapabilities capabilitites); + /// + /// Helper routine to convert existing RTP parameters into the RTP + /// capabilities. + /// + [static] + RTCRtpCapabilities ConvertParametersToCapabilitites(RTCRtpParameters parameters); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the SDP type of this RTCSessionDescription. This property + /// may only be obtained if the signaling type is SDP. + /// + [getter] + RTCSessionDescriptionSignalingType type; + + /// + /// Gets the SDP type of this RTCSessionDescription. This property + /// may only be obtained if the signaling type is SDP. + /// + [getter, obsolete("Use Type or SignalingType instead.")] + RTCSdpType sdpType; + + /// + /// Gets a indiciation if the signaling type is JSON based. + /// + [getter] + bool isJsonSignalling; + + /// + /// Gets a indiciation if the signaling type is SDP based. + /// + [getter] + bool isSdpSignaling; + + /// + /// Gets the structured representation of the SDP [RFC3264] or JSON + /// contents. + /// + [getter] + RTCSessionDescriptionDescription description; + + /// + /// Gets the string representation of the SDP [RFC3264] or JSON. + /// + [getter] + string formattedDescription; + + /// + /// Gets the string representation of the SDP [RFC3264] or JSON. + /// + [getter, obsolete("Use FormattedDescription instead.")] + string sdp; + }; + } + } +} diff --git a/ortc/idl/adapter/enums.idl b/ortc/idl/adapter/enums.idl new file mode 100644 index 00000000..c9cadb40 --- /dev/null +++ b/ortc/idl/adapter/enums.idl @@ -0,0 +1,360 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + namespace adapter + { + /// + /// The RTCSdpType enum describes the type of RTCSessionDescription + /// instance. + /// + enum RTCSdpType + { + /// + /// An RTCSdpType of offer indicates that a description must be + /// treated as an [RTC3264] offer. + /// + offer, + /// + /// An RTCSdpType of pranswer indicates that a description must be + /// treated as an [RTC3264] answer, but not a final answer. A + /// description used as an SDP pranswer may be applied as a response + /// to an SDP offer, or an update to a previously sent SDP pranswer. + /// + pranswer, + /// + /// The format of the description is that of an SDP answer. + /// + answer, + /// + /// The format of the description is that of an SDP rollback. + /// + rollback, + }; + + /// + /// Defines the session description's signalling mechanism. + /// + enum RTCSessionDescriptionSignalingType + { + /// + /// The format of the description is that of a JSON blob. + /// + json, + /// + /// The format of the description is that of an SDP offer. + /// + sdpOffer, + /// + /// The format of the description is that of an SDP pre-answer. + /// + sdpPranswer, + /// + /// The format of the description is that of an SDP answer. + /// + sdpAnswer, + /// + /// The format of the description is that of an SDP rollback. + /// + sdpRollback, + }; + + /// + /// Defines the session description's media type as described in + /// [RFC4566] Section 5.14 for the media line. + /// + /// + /// + /// m=audio 49170 RTP/AVP 0 + /// m=video 51372 RTP/AVP 99 + /// + /// + enum RTCSessionDescriptionMediaType + { + /// + /// This object represents an unknown media type. + /// + unknown, + /// + /// This object represents an audio media type. + /// + audio, + /// + /// This object represents a video media type. + /// + video, + /// + /// This object represents a text media type. + /// + text, + /// + /// This object represents an application media type. + /// + application, + }; + + /// + /// Defines the session description direction in which media is flowing. + /// + /// + /// + /// a=sendrecv + /// a=sendonly + /// a=recvonly + /// a=inactive + /// + /// + enum RTCSessionDescriptionMediaDirection + { + /// + /// As defined in [RFC4566], media should be started in send and + /// receive mode. + /// + sendReceive, + /// + /// As defined in [RFC4566], media should be started in send-only mode. + /// + sendOnly, + /// + /// As defined in [RFC4566], media should be started in receive-only + /// mode. + /// + receiveOnly, + /// + /// As defined in [RFC4566], media should be started in inactive mode. + /// + inactive, + }; + + /// + /// As described in [draft-ietf-rtcweb-jsep] (section 4.1.1.), BUNDLE + /// policy affects which media tracks are negotiated if the remote + /// endpoint is not BUNDLE-aware, and what ICE candidates are gathered. + /// + enum RTCBundlePolicy + { + /// + /// Gather ICE candidates for each media type in use (audio, video, + /// and data). If the remote endpoint is not BUNDLE-aware, negotiate + /// only one audio and video track on separate transports. + /// + balanced, + /// + /// Gather ICE candidates for each track. If the remote endpoint is + /// not BUNDLE-aware, negotiate all media tracks on separate + /// transports. + /// + maxCompat, + /// + /// Gather ICE candidates for only one track. If the remote endpoint + /// is not BUNDLE-aware, negotiate only one media track. + /// + maxBundle, + }; + + /// + /// The RtcpMuxPolicy affects what ICE candidates are gathered to + /// support non-multiplexed RTCP. + /// + enum RTCRtcpMuxPolicy + { + /// + /// Gather ICE candidates for both RTP and RTCP candidates. If the + /// remote-endpoint is capable of multiplexing RTCP, multiplex RTCP on + /// the RTP candidates. If it is not, use both the RTP and RTCP + /// candidates separately. + /// + negotiated, + /// + /// Gather ICE candidates only for RTP and multiplex RTCP on the RTP + /// candidates. If the remote endpoint is not capable of rtcp-mux, + /// session negotiation will fail. + /// + require, + }; + + /// + /// The RTCPeerConnectionSignalingMode defines the signaling type to be + /// used with signaling modes. + /// + enum RTCPeerConnectionSignalingMode + { + /// + /// Use JSON capabilities exchange style signaling with the peer + /// connection. + /// + json, + /// + /// Use SDP offer/answer exchange style signaling with the peer + /// connection. + /// + sdp, + }; + + /// + /// The RTCSignalingState describes the current state of an offer / + /// answer exchanged as it relates to the SDP negotiation process. WHen + /// JSON style signaling is used the state is always Stable. + /// + enum RTCSignalingState + { + /// + /// There is no offer­answer exchange in progress. This is also the + /// initial state in which case the local and remote descriptions are + /// empty. + /// + stable, + /// + /// A local description, of type "offer", has been successfully + /// applied. + /// + haveLocalOffer, + /// + /// A remote description, of type "offer", has been successfully + /// applied. + /// + haveRemoteOffer, + /// + /// A remote description of type "offer" has been successfully + /// applied and a local description of type "pranswer" has been + /// successfully applied. + /// + haveLocalPranswer, + /// + /// A local description of type "offer" has been successfully applied + /// and a remote description of type "pranswer" has been successfully + /// applied. + /// + haveRemotePranswer, + /// + /// The connection is closed. + /// + closed, + }; + + /// + /// The RTCIceConnectionState indicates the combined state of all the + /// RTCIceTransport objects states. + /// + enum RTCIceConnectionState + { + /// + /// The ICE Agent is gathering addresses and/or waiting for remote + /// candidates to be supplied. + /// + new, + /// + /// The ICE Agent has received remote candidates on at least one + /// component, and is checking candidate pairs but has not yet found a + /// connection. In addition to checking, it may also still be + /// gathering. + /// + checking, + /// + /// The ICE Agent has found a usable connection for all components but + /// is still checking other candidate pairs to see if there is a + /// better connection. It may also still be gathering. + /// + connected, + /// + /// The ICE Agent has finished gathering and checking and found a + /// connection for all components. Details on how the completed state + /// in ICE is reached are covered in [RFC5245]. + /// + completed, + /// + /// Liveness checks have failed for one or more components. This is + /// more aggressive than failed, and may trigger intermittently (and + /// resolve itself without action) on a flaky network. + /// + disconnected, + /// + /// The ICE Agent is finished checking all candidate pairs and failed + /// to find a connection for at least one component. Connections may + /// have been found for some components. + /// + failed, + /// + /// The ICE Agent has shut down and is no longer responding to STUN + /// requests. + /// + closed, + }; + + /// + /// The RTCPeerConnectionState indicates the combined state of all the + /// RTCIceTransport and RTCDtlsTransport objects states. + /// + enum RTCPeerConnectionState + { + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in the new + /// state and none of the transports are in the connecting, checking, + /// failed or disconnected state, or all transports are in the closed + /// state. + /// + new, + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in the + /// connecting or checking state and none of them is in the failed + /// state. + /// + connecting, + /// + /// All RTCIceTransports and RTCDtlsTransports are in the connected, + /// completed or closed state and at least of them is in the connected + /// or completed state. + /// + connected, + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in the + /// disconnected state and none of them are in the failed or + /// connecting or checking state. + /// + disconnected, + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in a failed + /// state. + /// + failed, + /// + /// The RTCPeerConnection object's IsClosed slot is true. + /// + closed, + }; + + } + + } +} diff --git a/ortc/idl/config.json b/ortc/idl/config.json new file mode 100644 index 00000000..173ded05 --- /dev/null +++ b/ortc/idl/config.json @@ -0,0 +1,57 @@ +{ + "project": { + "name": "org.ortc", + "aliases": { + "alias": [ + { + "in": "bogus_ortc_test_alias", + "out": "bogus" + } + ] + }, + "exclusives": { + "exclusive": [ + "xplatform" + ] + }, + "includes": { + "include": [ + "../../../zsLib/zsLib/idl/config.json" + ] + }, + "sources": { + "source": [ + "Ortc.idl", + "Logger.idl", + "Settings.idl", + "error.idl", + "enums.idl", + "Capabilities.idl", + "Certificate.idl", + "Constraints.idl", + "StatsReport.idl", + "StatsProvider.idl", + "DataChannel.idl", + "IceTypes.idl", + "IceGatherer.idl", + "IceTransport.idl", + "IceTransportController.idl", + "DtlsTransport.idl", + "Identity.idl", + "MediaStreamTrack.idl", + "MediaDevices.idl", + "RtpTypes.idl", + "RtpListener.idl", + "RtpReceiver.idl", + "RtpSender.idl", + "DtmfSender.idl", + "SctpTransport.idl", + "SrtpSdesTransport.idl", + "adapter/enums.idl", + "adapter/SessionDescription.idl", + "adapter/MediaStream.idl", + "adapter/PeerConnection.idl" + ] + } + } +} diff --git a/ortc/idl/enums.idl b/ortc/idl/enums.idl new file mode 100644 index 00000000..0ed854a1 --- /dev/null +++ b/ortc/idl/enums.idl @@ -0,0 +1,825 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// RTCDataChannelState represents the state of the RTCDataChannel object. + /// + enum RTCDataChannelState + { + /// + /// The user agent is attempting to establish the underlying data + /// transport. This is the initial state of an RTCDataChannel object. + /// + connecting, + /// + /// The underlying data transport is established and communication is + /// possible. This is the initial state of an RTCDataChannel object + /// dispatched as a part of an RTCDataChannelEvent. + /// + open, + /// + /// The procedure to close down the underlying data transport has + /// started. + /// + closing, + /// + /// The underlying data transport has been closed or could not be + /// established. + /// + closed, + }; + + /// + /// RTCSctpTransportState indicates the state of the SCTP transport. + /// + enum RTCSctpTransportState + { + /// + /// The RTCSctpTransport object has been created and has not started + /// negotiating yet. + /// + new, + /// + /// SCTP is in the process of negotiating an association. + /// + connecting, + /// + /// SCTP has completed negotiation of an association. + /// + connected, + /// + /// The SCTP association has been closed intentionally via a call to + /// Stop() or receipt of a SHUTDOWN or ABORT chunk. + /// + closed, + }; + + /// + /// RTCIceRole contains the current role of the ICE transport. + /// + enum RTCIceRole + { + /// + /// The controlling state, defined in [RFC5245] Section 3. + /// + controlling, + /// + /// The controlled state, defined in [RFC5245] Section 3. + /// + controlled, + }; + + /// + /// RTCIceComponent contains the component-id of the RTCIceTransport, + /// which will be "RTP" unless RTP and RTCP are not multiplexed and the + /// RTCIceTransport object was returned by createAssociatedTransport(). + /// + enum RTCIceComponent + { + /// + /// The RTP component ID, defined (as '1') in [RFC5245] Section 4.1.1.1. + /// Protocols multiplexed with RTP (e.g. SCTP data channel) share its + /// component ID. + /// + rtp = 1, + /// + /// The RTCP component ID, defined (as '2') in [RFC5245] Section + /// 4.1.1.1. + /// + rtcp = 2, + }; + + enum RTCIceProtocol + { + /// + /// A UDP candidate, as described in [RFC5245]. + /// + udp, + /// + /// A TCP candidate, as described in [RFC5245]. + /// + tcp, + }; + + /// + /// The RTCIceCandidateType includes the type of the ICE candidate. + /// + enum RTCIceCandidateType + { + /// + /// A host candidate, defined in [RFC5245] Section 3. + /// + host, + /// + /// A server reflexive candidate, defined in [RFC5245] Section 3. + /// + srflex, + /// + /// A peer reflexive candidate, defined in [RFC5245] Section 3. + /// + prflx, + /// + /// A relay candidate, defined in [RFC5245] Section 3. + /// + relay, + }; + + /// + /// The RTCIceTcpCandidateType includes the type of the ICE TCP candidate, + /// as described in [RFC6544]. + /// + enum RTCIceTcpCandidateType + { + /// + /// An active TCP candidate is one for which the transport will attempt + /// to open an outbound connection but will not receive incoming + /// connection requests. + /// + active, + /// + /// A passive TCP candidate is one for which the transport will receive + /// incoming connection attempts but not attempt a connection. + /// + passive, + /// + /// An so candidate is one for which the transport will attempt to open + /// a connection simultaneously with its peer. + /// + so, + }; + + /// + /// RTCIceGathererState represents the current state of the ICE gatherer. + /// + enum RTCIceGathererState + { + /// + /// The object has been created but Gather() has not been called. + /// + new, + /// + /// Gather() has been called, and the RTCIceGatherer is in the process + /// of gathering candidates (which includes adding new candidates and + /// removing invalidated candidates). + /// + gathering, + /// + /// The RTCIceGatherer has completed gathering. Events such as adding, + /// updating or removing an interface, or adding, changing or removing a + /// TURN server will cause the state to go back to gathering before + /// re-entering "complete" once all candidate changes are finalized. + /// + complete, + /// + /// The RTCIceGatherer has been closed intentionally (by calling + /// Close()) or as the result of an error. + /// + closed, + }; + + /// + /// RTCIceGatherFilterPolicy represents the detailed gatherer filter + /// options to restrict ICE candidate discovery. + /// + enum RTCIceGatherFilterPolicy : uint64 + { + /// + /// No gatherer filtering is required. + /// + none = 0, + /// + /// Filter all IPv4 host candidates. + /// + noIPv4Host = 0x00000001, + /// + /// Filter all IPv4 server reflexive candidates. + /// + noIPv4Srflx = 0x00000002, + /// + /// Filter all IPv4 peer reflexive candidates. + /// + noIPv4Prflx = 0x00000004, + /// + /// Filter all IPv4 relay candidates. + /// + noIPv4Relay = 0x00000008, + /// + /// Filter all IPv4 private candidates. + /// See: https://en.wikipedia.org/wiki/Private_network + /// + noIPv4Private = 0x00000010, + /// + /// Filter all IPv4 candidates. + /// + noIPv4 = 0x000000FF, + /// + /// Filter all IPv6 host candidates. + /// + noIPv6Host = 0x00000100, + /// + /// Filter all IPv6 server reflexive candidates. + /// + noIPv6Srflx = 0x00000200, + /// + /// Filter all IPv6 peer reflexive candidates. + /// + noIPv6Prflx = 0x00000400, + /// + /// Filter all IPv6 relay candidates. + /// + noIPv6Relay = 0x00000800, + /// + /// Filter all IPv6 private candidates. + /// See: https://en.wikipedia.org/wiki/Private_network + /// + noIPv6Private = 0x00001000, + /// + /// Filter all IPv6 Teredo tunnel or other tunneled candidates. + /// + noIPv6Tunnel = 0x00002000, + /// + /// Filter all IPv6 permanent candidates. + /// + noIPv6Permanent = 0x00004000, + /// + /// Filter all IPv6 candidates. + /// + noIPv6 = 0x0000FF00, + /// + /// Filter all host candidates. + /// + noHost = 0x00000101, + /// + /// Filter all server reflexive candidates. + /// + noSrflx = 0x00000202, + /// + /// Filter all server peer reflexive candidates. + /// + noPrflx = 0x00000404, + /// + /// Filter all relay candidates. + /// + noRelay = 0x00000808, + /// + /// Filter all private candidates. + /// See: https://en.wikipedia.org/wiki/Private_network + /// + noPrivate = 0x00001010, + /// + /// Filter all but relay candidates. + /// + relayOnly = 0x00000707, + /// + /// Filter all candidates. + /// + noCandidates = 0x7FFFFFFF, + }; + + /// + /// Use the string form of these enums with the RTCIceInterfacePolicy + /// Interface type variable to specify per interface type policies. + /// + enum RTCIceGatherInterfaceType + { + /// + /// Applies to all unknown interface types. + /// + Unknown, + /// + /// Applies to all interface types where there is no specific interface + /// type policy was specified. + /// + Default, + /// + /// Applies to all Local Area Network interface types. + /// + Lan, + /// + /// Applies to all Tunnel interface types. + /// + Tunnel, + /// + /// Applies to all Wireless Local Area Network interface types. + /// + Wlan, + /// + /// Applies to all Wireless Wide Area Network interface types. + /// + Wwan, + /// + /// Applies to all Virtual Private Network interface types. + /// + Vpn + }; + + /// + /// RTCIceCredentialType represents the type of credential used by a TURN + /// server. + /// + enum RTCIceCredentialType + { + /// + /// The credential is a long-term authentication password. + /// + password, + /// + /// The credential is an access token. + /// + token, + }; + + /// + /// RTCIceTransportState represents the current state of the ICE + /// transport. + /// + enum RTCIceTransportState + { + /// + /// The RTCIceTransport object is waiting for remote candidates to be + /// supplied. In this state the object can respond to incoming + /// connectivity checks. + /// + new, + /// + /// The RTCIceTransport has received at least one remote candidate, and + /// a local and remote RTCIceCandidateComplete dictionary was not added + /// as the last candidate. In this state the RTCIceTransport is checking + /// candidate pairs but has not yet found a successful candidate pair, + /// or consent checks [RFC7675] have failed on a previously successful + /// candidate pair. + /// + checking, + /// + /// The RTCIceTransport has received a response to an outgoing + /// connectivity check, or has received incoming DTLS/media after a + /// successful response to an incoming connectivity check, but is still + /// checking other candidate pairs to see if there is a better + /// connection. In this state outgoing media is permitted. + /// + connected, + /// + /// A local and remote RTCIceCandidateComplete dictionary was added as + /// the last candidate to the RTCIceTransport and all appropriate + /// candidate pairs have been tested and at least one functioning + /// candidate pair has been found. + /// + completed, + /// + /// The RTCIceTransport has received at least one local and remote + /// candidate, and a local and remote RTCIceCandidateComplete dictionary + /// was not added as the last candidate, but all appropriate candidate + /// pairs thus far have been tested and failed (or consent checks + /// [RFC7675] once successful, have now failed). Other candidate pairs + /// may become available for testing as new candidates are trickled, and + /// therefore the "failed" state has not been reached. + /// + disconnected, + /// + /// A local and remote RTCIceCandidateComplete dictionary was added as + /// the last candidate to the RTCIceTransport and all appropriate + /// candidate pairs have been tested and failed. + /// + failed, + /// + /// The RTCIceTransport has shut down and is no longer responding to + /// STUN requests. + /// + closed, + }; + + /// + /// RTCDtlsTransportState indicates the state of the DTLS transport. + /// + enum RTCDtlsTransportState + { + /// + /// The RTCDtlsTransport object has been created and has not started + /// negotiating yet. + /// + new, + /// + /// DTLS is in the process of negotiating a secure connection and + /// verifying the remote fingerprint. Once a secure connection is + /// negotiated (but prior to verification of the remote fingerprint, + /// enabled by calling start()), incoming data can flow through (and + /// media, once DTLS-SRTP key derivation is completed). + /// + connecting, + /// + /// DTLS has completed negotiation of a secure connection but the + /// fingerprint has not been verified. + /// + connected, + /// + /// The DTLS connection has been closed intentionally via a call to + /// Stop() or receipt of a close_notify alert. Calling transport.Stop() + /// will also result in a transition to the "closed" state. + /// + closed, + /// + /// The DTLS connection has been closed as the result of an error + /// (such as receipt of an error alert or a failure to validate the + /// remote fingerprint). + /// + failed, + }; + + /// + /// RTCDtlsRole indicates the role of the DTLS transport. + /// + enum RTCDtlsRole + { + /// + /// The DTLS role is determined based on the resolved ICE role: the + /// "Controlled" role acts as the DTLS client, the "Controlling" role + /// acts as the DTLS server. Since RTCDtlsRole is initialized to "Auto" + /// on construction of an RTCDtlsTransport object, + /// transport.GetLocalParameters().RTCDtlsRole will have an initial + /// value of "Auto". + /// + auto, + /// + /// The DTLS client role. A transition to "Client" will occur if + /// Start(remoteParameters) is called with remoteParameters.RTCDtlsRole + /// having a value of "Server". If RTCDtlsRole had previously had a + /// value of "Server" (e.g. due to the RTCDtlsTransport having + /// previously received packets from a DTLS client), then the DTLS + /// session is reset prior to transitioning to the "client" role. + /// + client, + /// + /// The DTLS server role. If RTCDtlsRole has a value of "Auto" and the + /// RTCDtlsTransport receives a DTLS client_hello packet, RTCDtlsRole + /// will transition to "Server", even before start() is called. A + /// transition from "Auto" to "Server" will also occur if + /// Start(remoteParameters) is called with remoteParameters.RTCDtlsRole + /// having a value of "Client". + /// + server, + }; + + /// + /// RTCStatsType object is initialized to the name of the dictionary that + /// the RTCStats represents. + /// + enum RTCStatsType + { + /// + /// Statistics for the inbound RTP stream that is currently received + /// with this RTCRtpReceiver object. It is accessed by the + /// RTCInboundRtpStreamStats. + /// + inboundRtp, + /// + /// Statistics for the outbound RTP stream that is currently sent with + /// this RTCRtpSender object. It is accessed by the + /// RTCOutboundRtpStreamStats. + /// + outboundRtp, + /// + /// Codec information for the RTCRtpReceiver or RTCRtpSender objects. It + /// is accessed by the RTCCodec. + /// + codec, + /// + /// Statistics for the RTCSctpTransport object. It is accessed by the + /// RTCSctpTransportStats. + /// + sctpTransport, + /// + /// Statistics for the RTCDataChannel object. It is accessed by the + /// RTCDataChannelStats. + /// + dataChannel, + /// + /// Statistics for the RTCMediaStream object. It is accessed by the + /// RTCMediaStreamStats. + /// + stream, + /// + /// Statistics for the RTCMediaStreamTrack object. It is accessed by the + /// RTCMediaStreamTrackStats. + /// + track, + /// + /// Statistics for the RTCIceGatherer object. It is accessed by the + /// RTCIceGathererStats. + /// + iceGatherer, + /// + /// Statistics for the RTCIceTransport object. It is accessed by the + /// RTCIceTransportStats. + /// + iceTransport, + /// + /// Statistics for the RTCDtlsTransport object. It is accessed by the + /// RTCDtlsTransportStats. + /// + dtlsTransport, + /// + /// Statistics for the RTCSrtpTransport object. It is accessed by the + /// RTCSrtpTransportStats. + /// + srtpTransport, + /// + /// Statistics for the RTCCertificate object. It is accessed by the + /// RTCCertificateStats. + /// + certificate, + /// + /// Statistics for the RTCIceGatherer or RTCIceTransport object. It is + /// accessed by the RTCIceCandidateAttributes. + /// + candidate, + /// + /// Statistics for the RTCIceCandidate object from the RTCIceGatherer + /// object. It is accessed by the RTCIceCandidatePairStats. + /// + candidatePair, + /// + /// Statistics for the local RTCIceCandidate from the RTCIceTransport + /// object. It is accessed by the RTCIceCandidateAttributes. + /// + localCandidate, + /// + /// Statistics for the remote RTCIceCandidate from the RTCIceTransport + /// object. It is accessed by the RTCIceCandidateAttributes. + /// + remoteCandidate, + }; + + /// + /// Candidate pair state is defined in Section 5.7.4 of [RFC5245]. + /// + enum RTCIceCandidatePairState + { + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + frozen, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + waiting, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + inProgress, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + failed, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + succeeded, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + cancelled, + }; + + /// + /// The kind attribute must represent either an audio or video track. + /// + enum MediaStreamTrackKind + { + /// + /// This object represents an audio track. + /// + audio, + /// + /// This object represents an video track. + /// + video + }; + + /// + /// The state attribute represents the state of the track. + /// + enum MediaStreamTrackState + { + /// + /// The track is active (the track's underlying media source is making a + /// best-effort attempt to provide data in real time). + /// + /// The output of a track in the live state can be switched on and off + /// with the enabled attribute. + /// + live, + /// + /// The track has ended (the track's underlying media source is no longer + /// providing data, and will never provide more data for this track). + /// Once a track enters this state, it never exits it. + /// + /// For example, a video track ends when the user unplugs the USB web + /// camera that acts as the track's media source. + /// + ended, + }; + + /// + /// Facing mode enum (as string) to be used in facing mode of the media stream track settings. + /// + enum VideoFacingMode + { + /// + /// The source is facing toward the user (a self-view camera). + /// + user, + /// + /// The source is facing away from the user (viewing the environment). + /// + environment, + /// + /// The source is facing to the left of the user. + /// + left, + /// + /// The source is facing to the right of the user. + /// + right, + }; + + /// + /// The type of the source of the MediaStreamTrack. + /// + enum SourceType + { + /// + /// A valid source type only for video MediaStreamTrack s. The source is + /// a local video-producing camera source. + /// + Camera, + /// + /// A valid source type only for audio MediaStreamTrack s. The source is + /// a local audio-producing microphone source. + /// + Microphone, + }; + + /// + /// Describes the kind of the represented device. + /// + enum MediaDeviceKind + { + /// + /// Represents an audio input device; for example a microphone. + /// + audioInput, + /// + /// Represents an audio output device; for example a pair of headphones. + /// + audioOutput, + /// + /// Represents a video input device; for example a webcam. + /// + videoInput, + }; + + + /// + /// RTCRtpDegradationPreference can be used to indicate the desired choice + /// between degrading resolution and degrading framerate when bandwidth is + /// constrained. + /// + enum RTCRtpDegradationPreference + { + /// + /// Degrade resolution in order to maintain framerate. + /// + maintainFramerate, + /// + /// Degrade framerate in order to maintain resolution. + /// + maintainResolution, + /// + /// Degrade a balance of framerate and resolution. + /// + balanced, + }; + + /// + /// RTCPriorityType can be used to indicate the relative priority of + /// various flows. + /// + enum RTCRtpPriorityType + { + /// + /// See [draft-ietf-rtcweb-transports], Section 4. + /// + veryLow, + /// + /// See [draft-ietf-rtcweb-transports], Section 4. + /// + low, + /// + /// See [draft-ietf-rtcweb-transports], Section 4. + /// + medium, + /// + /// See [draft-ietf-rtcweb-transports], Section 4. + /// + high, + }; + + /// + /// Configures the type of signal being encoded. + /// + enum RTCRtpOpusCodecCapabilityOptionsSignal + { + /// + /// (default) + /// + auto, + /// + /// Bias thresholds towards choosing MDCT modes. + /// + music, + /// + /// Bias thresholds towards choosing LPC or Hybrid modes. + /// + voice, + }; + + + /// + /// Opus coding mode. + /// + enum RTCRtpOpusCodecCapabilityOptionsApplication + { + /// + /// Gives best quality at a given bitrate for voice signals. + /// + voip, + /// + /// Gives best quality at a given bitrate for most non-voice signals + /// like music. + /// + audio, + /// + /// Configures low-delay mode that disables the speech-optimized mode in + /// exchange for slightly reduced delay. + /// + lowDelay, + }; + + /// + /// The type of protection for FlexFEC. See https://tools.ietf.org/html/draft-ietf-payload-flexible-fec-scheme-03 + /// for more details. + /// + enum RTCRtpFlexFecCodecCapabilityParametersToP + { + /// + /// 1-D interleaved FEC protection. + /// + n1DInterleavedFEC = 0, + /// + /// 1 for 1-D non-interleaved FEC protection. + /// + n1DNonInterleavedFEC = 1, + /// + /// 2 for 2-D parity FEC protection. + /// + n2DParityFEEC = 2, + /// + /// The value of 3 is reserved for future use. + /// + reserved = 3, + }; + + } +} diff --git a/ortc/idl/error.idl b/ortc/idl/error.idl new file mode 100644 index 00000000..b93c14b0 --- /dev/null +++ b/ortc/idl/error.idl @@ -0,0 +1,74 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace ortc + { + /// + /// This object represents generic error information. + /// + [dictionary] + struct Error + { + /// + /// Gets or sets a string representing the error code (see HTTP + /// status codes). + /// + uint16 errorCode; + /// + /// Gets or sets a string representing one of the error typename. + /// + string name; + /// + /// Gets or sets a string representing one of the error reason. + /// + string reason; + }; + + typedef zs::PromiseRejectionReason PromiseRejectionReason; + + /// + /// This object represents the error event for event delegates. + /// + interface ErrorEvent + { + [constructor, delete] + void ErrorEvent(); + + /// + /// Gets the error information associated with this event (if any). + /// + [getter] + Error error; + }; + } +} diff --git a/ortc/idl/sources.gni b/ortc/idl/sources.gni new file mode 100644 index 00000000..b984395a --- /dev/null +++ b/ortc/idl/sources.gni @@ -0,0 +1,318 @@ +ortc_sources_cxx_glue = [ +"ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainLong.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainString.h", + "ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h", + "ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.h", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.h", + "ortc/idl/wrapper/impl_org_ortc_DoubleRange.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.h", + "ortc/idl/wrapper/impl_org_ortc_EventQueue.h", + "ortc/idl/wrapper/impl_org_ortc_EventQueue.cpp", + "ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.h", + "ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.h", + "ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_LongRange.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.h", + "ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCCodec.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceServer.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.h", + "ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceServer.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaDevices.h", + "ortc/idl/wrapper/impl_org_ortc_LongRange.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.h", + "ortc/idl/wrapper/impl_org_ortc_ErrorEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentity.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.h", + "ortc/idl/wrapper/impl_org_ortc_Helper.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_StringOrStringList.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainString.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.h", + "ortc/idl/wrapper/impl_org_ortc_MediaDevices.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_Settings.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_Json.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaControl.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.cpp", + "ortc/idl/wrapper/impl_org_ortc_Error.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaControl.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.h", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.h", + "ortc/idl/wrapper/impl_org_ortc_Logger.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.h", + "ortc/idl/wrapper/impl_org_ortc_RTCStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.cpp", + "ortc/idl/wrapper/impl_org_ortc_Error.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCCertificate.h", + "ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.cpp", + "ortc/idl/wrapper/impl_org_ortc_Logger.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.h", + "ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_Json.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCCertificate.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.h", + "ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaSource.h", + "ortc/idl/wrapper/impl_org_ortc_Helper.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainLong.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.cpp", + "ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.h", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.h", + "ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.h", + "ortc/idl/wrapper/impl_org_ortc_MediaSource.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.cpp", + "ortc/idl/wrapper/impl_org_ortc_OrtcLib.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_StringOrStringList.cpp", + "ortc/idl/wrapper/impl_org_ortc_OrtcLib.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.cpp", + "ortc/idl/wrapper/impl_org_ortc_ErrorEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.h", + "ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.h", + "ortc/idl/wrapper/impl_org_ortc_DoubleRange.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.h", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.h", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.h", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCStats.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCCodec.h", + "ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_Settings.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp", + "ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.cpp", + "ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h", + "ortc/idl/wrapper/types.h", + "ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.h", + "ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.cpp", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentity.h", + "ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.h", + "ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.h", + "ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h", +] \ No newline at end of file diff --git a/ortc/idl/winuwp.json b/ortc/idl/winuwp.json new file mode 100644 index 00000000..1c69fbf2 --- /dev/null +++ b/ortc/idl/winuwp.json @@ -0,0 +1,9 @@ +{ + "project": { + "exclusives": { + "exclusive": [ + "WINUWP" + ] + } + } +} diff --git a/ortc/idl/wrapper/impl_org_ortc.cpp b/ortc/idl/wrapper/impl_org_ortc.cpp new file mode 100644 index 00000000..251b0176 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc.cpp @@ -0,0 +1,5 @@ + +#include + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_wrapper); } } } } +namespace wrapper { namespace impl { namespace org { namespace ortc { namespace adapter { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_wrapper_adapter); } } } } } diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.cpp new file mode 100644 index 00000000..dfa42701 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.cpp @@ -0,0 +1,117 @@ + +#include "impl_org_ortc_ConstrainBoolean.h" +#include "impl_org_ortc_ConstrainBooleanParameters.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBoolean::ConstrainBoolean() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainBooleanPtr wrapper::org::ortc::ConstrainBoolean::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBoolean::~ConstrainBoolean() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainBoolean::wrapper_init_org_ortc_ConstrainBoolean() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainBoolean::wrapper_init_org_ortc_ConstrainBoolean(wrapper::org::ortc::ConstrainBooleanPtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::ConstrainBooleanPtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainBoolean::wrapper_init_org_ortc_ConstrainBoolean(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::ConstrainBooleanPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainBooleanPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainBoolean::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainBoolean")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainBoolean::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanPtr wrapper::impl::org::ortc::ConstrainBoolean::toWrapper(NativeConstrainBooleanPtr native) noexcept +{ + if (!native) return ConstrainBooleanPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanPtr wrapper::impl::org::ortc::ConstrainBoolean::toWrapper(const NativeConstrainBoolean &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->value = native.mValue; + if (native.mParameters.hasValue()) { + pThis->parameters = ConstrainBooleanParameters::toWrapper(native.mParameters.value()); + } + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBoolean::NativeConstrainBooleanPtr wrapper::impl::org::ortc::ConstrainBoolean::toNative(wrapper::org::ortc::ConstrainBooleanPtr wrapper) noexcept +{ + auto result = make_shared(); + + result->mValue = wrapper->value; + if (wrapper->parameters.hasValue()) { + if (wrapper->parameters.value()) { + result->mParameters = *ConstrainBooleanParameters::toNative(wrapper->parameters.value()); + } + } + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.h new file mode 100644 index 00000000..c85e2cbb --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainBoolean.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainBoolean.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainBoolean : public wrapper::org::ortc::ConstrainBoolean + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::ConstrainBoolean, NativeConstrainBoolean); + + ConstrainBooleanWeakPtr thisWeak_; + + ConstrainBoolean() noexcept; + virtual ~ConstrainBoolean() noexcept; + + // methods ConstrainBoolean + void wrapper_init_org_ortc_ConstrainBoolean() noexcept override; + void wrapper_init_org_ortc_ConstrainBoolean(wrapper::org::ortc::ConstrainBooleanPtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainBoolean(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainBooleanPtr toWrapper(NativeConstrainBooleanPtr native) noexcept; + static ConstrainBooleanPtr toWrapper(const NativeConstrainBoolean &native) noexcept; + static NativeConstrainBooleanPtr toNative(wrapper::org::ortc::ConstrainBooleanPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.cpp new file mode 100644 index 00000000..5e69339d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.cpp @@ -0,0 +1,111 @@ + +#include "impl_org_ortc_ConstrainBooleanParameters.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanParameters::ConstrainBooleanParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainBooleanParametersPtr wrapper::org::ortc::ConstrainBooleanParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanParameters::~ConstrainBooleanParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainBooleanParameters::wrapper_init_org_ortc_ConstrainBooleanParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainBooleanParameters::wrapper_init_org_ortc_ConstrainBooleanParameters(wrapper::org::ortc::ConstrainBooleanParametersPtr source) noexcept +{ + if (!source) return; + wrapper::org::ortc::ConstrainBooleanParametersPtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainBooleanParameters::wrapper_init_org_ortc_ConstrainBooleanParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::ConstrainBooleanParametersPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainBooleanParametersPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainBooleanParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainBooleanParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainBooleanParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanParametersPtr wrapper::impl::org::ortc::ConstrainBooleanParameters::toWrapper(NativeConstrainBooleanParametersPtr native) noexcept +{ + if (!native) return ConstrainBooleanParametersPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanParametersPtr wrapper::impl::org::ortc::ConstrainBooleanParameters::toWrapper(const NativeConstrainBooleanParameters &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->exact = native.mExact; + pThis->ideal = native.mIdeal; + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainBooleanParameters::NativeConstrainBooleanParametersPtr wrapper::impl::org::ortc::ConstrainBooleanParameters::toNative(wrapper::org::ortc::ConstrainBooleanParametersPtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainBooleanParametersPtr(); + + auto result = make_shared(); + + result->mExact = wrapper->exact; + result->mIdeal = wrapper->ideal; + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.h new file mode 100644 index 00000000..e475199f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainBooleanParameters.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainBooleanParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainBooleanParameters : public wrapper::org::ortc::ConstrainBooleanParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::ConstrainBooleanParameters, NativeConstrainBooleanParameters); + + ConstrainBooleanParametersWeakPtr thisWeak_; + + ConstrainBooleanParameters() noexcept; + virtual ~ConstrainBooleanParameters() noexcept; + + // methods ConstrainBooleanParameters + void wrapper_init_org_ortc_ConstrainBooleanParameters() noexcept override; + void wrapper_init_org_ortc_ConstrainBooleanParameters(wrapper::org::ortc::ConstrainBooleanParametersPtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainBooleanParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainBooleanParametersPtr toWrapper(NativeConstrainBooleanParametersPtr native) noexcept; + static ConstrainBooleanParametersPtr toWrapper(const NativeConstrainBooleanParameters &native) noexcept; + static NativeConstrainBooleanParametersPtr toNative(wrapper::org::ortc::ConstrainBooleanParametersPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.cpp new file mode 100644 index 00000000..2357505a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_ortc_ConstrainDouble.h" +#include "impl_org_ortc_ConstrainDoubleRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDouble::ConstrainDouble() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainDoublePtr wrapper::org::ortc::ConstrainDouble::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDouble::~ConstrainDouble() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainDouble::wrapper_init_org_ortc_ConstrainDouble() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainDouble::wrapper_init_org_ortc_ConstrainDouble(wrapper::org::ortc::ConstrainDoublePtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::ConstrainDoublePtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainDouble::wrapper_init_org_ortc_ConstrainDouble(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + wrapper::org::ortc::ConstrainDoublePtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainDoublePtr pThis = thisWeak_.lock(); + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainDouble::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainDouble")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainDouble::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoublePtr wrapper::impl::org::ortc::ConstrainDouble::toWrapper(NativeConstrainDoublePtr native) noexcept +{ + if (!native) return ConstrainDoublePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoublePtr wrapper::impl::org::ortc::ConstrainDouble::toWrapper(const NativeConstrainDouble &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->value = native.mValue; + if (native.mRange.hasValue()) { + pThis->range = ConstrainDoubleRange::toWrapper(native.mRange.value()); + } + + pThis->wrapper_init_org_ortc_ConstrainDouble(); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDouble::NativeConstrainDoublePtr wrapper::impl::org::ortc::ConstrainDouble::toNative(wrapper::org::ortc::ConstrainDoublePtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainDoublePtr(); + + auto result = make_shared(); + result->mValue = wrapper->value; + if (wrapper->range.hasValue()) { + auto native = ConstrainDoubleRange::toNative(wrapper->range.value()); + if (native) { + result->mRange = *native; + } + } + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.h new file mode 100644 index 00000000..ca547943 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainDouble.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainDouble.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainDouble : public wrapper::org::ortc::ConstrainDouble + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::ConstrainDouble, NativeConstrainDouble); + + ConstrainDoubleWeakPtr thisWeak_; + + ConstrainDouble() noexcept; + virtual ~ConstrainDouble() noexcept; + + // methods ConstrainDouble + void wrapper_init_org_ortc_ConstrainDouble() noexcept override; + void wrapper_init_org_ortc_ConstrainDouble(wrapper::org::ortc::ConstrainDoublePtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainDouble(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainDoublePtr toWrapper(NativeConstrainDoublePtr native) noexcept; + static ConstrainDoublePtr toWrapper(const NativeConstrainDouble &native) noexcept; + static NativeConstrainDoublePtr toNative(wrapper::org::ortc::ConstrainDoublePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.cpp new file mode 100644 index 00000000..be999c7b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.cpp @@ -0,0 +1,118 @@ + +#include "impl_org_ortc_ConstrainDoubleRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoubleRange::ConstrainDoubleRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainDoubleRangePtr wrapper::org::ortc::ConstrainDoubleRange::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoubleRange::~ConstrainDoubleRange() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainDoubleRange::wrapper_init_org_ortc_ConstrainDoubleRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainDoubleRange::wrapper_init_org_ortc_ConstrainDoubleRange(wrapper::org::ortc::ConstrainDoubleRangePtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::ConstrainDoubleRangePtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainDoubleRange::wrapper_init_org_ortc_ConstrainDoubleRange(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::ConstrainDoubleRangePtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainDoubleRangePtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainDoubleRange::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainDoubleRange")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainDoubleRange::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoubleRangePtr wrapper::impl::org::ortc::ConstrainDoubleRange::toWrapper(NativeConstrainDoubleRangePtr native) noexcept +{ + if (!native) return ConstrainDoubleRangePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoubleRangePtr wrapper::impl::org::ortc::ConstrainDoubleRange::toWrapper(const NativeConstrainDoubleRange &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->min = native.mMin; + pThis->max = native.mMax; + pThis->exact = native.mExact; + pThis->ideal = native.mIdeal; + + pThis->wrapper_init_org_ortc_ConstrainDoubleRange(); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainDoubleRange::NativeConstrainDoubleRangePtr wrapper::impl::org::ortc::ConstrainDoubleRange::toNative(wrapper::org::ortc::ConstrainDoubleRangePtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainDoubleRangePtr(); + + auto native = make_shared(); + native->mMin = wrapper->min; + native->mMax = wrapper->max; + native->mExact = wrapper->exact; + native->mIdeal = wrapper->ideal; + + return native; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.h new file mode 100644 index 00000000..a2ad8811 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainDoubleRange.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainDoubleRange.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainDoubleRange : public wrapper::org::ortc::ConstrainDoubleRange + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::ConstrainDoubleRange, NativeConstrainDoubleRange); + ConstrainDoubleRangeWeakPtr thisWeak_; + + ConstrainDoubleRange() noexcept; + virtual ~ConstrainDoubleRange() noexcept; + + // methods ConstrainDoubleRange + void wrapper_init_org_ortc_ConstrainDoubleRange() noexcept override; + void wrapper_init_org_ortc_ConstrainDoubleRange(wrapper::org::ortc::ConstrainDoubleRangePtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainDoubleRange(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainDoubleRangePtr toWrapper(NativeConstrainDoubleRangePtr native) noexcept; + static ConstrainDoubleRangePtr toWrapper(const NativeConstrainDoubleRange &native) noexcept; + static NativeConstrainDoubleRangePtr toNative(wrapper::org::ortc::ConstrainDoubleRangePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainLong.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainLong.cpp new file mode 100644 index 00000000..ad6ede05 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainLong.cpp @@ -0,0 +1,119 @@ + +#include "impl_org_ortc_ConstrainLong.h" +#include "impl_org_ortc_ConstrainLongRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLong::ConstrainLong() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainLongPtr wrapper::org::ortc::ConstrainLong::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLong::~ConstrainLong() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainLong::wrapper_init_org_ortc_ConstrainLong() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainLong::wrapper_init_org_ortc_ConstrainLong(wrapper::org::ortc::ConstrainLongPtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::ConstrainLongPtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainLong::wrapper_init_org_ortc_ConstrainLong(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + wrapper::org::ortc::ConstrainLongPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainLongPtr pThis = thisWeak_.lock(); + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainLong::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainLong")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainLong::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongPtr wrapper::impl::org::ortc::ConstrainLong::toWrapper(NativeConstrainLongPtr native) noexcept +{ + if (!native) return ConstrainLongPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongPtr wrapper::impl::org::ortc::ConstrainLong::toWrapper(const NativeConstrainLong &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->value = native.mValue; + if (native.mRange.hasValue()) { + pThis->range = ConstrainLongRange::toWrapper(native.mRange.value()); + } + + pThis->wrapper_init_org_ortc_ConstrainLong(); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLong::NativeConstrainLongPtr wrapper::impl::org::ortc::ConstrainLong::toNative(wrapper::org::ortc::ConstrainLongPtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainLongPtr(); + + auto result = make_shared(); + result->mValue = wrapper->value; + if (wrapper->range.hasValue()) { + auto native = ConstrainLongRange::toNative(wrapper->range.value()); + if (native) { + result->mRange = *native; + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainLong.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainLong.h new file mode 100644 index 00000000..b31563a7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainLong.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainLong.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainLong : public wrapper::org::ortc::ConstrainLong + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::ConstrainLong, NativeConstrainLong); + + ConstrainLongWeakPtr thisWeak_; + + ConstrainLong() noexcept; + virtual ~ConstrainLong() noexcept; + + // methods ConstrainLong + void wrapper_init_org_ortc_ConstrainLong() noexcept override; + void wrapper_init_org_ortc_ConstrainLong(wrapper::org::ortc::ConstrainLongPtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainLong(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainLongPtr toWrapper(NativeConstrainLongPtr native) noexcept; + static ConstrainLongPtr toWrapper(const NativeConstrainLong &native) noexcept; + static NativeConstrainLongPtr toNative(wrapper::org::ortc::ConstrainLongPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.cpp new file mode 100644 index 00000000..b3a0c795 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.cpp @@ -0,0 +1,117 @@ + +#include "impl_org_ortc_ConstrainLongRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongRange::ConstrainLongRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainLongRangePtr wrapper::org::ortc::ConstrainLongRange::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongRange::~ConstrainLongRange() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainLongRange::wrapper_init_org_ortc_ConstrainLongRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainLongRange::wrapper_init_org_ortc_ConstrainLongRange(wrapper::org::ortc::ConstrainLongRangePtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::ConstrainLongRangePtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainLongRange::wrapper_init_org_ortc_ConstrainLongRange(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::ConstrainLongRangePtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainLongRangePtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainLongRange::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainLongRange")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainLongRange::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongRangePtr wrapper::impl::org::ortc::ConstrainLongRange::toWrapper(NativeConstrainLongRangePtr native) noexcept +{ + if (!native) return ConstrainLongRangePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongRangePtr wrapper::impl::org::ortc::ConstrainLongRange::toWrapper(const NativeConstrainLongRange &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->min = native.mMin; + pThis->max = native.mMax; + pThis->exact = native.mExact; + pThis->ideal = native.mIdeal; + + pThis->wrapper_init_org_ortc_ConstrainLongRange(); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainLongRange::NativeConstrainLongRangePtr wrapper::impl::org::ortc::ConstrainLongRange::toNative(wrapper::org::ortc::ConstrainLongRangePtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainLongRangePtr(); + + auto native = make_shared(); + native->mMin = wrapper->min; + native->mMax = wrapper->max; + native->mExact = wrapper->exact; + native->mIdeal = wrapper->ideal; + + return native; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.h new file mode 100644 index 00000000..7ed8578e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainLongRange.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainLongRange.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainLongRange : public wrapper::org::ortc::ConstrainLongRange + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::ConstrainLongRange, NativeConstrainLongRange); + + ConstrainLongRangeWeakPtr thisWeak_; + + ConstrainLongRange() noexcept; + virtual ~ConstrainLongRange() noexcept; + + // methods ConstrainLongRange + void wrapper_init_org_ortc_ConstrainLongRange() noexcept override; + void wrapper_init_org_ortc_ConstrainLongRange(wrapper::org::ortc::ConstrainLongRangePtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainLongRange(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainLongRangePtr toWrapper(NativeConstrainLongRangePtr native) noexcept; + static ConstrainLongRangePtr toWrapper(const NativeConstrainLongRange &native) noexcept; + static NativeConstrainLongRangePtr toNative(wrapper::org::ortc::ConstrainLongRangePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainString.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainString.cpp new file mode 100644 index 00000000..a62f5055 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainString.cpp @@ -0,0 +1,126 @@ + +#include "impl_org_ortc_ConstrainString.h" +#include "impl_org_ortc_StringOrStringList.h" +#include "impl_org_ortc_ConstrainStringParameters.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainString::ConstrainString() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainStringPtr wrapper::org::ortc::ConstrainString::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainString::~ConstrainString() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainString::wrapper_init_org_ortc_ConstrainString() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainString::wrapper_init_org_ortc_ConstrainString(wrapper::org::ortc::ConstrainStringPtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::ConstrainStringPtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainString::wrapper_init_org_ortc_ConstrainString(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + wrapper::org::ortc::ConstrainStringPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainStringPtr pThis = thisWeak_.lock(); + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainString::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainString")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainString::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringPtr wrapper::impl::org::ortc::ConstrainString::toWrapper(NativeConstrainStringPtr native) noexcept +{ + if (!native) return ConstrainStringPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringPtr wrapper::impl::org::ortc::ConstrainString::toWrapper(const NativeConstrainString &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + if (native.mValue.hasValue()) { + pThis->value = StringOrStringList::toWrapper(native.mValue.value()); + } + if (native.mParameters.hasValue()) { + pThis->parameters = ConstrainStringParameters::toWrapper(native.mParameters); + } + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainString::NativeConstrainStringPtr wrapper::impl::org::ortc::ConstrainString::toNative(wrapper::org::ortc::ConstrainStringPtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainStringPtr(); + + auto result = make_shared(); + + if (wrapper->value.hasValue()) { + if (wrapper->value.value()) { + result->mValue = *StringOrStringList::toNative(wrapper->value.value()); + } + } + if (wrapper->parameters.hasValue()) { + if (wrapper->parameters.value()) { + result->mParameters = *ConstrainStringParameters::toNative(wrapper->parameters.value()); + } + } + + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainString.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainString.h new file mode 100644 index 00000000..3ac3e481 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainString.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainString.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainString : public wrapper::org::ortc::ConstrainString + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::ConstrainString, NativeConstrainString); + + ConstrainStringWeakPtr thisWeak_; + + ConstrainString() noexcept; + virtual ~ConstrainString() noexcept; + + // methods ConstrainString + void wrapper_init_org_ortc_ConstrainString() noexcept override; + void wrapper_init_org_ortc_ConstrainString(wrapper::org::ortc::ConstrainStringPtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainString(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainStringPtr toWrapper(NativeConstrainStringPtr native) noexcept; + static ConstrainStringPtr toWrapper(const NativeConstrainString &native) noexcept; + static NativeConstrainStringPtr toNative(wrapper::org::ortc::ConstrainStringPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.cpp new file mode 100644 index 00000000..39fb3059 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.cpp @@ -0,0 +1,129 @@ + +#include "impl_org_ortc_ConstrainStringParameters.h" +#include "impl_org_ortc_StringOrStringList.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringParameters::ConstrainStringParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ConstrainStringParametersPtr wrapper::org::ortc::ConstrainStringParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringParameters::~ConstrainStringParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainStringParameters::wrapper_init_org_ortc_ConstrainStringParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainStringParameters::wrapper_init_org_ortc_ConstrainStringParameters(wrapper::org::ortc::ConstrainStringParametersPtr source) noexcept +{ + if (!source) return; + wrapper::org::ortc::ConstrainStringParametersPtr pThis = thisWeak_.lock(); + + auto native = toNative(source); + if (!native) return; + + wrapper::org::ortc::ConstrainStringParametersPtr wrapper = toWrapper(native); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::ConstrainStringParameters::wrapper_init_org_ortc_ConstrainStringParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::ConstrainStringParametersPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::ConstrainStringParametersPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::ConstrainStringParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("ConstrainStringParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::ConstrainStringParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringParametersPtr wrapper::impl::org::ortc::ConstrainStringParameters::toWrapper(NativeConstrainStringParametersPtr native) noexcept +{ + if (!native) return ConstrainStringParametersPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringParametersPtr wrapper::impl::org::ortc::ConstrainStringParameters::toWrapper(const NativeConstrainStringParameters &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + if (native.mExact.hasValue()) { + pThis->exact = StringOrStringList::toWrapper(native.mExact.value()); + } + if (native.mIdeal.hasValue()) { + pThis->ideal = StringOrStringList::toWrapper(native.mIdeal.value()); + } + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ConstrainStringParameters::NativeConstrainStringParametersPtr wrapper::impl::org::ortc::ConstrainStringParameters::toNative(wrapper::org::ortc::ConstrainStringParametersPtr wrapper) noexcept +{ + if (!wrapper) return NativeConstrainStringParametersPtr(); + + auto result = make_shared< NativeConstrainStringParameters >(); + + if (wrapper->exact.hasValue()) { + if (wrapper->exact.value()) { + result->mExact = *StringOrStringList::toNative(wrapper->exact.value()); + } + } + if (wrapper->ideal.hasValue()) { + if (wrapper->ideal.value()) { + result->mIdeal = *StringOrStringList::toNative(wrapper->ideal.value()); + } + } + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.h b/ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.h new file mode 100644 index 00000000..4053f1db --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ConstrainStringParameters.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ConstrainStringParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ConstrainStringParameters : public wrapper::org::ortc::ConstrainStringParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::ConstrainStringParameters, NativeConstrainStringParameters); + + ConstrainStringParametersWeakPtr thisWeak_; + + ConstrainStringParameters() noexcept; + virtual ~ConstrainStringParameters() noexcept; + + // methods ConstrainStringParameters + void wrapper_init_org_ortc_ConstrainStringParameters() noexcept override; + void wrapper_init_org_ortc_ConstrainStringParameters(wrapper::org::ortc::ConstrainStringParametersPtr source) noexcept override; + void wrapper_init_org_ortc_ConstrainStringParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static ConstrainStringParametersPtr toWrapper(NativeConstrainStringParametersPtr native) noexcept; + static ConstrainStringParametersPtr toWrapper(const NativeConstrainStringParameters &native) noexcept; + static NativeConstrainStringParametersPtr toNative(wrapper::org::ortc::ConstrainStringParametersPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_DoubleRange.cpp b/ortc/idl/wrapper/impl_org_ortc_DoubleRange.cpp new file mode 100644 index 00000000..7e764b42 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_DoubleRange.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_ortc_DoubleRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::DoubleRange::DoubleRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::DoubleRangePtr wrapper::org::ortc::DoubleRange::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::DoubleRange::~DoubleRange() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::DoubleRange::wrapper_init_org_ortc_DoubleRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::DoubleRange::wrapper_init_org_ortc_DoubleRange(double value) noexcept +{ + min = max = value; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::DoubleRange::wrapper_init_org_ortc_DoubleRange( + double inMin, + double inMax + ) noexcept +{ + this->min = inMin; + this->max = inMax; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::DoubleRange::wrapper_init_org_ortc_DoubleRange(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::DoubleRangePtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::DoubleRangePtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::DoubleRange::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("DoubleRange")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::DoubleRange::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::DoubleRangePtr wrapper::impl::org::ortc::DoubleRange::toWrapper(NativeCapabilityDoublePtr native) noexcept +{ + if (!native) return DoubleRangePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::DoubleRangePtr wrapper::impl::org::ortc::DoubleRange::toWrapper(const NativeCapabilityDouble &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->min = native.mMin; + pThis->max = native.mMax; + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::DoubleRange::NativeCapabilityDoublePtr wrapper::impl::org::ortc::DoubleRange::toNative(wrapper::org::ortc::DoubleRangePtr wrapper) noexcept +{ + if (!wrapper) return NativeCapabilityDoublePtr(); + + auto result = make_shared(); + + result->mMin = wrapper->min; + result->mMax = wrapper->max; + + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_DoubleRange.h b/ortc/idl/wrapper/impl_org_ortc_DoubleRange.h new file mode 100644 index 00000000..2728d8ba --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_DoubleRange.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_DoubleRange.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct DoubleRange : public wrapper::org::ortc::DoubleRange + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICapabilities::CapabilityDouble, NativeCapabilityDouble); + DoubleRangeWeakPtr thisWeak_; + + DoubleRange() noexcept; + virtual ~DoubleRange() noexcept; + + // methods DoubleRange + void wrapper_init_org_ortc_DoubleRange() noexcept override; + void wrapper_init_org_ortc_DoubleRange(double value) noexcept override; + void wrapper_init_org_ortc_DoubleRange( + double minimum, + double maximum + ) noexcept override; + void wrapper_init_org_ortc_DoubleRange(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static DoubleRangePtr toWrapper(NativeCapabilityDoublePtr native) noexcept; + static DoubleRangePtr toWrapper(const NativeCapabilityDouble &native) noexcept; + static NativeCapabilityDoublePtr toNative(wrapper::org::ortc::DoubleRangePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_Error.cpp b/ortc/idl/wrapper/impl_org_ortc_Error.cpp new file mode 100644 index 00000000..84f79d87 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Error.cpp @@ -0,0 +1,79 @@ + +#include "impl_org_ortc_Error.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::Error::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::Error::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::Error::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::Error::Error() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ErrorPtr wrapper::org::ortc::Error::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::Error::~Error() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::Error::wrapper_init_org_ortc_Error() noexcept +{ +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->errorCode = SafeInterrorCode)>(native.mErrorCode); + pThis->name = native.mName; + pThis->reason = native.mReason; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mErrorCode = SafeIntmErrorCode)>(wrapper->errorCode); + result->mName = wrapper->name; + result->mReason = wrapper->reason; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_Error.h b/ortc/idl/wrapper/impl_org_ortc_Error.h new file mode 100644 index 00000000..8281eb84 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Error.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_Error.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct Error : public wrapper::org::ortc::Error + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ErrorAny, NativeType); + ZS_DECLARE_TYPEDEF_PTR(Error, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::Error, WrapperType); + ErrorWeakPtr thisWeak_; + + Error() noexcept; + virtual ~Error() noexcept; + void wrapper_init_org_ortc_Error() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_ErrorEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_ErrorEvent.cpp new file mode 100644 index 00000000..9a50eb05 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ErrorEvent.cpp @@ -0,0 +1,71 @@ + +#include "impl_org_ortc_ErrorEvent.h" +#include "impl_org_ortc_Error.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::ErrorEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::ErrorEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ErrorEvent::ErrorEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ErrorEventPtr wrapper::org::ortc::ErrorEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::ErrorEvent::~ErrorEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::ErrorPtr wrapper::impl::org::ortc::ErrorEvent::get_error() noexcept +{ + return error_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(::ortc::ErrorAnyPtr error) noexcept +{ + if (!error) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->error_ = Error::toWrapper(error); + return pThis; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(wrapper::org::ortc::ErrorPtr error) noexcept +{ + if (!error) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->error_ = error; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_ErrorEvent.h b/ortc/idl/wrapper/impl_org_ortc_ErrorEvent.h new file mode 100644 index 00000000..af2b40dd --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_ErrorEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_ErrorEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct ErrorEvent : public wrapper::org::ortc::ErrorEvent + { + ZS_DECLARE_TYPEDEF_PTR(ErrorEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::ErrorEvent, WrapperType); + ErrorEventWeakPtr thisWeak_; + wrapper::org::ortc::ErrorPtr error_; + + ErrorEvent() noexcept; + virtual ~ErrorEvent() noexcept; + + // properties ErrorEvent + wrapper::org::ortc::ErrorPtr get_error() noexcept override; + + static WrapperImplTypePtr toWrapper(::ortc::ErrorAnyPtr error) noexcept; + static WrapperImplTypePtr toWrapper(wrapper::org::ortc::ErrorPtr error) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_EventQueue.cpp b/ortc/idl/wrapper/impl_org_ortc_EventQueue.cpp new file mode 100644 index 00000000..0bf136dc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_EventQueue.cpp @@ -0,0 +1,203 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#include +#endif //WINUWP + +#include "impl_org_ortc_EventQueue.h" + +#include + + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +namespace wrapper { namespace impl { namespace org { namespace ortc { + ZS_DECLARE_STRUCT_PTR(EventQueueWrapperAnyCx); + + struct EventQueueWrapperAnyCx : Any + { + Windows::UI::Core::CoreDispatcher^ queue_ {nullptr}; + }; +} } } } + +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +namespace wrapper { namespace impl { namespace org { namespace ortc { + ZS_DECLARE_STRUCT_PTR(EventQueueWrapperAnyCx); + + struct EventQueueWrapperAnyWinrt : Any + { + winrt::Windows::UI::Core::CoreDispatcher queue_ {nullptr}; + }; +} } } } + +#endif // CPPWINRT_VERSION + +#else + + +namespace wrapper { namespace impl { namespace org { namespace ortc { + ZS_DECLARE_STRUCT_PTR(EventQueueWrapperAny); + + struct EventQueueWrapperAny : Any + { + ::zsLib::IMessageQueuePtr queue_ {nullptr}; + }; +} } } } + +#endif //WINUWP + + +//------------------------------------------------------------------------------ +static wrapper::org::ortc::EventQueuePtr &getSingleton() noexcept +{ + static wrapper::org::ortc::EventQueuePtr singleton_ {}; + return singleton_; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::EventQueue::EventQueue() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr wrapper::org::ortc::EventQueue::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::EventQueue::~EventQueue() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr wrapper::org::ortc::EventQueue::getDefaultForUi() noexcept +{ +#ifndef WINUWP + auto result {std::make_shared()}; + auto any {std::make_shared()}; + any->queue_ = zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue(); + result->queue_ = any; + return result; +#else + return get_singleton(); +#endif //ndef WINUWP +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr wrapper::org::ortc::EventQueue::get_singleton() noexcept +{ + return getSingleton(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::EventQueue::set_singleton(wrapper::org::ortc::EventQueuePtr value) noexcept +{ + getSingleton() = value; +} + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +wrapper::org::ortc::EventQueuePtr wrapper::impl::org::ortc::EventQueue::toWrapper(Windows::UI::Core::CoreDispatcher^ queue) noexcept +{ + auto any {make_shared()}; + any->queue_ = queue; + auto result = wrapper::org::ortc::EventQueue::wrapper_create(); + result->wrapper_init_org_ortc_EventQueue(any); + return result; +} + +Windows::UI::Core::CoreDispatcher^ wrapper::impl::org::ortc::EventQueue::toNative_cx(wrapper::org::ortc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + AnyPtr any = queue->get_queue(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::ortc::EventQueueWrapperAnyCx, any); + if (!castedAny) return nullptr; + return castedAny->queue_; +} +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +wrapper::org::ortc::EventQueuePtr wrapper::impl::org::ortc::EventQueue::toWrapper(winrt::Windows::UI::Core::CoreDispatcher queue) noexcept +{ + auto any {make_shared()}; + any->queue_ = queue; + auto result = wrapper::org::ortc::EventQueue::wrapper_create(); + result->wrapper_init_org_ortc_EventQueue(any); + return result; +} + +winrt::Windows::UI::Core::CoreDispatcher wrapper::impl::org::ortc::EventQueue::toNative_winrt(wrapper::org::ortc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + AnyPtr any = queue->get_queue(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::ortc::EventQueueWrapperAnyWinrt, any); + if (!castedAny) return nullptr; + return castedAny->queue_; +} + +#endif // CPPWINRT_VERSION + +#else + +wrapper::org::ortc::EventQueuePtr wrapper::impl::org::ortc::EventQueue::toWrapper(::zsLib::IMessageQueuePtr queue) noexcept +{ + auto any {make_shared()}; + any->queue_ = queue; + auto result = wrapper::org::ortc::EventQueue::wrapper_create(); + result->wrapper_init_org_ortc_EventQueue(any); + return result; +} + +::zsLib::IMessageQueuePtr wrapper::impl::org::ortc::EventQueue::toNative(wrapper::org::ortc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + AnyPtr any = queue->get_queue(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::ortc::EventQueueWrapperAny, any); + if (!castedAny) return nullptr; + return castedAny->queue_; +} + +#endif //WINUWP diff --git a/ortc/idl/wrapper/impl_org_ortc_EventQueue.h b/ortc/idl/wrapper/impl_org_ortc_EventQueue.h new file mode 100644 index 00000000..b754e17d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_EventQueue.h @@ -0,0 +1,48 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_EventQueue.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct EventQueue : public wrapper::org::ortc::EventQueue + { + EventQueueWeakPtr thisWeak_; + + AnyPtr queue_{}; + + EventQueue() noexcept; + virtual ~EventQueue() noexcept; + + // methods EventQueue + void wrapper_init_org_ortc_EventQueue(AnyPtr queue) noexcept override { queue_ = queue; } + + // properties EventQueue + AnyPtr get_queue() noexcept override { return queue_; } + +#ifdef WINUWP +#ifdef __cplusplus_winrt + static wrapper::org::ortc::EventQueuePtr toWrapper(Windows::UI::Core::CoreDispatcher^ queue) noexcept; + static Windows::UI::Core::CoreDispatcher^ toNative_cx(wrapper::org::ortc::EventQueuePtr queue) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + static wrapper::org::ortc::EventQueuePtr toWrapper(winrt::Windows::UI::Core::CoreDispatcher queue) noexcept; + static winrt::Windows::UI::Core::CoreDispatcher toNative_winrt(wrapper::org::ortc::EventQueuePtr queue) noexcept; +#endif // CPPWINRT_VERSION +#else + static wrapper::org::ortc::EventQueuePtr toWrapper(::zsLib::IMessageQueuePtr queue) noexcept; + static ::zsLib::IMessageQueuePtr toNative(wrapper::org::ortc::EventQueuePtr queue) noexcept; +#endif //WINUWP + + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.cpp b/ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.cpp new file mode 100644 index 00000000..bd87e251 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.cpp @@ -0,0 +1,45 @@ + +#include "impl_org_ortc_EventQueue.h" +#include "impl_org_ortc_EventQueueMaker.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::EventQueueMaker::~EventQueueMaker() noexcept +{ +} + +#if 0 +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr wrapper::org::ortc::EventQueueMaker::bindQueue(AnyPtr queue) noexcept +{ + wrapper::org::ortc::EventQueuePtr result = wrapper::org::ortc::EventQueue::wrapper_create(); + result->wrapper_init_org_ortc_EventQueue(queue); + return result; +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::org::ortc::EventQueueMaker::extractQueue(wrapper::org::ortc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + return queue->get_queue(); +} +#endif //0 + + diff --git a/ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.h b/ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.h new file mode 100644 index 00000000..41011153 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_EventQueueMaker.h @@ -0,0 +1,25 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_ortc_EventQueueMaker.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct EventQueueMaker : public wrapper::org::ortc::EventQueueMaker + { + EventQueueMaker() noexcept = delete; + EventQueueMaker(const EventQueueMaker &) noexcept = delete; + virtual ~EventQueueMaker() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_Helper.cpp b/ortc/idl/wrapper/impl_org_ortc_Helper.cpp new file mode 100644 index 00000000..d9345271 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Helper.cpp @@ -0,0 +1,914 @@ + +#include "impl_org_ortc_Helper.h" + +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_RTCStatsTypeSet.h" +#include "impl_org_ortc_RTCStatsReport.h" +#include "impl_org_ortc_OverconstrainedError.h" +#include "impl_org_ortc_Error.h" + +#include +#include +#include + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } +namespace wrapper { namespace impl { namespace org { namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper_adapter); } } } } } + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + } // namespace adapater + + //--------------------------------------------------------------------- + zsLib::IMessageQueuePtr Helper::getGuiQueue() noexcept + { + return zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue(); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::log::Level Helper::toWrapper(zsLib::Log::Level level) noexcept + { + switch (level) + { + case zsLib::Log::Level::None: return wrapper::org::ortc::log::Level_none; + case zsLib::Log::Level::Basic: return wrapper::org::ortc::log::Level_basic; + case zsLib::Log::Level::Detail: return wrapper::org::ortc::log::Level_detail; + case zsLib::Log::Level::Debug: return wrapper::org::ortc::log::Level_debug; + case zsLib::Log::Level::Trace: return wrapper::org::ortc::log::Level_trace; + case zsLib::Log::Level::Insane: return wrapper::org::ortc::log::Level_insane; + } + ZS_ASSERT_FAIL("level is unknown"); + return toWrapper(zsLib::Log::Level_First); + } + + //--------------------------------------------------------------------- + zsLib::Log::Level Helper::toNative(wrapper::org::ortc::log::Level level) noexcept + { + switch (level) + { + case wrapper::org::ortc::log::Level_none: return zsLib::Log::Level::None; + case wrapper::org::ortc::log::Level_basic: return zsLib::Log::Level::Basic; + case wrapper::org::ortc::log::Level_detail: return zsLib::Log::Level::Detail; + case wrapper::org::ortc::log::Level_debug: return zsLib::Log::Level::Debug; + case wrapper::org::ortc::log::Level_trace: return zsLib::Log::Level::Trace; + case wrapper::org::ortc::log::Level_insane: return zsLib::Log::Level::Insane; + } + ZS_ASSERT_FAIL("level is unknown"); + return zsLib::Log::Level_First; + } + + //--------------------------------------------------------------------- + const char *Helper::toNative(wrapper::org::ortc::log::Component component) noexcept + { + const char *componentStr{}; + switch (component) { + case wrapper::org::ortc::log::Component_all: return NULL; + case wrapper::org::ortc::log::Component_zslib: componentStr = "zslib"; break; + case wrapper::org::ortc::log::Component_socket: componentStr = "zslib_socket"; break; + case wrapper::org::ortc::log::Component_eventing: componentStr = "zslib_eventing"; break; + case wrapper::org::ortc::log::Component_services: componentStr = "org_ortc_services"; break; + case wrapper::org::ortc::log::Component_dns: componentStr = "org_ortc_services_dns"; break; + case wrapper::org::ortc::log::Component_turn: componentStr = "org_ortc_services_turn"; break; + case wrapper::org::ortc::log::Component_http: componentStr = "org_ortc_services_http"; break; + case wrapper::org::ortc::log::Component_logger: componentStr = "org_ortc_services_logger"; break; + case wrapper::org::ortc::log::Component_wire: componentStr = "org_ortc_services_wire"; break; + case wrapper::org::ortc::log::Component_stun: componentStr = "org_ortc_services_stun"; break; + case wrapper::org::ortc::log::Component_ortc: componentStr = "org_ortc"; break; + case wrapper::org::ortc::log::Component_webrtc: componentStr = "org_ortc_webrtc"; break; + case wrapper::org::ortc::log::Component_dtlsTransport: componentStr = "org_ortc_dtls_transport"; break; + case wrapper::org::ortc::log::Component_iceGatherer: componentStr = "org_ortc_ice_gatherer"; break; + case wrapper::org::ortc::log::Component_iceGathererRouter: componentStr = "org_ortc_ice_gatherer_router"; break; + case wrapper::org::ortc::log::Component_iceTransport: componentStr = "org_ortc_ice_transport"; break; + case wrapper::org::ortc::log::Component_iceTransportController: componentStr = "org_ortc_ice_transport_controller"; break; + case wrapper::org::ortc::log::Component_mediaDevices: componentStr = "org_ortc_media_devices"; break; + case wrapper::org::ortc::log::Component_mediaStreamTrack: componentStr = "org_ortc_media_stream_track"; break; + case wrapper::org::ortc::log::Component_rtpRtcpPacket: componentStr = "org_ortc_rtp_rtcp_packet"; break; + case wrapper::org::ortc::log::Component_rtpListener: componentStr = "org_ortc_rtp_listener"; break; + case wrapper::org::ortc::log::Component_rtpMediaEngine: componentStr = "org_ortc_rtp_media_engine"; break; + case wrapper::org::ortc::log::Component_rtpReceiver: componentStr = "org_ortc_rtp_receiver"; break; + case wrapper::org::ortc::log::Component_rtpSender: componentStr = "org_ortc_rtp_sender"; break; + case wrapper::org::ortc::log::Component_rtpTypes: componentStr = "org_ortc_rtp_types"; break; + case wrapper::org::ortc::log::Component_sctpDataChannel: componentStr = "org_ortc_sctp_data_channel"; break; + case wrapper::org::ortc::log::Component_srtp: componentStr = "org_ortc_srtp"; break; + case wrapper::org::ortc::log::Component_stats: componentStr = "org_ortc_stats"; break; + case wrapper::org::ortc::log::Component_adapter: componentStr = "org_ortc_adapter"; break; + }; + ZS_ASSERT(componentStr); + return componentStr; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::MediaStreamTrackKind Helper::toWrapper(IMediaStreamTrackTypes::Kinds kind) noexcept + { + switch (kind) + { + case IMediaStreamTrackTypes::Kind_Audio: return wrapper::org::ortc::MediaStreamTrackKind::MediaStreamTrackKind_audio; + case IMediaStreamTrackTypes::Kind_Video: return wrapper::org::ortc::MediaStreamTrackKind::MediaStreamTrackKind_video; + } + ZS_ASSERT_FAIL("kind is unknown"); + return toWrapper(IMediaStreamTrackTypes::Kind_First); + } + + //--------------------------------------------------------------------- + ::ortc::IMediaStreamTrackTypes::Kinds Helper::toNative(wrapper::org::ortc::MediaStreamTrackKind kind) noexcept + { + switch (kind) + { + case wrapper::org::ortc::MediaStreamTrackKind::MediaStreamTrackKind_audio: return IMediaStreamTrackTypes::Kind_Audio; + case wrapper::org::ortc::MediaStreamTrackKind::MediaStreamTrackKind_video: return IMediaStreamTrackTypes::Kind_Video; + } + ZS_ASSERT_FAIL("kind is unknown"); + return IMediaStreamTrackTypes::Kind_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::MediaStreamTrackState Helper::toWrapper(IMediaStreamTrackTypes::States state) noexcept + { + switch (state) + { + case IMediaStreamTrackTypes::State_Live: return wrapper::org::ortc::MediaStreamTrackState::MediaStreamTrackState_live; + case IMediaStreamTrackTypes::State_Ended: return wrapper::org::ortc::MediaStreamTrackState::MediaStreamTrackState_ended; + } + ZS_ASSERT_FAIL("state is unknown"); + return wrapper::org::ortc::MediaStreamTrackState::MediaStreamTrackState_ended; + } + + //--------------------------------------------------------------------- + ::ortc::IMediaDevicesTypes::DeviceKinds Helper::toNative(wrapper::org::ortc::MediaDeviceKind kind) noexcept + { + switch (kind) + { + case wrapper::org::ortc::MediaDeviceKind_audioInput: return ::ortc::IMediaDevicesTypes::DeviceKind_AudioInput; + case wrapper::org::ortc::MediaDeviceKind_audioOutput: return ::ortc::IMediaDevicesTypes::DeviceKind_AudioOutput; + case wrapper::org::ortc::MediaDeviceKind_videoInput: return ::ortc::IMediaDevicesTypes::DeviceKind_VideoInput; + } + + ZS_ASSERT_FAIL("kind is unknown"); + return ::ortc::IMediaDevicesTypes::DeviceKind_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::MediaDeviceKind Helper::toWrapper(::ortc::IMediaDevicesTypes::DeviceKinds kind) noexcept + { + switch (kind) + { + case ::ortc::IMediaDevicesTypes::DeviceKind_AudioInput: return wrapper::org::ortc::MediaDeviceKind_audioInput; + case ::ortc::IMediaDevicesTypes::DeviceKind_AudioOutput: return wrapper::org::ortc::MediaDeviceKind_audioOutput; + case ::ortc::IMediaDevicesTypes::DeviceKind_VideoInput: return wrapper::org::ortc::MediaDeviceKind_videoInput; + } + ZS_ASSERT_FAIL("kind is unknown"); + return toWrapper(::ortc::IMediaDevicesTypes::DeviceKind_First); + } + + //--------------------------------------------------------------------- + ::ortc::IStatsReportTypes::StatsTypes Helper::toNative(wrapper::org::ortc::RTCStatsType type) noexcept + { + switch (type) + { + case wrapper::org::ortc::RTCStatsType_inboundRtp: return ::ortc::IStatsReportTypes::StatsType_InboundRTP; + case wrapper::org::ortc::RTCStatsType_outboundRtp: return ::ortc::IStatsReportTypes::StatsType_OutboundRTP; + case wrapper::org::ortc::RTCStatsType_codec: return ::ortc::IStatsReportTypes::StatsType_Codec; + case wrapper::org::ortc::RTCStatsType_sctpTransport: return ::ortc::IStatsReportTypes::StatsType_SCTPTransport; + case wrapper::org::ortc::RTCStatsType_dataChannel: return ::ortc::IStatsReportTypes::StatsType_DataChannel; + case wrapper::org::ortc::RTCStatsType_stream: return ::ortc::IStatsReportTypes::StatsType_Stream; + case wrapper::org::ortc::RTCStatsType_track: return ::ortc::IStatsReportTypes::StatsType_Track; + case wrapper::org::ortc::RTCStatsType_iceGatherer: return ::ortc::IStatsReportTypes::StatsType_ICEGatherer; + case wrapper::org::ortc::RTCStatsType_iceTransport: return ::ortc::IStatsReportTypes::StatsType_ICETransport; + case wrapper::org::ortc::RTCStatsType_dtlsTransport: return ::ortc::IStatsReportTypes::StatsType_DTLSTransport; + case wrapper::org::ortc::RTCStatsType_srtpTransport: return ::ortc::IStatsReportTypes::StatsType_SRTPTransport; + case wrapper::org::ortc::RTCStatsType_certificate: return ::ortc::IStatsReportTypes::StatsType_Certificate; + case wrapper::org::ortc::RTCStatsType_candidate: return ::ortc::IStatsReportTypes::StatsType_Candidate; + case wrapper::org::ortc::RTCStatsType_candidatePair: return ::ortc::IStatsReportTypes::StatsType_CandidatePair; + case wrapper::org::ortc::RTCStatsType_localCandidate: return ::ortc::IStatsReportTypes::StatsType_LocalCandidate; + case wrapper::org::ortc::RTCStatsType_remoteCandidate: return ::ortc::IStatsReportTypes::StatsType_RemoteCandidate; + } + + ZS_ASSERT_FAIL("stats type is unknown"); + return ::ortc::IStatsReportTypes::StatsType_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCStatsType Helper::toWrapper(::ortc::IStatsReportTypes::StatsTypes type) noexcept + { + switch (type) + { + case ::ortc::IStatsReportTypes::StatsType_InboundRTP: return wrapper::org::ortc::RTCStatsType_inboundRtp; + case ::ortc::IStatsReportTypes::StatsType_OutboundRTP: return wrapper::org::ortc::RTCStatsType_outboundRtp; + case ::ortc::IStatsReportTypes::StatsType_Codec: return wrapper::org::ortc::RTCStatsType_codec; + case ::ortc::IStatsReportTypes::StatsType_SCTPTransport: return wrapper::org::ortc::RTCStatsType_sctpTransport; + case ::ortc::IStatsReportTypes::StatsType_DataChannel: return wrapper::org::ortc::RTCStatsType_dataChannel; + case ::ortc::IStatsReportTypes::StatsType_Stream: return wrapper::org::ortc::RTCStatsType_stream; + case ::ortc::IStatsReportTypes::StatsType_Track: return wrapper::org::ortc::RTCStatsType_track; + case ::ortc::IStatsReportTypes::StatsType_ICEGatherer: return wrapper::org::ortc::RTCStatsType_iceGatherer; + case ::ortc::IStatsReportTypes::StatsType_ICETransport: return wrapper::org::ortc::RTCStatsType_iceTransport; + case ::ortc::IStatsReportTypes::StatsType_DTLSTransport: return wrapper::org::ortc::RTCStatsType_dtlsTransport; + case ::ortc::IStatsReportTypes::StatsType_SRTPTransport: return wrapper::org::ortc::RTCStatsType_srtpTransport; + case ::ortc::IStatsReportTypes::StatsType_Certificate: return wrapper::org::ortc::RTCStatsType_certificate; + case ::ortc::IStatsReportTypes::StatsType_Candidate: return wrapper::org::ortc::RTCStatsType_candidate; + case ::ortc::IStatsReportTypes::StatsType_CandidatePair: return wrapper::org::ortc::RTCStatsType_candidatePair; + case ::ortc::IStatsReportTypes::StatsType_LocalCandidate: return wrapper::org::ortc::RTCStatsType_localCandidate; + case ::ortc::IStatsReportTypes::StatsType_RemoteCandidate: return wrapper::org::ortc::RTCStatsType_remoteCandidate; + } + ZS_ASSERT_FAIL("stats type is unknown"); + return toWrapper(::ortc::IStatsReportTypes::StatsType_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCSctpTransportState Helper::toWrapper(::ortc::ISCTPTransportTypes::States state) noexcept + { + switch (state) + { + case ::ortc::ISCTPTransportTypes::State_New: return wrapper::org::ortc::RTCSctpTransportState_new; + case ::ortc::ISCTPTransportTypes::State_Connecting: return wrapper::org::ortc::RTCSctpTransportState_connecting; + case ::ortc::ISCTPTransportTypes::State_Connected: return wrapper::org::ortc::RTCSctpTransportState_connected; + case ::ortc::ISCTPTransportTypes::State_Closed: return wrapper::org::ortc::RTCSctpTransportState_closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toWrapper(::ortc::ISCTPTransportTypes::State_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCDataChannelState Helper::toWrapper(::ortc::IDataChannelTypes::States state) noexcept + { + switch (state) + { + case ::ortc::IDataChannelTypes::State_Connecting: return wrapper::org::ortc::RTCDataChannelState_connecting; + case ::ortc::IDataChannelTypes::State_Open: return wrapper::org::ortc::RTCDataChannelState_open; + case ::ortc::IDataChannelTypes::State_Closing: return wrapper::org::ortc::RTCDataChannelState_closing; + case ::ortc::IDataChannelTypes::State_Closed: return wrapper::org::ortc::RTCDataChannelState_closed; + } + ZS_ASSERT_FAIL("data channel state is unknown"); + return toWrapper(::ortc::IDataChannelTypes::State_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceCandidatePairState Helper::toWrapper(::ortc::IStatsReportTypes::StatsICECandidatePairStates state) noexcept + { + switch (state) + { + case ::ortc::IStatsReportTypes::StatsICECandidatePairState_Frozen: return wrapper::org::ortc::RTCIceCandidatePairState_frozen; + case ::ortc::IStatsReportTypes::StatsICECandidatePairState_Waiting: return wrapper::org::ortc::RTCIceCandidatePairState_waiting; + case ::ortc::IStatsReportTypes::StatsICECandidatePairState_InProgress: return wrapper::org::ortc::RTCIceCandidatePairState_inProgress; + case ::ortc::IStatsReportTypes::StatsICECandidatePairState_Failed: return wrapper::org::ortc::RTCIceCandidatePairState_failed; + case ::ortc::IStatsReportTypes::StatsICECandidatePairState_Succeeded: return wrapper::org::ortc::RTCIceCandidatePairState_succeeded; + case ::ortc::IStatsReportTypes::StatsICECandidatePairState_Cancelled: return wrapper::org::ortc::RTCIceCandidatePairState_failed; + } + ZS_ASSERT_FAIL("ICE candidate pair state is unknown"); + return toWrapper(::ortc::IStatsReportTypes::StatsICECandidatePairState_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode Helper::toWrapper(::ortc::adapter::IPeerConnectionTypes::SignalingModes mode) noexcept + { + switch (mode) + { + case ::ortc::adapter::IPeerConnectionTypes::SignalingMode_JSON: return wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode_json; + case ::ortc::adapter::IPeerConnectionTypes::SignalingMode_SDP: return wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode_sdp; + } + ZS_ASSERT_FAIL("signaling mode is unknown"); + return toWrapper(::ortc::adapter::IPeerConnectionTypes::SignalingMode_First); + } + + //--------------------------------------------------------------------- + ::ortc::adapter::IPeerConnectionTypes::SignalingModes Helper::toNative(wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode mode) noexcept + { + switch (mode) + { + case wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode_json: return ::ortc::adapter::IPeerConnectionTypes::SignalingMode_JSON; + case wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode_sdp: return ::ortc::adapter::IPeerConnectionTypes::SignalingMode_SDP; + } + ZS_ASSERT_FAIL("signaling mode is unknown"); + return ::ortc::adapter::IPeerConnectionTypes::SignalingMode_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCRtcpMuxPolicy Helper::toWrapper(::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicies policy) noexcept + { + switch (policy) + { + case ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicy_Negotiated: return wrapper::org::ortc::adapter::RTCRtcpMuxPolicy_negotiated; + case ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicy_Require: return wrapper::org::ortc::adapter::RTCRtcpMuxPolicy_require; + } + ZS_ASSERT_FAIL("mux policy mode is unknown"); + return toWrapper(::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicy_First); + } + + //--------------------------------------------------------------------- + ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicies Helper::toNative(wrapper::org::ortc::adapter::RTCRtcpMuxPolicy policy) noexcept + { + switch (policy) + { + case wrapper::org::ortc::adapter::RTCRtcpMuxPolicy_negotiated: return ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicy_Negotiated; + case wrapper::org::ortc::adapter::RTCRtcpMuxPolicy_require: return ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicy_Require; + } + ZS_ASSERT_FAIL("mux policy is unknown"); + return ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicy_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCBundlePolicy Helper::toWrapper(::ortc::adapter::IPeerConnectionTypes::BundlePolicies policy) noexcept + { + switch (policy) + { + case ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_Balanced: return wrapper::org::ortc::adapter::RTCBundlePolicy_balanced; + case ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_MaxCompat: return wrapper::org::ortc::adapter::RTCBundlePolicy_maxCompat; + case ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_MaxBundle: return wrapper::org::ortc::adapter::RTCBundlePolicy_maxBundle; + } + ZS_ASSERT_FAIL("bundle policy mode is unknown"); + return toWrapper(::ortc::adapter::IPeerConnectionTypes::BundlePolicy_First); + } + + //--------------------------------------------------------------------- + ::ortc::adapter::IPeerConnectionTypes::BundlePolicies Helper::toNative(wrapper::org::ortc::adapter::RTCBundlePolicy policy) noexcept + { + switch (policy) + { + case wrapper::org::ortc::adapter::RTCBundlePolicy_balanced: return ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_Balanced; + case wrapper::org::ortc::adapter::RTCBundlePolicy_maxCompat: return ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_MaxCompat; + case wrapper::org::ortc::adapter::RTCBundlePolicy_maxBundle: return ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_MaxBundle; + } + ZS_ASSERT_FAIL("bundle policy is unknown"); + return ::ortc::adapter::IPeerConnectionTypes::BundlePolicy_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCSignalingState Helper::toWrapper(::ortc::adapter::IPeerConnectionTypes::SignalingStates state) noexcept + { + switch (state) + { + case ::ortc::adapter::IPeerConnectionTypes::SignalingState_Stable: return wrapper::org::ortc::adapter::RTCSignalingState_stable; + case ::ortc::adapter::IPeerConnectionTypes::SignalingState_HaveLocalOffer: return wrapper::org::ortc::adapter::RTCSignalingState_haveLocalOffer; + case ::ortc::adapter::IPeerConnectionTypes::SignalingState_HaveRemoteOffer: return wrapper::org::ortc::adapter::RTCSignalingState_haveRemoteOffer; + case ::ortc::adapter::IPeerConnectionTypes::SignalingState_HaveLocalPranswer: return wrapper::org::ortc::adapter::RTCSignalingState_haveLocalPranswer; + case ::ortc::adapter::IPeerConnectionTypes::SignalingState_HaveRemotePranswer: return wrapper::org::ortc::adapter::RTCSignalingState_haveRemotePranswer; + case ::ortc::adapter::IPeerConnectionTypes::SignalingState_Closed: return wrapper::org::ortc::adapter::RTCSignalingState_closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toWrapper(::ortc::adapter::IPeerConnectionTypes::SignalingState_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCIceConnectionState Helper::toPeerConnectionWrapper(::ortc::IICETransportTypes::States state) noexcept + { + switch (state) + { + case ::ortc::IICETransportTypes::State_New: return wrapper::org::ortc::adapter::RTCIceConnectionState_new; + case ::ortc::IICETransportTypes::State_Checking: return wrapper::org::ortc::adapter::RTCIceConnectionState_checking; + case ::ortc::IICETransportTypes::State_Connected: return wrapper::org::ortc::adapter::RTCIceConnectionState_connected; + case ::ortc::IICETransportTypes::State_Completed: return wrapper::org::ortc::adapter::RTCIceConnectionState_completed; + case ::ortc::IICETransportTypes::State_Disconnected: return wrapper::org::ortc::adapter::RTCIceConnectionState_disconnected; + case ::ortc::IICETransportTypes::State_Failed: return wrapper::org::ortc::adapter::RTCIceConnectionState_failed; + case ::ortc::IICETransportTypes::State_Closed: return wrapper::org::ortc::adapter::RTCIceConnectionState_closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toPeerConnectionWrapper(::ortc::IICETransportTypes::State_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCPeerConnectionState Helper::toWrapper(::ortc::adapter::IPeerConnectionTypes::PeerConnectionStates state) noexcept + { + switch (state) + { + case ::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_New: return wrapper::org::ortc::adapter::RTCPeerConnectionState_new; + case ::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_Connecting: return wrapper::org::ortc::adapter::RTCPeerConnectionState_connecting; + case ::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_Connected: return wrapper::org::ortc::adapter::RTCPeerConnectionState_connected; + case ::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_Disconnected: return wrapper::org::ortc::adapter::RTCPeerConnectionState_disconnected; + case ::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_Failed: return wrapper::org::ortc::adapter::RTCPeerConnectionState_failed; + case ::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_Closed: return wrapper::org::ortc::adapter::RTCPeerConnectionState_closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toWrapper(::ortc::adapter::IPeerConnectionTypes::PeerConnectionState_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceGatherFilterPolicy Helper::toWrapper(::ortc::IICEGathererTypes::FilterPolicies policy) noexcept + { + return static_cast(static_cast::type>(policy)); + } + + //--------------------------------------------------------------------- + ::ortc::IICEGathererTypes::FilterPolicies Helper::toNative(wrapper::org::ortc::RTCIceGatherFilterPolicy policy) noexcept + { + return static_cast<::ortc::IICEGathererTypes::FilterPolicies>(static_cast::type>(policy)); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceCredentialType Helper::toWrapper(::ortc::IICEGathererTypes::CredentialTypes type) noexcept + { + switch (type) + { + case ::ortc::IICEGathererTypes::CredentialType_Password: return wrapper::org::ortc::RTCIceCredentialType_password; + case ::ortc::IICEGathererTypes::CredentialType_Token: return wrapper::org::ortc::RTCIceCredentialType_token; + } + ZS_ASSERT_FAIL("credential type is unknown"); + return toWrapper(::ortc::IICEGathererTypes::CredentialType_First); + } + + //--------------------------------------------------------------------- + ::ortc::IICEGathererTypes::CredentialTypes Helper::toNative(wrapper::org::ortc::RTCIceCredentialType type) noexcept + { + switch (type) + { + case wrapper::org::ortc::RTCIceCredentialType_password: return ::ortc::IICEGathererTypes::CredentialType_Password; + case wrapper::org::ortc::RTCIceCredentialType_token: return ::ortc::IICEGathererTypes::CredentialType_Token; + } + ZS_ASSERT_FAIL("credential type is unknown"); + return ::ortc::IICEGathererTypes::CredentialType_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceGathererState Helper::toWrapper(::ortc::IICEGathererTypes::States state) noexcept + { + switch (state) + { + case ::ortc::IICEGathererTypes::State_New: return wrapper::org::ortc::RTCIceGathererState_new; + case ::ortc::IICEGathererTypes::State_Gathering: return wrapper::org::ortc::RTCIceGathererState_gathering; + case ::ortc::IICEGathererTypes::State_Complete: return wrapper::org::ortc::RTCIceGathererState_complete; + case ::ortc::IICEGathererTypes::State_Closed: return wrapper::org::ortc::RTCIceGathererState_closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toWrapper(::ortc::IICEGathererTypes::State_First); + } + + //--------------------------------------------------------------------- + ::ortc::IICEGathererTypes::States Helper::toNative(wrapper::org::ortc::RTCIceGathererState state) noexcept + { + switch (state) + { + case wrapper::org::ortc::RTCIceGathererState_new: return ::ortc::IICEGathererTypes::State_New; + case wrapper::org::ortc::RTCIceGathererState_gathering: return ::ortc::IICEGathererTypes::State_Gathering; + case wrapper::org::ortc::RTCIceGathererState_complete: return ::ortc::IICEGathererTypes::State_Complete; + case wrapper::org::ortc::RTCIceGathererState_closed: return ::ortc::IICEGathererTypes::State_Closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return ::ortc::IICEGathererTypes::State_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceCandidateType Helper::toWrapper(::ortc::IICETypes::CandidateTypes type) noexcept + { + switch (type) + { + case ::ortc::IICETypes::CandidateType_Host: return wrapper::org::ortc::RTCIceCandidateType_host; + case ::ortc::IICETypes::CandidateType_Srflex: return wrapper::org::ortc::RTCIceCandidateType_srflex; + case ::ortc::IICETypes::CandidateType_Prflx: return wrapper::org::ortc::RTCIceCandidateType_prflx; + case ::ortc::IICETypes::CandidateType_Relay: return wrapper::org::ortc::RTCIceCandidateType_relay; + } + ZS_ASSERT_FAIL("ice candidate type is unknown"); + return toWrapper(::ortc::IICETypes::CandidateType_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceComponent Helper::toWrapper(::ortc::IICETypes::Components component) noexcept + { + switch (component) + { + case ::ortc::IICETypes::Component_RTP: return wrapper::org::ortc::RTCIceComponent_rtp; + case ::ortc::IICETypes::Component_RTCP: return wrapper::org::ortc::RTCIceComponent_rtcp; + } + ZS_ASSERT_FAIL("component is unknown"); + return toWrapper(::ortc::IICETypes::Component_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceProtocol Helper::toWrapper(::ortc::IICETypes::Protocols protocol) noexcept + { + switch (protocol) + { + case ::ortc::IICETypes::Protocol_UDP: return wrapper::org::ortc::RTCIceProtocol_udp; + case ::ortc::IICETypes::Protocol_TCP: return wrapper::org::ortc::RTCIceProtocol_tcp; + } + ZS_ASSERT_FAIL("protocol is unknown"); + return toWrapper(::ortc::IICETypes::Protocol_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceTcpCandidateType Helper::toWrapper(::ortc::IICETypes::TCPCandidateTypes type) noexcept + { + switch (type) + { + case ::ortc::IICETypes::TCPCandidateType_Active: return wrapper::org::ortc::RTCIceTcpCandidateType_active; + case ::ortc::IICETypes::TCPCandidateType_Passive: return wrapper::org::ortc::RTCIceTcpCandidateType_passive; + case ::ortc::IICETypes::TCPCandidateType_SO: return wrapper::org::ortc::RTCIceTcpCandidateType_so; + } + ZS_ASSERT_FAIL("tcp candidate type is unknown"); + return toWrapper(::ortc::IICETypes::TCPCandidateType_First); + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceTransportState Helper::toWrapper(::ortc::IICETransportTypes::States state) noexcept + { + switch (state) + { + case ::ortc::IICETransportTypes::State_New: return wrapper::org::ortc::RTCIceTransportState_new; + case ::ortc::IICETransportTypes::State_Checking: return wrapper::org::ortc::RTCIceTransportState_checking; + case ::ortc::IICETransportTypes::State_Connected: return wrapper::org::ortc::RTCIceTransportState_connected; + case ::ortc::IICETransportTypes::State_Completed: return wrapper::org::ortc::RTCIceTransportState_completed; + case ::ortc::IICETransportTypes::State_Disconnected: return wrapper::org::ortc::RTCIceTransportState_disconnected; + case ::ortc::IICETransportTypes::State_Failed: return wrapper::org::ortc::RTCIceTransportState_failed; + case ::ortc::IICETransportTypes::State_Closed: return wrapper::org::ortc::RTCIceTransportState_closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toWrapper(::ortc::IICETransportTypes::State_First); + } + + //--------------------------------------------------------------------- + ::ortc::IICETransportTypes::States Helper::toNative(wrapper::org::ortc::RTCIceTransportState state) noexcept + { + switch (state) + { + case wrapper::org::ortc::RTCIceTransportState_new: return ::ortc::IICETransportTypes::State_New; + case wrapper::org::ortc::RTCIceTransportState_checking: return ::ortc::IICETransportTypes::State_Checking; + case wrapper::org::ortc::RTCIceTransportState_connected: return ::ortc::IICETransportTypes::State_Connected; + case wrapper::org::ortc::RTCIceTransportState_completed: return ::ortc::IICETransportTypes::State_Completed; + case wrapper::org::ortc::RTCIceTransportState_disconnected: return ::ortc::IICETransportTypes::State_Disconnected; + case wrapper::org::ortc::RTCIceTransportState_failed: return ::ortc::IICETransportTypes::State_Failed; + case wrapper::org::ortc::RTCIceTransportState_closed: return ::ortc::IICETransportTypes::State_Closed; + } + ZS_ASSERT_FAIL("state is unknown"); + return ::ortc::IICETransportTypes::State_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCIceRole Helper::toWrapper(::ortc::IICETypes::Roles role) noexcept + { + switch (role) + { + case ::ortc::IICETypes::Role_Controlling: return wrapper::org::ortc::RTCIceRole_controlling; + case ::ortc::IICETypes::Role_Controlled: return wrapper::org::ortc::RTCIceRole_controlled; + } + ZS_ASSERT_FAIL("role is unknown"); + return toWrapper(::ortc::IICETypes::Role_First); + } + + //--------------------------------------------------------------------- + ::ortc::IICETypes::Roles Helper::toNative(wrapper::org::ortc::RTCIceRole role) noexcept + { + switch (role) + { + case wrapper::org::ortc::RTCIceRole_controlling: return ::ortc::IICETypes::Role_Controlling; + case wrapper::org::ortc::RTCIceRole_controlled: return ::ortc::IICETypes::Role_Controlled; + } + ZS_ASSERT_FAIL("state is unknown"); + return ::ortc::IICETypes::Role_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal Helper::toWrapper(::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signals signal) noexcept + { + switch (signal) + { + case ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_Auto: return wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal_auto; + case ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_Music: return wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal_music; + case ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_Voice: return wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal_voice; + } + ZS_ASSERT_FAIL("signal type is unknown"); + return toWrapper(::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_First); + } + + //--------------------------------------------------------------------- + ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signals Helper::toNative(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal signal) noexcept + { + switch (signal) + { + case wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal_auto: return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_Auto; + case wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal_music: return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_Music; + case wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal_voice: return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_Voice; + } + ZS_ASSERT_FAIL("signal type is unknown"); + return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signal_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication Helper::toWrapper(::ortc::IRTPTypes::OpusCodecCapabilityOptions::Applications application) noexcept + { + switch (application) + { + case ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_VoIP: return wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication_voip; + case ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_Audio: return wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication_audio; + case ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_LowDelay: return wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication_lowDelay; + } + ZS_ASSERT_FAIL("application type is unknown"); + return toWrapper(::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_First); + } + + //--------------------------------------------------------------------- + ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Applications Helper::toNative(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication application) noexcept + { + switch (application) + { + case wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication_voip: return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_VoIP; + case wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication_audio: return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_Audio; + case wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication_lowDelay: return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_LowDelay; + } + ZS_ASSERT_FAIL("application type is unknown"); + return ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Application_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP Helper::toWrapper(::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToPs top) noexcept + { + switch (top) + { + case ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_1DInterleavedFEC: return wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_n1DInterleavedFEC; + case ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_1DNonInterleavedFEC: return wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_n1DNonInterleavedFEC; + case ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_2DParityFEEC: return wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_n2DParityFEEC; + case ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_Reserved: return wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_reserved; + } + ZS_ASSERT_FAIL("ToP is unknown"); + return toWrapper(::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_First); + } + + //--------------------------------------------------------------------- + ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToPs Helper::toNative(wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP top) noexcept + { + switch (top) + { + case wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_n1DInterleavedFEC: return ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_1DInterleavedFEC; + case wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_n1DNonInterleavedFEC: return ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_1DNonInterleavedFEC; + case wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_n2DParityFEEC: return ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_2DParityFEEC; + case wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP_reserved: return ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_Reserved; + } + ZS_ASSERT_FAIL("ToP is unknown"); + return ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToP_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCRtpDegradationPreference Helper::toWrapper(::ortc::IRTPTypes::DegradationPreferences preference) noexcept + { + switch (preference) + { + case ::ortc::IRTPTypes::DegradationPreference_MaintainFramerate: return wrapper::org::ortc::RTCRtpDegradationPreference_maintainFramerate; + case ::ortc::IRTPTypes::DegradationPreference_MaintainResolution: return wrapper::org::ortc::RTCRtpDegradationPreference_maintainResolution; + case ::ortc::IRTPTypes::DegradationPreference_Balanced: return wrapper::org::ortc::RTCRtpDegradationPreference_balanced; + } + ZS_ASSERT_FAIL("preference is unknown"); + return toWrapper(::ortc::IRTPTypes::DegradationPreference_First); + } + + //--------------------------------------------------------------------- + ::ortc::IRTPTypes::DegradationPreferences Helper::toNative(wrapper::org::ortc::RTCRtpDegradationPreference preference) noexcept + { + switch (preference) + { + case wrapper::org::ortc::RTCRtpDegradationPreference_maintainFramerate: return ::ortc::IRTPTypes::DegradationPreference_MaintainFramerate; + case wrapper::org::ortc::RTCRtpDegradationPreference_maintainResolution: return ::ortc::IRTPTypes::DegradationPreference_MaintainResolution; + case wrapper::org::ortc::RTCRtpDegradationPreference_balanced: return ::ortc::IRTPTypes::DegradationPreference_Balanced; + } + ZS_ASSERT_FAIL("preference is unknown"); + return ::ortc::IRTPTypes::DegradationPreference_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCRtpPriorityType Helper::toWrapper(::ortc::IRTPTypes::PriorityTypes type) noexcept + { + switch (type) + { + case ::ortc::IRTPTypes::PriorityType_VeryLow: return wrapper::org::ortc::RTCRtpPriorityType_veryLow; + case ::ortc::IRTPTypes::PriorityType_Low: return wrapper::org::ortc::RTCRtpPriorityType_low; + case ::ortc::IRTPTypes::PriorityType_Medium: return wrapper::org::ortc::RTCRtpPriorityType_medium; + case ::ortc::IRTPTypes::PriorityType_High: return wrapper::org::ortc::RTCRtpPriorityType_high; + } + ZS_ASSERT_FAIL("type is unknown"); + return toWrapper(::ortc::IRTPTypes::PriorityType_First); + } + + //--------------------------------------------------------------------- + ::ortc::IRTPTypes::PriorityTypes Helper::toNative(wrapper::org::ortc::RTCRtpPriorityType type) noexcept + { + switch (type) + { + case wrapper::org::ortc::RTCRtpPriorityType_veryLow: return ::ortc::IRTPTypes::PriorityType_VeryLow; + case wrapper::org::ortc::RTCRtpPriorityType_low: return ::ortc::IRTPTypes::PriorityType_Low; + case wrapper::org::ortc::RTCRtpPriorityType_medium: return ::ortc::IRTPTypes::PriorityType_Medium; + case wrapper::org::ortc::RTCRtpPriorityType_high: return ::ortc::IRTPTypes::PriorityType_High; + } + ZS_ASSERT_FAIL("type is unknown"); + return ::ortc::IRTPTypes::PriorityType_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType Helper::toWrapper(::ortc::adapter::ISessionDescriptionTypes::SignalingTypes type) noexcept + { + switch (type) + { + case ::ortc::adapter::ISessionDescriptionTypes::SignalingType_JSON: return wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_json; + case ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPOffer: return wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpOffer; + case ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPPranswer: return wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpPranswer; + case ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPAnswer: return wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpAnswer; + case ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPRollback: return wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpRollback; + } + ZS_ASSERT_FAIL("type is unknown"); + return toWrapper(::ortc::adapter::ISessionDescriptionTypes::SignalingType_First); + } + + //--------------------------------------------------------------------- + ::ortc::adapter::ISessionDescriptionTypes::SignalingTypes Helper::toNative(wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType type) noexcept + { + switch (type) + { + case wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_json: return ::ortc::adapter::ISessionDescriptionTypes::SignalingType_JSON; + case wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpOffer: return ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPOffer; + case wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpPranswer: return ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPPranswer; + case wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpAnswer: return ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPAnswer; + case wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType_sdpRollback: return ::ortc::adapter::ISessionDescriptionTypes::SignalingType_SDPRollback; + } + ZS_ASSERT_FAIL("type is unknown"); + return ::ortc::adapter::ISessionDescriptionTypes::SignalingType_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCDtlsRole Helper::toWrapper(::ortc::IDTLSTransportTypes::Roles role) noexcept + { + switch (role) + { + case ::ortc::IDTLSTransportTypes::Role_Auto: return wrapper::org::ortc::RTCDtlsRole_auto; + case ::ortc::IDTLSTransportTypes::Role_Client: return wrapper::org::ortc::RTCDtlsRole_client; + case ::ortc::IDTLSTransportTypes::Role_Server: return wrapper::org::ortc::RTCDtlsRole_server; + } + ZS_ASSERT_FAIL("role is unknown"); + return toWrapper(::ortc::IDTLSTransportTypes::Role_First); + } + + //--------------------------------------------------------------------- + ::ortc::IDTLSTransportTypes::Roles Helper::toNative(wrapper::org::ortc::RTCDtlsRole role) noexcept + { + switch (role) + { + case wrapper::org::ortc::RTCDtlsRole_auto: return ::ortc::IDTLSTransportTypes::Role_Auto; + case wrapper::org::ortc::RTCDtlsRole_client: return ::ortc::IDTLSTransportTypes::Role_Client; + case wrapper::org::ortc::RTCDtlsRole_server: return ::ortc::IDTLSTransportTypes::Role_Server; + } + ZS_ASSERT_FAIL("role is unknown"); + return ::ortc::IDTLSTransportTypes::Role_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::RTCDtlsTransportState Helper::toWrapper(::ortc::IDTLSTransportTypes::States state) noexcept + { + switch (state) + { + case ::ortc::IDTLSTransportTypes::State_New: return wrapper::org::ortc::RTCDtlsTransportState_new; + case ::ortc::IDTLSTransportTypes::State_Connecting: return wrapper::org::ortc::RTCDtlsTransportState_connecting; + case ::ortc::IDTLSTransportTypes::State_Connected: return wrapper::org::ortc::RTCDtlsTransportState_connected; + case ::ortc::IDTLSTransportTypes::State_Closed: return wrapper::org::ortc::RTCDtlsTransportState_closed; + case ::ortc::IDTLSTransportTypes::State_Failed: return wrapper::org::ortc::RTCDtlsTransportState_failed; + } + ZS_ASSERT_FAIL("state is unknown"); + return toWrapper(::ortc::IDTLSTransportTypes::State_First); + } + + //--------------------------------------------------------------------- + ::ortc::IDTLSTransportTypes::States Helper::toNative(wrapper::org::ortc::RTCDtlsTransportState state) noexcept + { + switch (state) + { + case wrapper::org::ortc::RTCDtlsTransportState_new: return ::ortc::IDTLSTransportTypes::State_New; + case wrapper::org::ortc::RTCDtlsTransportState_connecting: return ::ortc::IDTLSTransportTypes::State_Connecting; + case wrapper::org::ortc::RTCDtlsTransportState_connected: return ::ortc::IDTLSTransportTypes::State_Connected; + case wrapper::org::ortc::RTCDtlsTransportState_closed: return ::ortc::IDTLSTransportTypes::State_Closed; + case wrapper::org::ortc::RTCDtlsTransportState_failed: return ::ortc::IDTLSTransportTypes::State_Failed; + } + ZS_ASSERT_FAIL("role is unknown"); + return ::ortc::IDTLSTransportTypes::State_First; + } + + //--------------------------------------------------------------------- + wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection Helper::toWrapper(::ortc::adapter::ISessionDescriptionTypes::MediaDirections direction) noexcept + { + switch (direction) + { + case ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_SendReceive: return wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_sendReceive; + case ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_SendOnly: return wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_sendOnly; + case ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_ReceiveOnly: return wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_receiveOnly; + case ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_Inactive: return wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_inactive; + } + ZS_ASSERT_FAIL("direction is unknown"); + return toWrapper(::ortc::adapter::ISessionDescriptionTypes::MediaDirection_First); + } + + //--------------------------------------------------------------------- + ::ortc::adapter::ISessionDescriptionTypes::MediaDirections Helper::toNative(wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection direction) noexcept + { + switch (direction) + { + case wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_sendReceive: return ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_SendReceive; + case wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_sendOnly: return ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_SendOnly; + case wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_receiveOnly: return ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_ReceiveOnly; + case wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection_inactive: return ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_Inactive; + } + ZS_ASSERT_FAIL("direction is unknown"); + return ::ortc::adapter::ISessionDescriptionTypes::MediaDirection_First; + } + + //--------------------------------------------------------------------- + Helper::WrapperMediaStreamTrackListPtr Helper::toWrapper(MediaStreamTrackListPtr tracks) noexcept + { + auto result = make_shared(); + if (!tracks) return result; + for (auto iter = tracks->begin(); iter != tracks->end(); ++iter) + { + auto native = wrapper::impl::org::ortc::MediaStreamTrack::toWrapper(*iter); + if (!native) continue; + result->push_back(native); + } + return result; + } + + //--------------------------------------------------------------------- + Helper::MediaStreamTrackListPtr Helper::toNative(WrapperMediaStreamTrackListPtr tracks) noexcept + { + if (!tracks) return MediaStreamTrackListPtr(); + + MediaStreamTrackListPtr result = make_shared(); + for (auto iter = tracks->begin(); iter != tracks->end(); ++iter) + { + auto native = wrapper::impl::org::ortc::MediaStreamTrack::toNative(*iter); + if (!native) continue; + result->push_back(native); + } + return result; + } + + //--------------------------------------------------------------------- + PromisePtr Helper::toWrapper(PromisePtr promise) noexcept + { + if (!promise) return promise; + + auto result = Promise::create(getGuiQueue()); + + promise->thenClosure([promise, result] { + if (promise->isRejected()) { + reject(promise, result); + return; + } + + result->resolve(); + }); + promise->background(); + return result; + } + + //--------------------------------------------------------------------- + void Helper::reject( + PromisePtr nativePromise, + PromisePtr wrapperPromise + ) noexcept + { + { + auto reason = nativePromise->reason<::ortc::ErrorAny>(); + if (reason) { + auto wrapper = Error::toWrapper(reason); + auto holder = make_shared< AnyHolder >(); + holder->value_ = wrapper; + wrapperPromise->reject(holder); + return; + } + } + { + auto reason = nativePromise->reason<::ortc::IMediaStreamTrackTypes::OverconstrainedError>(); + if (reason) { + auto wrapper = OverconstrainedError::toWrapper(reason); + auto holder = make_shared< AnyHolder >(); + holder->value_ = wrapper; + wrapperPromise->reject(holder); + return; + } + } + wrapperPromise->reject(); + return; + } + + //--------------------------------------------------------------------- + Helper::PromiseWithStatsReportPtr Helper::getStats(IStatsProviderPtr native, wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept + { + ZS_ASSERT(native); + ZS_ASSERT(statTypes); + + auto value = wrapper::impl::org::ortc::RTCStatsTypeSet::toNative(statTypes); + ZS_ASSERT(value); + + auto promise = native->getStats(*value); + if (!promise) return PromiseWithStatsReportPtr(); + + auto result = PromiseWithStatsReport::create(); + + promise->thenClosure([result, promise]() + { + if (promise->isRejected()) + { + result->reject(); + return; + } + result->resolve(wrapper::impl::org::ortc::RTCStatsReport::toWrapper(promise->value())); + }); + promise->background(); + return result; + } + + } // namespace ortc + } // namespace org + } // namespace impl +} // namespace wrapper diff --git a/ortc/idl/wrapper/impl_org_ortc_Helper.h b/ortc/idl/wrapper/impl_org_ortc_Helper.h new file mode 100644 index 00000000..3356d703 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Helper.h @@ -0,0 +1,143 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_Json.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct Helper + { + typedef PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > PromiseWithStatsReport; + ZS_DECLARE_PTR(PromiseWithStatsReport); + + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes, IMediaStreamTrackTypes); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsProvider, IStatsProvider); + + typedef list< ::ortc::IMediaStreamTrackPtr > MediaStreamTrackList; + ZS_DECLARE_PTR(MediaStreamTrackList); + + typedef list< wrapper::org::ortc::MediaStreamTrackPtr > WrapperMediaStreamTrackList; + ZS_DECLARE_PTR(WrapperMediaStreamTrackList); + + static zsLib::IMessageQueuePtr getGuiQueue() noexcept; + + static wrapper::org::ortc::log::Level toWrapper(zsLib::Log::Level level) noexcept; + static zsLib::Log::Level toNative(wrapper::org::ortc::log::Level level) noexcept; + + static const char *toNative(wrapper::org::ortc::log::Component component) noexcept; + + static wrapper::org::ortc::MediaStreamTrackKind toWrapper(IMediaStreamTrackTypes::Kinds kind) noexcept; + static IMediaStreamTrackTypes::Kinds toNative(wrapper::org::ortc::MediaStreamTrackKind kind) noexcept; + + static wrapper::org::ortc::MediaStreamTrackState toWrapper(IMediaStreamTrackTypes::States state) noexcept; + + static ::ortc::IMediaDevicesTypes::DeviceKinds toNative(wrapper::org::ortc::MediaDeviceKind kind) noexcept; + static wrapper::org::ortc::MediaDeviceKind toWrapper(::ortc::IMediaDevicesTypes::DeviceKinds kind) noexcept; + + static ::ortc::IStatsReportTypes::StatsTypes toNative(wrapper::org::ortc::RTCStatsType type) noexcept; + static wrapper::org::ortc::RTCStatsType toWrapper(::ortc::IStatsReportTypes::StatsTypes type) noexcept; + + static wrapper::org::ortc::RTCSctpTransportState toWrapper(::ortc::ISCTPTransportTypes::States state) noexcept; + static wrapper::org::ortc::RTCDataChannelState toWrapper(::ortc::IDataChannelTypes::States state) noexcept; + + static wrapper::org::ortc::RTCIceCandidatePairState toWrapper(::ortc::IStatsReportTypes::StatsICECandidatePairStates state) noexcept; + + static wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode toWrapper(::ortc::adapter::IPeerConnectionTypes::SignalingModes mode) noexcept; + static ::ortc::adapter::IPeerConnectionTypes::SignalingModes toNative(wrapper::org::ortc::adapter::RTCPeerConnectionSignalingMode mode) noexcept; + + static wrapper::org::ortc::adapter::RTCRtcpMuxPolicy toWrapper(::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicies policy) noexcept; + static ::ortc::adapter::IPeerConnectionTypes::RTCPMuxPolicies toNative(wrapper::org::ortc::adapter::RTCRtcpMuxPolicy policy) noexcept; + + static wrapper::org::ortc::adapter::RTCBundlePolicy toWrapper(::ortc::adapter::IPeerConnectionTypes::BundlePolicies policy) noexcept; + static ::ortc::adapter::IPeerConnectionTypes::BundlePolicies toNative(wrapper::org::ortc::adapter::RTCBundlePolicy policy) noexcept; + + static wrapper::org::ortc::adapter::RTCSignalingState toWrapper(::ortc::adapter::IPeerConnectionTypes::SignalingStates state) noexcept; + static wrapper::org::ortc::adapter::RTCIceConnectionState toPeerConnectionWrapper(::ortc::IICETransportTypes::States state) noexcept; + static wrapper::org::ortc::adapter::RTCPeerConnectionState toWrapper(::ortc::adapter::IPeerConnectionTypes::PeerConnectionStates state) noexcept; + + static wrapper::org::ortc::RTCIceGatherFilterPolicy toWrapper(::ortc::IICEGathererTypes::FilterPolicies policy) noexcept; + static ::ortc::IICEGathererTypes::FilterPolicies toNative(wrapper::org::ortc::RTCIceGatherFilterPolicy policy) noexcept; + + static wrapper::org::ortc::RTCIceCredentialType toWrapper(::ortc::IICEGathererTypes::CredentialTypes policy) noexcept; + static ::ortc::IICEGathererTypes::CredentialTypes toNative(wrapper::org::ortc::RTCIceCredentialType policy) noexcept; + + static wrapper::org::ortc::RTCIceGathererState toWrapper(::ortc::IICEGathererTypes::States state) noexcept; + static ::ortc::IICEGathererTypes::States toNative(wrapper::org::ortc::RTCIceGathererState state) noexcept; + + static wrapper::org::ortc::RTCIceComponent toWrapper(::ortc::IICETypes::Components component) noexcept; + static wrapper::org::ortc::RTCIceProtocol toWrapper(::ortc::IICETypes::Protocols protocol) noexcept; + static wrapper::org::ortc::RTCIceCandidateType toWrapper(::ortc::IICETypes::CandidateTypes type) noexcept; + static wrapper::org::ortc::RTCIceTcpCandidateType toWrapper(::ortc::IICETypes::TCPCandidateTypes type) noexcept; + + static wrapper::org::ortc::RTCIceTransportState toWrapper(::ortc::IICETransportTypes::States state) noexcept; + static ::ortc::IICETransportTypes::States toNative(wrapper::org::ortc::RTCIceTransportState state) noexcept; + + static wrapper::org::ortc::RTCIceRole toWrapper(::ortc::IICETypes::Roles role) noexcept; + static ::ortc::IICETypes::Roles toNative(wrapper::org::ortc::RTCIceRole role) noexcept; + + static wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal toWrapper(::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signals signal) noexcept; + static ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Signals toNative(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsSignal signal) noexcept; + + static wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication toWrapper(::ortc::IRTPTypes::OpusCodecCapabilityOptions::Applications application) noexcept; + static ::ortc::IRTPTypes::OpusCodecCapabilityOptions::Applications toNative(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsApplication application) noexcept; + + static wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP toWrapper(::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToPs top) noexcept; + static ::ortc::IRTPTypes::FlexFECCodecCapabilityParameters::ToPs toNative(wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersToP top) noexcept; + + static wrapper::org::ortc::RTCRtpDegradationPreference toWrapper(::ortc::IRTPTypes::DegradationPreferences preference) noexcept; + static ::ortc::IRTPTypes::DegradationPreferences toNative(wrapper::org::ortc::RTCRtpDegradationPreference preference) noexcept; + + static wrapper::org::ortc::RTCRtpPriorityType toWrapper(::ortc::IRTPTypes::PriorityTypes type) noexcept; + static ::ortc::IRTPTypes::PriorityTypes toNative(wrapper::org::ortc::RTCRtpPriorityType type) noexcept; + + static wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType toWrapper(::ortc::adapter::ISessionDescriptionTypes::SignalingTypes type) noexcept; + static ::ortc::adapter::ISessionDescriptionTypes::SignalingTypes toNative(wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType type) noexcept; + + static wrapper::org::ortc::RTCDtlsRole toWrapper(::ortc::IDTLSTransportTypes::Roles role) noexcept; + static ::ortc::IDTLSTransportTypes::Roles toNative(wrapper::org::ortc::RTCDtlsRole role) noexcept; + + static wrapper::org::ortc::RTCDtlsTransportState toWrapper(::ortc::IDTLSTransportTypes::States state) noexcept; + static ::ortc::IDTLSTransportTypes::States toNative(wrapper::org::ortc::RTCDtlsTransportState state) noexcept; + + static wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection toWrapper(::ortc::adapter::ISessionDescriptionTypes::MediaDirections direction) noexcept; + static ::ortc::adapter::ISessionDescriptionTypes::MediaDirections toNative(wrapper::org::ortc::adapter::RTCSessionDescriptionMediaDirection direction) noexcept; + + static WrapperMediaStreamTrackListPtr toWrapper(MediaStreamTrackListPtr tracks) noexcept; + static MediaStreamTrackListPtr toNative(WrapperMediaStreamTrackListPtr tracks) noexcept; + + static PromisePtr toWrapper(PromisePtr promise) noexcept; + static void reject( + PromisePtr nativePromise, + PromisePtr wrapperPromise + ) noexcept; + + static PromiseWithStatsReportPtr getStats(IStatsProviderPtr native, wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept; + + template + static void optionalSafeIntConvert(const optionalType1 &inputType, optionalType2 &outputType) noexcept + { + outputType = inputType.hasValue() ? optionalType2(SafeInt(inputType.value())) : optionalType2(); + } + + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_Json.cpp b/ortc/idl/wrapper/impl_org_ortc_Json.cpp new file mode 100644 index 00000000..6d6dfa20 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Json.cpp @@ -0,0 +1,74 @@ + +#include "impl_org_ortc_Json.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(zsLib::eventing::IHelper, UseHelper); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::Json::Json() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::org::ortc::Json::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::Json::~Json() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::Json::wrapper_init_org_ortc_Json(String jsonString) noexcept +{ + native_ = UseHelper::toJSON(jsonString); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::Json::toString() noexcept +{ + if (!native_) return String(); + return UseHelper::toString(native_); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::JsonPtr wrapper::impl::org::ortc::Json::toWrapper(zsLib::XML::ElementPtr rootEl) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = rootEl; + return pThis; +} + +//------------------------------------------------------------------------------ +zsLib::XML::ElementPtr wrapper::impl::org::ortc::Json::toNative(wrapper::org::ortc::JsonPtr wrapper) noexcept +{ + if (!wrapper) return zsLib::XML::ElementPtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return zsLib::XML::ElementPtr(); + return result->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_Json.h b/ortc/idl/wrapper/impl_org_ortc_Json.h new file mode 100644 index 00000000..557f666a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Json.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_Json.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct Json : public wrapper::org::ortc::Json + { + JsonWeakPtr thisWeak_; + zsLib::XML::ElementPtr native_; + + Json() noexcept; + virtual ~Json() noexcept; + + // methods Json + void wrapper_init_org_ortc_Json(String jsonString) noexcept override; + String toString() noexcept override; + + static JsonPtr toWrapper(zsLib::XML::ElementPtr rootEl) noexcept; + static zsLib::XML::ElementPtr toNative(wrapper::org::ortc::JsonPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_Logger.cpp b/ortc/idl/wrapper/impl_org_ortc_Logger.cpp new file mode 100644 index 00000000..1d9f2dfe --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Logger.cpp @@ -0,0 +1,208 @@ + +#include "impl_org_ortc_Logger.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +#include + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +using namespace wrapper::impl::org::ortc; + +ZS_DECLARE_TYPEDEF_PTR(::ortc::services::ILogger, UseLogger); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::Logger::~Logger() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::setLogLevel( + wrapper::org::ortc::log::Component component, + wrapper::org::ortc::log::Level level + ) noexcept +{ + UseLogger::setLogLevel(Helper::toNative(component), Helper::toNative(level)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::setLogLevel( + String component, + wrapper::org::ortc::log::Level level + ) noexcept +{ + UseLogger::setLogLevel(component, Helper::toNative(level)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::installStdOutLogger(bool colorizeOutput) noexcept +{ + UseLogger::installStdOutLogger(colorizeOutput); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::installFileLogger( + String fileName, + bool colorizeOutput + ) noexcept +{ + UseLogger::installFileLogger(fileName, colorizeOutput); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::installTelnetLogger( + uint16_t listenPort, + ::zsLib::Seconds maxWaitForSocketToBeAvailable, + bool colorizeOutput + ) noexcept +{ + UseLogger::installTelnetLogger(listenPort, maxWaitForSocketToBeAvailable, colorizeOutput); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::installOutgoingTelnetLogger( + String serverHostWithPort, + bool colorizeOutput, + String sendStringUponConnection + ) noexcept +{ + UseLogger::installOutgoingTelnetLogger(serverHostWithPort, colorizeOutput, sendStringUponConnection); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::installDebuggerLogger() noexcept +{ + UseLogger::installDebuggerLogger(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::Logger::isTelnetLoggerListening() noexcept +{ + return UseLogger::isTelnetLoggerListening(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::Logger::isTelnetLoggerConnected() noexcept +{ + return UseLogger::isTelnetLoggerConnected(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::Logger::isOutgoingTelnetLoggerConnected() noexcept +{ + return UseLogger::isOutgoingTelnetLoggerConnected(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::uninstallStdOutLogger() noexcept +{ + UseLogger::uninstallStdOutLogger(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::uninstallFileLogger() noexcept +{ + UseLogger::uninstallFileLogger(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::uninstallTelnetLogger() noexcept +{ + UseLogger::uninstallTelnetLogger(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::uninstallOutgoingTelnetLogger() noexcept +{ + UseLogger::uninstallOutgoingTelnetLogger(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::uninstallDebuggerLogger() noexcept +{ + UseLogger::uninstallDebuggerLogger(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::setDefaultEventingLevel( + wrapper::org::ortc::log::Component component, + wrapper::org::ortc::log::Level level + ) noexcept +{ + UseLogger::setDefaultEventingLevel(Helper::toNative(component), Helper::toNative(level)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::setDefaultEventingLevel( + String component, + wrapper::org::ortc::log::Level level + ) noexcept +{ + UseLogger::setDefaultEventingLevel(component, Helper::toNative(level)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::setEventingLevel( + wrapper::org::ortc::log::Component component, + wrapper::org::ortc::log::Level level + ) noexcept +{ + UseLogger::setEventingLevel(Helper::toNative(component), Helper::toNative(level)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::setEventingLevel( + String component, + wrapper::org::ortc::log::Level level + ) noexcept +{ + UseLogger::setEventingLevel(component, Helper::toNative(level)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::installEventingListener( + String sharedSecret, + uint16_t listenPort, + ::zsLib::Seconds maxWaitForSocketToBeAvailable + ) noexcept +{ + UseLogger::installEventingListener(listenPort, sharedSecret, maxWaitForSocketToBeAvailable); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::connectToEventingServer( + String sharedSecret, + String serverHostWithPort + ) noexcept +{ + UseLogger::connectToEventingServer(serverHostWithPort, sharedSecret); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::uninstallEventingListener() noexcept +{ + UseLogger::uninstallEventingListener(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Logger::disconnectEventingServer() noexcept +{ + UseLogger::disconnectEventingServer(); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_Logger.h b/ortc/idl/wrapper/impl_org_ortc_Logger.h new file mode 100644 index 00000000..ce104369 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Logger.h @@ -0,0 +1,24 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_Logger.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct Logger : public wrapper::org::ortc::Logger + { + Logger() noexcept = delete; + Logger(const Logger &) noexcept = delete; + virtual ~Logger() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_LongRange.cpp b/ortc/idl/wrapper/impl_org_ortc_LongRange.cpp new file mode 100644 index 00000000..d524ad09 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_LongRange.cpp @@ -0,0 +1,119 @@ + +#include "impl_org_ortc_LongRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::LongRange::LongRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::LongRangePtr wrapper::org::ortc::LongRange::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::LongRange::~LongRange() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::LongRange::wrapper_init_org_ortc_LongRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::LongRange::wrapper_init_org_ortc_LongRange(long value) noexcept +{ + min = max = value; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::LongRange::wrapper_init_org_ortc_LongRange( + long inMin, + long inMax + ) noexcept +{ + this->min = inMin; + this->max = inMax; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::LongRange::wrapper_init_org_ortc_LongRange(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::LongRangePtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::LongRangePtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::LongRange::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("LongRange")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::LongRange::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::LongRangePtr wrapper::impl::org::ortc::LongRange::toWrapper(NativeCapabilityLongPtr native) noexcept +{ + if (!native) return LongRangePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::LongRangePtr wrapper::impl::org::ortc::LongRange::toWrapper(const NativeCapabilityLong &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->min = native.mMin; + pThis->max = native.mMax; + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::LongRange::NativeCapabilityLongPtr wrapper::impl::org::ortc::LongRange::toNative(wrapper::org::ortc::LongRangePtr wrapper) noexcept +{ + if (!wrapper) return NativeCapabilityLongPtr(); + + auto result = make_shared(); + + result->mMin = wrapper->min; + result->mMax = wrapper->max; + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_LongRange.h b/ortc/idl/wrapper/impl_org_ortc_LongRange.h new file mode 100644 index 00000000..0fecb287 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_LongRange.h @@ -0,0 +1,43 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_LongRange.h" + + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct LongRange : public wrapper::org::ortc::LongRange + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICapabilities::CapabilityLong, NativeCapabilityLong); + LongRangeWeakPtr thisWeak_; + + LongRange() noexcept; + virtual ~LongRange() noexcept; + + // methods LongRange + void wrapper_init_org_ortc_LongRange() noexcept override; + void wrapper_init_org_ortc_LongRange(long value) noexcept override; + void wrapper_init_org_ortc_LongRange( + long minimum, + long maximum + ) noexcept override; + void wrapper_init_org_ortc_LongRange(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static LongRangePtr toWrapper(NativeCapabilityLongPtr native) noexcept; + static LongRangePtr toWrapper(const NativeCapabilityLong &native) noexcept; + static NativeCapabilityLongPtr toNative(wrapper::org::ortc::LongRangePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaControl.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaControl.cpp new file mode 100644 index 00000000..9d89758f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaControl.cpp @@ -0,0 +1,40 @@ +// Generated by zsLibEventingTool + +#include "impl_org_ortc_MediaControl.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaControl::~MediaControl() noexcept +{ +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::org::ortc::MediaControl::get_displayOrientation() noexcept +{ + AnyPtr result {}; + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::MediaControl::set_displayOrientation(AnyPtr value) noexcept +{ +} + + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaControl.h b/ortc/idl/wrapper/impl_org_ortc_MediaControl.h new file mode 100644 index 00000000..4d71ea18 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaControl.h @@ -0,0 +1,26 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaControl.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaControl : public wrapper::org::ortc::MediaControl + { + MediaControlWeakPtr thisWeak_; + + MediaControl() noexcept = delete; + MediaControl(const MediaControl &) noexcept = delete; + virtual ~MediaControl() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.cpp new file mode 100644 index 00000000..38bfbfdf --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.cpp @@ -0,0 +1,115 @@ + +#include "impl_org_ortc_MediaDeviceInfo.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDeviceInfo::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDeviceInfo::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDeviceInfo::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaDeviceInfo::MediaDeviceInfo() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaDeviceInfoPtr wrapper::org::ortc::MediaDeviceInfo::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaDeviceInfo::~MediaDeviceInfo() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaDeviceInfo::wrapper_init_org_ortc_MediaDeviceInfo() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaDeviceInfo::wrapper_init_org_ortc_MediaDeviceInfo(wrapper::org::ortc::MediaDeviceInfoPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaDeviceInfo::wrapper_init_org_ortc_MediaDeviceInfo(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaDeviceInfo::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaDeviceInfo::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->kind = Helper::toWrapper(native.mKind); + pThis->label = native.mLabel; + pThis->deviceId = native.mDeviceID; + pThis->groupId = native.mGroupID; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mKind = Helper::toNative(wrapper->kind); + result->mLabel = wrapper->label; + result->mDeviceID = wrapper->deviceId; + result->mGroupID = wrapper->groupId; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.h b/ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.h new file mode 100644 index 00000000..66c6a688 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaDeviceInfo.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaDeviceInfo.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaDeviceInfo : public wrapper::org::ortc::MediaDeviceInfo + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaDevicesTypes::Device, NativeType); + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceInfo, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::MediaDeviceInfo, WrapperType); + MediaDeviceInfoWeakPtr thisWeak_; + + MediaDeviceInfo() noexcept; + virtual ~MediaDeviceInfo() noexcept; + + // methods MediaDeviceInfo + void wrapper_init_org_ortc_MediaDeviceInfo() noexcept override; + void wrapper_init_org_ortc_MediaDeviceInfo(wrapper::org::ortc::MediaDeviceInfoPtr source) noexcept override; + void wrapper_init_org_ortc_MediaDeviceInfo(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaDevices.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaDevices.cpp new file mode 100644 index 00000000..bccc54bc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaDevices.cpp @@ -0,0 +1,151 @@ + +#include "impl_org_ortc_MediaDevices.h" +#include "impl_org_ortc_MediaStreamConstraints.h" +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_MediaDeviceInfo.h" +#include "impl_org_ortc_MediaTrackSupportedConstraints.h" +#include "impl_org_ortc_Helper.h" + + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDevices::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDevices::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDevices::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaDevices::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaDevices::MediaDevices() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaDevicesPtr wrapper::org::ortc::MediaDevices::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaDevices::~MediaDevices() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackSupportedConstraintsPtr wrapper::org::ortc::MediaDevices::getSupportedConstraints() noexcept +{ + return wrapper::impl::org::ortc::MediaTrackSupportedConstraints::toWrapper(NativeType::getSupportedConstraints()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< shared_ptr< list< wrapper::org::ortc::MediaDeviceInfoPtr > > > > wrapper::org::ortc::MediaDevices::enumerateDevices() noexcept +{ + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< shared_ptr< list< wrapper::org::ortc::MediaDeviceInfoPtr > > >, PromiseWithType); + + auto promise = NativeType::enumerateDevices(); + + auto result = PromiseWithType::create(wrapper::impl::org::ortc::Helper::getGuiQueue()); + + promise->thenClosure([promise, result] { + if (promise->isRejected()) { + wrapper::impl::org::ortc::Helper::reject(promise, result); + return; + } + auto wrapperList = make_shared< list< wrapper::org::ortc::MediaDeviceInfoPtr > >(); + auto nativeList = promise->value(); + for (auto iter = nativeList->begin(); iter != nativeList->end(); ++iter) { + auto wrapper = wrapper::impl::org::ortc::MediaDeviceInfo::toWrapper(*iter); + if (!wrapper) continue; + wrapperList->push_back(wrapper); + } + + result->resolve(wrapperList); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > > > wrapper::org::ortc::MediaDevices::getUserMedia(wrapper::org::ortc::MediaStreamConstraintsPtr constraints) noexcept +{ + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > >, PromiseWithType); + + auto native = wrapper::impl::org::ortc::MediaStreamConstraints::toNative(constraints); + if (!native) return PromiseWithType::createRejected(wrapper::impl::org::ortc::Helper::getGuiQueue()); + auto promise = NativeType::getUserMedia(*native); + + auto result = PromiseWithType::create(wrapper::impl::org::ortc::Helper::getGuiQueue()); + + promise->thenClosure([promise, result] { + if (promise->isRejected()) { + wrapper::impl::org::ortc::Helper::reject(promise, result); + return; + } + auto wrapperList = make_shared< list< wrapper::org::ortc::MediaStreamTrackPtr > >(); + auto nativeList = promise->value(); + for (auto iter = nativeList->begin(); iter != nativeList->end(); ++iter) { + auto wrapper = wrapper::impl::org::ortc::MediaStreamTrack::toWrapper(*iter); + if (!wrapper) continue; + wrapperList->push_back(wrapper); + } + + result->resolve(wrapperList); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaDevicesPtr wrapper::org::ortc::MediaDevices::get_singleton() noexcept +{ + zsLib::AutoRecursiveLock lock(*zsLib::IHelper::getGlobalLock()); + static zsLib::SingletonLazySharedPtr singleton(wrapper_create()); + auto result = singleton.singleton(); + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaDevices::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onMediaDevicesChanged() noexcept +{ + onDeviceChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = ::ortc::IMediaDevices::subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaDevices.h b/ortc/idl/wrapper/impl_org_ortc_MediaDevices.h new file mode 100644 index 00000000..ba2419f2 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaDevices.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaDevices.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaDevices : public wrapper::org::ortc::MediaDevices, + public ::ortc::IMediaDevicesDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaDevices, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaDevices, IMediaDevices); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaDevicesSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(MediaDevices, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::MediaDevices, WrapperType); + MediaDevicesWeakPtr thisWeak_; + //NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + NativeTypeSubscriptionPtr subscription_; + + MediaDevices() noexcept; + virtual ~MediaDevices() noexcept; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onMediaDevicesChanged() noexcept override; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaSource.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaSource.cpp new file mode 100644 index 00000000..ae3a0c20 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaSource.cpp @@ -0,0 +1,77 @@ + +#include "impl_org_ortc_MediaSource.h" +#include "impl_org_ortc_MediaStreamTrack.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaSource::MediaSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr wrapper::org::ortc::MediaSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaSource::~MediaSource() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaSource::wrapper_init_org_ortc_MediaSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::impl::org::ortc::MediaSource::get_source() noexcept +{ + zsLib::AutoLock lock(lock_); + return source_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaSource::set_source(AnyPtr value) noexcept +{ + zsLib::AutoLock lock(lock_); + source_ = value; +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::impl::org::ortc::MediaSource::get_track() noexcept +{ + auto holder = make_shared < AnyHolder< ::ortc::IMediaStreamTrackPtr > > (); + holder->value_ = MediaStreamTrack::toNative(track_); + return holder; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaSourcePtr wrapper::impl::org::ortc::MediaSource::createWithTrack(MediaStreamTrackPtr track) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->track_ = track; + pThis->wrapper_init_org_ortc_MediaSource(); + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaSource.h b/ortc/idl/wrapper/impl_org_ortc_MediaSource.h new file mode 100644 index 00000000..9598e2d7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaSource.h @@ -0,0 +1,38 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaSource.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaSource : public wrapper::org::ortc::MediaSource + { + MediaSourceWeakPtr thisWeak_; + MediaStreamTrackPtr track_; + + zsLib::Lock lock_; + AnyPtr source_; + + MediaSource() noexcept; + virtual ~MediaSource() noexcept; + void wrapper_init_org_ortc_MediaSource() noexcept override; + + // properties MediaSource + AnyPtr get_source() noexcept override; + void set_source(AnyPtr value) noexcept override; + AnyPtr get_track() noexcept override; + + static MediaSourcePtr createWithTrack(MediaStreamTrackPtr track) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.cpp new file mode 100644 index 00000000..a3850bb9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.cpp @@ -0,0 +1,123 @@ + +#include "impl_org_ortc_MediaStreamConstraints.h" +#include "impl_org_ortc_MediaTrackConstraints.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamConstraints::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamConstraints::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamConstraints::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaStreamConstraints::MediaStreamConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamConstraintsPtr wrapper::org::ortc::MediaStreamConstraints::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaStreamConstraints::~MediaStreamConstraints() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamConstraints::wrapper_init_org_ortc_MediaStreamConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamConstraints::wrapper_init_org_ortc_MediaStreamConstraints(wrapper::org::ortc::MediaStreamConstraintsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamConstraints::wrapper_init_org_ortc_MediaStreamConstraints(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaStreamConstraints::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaStreamConstraints::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + if (native.mAudio) { + pThis->audio = MediaTrackConstraints::toWrapper(native.mAudio); + } + if (native.mVideo) { + pThis->video = MediaTrackConstraints::toWrapper(native.mVideo); + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + if (wrapper->audio.hasValue()) { + if (wrapper->audio.value()) { + result->mAudio = MediaTrackConstraints::toNative(wrapper->audio.value()); + } + } + if (wrapper->video.hasValue()) { + if (wrapper->video.value()) { + result->mVideo = MediaTrackConstraints::toNative(wrapper->video.value()); + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.h b/ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.h new file mode 100644 index 00000000..0887ea38 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaStreamConstraints.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaStreamConstraints.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaStreamConstraints : public wrapper::org::ortc::MediaStreamConstraints + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::Constraints, NativeType); + ZS_DECLARE_TYPEDEF_PTR(MediaStreamConstraints, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::MediaStreamConstraints, WrapperType); + MediaStreamConstraintsWeakPtr thisWeak_; + + MediaStreamConstraints() noexcept; + virtual ~MediaStreamConstraints() noexcept; + + // methods MediaStreamConstraints + void wrapper_init_org_ortc_MediaStreamConstraints() noexcept override; + void wrapper_init_org_ortc_MediaStreamConstraints(wrapper::org::ortc::MediaStreamConstraintsPtr source) noexcept override; + void wrapper_init_org_ortc_MediaStreamConstraints(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.cpp new file mode 100644 index 00000000..10f7d0a0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.cpp @@ -0,0 +1,239 @@ + +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_MediaTrackCapabilities.h" +#include "impl_org_ortc_MediaTrackConstraints.h" +#include "impl_org_ortc_MediaTrackSettings.h" +#include "impl_org_ortc_MediaSource.h" +#include "impl_org_ortc_OverconstrainedError.h" +#include "impl_org_ortc_OverconstrainedErrorEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamTrack::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamTrack::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamTrack::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaStreamTrack::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaStreamTrack::MediaStreamTrack() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackPtr wrapper::org::ortc::MediaStreamTrack::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaStreamTrack::~MediaStreamTrack() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackPtr wrapper::impl::org::ortc::MediaStreamTrack::clone() noexcept +{ + return toWrapper(native_->clone()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::stop() noexcept +{ + return native_->stop(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackCapabilitiesPtr wrapper::impl::org::ortc::MediaStreamTrack::getCapabilities() noexcept +{ + return MediaTrackCapabilities::toWrapper(native_->getCapabilities()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackConstraintsPtr wrapper::impl::org::ortc::MediaStreamTrack::getConstraints() noexcept +{ + return MediaTrackConstraints::toWrapper(native_->getConstraints()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackSettingsPtr wrapper::impl::org::ortc::MediaStreamTrack::getSettings() noexcept +{ + return MediaTrackSettings::toWrapper(native_->getSettings()); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::ortc::MediaStreamTrack::applyConstraints(wrapper::org::ortc::MediaTrackConstraintsPtr constraints) noexcept(false) +{ + ZS_THROW_INVALID_ARGUMENT_IF(!constraints); + return Helper::toWrapper(native_->applyConstraints(*MediaTrackConstraints::toNative(constraints))); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::MediaStreamTrack::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackKind wrapper::impl::org::ortc::MediaStreamTrack::get_kind() noexcept +{ + return Helper::toWrapper(native_->kind()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaStreamTrack::get_id() noexcept +{ + return native_->id(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaStreamTrack::get_deviceId() noexcept +{ + return native_->deviceID(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaStreamTrack::get_label() noexcept +{ + return native_->label(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::MediaStreamTrack::get_enabled() noexcept +{ + return native_->enabled(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::set_enabled(bool value) noexcept +{ + native_->enabled(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::MediaStreamTrack::get_muted() noexcept +{ + return native_->muted(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::set_muted(bool value) noexcept +{ + native_->muted(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::MediaStreamTrack::get_remote() noexcept +{ + return native_->remote(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackState wrapper::impl::org::ortc::MediaStreamTrack::get_readyState() noexcept +{ + return Helper::toWrapper(native_->readyState()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr wrapper::impl::org::ortc::MediaStreamTrack::get_source() noexcept +{ + zsLib::AutoLock lock(lock_); + if (mediaSource_) return mediaSource_; + + mediaSource_ = MediaSource::createWithTrack(thisWeak_.lock()); + return mediaSource_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::onMediaStreamTrackMute( + IMediaStreamTrackPtr track, + bool isMuted + ) noexcept +{ + if (isMuted) { + onMute(); + } else { + onUnmute(); + } +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::onMediaStreamTrackEnded(IMediaStreamTrackPtr track) noexcept +{ + onEnded(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaStreamTrack::onMediaStreamTrackOverConstrained( + IMediaStreamTrackPtr track, + OverconstrainedErrorPtr error + ) noexcept +{ + onOverConstrained(OverconstrainedErrorEvent::toWrapper(wrapper::impl::org::ortc::OverconstrainedError::toWrapper(error))); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.h b/ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.h new file mode 100644 index 00000000..fa8cbf1f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaStreamTrack.h @@ -0,0 +1,80 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaStreamTrack.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaStreamTrack : public wrapper::org::ortc::MediaStreamTrack, + public ::ortc::IMediaStreamTrackDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrack, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrack, IMediaStreamTrack); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(MediaStreamTrack, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::MediaStreamTrack, WrapperType); + + MediaStreamTrackWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_ {true}; + NativeTypeSubscriptionPtr subscription_; + MediaSourcePtr mediaSource_; + + MediaStreamTrack() noexcept; + virtual ~MediaStreamTrack() noexcept; + + // methods MediaStreamTrack + wrapper::org::ortc::MediaStreamTrackPtr clone() noexcept override; + void stop() noexcept override; + wrapper::org::ortc::MediaTrackCapabilitiesPtr getCapabilities() noexcept override; + wrapper::org::ortc::MediaTrackConstraintsPtr getConstraints() noexcept override; + wrapper::org::ortc::MediaTrackSettingsPtr getSettings() noexcept override; + PromisePtr applyConstraints(wrapper::org::ortc::MediaTrackConstraintsPtr constraints) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument + + // properties MediaStreamTrack + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::MediaStreamTrackKind get_kind() noexcept override; + String get_id() noexcept override; + String get_deviceId() noexcept override; + String get_label() noexcept override; + bool get_enabled() noexcept override; + void set_enabled(bool value) noexcept override; + bool get_muted() noexcept override; + void set_muted(bool value) noexcept override; + bool get_remote() noexcept override; + wrapper::org::ortc::MediaStreamTrackState get_readyState() noexcept override; + wrapper::org::ortc::MediaSourcePtr get_source() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + // IMediaStreamTrackDelegate + virtual void onMediaStreamTrackMute( + IMediaStreamTrackPtr track, + bool isMuted + ) noexcept override; + + virtual void onMediaStreamTrackEnded(IMediaStreamTrackPtr track) noexcept override; + virtual void onMediaStreamTrackOverConstrained( + IMediaStreamTrackPtr track, + OverconstrainedErrorPtr error + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.cpp new file mode 100644 index 00000000..34b9fd81 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.cpp @@ -0,0 +1,213 @@ + +#include "impl_org_ortc_MediaTrackCapabilities.h" +#include "impl_org_ortc_LongRange.h" +#include "impl_org_ortc_DoubleRange.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackCapabilities::MediaTrackCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackCapabilitiesPtr wrapper::org::ortc::MediaTrackCapabilities::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackCapabilities::~MediaTrackCapabilities() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackCapabilities::wrapper_init_org_ortc_MediaTrackCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackCapabilities::wrapper_init_org_ortc_MediaTrackCapabilities(wrapper::org::ortc::MediaTrackCapabilitiesPtr source) noexcept +{ + wrapper::org::ortc::MediaTrackCapabilitiesPtr pThis = thisWeak_.lock(); + wrapper::org::ortc::MediaTrackCapabilitiesPtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackCapabilities::wrapper_init_org_ortc_MediaTrackCapabilities(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + wrapper::org::ortc::MediaTrackCapabilitiesPtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + wrapper::org::ortc::MediaTrackCapabilitiesPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaTrackCapabilities::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaTrackCapabilities::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackCapabilitiesPtr wrapper::impl::org::ortc::MediaTrackCapabilities::toWrapper(NativeCapabilitiesPtr native) noexcept +{ + if (!native) return MediaTrackCapabilitiesPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackCapabilitiesPtr wrapper::impl::org::ortc::MediaTrackCapabilities::toWrapper(const NativeCapabilities &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + if (native.mWidth.hasValue()) { + pThis->width = LongRange::toWrapper(native.mWidth.value()); + } + if (native.mHeight.hasValue()) { + pThis->height = LongRange::toWrapper(native.mHeight.value()); + } + if (native.mAspectRatio.hasValue()) { + pThis->aspectRatio = DoubleRange::toWrapper(native.mAspectRatio.value()); + } + if (native.mFrameRate.hasValue()) { + pThis->frameRate = DoubleRange::toWrapper(native.mFrameRate.value()); + } + if (native.mFacingMode.hasValue()) { + pThis->facingMode = make_shared< list< String > >(); + for (auto iter = native.mFacingMode.value().begin(); iter != native.mFacingMode.value().end(); ++iter) + { + pThis->facingMode->push_back(*iter); + } + } + if (native.mVolume.hasValue()) { + pThis->volume = DoubleRange::toWrapper(native.mVolume.value()); + } + if (native.mSampleRate.hasValue()) { + pThis->sampleRate = LongRange::toWrapper(native.mSampleRate.value()); + } + if (native.mSampleSize.hasValue()) { + pThis->sampleSize = LongRange::toWrapper(native.mSampleSize.value()); + } + if (native.mEchoCancellation.hasValue()) { + pThis->echoCancellation = make_shared< list< bool > >(); + for (auto iter = native.mEchoCancellation.value().begin(); iter != native.mEchoCancellation.value().end(); ++iter) + { + pThis->echoCancellation->push_back(*iter); + } + } + if (native.mLatency.hasValue()) { + pThis->latency = DoubleRange::toWrapper(native.mLatency.value()); + } + if (native.mChannelCount.hasValue()) { + pThis->channelCount = LongRange::toWrapper(native.mChannelCount.value()); + } + pThis->deviceId = native.mDeviceID; + pThis->groupId = native.mGroupID; + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackCapabilities::NativeCapabilitiesPtr wrapper::impl::org::ortc::MediaTrackCapabilities::toNative(wrapper::org::ortc::MediaTrackCapabilitiesPtr wrapper) noexcept +{ + if (!wrapper) return NativeCapabilitiesPtr(); + + auto native = make_shared< NativeCapabilities >(); + + if (wrapper->width.hasValue()) { + if (wrapper->width.value()) { + native->mWidth = *LongRange::toNative(wrapper->width); + } + } + if (wrapper->height.hasValue()) { + if (wrapper->height.value()) { + native->mHeight = *LongRange::toNative(wrapper->height); + } + } + if (wrapper->aspectRatio.hasValue()) { + if (wrapper->aspectRatio.value()) { + native->mAspectRatio = *DoubleRange::toNative(wrapper->aspectRatio); + } + } + if (wrapper->frameRate.hasValue()) { + if (wrapper->frameRate.value()) { + native->mFrameRate = *DoubleRange::toNative(wrapper->frameRate); + } + } + if (wrapper->facingMode) { + auto value = make_shared(); + for (auto iter = wrapper->facingMode->begin(); iter != wrapper->facingMode->end(); ++iter) { + value->insert(*iter); + } + native->mFacingMode = *value; + } + if (wrapper->volume.hasValue()) { + if (wrapper->volume.value()) { + native->mVolume = *DoubleRange::toNative(wrapper->volume); + } + } + if (wrapper->sampleRate.hasValue()) { + if (wrapper->sampleRate.value()) { + native->mSampleRate = *LongRange::toNative(wrapper->sampleRate); + } + } + if (wrapper->sampleSize.hasValue()) { + if (wrapper->sampleSize.value()) { + native->mSampleSize = *LongRange::toNative(wrapper->sampleSize); + } + } + if (wrapper->echoCancellation) { + auto value = make_shared(); + for (auto iter = wrapper->echoCancellation->begin(); iter != wrapper->echoCancellation->end(); ++iter) { + value->insert(*iter); + } + native->mEchoCancellation = *value; + } + if (wrapper->latency.hasValue()) { + if (wrapper->latency.value()) { + native->mLatency = *DoubleRange::toNative(wrapper->latency); + } + } + if (wrapper->channelCount.hasValue()) { + if (wrapper->channelCount.value()) { + native->mChannelCount = *LongRange::toNative(wrapper->channelCount); + } + } + + native->mDeviceID = wrapper->deviceId; + native->mGroupID = wrapper->groupId; + + return native; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.h b/ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.h new file mode 100644 index 00000000..3ac71610 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackCapabilities.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaTrackCapabilities.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaTrackCapabilities : public wrapper::org::ortc::MediaTrackCapabilities + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::Capabilities, NativeCapabilities); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICapabilities::CapabilityString, NativeCapabilityString); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICapabilities::CapabilityBoolean, NativeCapabilityBoolean); + + MediaTrackCapabilitiesWeakPtr thisWeak_; + + MediaTrackCapabilities() noexcept; + virtual ~MediaTrackCapabilities() noexcept; + + // methods MediaTrackCapabilities + void wrapper_init_org_ortc_MediaTrackCapabilities() noexcept override; + void wrapper_init_org_ortc_MediaTrackCapabilities(wrapper::org::ortc::MediaTrackCapabilitiesPtr source) noexcept override; + void wrapper_init_org_ortc_MediaTrackCapabilities(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static MediaTrackCapabilitiesPtr toWrapper(NativeCapabilitiesPtr native) noexcept; + static MediaTrackCapabilitiesPtr toWrapper(const NativeCapabilities &native) noexcept; + static NativeCapabilitiesPtr toNative(wrapper::org::ortc::MediaTrackCapabilitiesPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.cpp new file mode 100644 index 00000000..17a7ed70 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.cpp @@ -0,0 +1,170 @@ + +#include "impl_org_ortc_MediaTrackConstraintSet.h" +#include "impl_org_ortc_ConstrainLong.h" +#include "impl_org_ortc_ConstrainDouble.h" +#include "impl_org_ortc_ConstrainString.h" +#include "impl_org_ortc_ConstrainBoolean.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintSet::MediaTrackConstraintSet() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackConstraintSetPtr wrapper::org::ortc::MediaTrackConstraintSet::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintSet::~MediaTrackConstraintSet() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackConstraintSet::wrapper_init_org_ortc_MediaTrackConstraintSet() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackConstraintSet::wrapper_init_org_ortc_MediaTrackConstraintSet(wrapper::org::ortc::MediaTrackConstraintSetPtr source) noexcept +{ + if (!source) return; + wrapper::org::ortc::MediaTrackConstraintSetPtr pThis = thisWeak_.lock(); + + auto native = toNative(source); + if (!native) return; + + wrapper::org::ortc::MediaTrackConstraintSetPtr wrapper = toWrapper(native); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackConstraintSet::wrapper_init_org_ortc_MediaTrackConstraintSet(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::MediaTrackConstraintSetPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::MediaTrackConstraintSetPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaTrackConstraintSet::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaTrackConstraintSet::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintSetPtr wrapper::impl::org::ortc::MediaTrackConstraintSet::toWrapper(NativeConstraintSetPtr native) noexcept +{ + if (!native) return MediaTrackConstraintSetPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintSetPtr wrapper::impl::org::ortc::MediaTrackConstraintSet::toWrapper(const NativeConstraintSet &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->width = ConstrainLong::toWrapper(native.mWidth); + pThis->height = ConstrainLong::toWrapper(native.mHeight); + pThis->aspectRatio = ConstrainDouble::toWrapper(native.mAspectRatio); + pThis->frameRate = ConstrainDouble::toWrapper(native.mFrameRate); + pThis->facingMode = ConstrainString::toWrapper(native.mFacingMode); + pThis->volume = ConstrainDouble::toWrapper(native.mVolume); + pThis->sampleRate = ConstrainLong::toWrapper(native.mSampleRate); + pThis->sampleSize = ConstrainLong::toWrapper(native.mSampleSize); + pThis->echoCancellation = ConstrainBoolean::toWrapper(native.mEchoCancellation); + pThis->latency = ConstrainDouble::toWrapper(native.mLatency); + pThis->channelCount = ConstrainLong::toWrapper(native.mChannelCount); + pThis->deviceId = ConstrainString::toWrapper(native.mDeviceID); + pThis->groupId = ConstrainString::toWrapper(native.mGroupID); + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintSet::NativeConstraintSetPtr wrapper::impl::org::ortc::MediaTrackConstraintSet::toNative(wrapper::org::ortc::MediaTrackConstraintSetPtr wrapper) noexcept +{ + if (!wrapper) return NativeConstraintSetPtr(); + + auto result = make_shared(); + + if (wrapper->width) { + result->mWidth = *ConstrainLong::toNative(wrapper->width); + } + if (wrapper->height) { + result->mHeight = *ConstrainLong::toNative(wrapper->height); + } + if (wrapper->aspectRatio) { + result->mAspectRatio = *ConstrainDouble::toNative(wrapper->aspectRatio); + } + if (wrapper->frameRate) { + result->mFrameRate = *ConstrainDouble::toNative(wrapper->frameRate); + } + if (wrapper->facingMode) { + result->mFacingMode = *ConstrainString::toNative(wrapper->facingMode); + } + if (wrapper->volume) { + result->mVolume = *ConstrainDouble::toNative(wrapper->volume); + } + if (wrapper->sampleRate) { + result->mSampleRate = *ConstrainLong::toNative(wrapper->sampleRate); + } + if (wrapper->sampleSize) { + result->mSampleSize = *ConstrainLong::toNative(wrapper->sampleSize); + } + if (wrapper->echoCancellation) { + result->mEchoCancellation = *ConstrainBoolean::toNative(wrapper->echoCancellation); + } + if (wrapper->latency) { + result->mLatency = *ConstrainDouble::toNative(wrapper->latency); + } + if (wrapper->channelCount) { + result->mChannelCount = *ConstrainLong::toNative(wrapper->channelCount); + } + if (wrapper->deviceId) { + result->mDeviceID = *ConstrainString::toNative(wrapper->deviceId); + } + if (wrapper->groupId) { + result->mGroupID = *ConstrainString::toNative(wrapper->groupId); + } + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.h b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.h new file mode 100644 index 00000000..9614c4f0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraintSet.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaTrackConstraintSet.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaTrackConstraintSet : public wrapper::org::ortc::MediaTrackConstraintSet + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::ConstraintSet, NativeConstraintSet); + + MediaTrackConstraintSetWeakPtr thisWeak_; + + MediaTrackConstraintSet() noexcept; + virtual ~MediaTrackConstraintSet() noexcept; + + // methods MediaTrackConstraintSet + void wrapper_init_org_ortc_MediaTrackConstraintSet() noexcept override; + void wrapper_init_org_ortc_MediaTrackConstraintSet(wrapper::org::ortc::MediaTrackConstraintSetPtr source) noexcept override; + void wrapper_init_org_ortc_MediaTrackConstraintSet(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static MediaTrackConstraintSetPtr toWrapper(NativeConstraintSetPtr native) noexcept; + static MediaTrackConstraintSetPtr toWrapper(const NativeConstraintSet &native) noexcept; + static NativeConstraintSetPtr toNative(wrapper::org::ortc::MediaTrackConstraintSetPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.cpp new file mode 100644 index 00000000..96c705e0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.cpp @@ -0,0 +1,188 @@ + +#include "impl_org_ortc_MediaTrackConstraints.h" +#include "impl_org_ortc_MediaTrackConstraintSet.h" +#include "impl_org_ortc_ConstrainLong.h" +#include "impl_org_ortc_ConstrainDouble.h" +#include "impl_org_ortc_ConstrainString.h" +#include "impl_org_ortc_ConstrainBoolean.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraints::MediaTrackConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackConstraintsPtr wrapper::org::ortc::MediaTrackConstraints::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraints::~MediaTrackConstraints() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaTrackConstraints::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaTrackConstraints::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackConstraints::wrapper_init_org_ortc_MediaTrackConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackConstraints::wrapper_init_org_ortc_MediaTrackConstraints(wrapper::org::ortc::MediaTrackConstraintsPtr source) noexcept +{ + if (!source) return; + wrapper::org::ortc::MediaTrackConstraintsPtr pThis = thisWeak_.lock(); + + auto native = toNative(source); + if (!native) return; + + wrapper::org::ortc::MediaTrackConstraintsPtr wrapper = toWrapper(native); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackConstraints::wrapper_init_org_ortc_MediaTrackConstraints(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::MediaTrackConstraintsPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::MediaTrackConstraintsPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintsPtr wrapper::impl::org::ortc::MediaTrackConstraints::toWrapper(NativeTrackConstraintsPtr native) noexcept +{ + if (!native) return MediaTrackConstraintsPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraintsPtr wrapper::impl::org::ortc::MediaTrackConstraints::toWrapper(const NativeTrackConstraints &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->width = ConstrainLong::toWrapper(native.mWidth); + pThis->height = ConstrainLong::toWrapper(native.mHeight); + pThis->aspectRatio = ConstrainDouble::toWrapper(native.mAspectRatio); + pThis->frameRate = ConstrainDouble::toWrapper(native.mFrameRate); + pThis->facingMode = ConstrainString::toWrapper(native.mFacingMode); + pThis->volume = ConstrainDouble::toWrapper(native.mVolume); + pThis->sampleRate = ConstrainLong::toWrapper(native.mSampleRate); + pThis->sampleSize = ConstrainLong::toWrapper(native.mSampleSize); + pThis->echoCancellation = ConstrainBoolean::toWrapper(native.mEchoCancellation); + pThis->latency = ConstrainDouble::toWrapper(native.mLatency); + pThis->channelCount = ConstrainLong::toWrapper(native.mChannelCount); + pThis->deviceId = ConstrainString::toWrapper(native.mDeviceID); + pThis->groupId = ConstrainString::toWrapper(native.mGroupID); + + pThis->advanced = make_shared< list< wrapper::org::ortc::MediaTrackConstraintSetPtr > >(); + + for (auto iter = native.mAdvanced.begin(); iter != native.mAdvanced.end(); ++iter) + { + auto wrapper = wrapper::impl::org::ortc::MediaTrackConstraintSet::toWrapper(*iter); + if (!wrapper) continue; + pThis->advanced->push_back(wrapper); + } + + return pThis; +} +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackConstraints::NativeTrackConstraintsPtr wrapper::impl::org::ortc::MediaTrackConstraints::toNative(wrapper::org::ortc::MediaTrackConstraintsPtr wrapper) noexcept +{ + if (!wrapper) return NativeTrackConstraintsPtr(); + + auto result = make_shared(); + + if (wrapper->width) { + result->mWidth = *ConstrainLong::toNative(wrapper->width); + } + if (wrapper->height) { + result->mHeight = *ConstrainLong::toNative(wrapper->height); + } + if (wrapper->aspectRatio) { + result->mAspectRatio = *ConstrainDouble::toNative(wrapper->aspectRatio); + } + if (wrapper->frameRate) { + result->mFrameRate = *ConstrainDouble::toNative(wrapper->frameRate); + } + if (wrapper->facingMode) { + result->mFacingMode = *ConstrainString::toNative(wrapper->facingMode); + } + if (wrapper->volume) { + result->mVolume = *ConstrainDouble::toNative(wrapper->volume); + } + if (wrapper->sampleRate) { + result->mSampleRate = *ConstrainLong::toNative(wrapper->sampleRate); + } + if (wrapper->sampleSize) { + result->mSampleSize = *ConstrainLong::toNative(wrapper->sampleSize); + } + if (wrapper->echoCancellation) { + result->mEchoCancellation = *ConstrainBoolean::toNative(wrapper->echoCancellation); + } + if (wrapper->latency) { + result->mLatency = *ConstrainDouble::toNative(wrapper->latency); + } + if (wrapper->channelCount) { + result->mChannelCount = *ConstrainLong::toNative(wrapper->channelCount); + } + if (wrapper->deviceId) { + result->mDeviceID = *ConstrainString::toNative(wrapper->deviceId); + } + if (wrapper->groupId) { + result->mGroupID = *ConstrainString::toNative(wrapper->groupId); + } + + if (wrapper->advanced) { + for (auto iter = wrapper->advanced->begin(); iter != wrapper->advanced->end(); ++iter) + { + auto native = wrapper::impl::org::ortc::MediaTrackConstraintSet::toNative(*iter); + if (!native) continue; + result->mAdvanced.push_back(native); + } + } + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.h b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.h new file mode 100644 index 00000000..b9b218ef --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackConstraints.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaTrackConstraints.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaTrackConstraints : public wrapper::org::ortc::MediaTrackConstraints + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::TrackConstraints, NativeTrackConstraints); + + MediaTrackConstraintsWeakPtr thisWeak_; + + MediaTrackConstraints() noexcept; + virtual ~MediaTrackConstraints() noexcept; + + // methods MediaTrackConstraintSet + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods MediaTrackConstraints + void wrapper_init_org_ortc_MediaTrackConstraints() noexcept override; + void wrapper_init_org_ortc_MediaTrackConstraints(wrapper::org::ortc::MediaTrackConstraintsPtr source) noexcept override; + void wrapper_init_org_ortc_MediaTrackConstraints(wrapper::org::ortc::JsonPtr json) noexcept override; + + static MediaTrackConstraintsPtr toWrapper(NativeTrackConstraintsPtr native) noexcept; + static MediaTrackConstraintsPtr toWrapper(const NativeTrackConstraints &native) noexcept; + static NativeTrackConstraintsPtr toNative(wrapper::org::ortc::MediaTrackConstraintsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.cpp new file mode 100644 index 00000000..188b7cb7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.cpp @@ -0,0 +1,133 @@ + +#include "impl_org_ortc_MediaTrackSettings.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackSettings::MediaTrackSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackSettingsPtr wrapper::org::ortc::MediaTrackSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackSettings::~MediaTrackSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackSettings::wrapper_init_org_ortc_MediaTrackSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackSettings::wrapper_init_org_ortc_MediaTrackSettings(wrapper::org::ortc::MediaTrackSettingsPtr source) noexcept +{ + if (!source) return; + + wrapper::org::ortc::MediaTrackSettingsPtr wrapper = source; + wrapper::org::ortc::MediaTrackSettingsPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackSettings::wrapper_init_org_ortc_MediaTrackSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + auto rootEl = Json::toNative(json); + if (!rootEl) return; + + auto native = Settings::create(rootEl); + if (!native) return; + + wrapper::org::ortc::MediaTrackSettingsPtr wrapper = toWrapper(native); + if (!wrapper) return; + + wrapper::org::ortc::MediaTrackSettingsPtr pThis = thisWeak_.lock(); + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaTrackSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaTrackSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackSettingsPtr wrapper::impl::org::ortc::MediaTrackSettings::toWrapper(SettingsPtr native) noexcept +{ + if (!native) return MediaTrackSettingsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->width = native->mWidth; + pThis->height = native->mHeight; + pThis->aspectRatio = native->mAspectRatio; + pThis->frameRate = native->mFrameRate; + pThis->facingMode = native->mFacingMode; + pThis->volume = native->mVolume; + pThis->sampleRate = native->mSampleRate; + pThis->sampleSize = native->mSampleSize; + pThis->echoCancellation = native->mEchoCancellation; + pThis->latency = native->mLatency; + pThis->channelCount = native->mChannelCount; + pThis->deviceId = native->mDeviceID; + pThis->groupId = native->mGroupID; + + pThis->wrapper_init_org_ortc_MediaTrackSettings(); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackSettings::SettingsPtr wrapper::impl::org::ortc::MediaTrackSettings::toNative(MediaTrackSettingsPtr wrapper) noexcept +{ + if (!wrapper) return SettingsPtr(); + + auto native = Settings::create(); + + native->mWidth = wrapper->width; + native->mHeight = wrapper->height; + native->mAspectRatio = wrapper->aspectRatio; + native->mFrameRate = wrapper->frameRate; + native->mFacingMode = wrapper->facingMode; + native->mVolume = wrapper->volume; + native->mSampleRate = wrapper->sampleRate; + native->mSampleSize = wrapper->sampleSize; + native->mEchoCancellation = wrapper->echoCancellation; + native->mLatency = wrapper->latency; + native->mChannelCount = wrapper->channelCount; + native->mDeviceID = wrapper->deviceId; + native->mGroupID = wrapper->groupId; + + return native; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.h b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.h new file mode 100644 index 00000000..e2244d25 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSettings.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaTrackSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaTrackSettings : public wrapper::org::ortc::MediaTrackSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::Settings, Settings); + + MediaTrackSettingsWeakPtr thisWeak_; + + MediaTrackSettings() noexcept; + virtual ~MediaTrackSettings() noexcept; + + // methods MediaTrackSettings + void wrapper_init_org_ortc_MediaTrackSettings() noexcept override; + void wrapper_init_org_ortc_MediaTrackSettings(wrapper::org::ortc::MediaTrackSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_MediaTrackSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static MediaTrackSettingsPtr toWrapper(SettingsPtr native) noexcept; + static SettingsPtr toNative(MediaTrackSettingsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.cpp b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.cpp new file mode 100644 index 00000000..a267f1b9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.cpp @@ -0,0 +1,133 @@ + +#include "impl_org_ortc_MediaTrackSupportedConstraints.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaTrackSupportedConstraints::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaTrackSupportedConstraints::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::MediaTrackSupportedConstraints::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackSupportedConstraints::MediaTrackSupportedConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaTrackSupportedConstraintsPtr wrapper::org::ortc::MediaTrackSupportedConstraints::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::MediaTrackSupportedConstraints::~MediaTrackSupportedConstraints() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackSupportedConstraints::wrapper_init_org_ortc_MediaTrackSupportedConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackSupportedConstraints::wrapper_init_org_ortc_MediaTrackSupportedConstraints(wrapper::org::ortc::MediaTrackSupportedConstraintsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::MediaTrackSupportedConstraints::wrapper_init_org_ortc_MediaTrackSupportedConstraints(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::MediaTrackSupportedConstraints::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("MediaTrackSupportedConstraints")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::MediaTrackSupportedConstraints::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->width = native.mWidth; + pThis->height = native.mHeight; + pThis->aspectRatio = native.mAspectRatio; + pThis->frameRate = native.mFrameRate; + pThis->facingMode = native.mFacingMode; + pThis->volume = native.mVolume; + pThis->sampleRate = native.mSampleRate; + pThis->sampleSize = native.mSampleSize; + pThis->echoCancellation = native.mEchoCancellation; + pThis->latency = native.mLatency; + pThis->channelCount = native.mChannelCount; + pThis->deviceId = native.mDeviceID; + pThis->groupId = native.mGroupID; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mWidth = wrapper->width; + result->mHeight = wrapper->height; + result->mAspectRatio = wrapper->aspectRatio; + result->mFrameRate = wrapper->frameRate; + result->mFacingMode = wrapper->facingMode; + result->mVolume = wrapper->volume; + result->mSampleRate = wrapper->sampleRate; + result->mSampleSize = wrapper->sampleSize; + result->mEchoCancellation = wrapper->echoCancellation; + result->mLatency = wrapper->latency; + result->mChannelCount = wrapper->channelCount; + result->mDeviceID = wrapper->deviceId; + result->mGroupID = wrapper->groupId; + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.h b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.h new file mode 100644 index 00000000..20a1165c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_MediaTrackSupportedConstraints.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_MediaTrackSupportedConstraints.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct MediaTrackSupportedConstraints : public wrapper::org::ortc::MediaTrackSupportedConstraints + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaDevicesTypes::SupportedConstraints, NativeType); + ZS_DECLARE_TYPEDEF_PTR(MediaTrackSupportedConstraints, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::MediaTrackSupportedConstraints, WrapperType); + MediaTrackSupportedConstraintsWeakPtr thisWeak_; + + MediaTrackSupportedConstraints() noexcept; + virtual ~MediaTrackSupportedConstraints() noexcept; + + // methods MediaTrackSupportedConstraints + void wrapper_init_org_ortc_MediaTrackSupportedConstraints() noexcept override; + void wrapper_init_org_ortc_MediaTrackSupportedConstraints(wrapper::org::ortc::MediaTrackSupportedConstraintsPtr source) noexcept override; + void wrapper_init_org_ortc_MediaTrackSupportedConstraints(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_OrtcLib.cpp b/ortc/idl/wrapper/impl_org_ortc_OrtcLib.cpp new file mode 100644 index 00000000..d4cdf103 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_OrtcLib.cpp @@ -0,0 +1,155 @@ + +#include "impl_org_ortc_Helper.h" + +#include + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#include +#endif //WINUWP + +#include "impl_org_ortc_EventQueue.h" +#include "impl_org_ortc_OrtcLib.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::OrtcLib::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::OrtcLib::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::OrtcLib::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::OrtcLib::~OrtcLib() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::setup() noexcept +{ + auto defaultEventQueue = wrapper::org::ortc::EventQueue::get_singleton(); + setup(defaultEventQueue ? defaultEventQueue : wrapper::org::ortc::EventQueue::getDefaultForUi()); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::setup(wrapper::org::ortc::EventQueuePtr queue) noexcept +{ +#ifdef WINUWP +#ifdef __cplusplus_winrt + NativeType::setup(wrapper::impl::org::ortc::EventQueue::toNative_cx(queue)); +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + NativeType::setup(wrapper::impl::org::ortc::EventQueue::toNative_winrt(queue)); +#endif //CPPWINRT_VERSION +#else //WINUWP + NativeType::setup(wrapper::impl::org::ortc::EventQueue::toNative(queue)); +#endif //WINUWP +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::startMediaTracing() noexcept +{ + NativeType::startMediaTracing(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::stopMediaTracing() noexcept +{ + NativeType::stopMediaTracing(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::OrtcLib::isMediaTracing() noexcept +{ + return NativeType::isMediaTracing(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::OrtcLib::saveMediaTrace(String filename) noexcept +{ + return NativeType::saveMediaTrace(filename); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::OrtcLib::saveMediaTrace( + String host, + int port + ) noexcept +{ + return NativeType::saveMediaTrace(host, port); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::org::ortc::OrtcLib::notifyGoingToBackground() noexcept +{ + struct Notified : public Any, + public ::ortc::services::IBackgroundingCompletionDelegate + { + virtual void onBackgroundingReady(::ortc::services::IBackgroundingQueryPtr query) noexcept + { + promise_->resolve(); + promise_.reset(); + } + + PromisePtr promise_; + ::ortc::services::IBackgroundingQueryPtr query_; + }; + + auto observer = make_shared(); + observer->promise_ = Promise::create(wrapper::impl::org::ortc::Helper::getGuiQueue()); + observer->promise_->setReferenceHolder(observer); + observer->query_ = ::ortc::services::IBackgrounding::notifyGoingToBackground(); + return observer->promise_; +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::notifyGoingToBackgroundNow() noexcept +{ + ::ortc::services::IBackgrounding::notifyGoingToBackgroundNow(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::notifyReturningFromBackground() noexcept +{ + ::ortc::services::IBackgrounding::notifyReturningFromBackground(); +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::org::ortc::OrtcLib::get_ntpServerTime() noexcept +{ + return NativeType::ntpServerTime(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::OrtcLib::set_ntpServerTime(::zsLib::Milliseconds value) noexcept +{ + NativeType::ntpServerTime(value); +} + + diff --git a/ortc/idl/wrapper/impl_org_ortc_OrtcLib.h b/ortc/idl/wrapper/impl_org_ortc_OrtcLib.h new file mode 100644 index 00000000..4fa41d16 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_OrtcLib.h @@ -0,0 +1,29 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_OrtcLib.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct OrtcLib : public wrapper::org::ortc::OrtcLib + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IORTC, NativeType); + ZS_DECLARE_TYPEDEF_PTR(OrtcLib, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::OrtcLib, WrapperType); + + OrtcLib() noexcept = delete; + OrtcLib(const OrtcLib &) noexcept = delete; + virtual ~OrtcLib() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.cpp b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.cpp new file mode 100644 index 00000000..3194ce9c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.cpp @@ -0,0 +1,61 @@ + +#include "impl_org_ortc_OverconstrainedError.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::OverconstrainedError::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::OverconstrainedError::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::OverconstrainedError::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::OverconstrainedError::OverconstrainedError() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::OverconstrainedErrorPtr wrapper::org::ortc::OverconstrainedError::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::OverconstrainedError::~OverconstrainedError() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::OverconstrainedError::wrapper_init_org_ortc_OverconstrainedError() noexcept +{ +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return OverconstrainedErrorPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->name = native->mName; + pThis->message = native->mMessage; + pThis->constraint = native->mConstraint; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.h b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.h new file mode 100644 index 00000000..39caf664 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedError.h @@ -0,0 +1,33 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_ortc_OverconstrainedError.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct OverconstrainedError : public wrapper::org::ortc::OverconstrainedError + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrackTypes::OverconstrainedError, NativeType); + ZS_DECLARE_TYPEDEF_PTR(OverconstrainedError, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::OverconstrainedError, WrapperType); + OverconstrainedErrorWeakPtr thisWeak_; + + OverconstrainedError() noexcept; + virtual ~OverconstrainedError() noexcept; + void wrapper_init_org_ortc_OverconstrainedError() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.cpp new file mode 100644 index 00000000..919d07a8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.cpp @@ -0,0 +1,61 @@ + +#include "impl_org_ortc_OverconstrainedErrorEvent.h" +#include "impl_org_ortc_OverconstrainedError.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::OverconstrainedErrorEvent::OverconstrainedErrorEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::OverconstrainedErrorEventPtr wrapper::org::ortc::OverconstrainedErrorEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::OverconstrainedErrorEvent::~OverconstrainedErrorEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::OverconstrainedErrorEvent::wrapper_init_org_ortc_OverconstrainedErrorEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::OverconstrainedErrorPtr wrapper::impl::org::ortc::OverconstrainedErrorEvent::get_error() noexcept +{ + return error_; +} + +wrapper::impl::org::ortc::OverconstrainedErrorEventPtr wrapper::impl::org::ortc::OverconstrainedErrorEvent::toWrapper(OverconstrainedErrorPtr error) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->error_ = error; + pThis->wrapper_init_org_ortc_OverconstrainedErrorEvent(); + return pThis; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.h b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.h new file mode 100644 index 00000000..e2228ec3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_OverconstrainedErrorEvent.h @@ -0,0 +1,32 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_OverconstrainedErrorEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct OverconstrainedErrorEvent : public wrapper::org::ortc::OverconstrainedErrorEvent + { + OverconstrainedErrorEventWeakPtr thisWeak_; + OverconstrainedErrorPtr error_; + + OverconstrainedErrorEvent() noexcept; + virtual ~OverconstrainedErrorEvent() noexcept; + void wrapper_init_org_ortc_OverconstrainedErrorEvent() noexcept override; + + // properties OverconstrainedErrorEvent + wrapper::org::ortc::OverconstrainedErrorPtr get_error() noexcept override; + + static OverconstrainedErrorEventPtr toWrapper(OverconstrainedErrorPtr error) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCCertificate.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCCertificate.cpp new file mode 100644 index 00000000..1fad0666 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCCertificate.cpp @@ -0,0 +1,120 @@ + +#include "impl_org_ortc_RTCCertificate.h" +#include "impl_org_ortc_RTCDtlsFingerprint.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificate::RTCCertificate() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCCertificatePtr wrapper::org::ortc::RTCCertificate::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificate::~RTCCertificate() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCCertificatePtr > > wrapper::org::ortc::RTCCertificate::generateCertificate() noexcept(false) +{ + return impl::org::ortc::RTCCertificate::toWrapper(::ortc::ICertificate::generateCertificate()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCCertificatePtr > > wrapper::org::ortc::RTCCertificate::generateCertificate(String keygenAlgorithm) noexcept(false) +{ + if (keygenAlgorithm.isEmpty()) return generateCertificate(); + return impl::org::ortc::RTCCertificate::toWrapper(::ortc::ICertificate::generateCertificate(keygenAlgorithm)); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCCertificatePtr > > wrapper::org::ortc::RTCCertificate::generateCertificate(wrapper::org::ortc::JsonPtr keygenAlgorithm) noexcept +{ + if (!keygenAlgorithm) return generateCertificate(); + + auto native = impl::org::ortc::Json::toNative(keygenAlgorithm); + if (!native) return generateCertificate(); + + return impl::org::ortc::RTCCertificate::toWrapper(::ortc::ICertificate::generateCertificate(native)); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCCertificate::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCCertificate::get_expires() noexcept +{ + return native_->expires(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsFingerprintPtr wrapper::impl::org::ortc::RTCCertificate::get_fingerprint() noexcept +{ + return RTCDtlsFingerprint::toWrapper(native_->fingerprint()); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificate::PromiseWithTypePtr wrapper::impl::org::ortc::RTCCertificate::toWrapper(NativePromiseWithCertificatePtr promise) noexcept +{ + if (!promise) return PromiseWithTypePtr(); + + auto result = PromiseWithType::create(Helper::getGuiQueue()); + promise->thenClosure([result, promise] { + if (promise->isRejected()) { + Helper::reject(promise, result); + return; + } + + result->resolve(toWrapper(promise->value())); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificatePtr wrapper::impl::org::ortc::RTCCertificate::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return RTCCertificatePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificate::NativeTypePtr wrapper::impl::org::ortc::RTCCertificate::toNative(wrapper::org::ortc::RTCCertificatePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCCertificate.h b/ortc/idl/wrapper/impl_org_ortc_RTCCertificate.h new file mode 100644 index 00000000..846af96f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCCertificate.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCCertificate.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCCertificate : public wrapper::org::ortc::RTCCertificate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICertificate, NativeType); + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< wrapper::org::ortc::RTCCertificatePtr >, PromiseWithType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICertificateTypes::PromiseWithCertificate, NativePromiseWithCertificate); + + RTCCertificateWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCCertificate() noexcept; + virtual ~RTCCertificate() noexcept; + + // properties RTCCertificate + uint64_t get_objectId() noexcept override; + ::zsLib::Time get_expires() noexcept override; + wrapper::org::ortc::RTCDtlsFingerprintPtr get_fingerprint() noexcept override; + + static PromiseWithTypePtr toWrapper(NativePromiseWithCertificatePtr promise) noexcept; + static RTCCertificatePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(wrapper::org::ortc::RTCCertificatePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.cpp new file mode 100644 index 00000000..d8e3d35b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.cpp @@ -0,0 +1,143 @@ + +#include "impl_org_ortc_RTCCertificateStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificateStats::RTCCertificateStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCCertificateStatsPtr wrapper::org::ortc::RTCCertificateStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificateStats::~RTCCertificateStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCCertificateStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCCertificateStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCCertificateStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCCertificateStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCCertificateStats::wrapper_init_org_ortc_RTCCertificateStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCCertificateStats::wrapper_init_org_ortc_RTCCertificateStats(wrapper::org::ortc::RTCCertificateStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCCertificateStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCCertificateStats::wrapper_init_org_ortc_RTCCertificateStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::get_fingerprint() noexcept +{ + return native_->mFingerprint; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::get_fingerprintAlgorithm() noexcept +{ + return native_->mFingerprintAlgorithm; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::get_base64Certificate() noexcept +{ + return native_->mBase64Certificate; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCertificateStats::get_issuerCertificateId() noexcept +{ + return native_->mIssuerCertificateID; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificateStatsPtr wrapper::impl::org::ortc::RTCCertificateStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCCertificateStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCertificateStats::NativeStatsPtr wrapper::impl::org::ortc::RTCCertificateStats::toNative(wrapper::org::ortc::RTCCertificateStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.h new file mode 100644 index 00000000..8be42d3e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCCertificateStats.h @@ -0,0 +1,52 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCCertificateStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCCertificateStats : public wrapper::org::ortc::RTCCertificateStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::CertificateStats, NativeStats); + RTCCertificateStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCCertificateStats() noexcept; + virtual ~RTCCertificateStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCCertificateStats + void wrapper_init_org_ortc_RTCCertificateStats() noexcept override; + void wrapper_init_org_ortc_RTCCertificateStats(wrapper::org::ortc::RTCCertificateStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCCertificateStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCCertificateStats + String get_fingerprint() noexcept override; + String get_fingerprintAlgorithm() noexcept override; + String get_base64Certificate() noexcept override; + String get_issuerCertificateId() noexcept override; + + static RTCCertificateStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCCertificateStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCCodec.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCCodec.cpp new file mode 100644 index 00000000..1f123a99 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCCodec.cpp @@ -0,0 +1,149 @@ + +#include "impl_org_ortc_RTCCodec.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCodec::RTCCodec() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCCodecPtr wrapper::org::ortc::RTCCodec::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCodec::~RTCCodec() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCCodec::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCCodec")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCodec::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCCodec::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCCodec::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCodec::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCodec::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCCodec::wrapper_init_org_ortc_RTCCodec() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCCodec::wrapper_init_org_ortc_RTCCodec(wrapper::org::ortc::RTCCodecPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCCodec(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCCodec::wrapper_init_org_ortc_RTCCodec(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +Optional< uint8_t > wrapper::impl::org::ortc::RTCCodec::get_payloadType() noexcept +{ + return native_->mPayloadType; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCodec::get_codec() noexcept +{ + return native_->mCodec; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCCodec::get_clockRate() noexcept +{ + return native_->mClockRate; +} + +//------------------------------------------------------------------------------ +Optional< unsigned long > wrapper::impl::org::ortc::RTCCodec::get_channels() noexcept +{ + return native_->mChannels; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCCodec::get_parameters() noexcept +{ + return native_->mParameters; +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCodecPtr wrapper::impl::org::ortc::RTCCodec::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCCodecPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCCodec::NativeStatsPtr wrapper::impl::org::ortc::RTCCodec::toNative(wrapper::org::ortc::RTCCodecPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCCodec.h b/ortc/idl/wrapper/impl_org_ortc_RTCCodec.h new file mode 100644 index 00000000..7d7c782c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCCodec.h @@ -0,0 +1,53 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCCodec.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCCodec : public wrapper::org::ortc::RTCCodec + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::Codec, NativeStats); + RTCCodecWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCCodec() noexcept; + virtual ~RTCCodec() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCCodec + void wrapper_init_org_ortc_RTCCodec() noexcept override; + void wrapper_init_org_ortc_RTCCodec(wrapper::org::ortc::RTCCodecPtr source) noexcept override; + void wrapper_init_org_ortc_RTCCodec(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCCodec + Optional< uint8_t > get_payloadType() noexcept override; + String get_codec() noexcept override; + unsigned long get_clockRate() noexcept override; + Optional< unsigned long > get_channels() noexcept override; + String get_parameters() noexcept override; + + static RTCCodecPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCCodecPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.cpp new file mode 100644 index 00000000..b01a7b9b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.cpp @@ -0,0 +1,226 @@ + +#include "impl_org_ortc_RTCDataChannel.h" +#include "impl_org_ortc_RTCDataChannelParameters.h" +#include "impl_org_ortc_RTCDataTransport.h" +#include "impl_org_ortc_RTCMessageEvent.h" +#include "impl_org_ortc_RTCDataChannelStateChangeEvent.h" +#include "impl_org_ortc_ErrorEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannel::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannel::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannel::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannel::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannel::RTCDataChannel() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelPtr wrapper::org::ortc::RTCDataChannel::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannel::~RTCDataChannel() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCDataChannel::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::wrapper_init_org_ortc_RTCDataChannel( + wrapper::org::ortc::RTCDataTransportPtr transport, + wrapper::org::ortc::RTCDataChannelParametersPtr params + ) noexcept(false) +{ + auto native = RTCDataChannelParameters::toNative(params); + ZS_THROW_INVALID_ARGUMENT_IF(!params); + native_ = NativeType::create(thisWeak_.lock(), RTCDataTransport::toNative(transport), *native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::close() noexcept +{ + native_->close(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::send(String text) noexcept(false) +{ + native_->send(text); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::send(SecureByteBlockPtr data) noexcept(false) +{ + if (!data) return; + native_->send(*data); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCDataChannel::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataTransportPtr wrapper::impl::org::ortc::RTCDataChannel::get_transport() noexcept +{ + return RTCDataTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelParametersPtr wrapper::impl::org::ortc::RTCDataChannel::get_parameters() noexcept +{ + return RTCDataChannelParameters::toWrapper(native_->parameters()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelState wrapper::impl::org::ortc::RTCDataChannel::get_readyState() noexcept +{ + return Helper::toWrapper(native_->readyState()); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCDataChannel::get_bufferedAmount() noexcept +{ + return SafeInt(native_->bufferedAmount()); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCDataChannel::get_bufferedAmountLowThreshold() noexcept +{ + return SafeInt(native_->bufferedAmountLowThreshold()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::set_bufferedAmountLowThreshold(uint64_t value) noexcept +{ + native_->bufferedAmountLowThreshold(SafeInt(value)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannel::get_binaryType() noexcept +{ + return native_->binaryType(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::set_binaryType(String value) noexcept +{ + native_->binaryType(value); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannel::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDataChannelStateChange( + IDataChannelPtr channel, + ::ortc::IDataChannelTypes::States state +) noexcept +{ + onStateChange(RTCDataChannelStateChangeEvent::toWrapper(state)); + + switch (state) { + case ::ortc::IDataChannelTypes::State_Open: onOpen(); break; + case ::ortc::IDataChannelTypes::State_Closed: onClose(); break; + default: break; + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDataChannelError( + IDataChannelPtr channel, + ::ortc::ErrorAnyPtr error +) noexcept +{ + onError(ErrorEvent::toWrapper(error)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDataChannelBufferedAmountLow(IDataChannelPtr channel) noexcept +{ + onBufferedAmountLow(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDataChannelMessage( + IDataChannelPtr channel, + MessageEventDataPtr data +) noexcept +{ + onMessage(RTCMessageEvent::toWrapper(data)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.h b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.h new file mode 100644 index 00000000..afc01630 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannel.h @@ -0,0 +1,85 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDataChannel.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDataChannel : public wrapper::org::ortc::RTCDataChannel, + public ::ortc::IDataChannelDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannel, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannel, IDataChannel); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannelSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCDataChannel, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDataChannel, WrapperType); + + RTCDataChannelWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCDataChannel() noexcept; + virtual ~RTCDataChannel() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCDataChannel + void wrapper_init_org_ortc_RTCDataChannel( + wrapper::org::ortc::RTCDataTransportPtr transport, + wrapper::org::ortc::RTCDataChannelParametersPtr params + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void close() noexcept override; + void send(String text) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void send(SecureByteBlockPtr data) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // properties RTCDataChannel + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCDataTransportPtr get_transport() noexcept override; + wrapper::org::ortc::RTCDataChannelParametersPtr get_parameters() noexcept override; + wrapper::org::ortc::RTCDataChannelState get_readyState() noexcept override; + uint64_t get_bufferedAmount() noexcept override; + uint64_t get_bufferedAmountLowThreshold() noexcept override; + void set_bufferedAmountLowThreshold(uint64_t value) noexcept override; + String get_binaryType() noexcept override; + void set_binaryType(String value) noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onDataChannelStateChange( + IDataChannelPtr channel, + ::ortc::IDataChannelTypes::States state + ) noexcept override; + + virtual void onDataChannelError( + IDataChannelPtr channel, + ::ortc::ErrorAnyPtr error + ) noexcept override; + + virtual void onDataChannelBufferedAmountLow(IDataChannelPtr channel) noexcept override; + + virtual void onDataChannelMessage( + IDataChannelPtr channel, + MessageEventDataPtr data + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.cpp new file mode 100644 index 00000000..4336df73 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.cpp @@ -0,0 +1,60 @@ + +#include "impl_org_ortc_RTCDataChannelEvent.h" +#include "impl_org_ortc_RTCDataChannel.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelEvent::RTCDataChannelEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelEventPtr wrapper::org::ortc::RTCDataChannelEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelEvent::~RTCDataChannelEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelPtr wrapper::impl::org::ortc::RTCDataChannelEvent::get_dataChannel() noexcept +{ + return RTCDataChannel::toWrapper(native_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.h new file mode 100644 index 00000000..e9abdb36 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDataChannelEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDataChannelEvent : public wrapper::org::ortc::RTCDataChannelEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannel, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDataChannelEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDataChannelEvent, WrapperType); + RTCDataChannelEventWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCDataChannelEvent() noexcept; + virtual ~RTCDataChannelEvent() noexcept; + + // properties RTCDataChannelEvent + wrapper::org::ortc::RTCDataChannelPtr get_dataChannel() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.cpp new file mode 100644 index 00000000..65b046af --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_ortc_RTCDataChannelParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelParameters::RTCDataChannelParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelParametersPtr wrapper::org::ortc::RTCDataChannelParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelParameters::~RTCDataChannelParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannelParameters::wrapper_init_org_ortc_RTCDataChannelParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannelParameters::wrapper_init_org_ortc_RTCDataChannelParameters(wrapper::org::ortc::RTCDataChannelParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannelParameters::wrapper_init_org_ortc_RTCDataChannelParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCDataChannelParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCDataChannelParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannelParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->label = native.mLabel; + pThis->ordered = native.mOrdered; + pThis->maxPacketLifetime = native.mMaxPacketLifetime; + pThis->maxRetransmits = native.mMaxRetransmits; + pThis->protocol = native.mProtocol; + pThis->negotiated = native.mNegotiated; + Helper::optionalSafeIntConvert(native.mID, pThis->id); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mLabel = wrapper->label; + result->mOrdered = wrapper->ordered; + result->mMaxPacketLifetime = wrapper->maxPacketLifetime; + result->mMaxRetransmits = wrapper->maxRetransmits; + result->mProtocol = wrapper->protocol; + result->mNegotiated = wrapper->negotiated; + Helper::optionalSafeIntConvert(wrapper->id, result->mID); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.h new file mode 100644 index 00000000..d043045a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDataChannelParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDataChannelParameters : public wrapper::org::ortc::RTCDataChannelParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannelTypes::Parameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDataChannelParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDataChannelParameters, WrapperType); + RTCDataChannelParametersWeakPtr thisWeak_; + + RTCDataChannelParameters() noexcept; + virtual ~RTCDataChannelParameters() noexcept; + + // methods RTCDataChannelParameters + void wrapper_init_org_ortc_RTCDataChannelParameters() noexcept override; + void wrapper_init_org_ortc_RTCDataChannelParameters(wrapper::org::ortc::RTCDataChannelParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCDataChannelParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.cpp new file mode 100644 index 00000000..0bdad8eb --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.cpp @@ -0,0 +1,60 @@ + +#include "impl_org_ortc_RTCDataChannelStateChangeEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelStateChangeEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelStateChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataChannelStateChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelStateChangeEvent::RTCDataChannelStateChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelStateChangeEventPtr wrapper::org::ortc::RTCDataChannelStateChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelStateChangeEvent::~RTCDataChannelStateChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelState wrapper::impl::org::ortc::RTCDataChannelStateChangeEvent::get_state() noexcept +{ + return Helper::toWrapper(native_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.h new file mode 100644 index 00000000..8c44331f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStateChangeEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDataChannelStateChangeEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDataChannelStateChangeEvent : public wrapper::org::ortc::RTCDataChannelStateChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannelTypes::States, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDataChannelStateChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDataChannelStateChangeEvent, WrapperType); + RTCDataChannelStateChangeEventWeakPtr thisWeak_; + NativeType native_; + + RTCDataChannelStateChangeEvent() noexcept; + virtual ~RTCDataChannelStateChangeEvent() noexcept; + + // properties RTCDataChannelStateChangeEvent + wrapper::org::ortc::RTCDataChannelState get_state() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeType native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.cpp new file mode 100644 index 00000000..cffb5f18 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.cpp @@ -0,0 +1,168 @@ + +#include "impl_org_ortc_RTCDataChannelStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelStats::RTCDataChannelStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelStatsPtr wrapper::org::ortc::RTCDataChannelStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelStats::~RTCDataChannelStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCDataChannelStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCDataChannelStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannelStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCDataChannelStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCDataChannelStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannelStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannelStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannelStats::wrapper_init_org_ortc_RTCDataChannelStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannelStats::wrapper_init_org_ortc_RTCDataChannelStats(wrapper::org::ortc::RTCDataChannelStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCDataChannelStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDataChannelStats::wrapper_init_org_ortc_RTCDataChannelStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannelStats::get_label() noexcept +{ + return native_->mLabel; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDataChannelStats::get_protocol() noexcept +{ + return native_->mProtocol; +} + +//------------------------------------------------------------------------------ +long wrapper::impl::org::ortc::RTCDataChannelStats::get_dataChannelId() noexcept +{ + return native_->mDataChannelID; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataChannelState wrapper::impl::org::ortc::RTCDataChannelStats::get_state() noexcept +{ + return Helper::toWrapper(native_->mState); +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCDataChannelStats::get_messagesSent() noexcept +{ + return native_->mMessagesSent; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCDataChannelStats::get_bytesSent() noexcept +{ + return native_->mBytesSent; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCDataChannelStats::get_messagesReceived() noexcept +{ + return native_->mMessagesReceived; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCDataChannelStats::get_bytesReceived() noexcept +{ + return native_->mBytesReceived; +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelStatsPtr wrapper::impl::org::ortc::RTCDataChannelStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCDataChannelStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataChannelStats::NativeStatsPtr wrapper::impl::org::ortc::RTCDataChannelStats::toNative(wrapper::org::ortc::RTCDataChannelStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.h new file mode 100644 index 00000000..7ada8e0a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataChannelStats.h @@ -0,0 +1,56 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDataChannelStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDataChannelStats : public wrapper::org::ortc::RTCDataChannelStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::DataChannelStats, NativeStats); + RTCDataChannelStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCDataChannelStats() noexcept; + virtual ~RTCDataChannelStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCDataChannelStats + void wrapper_init_org_ortc_RTCDataChannelStats() noexcept override; + void wrapper_init_org_ortc_RTCDataChannelStats(wrapper::org::ortc::RTCDataChannelStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCDataChannelStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCDataChannelStats + String get_label() noexcept override; + String get_protocol() noexcept override; + long get_dataChannelId() noexcept override; + wrapper::org::ortc::RTCDataChannelState get_state() noexcept override; + unsigned long get_messagesSent() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long get_messagesReceived() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + + static RTCDataChannelStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCDataChannelStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.cpp new file mode 100644 index 00000000..2b6c34d6 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.cpp @@ -0,0 +1,72 @@ + +#include "impl_org_ortc_RTCDataTransport.h" +#include "impl_org_ortc_RTCSctpTransport.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDataTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataTransport::RTCDataTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDataTransportPtr wrapper::org::ortc::RTCDataTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDataTransport::~RTCDataTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCSctpTransport::toNative(impl); + } + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return impl->native_; + } + return NativeTypePtr(); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.h new file mode 100644 index 00000000..7af0f619 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDataTransport.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDataTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDataTransport : public wrapper::org::ortc::RTCDataTransport + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDataTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDataTransport, WrapperType); + RTCDataTransportWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCDataTransport() noexcept; + virtual ~RTCDataTransport() noexcept; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.cpp new file mode 100644 index 00000000..02ee8c73 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.cpp @@ -0,0 +1,76 @@ + +#include "impl_org_ortc_RTCDtlsCertificateBinary.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsCertificateBinary::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsCertificateBinary::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsCertificateBinary::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsCertificateBinary::RTCDtlsCertificateBinary() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsCertificateBinaryPtr wrapper::org::ortc::RTCDtlsCertificateBinary::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsCertificateBinary::~RTCDtlsCertificateBinary() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +SecureByteBlockPtr wrapper::impl::org::ortc::RTCDtlsCertificateBinary::get_certificate() noexcept +{ + return native_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = make_shared(native); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto impl = std::dynamic_pointer_cast(wrapper); + if (!impl) return NativeTypePtr(); + + return impl->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.h new file mode 100644 index 00000000..b819b262 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsCertificateBinary.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtlsCertificateBinary.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtlsCertificateBinary : public wrapper::org::ortc::RTCDtlsCertificateBinary + { + ZS_DECLARE_TYPEDEF_PTR(::zsLib::eventing::SecureByteBlock, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDtlsCertificateBinary, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtlsCertificateBinary, WrapperType); + RTCDtlsCertificateBinaryWeakPtr thisWeak_; + SecureByteBlockPtr native_; + + RTCDtlsCertificateBinary() noexcept; + virtual ~RTCDtlsCertificateBinary() noexcept; + + // properties RTCDtlsCertificateBinary + SecureByteBlockPtr get_certificate() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.cpp new file mode 100644 index 00000000..2c1d439b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.cpp @@ -0,0 +1,110 @@ + +#include "impl_org_ortc_RTCDtlsFingerprint.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsFingerprint::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsFingerprint::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsFingerprint::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsFingerprint::RTCDtlsFingerprint() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsFingerprintPtr wrapper::org::ortc::RTCDtlsFingerprint::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsFingerprint::~RTCDtlsFingerprint() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsFingerprint::wrapper_init_org_ortc_RTCDtlsFingerprint() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsFingerprint::wrapper_init_org_ortc_RTCDtlsFingerprint(wrapper::org::ortc::RTCDtlsFingerprintPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsFingerprint::wrapper_init_org_ortc_RTCDtlsFingerprint(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCDtlsFingerprint::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsFingerprint::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->algorithm = native.mAlgorithm; + pThis->value = native.mValue; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mAlgorithm = wrapper->algorithm; + result->mValue = wrapper->value; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.h new file mode 100644 index 00000000..f0627353 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsFingerprint.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtlsFingerprint.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtlsFingerprint : public wrapper::org::ortc::RTCDtlsFingerprint + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ICertificateTypes::Fingerprint, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDtlsFingerprint, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtlsFingerprint, WrapperType); + RTCDtlsFingerprintWeakPtr thisWeak_; + + RTCDtlsFingerprint() noexcept; + virtual ~RTCDtlsFingerprint() noexcept; + + // methods RTCDtlsFingerprint + void wrapper_init_org_ortc_RTCDtlsFingerprint() noexcept override; + void wrapper_init_org_ortc_RTCDtlsFingerprint(wrapper::org::ortc::RTCDtlsFingerprintPtr source) noexcept override; + void wrapper_init_org_ortc_RTCDtlsFingerprint(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.cpp new file mode 100644 index 00000000..ef5f47e8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.cpp @@ -0,0 +1,123 @@ + +#include "impl_org_ortc_RTCDtlsParameters.h" +#include "impl_org_ortc_RTCDtlsFingerprint.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsParameters::RTCDtlsParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsParametersPtr wrapper::org::ortc::RTCDtlsParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsParameters::~RTCDtlsParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsParameters::wrapper_init_org_ortc_RTCDtlsParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsParameters::wrapper_init_org_ortc_RTCDtlsParameters(wrapper::org::ortc::RTCDtlsParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsParameters::wrapper_init_org_ortc_RTCDtlsParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCDtlsParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCDtlsParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->role = Helper::toWrapper(native.mRole); + pThis->fingerprints = make_shared< list< wrapper::org::ortc::RTCDtlsFingerprintPtr > >(); + for (auto iter = native.mFingerprints.begin(); iter != native.mFingerprints.end(); ++iter) { + auto wrapper = RTCDtlsFingerprint::toWrapper(*iter); + if (!wrapper) continue; + pThis->fingerprints->push_back(wrapper); + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mRole = Helper::toNative(wrapper->role); + if (wrapper->fingerprints) { + for (auto iter = wrapper->fingerprints->begin(); iter != wrapper->fingerprints->end(); ++iter) { + auto native = RTCDtlsFingerprint::toNative(*iter); + if (!native) continue; + result->mFingerprints.push_back(*native); + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.h new file mode 100644 index 00000000..f65c5d4f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtlsParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtlsParameters : public wrapper::org::ortc::RTCDtlsParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTLSTransportTypes::Parameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDtlsParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtlsParameters, WrapperType); + RTCDtlsParametersWeakPtr thisWeak_; + + RTCDtlsParameters() noexcept; + virtual ~RTCDtlsParameters() noexcept; + + // methods RTCDtlsParameters + void wrapper_init_org_ortc_RTCDtlsParameters() noexcept override; + void wrapper_init_org_ortc_RTCDtlsParameters(wrapper::org::ortc::RTCDtlsParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCDtlsParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.cpp new file mode 100644 index 00000000..ea59cadf --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.cpp @@ -0,0 +1,218 @@ + +#include "impl_org_ortc_RTCDtlsTransport.h" +#include "impl_org_ortc_RTCDtlsParameters.h" +#include "impl_org_ortc_RTCIceTransport.h" +#include "impl_org_ortc_RTCCertificate.h" +#include "impl_org_ortc_RTCDtlsTransportStateChangeEvent.h" +#include "impl_org_ortc_RTCDtlsCertificateBinary.h" +#include "impl_org_ortc_ErrorEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsTransport::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransport::RTCDtlsTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsTransportPtr wrapper::org::ortc::RTCDtlsTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransport::~RTCDtlsTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCDtlsTransport::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransport::wrapper_init_org_ortc_RTCDtlsTransport( + wrapper::org::ortc::RTCIceTransportPtr iceTransport, + shared_ptr< list< wrapper::org::ortc::RTCCertificatePtr > > certificates + ) noexcept(false) +{ + ZS_THROW_INVALID_ARGUMENT_IF(!iceTransport); + + list< ::ortc::ICertificatePtr > nativeList; + if (certificates) { + for (auto iter = certificates->begin(); iter != certificates->end(); ++iter) { + auto native = RTCCertificate::toNative(*iter); + if (!native) continue; + nativeList.push_back(native); + } + } + + native_ = IDTLSTransport::create(thisWeak_.lock(), RTCIceTransport::toNative(iceTransport), nativeList); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsParametersPtr wrapper::impl::org::ortc::RTCDtlsTransport::remoteParameters() noexcept +{ + return RTCDtlsParameters::toWrapper(native_->getRemoteParameters()); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCDtlsCertificateBinaryPtr > > wrapper::impl::org::ortc::RTCDtlsTransport::getRemoteCertificates() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::RTCDtlsCertificateBinaryPtr > >(); + auto native = native_->getRemoteCertificates(); + if (native) { + for (auto iter = native->begin(); iter != native->end(); ++iter) { + auto wrapper = RTCDtlsCertificateBinary::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + } + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransport::start(wrapper::org::ortc::RTCDtlsParametersPtr remoteParameters) noexcept(false) +{ + ZS_THROW_INVALID_ARGUMENT_IF(!remoteParameters); + auto native = RTCDtlsParameters::toNative(remoteParameters); + ZS_THROW_INVALID_ARGUMENT_IF(!native); + native_->start(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransport::stop() noexcept +{ + native_->stop(); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCDtlsTransport::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCCertificatePtr > > wrapper::impl::org::ortc::RTCDtlsTransport::get_certificates() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::RTCCertificatePtr > >(); + auto native = native_->certificates(); + if (native) { + for (auto iter = native->begin(); iter != native->end(); ++iter) { + auto wrapper = RTCCertificate::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + } + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportPtr wrapper::impl::org::ortc::RTCDtlsTransport::get_transport() noexcept +{ + return RTCIceTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsTransportState wrapper::impl::org::ortc::RTCDtlsTransport::get_state() noexcept +{ + return Helper::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsParametersPtr wrapper::impl::org::ortc::RTCDtlsTransport::get_localParameters() noexcept +{ + return RTCDtlsParameters::toWrapper(native_->getLocalParameters()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransport::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDTLSTransportStateChange( + IDTLSTransportPtr transport, + IDTLSTransport::States state + ) noexcept +{ + onStateChange(RTCDtlsTransportStateChangeEvent::toWrapper(Helper::toWrapper(state))); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDTLSTransportError( + IDTLSTransportPtr transport, + ::ortc::ErrorAnyPtr error + ) noexcept +{ + onError(ErrorEvent::toWrapper(error)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.h new file mode 100644 index 00000000..c2dee0cb --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransport.h @@ -0,0 +1,75 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtlsTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtlsTransport : public wrapper::org::ortc::RTCDtlsTransport, + public ::ortc::IDTLSTransportDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTLSTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTLSTransport, IDTLSTransport); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTLSTransportSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCDtlsTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtlsTransport, WrapperType); + RTCDtlsTransportWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCDtlsTransport() noexcept; + virtual ~RTCDtlsTransport() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCDtlsTransport + void wrapper_init_org_ortc_RTCDtlsTransport( + wrapper::org::ortc::RTCIceTransportPtr iceTransport, + shared_ptr< list< wrapper::org::ortc::RTCCertificatePtr > > certificates + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + wrapper::org::ortc::RTCDtlsParametersPtr remoteParameters() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCDtlsCertificateBinaryPtr > > getRemoteCertificates() noexcept override; + void start(wrapper::org::ortc::RTCDtlsParametersPtr remoteParameters) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void stop() noexcept override; + + // properties RTCDtlsTransport + uint64_t get_objectId() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCCertificatePtr > > get_certificates() noexcept override; + wrapper::org::ortc::RTCIceTransportPtr get_transport() noexcept override; + wrapper::org::ortc::RTCDtlsTransportState get_state() noexcept override; + wrapper::org::ortc::RTCDtlsParametersPtr get_localParameters() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + // IDTLSTransportDelegate + void onDTLSTransportStateChange( + IDTLSTransportPtr transport, + IDTLSTransport::States state + ) noexcept override; + + void onDTLSTransportError( + IDTLSTransportPtr transport, + ::ortc::ErrorAnyPtr error + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp new file mode 100644 index 00000000..fb54f5c0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp @@ -0,0 +1,57 @@ + +#include "impl_org_ortc_RTCDtlsTransportStateChangeEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsTransportStateChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtlsTransportStateChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransportStateChangeEvent::RTCDtlsTransportStateChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsTransportStateChangeEventPtr wrapper::org::ortc::RTCDtlsTransportStateChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransportStateChangeEvent::~RTCDtlsTransportStateChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsTransportState wrapper::impl::org::ortc::RTCDtlsTransportStateChangeEvent::get_state() noexcept +{ + return state_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(wrapper::org::ortc::RTCDtlsTransportState state) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->state_ = state; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.h new file mode 100644 index 00000000..f0812f71 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStateChangeEvent.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtlsTransportStateChangeEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtlsTransportStateChangeEvent : public wrapper::org::ortc::RTCDtlsTransportStateChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCDtlsTransportStateChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtlsTransportStateChangeEvent, WrapperType); + RTCDtlsTransportStateChangeEventWeakPtr thisWeak_; + wrapper::org::ortc::RTCDtlsTransportState state_ {wrapper::org::ortc::RTCDtlsTransportState_new}; + + RTCDtlsTransportStateChangeEvent() noexcept; + virtual ~RTCDtlsTransportStateChangeEvent() noexcept; + + // properties RTCDtlsTransportStateChangeEvent + wrapper::org::ortc::RTCDtlsTransportState get_state() noexcept override; + + static WrapperImplTypePtr toWrapper(wrapper::org::ortc::RTCDtlsTransportState state) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.cpp new file mode 100644 index 00000000..708a37ca --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.cpp @@ -0,0 +1,130 @@ + +#include "impl_org_ortc_RTCDtlsTransportStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransportStats::RTCDtlsTransportStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsTransportStatsPtr wrapper::org::ortc::RTCDtlsTransportStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransportStats::~RTCDtlsTransportStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCDtlsTransportStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCDtlsTransportStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsTransportStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCDtlsTransportStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCDtlsTransportStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsTransportStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsTransportStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransportStats::wrapper_init_org_ortc_RTCDtlsTransportStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransportStats::wrapper_init_org_ortc_RTCDtlsTransportStats(wrapper::org::ortc::RTCDtlsTransportStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCDtlsTransportStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtlsTransportStats::wrapper_init_org_ortc_RTCDtlsTransportStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsTransportStats::get_localCertificateId() noexcept +{ + return native_->mLocalCertificateID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtlsTransportStats::get_remoteCertificateId() noexcept +{ + return native_->mRemoteCertificateID; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransportStatsPtr wrapper::impl::org::ortc::RTCDtlsTransportStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCDtlsTransportStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtlsTransportStats::NativeStatsPtr wrapper::impl::org::ortc::RTCDtlsTransportStats::toNative(wrapper::org::ortc::RTCDtlsTransportStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.h new file mode 100644 index 00000000..67ef38e5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtlsTransportStats.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtlsTransportStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtlsTransportStats : public wrapper::org::ortc::RTCDtlsTransportStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::DTLSTransportStats, NativeStats); + RTCDtlsTransportStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCDtlsTransportStats() noexcept; + virtual ~RTCDtlsTransportStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCDtlsTransportStats + void wrapper_init_org_ortc_RTCDtlsTransportStats() noexcept override; + void wrapper_init_org_ortc_RTCDtlsTransportStats(wrapper::org::ortc::RTCDtlsTransportStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCDtlsTransportStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCDtlsTransportStats + String get_localCertificateId() noexcept override; + String get_remoteCertificateId() noexcept override; + + static RTCDtlsTransportStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCDtlsTransportStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.cpp new file mode 100644 index 00000000..8f044305 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.cpp @@ -0,0 +1,169 @@ + +#include "impl_org_ortc_RTCDtmfSender.h" +#include "impl_org_ortc_RTCRtpSender.h" +#include "impl_org_ortc_RTCDtmfToneChangeEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfSender::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfSender::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfSender::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfSender::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtmfSender::RTCDtmfSender() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtmfSenderPtr wrapper::org::ortc::RTCDtmfSender::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtmfSender::~RTCDtmfSender() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtmfSender::wrapper_init_org_ortc_RTCDtmfSender(wrapper::org::ortc::RTCRtpSenderPtr sender) noexcept(false) +{ + native_ = NativeType::create(thisWeak_.lock(), RTCRtpSender::toNative(sender)); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCDtmfSender::canInsertDtmf() noexcept +{ + return native_->canInsertDTMF(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtmfSender::insertDtmf(String tones) noexcept(false) +{ + native_->insertDTMF(tones); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtmfSender::insertDtmf( + String tones, + ::zsLib::Milliseconds duration + ) noexcept(false) +{ + native_->insertDTMF(tones, duration); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtmfSender::insertDtmf( + String tones, + ::zsLib::Milliseconds duration, + ::zsLib::Milliseconds interToneGap + ) noexcept(false) +{ + native_->insertDTMF(tones, duration, interToneGap); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCDtmfSender::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpSenderPtr wrapper::impl::org::ortc::RTCDtmfSender::get_sender() noexcept +{ + return RTCRtpSender::toWrapper(native_->sender()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtmfSender::get_toneBuffer() noexcept +{ + return native_->toneBuffer(); +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::ortc::RTCDtmfSender::get_duration() noexcept +{ + return native_->duration(); +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::ortc::RTCDtmfSender::get_interToneGap() noexcept +{ + return native_->interToneGap(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCDtmfSender::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onDTMFSenderToneChanged( + IDTMFSenderPtr sender, + String tone +) noexcept +{ + onToneChange(RTCDtmfToneChangeEvent::toWrapper(tone)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.h new file mode 100644 index 00000000..0ed1a8b5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfSender.h @@ -0,0 +1,70 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtmfSender.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtmfSender : public wrapper::org::ortc::RTCDtmfSender, + public ::ortc::IDTMFSenderDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTMFSender, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTMFSender, IDTMFSender); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDTMFSenderSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCDtmfSender, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtmfSender, WrapperType); + RTCDtmfSenderWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCDtmfSender() noexcept; + virtual ~RTCDtmfSender() noexcept; + + // methods RTCDtmfSender + void wrapper_init_org_ortc_RTCDtmfSender(wrapper::org::ortc::RTCRtpSenderPtr sender) noexcept(false) override; // throws ::zsLib::Exceptions::BadState + bool canInsertDtmf() noexcept override; + void insertDtmf(String tones) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void insertDtmf( + String tones, + ::zsLib::Milliseconds duration + ) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void insertDtmf( + String tones, + ::zsLib::Milliseconds duration, + ::zsLib::Milliseconds interToneGap + ) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + + // properties RTCDtmfSender + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCRtpSenderPtr get_sender() noexcept override; + String get_toneBuffer() noexcept override; + ::zsLib::Milliseconds get_duration() noexcept override; + ::zsLib::Milliseconds get_interToneGap() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onDTMFSenderToneChanged( + IDTMFSenderPtr sender, + String tone + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.cpp new file mode 100644 index 00000000..b45c7382 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.cpp @@ -0,0 +1,61 @@ + +#include "impl_org_ortc_RTCDtmfToneChangeEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfToneChangeEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfToneChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCDtmfToneChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtmfToneChangeEvent::RTCDtmfToneChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtmfToneChangeEventPtr wrapper::org::ortc::RTCDtmfToneChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCDtmfToneChangeEvent::~RTCDtmfToneChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCDtmfToneChangeEvent::get_tone() noexcept +{ + return native_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.h new file mode 100644 index 00000000..164c1e5d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCDtmfToneChangeEvent.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCDtmfToneChangeEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCDtmfToneChangeEvent : public wrapper::org::ortc::RTCDtmfToneChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(String, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCDtmfToneChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCDtmfToneChangeEvent, WrapperType); + RTCDtmfToneChangeEventWeakPtr thisWeak_; + NativeType native_; + + RTCDtmfToneChangeEvent() noexcept; + virtual ~RTCDtmfToneChangeEvent() noexcept; + + // properties RTCDtmfToneChangeEvent + String get_tone() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeType native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.cpp new file mode 100644 index 00000000..c0e7128a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.cpp @@ -0,0 +1,166 @@ + +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidate::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidate::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidate::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidate::RTCIceCandidate() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePtr wrapper::org::ortc::RTCIceCandidate::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidate::~RTCIceCandidate() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidate::wrapper_init_org_ortc_RTCIceCandidate() noexcept +{ + native_ = make_shared< NativeType >(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceCandidate::toJson() noexcept +{ + return Json::toWrapper(native_->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidate::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceComponent wrapper::impl::org::ortc::RTCIceCandidate::get_component() noexcept +{ + return Helper::toWrapper(native_->mComponent); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidate::get_interfaceType() noexcept +{ + return native_->mInterfaceType; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidate::get_foundation() noexcept +{ + return native_->mFoundation; +} + +//------------------------------------------------------------------------------ +uint32_t wrapper::impl::org::ortc::RTCIceCandidate::get_priority() noexcept +{ + return native_->mPriority; +} + +//------------------------------------------------------------------------------ +uint32_t wrapper::impl::org::ortc::RTCIceCandidate::get_unfreezePriority() noexcept +{ + return native_->mUnfreezePriority; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceProtocol wrapper::impl::org::ortc::RTCIceCandidate::get_protocol() noexcept +{ + return Helper::toWrapper(native_->mProtocol); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidate::get_ip() noexcept +{ + return native_->mIP; +} + +//------------------------------------------------------------------------------ +uint16_t wrapper::impl::org::ortc::RTCIceCandidate::get_port() noexcept +{ + return native_->mPort; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidateType wrapper::impl::org::ortc::RTCIceCandidate::get_candidateType() noexcept +{ + return Helper::toWrapper(native_->mCandidateType); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTcpCandidateType wrapper::impl::org::ortc::RTCIceCandidate::get_tcpType() noexcept +{ + return Helper::toWrapper(native_->mTCPType); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidate::get_relatedAddress() noexcept +{ + return native_->mRelatedAddress; +} + +//------------------------------------------------------------------------------ +uint16_t wrapper::impl::org::ortc::RTCIceCandidate::get_relatedPort() noexcept +{ + return native_->mRelatedPort; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + return std::dynamic_pointer_cast(wrapper)->native_; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(wrapper::org::ortc::RTCIceGathererCandidatePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + + return result->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.h new file mode 100644 index 00000000..48ce2efc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidate.h @@ -0,0 +1,55 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceCandidate.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceCandidate : public wrapper::org::ortc::RTCIceCandidate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETypes::Candidate, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceCandidate, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceCandidate, WrapperType); + RTCIceCandidateWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCIceCandidate() noexcept; + virtual ~RTCIceCandidate() noexcept; + + // methods RTCIceGathererCandidate + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCIceGathererCandidate + wrapper::org::ortc::RTCIceComponent get_component() noexcept override; + void wrapper_init_org_ortc_RTCIceCandidate() noexcept override; + + // properties RTCIceCandidate + String get_interfaceType() noexcept override; + String get_foundation() noexcept override; + uint32_t get_priority() noexcept override; + uint32_t get_unfreezePriority() noexcept override; + wrapper::org::ortc::RTCIceProtocol get_protocol() noexcept override; + String get_ip() noexcept override; + uint16_t get_port() noexcept override; + wrapper::org::ortc::RTCIceCandidateType get_candidateType() noexcept override; + wrapper::org::ortc::RTCIceTcpCandidateType get_tcpType() noexcept override; + String get_relatedAddress() noexcept override; + uint16_t get_relatedPort() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + static NativeTypePtr toNative(wrapper::org::ortc::RTCIceGathererCandidatePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.cpp new file mode 100644 index 00000000..cf462883 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.cpp @@ -0,0 +1,162 @@ + +#include "impl_org_ortc_RTCIceCandidateAttributes.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidateAttributes::RTCIceCandidateAttributes() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidateAttributesPtr wrapper::org::ortc::RTCIceCandidateAttributes::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidateAttributes::~RTCIceCandidateAttributes() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceCandidateAttributes::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCIceCandidateAttributes")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidateAttributes::wrapper_init_org_ortc_RTCIceCandidateAttributes() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidateAttributes::wrapper_init_org_ortc_RTCIceCandidateAttributes(wrapper::org::ortc::RTCIceCandidateAttributesPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCIceCandidateAttributes(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidateAttributes::wrapper_init_org_ortc_RTCIceCandidateAttributes(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_relatedId() noexcept +{ + return native_->mRelatedID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_ipAddress() noexcept +{ + return native_->mIPAddress; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_portNumber() noexcept +{ + return native_->mPortNumber; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_transport() noexcept +{ + return native_->mTransport; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidateType wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_candidateType() noexcept +{ + return Helper::toWrapper(native_->mCandidateType); +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_priority() noexcept +{ + return native_->mPriority; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateAttributes::get_addressSourceUrl() noexcept +{ + return native_->mAddressSourceURL; +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidateAttributesPtr wrapper::impl::org::ortc::RTCIceCandidateAttributes::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCIceCandidateAttributesPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidateAttributes::NativeStatsPtr wrapper::impl::org::ortc::RTCIceCandidateAttributes::toNative(wrapper::org::ortc::RTCIceCandidateAttributesPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.h new file mode 100644 index 00000000..b2aa1c75 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateAttributes.h @@ -0,0 +1,55 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceCandidateAttributes.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceCandidateAttributes : public wrapper::org::ortc::RTCIceCandidateAttributes + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::ICECandidateAttributes, NativeStats); + RTCIceCandidateAttributesWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCIceCandidateAttributes() noexcept; + virtual ~RTCIceCandidateAttributes() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCIceCandidateAttributes + void wrapper_init_org_ortc_RTCIceCandidateAttributes() noexcept override; + void wrapper_init_org_ortc_RTCIceCandidateAttributes(wrapper::org::ortc::RTCIceCandidateAttributesPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceCandidateAttributes(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCIceCandidateAttributes + String get_relatedId() noexcept override; + String get_ipAddress() noexcept override; + unsigned long get_portNumber() noexcept override; + String get_transport() noexcept override; + wrapper::org::ortc::RTCIceCandidateType get_candidateType() noexcept override; + unsigned long get_priority() noexcept override; + String get_addressSourceUrl() noexcept override; + + static RTCIceCandidateAttributesPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCIceCandidateAttributesPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.cpp new file mode 100644 index 00000000..94638852 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.cpp @@ -0,0 +1,107 @@ + +#include "impl_org_ortc_RTCIceCandidateComplete.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidateComplete::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidateComplete::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidateComplete::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidateComplete::RTCIceCandidateComplete() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidateCompletePtr wrapper::org::ortc::RTCIceCandidateComplete::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidateComplete::~RTCIceCandidateComplete() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidateComplete::wrapper_init_org_ortc_RTCIceCandidateComplete() noexcept +{ + native_ = make_shared< NativeType >(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceCandidateComplete::toJson() noexcept +{ + return Json::toWrapper(native_->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidateComplete::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceComponent wrapper::impl::org::ortc::RTCIceCandidateComplete::get_component() noexcept +{ + return Helper::toWrapper(native_->mComponent); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCIceCandidateComplete::get_complete() noexcept +{ + return native_->mComplete; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + return std::dynamic_pointer_cast(wrapper)->native_; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(wrapper::org::ortc::RTCIceGathererCandidatePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + + return result->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.h new file mode 100644 index 00000000..278aa261 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidateComplete.h @@ -0,0 +1,45 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceCandidateComplete.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceCandidateComplete : public wrapper::org::ortc::RTCIceCandidateComplete + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETypes::CandidateComplete, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceCandidateComplete, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceCandidateComplete, WrapperType); + RTCIceCandidateCompleteWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCIceCandidateComplete() noexcept; + virtual ~RTCIceCandidateComplete() noexcept; + + // methods RTCIceGathererCandidate + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCIceGathererCandidate + wrapper::org::ortc::RTCIceComponent get_component() noexcept override; + void wrapper_init_org_ortc_RTCIceCandidateComplete() noexcept override; + + // properties RTCIceCandidateComplete + bool get_complete() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + static NativeTypePtr toNative(wrapper::org::ortc::RTCIceGathererCandidatePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.cpp new file mode 100644 index 00000000..1ed0b303 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.cpp @@ -0,0 +1,129 @@ + +#include "impl_org_ortc_RTCIceCandidatePair.h" +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidatePair::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidatePair::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidatePair::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePair::RTCIceCandidatePair() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePairPtr wrapper::org::ortc::RTCIceCandidatePair::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePair::~RTCIceCandidatePair() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePair::wrapper_init_org_ortc_RTCIceCandidatePair() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePair::wrapper_init_org_ortc_RTCIceCandidatePair(wrapper::org::ortc::RTCIceCandidatePairPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePair::wrapper_init_org_ortc_RTCIceCandidatePair(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceCandidatePair::toJson() noexcept +{ + return Json::toWrapper(native_->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePair::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePtr wrapper::impl::org::ortc::RTCIceCandidatePair::get_local() noexcept +{ + return RTCIceCandidate::toWrapper(native_->mLocal); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePair::set_local(wrapper::org::ortc::RTCIceCandidatePtr value) noexcept +{ + native_->mLocal = RTCIceCandidate::toNative(value); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePtr wrapper::impl::org::ortc::RTCIceCandidatePair::get_remote() noexcept +{ + return RTCIceCandidate::toWrapper(native_->mRemote); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePair::set_remote(wrapper::org::ortc::RTCIceCandidatePtr value) noexcept +{ + native_->mRemote = RTCIceCandidate::toNative(value); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto impl = std::dynamic_pointer_cast(wrapper); + if (!impl) return NativeTypePtr(); + + return impl->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.h new file mode 100644 index 00000000..30e83373 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePair.h @@ -0,0 +1,46 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceCandidatePair.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceCandidatePair : public wrapper::org::ortc::RTCIceCandidatePair + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransportTypes::CandidatePair, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceCandidatePair, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceCandidatePair, WrapperType); + RTCIceCandidatePairWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCIceCandidatePair() noexcept; + virtual ~RTCIceCandidatePair() noexcept; + + // methods RTCIceCandidatePair + void wrapper_init_org_ortc_RTCIceCandidatePair() noexcept override; + void wrapper_init_org_ortc_RTCIceCandidatePair(wrapper::org::ortc::RTCIceCandidatePairPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceCandidatePair(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCIceCandidatePair + wrapper::org::ortc::RTCIceCandidatePtr get_local() noexcept override; + void set_local(wrapper::org::ortc::RTCIceCandidatePtr value) noexcept override; + wrapper::org::ortc::RTCIceCandidatePtr get_remote() noexcept override; + void set_remote(wrapper::org::ortc::RTCIceCandidatePtr value) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp new file mode 100644 index 00000000..0fed3854 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp @@ -0,0 +1,58 @@ + +#include "impl_org_ortc_RTCIceCandidatePairChangeEvent.h" +#include "impl_org_ortc_RTCIceCandidatePair.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidatePairChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceCandidatePairChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePairChangeEvent::RTCIceCandidatePairChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePairChangeEventPtr wrapper::org::ortc::RTCIceCandidatePairChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePairChangeEvent::~RTCIceCandidatePairChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePairPtr wrapper::impl::org::ortc::RTCIceCandidatePairChangeEvent::get_candidatePair() noexcept +{ + return RTCIceCandidatePair::toWrapper(candidatePair_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(::ortc::IICETransportTypes::CandidatePairPtr candidatePair) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->candidatePair_ = candidatePair; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.h new file mode 100644 index 00000000..7c40a315 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairChangeEvent.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceCandidatePairChangeEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceCandidatePairChangeEvent : public wrapper::org::ortc::RTCIceCandidatePairChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCIceCandidatePairChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceCandidatePairChangeEvent, WrapperType); + RTCIceCandidatePairChangeEventWeakPtr thisWeak_; + ::ortc::IICETransportTypes::CandidatePairPtr candidatePair_; + + RTCIceCandidatePairChangeEvent() noexcept; + virtual ~RTCIceCandidatePairChangeEvent() noexcept; + + // properties RTCIceCandidatePairChangeEvent + wrapper::org::ortc::RTCIceCandidatePairPtr get_candidatePair() noexcept override; + + static WrapperImplTypePtr toWrapper(::ortc::IICETransportTypes::CandidatePairPtr candidatePair) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.cpp new file mode 100644 index 00000000..784b4e19 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.cpp @@ -0,0 +1,197 @@ + +#include "impl_org_ortc_RTCIceCandidatePairStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePairStats::RTCIceCandidatePairStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePairStatsPtr wrapper::org::ortc::RTCIceCandidatePairStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePairStats::~RTCIceCandidatePairStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceCandidatePairStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCIceCandidatePairStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePairStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePairStats::wrapper_init_org_ortc_RTCIceCandidatePairStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePairStats::wrapper_init_org_ortc_RTCIceCandidatePairStats(wrapper::org::ortc::RTCIceCandidatePairStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCIceCandidatePairStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceCandidatePairStats::wrapper_init_org_ortc_RTCIceCandidatePairStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_transportId() noexcept +{ + return native_->mTransportID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_localCandidateId() noexcept +{ + return native_->mLocalCandidateID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_remoteCandidateId() noexcept +{ + return native_->mRemoteCandidateID; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePairState wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_state() noexcept +{ + return Helper::toWrapper(native_->mState); +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_priority() noexcept +{ + return native_->mPriority; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_nominated() noexcept +{ + return native_->mNominated; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_writable() noexcept +{ + return native_->mWritable; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_readable() noexcept +{ + return native_->mReadable; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_bytesSent() noexcept +{ + return native_->mBytesSent; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_bytesReceived() noexcept +{ + return native_->mBytesReceived; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_roundTripTime() noexcept +{ + return native_->mRoundTripTime; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_availableOutgoingBitrate() noexcept +{ + return native_->mAvailableOutgoingBitrate; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCIceCandidatePairStats::get_availableIncomingBitrate() noexcept +{ + return native_->mAvailableIncomingBitrate; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePairStatsPtr wrapper::impl::org::ortc::RTCIceCandidatePairStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCIceCandidatePairStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceCandidatePairStats::NativeStatsPtr wrapper::impl::org::ortc::RTCIceCandidatePairStats::toNative(wrapper::org::ortc::RTCIceCandidatePairStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.h new file mode 100644 index 00000000..29488e13 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceCandidatePairStats.h @@ -0,0 +1,61 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceCandidatePairStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceCandidatePairStats : public wrapper::org::ortc::RTCIceCandidatePairStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::ICECandidatePairStats, NativeStats); + RTCIceCandidatePairStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCIceCandidatePairStats() noexcept; + virtual ~RTCIceCandidatePairStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCIceCandidatePairStats + void wrapper_init_org_ortc_RTCIceCandidatePairStats() noexcept override; + void wrapper_init_org_ortc_RTCIceCandidatePairStats(wrapper::org::ortc::RTCIceCandidatePairStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceCandidatePairStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCIceCandidatePairStats + String get_transportId() noexcept override; + String get_localCandidateId() noexcept override; + String get_remoteCandidateId() noexcept override; + wrapper::org::ortc::RTCIceCandidatePairState get_state() noexcept override; + unsigned long long get_priority() noexcept override; + bool get_nominated() noexcept override; + bool get_writable() noexcept override; + bool get_readable() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + double get_roundTripTime() noexcept override; + double get_availableOutgoingBitrate() noexcept override; + double get_availableIncomingBitrate() noexcept override; + + static RTCIceCandidatePairStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCIceCandidatePairStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.cpp new file mode 100644 index 00000000..527cb93e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.cpp @@ -0,0 +1,107 @@ + +#include "impl_org_ortc_RTCIceGatherInterfacePolicy.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::RTCIceGatherInterfacePolicy() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGatherInterfacePolicyPtr wrapper::org::ortc::RTCIceGatherInterfacePolicy::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::~RTCIceGatherInterfacePolicy() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::wrapper_init_org_ortc_RTCIceGatherInterfacePolicy() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::wrapper_init_org_ortc_RTCIceGatherInterfacePolicy(wrapper::org::ortc::RTCIceGatherInterfacePolicyPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::wrapper_init_org_ortc_RTCIceGatherInterfacePolicy(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::WrapperImplTypePtr wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::WrapperImplTypePtr wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->interfaceType = native.mInterfaceType; + pThis->gatherPolicy = Helper::toWrapper(native.mGatherPolicy); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::NativeTypePtr wrapper::impl::org::ortc::RTCIceGatherInterfacePolicy::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mInterfaceType = wrapper->interfaceType; + result->mGatherPolicy = Helper::toNative(wrapper->gatherPolicy); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.h new file mode 100644 index 00000000..0b9c7533 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherInterfacePolicy.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGatherInterfacePolicy.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGatherInterfacePolicy : public wrapper::org::ortc::RTCIceGatherInterfacePolicy + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGathererTypes::InterfacePolicy, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceGatherInterfacePolicy, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGatherInterfacePolicy, WrapperType); + + RTCIceGatherInterfacePolicyWeakPtr thisWeak_; + + RTCIceGatherInterfacePolicy() noexcept; + virtual ~RTCIceGatherInterfacePolicy() noexcept; + + // methods RTCIceGatherInterfacePolicy + void wrapper_init_org_ortc_RTCIceGatherInterfacePolicy() noexcept override; + void wrapper_init_org_ortc_RTCIceGatherInterfacePolicy(wrapper::org::ortc::RTCIceGatherInterfacePolicyPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceGatherInterfacePolicy(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.cpp new file mode 100644 index 00000000..a3b8c656 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.cpp @@ -0,0 +1,128 @@ + +#include "impl_org_ortc_RTCIceGatherOptions.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_RTCIceGatherInterfacePolicy.h" +#include "impl_org_ortc_RTCIceServer.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherOptions::RTCIceGatherOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGatherOptionsPtr wrapper::org::ortc::RTCIceGatherOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherOptions::~RTCIceGatherOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherOptions::wrapper_init_org_ortc_RTCIceGatherOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherOptions::wrapper_init_org_ortc_RTCIceGatherOptions(wrapper::org::ortc::RTCIceGatherOptionsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherOptions::wrapper_init_org_ortc_RTCIceGatherOptions(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceGatherOptions::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCIceGatherOptions")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGatherOptions::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherOptions::WrapperImplTypePtr wrapper::impl::org::ortc::RTCIceGatherOptions::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherOptions::WrapperImplTypePtr wrapper::impl::org::ortc::RTCIceGatherOptions::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->continuousGathering = native.mContinuousGathering; + pThis->interfacePolicies = make_shared< list >(); + for (auto iter = native.mInterfacePolicies.begin(); iter != native.mInterfacePolicies.end(); ++iter) { + pThis->interfacePolicies->push_back(RTCIceGatherInterfacePolicy::toWrapper(*iter)); + } + pThis->iceServers = make_shared< list >(); + for (auto iter = native.mICEServers.begin(); iter != native.mICEServers.end(); ++iter) { + pThis->iceServers->push_back(RTCIceServer::toWrapper(*iter)); + } + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherOptions::NativeTypePtr wrapper::impl::org::ortc::RTCIceGatherOptions::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mContinuousGathering = wrapper->continuousGathering; + if (wrapper->interfacePolicies) { + for (auto iter = wrapper->interfacePolicies->begin(); iter != wrapper->interfacePolicies->end(); ++iter) { + auto value = RTCIceGatherInterfacePolicy::toNative(*iter); + if (!value) continue; + result->mInterfacePolicies.push_back(*value); + } + } + if (wrapper->iceServers) { + for (auto iter = wrapper->iceServers->begin(); iter != wrapper->iceServers->end(); ++iter) { + auto value = RTCIceServer::toNative(*iter); + if (!value) continue; + result->mICEServers.push_back(*value); + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.h new file mode 100644 index 00000000..52771952 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherOptions.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGatherOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGatherOptions : public wrapper::org::ortc::RTCIceGatherOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGathererTypes::Options, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceGatherOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGatherOptions, WrapperType); + RTCIceGatherOptionsWeakPtr thisWeak_; + + RTCIceGatherOptions() noexcept; + virtual ~RTCIceGatherOptions() noexcept; + + // methods RTCIceGatherOptions + void wrapper_init_org_ortc_RTCIceGatherOptions() noexcept override; + void wrapper_init_org_ortc_RTCIceGatherOptions(wrapper::org::ortc::RTCIceGatherOptionsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceGatherOptions(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.cpp new file mode 100644 index 00000000..4fd29f71 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.cpp @@ -0,0 +1,228 @@ + +#include "impl_org_ortc_RTCIceGatherer.h" +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_RTCIceParameters.h" +#include "impl_org_ortc_RTCIceGatherOptions.h" +#include "impl_org_ortc_RTCIceGathererStateChangeEvent.h" +#include "impl_org_ortc_RTCIceGathererCandidateEvent.h" +#include "impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h" +#include "impl_org_ortc_RTCIceGathererIceErrorEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGatherer::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGatherer::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGatherer::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGatherer::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherer::RTCIceGatherer() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererPtr wrapper::org::ortc::RTCIceGatherer::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGatherer::~RTCIceGatherer() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCIceGatherer::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherer::wrapper_init_org_ortc_RTCIceGatherer(wrapper::org::ortc::RTCIceGatherOptionsPtr options) noexcept(false) +{ + auto native = RTCIceGatherOptions::toNative(options); + ZS_THROW_INVALID_ARGUMENT_IF(!native); + + native_ = NativeType::create(thisWeak_.lock(), *native); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererPtr wrapper::impl::org::ortc::RTCIceGatherer::createAssociatedGatherer() noexcept(false) +{ + return RTCIceGatherer::toWrapper(native_->createAssociatedGatherer(::ortc::IICEGathererDelegatePtr())); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherer::gather() noexcept +{ + native_->gather(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherer::gather(wrapper::org::ortc::RTCIceGatherOptionsPtr options) noexcept +{ + auto native = RTCIceGatherOptions::toNative(options); + if (!native) { + gather(); + return; + } + native_->gather(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherer::close() noexcept +{ + native_->close(); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCIceGatherer::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceComponent wrapper::impl::org::ortc::RTCIceGatherer::get_component() noexcept +{ + return Helper::toWrapper(native_->component()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererState wrapper::impl::org::ortc::RTCIceGatherer::get_state() noexcept +{ + return Helper::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceParametersPtr wrapper::impl::org::ortc::RTCIceGatherer::get_localParameters() noexcept +{ + return RTCIceParameters::toWrapper(native_->getLocalParameters()); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCIceCandidatePtr > > wrapper::impl::org::ortc::RTCIceGatherer::get_localCandidates() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::RTCIceCandidatePtr > >(); + + auto nativeList = native_->getLocalCandidates(); + if (nativeList) { + for (auto iter = nativeList->begin(); iter != nativeList->end(); ++iter) { + auto wrapper = RTCIceCandidate::toWrapper(make_shared<::ortc::IICETypes::Candidate>(*iter)); + if (!wrapper) continue; + result->push_back(wrapper); + } + } + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGatherer::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICEGathererStateChange( + IICEGathererPtr gatherer, + IICEGatherer::States state +) +{ + onStateChange(RTCIceGathererStateChangeEvent::toWrapper(state)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICEGathererLocalCandidate( + IICEGathererPtr gatherer, + CandidatePtr candidate +) +{ + onLocalCandidate(RTCIceGathererCandidateEvent::toWrapper(candidate)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICEGathererLocalCandidateComplete( + IICEGathererPtr gatherer, + CandidateCompletePtr candidate +) +{ + onLocalCandidateComplete(RTCIceGathererCandidateCompleteEvent::toWrapper(candidate)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICEGathererLocalCandidateGone( + IICEGathererPtr gatherer, + CandidatePtr candidate +) +{ + onLocalCandidateGone(RTCIceGathererCandidateEvent::toWrapper(candidate)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICEGathererError( + IICEGathererPtr gatherer, + ErrorEventPtr errorEvent +) +{ + onError(RTCIceGathererIceErrorEvent::toWrapper(errorEvent)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.h new file mode 100644 index 00000000..07bc34c8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGatherer.h @@ -0,0 +1,86 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGatherer.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGatherer : public wrapper::org::ortc::RTCIceGatherer, + public ::ortc::IICEGathererDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGatherer, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGatherer, IICEGatherer); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGathererSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCIceGatherer, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGatherer, WrapperType); + RTCIceGathererWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCIceGatherer() noexcept; + virtual ~RTCIceGatherer() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCIceGatherer + void wrapper_init_org_ortc_RTCIceGatherer(wrapper::org::ortc::RTCIceGatherOptionsPtr options) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument + wrapper::org::ortc::RTCIceGathererPtr createAssociatedGatherer() noexcept(false) override; // throws ::zsLib::Exceptions::BadState + void gather() noexcept override; + void gather(wrapper::org::ortc::RTCIceGatherOptionsPtr options) noexcept override; + void close() noexcept override; + + // properties RTCIceGatherer + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCIceComponent get_component() noexcept override; + wrapper::org::ortc::RTCIceGathererState get_state() noexcept override; + wrapper::org::ortc::RTCIceParametersPtr get_localParameters() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCIceCandidatePtr > > get_localCandidates() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onICEGathererStateChange( + IICEGathererPtr gatherer, + IICEGatherer::States state + ) override; + + virtual void onICEGathererLocalCandidate( + IICEGathererPtr gatherer, + CandidatePtr candidate + ) override; + + virtual void onICEGathererLocalCandidateComplete( + IICEGathererPtr gatherer, + CandidateCompletePtr candidate + ) override; + + virtual void onICEGathererLocalCandidateGone( + IICEGathererPtr gatherer, + CandidatePtr candidate + ) override; + + virtual void onICEGathererError( + IICEGathererPtr gatherer, + ErrorEventPtr errorEvent + ) override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.cpp new file mode 100644 index 00000000..26d367a7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.cpp @@ -0,0 +1,135 @@ + +#include "impl_org_ortc_RTCIceGathererCandidate.h" +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_RTCIceCandidateComplete.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidate::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidate::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidate::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererCandidate::RTCIceGathererCandidate() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererCandidatePtr wrapper::org::ortc::RTCIceGathererCandidate::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererCandidate::~RTCIceGathererCandidate() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererCandidatePtr wrapper::org::ortc::RTCIceGathererCandidate::create(wrapper::org::ortc::JsonPtr json) noexcept +{ + auto result = ::ortc::IICETypes::GatherCandidate::create(impl::org::ortc::Json::toNative(json)); + { + auto native = std::dynamic_pointer_cast<::ortc::IICETypes::Candidate>(result); + if (native) return wrapper::impl::org::ortc::RTCIceCandidate::toWrapper(native); + } + { + auto native = std::dynamic_pointer_cast<::ortc::IICETypes::CandidateComplete>(result); + if (native) return wrapper::impl::org::ortc::RTCIceCandidateComplete::toWrapper(native); + } + return WrapperImplTypePtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceGathererCandidate::toJson() noexcept +{ + { + auto native = std::dynamic_pointer_cast<::ortc::IICETypes::Candidate>(native_); + if (native) return Json::toWrapper(native->createElement()); + } + { + auto native = std::dynamic_pointer_cast<::ortc::IICETypes::CandidateComplete>(native_); + if (native) return Json::toWrapper(native->createElement()); + } + return JsonPtr(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererCandidate::hash() noexcept +{ + { + auto native = std::dynamic_pointer_cast<::ortc::IICETypes::Candidate>(native_); + if (native) return native->hash(); + } + { + auto native = std::dynamic_pointer_cast<::ortc::IICETypes::CandidateComplete>(native_); + if (native) return native->hash(); + } + return String(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceComponent wrapper::impl::org::ortc::RTCIceGathererCandidate::get_component() noexcept +{ + return Helper::toWrapper(native_->mComponent); +} + +//------------------------------------------------------------------------------ +WrapperTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperTypePtr(); + + { + auto converted = std::dynamic_pointer_cast<::ortc::IICETypes::Candidate>(native); + if (converted) return RTCIceCandidate::toWrapper(converted); + } + { + auto converted = std::dynamic_pointer_cast<::ortc::IICETypes::CandidateComplete>(native); + if (converted) return RTCIceCandidateComplete::toWrapper(converted); + } + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + wrapper::org::ortc::RTCIceCandidatePtr impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCIceCandidate::toNative(impl); + } + + { + wrapper::org::ortc::RTCIceCandidateCompletePtr impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCIceCandidateComplete::toNative(impl); + } + + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.h new file mode 100644 index 00000000..4dfb27bf --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidate.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGathererCandidate.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGathererCandidate : public wrapper::org::ortc::RTCIceGathererCandidate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETypes::GatherCandidate, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceGathererCandidate, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGathererCandidate, WrapperType); + RTCIceGathererCandidateWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCIceGathererCandidate() noexcept; + virtual ~RTCIceGathererCandidate() noexcept; + + // methods RTCIceGathererCandidate + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCIceGathererCandidate + wrapper::org::ortc::RTCIceComponent get_component() noexcept override; + + static WrapperTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp new file mode 100644 index 00000000..f2a377fc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp @@ -0,0 +1,58 @@ + +#include "impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h" +#include "impl_org_ortc_RTCIceCandidateComplete.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidateCompleteEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidateCompleteEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererCandidateCompleteEvent::RTCIceGathererCandidateCompleteEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererCandidateCompleteEventPtr wrapper::org::ortc::RTCIceGathererCandidateCompleteEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererCandidateCompleteEvent::~RTCIceGathererCandidateCompleteEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidateCompletePtr wrapper::impl::org::ortc::RTCIceGathererCandidateCompleteEvent::get_candidate() noexcept +{ + return candidate_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(::ortc::IICEGathererTypes::CandidateCompletePtr candidate) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->candidate_ = RTCIceCandidateComplete::toWrapper(candidate); + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h new file mode 100644 index 00000000..2ad77f7b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGathererCandidateCompleteEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGathererCandidateCompleteEvent : public wrapper::org::ortc::RTCIceGathererCandidateCompleteEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCIceGathererCandidateCompleteEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGathererCandidateCompleteEvent, WrapperType); + RTCIceGathererCandidateCompleteEventWeakPtr thisWeak_; + wrapper::org::ortc::RTCIceCandidateCompletePtr candidate_; + + RTCIceGathererCandidateCompleteEvent() noexcept; + virtual ~RTCIceGathererCandidateCompleteEvent() noexcept; + + // properties RTCIceGathererCandidateCompleteEvent + wrapper::org::ortc::RTCIceCandidateCompletePtr get_candidate() noexcept override; + + static WrapperImplTypePtr toWrapper(::ortc::IICEGathererTypes::CandidateCompletePtr candidate) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.cpp new file mode 100644 index 00000000..7d39cb56 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.cpp @@ -0,0 +1,68 @@ + +#include "impl_org_ortc_RTCIceGathererCandidateEvent.h" +#include "impl_org_ortc_RTCIceCandidate.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidateEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererCandidateEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererCandidateEvent::RTCIceGathererCandidateEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererCandidateEventPtr wrapper::org::ortc::RTCIceGathererCandidateEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererCandidateEvent::~RTCIceGathererCandidateEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePtr wrapper::impl::org::ortc::RTCIceGathererCandidateEvent::get_candidate() noexcept +{ + return candidate_; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererCandidateEvent::get_url() noexcept +{ + return url_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper( + ::ortc::IICEGathererTypes::CandidatePtr candidate, + const String &url +) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->candidate_ = RTCIceCandidate::toWrapper(candidate); + pThis->url_ = url; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.h new file mode 100644 index 00000000..562b88ab --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererCandidateEvent.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGathererCandidateEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGathererCandidateEvent : public wrapper::org::ortc::RTCIceGathererCandidateEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCIceGathererCandidateEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGathererCandidateEvent, WrapperType); + RTCIceGathererCandidateEventWeakPtr thisWeak_; + wrapper::org::ortc::RTCIceCandidatePtr candidate_; + String url_; + + RTCIceGathererCandidateEvent() noexcept; + virtual ~RTCIceGathererCandidateEvent() noexcept; + + // properties RTCIceGathererCandidateEvent + wrapper::org::ortc::RTCIceCandidatePtr get_candidate() noexcept override; + String get_url() noexcept override; + + static WrapperImplTypePtr toWrapper( + ::ortc::IICEGathererTypes::CandidatePtr candidate, + const String &url = String() + ) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.cpp new file mode 100644 index 00000000..72559bd7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.cpp @@ -0,0 +1,78 @@ + +#include "impl_org_ortc_RTCIceGathererIceErrorEvent.h" +#include "impl_org_ortc_RTCIceCandidate.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::RTCIceGathererIceErrorEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererIceErrorEventPtr wrapper::org::ortc::RTCIceGathererIceErrorEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::~RTCIceGathererIceErrorEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePtr wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::get_hostCandidate() noexcept +{ + return RTCIceCandidate::toWrapper(native_->mHostCandidate); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::get_url() noexcept +{ + return native_->mURL; +} + +//------------------------------------------------------------------------------ +uint16_t wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::get_errorCode() noexcept +{ + return native_->mErrorCode; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererIceErrorEvent::get_errorText() noexcept +{ + return native_->mErrorText; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.h new file mode 100644 index 00000000..2cca58df --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererIceErrorEvent.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGathererIceErrorEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGathererIceErrorEvent : public wrapper::org::ortc::RTCIceGathererIceErrorEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGathererTypes::ErrorEvent, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceGathererIceErrorEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGathererIceErrorEvent, WrapperType); + RTCIceGathererIceErrorEventWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCIceGathererIceErrorEvent() noexcept; + virtual ~RTCIceGathererIceErrorEvent() noexcept; + + // properties RTCIceGathererIceErrorEvent + wrapper::org::ortc::RTCIceCandidatePtr get_hostCandidate() noexcept override; + String get_url() noexcept override; + uint16_t get_errorCode() noexcept override; + String get_errorText() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.cpp new file mode 100644 index 00000000..771d9f48 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.cpp @@ -0,0 +1,59 @@ + +#include "impl_org_ortc_RTCIceGathererStateChangeEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererStateChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceGathererStateChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererStateChangeEvent::RTCIceGathererStateChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererStateChangeEventPtr wrapper::org::ortc::RTCIceGathererStateChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererStateChangeEvent::~RTCIceGathererStateChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererState wrapper::impl::org::ortc::RTCIceGathererStateChangeEvent::get_state() noexcept +{ + return Helper::toWrapper(state_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(::ortc::IICEGathererTypes::States state) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->state_ = state; + return pThis; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.h new file mode 100644 index 00000000..b828df40 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStateChangeEvent.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGathererStateChangeEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGathererStateChangeEvent : public wrapper::org::ortc::RTCIceGathererStateChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCIceGathererStateChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceGathererStateChangeEvent, WrapperType); + RTCIceGathererStateChangeEventWeakPtr thisWeak_; + ::ortc::IICEGathererTypes::States state_ { ::ortc::IICEGathererTypes::State_First}; + + RTCIceGathererStateChangeEvent() noexcept; + virtual ~RTCIceGathererStateChangeEvent() noexcept; + + // properties RTCIceGathererStateChangeEvent + wrapper::org::ortc::RTCIceGathererState get_state() noexcept override; + + static WrapperImplTypePtr toWrapper(::ortc::IICEGathererTypes::States state) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.cpp new file mode 100644 index 00000000..ea164022 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.cpp @@ -0,0 +1,137 @@ + +#include "impl_org_ortc_RTCIceGathererStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererStats::RTCIceGathererStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererStatsPtr wrapper::org::ortc::RTCIceGathererStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererStats::~RTCIceGathererStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceGathererStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCIceGathererStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCIceGathererStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCIceGathererStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGathererStats::wrapper_init_org_ortc_RTCIceGathererStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGathererStats::wrapper_init_org_ortc_RTCIceGathererStats(wrapper::org::ortc::RTCIceGathererStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCIceGathererStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceGathererStats::wrapper_init_org_ortc_RTCIceGathererStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceGathererStats::get_bytesSent() noexcept +{ + return native_->mBytesSent; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceGathererStats::get_bytesReceived() noexcept +{ + return native_->mBytesReceived; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceGathererStats::get_rtcpGathererStatsId() noexcept +{ + return native_->mRTCPGathererStatsID; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererStatsPtr wrapper::impl::org::ortc::RTCIceGathererStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCIceGathererStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceGathererStats::NativeStatsPtr wrapper::impl::org::ortc::RTCIceGathererStats::toNative(wrapper::org::ortc::RTCIceGathererStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.h new file mode 100644 index 00000000..55b4f7a3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceGathererStats.h @@ -0,0 +1,51 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceGathererStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceGathererStats : public wrapper::org::ortc::RTCIceGathererStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::ICEGathererStats, NativeStats); + RTCIceGathererStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCIceGathererStats() noexcept; + virtual ~RTCIceGathererStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCIceGathererStats + void wrapper_init_org_ortc_RTCIceGathererStats() noexcept override; + void wrapper_init_org_ortc_RTCIceGathererStats(wrapper::org::ortc::RTCIceGathererStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceGathererStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCIceGathererStats + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + String get_rtcpGathererStatsId() noexcept override; + + static RTCIceGathererStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCIceGathererStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.cpp new file mode 100644 index 00000000..34fa8684 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.cpp @@ -0,0 +1,114 @@ + +#include "impl_org_ortc_RTCIceParameters.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceParameters::RTCIceParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceParametersPtr wrapper::org::ortc::RTCIceParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceParameters::~RTCIceParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceParameters::wrapper_init_org_ortc_RTCIceParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceParameters::wrapper_init_org_ortc_RTCIceParameters(wrapper::org::ortc::RTCIceParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceParameters::wrapper_init_org_ortc_RTCIceParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCIceParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->useUnfreezePriority = native.mUseUnfreezePriority; + pThis->usernameFragment = native.mUsernameFragment; + pThis->password = native.mPassword; + pThis->iceLite = native.mICELite; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mUseUnfreezePriority = wrapper->useUnfreezePriority; + result->mUsernameFragment = wrapper->usernameFragment; + result->mPassword = wrapper->password; + result->mICELite = wrapper->iceLite; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.h new file mode 100644 index 00000000..aeeb3eec --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceParameters : public wrapper::org::ortc::RTCIceParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETypes::Parameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceParameters, WrapperType); + RTCIceParametersWeakPtr thisWeak_; + + RTCIceParameters() noexcept; + virtual ~RTCIceParameters() noexcept; + + // methods RTCIceParameters + void wrapper_init_org_ortc_RTCIceParameters() noexcept override; + void wrapper_init_org_ortc_RTCIceParameters(wrapper::org::ortc::RTCIceParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceServer.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceServer.cpp new file mode 100644 index 00000000..bb56aa67 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceServer.cpp @@ -0,0 +1,113 @@ + +#include "impl_org_ortc_RTCIceServer.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceServer::RTCIceServer() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceServerPtr wrapper::org::ortc::RTCIceServer::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceServer::~RTCIceServer() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceServer::wrapper_init_org_ortc_RTCIceServer() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceServer::wrapper_init_org_ortc_RTCIceServer(wrapper::org::ortc::RTCIceServerPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceServer::wrapper_init_org_ortc_RTCIceServer(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceServer::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCIceServer")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceServer::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceServer::WrapperImplTypePtr wrapper::impl::org::ortc::RTCIceServer::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceServer::WrapperImplTypePtr wrapper::impl::org::ortc::RTCIceServer::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->urls = make_shared< list >(native.mURLs); + pThis->username = native.mUserName; + pThis->credential = native.mCredential; + pThis->credentialType = Helper::toWrapper(native.mCredentialType); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceServer::NativeTypePtr wrapper::impl::org::ortc::RTCIceServer::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + if (wrapper->urls) { + result->mURLs = *(wrapper->urls); + } + result->mUserName = wrapper->username; + result->mCredential = wrapper->credential; + result->mCredentialType = Helper::toNative(wrapper->credentialType); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceServer.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceServer.h new file mode 100644 index 00000000..ed8bef94 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceServer.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceServer.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceServer : public wrapper::org::ortc::RTCIceServer + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICEGathererTypes::Server, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceServer, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceServer, WrapperType); + RTCIceServerWeakPtr thisWeak_; + + RTCIceServer() noexcept; + virtual ~RTCIceServer() noexcept; + + // methods RTCIceServer + void wrapper_init_org_ortc_RTCIceServer() noexcept override; + void wrapper_init_org_ortc_RTCIceServer(wrapper::org::ortc::RTCIceServerPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceServer(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.cpp new file mode 100644 index 00000000..d1b15ce9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.cpp @@ -0,0 +1,321 @@ + +#include "impl_org_ortc_RTCIceTransport.h" +#include "impl_org_ortc_RTCIceParameters.h" +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_RTCIceCandidatePair.h" +#include "impl_org_ortc_RTCIceGatherer.h" +#include "impl_org_ortc_RTCIceGathererCandidate.h" +#include "impl_org_ortc_RTCIceParameters.h" +#include "impl_org_ortc_RTCIceTransportOptions.h" +#include "impl_org_ortc_RTCIceTransportStateChangeEvent.h" +#include "impl_org_ortc_RTCIceCandidatePairChangeEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransport::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransport::RTCIceTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportPtr wrapper::org::ortc::RTCIceTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransport::~RTCIceTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCIceTransport::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::wrapper_init_org_ortc_RTCIceTransport() noexcept +{ + native_ = NativeType::create(thisWeak_.lock()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::wrapper_init_org_ortc_RTCIceTransport(wrapper::org::ortc::RTCIceGathererPtr gatherer) noexcept(false) +{ + native_ = NativeType::create(thisWeak_.lock(), RTCIceGatherer::toNative(gatherer)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::start( + wrapper::org::ortc::RTCIceGathererPtr gatherer, + wrapper::org::ortc::RTCIceParametersPtr remoteParameters + ) noexcept(false) +{ + auto nativeParams = RTCIceParameters::toNative(remoteParameters); + ZS_ASSERT(nativeParams); + + native_->start(RTCIceGatherer::toNative(gatherer), *nativeParams); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::start( + wrapper::org::ortc::RTCIceGathererPtr gatherer, + wrapper::org::ortc::RTCIceParametersPtr remoteParameters, + wrapper::org::ortc::RTCIceRole role + ) noexcept(false) +{ + auto nativeParams = RTCIceParameters::toNative(remoteParameters); + ZS_THROW_INVALID_ARGUMENT_IF(!nativeParams); + + ::ortc::IICETransport::Options optionalOptions; + optionalOptions.mRole = Helper::toNative(role); + + native_->start(RTCIceGatherer::toNative(gatherer), *nativeParams, optionalOptions); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::start( + wrapper::org::ortc::RTCIceGathererPtr gatherer, + wrapper::org::ortc::RTCIceParametersPtr remoteParameters, + wrapper::org::ortc::RTCIceTransportOptionsPtr options + ) noexcept(false) +{ + auto nativeParams = RTCIceParameters::toNative(remoteParameters); + ZS_THROW_INVALID_ARGUMENT_IF(!nativeParams); + + auto nativeOptions = RTCIceTransportOptions::toNative(options); + Optional<::ortc::IICETransport::Options> optionalOptions; + if (nativeOptions) { + optionalOptions = *nativeOptions; + } + + native_->start(RTCIceGatherer::toNative(gatherer), *nativeParams, optionalOptions); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::stop() noexcept +{ + native_->stop(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportPtr wrapper::impl::org::ortc::RTCIceTransport::createAssociatedTransport() noexcept +{ + return RTCIceTransport::toWrapper(native_->createAssociatedTransport(::ortc::IICETransportDelegatePtr())); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::addRemoteCandidate(wrapper::org::ortc::RTCIceGathererCandidatePtr remoteCandidate) noexcept(false) +{ + auto native = RTCIceGathererCandidate::toNative(remoteCandidate); + if (!native) return; + native_->addRemoteCandidate(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::setRemoteCandidates(shared_ptr< list< wrapper::org::ortc::RTCIceCandidatePtr > > remoteCandidates) noexcept(false) +{ + list< ::ortc::IICETypes::Candidate > nativeList; + if (remoteCandidates) { + for (auto iter = remoteCandidates->begin(); iter != remoteCandidates->end(); ++iter) { + auto native = RTCIceCandidate::toNative(*iter); + if (!native) continue; + nativeList.push_back(*native); + } + } + native_->setRemoteCandidates(nativeList); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::removeRemoteCandidate(wrapper::org::ortc::RTCIceGathererCandidatePtr remoteCandidate) noexcept(false) +{ + auto native = RTCIceGathererCandidate::toNative(remoteCandidate); + if (!native) return; + native_->removeRemoteCandidate(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::keepWarm(wrapper::org::ortc::RTCIceCandidatePairPtr candidatePair) noexcept(false) +{ + auto native = RTCIceCandidatePair::toNative(candidatePair); + if (!native) return; + native_->keepWarm(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::keepWarm( + wrapper::org::ortc::RTCIceCandidatePairPtr candidatePair, + bool keepWarm + ) noexcept(false) +{ + auto native = RTCIceCandidatePair::toNative(candidatePair); + if (!native) return; + native_->keepWarm(*native, keepWarm); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCIceTransport::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererPtr wrapper::impl::org::ortc::RTCIceTransport::get_gatherer() noexcept +{ + return RTCIceGatherer::toWrapper(native_->iceGatherer()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceRole wrapper::impl::org::ortc::RTCIceTransport::get_role() noexcept +{ + return Helper::toWrapper(native_->role()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceComponent wrapper::impl::org::ortc::RTCIceTransport::get_component() noexcept +{ + return Helper::toWrapper(native_->component()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportState wrapper::impl::org::ortc::RTCIceTransport::get_state() noexcept +{ + return Helper::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCIceCandidatePtr > > wrapper::impl::org::ortc::RTCIceTransport::get_remoteCandidates() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::RTCIceCandidatePtr > >(); + auto native = native_->getRemoteCandidates(); + if (native) { + for (auto iter = native->begin(); iter != native->end(); ++iter) { + auto wrapper = RTCIceCandidate::toWrapper(make_shared<::ortc::IICETypes::Candidate>(*iter)); + if (!wrapper) continue; + result->push_back(wrapper); + } + } + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceCandidatePairPtr wrapper::impl::org::ortc::RTCIceTransport::get_selectedCandidatePair() noexcept +{ + return RTCIceCandidatePair::toWrapper(native_->getSelectedCandidatePair()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceParametersPtr wrapper::impl::org::ortc::RTCIceTransport::get_remoteParameters() noexcept +{ + return RTCIceParameters::toWrapper(native_->getRemoteParameters()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransport::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICETransportStateChange( + IICETransportPtr transport, + IICETransport::States state +) noexcept +{ + onStateChange(RTCIceTransportStateChangeEvent::toWrapper(state)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICETransportCandidatePairAvailable( + IICETransportPtr transport, + CandidatePairPtr candidatePair +) noexcept +{ + onCandidatePairAvailable(RTCIceCandidatePairChangeEvent::toWrapper(candidatePair)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICETransportCandidatePairGone( + IICETransportPtr transport, + CandidatePairPtr candidatePair +) noexcept +{ + onCandidatePairGone(RTCIceCandidatePairChangeEvent::toWrapper(candidatePair)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onICETransportCandidatePairChanged( + IICETransportPtr transport, + CandidatePairPtr candidatePair +) noexcept +{ + onCandidatePairChange(RTCIceCandidatePairChangeEvent::toWrapper(candidatePair)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.h new file mode 100644 index 00000000..fd1c9577 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransport.h @@ -0,0 +1,103 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceTransport : public wrapper::org::ortc::RTCIceTransport, + public ::ortc::IICETransportDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransport, IICETransport); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransportSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCIceTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceTransport, WrapperType); + RTCIceTransportWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCIceTransport() noexcept; + virtual ~RTCIceTransport() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCIceTransport + void wrapper_init_org_ortc_RTCIceTransport() noexcept override; + void wrapper_init_org_ortc_RTCIceTransport(wrapper::org::ortc::RTCIceGathererPtr gatherer) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void start( + wrapper::org::ortc::RTCIceGathererPtr gatherer, + wrapper::org::ortc::RTCIceParametersPtr remoteParameters + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void start( + wrapper::org::ortc::RTCIceGathererPtr gatherer, + wrapper::org::ortc::RTCIceParametersPtr remoteParameters, + wrapper::org::ortc::RTCIceRole role + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void start( + wrapper::org::ortc::RTCIceGathererPtr gatherer, + wrapper::org::ortc::RTCIceParametersPtr remoteParameters, + wrapper::org::ortc::RTCIceTransportOptionsPtr options + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void stop() noexcept override; + wrapper::org::ortc::RTCIceTransportPtr createAssociatedTransport() noexcept override; + void addRemoteCandidate(wrapper::org::ortc::RTCIceGathererCandidatePtr remoteCandidate) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void setRemoteCandidates(shared_ptr< list< wrapper::org::ortc::RTCIceCandidatePtr > > remoteCandidates) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void removeRemoteCandidate(wrapper::org::ortc::RTCIceGathererCandidatePtr remoteCandidate) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void keepWarm(wrapper::org::ortc::RTCIceCandidatePairPtr candidatePair) noexcept(false) override; // throws ::zsLib::Exceptions::BadState + void keepWarm( + wrapper::org::ortc::RTCIceCandidatePairPtr candidatePair, + bool keepWarm + ) noexcept(false) override; // throws ::zsLib::Exceptions::BadState + + // properties RTCIceTransport + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCIceGathererPtr get_gatherer() noexcept override; + wrapper::org::ortc::RTCIceRole get_role() noexcept override; + wrapper::org::ortc::RTCIceComponent get_component() noexcept override; + wrapper::org::ortc::RTCIceTransportState get_state() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCIceCandidatePtr > > get_remoteCandidates() noexcept override; + wrapper::org::ortc::RTCIceCandidatePairPtr get_selectedCandidatePair() noexcept override; + wrapper::org::ortc::RTCIceParametersPtr get_remoteParameters() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onICETransportStateChange( + IICETransportPtr transport, + IICETransport::States state + ) noexcept override; + virtual void onICETransportCandidatePairAvailable( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) noexcept override; + virtual void onICETransportCandidatePairGone( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) noexcept override; + + virtual void onICETransportCandidatePairChanged( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.cpp new file mode 100644 index 00000000..7854dcd0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.cpp @@ -0,0 +1,108 @@ + +#include "impl_org_ortc_RTCIceTransportController.h" +#include "impl_org_ortc_RTCIceTransport.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportController::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportController::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportController::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportController::RTCIceTransportController() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportControllerPtr wrapper::org::ortc::RTCIceTransportController::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportController::~RTCIceTransportController() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportController::wrapper_init_org_ortc_RTCIceTransportController() noexcept +{ + native_ = NativeType::create(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportController::addTransport(wrapper::org::ortc::RTCIceTransportPtr transport) noexcept(false) +{ + return native_->addTransport(RTCIceTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportController::addTransport( + wrapper::org::ortc::RTCIceTransportPtr transport, + uint64_t index + ) noexcept(false) +{ + size_t native = SafeInt(index); + return native_->addTransport(RTCIceTransport::toNative(transport), native); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCIceTransportController::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCIceTransportPtr > > wrapper::impl::org::ortc::RTCIceTransportController::get_transports() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::RTCIceTransportPtr > >(); + auto native = native_->getTransports(); + for (auto iter = native.begin(); iter != native.end(); ++iter) { + auto wrapper = RTCIceTransport::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.h new file mode 100644 index 00000000..c44bd05e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportController.h @@ -0,0 +1,47 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceTransportController.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceTransportController : public wrapper::org::ortc::RTCIceTransportController + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransportController, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransportController, IICETransportController); + ZS_DECLARE_TYPEDEF_PTR(RTCIceTransportController, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceTransportController, WrapperType); + + RTCIceTransportControllerWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCIceTransportController() noexcept; + virtual ~RTCIceTransportController() noexcept; + + // methods RTCIceTransportController + void wrapper_init_org_ortc_RTCIceTransportController() noexcept override; + void addTransport(wrapper::org::ortc::RTCIceTransportPtr transport) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void addTransport( + wrapper::org::ortc::RTCIceTransportPtr transport, + uint64_t index + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // properties RTCIceTransportController + uint64_t get_objectId() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCIceTransportPtr > > get_transports() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.cpp new file mode 100644 index 00000000..ba249fde --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.cpp @@ -0,0 +1,111 @@ + +#include "impl_org_ortc_RTCIceTransportOptions.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportOptions::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportOptions::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportOptions::RTCIceTransportOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportOptionsPtr wrapper::org::ortc::RTCIceTransportOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportOptions::~RTCIceTransportOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportOptions::wrapper_init_org_ortc_RTCIceTransportOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportOptions::wrapper_init_org_ortc_RTCIceTransportOptions(wrapper::org::ortc::RTCIceTransportOptionsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportOptions::wrapper_init_org_ortc_RTCIceTransportOptions(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceTransportOptions::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCIceTransportOptions")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceTransportOptions::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->aggressiveIce = native.mAggressiveICE; + pThis->role = Helper::toWrapper(native.mRole); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mAggressiveICE = wrapper->aggressiveIce; + result->mRole = Helper::toNative(wrapper->role); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.h new file mode 100644 index 00000000..36af6d63 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportOptions.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceTransportOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceTransportOptions : public wrapper::org::ortc::RTCIceTransportOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IICETransportTypes::Options, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceTransportOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceTransportOptions, WrapperType); + RTCIceTransportOptionsWeakPtr thisWeak_; + + RTCIceTransportOptions() noexcept; + virtual ~RTCIceTransportOptions() noexcept; + + // methods RTCIceTransportOptions + void wrapper_init_org_ortc_RTCIceTransportOptions() noexcept override; + void wrapper_init_org_ortc_RTCIceTransportOptions(wrapper::org::ortc::RTCIceTransportOptionsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceTransportOptions(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.cpp new file mode 100644 index 00000000..df6bd792 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.cpp @@ -0,0 +1,58 @@ + +#include "impl_org_ortc_RTCIceTransportStateChangeEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportStateChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCIceTransportStateChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportStateChangeEvent::RTCIceTransportStateChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportStateChangeEventPtr wrapper::org::ortc::RTCIceTransportStateChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportStateChangeEvent::~RTCIceTransportStateChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportState wrapper::impl::org::ortc::RTCIceTransportStateChangeEvent::get_state() noexcept +{ + return Helper::toWrapper(state_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(::ortc::IICETransportTypes::States state) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->state_ = state; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.h new file mode 100644 index 00000000..d635e3f9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStateChangeEvent.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceTransportStateChangeEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceTransportStateChangeEvent : public wrapper::org::ortc::RTCIceTransportStateChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCIceTransportStateChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCIceTransportStateChangeEvent, WrapperType); + RTCIceTransportStateChangeEventWeakPtr thisWeak_; + ::ortc::IICETransportTypes::States state_ { ::ortc::IICETransportTypes::State_First}; + + RTCIceTransportStateChangeEvent() noexcept; + virtual ~RTCIceTransportStateChangeEvent() noexcept; + + // properties RTCIceTransportStateChangeEvent + wrapper::org::ortc::RTCIceTransportState get_state() noexcept override; + + static WrapperImplTypePtr toWrapper(::ortc::IICETransportTypes::States state) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.cpp new file mode 100644 index 00000000..a4925ff8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.cpp @@ -0,0 +1,149 @@ + +#include "impl_org_ortc_RTCIceTransportStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportStats::RTCIceTransportStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportStatsPtr wrapper::org::ortc::RTCIceTransportStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportStats::~RTCIceTransportStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCIceTransportStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCIceTransportStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceTransportStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCIceTransportStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCIceTransportStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceTransportStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceTransportStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportStats::wrapper_init_org_ortc_RTCIceTransportStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportStats::wrapper_init_org_ortc_RTCIceTransportStats(wrapper::org::ortc::RTCIceTransportStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCIceTransportStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIceTransportStats::wrapper_init_org_ortc_RTCIceTransportStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceTransportStats::get_bytesSent() noexcept +{ + return native_->mBytesSent; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCIceTransportStats::get_bytesReceived() noexcept +{ + return native_->mBytesReceived; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceTransportStats::get_rtcpTransportStatsId() noexcept +{ + return native_->mRTCPTransportStatsID; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCIceTransportStats::get_activeConnection() noexcept +{ + return native_->mActiveConnection; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCIceTransportStats::get_selectedCandidatePairId() noexcept +{ + return native_->mSelectedCandidatePairID; +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportStatsPtr wrapper::impl::org::ortc::RTCIceTransportStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCIceTransportStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIceTransportStats::NativeStatsPtr wrapper::impl::org::ortc::RTCIceTransportStats::toNative(wrapper::org::ortc::RTCIceTransportStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.h new file mode 100644 index 00000000..f9ebf059 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIceTransportStats.h @@ -0,0 +1,53 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIceTransportStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIceTransportStats : public wrapper::org::ortc::RTCIceTransportStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::ICETransportStats, NativeStats); + RTCIceTransportStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCIceTransportStats() noexcept; + virtual ~RTCIceTransportStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCIceTransportStats + void wrapper_init_org_ortc_RTCIceTransportStats() noexcept override; + void wrapper_init_org_ortc_RTCIceTransportStats(wrapper::org::ortc::RTCIceTransportStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCIceTransportStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCIceTransportStats + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + String get_rtcpTransportStatsId() noexcept override; + bool get_activeConnection() noexcept override; + String get_selectedCandidatePairId() noexcept override; + + static RTCIceTransportStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCIceTransportStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentity.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIdentity.cpp new file mode 100644 index 00000000..83d02821 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentity.cpp @@ -0,0 +1,151 @@ + +#include "impl_org_ortc_RTCIdentity.h" +#include "impl_org_ortc_RTCIdentityAssertion.h" +#include "impl_org_ortc_RTCIdentityResult.h" +#include "impl_org_ortc_RTCIdentityError.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentity::RTCIdentity() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIdentityPtr wrapper::org::ortc::RTCIdentity::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentity::~RTCIdentity() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIdentity::wrapper_init_org_ortc_RTCIdentity(wrapper::org::ortc::RTCDtlsTransportPtr transport) noexcept +{ +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > > wrapper::impl::org::ortc::RTCIdentity::getIdentityAssertion(String provider) noexcept +{ + return getIdentityAssertion(provider, String(), String()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > > wrapper::impl::org::ortc::RTCIdentity::getIdentityAssertion( + String provider, + String protocol + ) noexcept +{ + return getIdentityAssertion(provider, protocol, String()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > > wrapper::impl::org::ortc::RTCIdentity::getIdentityAssertion( + String provider, + String protocol, + String username + ) noexcept +{ + typedef PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > PromiseWithType; + + auto result = PromiseWithType::create(Helper::getGuiQueue()); + + if (protocol.isEmpty()) { + protocol = "default"; + } + + auto promise = native_->getIdentityAssertion(provider, protocol, username.hasData() ? username.c_str() : NULL); + + promise->thenClosure([promise, result] { + if (promise->isRejected()) { + typedef AnyHolder< RTCIdentityErrorPtr > AnyHolderType; + + auto nativeReason = promise->reason(); + if (nativeReason) { + auto reason = make_shared(); + reason->value_ = RTCIdentityError::toWrapper(nativeReason); + result->reject(reason); + return; + } + Helper::reject(promise, result); + return; + } + result->resolve(RTCIdentityResult::toWrapper(promise->value())); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityAssertionPtr > > wrapper::impl::org::ortc::RTCIdentity::setIdentityAssertion(String assertion) noexcept +{ + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityAssertionPtr >, PromiseWithType); + + auto promise = native_->setIdentityAssertion(assertion); + if (!promise) return PromiseWithTypePtr(); + + auto result = PromiseWithType::create(Helper::getGuiQueue()); + + promise->thenClosure([promise, result] { + if (promise->isRejected()) { + Helper::reject(promise, result); + return; + } + result->resolve(RTCIdentityAssertion::toWrapper(promise->value())); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCIdentity::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIdentityAssertionPtr wrapper::impl::org::ortc::RTCIdentity::get_peerIdentity() noexcept +{ + return RTCIdentityAssertion::toWrapper(native_->peerIdentity()); +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityPtr wrapper::impl::org::ortc::RTCIdentity::toWrapper(NativeIdentityPtr native) noexcept +{ + if (!native) return RTCIdentityPtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentity::NativeIdentityPtr wrapper::impl::org::ortc::RTCIdentity::toNative(wrapper::org::ortc::RTCIdentityPtr wrapper) noexcept +{ + if (!wrapper) return NativeIdentityPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentity.h b/ortc/idl/wrapper/impl_org_ortc_RTCIdentity.h new file mode 100644 index 00000000..97117f46 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentity.h @@ -0,0 +1,49 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIdentity.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIdentity : public wrapper::org::ortc::RTCIdentity + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IIdentity, NativeIdentity); + RTCIdentityWeakPtr thisWeak_; + NativeIdentityPtr native_; + + RTCIdentity() noexcept; + virtual ~RTCIdentity() noexcept; + + // methods RTCIdentity + void wrapper_init_org_ortc_RTCIdentity(wrapper::org::ortc::RTCDtlsTransportPtr transport) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > > getIdentityAssertion(String provider) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > > getIdentityAssertion( + String provider, + String protocol + ) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityResultPtr > > getIdentityAssertion( + String provider, + String protocol, + String username + ) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCIdentityAssertionPtr > > setIdentityAssertion(String assertion) noexcept override; + + // properties RTCIdentity + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCIdentityAssertionPtr get_peerIdentity() noexcept override; + + static RTCIdentityPtr toWrapper(NativeIdentityPtr native) noexcept; + static NativeIdentityPtr toNative(wrapper::org::ortc::RTCIdentityPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.cpp new file mode 100644 index 00000000..a086884e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.cpp @@ -0,0 +1,74 @@ + +#include "impl_org_ortc_RTCIdentityAssertion.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityAssertion::RTCIdentityAssertion() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIdentityAssertionPtr wrapper::org::ortc::RTCIdentityAssertion::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityAssertion::~RTCIdentityAssertion() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIdentityAssertion::wrapper_init_org_ortc_RTCIdentityAssertion() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityAssertionPtr wrapper::impl::org::ortc::RTCIdentityAssertion::toWrapper(NativeAssertionPtr native) noexcept +{ + if (!native) return RTCIdentityAssertionPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityAssertionPtr wrapper::impl::org::ortc::RTCIdentityAssertion::toWrapper(const NativeAssertion &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->idp = native.mIDP; + pThis->name = native.mName; + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityAssertion::NativeAssertionPtr wrapper::impl::org::ortc::RTCIdentityAssertion::toNative(wrapper::org::ortc::RTCIdentityAssertionPtr wrapper) noexcept +{ + if (!wrapper) return NativeAssertionPtr(); + + auto result = make_shared(); + result->mIDP = wrapper->idp; + result->mName = wrapper->name; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.h b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.h new file mode 100644 index 00000000..ebd5b8c1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityAssertion.h @@ -0,0 +1,32 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIdentityAssertion.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIdentityAssertion : public wrapper::org::ortc::RTCIdentityAssertion + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IIdentityTypes::Assertion, NativeAssertion); + RTCIdentityAssertionWeakPtr thisWeak_; + + RTCIdentityAssertion() noexcept; + virtual ~RTCIdentityAssertion() noexcept; + void wrapper_init_org_ortc_RTCIdentityAssertion() noexcept override; + + static RTCIdentityAssertionPtr toWrapper(NativeAssertionPtr native) noexcept; + static RTCIdentityAssertionPtr toWrapper(const NativeAssertion &native) noexcept; + static NativeAssertionPtr toNative(wrapper::org::ortc::RTCIdentityAssertionPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.cpp new file mode 100644 index 00000000..eda8fe69 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.cpp @@ -0,0 +1,75 @@ + +#include "impl_org_ortc_RTCIdentityError.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityError::RTCIdentityError() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIdentityErrorPtr wrapper::org::ortc::RTCIdentityError::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityError::~RTCIdentityError() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIdentityError::wrapper_init_org_ortc_RTCIdentityError() noexcept +{ +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityErrorPtr wrapper::impl::org::ortc::RTCIdentityError::toWrapper(NativeErrorPtr native) noexcept +{ + if (!native) return RTCIdentityErrorPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityErrorPtr wrapper::impl::org::ortc::RTCIdentityError::toWrapper(const NativeError &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->idp = native.mIDP; + pThis->protocol = native.mProtocol; + pThis->loginUrl = native.mLoginURL; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityError::NativeErrorPtr wrapper::impl::org::ortc::RTCIdentityError::toWrapper(wrapper::org::ortc::RTCIdentityErrorPtr wrapper) noexcept +{ + if (!wrapper) return NativeErrorPtr(); + + auto result = make_shared(); + result->mIDP = wrapper->idp; + result->mProtocol = wrapper->protocol; + result->mLoginURL = wrapper->loginUrl; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.h b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.h new file mode 100644 index 00000000..b94bda28 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityError.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIdentityError.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIdentityError : public wrapper::org::ortc::RTCIdentityError + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IIdentityTypes::Error, NativeError); + + RTCIdentityErrorWeakPtr thisWeak_; + + RTCIdentityError() noexcept; + virtual ~RTCIdentityError() noexcept; + void wrapper_init_org_ortc_RTCIdentityError() noexcept override; + + static RTCIdentityErrorPtr toWrapper(NativeErrorPtr native) noexcept; + static RTCIdentityErrorPtr toWrapper(const NativeError &native) noexcept; + static NativeErrorPtr toWrapper(wrapper::org::ortc::RTCIdentityErrorPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.cpp new file mode 100644 index 00000000..97a850d9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.cpp @@ -0,0 +1,71 @@ + +#include "impl_org_ortc_RTCIdentityResult.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityResult::RTCIdentityResult() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIdentityResultPtr wrapper::org::ortc::RTCIdentityResult::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityResult::~RTCIdentityResult() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCIdentityResult::wrapper_init_org_ortc_RTCIdentityResult() noexcept +{ +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityResultPtr wrapper::impl::org::ortc::RTCIdentityResult::toWrapper(NativeResultPtr native) noexcept +{ + if (!native) return RTCIdentityResultPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityResultPtr wrapper::impl::org::ortc::RTCIdentityResult::toWrapper(const NativeResult &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->assertion = native.mAssertion; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCIdentityResult::NativeResultPtr wrapper::impl::org::ortc::RTCIdentityResult::toNative(wrapper::org::ortc::RTCIdentityResultPtr wrapper) noexcept +{ + if (!wrapper) return NativeResultPtr(); + + auto result = make_shared(); + result->mAssertion = wrapper->assertion; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.h b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.h new file mode 100644 index 00000000..55daf59b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCIdentityResult.h @@ -0,0 +1,32 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCIdentityResult.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCIdentityResult : public wrapper::org::ortc::RTCIdentityResult + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IIdentityTypes::Result, NativeResult); + RTCIdentityResultWeakPtr thisWeak_; + + RTCIdentityResult() noexcept; + virtual ~RTCIdentityResult() noexcept; + void wrapper_init_org_ortc_RTCIdentityResult() noexcept override; + + static RTCIdentityResultPtr toWrapper(NativeResultPtr native) noexcept; + static RTCIdentityResultPtr toWrapper(const NativeResult &native) noexcept; + static NativeResultPtr toNative(wrapper::org::ortc::RTCIdentityResultPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.cpp new file mode 100644 index 00000000..0b1206d0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.cpp @@ -0,0 +1,221 @@ + +#include "impl_org_ortc_RTCInboundRtpStreamStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCInboundRtpStreamStats::RTCInboundRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCInboundRtpStreamStatsPtr wrapper::org::ortc::RTCInboundRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCInboundRtpStreamStats::~RTCInboundRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCInboundRtpStreamStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCInboundRtpStreamStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_ssrc() noexcept +{ + return (Optional< uint32_t >)native_->mSSRC; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_associatedStatId() noexcept +{ + return native_->mAssociatedStatID; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_isRemote() noexcept +{ + return native_->mIsRemote; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_mediaType() noexcept +{ + return native_->mMediaType; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_mediaTrackId() noexcept +{ + return native_->mMediaTrackID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_transportId() noexcept +{ + return native_->mTransportID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_codecId() noexcept +{ + return native_->mCodecID; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_firCount() noexcept +{ + return native_->mFIRCount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_pliCount() noexcept +{ + return native_->mPLICount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_nackCount() noexcept +{ + return native_->mNACKCount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_sliCount() noexcept +{ + return native_->mSLICount; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCInboundRtpStreamStats::wrapper_init_org_ortc_RTCInboundRtpStreamStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCInboundRtpStreamStats::wrapper_init_org_ortc_RTCInboundRtpStreamStats(wrapper::org::ortc::RTCInboundRtpStreamStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCInboundRtpStreamStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCInboundRtpStreamStats::wrapper_init_org_ortc_RTCInboundRtpStreamStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_packetsReceived() noexcept +{ + return native_->mPacketsReceived; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_bytesReceived() noexcept +{ + return native_->mBytesReceived; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_packetsLost() noexcept +{ + return native_->mPacketsLost; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_jitter() noexcept +{ + return native_->mJitter; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_fractionLost() noexcept +{ + return native_->mFractionLost; +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::ortc::RTCInboundRtpStreamStats::get_endToEndDelay() noexcept +{ + return native_->mEndToEndDelay; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCInboundRtpStreamStatsPtr wrapper::impl::org::ortc::RTCInboundRtpStreamStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCInboundRtpStreamStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCInboundRtpStreamStats::NativeStatsPtr wrapper::impl::org::ortc::RTCInboundRtpStreamStats::toNative(wrapper::org::ortc::RTCInboundRtpStreamStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.h new file mode 100644 index 00000000..a38c78c3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCInboundRtpStreamStats.h @@ -0,0 +1,67 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCInboundRtpStreamStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCInboundRtpStreamStats : public wrapper::org::ortc::RTCInboundRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::InboundRTPStreamStats, NativeStats); + RTCInboundRtpStreamStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCInboundRtpStreamStats() noexcept; + virtual ~RTCInboundRtpStreamStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_associatedStatId() noexcept override; + bool get_isRemote() noexcept override; + String get_mediaType() noexcept override; + String get_mediaTrackId() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + + // methods RTCInboundRtpStreamStats + void wrapper_init_org_ortc_RTCInboundRtpStreamStats() noexcept override; + void wrapper_init_org_ortc_RTCInboundRtpStreamStats(wrapper::org::ortc::RTCInboundRtpStreamStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCInboundRtpStreamStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCInboundRtpStreamStats + unsigned long get_packetsReceived() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + unsigned long get_packetsLost() noexcept override; + double get_jitter() noexcept override; + double get_fractionLost() noexcept override; + ::zsLib::Milliseconds get_endToEndDelay() noexcept override; + + static RTCInboundRtpStreamStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCInboundRtpStreamStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.cpp new file mode 100644 index 00000000..a4dd3a91 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.cpp @@ -0,0 +1,130 @@ + +#include "impl_org_ortc_RTCMediaStreamStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamStats::RTCMediaStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCMediaStreamStatsPtr wrapper::org::ortc::RTCMediaStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamStats::~RTCMediaStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCMediaStreamStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCMediaStreamStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCMediaStreamStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCMediaStreamStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCMediaStreamStats::wrapper_init_org_ortc_RTCMediaStreamStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCMediaStreamStats::wrapper_init_org_ortc_RTCMediaStreamStats(wrapper::org::ortc::RTCMediaStreamStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCMediaStreamStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCMediaStreamStats::wrapper_init_org_ortc_RTCMediaStreamStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamStats::get_streamId() noexcept +{ + return native_->mStreamID; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< String > > wrapper::impl::org::ortc::RTCMediaStreamStats::get_trackIds() noexcept +{ + return make_shared< list >(native_->mTrackIDs); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamStatsPtr wrapper::impl::org::ortc::RTCMediaStreamStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCMediaStreamStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamStats::NativeStatsPtr wrapper::impl::org::ortc::RTCMediaStreamStats::toNative(wrapper::org::ortc::RTCMediaStreamStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.h new file mode 100644 index 00000000..97ff4e93 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamStats.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCMediaStreamStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCMediaStreamStats : public wrapper::org::ortc::RTCMediaStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::MediaStreamStats, NativeStats); + RTCMediaStreamStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCMediaStreamStats() noexcept; + virtual ~RTCMediaStreamStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCMediaStreamStats + void wrapper_init_org_ortc_RTCMediaStreamStats() noexcept override; + void wrapper_init_org_ortc_RTCMediaStreamStats(wrapper::org::ortc::RTCMediaStreamStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCMediaStreamStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCMediaStreamStats + String get_streamId() noexcept override; + shared_ptr< list< String > > get_trackIds() noexcept override; + + static RTCMediaStreamStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCMediaStreamStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.cpp new file mode 100644 index 00000000..d26bd926 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.cpp @@ -0,0 +1,208 @@ + +#include "impl_org_ortc_RTCMediaStreamTrackStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamTrackStats::RTCMediaStreamTrackStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCMediaStreamTrackStatsPtr wrapper::org::ortc::RTCMediaStreamTrackStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamTrackStats::~RTCMediaStreamTrackStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCMediaStreamTrackStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCMediaStreamTrackStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamTrackStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCMediaStreamTrackStats::wrapper_init_org_ortc_RTCMediaStreamTrackStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCMediaStreamTrackStats::wrapper_init_org_ortc_RTCMediaStreamTrackStats(wrapper::org::ortc::RTCMediaStreamTrackStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCMediaStreamTrackStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCMediaStreamTrackStats::wrapper_init_org_ortc_RTCMediaStreamTrackStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_trackId() noexcept +{ + return native_->mTrackID; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_remoteSource() noexcept +{ + return native_->mRemoteSource; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< uint32_t > > wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_ssrcIds() noexcept +{ + auto result = make_shared< list >(); + for (auto iter = native_->mSSRCIDs.begin(); iter != native_->mSSRCIDs.end(); ++iter) + { + result->push_back(*iter); + } + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_frameWidth() noexcept +{ + return native_->mFrameWidth; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_frameHeight() noexcept +{ + return native_->mFrameHeight; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_framesPerSecond() noexcept +{ + return native_->mFramesPerSecond; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_framesSent() noexcept +{ + return native_->mFramesSent; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_framesReceived() noexcept +{ + return native_->mFramesReceived; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_framesDecoded() noexcept +{ + return native_->mFramesDecoded; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_framesDropped() noexcept +{ + return native_->mFramesDropped; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_framesCorrupted() noexcept +{ + return native_->mFramesCorrupted; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_audioLevel() noexcept +{ + return native_->mAudioLevel; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_echoReturnLoss() noexcept +{ + return native_->mEchoReturnLoss; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCMediaStreamTrackStats::get_echoReturnLossEnhancement() noexcept +{ + return native_->mEchoReturnLossEnhancement; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamTrackStatsPtr wrapper::impl::org::ortc::RTCMediaStreamTrackStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCMediaStreamTrackStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMediaStreamTrackStats::NativeStatsPtr wrapper::impl::org::ortc::RTCMediaStreamTrackStats::toNative(wrapper::org::ortc::RTCMediaStreamTrackStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.h new file mode 100644 index 00000000..752b7419 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCMediaStreamTrackStats.h @@ -0,0 +1,62 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCMediaStreamTrackStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCMediaStreamTrackStats : public wrapper::org::ortc::RTCMediaStreamTrackStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::MediaStreamTrackStats, NativeStats); + RTCMediaStreamTrackStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCMediaStreamTrackStats() noexcept; + virtual ~RTCMediaStreamTrackStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCMediaStreamTrackStats + void wrapper_init_org_ortc_RTCMediaStreamTrackStats() noexcept override; + void wrapper_init_org_ortc_RTCMediaStreamTrackStats(wrapper::org::ortc::RTCMediaStreamTrackStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCMediaStreamTrackStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCMediaStreamTrackStats + String get_trackId() noexcept override; + bool get_remoteSource() noexcept override; + shared_ptr< list< uint32_t > > get_ssrcIds() noexcept override; + unsigned long get_frameWidth() noexcept override; + unsigned long get_frameHeight() noexcept override; + double get_framesPerSecond() noexcept override; + unsigned long get_framesSent() noexcept override; + unsigned long get_framesReceived() noexcept override; + unsigned long get_framesDecoded() noexcept override; + unsigned long get_framesDropped() noexcept override; + unsigned long get_framesCorrupted() noexcept override; + double get_audioLevel() noexcept override; + double get_echoReturnLoss() noexcept override; + double get_echoReturnLossEnhancement() noexcept override; + + static RTCMediaStreamTrackStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCMediaStreamTrackStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.cpp new file mode 100644 index 00000000..db3de4fe --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.cpp @@ -0,0 +1,66 @@ + +#include "impl_org_ortc_RTCMessageEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCMessageEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCMessageEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCMessageEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMessageEvent::RTCMessageEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCMessageEventPtr wrapper::org::ortc::RTCMessageEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCMessageEvent::~RTCMessageEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +SecureByteBlockPtr wrapper::impl::org::ortc::RTCMessageEvent::get_binary() noexcept +{ + return native_->mBinary; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCMessageEvent::get_text() noexcept +{ + return native_->mText; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.h new file mode 100644 index 00000000..a84c6ebb --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCMessageEvent.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCMessageEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCMessageEvent : public wrapper::org::ortc::RTCMessageEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannelDelegate::MessageEventData, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCMessageEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCMessageEvent, WrapperType); + RTCMessageEventWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCMessageEvent() noexcept; + virtual ~RTCMessageEvent() noexcept; + + // properties RTCMessageEvent + SecureByteBlockPtr get_binary() noexcept override; + String get_text() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.cpp new file mode 100644 index 00000000..3ac8b107 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.cpp @@ -0,0 +1,209 @@ + +#include "impl_org_ortc_RTCOutboundRtpStreamStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::RTCOutboundRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCOutboundRtpStreamStatsPtr wrapper::org::ortc::RTCOutboundRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::~RTCOutboundRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCOutboundRtpStreamStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_ssrc() noexcept +{ + return (Optional< uint32_t >)native_->mSSRC; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_associatedStatId() noexcept +{ + return native_->mAssociatedStatID; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_isRemote() noexcept +{ + return native_->mIsRemote; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_mediaType() noexcept +{ + return native_->mMediaType; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_mediaTrackId() noexcept +{ + return native_->mMediaTrackID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_transportId() noexcept +{ + return native_->mTransportID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_codecId() noexcept +{ + return native_->mCodecID; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_firCount() noexcept +{ + return native_->mFIRCount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_pliCount() noexcept +{ + return native_->mPLICount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_nackCount() noexcept +{ + return native_->mNACKCount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_sliCount() noexcept +{ + return native_->mSLICount; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::wrapper_init_org_ortc_RTCOutboundRtpStreamStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::wrapper_init_org_ortc_RTCOutboundRtpStreamStats(wrapper::org::ortc::RTCOutboundRtpStreamStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCOutboundRtpStreamStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::wrapper_init_org_ortc_RTCOutboundRtpStreamStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_packetsSent() noexcept +{ + return native_->mPacketsSent; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_bytesSent() noexcept +{ + return native_->mBytesSent; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_targetBitrate() noexcept +{ + return native_->mTargetBitrate; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::get_roundTripTime() noexcept +{ + return native_->mRoundTripTime; +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCOutboundRtpStreamStatsPtr wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCOutboundRtpStreamStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::NativeStatsPtr wrapper::impl::org::ortc::RTCOutboundRtpStreamStats::toNative(wrapper::org::ortc::RTCOutboundRtpStreamStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.h new file mode 100644 index 00000000..4057311d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCOutboundRtpStreamStats.h @@ -0,0 +1,66 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCOutboundRtpStreamStats.h" + +#include + + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCOutboundRtpStreamStats : public wrapper::org::ortc::RTCOutboundRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::OutboundRTPStreamStats, NativeStats); + RTCOutboundRtpStreamStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCOutboundRtpStreamStats() noexcept; + virtual ~RTCOutboundRtpStreamStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_associatedStatId() noexcept override; + bool get_isRemote() noexcept override; + String get_mediaType() noexcept override; + String get_mediaTrackId() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + + // methods RTCOutboundRtpStreamStats + void wrapper_init_org_ortc_RTCOutboundRtpStreamStats() noexcept override; + void wrapper_init_org_ortc_RTCOutboundRtpStreamStats(wrapper::org::ortc::RTCOutboundRtpStreamStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCOutboundRtpStreamStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCOutboundRtpStreamStats + unsigned long get_packetsSent() noexcept override; + unsigned long long get_bytesSent() noexcept override; + double get_targetBitrate() noexcept override; + double get_roundTripTime() noexcept override; + + static RTCOutboundRtpStreamStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCOutboundRtpStreamStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.cpp new file mode 100644 index 00000000..b41d6eaa --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.cpp @@ -0,0 +1,110 @@ + +#include "impl_org_ortc_RTCRtcpFeedback.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpFeedback::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpFeedback::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpFeedback::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtcpFeedback::RTCRtcpFeedback() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtcpFeedbackPtr wrapper::org::ortc::RTCRtcpFeedback::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtcpFeedback::~RTCRtcpFeedback() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtcpFeedback::wrapper_init_org_ortc_RTCRtcpFeedback() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtcpFeedback::wrapper_init_org_ortc_RTCRtcpFeedback(wrapper::org::ortc::RTCRtcpFeedbackPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtcpFeedback::wrapper_init_org_ortc_RTCRtcpFeedback(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtcpFeedback::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtcpFeedback::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->type = native.mType; + pThis->parameter = native.mParameter; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mType = wrapper->type; + result->mParameter = wrapper->parameter; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.h new file mode 100644 index 00000000..784d8275 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpFeedback.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtcpFeedback.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtcpFeedback : public wrapper::org::ortc::RTCRtcpFeedback + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::RTCPFeedback, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtcpFeedback, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtcpFeedback, WrapperType); + RTCRtcpFeedbackWeakPtr thisWeak_; + + RTCRtcpFeedback() noexcept; + virtual ~RTCRtcpFeedback() noexcept; + + // methods RTCRtcpFeedback + void wrapper_init_org_ortc_RTCRtcpFeedback() noexcept override; + void wrapper_init_org_ortc_RTCRtcpFeedback(wrapper::org::ortc::RTCRtcpFeedbackPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtcpFeedback(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.cpp new file mode 100644 index 00000000..0e596e61 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.cpp @@ -0,0 +1,114 @@ + +#include "impl_org_ortc_RTCRtcpParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtcpParameters::RTCRtcpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtcpParametersPtr wrapper::org::ortc::RTCRtcpParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtcpParameters::~RTCRtcpParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtcpParameters::wrapper_init_org_ortc_RTCRtcpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtcpParameters::wrapper_init_org_ortc_RTCRtcpParameters(wrapper::org::ortc::RTCRtcpParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtcpParameters::wrapper_init_org_ortc_RTCRtcpParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtcpParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtcpParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->ssrc = SafeIntssrc)>(native.mSSRC); + pThis->cName = native.mCName; + pThis->reducedSize = native.mReducedSize; + pThis->mux = native.mMux; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mSSRC = SafeIntmSSRC)>(wrapper->ssrc); + result->mCName = wrapper->cName; + result->mReducedSize = wrapper->reducedSize; + result->mMux = wrapper->mux; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.h new file mode 100644 index 00000000..9e027657 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtcpParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtcpParameters : public wrapper::org::ortc::RTCRtcpParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::RTCPParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtcpParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtcpParameters, WrapperType); + RTCRtcpParametersWeakPtr thisWeak_; + + RTCRtcpParameters() noexcept; + virtual ~RTCRtcpParameters() noexcept; + + // methods RTCRtcpParameters + void wrapper_init_org_ortc_RTCRtcpParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtcpParameters(wrapper::org::ortc::RTCRtcpParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtcpParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.cpp new file mode 100644 index 00000000..b82ce20c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.cpp @@ -0,0 +1,78 @@ + +#include "impl_org_ortc_RTCRtcpTransport.h" +#include "impl_org_ortc_RTCDtlsTransport.h" +#include "impl_org_ortc_RTCIceTransport.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtcpTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtcpTransport::RTCRtcpTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtcpTransportPtr wrapper::org::ortc::RTCRtcpTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtcpTransport::~RTCRtcpTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCDtlsTransport::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCIceTransport::toNative(impl); + } + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return impl->native_; + } + return NativeTypePtr(); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.h new file mode 100644 index 00000000..29125a50 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtcpTransport.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtcpTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtcpTransport : public wrapper::org::ortc::RTCRtcpTransport + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTCPTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtcpTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtcpTransport, WrapperType); + RTCRtcpTransportWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCRtcpTransport() noexcept; + virtual ~RTCRtcpTransport() noexcept; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.cpp new file mode 100644 index 00000000..bb85a838 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.cpp @@ -0,0 +1,138 @@ + +#include "impl_org_ortc_RTCRtpCapabilities.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_RTCRtpCodecCapability.h" +#include "impl_org_ortc_RTCRtpHeaderExtension.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCapabilities::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCapabilities::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCapabilities::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCapabilities::RTCRtpCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCapabilitiesPtr wrapper::org::ortc::RTCRtpCapabilities::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCapabilities::~RTCRtpCapabilities() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCapabilities::wrapper_init_org_ortc_RTCRtpCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCapabilities::wrapper_init_org_ortc_RTCRtpCapabilities(wrapper::org::ortc::RTCRtpCapabilitiesPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCapabilities::wrapper_init_org_ortc_RTCRtpCapabilities(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpCapabilities::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpCapabilities::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->codecs = make_shared< list< wrapper::org::ortc::RTCRtpCodecCapabilityPtr > >(); + for (auto iter = native.mCodecs.begin(); iter != native.mCodecs.end(); ++iter) { + auto wrapper = RTCRtpCodecCapability::toWrapper(*iter); + if (!wrapper) continue; + pThis->codecs->push_back(wrapper); + } + pThis->headerExtensions = make_shared< list< wrapper::org::ortc::RTCRtpHeaderExtensionPtr > >(); + for (auto iter = native.mHeaderExtensions.begin(); iter != native.mHeaderExtensions.end(); ++iter) { + auto wrapper = RTCRtpHeaderExtension::toWrapper(*iter); + if (!wrapper) continue; + pThis->headerExtensions->push_back(wrapper); + } + pThis->fecMechanisms = make_shared< list >(native.mFECMechanisms); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + if (wrapper->codecs) { + for (auto iter = wrapper->codecs->begin(); iter != wrapper->codecs->end(); ++iter) { + auto native = RTCRtpCodecCapability::toNative(*iter); + if (!native) continue; + result->mCodecs.push_back(*native); + } + } + if (wrapper->headerExtensions) { + for (auto iter = wrapper->headerExtensions->begin(); iter != wrapper->headerExtensions->end(); ++iter) { + auto native = RTCRtpHeaderExtension::toNative(*iter); + if (!native) continue; + result->mHeaderExtensions.push_back(*native); + } + } + if (wrapper->fecMechanisms) { + result->mFECMechanisms = *(wrapper->fecMechanisms); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.h new file mode 100644 index 00000000..ef7c59cf --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCapabilities.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpCapabilities.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpCapabilities : public wrapper::org::ortc::RTCRtpCapabilities + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::Capabilities, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpCapabilities, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpCapabilities, WrapperType); + RTCRtpCapabilitiesWeakPtr thisWeak_; + + RTCRtpCapabilities() noexcept; + virtual ~RTCRtpCapabilities() noexcept; + + // methods RTCRtpCapabilities + void wrapper_init_org_ortc_RTCRtpCapabilities() noexcept override; + void wrapper_init_org_ortc_RTCRtpCapabilities(wrapper::org::ortc::RTCRtpCapabilitiesPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpCapabilities(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.cpp new file mode 100644 index 00000000..38770ca5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.cpp @@ -0,0 +1,149 @@ + +#include "impl_org_ortc_RTCRtpCodecCapability.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_RTCRtcpFeedback.h" +#include "impl_org_ortc_RTCRtpCodecCapabilityParameters.h" +#include "impl_org_ortc_RTCRtpCodecCapabilityOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapability::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapability::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapability::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecCapability::RTCRtpCodecCapability() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCodecCapabilityPtr wrapper::org::ortc::RTCRtpCodecCapability::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecCapability::~RTCRtpCodecCapability() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCodecCapability::wrapper_init_org_ortc_RTCRtpCodecCapability() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCodecCapability::wrapper_init_org_ortc_RTCRtpCodecCapability(wrapper::org::ortc::RTCRtpCodecCapabilityPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCodecCapability::wrapper_init_org_ortc_RTCRtpCodecCapability(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpCodecCapability::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpCodecCapability::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->name = native.mName; + pThis->kind = native.mKind; + Helper::optionalSafeIntConvert(native.mClockRate, pThis->clockRate); + pThis->preferredPayloadType = native.mPreferredPayloadType; + pThis->pTime = native.mPTime; + pThis->maxPTime = native.mMaxPTime; + Helper::optionalSafeIntConvert(native.mNumChannels, pThis->numChannels); + pThis->rtcpFeedback = make_shared< list< wrapper::org::ortc::RTCRtcpFeedbackPtr > >(); + for (auto iter = native.mRTCPFeedback.begin(); iter != native.mRTCPFeedback.end(); ++iter) { + auto wrapper = RTCRtcpFeedback::toWrapper(*iter); + if (!wrapper) continue; + pThis->rtcpFeedback->push_back(wrapper); + } + pThis->parameters = RTCRtpCodecCapabilityParameters::toWrapper(native.mParameters); + pThis->options = RTCRtpCodecCapabilityOptions::toWrapper(native.mOptions); + pThis->maxTemporalLayers = native.mMaxTemporalLayers; + pThis->maxSpatialLayers = native.mMaxSpatialLayers; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + + result->mName = wrapper->name; + result->mKind = wrapper->kind; + Helper::optionalSafeIntConvert(wrapper->clockRate, result->mClockRate); + result->mPreferredPayloadType = wrapper->preferredPayloadType; + result->mPTime = wrapper->pTime; + result->mMaxPTime = wrapper->maxPTime; + Helper::optionalSafeIntConvert(wrapper->numChannels, result->mNumChannels); + if (wrapper->rtcpFeedback) { + for (auto iter = wrapper->rtcpFeedback->begin(); iter != wrapper->rtcpFeedback->end(); ++iter) { + auto native = RTCRtcpFeedback::toNative(*iter); + if (!native) continue; + result->mRTCPFeedback.push_back(*native); + } + } + result->mParameters = RTCRtpCodecCapabilityParameters::toNative(wrapper->parameters); + result->mOptions = RTCRtpCodecCapabilityOptions::toNative(wrapper->options); + result->mMaxTemporalLayers = wrapper->maxTemporalLayers; + result->mMaxSpatialLayers = wrapper->maxSpatialLayers; + + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.h new file mode 100644 index 00000000..5c63e015 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapability.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpCodecCapability.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpCodecCapability : public wrapper::org::ortc::RTCRtpCodecCapability + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::CodecCapability, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpCodecCapability, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpCodecCapability, WrapperType); + RTCRtpCodecCapabilityWeakPtr thisWeak_; + + RTCRtpCodecCapability() noexcept; + virtual ~RTCRtpCodecCapability() noexcept; + + // methods RTCRtpCodecCapability + void wrapper_init_org_ortc_RTCRtpCodecCapability() noexcept override; + void wrapper_init_org_ortc_RTCRtpCodecCapability(wrapper::org::ortc::RTCRtpCodecCapabilityPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpCodecCapability(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp new file mode 100644 index 00000000..c66257d3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp @@ -0,0 +1,78 @@ + +#include "impl_org_ortc_RTCRtpCodecCapabilityOptions.h" +#include "impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapabilityOptions::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapabilityOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapabilityOptions::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecCapabilityOptions::RTCRtpCodecCapabilityOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCodecCapabilityOptionsPtr wrapper::org::ortc::RTCRtpCodecCapabilityOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecCapabilityOptions::~RTCRtpCodecCapabilityOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperTypePtr(); + + { + auto wrapper = RTCRtpOpusCodecCapabilityOptions::toWrapper(native); + if (wrapper) return wrapper; + } + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpOpusCodecCapabilityOptions::toNative(impl); + } + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return impl->native_; + } + + return NativeTypePtr(); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.h new file mode 100644 index 00000000..5efe07a8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityOptions.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpCodecCapabilityOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpCodecCapabilityOptions : public wrapper::org::ortc::RTCRtpCodecCapabilityOptions + { + ZS_DECLARE_TYPEDEF_PTR(zsLib::Any, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpCodecCapabilityOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpCodecCapabilityOptions, WrapperType); + RTCRtpCodecCapabilityOptionsWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCRtpCodecCapabilityOptions() noexcept; + virtual ~RTCRtpCodecCapabilityOptions() noexcept; + + static WrapperTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp new file mode 100644 index 00000000..59e7fa66 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp @@ -0,0 +1,114 @@ + +#include "impl_org_ortc_RTCRtpCodecCapabilityParameters.h" +#include "impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h" +#include "impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h" +#include "impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h" +#include "impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h" +#include "impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapabilityParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapabilityParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecCapabilityParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecCapabilityParameters::RTCRtpCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCodecCapabilityParametersPtr wrapper::org::ortc::RTCRtpCodecCapabilityParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecCapabilityParameters::~RTCRtpCodecCapabilityParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + { + auto wrapper = RTCRtpOpusCodecCapabilityParameters::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpVp8CodecCapabilityParameters::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpH264CodecCapabilityParameters::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpRtxCodecCapabilityParameters::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpFlexFecCodecCapabilityParameters::toWrapper(native); + if (wrapper) return wrapper; + } + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpOpusCodecCapabilityParameters::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpVp8CodecCapabilityParameters::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpH264CodecCapabilityParameters::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpRtxCodecCapabilityParameters::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpFlexFecCodecCapabilityParameters::toNative(impl); + } + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return impl->native_; + } + return NativeTypePtr(); +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.h new file mode 100644 index 00000000..f86591e3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecCapabilityParameters.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpCodecCapabilityParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpCodecCapabilityParameters : public wrapper::org::ortc::RTCRtpCodecCapabilityParameters + { + ZS_DECLARE_TYPEDEF_PTR(zsLib::Any, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpCodecCapabilityParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpCodecCapabilityParameters, WrapperType); + RTCRtpCodecCapabilityParametersWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCRtpCodecCapabilityParameters() noexcept; + virtual ~RTCRtpCodecCapabilityParameters() noexcept; + + static WrapperTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.cpp new file mode 100644 index 00000000..bde28e03 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.cpp @@ -0,0 +1,123 @@ + +#include "impl_org_ortc_RTCRtpCodecParameterSettings.h" +#include "impl_org_ortc_RTCRtpOpusCodecParameterSettings.h" +#include "impl_org_ortc_RTCRtpVp8CodecParameterSettings.h" +#include "impl_org_ortc_RTCRtpH264CodecParameterSettings.h" +#include "impl_org_ortc_RTCRtpRtxCodecParameterSettings.h" +#include "impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h" +#include "impl_org_ortc_RTCRtpRedCodecParameterSettings.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecParameterSettings::RTCRtpCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCodecParameterSettingsPtr wrapper::org::ortc::RTCRtpCodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecParameterSettings::~RTCRtpCodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + { + auto wrapper = RTCRtpOpusCodecParameterSettings::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpVp8CodecParameterSettings::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpH264CodecParameterSettings::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpRtxCodecParameterSettings::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpFlexFecCodecParameterSettings::toWrapper(native); + if (wrapper) return wrapper; + } + { + auto wrapper = RTCRtpRedCodecParameterSettings::toWrapper(native); + if (wrapper) return wrapper; + } + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpOpusCodecParameterSettings::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpVp8CodecParameterSettings::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpH264CodecParameterSettings::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpRtxCodecParameterSettings::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpFlexFecCodecParameterSettings::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCRtpRedCodecParameterSettings::toNative(impl); + } + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return impl->native_; + } + + return NativeTypePtr(); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.h new file mode 100644 index 00000000..86824188 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameterSettings.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpCodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpCodecParameterSettings : public wrapper::org::ortc::RTCRtpCodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(zsLib::Any, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpCodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpCodecParameterSettings, WrapperType); + RTCRtpCodecParameterSettingsWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCRtpCodecParameterSettings() noexcept; + virtual ~RTCRtpCodecParameterSettings() noexcept; + + static WrapperTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.cpp new file mode 100644 index 00000000..a5464be5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.cpp @@ -0,0 +1,138 @@ + +#include "impl_org_ortc_RTCRtpCodecParameters.h" +#include "impl_org_ortc_RTCRtcpFeedback.h" +#include "impl_org_ortc_RTCRtpCodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpCodecParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecParameters::RTCRtpCodecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCodecParametersPtr wrapper::org::ortc::RTCRtpCodecParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpCodecParameters::~RTCRtpCodecParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCodecParameters::wrapper_init_org_ortc_RTCRtpCodecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCodecParameters::wrapper_init_org_ortc_RTCRtpCodecParameters(wrapper::org::ortc::RTCRtpCodecParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpCodecParameters::wrapper_init_org_ortc_RTCRtpCodecParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpCodecParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCRtpCodecParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpCodecParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->name = native.mName; + pThis->payloadType = SafeIntpayloadType)>(native.mPayloadType); + Helper::optionalSafeIntConvert(native.mClockRate, pThis->clockRate); + pThis->pTime = native.mPTime; + pThis->maxPTime = native.mMaxPTime; + Helper::optionalSafeIntConvert(native.mNumChannels, pThis->numChannels); + pThis->rtcpFeedback = make_shared< list >(); + for (auto iter = native.mRTCPFeedback.begin(); iter != native.mRTCPFeedback.end(); ++iter) { + auto wrapper = RTCRtcpFeedback::toWrapper(*iter); + if (!wrapper) continue; + pThis->rtcpFeedback->push_back(wrapper); + } + pThis->parameters = RTCRtpCodecParameterSettings::toWrapper(native.mParameters); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mName = wrapper->name; + result->mPayloadType = SafeIntmPayloadType)>(wrapper->payloadType); + Helper::optionalSafeIntConvert(wrapper->clockRate, result->mClockRate); + result->mPTime = wrapper->pTime; + result->mMaxPTime = wrapper->maxPTime; + Helper::optionalSafeIntConvert(wrapper->numChannels, result->mNumChannels); + if (wrapper->rtcpFeedback) { + for (auto iter = wrapper->rtcpFeedback->begin(); iter != wrapper->rtcpFeedback->end(); ++iter) { + auto native = RTCRtcpFeedback::toNative(*iter); + if (!native) continue; + result->mRTCPFeedback.push_back(*native); + } + } + if (wrapper->parameters) { + result->mParameters = RTCRtpCodecParameterSettings::toNative(wrapper->parameters); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.h new file mode 100644 index 00000000..228a8a41 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpCodecParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpCodecParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpCodecParameters : public wrapper::org::ortc::RTCRtpCodecParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::CodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpCodecParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpCodecParameters, WrapperType); + RTCRtpCodecParametersWeakPtr thisWeak_; + + RTCRtpCodecParameters() noexcept; + virtual ~RTCRtpCodecParameters() noexcept; + + // methods RTCRtpCodecParameters + void wrapper_init_org_ortc_RTCRtpCodecParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpCodecParameters(wrapper::org::ortc::RTCRtpCodecParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpCodecParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.cpp new file mode 100644 index 00000000..829a65f2 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.cpp @@ -0,0 +1,88 @@ + +#include "impl_org_ortc_RTCRtpContributingSource.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpContributingSource::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpContributingSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpContributingSource::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpContributingSource::RTCRtpContributingSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpContributingSourcePtr wrapper::org::ortc::RTCRtpContributingSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpContributingSource::~RTCRtpContributingSource() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpContributingSource::wrapper_init_org_ortc_RTCRtpContributingSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpContributingSource::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->timestamp = native.mTimestamp; + pThis->csrc = SafeIntcsrc)>(native.mCSRC); + pThis->audioLevel = SafeIntaudioLevel)>(native.mAudioLevel); + pThis->voiceActivityFlag = native.mVoiceActivityFlag; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mTimestamp = wrapper->timestamp; + result->mCSRC = SafeIntmCSRC)>(wrapper->csrc); + result->mAudioLevel = SafeIntmAudioLevel)>(wrapper->audioLevel); + result->mVoiceActivityFlag = wrapper->voiceActivityFlag; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.h new file mode 100644 index 00000000..bac8cf9f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpContributingSource.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpContributingSource.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpContributingSource : public wrapper::org::ortc::RTCRtpContributingSource + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPReceiverTypes::ContributingSource, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpContributingSource, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpContributingSource, WrapperType); + RTCRtpContributingSourceWeakPtr thisWeak_; + + RTCRtpContributingSource() noexcept; + virtual ~RTCRtpContributingSource() noexcept; + + // methods RTCRtpContributingSource + void wrapper_init_org_ortc_RTCRtpContributingSource() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.cpp new file mode 100644 index 00000000..e0bfd3f7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.cpp @@ -0,0 +1,148 @@ + +#include "impl_org_ortc_RTCRtpEncodingParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_RTCRtpFecParameters.h" +#include "impl_org_ortc_RTCRtpRtxParameters.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpEncodingParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpEncodingParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpEncodingParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpEncodingParameters::RTCRtpEncodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpEncodingParametersPtr wrapper::org::ortc::RTCRtpEncodingParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpEncodingParameters::~RTCRtpEncodingParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpEncodingParameters::wrapper_init_org_ortc_RTCRtpEncodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpEncodingParameters::wrapper_init_org_ortc_RTCRtpEncodingParameters(wrapper::org::ortc::RTCRtpEncodingParametersPtr source) noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpEncodingParameters::wrapper_init_org_ortc_RTCRtpEncodingParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpEncodingParameters::toJson() noexcept +{ + wrapper::org::ortc::JsonPtr result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpEncodingParameters::hash() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mSSRC, pThis->ssrc); + Helper::optionalSafeIntConvert(native.mCodecPayloadType, pThis->codecPayloadType); + if (native.mFEC.hasValue()) { + pThis->fec = RTCRtpFecParameters::toWrapper(native.mFEC); + } + if (native.mRTX.hasValue()) { + pThis->rtx = RTCRtpRtxParameters::toWrapper(native.mRTX); + } + if (native.mPriority.hasValue()) { + pThis->priority = Helper::toWrapper(native.mPriority.value()); + } + Helper::optionalSafeIntConvert(native.mMaxBitrate, pThis->maxBitrate); + pThis->minQuality = native.mMinQuality; + pThis->resolutionScale = native.mResolutionScale; + pThis->framerateScale = native.mFramerateScale; + pThis->active = native.mActive; + pThis->encodingId = native.mEncodingID; + pThis->dependencyEncodingIds = make_shared< list >(native.mDependencyEncodingIDs); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->ssrc, result->mSSRC); + Helper::optionalSafeIntConvert(wrapper->codecPayloadType, result->mCodecPayloadType); + if (wrapper->fec.hasValue()) { + if (wrapper->fec.value()) { + auto native = RTCRtpFecParameters::toNative(wrapper->fec.value()); + if (native) { + result->mFEC = *native; + } + } + } + if (wrapper->rtx.hasValue()) { + if (wrapper->rtx.value()) { + auto native = RTCRtpRtxParameters::toNative(wrapper->rtx.value()); + if (native) { + result->mRTX = *native; + } + } + } + if (wrapper->priority.hasValue()) { + result->mPriority = Helper::toNative(wrapper->priority.value()); + } + Helper::optionalSafeIntConvert(wrapper->maxBitrate, result->mMaxBitrate); + result->mMinQuality = wrapper->minQuality; + result->mResolutionScale = wrapper->resolutionScale; + result->mFramerateScale = wrapper->framerateScale; + result->mActive = wrapper->active; + result->mEncodingID = wrapper->encodingId; + if (wrapper->dependencyEncodingIds) { + result->mDependencyEncodingIDs = (*wrapper->dependencyEncodingIds); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.h new file mode 100644 index 00000000..c9698e90 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpEncodingParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpEncodingParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpEncodingParameters : public wrapper::org::ortc::RTCRtpEncodingParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::EncodingParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpEncodingParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpEncodingParameters, WrapperType); + RTCRtpEncodingParametersWeakPtr thisWeak_; + + RTCRtpEncodingParameters() noexcept; + virtual ~RTCRtpEncodingParameters() noexcept; + + // methods RTCRtpEncodingParameters + void wrapper_init_org_ortc_RTCRtpEncodingParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpEncodingParameters(wrapper::org::ortc::RTCRtpEncodingParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpEncodingParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.cpp new file mode 100644 index 00000000..f2f006f5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.cpp @@ -0,0 +1,117 @@ + +#include "impl_org_ortc_RTCRtpFecParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFecParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFecParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFecParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpFecParameters::RTCRtpFecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpFecParametersPtr wrapper::org::ortc::RTCRtpFecParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpFecParameters::~RTCRtpFecParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFecParameters::wrapper_init_org_ortc_RTCRtpFecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFecParameters::wrapper_init_org_ortc_RTCRtpFecParameters(wrapper::org::ortc::RTCRtpFecParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFecParameters::wrapper_init_org_ortc_RTCRtpFecParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpFecParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpFecParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mSSRC, pThis->ssrc); + pThis->mechanism = native.mMechanism; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->ssrc, result->mSSRC); + result->mMechanism = wrapper->mechanism; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.h new file mode 100644 index 00000000..2ea529ec --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFecParameters.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpFecParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpFecParameters : public wrapper::org::ortc::RTCRtpFecParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::FECParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpFecParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpFecParameters, WrapperType); + RTCRtpFecParametersWeakPtr thisWeak_; + + RTCRtpFecParameters() noexcept; + virtual ~RTCRtpFecParameters() noexcept; + + // methods RTCRtpFecParameters + void wrapper_init_org_ortc_RTCRtpFecParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpFecParameters(wrapper::org::ortc::RTCRtpFecParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpFecParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp new file mode 100644 index 00000000..87e4f30e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp @@ -0,0 +1,128 @@ + +#include "impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::RTCRtpFlexFecCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersPtr wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::~RTCRtpFlexFecCodecCapabilityParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpFlexFecCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpFlexFecCodecCapabilityParameters(wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpFlexFecCodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpFlexFecCodecCapabilityParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->repairWindow = native.mRepairWindow; + Helper::optionalSafeIntConvert(native.mL, pThis->columns); + Helper::optionalSafeIntConvert(native.mD, pThis->rows); + if (native.mToP.hasValue()) { + pThis->toP = Helper::toWrapper(native.mToP.value()); + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mRepairWindow = wrapper->repairWindow; + Helper::optionalSafeIntConvert(wrapper->columns, result->mL); + Helper::optionalSafeIntConvert(wrapper->rows, result->mD); + if (wrapper->toP.hasValue()) { + result->mToP = Helper::toNative(wrapper->toP.value()); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h new file mode 100644 index 00000000..3b4227b0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpFlexFecCodecCapabilityParameters : public wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::FlexFECCodecCapabilityParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpFlexFecCodecCapabilityParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParameters, WrapperType); + RTCRtpFlexFecCodecCapabilityParametersWeakPtr thisWeak_; + + RTCRtpFlexFecCodecCapabilityParameters() noexcept; + virtual ~RTCRtpFlexFecCodecCapabilityParameters() noexcept; + + // methods RTCRtpFlexFecCodecCapabilityParameters + void wrapper_init_org_ortc_RTCRtpFlexFecCodecCapabilityParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpFlexFecCodecCapabilityParameters(wrapper::org::ortc::RTCRtpFlexFecCodecCapabilityParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpFlexFecCodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp new file mode 100644 index 00000000..ae9da056 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp @@ -0,0 +1,128 @@ + +#include "impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::RTCRtpFlexFecCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpFlexFecCodecParameterSettingsPtr wrapper::org::ortc::RTCRtpFlexFecCodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::~RTCRtpFlexFecCodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::wrapper_init_org_ortc_RTCRtpFlexFecCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::wrapper_init_org_ortc_RTCRtpFlexFecCodecParameterSettings(wrapper::org::ortc::RTCRtpFlexFecCodecParameterSettingsPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpFlexFecCodecParameterSettings::wrapper_init_org_ortc_RTCRtpFlexFecCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->repairWindow = native.mRepairWindow; + Helper::optionalSafeIntConvert(native.mL, pThis->columns); + Helper::optionalSafeIntConvert(native.mD, pThis->rows); + if (native.mToP.hasValue()) { + pThis->toP = Helper::toWrapper(native.mToP.value()); + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mRepairWindow = wrapper->repairWindow; + Helper::optionalSafeIntConvert(wrapper->columns, result->mL); + Helper::optionalSafeIntConvert(wrapper->rows, result->mD); + if (wrapper->toP.hasValue()) { + result->mToP = Helper::toNative(wrapper->toP.value()); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h new file mode 100644 index 00000000..e713e3d1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h @@ -0,0 +1,43 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpFlexFecCodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpFlexFecCodecParameterSettings : public wrapper::org::ortc::RTCRtpFlexFecCodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::FlexFECCodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpFlexFecCodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpFlexFecCodecParameterSettings, WrapperType); + RTCRtpFlexFecCodecParameterSettingsWeakPtr thisWeak_; + + RTCRtpFlexFecCodecParameterSettings() noexcept; + virtual ~RTCRtpFlexFecCodecParameterSettings() noexcept; + + // methods RTCRtpFlexFecCodecCapabilityParameters + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods RTCRtpFlexFecCodecParameterSettings + void wrapper_init_org_ortc_RTCRtpFlexFecCodecParameterSettings() noexcept override; + void wrapper_init_org_ortc_RTCRtpFlexFecCodecParameterSettings(wrapper::org::ortc::RTCRtpFlexFecCodecParameterSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpFlexFecCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp new file mode 100644 index 00000000..9cb7f299 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp @@ -0,0 +1,140 @@ + +#include "impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::RTCRtpH264CodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpH264CodecCapabilityParametersPtr wrapper::org::ortc::RTCRtpH264CodecCapabilityParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::~RTCRtpH264CodecCapabilityParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpH264CodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpH264CodecCapabilityParameters(wrapper::org::ortc::RTCRtpH264CodecCapabilityParametersPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpH264CodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpH264CodecCapabilityParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mProfileLevelID, pThis->profileLevelId); + pThis->packetizationModes = make_shared< list< unsigned short > >(); + for (auto iter = native.mPacketizationModes.begin(); iter != native.mPacketizationModes.end(); ++iter) { + pThis->packetizationModes->push_back(SafeInt(*iter)); + } + Helper::optionalSafeIntConvert(native.mMaxMBPS, pThis->maxMbps); + Helper::optionalSafeIntConvert(native.mMaxSMBPS, pThis->maxSMbps); + Helper::optionalSafeIntConvert(native.mMaxFS, pThis->maxFs); + Helper::optionalSafeIntConvert(native.mMaxCPB, pThis->maxCpb); + Helper::optionalSafeIntConvert(native.mMaxDPB, pThis->maxDpb); + Helper::optionalSafeIntConvert(native.mMaxBR, pThis->maxBr); + + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->profileLevelId, result->mProfileLevelID); + if (wrapper->packetizationModes) { + for (auto iter = wrapper->packetizationModes->begin(); iter != wrapper->packetizationModes->end(); ++iter) { + result->mPacketizationModes.push_back(SafeIntmPacketizationModes)::value_type>(*iter)); + } + } + Helper::optionalSafeIntConvert(wrapper->maxMbps, result->mMaxMBPS); + Helper::optionalSafeIntConvert(wrapper->maxSMbps, result->mMaxSMBPS); + Helper::optionalSafeIntConvert(wrapper->maxFs, result->mMaxFS); + Helper::optionalSafeIntConvert(wrapper->maxCpb, result->mMaxCPB); + Helper::optionalSafeIntConvert(wrapper->maxDpb, result->mMaxDPB); + Helper::optionalSafeIntConvert(wrapper->maxBr, result->mMaxBR); + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h new file mode 100644 index 00000000..89ad3c8e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpH264CodecCapabilityParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpH264CodecCapabilityParameters : public wrapper::org::ortc::RTCRtpH264CodecCapabilityParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::H264CodecCapabilityParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpH264CodecCapabilityParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpH264CodecCapabilityParameters, WrapperType); + RTCRtpH264CodecCapabilityParametersWeakPtr thisWeak_; + + RTCRtpH264CodecCapabilityParameters() noexcept; + virtual ~RTCRtpH264CodecCapabilityParameters() noexcept; + + // methods RTCRtpH264CodecCapabilityParameters + void wrapper_init_org_ortc_RTCRtpH264CodecCapabilityParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpH264CodecCapabilityParameters(wrapper::org::ortc::RTCRtpH264CodecCapabilityParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpH264CodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp new file mode 100644 index 00000000..95cef202 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp @@ -0,0 +1,142 @@ + +#include "impl_org_ortc_RTCRtpH264CodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::RTCRtpH264CodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpH264CodecParameterSettingsPtr wrapper::org::ortc::RTCRtpH264CodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::~RTCRtpH264CodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::wrapper_init_org_ortc_RTCRtpH264CodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::wrapper_init_org_ortc_RTCRtpH264CodecParameterSettings(wrapper::org::ortc::RTCRtpH264CodecParameterSettingsPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpH264CodecParameterSettings::wrapper_init_org_ortc_RTCRtpH264CodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mProfileLevelID, pThis->profileLevelId); + pThis->packetizationModes = make_shared< list< unsigned short > >(); + for (auto iter = native.mPacketizationModes.begin(); iter != native.mPacketizationModes.end(); ++iter) { + pThis->packetizationModes->push_back(SafeInt(*iter)); + } + Helper::optionalSafeIntConvert(native.mMaxMBPS, pThis->maxMbps); + Helper::optionalSafeIntConvert(native.mMaxSMBPS, pThis->maxSMbps); + Helper::optionalSafeIntConvert(native.mMaxFS, pThis->maxFs); + Helper::optionalSafeIntConvert(native.mMaxCPB, pThis->maxCpb); + Helper::optionalSafeIntConvert(native.mMaxDPB, pThis->maxDpb); + Helper::optionalSafeIntConvert(native.mMaxBR, pThis->maxBr); + + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->profileLevelId, result->mProfileLevelID); + if (wrapper->packetizationModes) { + for (auto iter = wrapper->packetizationModes->begin(); iter != wrapper->packetizationModes->end(); ++iter) { + result->mPacketizationModes.push_back(SafeIntmPacketizationModes)::value_type>(*iter)); + } + } + Helper::optionalSafeIntConvert(wrapper->maxMbps, result->mMaxMBPS); + Helper::optionalSafeIntConvert(wrapper->maxSMbps, result->mMaxSMBPS); + Helper::optionalSafeIntConvert(wrapper->maxFs, result->mMaxFS); + Helper::optionalSafeIntConvert(wrapper->maxCpb, result->mMaxCPB); + Helper::optionalSafeIntConvert(wrapper->maxDpb, result->mMaxDPB); + Helper::optionalSafeIntConvert(wrapper->maxBr, result->mMaxBR); + + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.h new file mode 100644 index 00000000..42a027d8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpH264CodecParameterSettings.h @@ -0,0 +1,43 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpH264CodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpH264CodecParameterSettings : public wrapper::org::ortc::RTCRtpH264CodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::H264CodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpH264CodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpH264CodecParameterSettings, WrapperType); + RTCRtpH264CodecParameterSettingsWeakPtr thisWeak_; + + RTCRtpH264CodecParameterSettings() noexcept; + virtual ~RTCRtpH264CodecParameterSettings() noexcept; + + // methods RTCRtpH264CodecCapabilityParameters + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods RTCRtpH264CodecParameterSettings + void wrapper_init_org_ortc_RTCRtpH264CodecParameterSettings() noexcept override; + void wrapper_init_org_ortc_RTCRtpH264CodecParameterSettings(wrapper::org::ortc::RTCRtpH264CodecParameterSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpH264CodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.cpp new file mode 100644 index 00000000..85cc002a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.cpp @@ -0,0 +1,116 @@ + +#include "impl_org_ortc_RTCRtpHeaderExtension.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpHeaderExtension::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpHeaderExtension::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpHeaderExtension::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpHeaderExtension::RTCRtpHeaderExtension() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpHeaderExtensionPtr wrapper::org::ortc::RTCRtpHeaderExtension::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpHeaderExtension::~RTCRtpHeaderExtension() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpHeaderExtension::wrapper_init_org_ortc_RTCRtpHeaderExtension() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpHeaderExtension::wrapper_init_org_ortc_RTCRtpHeaderExtension(wrapper::org::ortc::RTCRtpHeaderExtensionPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpHeaderExtension::wrapper_init_org_ortc_RTCRtpHeaderExtension(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpHeaderExtension::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpHeaderExtension::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->kind = native.mKind; + pThis->uri = native.mURI; + pThis->preferredId = SafeIntpreferredId)>(native.mPreferredID); + pThis->preferredEncrypt = native.mPreferredEncrypt; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mKind = wrapper->kind; + result->mURI = wrapper->uri; + result->mPreferredID = SafeIntmPreferredID)>(wrapper->preferredId); + result->mPreferredEncrypt = wrapper->preferredEncrypt; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.h new file mode 100644 index 00000000..9cac6665 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtension.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpHeaderExtension.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpHeaderExtension : public wrapper::org::ortc::RTCRtpHeaderExtension + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::HeaderExtension, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpHeaderExtension, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpHeaderExtension, WrapperType); + RTCRtpHeaderExtensionWeakPtr thisWeak_; + + RTCRtpHeaderExtension() noexcept; + virtual ~RTCRtpHeaderExtension() noexcept; + + // methods RTCRtpHeaderExtension + void wrapper_init_org_ortc_RTCRtpHeaderExtension() noexcept override; + void wrapper_init_org_ortc_RTCRtpHeaderExtension(wrapper::org::ortc::RTCRtpHeaderExtensionPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpHeaderExtension(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp new file mode 100644 index 00000000..4ad24f33 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp @@ -0,0 +1,114 @@ + +#include "impl_org_ortc_RTCRtpHeaderExtensionParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::RTCRtpHeaderExtensionParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr wrapper::org::ortc::RTCRtpHeaderExtensionParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::~RTCRtpHeaderExtensionParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::wrapper_init_org_ortc_RTCRtpHeaderExtensionParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::wrapper_init_org_ortc_RTCRtpHeaderExtensionParameters(wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::wrapper_init_org_ortc_RTCRtpHeaderExtensionParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpHeaderExtensionParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->uri = native.mURI; + pThis->id = SafeIntid)>(native.mID); + pThis->encrypt = native.mEncrypt; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mURI = wrapper->uri; + result->mID = SafeIntmID)>(wrapper->id); + result->mEncrypt = wrapper->encrypt; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.h new file mode 100644 index 00000000..677e8d51 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpHeaderExtensionParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpHeaderExtensionParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpHeaderExtensionParameters : public wrapper::org::ortc::RTCRtpHeaderExtensionParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::HeaderExtensionParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpHeaderExtensionParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpHeaderExtensionParameters, WrapperType); + RTCRtpHeaderExtensionParametersWeakPtr thisWeak_; + + RTCRtpHeaderExtensionParameters() noexcept; + virtual ~RTCRtpHeaderExtensionParameters() noexcept; + + // methods RTCRtpHeaderExtensionParameters + void wrapper_init_org_ortc_RTCRtpHeaderExtensionParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpHeaderExtensionParameters(wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpHeaderExtensionParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.cpp new file mode 100644 index 00000000..fc43dcab --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.cpp @@ -0,0 +1,162 @@ + +#include "impl_org_ortc_RTCRtpListener.h" +#include "impl_org_ortc_RTCRtpUnhandledEvent.h" +#include "impl_org_ortc_RTCRtpTransport.h" +#include "impl_org_ortc_RTCRtpHeaderExtensionParameters.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpListener::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpListener::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpListener::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpListener::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpListener::RTCRtpListener() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpListenerPtr wrapper::org::ortc::RTCRtpListener::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpListener::~RTCRtpListener() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCRtpListener::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpListener::wrapper_init_org_ortc_RTCRtpListener(wrapper::org::ortc::RTCRtpTransportPtr transport) noexcept +{ + native_ = NativeType::create(thisWeak_.lock(), RTCRtpTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpListener::wrapper_init_org_ortc_RTCRtpListener( + wrapper::org::ortc::RTCRtpTransportPtr transport, + shared_ptr< list< wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr > > headerExtensions + ) noexcept(false) +{ + ::ortc::IRTPTypes::HeaderExtensionParametersList nativeList; + if (headerExtensions) { + for (auto iter = headerExtensions->begin(); iter != headerExtensions->end(); ++iter) { + auto native = RTCRtpHeaderExtensionParameters::toNative(*iter); + if (!native) continue; + nativeList.push_back(*native); + } + } + native_ = NativeType::create(thisWeak_.lock(), RTCRtpTransport::toNative(transport), nativeList); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpListener::setHeaderExtensions(shared_ptr< list< wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr > > headerExtensions) noexcept(false) +{ + ::ortc::IRTPTypes::HeaderExtensionParametersList nativeList; + if (headerExtensions) { + for (auto iter = headerExtensions->begin(); iter != headerExtensions->end(); ++iter) { + auto native = RTCRtpHeaderExtensionParameters::toNative(*iter); + if (!native) continue; + nativeList.push_back(*native); + } + } + native_->setHeaderExtensions(nativeList); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCRtpListener::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpTransportPtr wrapper::impl::org::ortc::RTCRtpListener::get_transport() noexcept +{ + return RTCRtpTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpListener::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onRTPListenerUnhandledRTP( + IRTPListenerPtr listener, + SSRCType ssrc, + PayloadType payloadType, + const char *mid, + const char *rid +) noexcept +{ + onUnhandled(RTCRtpUnhandledEvent::toWrapper(ssrc, payloadType, mid, rid)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.h new file mode 100644 index 00000000..c75f894a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpListener.h @@ -0,0 +1,68 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpListener.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpListener : public wrapper::org::ortc::RTCRtpListener, + public ::ortc::IRTPListenerDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPListener, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPListener, IRTPListener); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPListenerSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpListener, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpListener, WrapperType); + + RTCRtpListenerWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCRtpListener() noexcept; + virtual ~RTCRtpListener() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCRtpListener + void wrapper_init_org_ortc_RTCRtpListener(wrapper::org::ortc::RTCRtpTransportPtr transport) noexcept override; + void wrapper_init_org_ortc_RTCRtpListener( + wrapper::org::ortc::RTCRtpTransportPtr transport, + shared_ptr< list< wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr > > headerExtensions + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument + void setHeaderExtensions(shared_ptr< list< wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr > > headerExtensions) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument + + // properties RTCRtpListener + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCRtpTransportPtr get_transport() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onRTPListenerUnhandledRTP( + IRTPListenerPtr listener, + SSRCType ssrc, + PayloadType payloadType, + const char *mid, + const char *rid + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp new file mode 100644 index 00000000..1229d458 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp @@ -0,0 +1,134 @@ + +#include "impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::RTCRtpOpusCodecCapabilityOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsPtr wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::~RTCRtpOpusCodecCapabilityOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityOptions(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityOptions(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityOptions::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mComplexity, pThis->complexity); + if (native.mSignal.hasValue()) { + pThis->signal = Helper::toWrapper(native.mSignal.value()); + } + if (native.mApplication.hasValue()) { + pThis->application = Helper::toWrapper(native.mApplication.value()); + } + Helper::optionalSafeIntConvert(native.mPacketLossPerc, pThis->packetLossPerc); + pThis->predictionDisabled = native.mPredictionDisabled; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->complexity, result->mComplexity); + if (wrapper->signal.hasValue()) { + result->mSignal = Helper::toNative(wrapper->signal.value()); + } + if (wrapper->application.hasValue()) { + result->mApplication = Helper::toNative(wrapper->application.value()); + } + Helper::optionalSafeIntConvert(wrapper->packetLossPerc, result->mPacketLossPerc); + result->mPredictionDisabled = wrapper->predictionDisabled; + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h new file mode 100644 index 00000000..1a8fc2da --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpOpusCodecCapabilityOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpOpusCodecCapabilityOptions : public wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::OpusCodecCapabilityOptions, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpOpusCodecCapabilityOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptions, WrapperType); + RTCRtpOpusCodecCapabilityOptionsWeakPtr thisWeak_; + + RTCRtpOpusCodecCapabilityOptions() noexcept; + virtual ~RTCRtpOpusCodecCapabilityOptions() noexcept; + + // methods RTCRtpOpusCodecCapabilityOptions + void wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityOptions() noexcept override; + void wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityOptions(wrapper::org::ortc::RTCRtpOpusCodecCapabilityOptionsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityOptions(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp new file mode 100644 index 00000000..93abbbdf --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp @@ -0,0 +1,130 @@ + +#include "impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::RTCRtpOpusCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpOpusCodecCapabilityParametersPtr wrapper::org::ortc::RTCRtpOpusCodecCapabilityParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::~RTCRtpOpusCodecCapabilityParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityParameters(wrapper::org::ortc::RTCRtpOpusCodecCapabilityParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpOpusCodecCapabilityParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mMaxPlaybackRate, pThis->maxPlaybackRate); + Helper::optionalSafeIntConvert(native.mMaxAverageBitrate, pThis->maxAverageBitrate); + pThis->stereo = native.mStereo; + pThis->cbr = native.mCBR; + pThis->useInbandFec = native.mUseInbandFEC; + pThis->useDtx = native.mUseDTX; + Helper::optionalSafeIntConvert(native.mSPropMaxCaptureRate, pThis->sPropMaxCaptureRate); + pThis->sPropStereo = native.mSPropStereo; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->maxPlaybackRate, result->mMaxPlaybackRate); + Helper::optionalSafeIntConvert(wrapper->maxAverageBitrate, result->mMaxAverageBitrate); + result->mStereo = wrapper->stereo; + result->mCBR = wrapper->cbr; + result->mUseInbandFEC = wrapper->useInbandFec; + result->mUseDTX = wrapper->useDtx; + Helper::optionalSafeIntConvert(wrapper->sPropMaxCaptureRate, result->mSPropMaxCaptureRate); + result->mSPropStereo = wrapper->sPropStereo; + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h new file mode 100644 index 00000000..1b8ab43b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpOpusCodecCapabilityParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpOpusCodecCapabilityParameters : public wrapper::org::ortc::RTCRtpOpusCodecCapabilityParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::OpusCodecCapabilityParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpOpusCodecCapabilityParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpOpusCodecCapabilityParameters, WrapperType); + RTCRtpOpusCodecCapabilityParametersWeakPtr thisWeak_; + + RTCRtpOpusCodecCapabilityParameters() noexcept; + virtual ~RTCRtpOpusCodecCapabilityParameters() noexcept; + + // methods RTCRtpOpusCodecCapabilityParameters + void wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityParameters(wrapper::org::ortc::RTCRtpOpusCodecCapabilityParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpOpusCodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp new file mode 100644 index 00000000..0847c6cf --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp @@ -0,0 +1,149 @@ + +#include "impl_org_ortc_RTCRtpOpusCodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::RTCRtpOpusCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpOpusCodecParameterSettingsPtr wrapper::org::ortc::RTCRtpOpusCodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::~RTCRtpOpusCodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::wrapper_init_org_ortc_RTCRtpOpusCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::wrapper_init_org_ortc_RTCRtpOpusCodecParameterSettings(wrapper::org::ortc::RTCRtpOpusCodecParameterSettingsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::wrapper_init_org_ortc_RTCRtpOpusCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpOpusCodecParameterSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mMaxPlaybackRate, pThis->maxPlaybackRate); + Helper::optionalSafeIntConvert(native.mMaxAverageBitrate, pThis->maxAverageBitrate); + pThis->stereo = native.mStereo; + pThis->cbr = native.mCBR; + pThis->useInbandFec = native.mUseInbandFEC; + pThis->useDtx = native.mUseDTX; + Helper::optionalSafeIntConvert(native.mComplexity, pThis->complexity); + if (native.mSignal.hasValue()) { + pThis->signal = Helper::toWrapper(native.mSignal.value()); + } + if (native.mApplication.hasValue()) { + pThis->application = Helper::toWrapper(native.mApplication.value()); + } + Helper::optionalSafeIntConvert(native.mPacketLossPerc, pThis->packetLossPerc); + pThis->predictionDisabled = native.mPredictionDisabled; + Helper::optionalSafeIntConvert(native.mSPropMaxCaptureRate, pThis->sPropMaxCaptureRate); + pThis->sPropStereo = native.mSPropStereo; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->maxPlaybackRate, result->mMaxPlaybackRate); + Helper::optionalSafeIntConvert(wrapper->maxAverageBitrate, result->mMaxAverageBitrate); + result->mStereo = wrapper->stereo; + result->mCBR = wrapper->cbr; + result->mUseInbandFEC = wrapper->useInbandFec; + result->mUseDTX = wrapper->useDtx; + Helper::optionalSafeIntConvert(wrapper->complexity, result->mComplexity); + if (wrapper->signal.hasValue()) { + result->mSignal = Helper::toNative(wrapper->signal.value()); + } + if (wrapper->application.hasValue()) { + result->mApplication = Helper::toNative(wrapper->application.value()); + } + Helper::optionalSafeIntConvert(wrapper->packetLossPerc, result->mPacketLossPerc); + result->mPacketLossPerc = wrapper->predictionDisabled; + Helper::optionalSafeIntConvert(wrapper->sPropMaxCaptureRate, result->mSPropMaxCaptureRate); + result->mSPropStereo = wrapper->sPropStereo; + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.h new file mode 100644 index 00000000..0e60415e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpOpusCodecParameterSettings.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpOpusCodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpOpusCodecParameterSettings : public wrapper::org::ortc::RTCRtpOpusCodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::OpusCodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpOpusCodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpOpusCodecParameterSettings, WrapperType); + RTCRtpOpusCodecParameterSettingsWeakPtr thisWeak_; + + RTCRtpOpusCodecParameterSettings() noexcept; + virtual ~RTCRtpOpusCodecParameterSettings() noexcept; + + // methods RTCRtpOpusCodecParameterSettings + void wrapper_init_org_ortc_RTCRtpOpusCodecParameterSettings() noexcept override; + void wrapper_init_org_ortc_RTCRtpOpusCodecParameterSettings(wrapper::org::ortc::RTCRtpOpusCodecParameterSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpOpusCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.cpp new file mode 100644 index 00000000..befd99c0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.cpp @@ -0,0 +1,159 @@ + +#include "impl_org_ortc_RTCRtpParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_RTCRtpCodecParameters.h" +#include "impl_org_ortc_RTCRtpHeaderExtensionParameters.h" +#include "impl_org_ortc_RTCRtpEncodingParameters.h" +#include "impl_org_ortc_RTCRtcpParameters.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpParameters::RTCRtpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpParametersPtr wrapper::org::ortc::RTCRtpParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpParameters::~RTCRtpParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpParameters::wrapper_init_org_ortc_RTCRtpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpParameters::wrapper_init_org_ortc_RTCRtpParameters(wrapper::org::ortc::RTCRtpParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpParameters::wrapper_init_org_ortc_RTCRtpParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCRtpParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->codecs = make_shared< list< wrapper::org::ortc::RTCRtpCodecParametersPtr > >(); + for (auto iter = native.mCodecs.begin(); iter != native.mCodecs.end(); ++iter) { + auto wrapper = RTCRtpCodecParameters::toWrapper(*iter); + if (!wrapper) continue; + pThis->codecs->push_back(wrapper); + } + pThis->headerExtensions = make_shared< list< wrapper::org::ortc::RTCRtpHeaderExtensionParametersPtr > >(); + for (auto iter = native.mHeaderExtensions.begin(); iter != native.mHeaderExtensions.end(); ++iter) { + auto wrapper = RTCRtpHeaderExtensionParameters::toWrapper(*iter); + if (!wrapper) continue; + pThis->headerExtensions->push_back(wrapper); + } + pThis->encodings = make_shared< list< wrapper::org::ortc::RTCRtpEncodingParametersPtr > >(); + for (auto iter = native.mEncodings.begin(); iter != native.mEncodings.end(); ++iter) { + auto wrapper = RTCRtpEncodingParameters::toWrapper(*iter); + if (!wrapper) continue; + pThis->encodings->push_back(wrapper); + } + pThis->rtcp = RTCRtcpParameters::toWrapper(native.mRTCP); + pThis->degredationPreference = Helper::toWrapper(native.mDegredationPreference); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + if (wrapper->codecs) { + for (auto iter = wrapper->codecs->begin(); iter != wrapper->codecs->end(); ++iter) { + auto native = RTCRtpCodecParameters::toNative(*iter); + if (!native) continue; + result->mCodecs.push_back(*native); + } + } + if (wrapper->headerExtensions) { + for (auto iter = wrapper->headerExtensions->begin(); iter != wrapper->headerExtensions->end(); ++iter) { + auto native = RTCRtpHeaderExtensionParameters::toNative(*iter); + if (!native) continue; + result->mHeaderExtensions.push_back(*native); + } + } + if (wrapper->encodings) { + for (auto iter = wrapper->encodings->begin(); iter != wrapper->encodings->end(); ++iter) { + auto native = RTCRtpEncodingParameters::toNative(*iter); + if (!native) continue; + result->mEncodings.push_back(*native); + } + } + if (wrapper->rtcp) { + auto native = RTCRtcpParameters::toNative(wrapper->rtcp); + if (native) { + result->mRTCP = *native; + } + } + result->mDegredationPreference = Helper::toNative(wrapper->degredationPreference); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.h new file mode 100644 index 00000000..759d5ab4 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpParameters : public wrapper::org::ortc::RTCRtpParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::Parameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpParameters, WrapperType); + RTCRtpParametersWeakPtr thisWeak_; + + RTCRtpParameters() noexcept; + virtual ~RTCRtpParameters() noexcept; + + // methods RTCRtpParameters + void wrapper_init_org_ortc_RTCRtpParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpParameters(wrapper::org::ortc::RTCRtpParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.cpp new file mode 100644 index 00000000..9b788ec5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.cpp @@ -0,0 +1,196 @@ + +#include "impl_org_ortc_RTCRtpReceiver.h" +#include "impl_org_ortc_RTCRtpTransport.h" +#include "impl_org_ortc_RTCRtcpTransport.h" +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_RTCRtpContributingSource.h" +#include "impl_org_ortc_RTCRtpCapabilities.h" +#include "impl_org_ortc_RTCRtpParameters.h" + +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpReceiver::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpReceiver::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpReceiver::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpReceiver::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpReceiver::RTCRtpReceiver() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpReceiverPtr wrapper::org::ortc::RTCRtpReceiver::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpReceiver::~RTCRtpReceiver() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCRtpReceiver::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpReceiver::wrapper_init_org_ortc_RTCRtpReceiver( + wrapper::org::ortc::MediaStreamTrackKind kind, + wrapper::org::ortc::RTCRtpTransportPtr transport + ) noexcept(false) +{ + native_ = IRTPReceiver::create(thisWeak_.lock(), Helper::toNative(kind), RTCRtpTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpReceiver::wrapper_init_org_ortc_RTCRtpReceiver( + wrapper::org::ortc::MediaStreamTrackKind kind, + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) +{ + native_ = IRTPReceiver::create(thisWeak_.lock(), Helper::toNative(kind), RTCRtpTransport::toNative(transport), RTCRtcpTransport::toNative(rtcpTransport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpReceiver::setTransport(wrapper::org::ortc::RTCRtpTransportPtr transport) noexcept(false) +{ + native_->setTransport(RTCRtpTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpReceiver::setTransport( + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) +{ + native_->setTransport(RTCRtpTransport::toNative(transport), RTCRtcpTransport::toNative(rtcpTransport)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCapabilitiesPtr wrapper::org::ortc::RTCRtpReceiver::getCapabilities(Optional< wrapper::org::ortc::MediaStreamTrackKind > kind) noexcept +{ + return wrapper::impl::org::ortc::RTCRtpCapabilities::toWrapper(NativeType::getCapabilities(kind.hasValue() ? Optional<::ortc::IMediaStreamTrackTypes::Kinds>(wrapper::impl::org::ortc::Helper::toNative(kind.value())) : Optional<::ortc::IMediaStreamTrackTypes::Kinds>())); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::ortc::RTCRtpReceiver::receive(wrapper::org::ortc::RTCRtpParametersPtr parameters) noexcept(false) +{ + auto native = RTCRtpParameters::toNative(parameters); + if (!native) return Promise::createRejected(Helper::getGuiQueue()); + return Helper::toWrapper(native_->receive(*native)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpReceiver::stop() noexcept +{ + native_->stop(); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCRtpContributingSourcePtr > > wrapper::impl::org::ortc::RTCRtpReceiver::getContributingSources() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::RTCRtpContributingSourcePtr > >(); + auto sources = native_->getContributingSources(); + for (auto iter = sources.begin(); iter != sources.end(); ++iter) { + auto wrapper = RTCRtpContributingSource::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpReceiver::requestSendCsrc(uint32_t csrc) noexcept +{ + native_->requestSendCSRC(csrc); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCRtpReceiver::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackPtr wrapper::impl::org::ortc::RTCRtpReceiver::get_track() noexcept +{ + return MediaStreamTrack::toWrapper(native_->track()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpTransportPtr wrapper::impl::org::ortc::RTCRtpReceiver::get_transport() noexcept +{ + return RTCRtpTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtcpTransportPtr wrapper::impl::org::ortc::RTCRtpReceiver::get_rtcpTransport() noexcept +{ + return RTCRtcpTransport::toWrapper(native_->rtcpTransport()); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.h new file mode 100644 index 00000000..499ed828 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpReceiver.h @@ -0,0 +1,71 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpReceiver.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpReceiver : public wrapper::org::ortc::RTCRtpReceiver, + public ::ortc::IRTPReceiverDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPReceiver, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPReceiver, IRTPReceiver); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPReceiverSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpReceiver, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpReceiver, WrapperType); + RTCRtpReceiverWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCRtpReceiver() noexcept; + virtual ~RTCRtpReceiver() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCRtpReceiver + void wrapper_init_org_ortc_RTCRtpReceiver( + wrapper::org::ortc::MediaStreamTrackKind kind, + wrapper::org::ortc::RTCRtpTransportPtr transport + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void wrapper_init_org_ortc_RTCRtpReceiver( + wrapper::org::ortc::MediaStreamTrackKind kind, + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void setTransport(wrapper::org::ortc::RTCRtpTransportPtr transport) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void setTransport( + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + PromisePtr receive(wrapper::org::ortc::RTCRtpParametersPtr parameters) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void stop() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCRtpContributingSourcePtr > > getContributingSources() noexcept override; + void requestSendCsrc(uint32_t csrc) noexcept override; + + // properties RTCRtpReceiver + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::MediaStreamTrackPtr get_track() noexcept override; + wrapper::org::ortc::RTCRtpTransportPtr get_transport() noexcept override; + wrapper::org::ortc::RTCRtcpTransportPtr get_rtcpTransport() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp new file mode 100644 index 00000000..3e6f175d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp @@ -0,0 +1,125 @@ + +#include "impl_org_ortc_RTCRtpRedCodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::RTCRtpRedCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpRedCodecParameterSettingsPtr wrapper::org::ortc::RTCRtpRedCodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::~RTCRtpRedCodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::wrapper_init_org_ortc_RTCRtpRedCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::wrapper_init_org_ortc_RTCRtpRedCodecParameterSettings(wrapper::org::ortc::RTCRtpRedCodecParameterSettingsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::wrapper_init_org_ortc_RTCRtpRedCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpRedCodecParameterSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->payloadTypes = make_shared< list< uint8_t > >(); + for (auto iter = native.mPayloadTypes.begin(); iter != native.mPayloadTypes.end(); ++iter) { + pThis->payloadTypes->push_back(SafeInt(*iter)); + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + if (wrapper->payloadTypes) { + for (auto iter = wrapper->payloadTypes->begin(); iter != wrapper->payloadTypes->end(); ++iter) { + result->mPayloadTypes.push_back(SafeInt< decltype(result->mPayloadTypes)::value_type >(*iter)); + } + } + + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.h new file mode 100644 index 00000000..d703f287 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRedCodecParameterSettings.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpRedCodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpRedCodecParameterSettings : public wrapper::org::ortc::RTCRtpRedCodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::REDCodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpRedCodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpRedCodecParameterSettings, WrapperType); + RTCRtpRedCodecParameterSettingsWeakPtr thisWeak_; + + RTCRtpRedCodecParameterSettings() noexcept; + virtual ~RTCRtpRedCodecParameterSettings() noexcept; + + // methods RTCRtpRedCodecParameterSettings + void wrapper_init_org_ortc_RTCRtpRedCodecParameterSettings() noexcept override; + void wrapper_init_org_ortc_RTCRtpRedCodecParameterSettings(wrapper::org::ortc::RTCRtpRedCodecParameterSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpRedCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp new file mode 100644 index 00000000..f9fac111 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp @@ -0,0 +1,118 @@ + +#include "impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::RTCRtpRtxCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpRtxCodecCapabilityParametersPtr wrapper::org::ortc::RTCRtpRtxCodecCapabilityParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::~RTCRtpRtxCodecCapabilityParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpRtxCodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpRtxCodecCapabilityParameters(wrapper::org::ortc::RTCRtpRtxCodecCapabilityParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpRtxCodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpRtxCodecCapabilityParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->apt = SafeIntapt)>(native.mApt); + pThis->rtxTime = native.mRTXTime; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mApt = SafeIntmApt)>(wrapper->apt); + result->mRTXTime = wrapper->rtxTime; + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h new file mode 100644 index 00000000..1bbd8a6f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpRtxCodecCapabilityParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpRtxCodecCapabilityParameters : public wrapper::org::ortc::RTCRtpRtxCodecCapabilityParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::RTXCodecCapabilityParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpRtxCodecCapabilityParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpRtxCodecCapabilityParameters, WrapperType); + RTCRtpRtxCodecCapabilityParametersWeakPtr thisWeak_; + + RTCRtpRtxCodecCapabilityParameters() noexcept; + virtual ~RTCRtpRtxCodecCapabilityParameters() noexcept; + + // methods RTCRtpRtxCodecCapabilityParameters + void wrapper_init_org_ortc_RTCRtpRtxCodecCapabilityParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpRtxCodecCapabilityParameters(wrapper::org::ortc::RTCRtpRtxCodecCapabilityParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpRtxCodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp new file mode 100644 index 00000000..1793eb6f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp @@ -0,0 +1,118 @@ + +#include "impl_org_ortc_RTCRtpRtxCodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::RTCRtpRtxCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpRtxCodecParameterSettingsPtr wrapper::org::ortc::RTCRtpRtxCodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::~RTCRtpRtxCodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::wrapper_init_org_ortc_RTCRtpRtxCodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::wrapper_init_org_ortc_RTCRtpRtxCodecParameterSettings(wrapper::org::ortc::RTCRtpRtxCodecParameterSettingsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxCodecParameterSettings::wrapper_init_org_ortc_RTCRtpRtxCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->apt = SafeIntapt)>(native.mApt); + pThis->rtxTime = native.mRTXTime; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mApt = SafeIntmApt)>(wrapper->apt); + result->mRTXTime = wrapper->rtxTime; + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.h new file mode 100644 index 00000000..93843e3e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxCodecParameterSettings.h @@ -0,0 +1,43 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpRtxCodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpRtxCodecParameterSettings : public wrapper::org::ortc::RTCRtpRtxCodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::RTXCodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpRtxCodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpRtxCodecParameterSettings, WrapperType); + RTCRtpRtxCodecParameterSettingsWeakPtr thisWeak_; + + RTCRtpRtxCodecParameterSettings() noexcept; + virtual ~RTCRtpRtxCodecParameterSettings() noexcept; + + // methods RTCRtpRtxCodecCapabilityParameters + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods RTCRtpRtxCodecParameterSettings + void wrapper_init_org_ortc_RTCRtpRtxCodecParameterSettings() noexcept override; + void wrapper_init_org_ortc_RTCRtpRtxCodecParameterSettings(wrapper::org::ortc::RTCRtpRtxCodecParameterSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpRtxCodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.cpp new file mode 100644 index 00000000..271a9d87 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.cpp @@ -0,0 +1,110 @@ + +#include "impl_org_ortc_RTCRtpRtxParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpRtxParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRtxParameters::RTCRtpRtxParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpRtxParametersPtr wrapper::org::ortc::RTCRtpRtxParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpRtxParameters::~RTCRtpRtxParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxParameters::wrapper_init_org_ortc_RTCRtpRtxParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxParameters::wrapper_init_org_ortc_RTCRtpRtxParameters(wrapper::org::ortc::RTCRtpRtxParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpRtxParameters::wrapper_init_org_ortc_RTCRtpRtxParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpRtxParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpRtxParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mSSRC, pThis->ssrc); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->ssrc, result->mSSRC); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.h new file mode 100644 index 00000000..2bbadba8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpRtxParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpRtxParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpRtxParameters : public wrapper::org::ortc::RTCRtpRtxParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::RTXParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpRtxParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpRtxParameters, WrapperType); + RTCRtpRtxParametersWeakPtr thisWeak_; + + RTCRtpRtxParameters() noexcept; + virtual ~RTCRtpRtxParameters() noexcept; + + // methods RTCRtpRtxParameters + void wrapper_init_org_ortc_RTCRtpRtxParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpRtxParameters(wrapper::org::ortc::RTCRtpRtxParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpRtxParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.cpp new file mode 100644 index 00000000..13e85524 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.cpp @@ -0,0 +1,201 @@ + +#include "impl_org_ortc_RTCRtpSender.h" +#include "impl_org_ortc_RTCRtpTransport.h" +#include "impl_org_ortc_RTCRtcpTransport.h" +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_RTCRtpParameters.h" +#include "impl_org_ortc_RTCRtpCapabilities.h" +#include "impl_org_ortc_RTCSsrcConflictEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpSender::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpSender::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpSender::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpSender::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpSender::RTCRtpSender() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpSenderPtr wrapper::org::ortc::RTCRtpSender::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpSender::~RTCRtpSender() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCRtpSender::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpSender::wrapper_init_org_ortc_RTCRtpSender( + wrapper::org::ortc::MediaStreamTrackPtr track, + wrapper::org::ortc::RTCRtpTransportPtr transport + ) noexcept(false) +{ + native_ = NativeType::create(thisWeak_.lock(), wrapper::impl::org::ortc::MediaStreamTrack::toNative(track), wrapper::impl::org::ortc::RTCRtpTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpSender::wrapper_init_org_ortc_RTCRtpSender( + wrapper::org::ortc::MediaStreamTrackPtr track, + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) +{ + native_ = NativeType::create(thisWeak_.lock(), wrapper::impl::org::ortc::MediaStreamTrack::toNative(track), wrapper::impl::org::ortc::RTCRtpTransport::toNative(transport), wrapper::impl::org::ortc::RTCRtcpTransport::toNative(rtcpTransport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpSender::setTransport(wrapper::org::ortc::RTCRtpTransportPtr transport) noexcept(false) +{ + native_->setTransport(RTCRtpTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpSender::setTransport( + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) +{ + native_->setTransport(RTCRtpTransport::toNative(transport), RTCRtcpTransport::toNative(rtcpTransport)); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::ortc::RTCRtpSender::setTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept(false) +{ + return Helper::toWrapper(native_->setTrack(MediaStreamTrack::toNative(track))); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCapabilitiesPtr wrapper::org::ortc::RTCRtpSender::getCapabilities(Optional< wrapper::org::ortc::MediaStreamTrackKind > kind) noexcept +{ + Optional<::ortc::IMediaStreamTrackTypes::Kinds> native; + if (kind.hasValue()) { + native = wrapper::impl::org::ortc::Helper::toNative(kind.value()); + } + return wrapper::impl::org::ortc::RTCRtpCapabilities::toWrapper(NativeType::getCapabilities(native)); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::ortc::RTCRtpSender::send(wrapper::org::ortc::RTCRtpParametersPtr parameters) noexcept(false) +{ + auto native = RTCRtpParameters::toNative(parameters); + ZS_ASSERT(native); + return Helper::toWrapper(native_->send(*native)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpSender::stop() noexcept +{ + native_->stop(); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCRtpSender::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackPtr wrapper::impl::org::ortc::RTCRtpSender::get_track() noexcept +{ + return MediaStreamTrack::toWrapper(native_->track()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpTransportPtr wrapper::impl::org::ortc::RTCRtpSender::get_transport() noexcept +{ + return RTCRtpTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtcpTransportPtr wrapper::impl::org::ortc::RTCRtpSender::get_rtcpTransport() noexcept +{ + return RTCRtcpTransport::toWrapper(native_->rtcpTransport()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpSender::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onRTPSenderSSRCConflict( + IRTPSenderPtr sender, + SSRCType ssrc +) noexcept +{ + onSsrcConflict(RTCSsrcConflictEvent::toWrapper(ssrc)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.h new file mode 100644 index 00000000..8e97a8a2 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpSender.h @@ -0,0 +1,78 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpSender.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpSender : public wrapper::org::ortc::RTCRtpSender, + public ::ortc::IRTPSenderDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPSender, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPSender, IRTPSender); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPSenderSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpSender, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpSender, WrapperType); + + RTCRtpSenderWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCRtpSender() noexcept; + virtual ~RTCRtpSender() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCRtpSender + void wrapper_init_org_ortc_RTCRtpSender( + wrapper::org::ortc::MediaStreamTrackPtr track, + wrapper::org::ortc::RTCRtpTransportPtr transport + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void wrapper_init_org_ortc_RTCRtpSender( + wrapper::org::ortc::MediaStreamTrackPtr track, + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void setTransport(wrapper::org::ortc::RTCRtpTransportPtr transport) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void setTransport( + wrapper::org::ortc::RTCRtpTransportPtr transport, + wrapper::org::ortc::RTCRtcpTransportPtr rtcpTransport + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + PromisePtr setTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + PromisePtr send(wrapper::org::ortc::RTCRtpParametersPtr parameters) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void stop() noexcept override; + + // properties RTCRtpSender + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::MediaStreamTrackPtr get_track() noexcept override; + wrapper::org::ortc::RTCRtpTransportPtr get_transport() noexcept override; + wrapper::org::ortc::RTCRtcpTransportPtr get_rtcpTransport() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onRTPSenderSSRCConflict( + IRTPSenderPtr sender, + SSRCType ssrc + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.cpp new file mode 100644 index 00000000..55ae96bc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.cpp @@ -0,0 +1,184 @@ + +#include "impl_org_ortc_RTCRtpStreamStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpStreamStats::RTCRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpStreamStatsPtr wrapper::org::ortc::RTCRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpStreamStats::~RTCRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpStreamStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCRtpStreamStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCRtpStreamStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCRtpStreamStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpStreamStats::wrapper_init_org_ortc_RTCRtpStreamStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpStreamStats::wrapper_init_org_ortc_RTCRtpStreamStats(wrapper::org::ortc::RTCRtpStreamStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCRtpStreamStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpStreamStats::wrapper_init_org_ortc_RTCRtpStreamStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::ortc::RTCRtpStreamStats::get_ssrc() noexcept +{ + return (Optional< uint32_t >)native_->mSSRC; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_associatedStatId() noexcept +{ + return native_->mAssociatedStatID; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCRtpStreamStats::get_isRemote() noexcept +{ + return native_->mIsRemote; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_mediaType() noexcept +{ + return native_->mMediaType; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_mediaTrackId() noexcept +{ + return native_->mMediaTrackID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_transportId() noexcept +{ + return native_->mTransportID; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpStreamStats::get_codecId() noexcept +{ + return native_->mCodecID; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCRtpStreamStats::get_firCount() noexcept +{ + return native_->mFIRCount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCRtpStreamStats::get_pliCount() noexcept +{ + return native_->mPLICount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCRtpStreamStats::get_nackCount() noexcept +{ + return native_->mNACKCount; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCRtpStreamStats::get_sliCount() noexcept +{ + return native_->mSLICount; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpStreamStatsPtr wrapper::impl::org::ortc::RTCRtpStreamStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCRtpStreamStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpStreamStats::NativeStatsPtr wrapper::impl::org::ortc::RTCRtpStreamStats::toNative(wrapper::org::ortc::RTCRtpStreamStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.h new file mode 100644 index 00000000..7393372c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpStreamStats.h @@ -0,0 +1,59 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpStreamStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpStreamStats : public wrapper::org::ortc::RTCRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::RTPStreamStats, NativeStats); + RTCRtpStreamStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCRtpStreamStats() noexcept; + virtual ~RTCRtpStreamStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCRtpStreamStats + void wrapper_init_org_ortc_RTCRtpStreamStats() noexcept override; + void wrapper_init_org_ortc_RTCRtpStreamStats(wrapper::org::ortc::RTCRtpStreamStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpStreamStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_associatedStatId() noexcept override; + bool get_isRemote() noexcept override; + String get_mediaType() noexcept override; + String get_mediaTrackId() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + + static RTCRtpStreamStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCRtpStreamStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.cpp new file mode 100644 index 00000000..f3b0d36e --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.cpp @@ -0,0 +1,78 @@ + +#include "impl_org_ortc_RTCRtpTransport.h" +#include "impl_org_ortc_RTCDtlsTransport.h" +#include "impl_org_ortc_RTCIceTransport.h" +#include "impl_org_ortc_RTCSrtpSdesTransport.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpTransport::RTCRtpTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpTransportPtr wrapper::org::ortc::RTCRtpTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpTransport::~RTCRtpTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCDtlsTransport::toNative(impl); + } + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return RTCSrtpSdesTransport::toNative(impl); + } + + { + auto impl = std::dynamic_pointer_cast(wrapper); + if (impl) return impl->native_; + } + return NativeTypePtr(); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.h new file mode 100644 index 00000000..de658b52 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpTransport.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpTransport : public wrapper::org::ortc::RTCRtpTransport + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpTransport, WrapperType); + RTCRtpTransportWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCRtpTransport() noexcept; + virtual ~RTCRtpTransport() noexcept; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.cpp new file mode 100644 index 00000000..49483626 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.cpp @@ -0,0 +1,88 @@ + +#include "impl_org_ortc_RTCRtpUnhandledEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpUnhandledEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpUnhandledEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpUnhandledEvent::RTCRtpUnhandledEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpUnhandledEventPtr wrapper::org::ortc::RTCRtpUnhandledEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpUnhandledEvent::~RTCRtpUnhandledEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpUnhandledEvent::wrapper_init_org_ortc_RTCRtpUnhandledEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +uint32_t wrapper::impl::org::ortc::RTCRtpUnhandledEvent::get_ssrc() noexcept +{ + return ssrc_; +} + +//------------------------------------------------------------------------------ +uint8_t wrapper::impl::org::ortc::RTCRtpUnhandledEvent::get_payloadType() noexcept +{ + return payloadType_; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpUnhandledEvent::get_muxId() noexcept +{ + return mid_; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpUnhandledEvent::get_rid() noexcept +{ + return rid_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper( + SSRCType ssrc, + PayloadType payloadType, + const String &mid, + const String &rid +) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->ssrc_ = ssrc; + pThis->payloadType_ = payloadType; + pThis->mid_ = mid; + pThis->rid_ = rid; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.h new file mode 100644 index 00000000..b1d888b3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpUnhandledEvent.h @@ -0,0 +1,48 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpUnhandledEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpUnhandledEvent : public wrapper::org::ortc::RTCRtpUnhandledEvent + { + typedef ::ortc::IRTPTypes::SSRCType SSRCType; + typedef ::ortc::IRTPTypes::PayloadType PayloadType; + ZS_DECLARE_TYPEDEF_PTR(RTCRtpUnhandledEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpUnhandledEvent, WrapperType); + RTCRtpUnhandledEventWeakPtr thisWeak_; + SSRCType ssrc_; + PayloadType payloadType_; + String mid_; + String rid_; + + RTCRtpUnhandledEvent() noexcept; + virtual ~RTCRtpUnhandledEvent() noexcept; + void wrapper_init_org_ortc_RTCRtpUnhandledEvent() noexcept override; + + // properties RTCRtpUnhandledEvent + uint32_t get_ssrc() noexcept override; + uint8_t get_payloadType() noexcept override; + String get_muxId() noexcept override; + String get_rid() noexcept override; + + static WrapperImplTypePtr toWrapper( + SSRCType ssrc, + PayloadType payloadType, + const String &mid, + const String &rid + ) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp new file mode 100644 index 00000000..1fe9a692 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::RTCRtpVp8CodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpVp8CodecCapabilityParametersPtr wrapper::org::ortc::RTCRtpVp8CodecCapabilityParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::~RTCRtpVp8CodecCapabilityParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpVp8CodecCapabilityParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpVp8CodecCapabilityParameters(wrapper::org::ortc::RTCRtpVp8CodecCapabilityParametersPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::wrapper_init_org_ortc_RTCRtpVp8CodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpVp8CodecCapabilityParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + Helper::optionalSafeIntConvert(native.mMaxFR, pThis->maxFr); + Helper::optionalSafeIntConvert(native.mMaxFS, pThis->maxFs); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->maxFr, result->mMaxFR); + Helper::optionalSafeIntConvert(wrapper->maxFs, result->mMaxFS); + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h new file mode 100644 index 00000000..753c6866 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpVp8CodecCapabilityParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpVp8CodecCapabilityParameters : public wrapper::org::ortc::RTCRtpVp8CodecCapabilityParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::VP8CodecCapabilityParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpVp8CodecCapabilityParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpVp8CodecCapabilityParameters, WrapperType); + RTCRtpVp8CodecCapabilityParametersWeakPtr thisWeak_; + + RTCRtpVp8CodecCapabilityParameters() noexcept; + virtual ~RTCRtpVp8CodecCapabilityParameters() noexcept; + + // methods RTCRtpVp8CodecCapabilityParameters + void wrapper_init_org_ortc_RTCRtpVp8CodecCapabilityParameters() noexcept override; + void wrapper_init_org_ortc_RTCRtpVp8CodecCapabilityParameters(wrapper::org::ortc::RTCRtpVp8CodecCapabilityParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpVp8CodecCapabilityParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp new file mode 100644 index 00000000..b02a9938 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_ortc_RTCRtpVp8CodecParameterSettings.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::RTCRtpVp8CodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpVp8CodecParameterSettingsPtr wrapper::org::ortc::RTCRtpVp8CodecParameterSettings::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::~RTCRtpVp8CodecParameterSettings() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::wrapper_init_org_ortc_RTCRtpVp8CodecParameterSettings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::wrapper_init_org_ortc_RTCRtpVp8CodecParameterSettings(wrapper::org::ortc::RTCRtpVp8CodecParameterSettingsPtr source) noexcept +{ + if (!source) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCRtpVp8CodecParameterSettings::wrapper_init_org_ortc_RTCRtpVp8CodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AnyPtr native) noexcept +{ + return toWrapper(std::dynamic_pointer_cast(native)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + Helper::optionalSafeIntConvert(native.mMaxFR, pThis->maxFr); + Helper::optionalSafeIntConvert(native.mMaxFS, pThis->maxFs); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->maxFr, result->mMaxFR); + Helper::optionalSafeIntConvert(wrapper->maxFs, result->mMaxFS); + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.h b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.h new file mode 100644 index 00000000..ce73dab6 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCRtpVp8CodecParameterSettings.h @@ -0,0 +1,43 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCRtpVp8CodecParameterSettings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCRtpVp8CodecParameterSettings : public wrapper::org::ortc::RTCRtpVp8CodecParameterSettings + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::VP8CodecParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCRtpVp8CodecParameterSettings, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCRtpVp8CodecParameterSettings, WrapperType); + RTCRtpVp8CodecParameterSettingsWeakPtr thisWeak_; + + RTCRtpVp8CodecParameterSettings() noexcept; + virtual ~RTCRtpVp8CodecParameterSettings() noexcept; + + // methods RTCRtpVp8CodecCapabilityParameters + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods RTCRtpVp8CodecParameterSettings + void wrapper_init_org_ortc_RTCRtpVp8CodecParameterSettings() noexcept override; + void wrapper_init_org_ortc_RTCRtpVp8CodecParameterSettings(wrapper::org::ortc::RTCRtpVp8CodecParameterSettingsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCRtpVp8CodecParameterSettings(wrapper::org::ortc::JsonPtr json) noexcept override; + + static WrapperImplTypePtr toWrapper(AnyPtr native) noexcept; + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.cpp new file mode 100644 index 00000000..d673e50d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.cpp @@ -0,0 +1,117 @@ + +#include "impl_org_ortc_RTCSctpCapabilities.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpCapabilities::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpCapabilities::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpCapabilities::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpCapabilities::RTCSctpCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpCapabilitiesPtr wrapper::org::ortc::RTCSctpCapabilities::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpCapabilities::~RTCSctpCapabilities() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpCapabilities::wrapper_init_org_ortc_RTCSctpCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpCapabilities::wrapper_init_org_ortc_RTCSctpCapabilities(wrapper::org::ortc::RTCSctpCapabilitiesPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpCapabilities::wrapper_init_org_ortc_RTCSctpCapabilities(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCSctpCapabilities::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCSctpCapabilities")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSctpCapabilities::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->maxMessageSize = SafeIntmaxMessageSize)>(native.mMaxMessageSize); + pThis->minPort = SafeIntminPort)>(native.mMinPort); + pThis->maxPort = SafeIntmaxPort)>(native.mMaxPort); + pThis->maxUsablePorts = SafeIntmaxUsablePorts)>(native.mMaxUsablePorts); + pThis->maxSessionsPerPort = SafeIntmaxSessionsPerPort)>(native.mMaxSessionsPerPort); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mMaxMessageSize = SafeIntmMaxMessageSize)>(wrapper->maxMessageSize); + result->mMinPort = SafeIntmMinPort)>(wrapper->minPort); + result->mMaxPort = SafeIntmMaxPort)>(wrapper->maxPort); + result->mMaxUsablePorts = SafeIntmMaxUsablePorts)>(wrapper->maxUsablePorts); + result->mMaxSessionsPerPort = SafeIntmMaxSessionsPerPort)>(wrapper->maxSessionsPerPort); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.h b/ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.h new file mode 100644 index 00000000..013115d4 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpCapabilities.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSctpCapabilities.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSctpCapabilities : public wrapper::org::ortc::RTCSctpCapabilities + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransportTypes::Capabilities, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSctpCapabilities, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSctpCapabilities, WrapperType); + RTCSctpCapabilitiesWeakPtr thisWeak_; + + RTCSctpCapabilities() noexcept; + virtual ~RTCSctpCapabilities() noexcept; + + // methods RTCSctpCapabilities + void wrapper_init_org_ortc_RTCSctpCapabilities() noexcept override; + void wrapper_init_org_ortc_RTCSctpCapabilities(wrapper::org::ortc::RTCSctpCapabilitiesPtr source) noexcept override; + void wrapper_init_org_ortc_RTCSctpCapabilities(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.cpp new file mode 100644 index 00000000..9e164497 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.cpp @@ -0,0 +1,219 @@ + +#include "impl_org_ortc_RTCSctpTransport.h" +#include "impl_org_ortc_RTCDtlsTransport.h" +#include "impl_org_ortc_RTCSctpCapabilities.h" +#include "impl_org_ortc_RTCSctpTransportListener.h" +#include "impl_org_ortc_RTCSctpTransportStateChangeEvent.h" +#include "impl_org_ortc_RTCDataChannelEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +using namespace wrapper::impl::org::ortc; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransport::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransport::RTCSctpTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportPtr wrapper::org::ortc::RTCSctpTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransport::~RTCSctpTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCSctpTransport::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransport::wrapper_init_org_ortc_RTCSctpTransport(wrapper::org::ortc::RTCDtlsTransportPtr transport) noexcept(false) +{ + native_ = NativeType::create(thisWeak_.lock(), RTCDtlsTransport::toNative(transport)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransport::wrapper_init_org_ortc_RTCSctpTransport( + wrapper::org::ortc::RTCDtlsTransportPtr transport, + uint16_t localPort + ) noexcept(false) +{ + native_ = NativeType::create(thisWeak_.lock(), RTCDtlsTransport::toNative(transport), localPort); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportListenerPtr wrapper::org::ortc::RTCSctpTransport::listen( + wrapper::org::ortc::RTCDtlsTransportPtr transport, + wrapper::org::ortc::RTCSctpCapabilitiesPtr remoteCapabilities + ) noexcept(false) +{ + auto native = wrapper::impl::org::ortc::RTCSctpCapabilities::toNative(remoteCapabilities); + ZS_THROW_INVALID_ARGUMENT_IF(!native); + return wrapper::impl::org::ortc::RTCSctpTransportListener::toWrapper(NativeType::listen(::ortc::ISCTPTransportListenerDelegatePtr(), wrapper::impl::org::ortc::RTCDtlsTransport::toNative(transport), *native)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpCapabilitiesPtr wrapper::org::ortc::RTCSctpTransport::getCapabilities() noexcept +{ + return wrapper::impl::org::ortc::RTCSctpCapabilities::toWrapper(NativeType::getCapabilities()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransport::start(wrapper::org::ortc::RTCSctpCapabilitiesPtr remoteCapabilities) noexcept(false) +{ + auto native = RTCSctpCapabilities::toNative(remoteCapabilities); + ZS_THROW_INVALID_ARGUMENT_IF(!native); + native_->start(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransport::start( + wrapper::org::ortc::RTCSctpCapabilitiesPtr remoteCapabilities, + uint16_t remotePort + ) noexcept(false) +{ + auto native = RTCSctpCapabilities::toNative(remoteCapabilities); + ZS_THROW_INVALID_ARGUMENT_IF(!native); + native_->start(*native, remotePort); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransport::stop() noexcept +{ + native_->stop(); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCSctpTransport::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCDtlsTransportPtr wrapper::impl::org::ortc::RTCSctpTransport::get_transport() noexcept +{ + return RTCDtlsTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportState wrapper::impl::org::ortc::RTCSctpTransport::get_state() noexcept +{ + return Helper::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +uint16_t wrapper::impl::org::ortc::RTCSctpTransport::get_port() noexcept +{ + return SafeInt(native_->port()); +} + +//------------------------------------------------------------------------------ +uint16_t wrapper::impl::org::ortc::RTCSctpTransport::get_localPort() noexcept +{ + return SafeInt(native_->localPort()); +} + +//------------------------------------------------------------------------------ +Optional< uint16_t > wrapper::impl::org::ortc::RTCSctpTransport::get_remotePort() noexcept +{ + Optional< uint16_t > result {}; + auto native = native_->remotePort(); + Helper::optionalSafeIntConvert(native, result); + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransport::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onSCTPTransportStateChange( + ISCTPTransportPtr transport, + States state +) noexcept +{ + onStateChange(RTCSctpTransportStateChangeEvent::toWrapper(state)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onSCTPTransportDataChannel( + ISCTPTransportPtr transport, + ::ortc::IDataChannelPtr channel +) noexcept +{ + onDataChannel(RTCDataChannelEvent::toWrapper(channel)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.h new file mode 100644 index 00000000..9d95c19b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransport.h @@ -0,0 +1,78 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSctpTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSctpTransport : public wrapper::org::ortc::RTCSctpTransport, + public ::ortc::ISCTPTransportDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransport, ISCTPTransport); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransportSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCSctpTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSctpTransport, WrapperType); + + RTCSctpTransportWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCSctpTransport() noexcept; + virtual ~RTCSctpTransport() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCSctpTransport + void wrapper_init_org_ortc_RTCSctpTransport(wrapper::org::ortc::RTCDtlsTransportPtr transport) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void wrapper_init_org_ortc_RTCSctpTransport( + wrapper::org::ortc::RTCDtlsTransportPtr transport, + uint16_t localPort + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void start(wrapper::org::ortc::RTCSctpCapabilitiesPtr remoteCapabilities) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void start( + wrapper::org::ortc::RTCSctpCapabilitiesPtr remoteCapabilities, + uint16_t remotePort + ) noexcept(false) override; // throws ::zsLib::Exceptions::BadState::zsLib::Exceptions::InvalidArgument + void stop() noexcept override; + + // properties RTCSctpTransport + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCDtlsTransportPtr get_transport() noexcept override; + wrapper::org::ortc::RTCSctpTransportState get_state() noexcept override; + uint16_t get_port() noexcept override; + uint16_t get_localPort() noexcept override; + Optional< uint16_t > get_remotePort() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onSCTPTransportStateChange( + ISCTPTransportPtr transport, + States state + ) noexcept override; + virtual void onSCTPTransportDataChannel( + ISCTPTransportPtr transport, + ::ortc::IDataChannelPtr channel + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.cpp new file mode 100644 index 00000000..97830258 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.cpp @@ -0,0 +1,103 @@ + +#include "impl_org_ortc_RTCSctpTransportListener.h" +#include "impl_org_ortc_RTCSctpTransport.h" +#include "impl_org_ortc_RTCSctpTransportListenerEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListener::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListener::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListener::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListener::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportListener::RTCSctpTransportListener() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportListenerPtr wrapper::org::ortc::RTCSctpTransportListener::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportListener::~RTCSctpTransportListener() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransportListener::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onSCTPTransport(::ortc::ISCTPTransportPtr transport) noexcept +{ + onTransport(RTCSctpTransportListenerEvent::toWrapper(transport)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + // result->defaultSubscription_ = false; // always have a default subscription + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + // always have a default subscription - thus noop +#if 0 + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +#endif // +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.h b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.h new file mode 100644 index 00000000..914d7ecc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListener.h @@ -0,0 +1,47 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSctpTransportListener.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSctpTransportListener : public wrapper::org::ortc::RTCSctpTransportListener, + public ::ortc::ISCTPTransportListenerDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransportListenerSubscription, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransportListenerSubscription, ISCTPTransportListenerSubscription); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransportListenerSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCSctpTransportListener, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSctpTransportListener, WrapperType); + + RTCSctpTransportListenerWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + //bool defaultSubscription_{ true }; // always last a default subscription + //NativeTypeSubscriptionPtr subscription_; // native type is a subscription + + RTCSctpTransportListener() noexcept; + virtual ~RTCSctpTransportListener() noexcept; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onSCTPTransport(::ortc::ISCTPTransportPtr transport) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.cpp new file mode 100644 index 00000000..9c524974 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.cpp @@ -0,0 +1,61 @@ + +#include "impl_org_ortc_RTCSctpTransportListenerEvent.h" +#include "impl_org_ortc_RTCSctpTransport.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListenerEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListenerEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportListenerEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportListenerEvent::RTCSctpTransportListenerEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportListenerEventPtr wrapper::org::ortc::RTCSctpTransportListenerEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportListenerEvent::~RTCSctpTransportListenerEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportPtr wrapper::impl::org::ortc::RTCSctpTransportListenerEvent::get_transport() noexcept +{ + return RTCSctpTransport::toWrapper(native_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.h new file mode 100644 index 00000000..378f3abb --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportListenerEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSctpTransportListenerEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSctpTransportListenerEvent : public wrapper::org::ortc::RTCSctpTransportListenerEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSctpTransportListenerEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSctpTransportListenerEvent, WrapperType); + RTCSctpTransportListenerEventWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCSctpTransportListenerEvent() noexcept; + virtual ~RTCSctpTransportListenerEvent() noexcept; + + // properties RTCSctpTransportListenerEvent + wrapper::org::ortc::RTCSctpTransportPtr get_transport() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp new file mode 100644 index 00000000..c4dca1b4 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp @@ -0,0 +1,60 @@ + +#include "impl_org_ortc_RTCSctpTransportStateChangeEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportStateChangeEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportStateChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSctpTransportStateChangeEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportStateChangeEvent::RTCSctpTransportStateChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportStateChangeEventPtr wrapper::org::ortc::RTCSctpTransportStateChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportStateChangeEvent::~RTCSctpTransportStateChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportState wrapper::impl::org::ortc::RTCSctpTransportStateChangeEvent::get_state() noexcept +{ + return Helper::toWrapper(native_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.h new file mode 100644 index 00000000..a4cfcf10 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStateChangeEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSctpTransportStateChangeEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSctpTransportStateChangeEvent : public wrapper::org::ortc::RTCSctpTransportStateChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISCTPTransportTypes::States, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSctpTransportStateChangeEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSctpTransportStateChangeEvent, WrapperType); + RTCSctpTransportStateChangeEventWeakPtr thisWeak_; + NativeType native_; + + RTCSctpTransportStateChangeEvent() noexcept; + virtual ~RTCSctpTransportStateChangeEvent() noexcept; + + // properties RTCSctpTransportStateChangeEvent + wrapper::org::ortc::RTCSctpTransportState get_state() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeType native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.cpp new file mode 100644 index 00000000..5628e7dd --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.cpp @@ -0,0 +1,131 @@ + +#include "impl_org_ortc_RTCSctpTransportStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportStats::RTCSctpTransportStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSctpTransportStatsPtr wrapper::org::ortc::RTCSctpTransportStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportStats::~RTCSctpTransportStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCSctpTransportStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCSctpTransportStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSctpTransportStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCSctpTransportStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCSctpTransportStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSctpTransportStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSctpTransportStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransportStats::wrapper_init_org_ortc_RTCSctpTransportStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransportStats::wrapper_init_org_ortc_RTCSctpTransportStats(wrapper::org::ortc::RTCSctpTransportStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCSctpTransportStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSctpTransportStats::wrapper_init_org_ortc_RTCSctpTransportStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCSctpTransportStats::get_dataChannelsOpened() noexcept +{ + return native_->mDataChannelsOpened; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCSctpTransportStats::get_dataChannelsClosed() noexcept +{ + return native_->mDataChannelsClosed; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportStatsPtr wrapper::impl::org::ortc::RTCSctpTransportStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCSctpTransportStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSctpTransportStats::NativeStatsPtr wrapper::impl::org::ortc::RTCSctpTransportStats::toNative(wrapper::org::ortc::RTCSctpTransportStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.h new file mode 100644 index 00000000..50a4b8e1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSctpTransportStats.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSctpTransportStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSctpTransportStats : public wrapper::org::ortc::RTCSctpTransportStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::SCTPTransportStats, NativeStats); + RTCSctpTransportStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCSctpTransportStats() noexcept; + virtual ~RTCSctpTransportStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCSctpTransportStats + void wrapper_init_org_ortc_RTCSctpTransportStats() noexcept override; + void wrapper_init_org_ortc_RTCSctpTransportStats(wrapper::org::ortc::RTCSctpTransportStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCSctpTransportStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + // properties RTCSctpTransportStats + unsigned long get_dataChannelsOpened() noexcept override; + unsigned long get_dataChannelsClosed() noexcept override; + + static RTCSctpTransportStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCSctpTransportStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp new file mode 100644 index 00000000..abc02595 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp @@ -0,0 +1,128 @@ + +#include "impl_org_ortc_RTCSrtpSdesCryptoParameters.h" +#include "impl_org_ortc_RTCSrtpSdesKeyParameters.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::RTCSrtpSdesCryptoParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr wrapper::org::ortc::RTCSrtpSdesCryptoParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::~RTCSrtpSdesCryptoParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::wrapper_init_org_ortc_RTCSrtpSdesCryptoParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::wrapper_init_org_ortc_RTCSrtpSdesCryptoParameters(wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::wrapper_init_org_ortc_RTCSrtpSdesCryptoParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCSrtpSdesCryptoParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSrtpSdesCryptoParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->tag = SafeInttag)>(native.mTag); + pThis->cryptoSuite = native.mCryptoSuite; + pThis->keyParams = make_shared< list< wrapper::org::ortc::RTCSrtpSdesKeyParametersPtr > >(); + for (auto iter = native.mKeyParams.begin(); iter != native.mKeyParams.end(); ++iter) { + auto wrapper = RTCSrtpSdesKeyParameters::toWrapper(*iter); + if (!wrapper) continue; + pThis->keyParams->push_back(wrapper); + } + pThis->sessionParams = make_shared< list< String > >(native.mSessionParams); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mTag = SafeIntmTag)>(wrapper->tag); + if (wrapper->keyParams) { + for (auto iter = wrapper->keyParams->begin(); iter != wrapper->keyParams->end(); ++iter) { + auto native = RTCSrtpSdesKeyParameters::toNative(*iter); + if (!native) continue; + result->mKeyParams.push_back(*native); + } + } + if (wrapper->sessionParams) { + result->mSessionParams = *(wrapper->sessionParams); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.h new file mode 100644 index 00000000..fe7982ef --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesCryptoParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSrtpSdesCryptoParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSrtpSdesCryptoParameters : public wrapper::org::ortc::RTCSrtpSdesCryptoParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISRTPSDESTransport::CryptoParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSrtpSdesCryptoParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSrtpSdesCryptoParameters, WrapperType); + RTCSrtpSdesCryptoParametersWeakPtr thisWeak_; + + RTCSrtpSdesCryptoParameters() noexcept; + virtual ~RTCSrtpSdesCryptoParameters() noexcept; + + // methods RTCSrtpSdesCryptoParameters + void wrapper_init_org_ortc_RTCSrtpSdesCryptoParameters() noexcept override; + void wrapper_init_org_ortc_RTCSrtpSdesCryptoParameters(wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCSrtpSdesCryptoParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.cpp new file mode 100644 index 00000000..6ba857dd --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.cpp @@ -0,0 +1,117 @@ + +#include "impl_org_ortc_RTCSrtpSdesKeyParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::RTCSrtpSdesKeyParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpSdesKeyParametersPtr wrapper::org::ortc::RTCSrtpSdesKeyParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::~RTCSrtpSdesKeyParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::wrapper_init_org_ortc_RTCSrtpSdesKeyParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::wrapper_init_org_ortc_RTCSrtpSdesKeyParameters(wrapper::org::ortc::RTCSrtpSdesKeyParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::wrapper_init_org_ortc_RTCSrtpSdesKeyParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCSrtpSdesKeyParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSrtpSdesKeyParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->keyMethod = native.mKeyMethod; + pThis->keySalt = native.mKeySalt; + pThis->lifetime = native.mLifetime; + pThis->mkiValue = native.mMKIValue; + pThis->mkiLength = SafeIntmkiLength)>(native.mMKILength); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mKeyMethod = wrapper->keyMethod; + result->mKeySalt = wrapper->keySalt; + result->mLifetime = wrapper->lifetime; + result->mMKIValue = wrapper->mkiValue; + result->mMKILength = SafeIntmMKILength)>(wrapper->mkiLength); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.h new file mode 100644 index 00000000..a416537d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesKeyParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSrtpSdesKeyParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSrtpSdesKeyParameters : public wrapper::org::ortc::RTCSrtpSdesKeyParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISRTPSDESTransportTypes::KeyParameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSrtpSdesKeyParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSrtpSdesKeyParameters, WrapperType); + RTCSrtpSdesKeyParametersWeakPtr thisWeak_; + + RTCSrtpSdesKeyParameters() noexcept; + virtual ~RTCSrtpSdesKeyParameters() noexcept; + + // methods RTCSrtpSdesKeyParameters + void wrapper_init_org_ortc_RTCSrtpSdesKeyParameters() noexcept override; + void wrapper_init_org_ortc_RTCSrtpSdesKeyParameters(wrapper::org::ortc::RTCSrtpSdesKeyParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCSrtpSdesKeyParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.cpp new file mode 100644 index 00000000..f98dbefc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.cpp @@ -0,0 +1,120 @@ + +#include "impl_org_ortc_RTCSrtpSdesParameters.h" +#include "impl_org_ortc_RTCSrtpSdesCryptoParameters.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesParameters::RTCSrtpSdesParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpSdesParametersPtr wrapper::org::ortc::RTCSrtpSdesParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesParameters::~RTCSrtpSdesParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesParameters::wrapper_init_org_ortc_RTCSrtpSdesParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesParameters::wrapper_init_org_ortc_RTCSrtpSdesParameters(wrapper::org::ortc::RTCSrtpSdesParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesParameters::wrapper_init_org_ortc_RTCSrtpSdesParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCSrtpSdesParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCSrtpSdesParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSrtpSdesParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->cryptoParams = make_shared< list< wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr > >(); + for (auto iter = native.mCryptoParams.begin(); iter != native.mCryptoParams.end(); ++iter) { + auto wrapper = RTCSrtpSdesCryptoParameters::toWrapper(*iter); + if (!wrapper) continue; + pThis->cryptoParams->push_back(wrapper); + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + if (wrapper->cryptoParams) { + for (auto iter = wrapper->cryptoParams->begin(); iter != wrapper->cryptoParams->end(); ++iter) { + auto native = RTCSrtpSdesCryptoParameters::toNative(*iter); + if (!native) continue; + result->mCryptoParams.push_back(*native); + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.h b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.h new file mode 100644 index 00000000..af452634 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSrtpSdesParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSrtpSdesParameters : public wrapper::org::ortc::RTCSrtpSdesParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISRTPSDESTransport::Parameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSrtpSdesParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSrtpSdesParameters, WrapperType); + RTCSrtpSdesParametersWeakPtr thisWeak_; + + RTCSrtpSdesParameters() noexcept; + virtual ~RTCSrtpSdesParameters() noexcept; + + // methods RTCSrtpSdesParameters + void wrapper_init_org_ortc_RTCSrtpSdesParameters() noexcept override; + void wrapper_init_org_ortc_RTCSrtpSdesParameters(wrapper::org::ortc::RTCSrtpSdesParametersPtr source) noexcept override; + void wrapper_init_org_ortc_RTCSrtpSdesParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.cpp new file mode 100644 index 00000000..deb030e8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.cpp @@ -0,0 +1,168 @@ + +#include "impl_org_ortc_RTCSrtpSdesTransport.h" +#include "impl_org_ortc_RTCIceTransport.h" +#include "impl_org_ortc_RTCSrtpSdesParameters.h" +#include "impl_org_ortc_RTCSrtpSdesCryptoParameters.h" +#include "impl_org_ortc_ErrorEvent.h" +#include "impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +namespace wrapper { namespace impl { namespace org { namespace ortc { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper); } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesTransport::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesTransport::RTCSrtpSdesTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpSdesTransportPtr wrapper::org::ortc::RTCSrtpSdesTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesTransport::~RTCSrtpSdesTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCSrtpSdesTransport::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesTransport::wrapper_init_org_ortc_RTCSrtpSdesTransport( + wrapper::org::ortc::RTCIceTransportPtr iceTransport, + wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr encryptParameters, + wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr decryptParameters + ) noexcept(false) +{ + auto nativeEnc = RTCSrtpSdesCryptoParameters::toNative(encryptParameters); + auto nativeDec = RTCSrtpSdesCryptoParameters::toNative(decryptParameters); + ZS_THROW_INVALID_ARGUMENT_IF(!nativeEnc); + ZS_THROW_INVALID_ARGUMENT_IF(!nativeDec); + + native_ = ISRTPSDESTransport::create(thisWeak_.lock(), RTCIceTransport::toNative(iceTransport), *nativeEnc, *nativeDec); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpSdesParametersPtr wrapper::org::ortc::RTCSrtpSdesTransport::getLocalParameters() noexcept +{ + return wrapper::impl::org::ortc::RTCSrtpSdesParameters::toWrapper(NativeType::getLocalParameters()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesTransport::stop() noexcept +{ + native_->stop(); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCSrtpSdesTransport::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportPtr wrapper::impl::org::ortc::RTCSrtpSdesTransport::get_transport() noexcept +{ + return RTCIceTransport::toWrapper(native_->transport()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceTransportPtr wrapper::impl::org::ortc::RTCSrtpSdesTransport::get_rtcpTransport() noexcept +{ + return RTCIceTransport::toWrapper(native_->rtcpTransport()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpSdesTransport::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onSRTPSDESTransportLifetimeRemaining( + ISRTPSDESTransportPtr transport, + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage +) noexcept +{ + onLifetimeRemaining(RTCSrtpSdesTransportLifetimeRemainingEvent::toWrapper(leastLifetimeRemainingPercentageForAllKeys, overallLifetimeRemainingPercentage)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onSRTPSDESTransportError( + ISRTPSDESTransportPtr transport, + ::ortc::ErrorAnyPtr error +) noexcept +{ + onError(ErrorEvent::toWrapper(error)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.h b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.h new file mode 100644 index 00000000..e00e0d87 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransport.h @@ -0,0 +1,72 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSrtpSdesTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSrtpSdesTransport : public wrapper::org::ortc::RTCSrtpSdesTransport, + public ::ortc::ISRTPSDESTransportDelegate + { + typedef unsigned long ULONG; + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISRTPSDESTransport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISRTPSDESTransport, ISRTPSDESTransport); + ZS_DECLARE_TYPEDEF_PTR(::ortc::ISRTPSDESTransportSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCSrtpSdesTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSrtpSdesTransport, WrapperType); + RTCSrtpSdesTransportWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCSrtpSdesTransport() noexcept; + virtual ~RTCSrtpSdesTransport() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCSrtpSdesTransport + void wrapper_init_org_ortc_RTCSrtpSdesTransport( + wrapper::org::ortc::RTCIceTransportPtr iceTransport, + wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr encryptParameters, + wrapper::org::ortc::RTCSrtpSdesCryptoParametersPtr decryptParameters + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void stop() noexcept override; + + // properties RTCSrtpSdesTransport + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::RTCIceTransportPtr get_transport() noexcept override; + wrapper::org::ortc::RTCIceTransportPtr get_rtcpTransport() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onSRTPSDESTransportLifetimeRemaining( + ISRTPSDESTransportPtr transport, + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage + ) noexcept override; + + virtual void onSRTPSDESTransportError( + ISRTPSDESTransportPtr transport, + ::ortc::ErrorAnyPtr error + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp new file mode 100644 index 00000000..f33f47d2 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp @@ -0,0 +1,67 @@ + +#include "impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::RTCSrtpSdesTransportLifetimeRemainingEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEventPtr wrapper::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::~RTCSrtpSdesTransportLifetimeRemainingEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::get_leastLifetimeRemainingPercentageForAllKeys() noexcept +{ + return leastLifetimeRemainingPercentageForAllKeys_; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent::get_overallLifetimeRemainingPercentage() noexcept +{ + return overallLifetimeRemainingPercentage_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper( + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage +) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->leastLifetimeRemainingPercentageForAllKeys_ = leastLifetimeRemainingPercentageForAllKeys; + pThis->overallLifetimeRemainingPercentage_ = overallLifetimeRemainingPercentage; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h new file mode 100644 index 00000000..00878936 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSrtpSdesTransportLifetimeRemainingEvent : public wrapper::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent + { + typedef unsigned long ULONG; + ZS_DECLARE_TYPEDEF_PTR(RTCSrtpSdesTransportLifetimeRemainingEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSrtpSdesTransportLifetimeRemainingEvent, WrapperType); + RTCSrtpSdesTransportLifetimeRemainingEventWeakPtr thisWeak_; + unsigned long leastLifetimeRemainingPercentageForAllKeys_{}; + unsigned long overallLifetimeRemainingPercentage_{}; + + RTCSrtpSdesTransportLifetimeRemainingEvent() noexcept; + virtual ~RTCSrtpSdesTransportLifetimeRemainingEvent() noexcept; + + // properties RTCSrtpSdesTransportLifetimeRemainingEvent + unsigned long get_leastLifetimeRemainingPercentageForAllKeys() noexcept override; + unsigned long get_overallLifetimeRemainingPercentage() noexcept override; + + static WrapperImplTypePtr toWrapper( + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage + ) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.cpp new file mode 100644 index 00000000..d7006a30 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.cpp @@ -0,0 +1,120 @@ + +#include "impl_org_ortc_RTCSrtpTransportStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpTransportStats::RTCSrtpTransportStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSrtpTransportStatsPtr wrapper::org::ortc::RTCSrtpTransportStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpTransportStats::~RTCSrtpTransportStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCSrtpTransportStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCSrtpTransportStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSrtpTransportStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCSrtpTransportStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCSrtpTransportStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSrtpTransportStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCSrtpTransportStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpTransportStats::wrapper_init_org_ortc_RTCSrtpTransportStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpTransportStats::wrapper_init_org_ortc_RTCSrtpTransportStats(wrapper::org::ortc::RTCSrtpTransportStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCSrtpTransportStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCSrtpTransportStats::wrapper_init_org_ortc_RTCSrtpTransportStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpTransportStatsPtr wrapper::impl::org::ortc::RTCSrtpTransportStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCSrtpTransportStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSrtpTransportStats::NativeStatsPtr wrapper::impl::org::ortc::RTCSrtpTransportStats::toNative(wrapper::org::ortc::RTCSrtpTransportStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.h new file mode 100644 index 00000000..5738e569 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSrtpTransportStats.h @@ -0,0 +1,46 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSrtpTransportStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSrtpTransportStats : public wrapper::org::ortc::RTCSrtpTransportStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::SRTPTransportStats, NativeStats); + RTCSrtpTransportStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCSrtpTransportStats() noexcept; + virtual ~RTCSrtpTransportStats() noexcept; + + // methods RTCStats + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // methods RTCSrtpTransportStats + void wrapper_init_org_ortc_RTCSrtpTransportStats() noexcept override; + void wrapper_init_org_ortc_RTCSrtpTransportStats(wrapper::org::ortc::RTCSrtpTransportStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCSrtpTransportStats(wrapper::org::ortc::JsonPtr json) noexcept override; + + static RTCSrtpTransportStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCSrtpTransportStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.cpp new file mode 100644 index 00000000..0b519945 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.cpp @@ -0,0 +1,59 @@ + +#include "impl_org_ortc_RTCSsrcConflictEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSsrcConflictEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSsrcConflictEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::RTCSsrcConflictEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSsrcConflictEvent::RTCSsrcConflictEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCSsrcConflictEventPtr wrapper::org::ortc::RTCSsrcConflictEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCSsrcConflictEvent::~RTCSsrcConflictEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +uint32_t wrapper::impl::org::ortc::RTCSsrcConflictEvent::get_ssrc() noexcept +{ + return native_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.h b/ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.h new file mode 100644 index 00000000..ac0e75f8 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCSsrcConflictEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCSsrcConflictEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCSsrcConflictEvent : public wrapper::org::ortc::RTCSsrcConflictEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IRTPTypes::SSRCType, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSsrcConflictEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::RTCSsrcConflictEvent, WrapperType); + RTCSsrcConflictEventWeakPtr thisWeak_; + NativeType native_; + + RTCSsrcConflictEvent() noexcept; + virtual ~RTCSsrcConflictEvent() noexcept; + + // properties RTCSsrcConflictEvent + uint32_t get_ssrc() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeType native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStats.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCStats.cpp new file mode 100644 index 00000000..b31e483b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStats.cpp @@ -0,0 +1,118 @@ + +#include "impl_org_ortc_RTCStats.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStats::RTCStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCStatsPtr wrapper::org::ortc::RTCStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStats::~RTCStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCStats::wrapper_init_org_ortc_RTCStats() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCStats::wrapper_init_org_ortc_RTCStats(wrapper::org::ortc::RTCStatsPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_RTCStats(); + return; + } + native_ = NativeStats::create(*toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCStats::wrapper_init_org_ortc_RTCStats(wrapper::org::ortc::JsonPtr json) noexcept +{ + native_ = NativeStats::create(Json::toNative(json)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::RTCStats::toJson() noexcept +{ + return Json::toWrapper(native_->createElement("RTCStats")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCStats::hash() noexcept +{ + return native_->hash(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::ortc::RTCStats::get_timestamp() noexcept +{ + return native_->mTimestamp; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::ortc::RTCStatsType > wrapper::impl::org::ortc::RTCStats::get_statsType() noexcept +{ + if (!native_->mStatsType.hasValue()) return Optional< wrapper::org::ortc::RTCStatsType >(); + return Helper::toWrapper(native_->mStatsType.value()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCStats::get_statsTypeOther() noexcept +{ + return native_->mStatsTypeOther; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::RTCStats::get_id() noexcept +{ + return native_->mID; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsPtr wrapper::impl::org::ortc::RTCStats::toWrapper(NativeStatsPtr native) noexcept +{ + if (!native) return RTCStatsPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStats::NativeStatsPtr wrapper::impl::org::ortc::RTCStats::toNative(wrapper::org::ortc::RTCStatsPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStats.h b/ortc/idl/wrapper/impl_org_ortc_RTCStats.h new file mode 100644 index 00000000..48f6c690 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStats.h @@ -0,0 +1,45 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCStats.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCStats : public wrapper::org::ortc::RTCStats + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::Stats, NativeStats); + + RTCStatsWeakPtr thisWeak_; + NativeStatsPtr native_; + + RTCStats() noexcept; + virtual ~RTCStats() noexcept; + + // methods RTCStats + void wrapper_init_org_ortc_RTCStats() noexcept override; + void wrapper_init_org_ortc_RTCStats(wrapper::org::ortc::RTCStatsPtr source) noexcept override; + void wrapper_init_org_ortc_RTCStats(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::ortc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + static RTCStatsPtr toWrapper(NativeStatsPtr native) noexcept; + static NativeStatsPtr toNative(wrapper::org::ortc::RTCStatsPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.cpp new file mode 100644 index 00000000..a211dda1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.cpp @@ -0,0 +1,64 @@ + +#include "impl_org_ortc_RTCStatsProvider.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsProvider::RTCStatsProvider() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCStatsProviderPtr wrapper::org::ortc::RTCStatsProvider::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsProvider::~RTCStatsProvider() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::RTCStatsProvider::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsProviderPtr wrapper::impl::org::ortc::RTCStatsProvider::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return RTCStatsProviderPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsProvider::NativeTypePtr wrapper::impl::org::ortc::RTCStatsProvider::toNative(wrapper::org::ortc::RTCStatsProviderPtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.h b/ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.h new file mode 100644 index 00000000..972d295c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStatsProvider.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCStatsProvider.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCStatsProvider : public wrapper::org::ortc::RTCStatsProvider + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsProvider, NativeType); + RTCStatsProviderWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCStatsProvider() noexcept; + virtual ~RTCStatsProvider() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; + + static RTCStatsProviderPtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(wrapper::org::ortc::RTCStatsProviderPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.cpp new file mode 100644 index 00000000..1eddcb3d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.cpp @@ -0,0 +1,68 @@ + +#include "impl_org_ortc_RTCStatsReport.h" +#include "impl_org_ortc_RTCStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsReport::RTCStatsReport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCStatsReportPtr wrapper::org::ortc::RTCStatsReport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsReport::~RTCStatsReport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCStatsPtr wrapper::impl::org::ortc::RTCStatsReport::getStats(String id) noexcept +{ + return RTCStats::toWrapper(native_->getStats(id)); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::RTCStatsReport::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< String > > wrapper::impl::org::ortc::RTCStatsReport::get_statsIds() noexcept +{ + return native_->getStatesIDs(); +} + +wrapper::impl::org::ortc::RTCStatsReportPtr wrapper::impl::org::ortc::RTCStatsReport::toWrapper(::ortc::IStatsReportPtr native) noexcept +{ + if (!native) return RTCStatsReportPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.h b/ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.h new file mode 100644 index 00000000..92408b3f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStatsReport.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCStatsReport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCStatsReport : public wrapper::org::ortc::RTCStatsReport + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReport, NativeStatsReport); + + RTCStatsReportWeakPtr thisWeak_; + NativeStatsReportPtr native_; + + RTCStatsReport() noexcept; + virtual ~RTCStatsReport() noexcept; + + // methods RTCStatsReport + wrapper::org::ortc::RTCStatsPtr getStats(String id) noexcept override; + + // properties RTCStatsReport + uint64_t get_objectId() noexcept override; + shared_ptr< list< String > > get_statsIds() noexcept override; + + static RTCStatsReportPtr toWrapper(NativeStatsReportPtr native) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.cpp b/ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.cpp new file mode 100644 index 00000000..a03ac208 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.cpp @@ -0,0 +1,81 @@ + +#include "impl_org_ortc_RTCStatsTypeSet.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsTypeSet::RTCStatsTypeSet() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCStatsTypeSetPtr wrapper::org::ortc::RTCStatsTypeSet::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = make_shared(); + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsTypeSet::~RTCStatsTypeSet() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCStatsTypeSet::wrapper_init_org_ortc_RTCStatsTypeSet() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::RTCStatsTypeSet::wrapper_init_org_ortc_RTCStatsTypeSet(shared_ptr< set< wrapper::org::ortc::RTCStatsType > > values) noexcept +{ + if (!values) return; + for (auto iter = values->begin(); iter != values->end(); ++iter) + { + auto native = Helper::toNative(*iter); + native_->insert(native); + } +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::RTCStatsTypeSet::hasStatType(wrapper::org::ortc::RTCStatsType type) noexcept +{ + return native_->hasStatType(Helper::toNative(type)); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsTypeSetPtr wrapper::impl::org::ortc::RTCStatsTypeSet::toWrapper(NativeStatsTypeSetPtr native) noexcept +{ + if (!native) return RTCStatsTypeSetPtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::RTCStatsTypeSet::NativeStatsTypeSetPtr wrapper::impl::org::ortc::RTCStatsTypeSet::toNative(wrapper::org::ortc::RTCStatsTypeSetPtr wrapper) noexcept +{ + if (!wrapper) return NativeStatsTypeSetPtr(); + return std::dynamic_pointer_cast(wrapper)->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.h b/ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.h new file mode 100644 index 00000000..b519b451 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_RTCStatsTypeSet.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_RTCStatsTypeSet.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct RTCStatsTypeSet : public wrapper::org::ortc::RTCStatsTypeSet + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IStatsReportTypes::StatsTypeSet, NativeStatsTypeSet); + RTCStatsTypeSetWeakPtr thisWeak_; + NativeStatsTypeSetPtr native_; + + RTCStatsTypeSet() noexcept; + virtual ~RTCStatsTypeSet() noexcept; + + // methods RTCStatsTypeSet + void wrapper_init_org_ortc_RTCStatsTypeSet() noexcept override; + void wrapper_init_org_ortc_RTCStatsTypeSet(shared_ptr< set< wrapper::org::ortc::RTCStatsType > > values) noexcept override; + bool hasStatType(wrapper::org::ortc::RTCStatsType type) noexcept override; + + static RTCStatsTypeSetPtr toWrapper(NativeStatsTypeSetPtr native) noexcept; + static NativeStatsTypeSetPtr toNative(wrapper::org::ortc::RTCStatsTypeSetPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_Settings.cpp b/ortc/idl/wrapper/impl_org_ortc_Settings.cpp new file mode 100644 index 00000000..548471d0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Settings.cpp @@ -0,0 +1,113 @@ + +#include "impl_org_ortc_Settings.h" +#include "impl_org_ortc_Json.h" + +#include +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::Settings::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::Settings::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::Settings::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::Settings::~Settings() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::applyDefaults() noexcept +{ + NativeType::applyDefaults(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::ortc::Settings::apply(wrapper::org::ortc::JsonPtr jsonSettings) noexcept +{ + return NativeType::apply(zsLib::IHelper::toString(wrapper::impl::org::ortc::Json::toNative(jsonSettings))); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::setString( + String key, + String value + ) noexcept +{ + NativeType::setString(key, value); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::setInt( + String key, + int64_t value + ) noexcept +{ + NativeType::setInt(key, SafeInt(value)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::setUInt( + String key, + uint64_t value + ) noexcept +{ + NativeType::setUInt(key, SafeInt(value)); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::setBool( + String key, + bool value + ) noexcept +{ + NativeType::setBool(key, value); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::setFloat( + String key, + float value + ) noexcept +{ + NativeType::setFloat(key, value); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::setDouble( + String key, + double value + ) noexcept +{ + NativeType::setDouble(key, value); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::clear(String key) noexcept +{ + NativeType::clear(key); +} + +//------------------------------------------------------------------------------ +void wrapper::org::ortc::Settings::clearAll() noexcept +{ + NativeType::clearAll(); +} + + diff --git a/ortc/idl/wrapper/impl_org_ortc_Settings.h b/ortc/idl/wrapper/impl_org_ortc_Settings.h new file mode 100644 index 00000000..572ee0ec --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_Settings.h @@ -0,0 +1,29 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_Settings.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct Settings : public wrapper::org::ortc::Settings + { + ZS_DECLARE_TYPEDEF_PTR(::zsLib::ISettings, NativeType); + ZS_DECLARE_TYPEDEF_PTR(OrtcLib, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::OrtcLib, WrapperType); + + Settings() noexcept = delete; + Settings(const Settings &) noexcept = delete; + virtual ~Settings() noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_StringOrStringList.cpp b/ortc/idl/wrapper/impl_org_ortc_StringOrStringList.cpp new file mode 100644 index 00000000..8f92d83f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_StringOrStringList.cpp @@ -0,0 +1,116 @@ + +#include "impl_org_ortc_StringOrStringList.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::StringOrStringList::StringOrStringList() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::StringOrStringListPtr wrapper::org::ortc::StringOrStringList::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::StringOrStringList::~StringOrStringList() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::StringOrStringList::wrapper_init_org_ortc_StringOrStringList() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::StringOrStringList::wrapper_init_org_ortc_StringOrStringList(wrapper::org::ortc::StringOrStringListPtr source) noexcept +{ + if (!source) return; + wrapper::org::ortc::StringOrStringListPtr pThis = thisWeak_.lock(); + (*pThis) = (*source); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::StringOrStringList::wrapper_init_org_ortc_StringOrStringList(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + auto native = make_shared(Json::toNative(json)); + + wrapper::org::ortc::StringOrStringListPtr pThis = thisWeak_.lock(); + wrapper::org::ortc::StringOrStringListPtr wrapper = toWrapper(native); + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::StringOrStringList::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("StringOrStringList")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::StringOrStringList::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::StringOrStringListPtr wrapper::impl::org::ortc::StringOrStringList::toWrapper(NativeStringOrStringListPtr native) noexcept +{ + if (!native) return StringOrStringListPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::StringOrStringListPtr wrapper::impl::org::ortc::StringOrStringList::toWrapper(const NativeStringOrStringList &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + + pThis->value = native.mValue; + if (native.mValues.hasValue()) { + pThis->values = make_shared< list >(native.mValues.value()); + } + + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::StringOrStringList::NativeStringOrStringListPtr wrapper::impl::org::ortc::StringOrStringList::toNative(wrapper::org::ortc::StringOrStringListPtr wrapper) noexcept +{ + if (!wrapper) return NativeStringOrStringListPtr(); + + auto result = make_shared(); + + result->mValue = wrapper->value; + if (wrapper->values.hasValue()) { + if (wrapper->values.value()) { + result->mValues = *(wrapper->values.value()); + } + } + + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_StringOrStringList.h b/ortc/idl/wrapper/impl_org_ortc_StringOrStringList.h new file mode 100644 index 00000000..6983ede1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_StringOrStringList.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_StringOrStringList.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + + struct StringOrStringList : public wrapper::org::ortc::StringOrStringList + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::IConstraints::StringOrStringList, NativeStringOrStringList); + + StringOrStringListWeakPtr thisWeak_; + + StringOrStringList() noexcept; + virtual ~StringOrStringList() noexcept; + + // methods StringOrStringList + void wrapper_init_org_ortc_StringOrStringList() noexcept override; + void wrapper_init_org_ortc_StringOrStringList(wrapper::org::ortc::StringOrStringListPtr source) noexcept override; + void wrapper_init_org_ortc_StringOrStringList(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static StringOrStringListPtr toWrapper(NativeStringOrStringListPtr native) noexcept; + static StringOrStringListPtr toWrapper(const NativeStringOrStringList &native) noexcept; + static NativeStringOrStringListPtr toNative(wrapper::org::ortc::StringOrStringListPtr wrapper) noexcept; + }; + + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.cpp new file mode 100644 index 00000000..8e0ba904 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.cpp @@ -0,0 +1,217 @@ + +#include "impl_org_ortc_adapter_MediaStream.h" +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_RTCStatsTypeSet.h" +#include "impl_org_ortc_RTCStatsReport.h" + +#include "impl_org_ortc_Helper.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper_adapter); } } } } } + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::MediaStream::MediaStream() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::MediaStreamPtr wrapper::org::ortc::adapter::MediaStream::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::MediaStream::~MediaStream() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::adapter::MediaStream::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::wrapper_init_org_ortc_adapter_MediaStream() noexcept +{ + native_ = IMediaStream::create(thisWeak_.lock()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::wrapper_init_org_ortc_adapter_MediaStream(wrapper::org::ortc::adapter::MediaStreamPtr source) noexcept +{ + if (!source) { + wrapper_init_org_ortc_adapter_MediaStream(); + return; + } + native_ = IMediaStream::create(thisWeak_.lock(), toNative(source)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::wrapper_init_org_ortc_adapter_MediaStream(shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > tracks) noexcept +{ + if (!tracks) { + wrapper_init_org_ortc_adapter_MediaStream(); + return; + } + + native_ = IMediaStream::create(thisWeak_.lock(), *Helper::toNative(tracks)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackPtr wrapper::impl::org::ortc::adapter::MediaStream::getTrackById(String id) noexcept +{ + if (!native_) return MediaStreamTrackPtr(); + + auto result = native_->getTrackByID(id); + if (!result) return MediaStreamTrackPtr(); + + return wrapper::impl::org::ortc::MediaStreamTrack::toWrapper(result); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::addTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept(false) +{ + if (!track) return; + native_->addTrack(wrapper::impl::org::ortc::MediaStreamTrack::toNative(track)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::removeTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept +{ + if (!track) return; + native_->removeTrack(wrapper::impl::org::ortc::MediaStreamTrack::toNative(track)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::MediaStreamPtr wrapper::impl::org::ortc::adapter::MediaStream::clone() noexcept +{ + return toWrapper(native_->clone()); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::adapter::MediaStream::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::MediaStream::get_id() noexcept +{ + return native_->id(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::adapter::MediaStream::get_active() noexcept +{ + return native_->active(); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > wrapper::impl::org::ortc::adapter::MediaStream::get_tracks() noexcept +{ + return Helper::toWrapper(native_->getTracks()); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > wrapper::impl::org::ortc::adapter::MediaStream::get_audioTracks() noexcept +{ + return Helper::toWrapper(native_->getAudioTracks()); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > wrapper::impl::org::ortc::adapter::MediaStream::get_videoTracks() noexcept +{ + return Helper::toWrapper(native_->getVideoTracks()); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::adapter::MediaStream::get_count() noexcept +{ + return native_->size(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::onMediaStreamAddTrack( + IMediaStreamPtr stream, + IMediaStreamTrackPtr track + ) noexcept +{ + onAddTrack(wrapper::impl::org::ortc::MediaStreamTrack::toWrapper(track)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::onMediaStreamRemoveTrack( + IMediaStreamPtr stream, + IMediaStreamTrackPtr track + ) noexcept +{ + onRemoveTrack(wrapper::impl::org::ortc::MediaStreamTrack::toWrapper(track)); +} + +//------------------------------------------------------------------------------ +::wrapper::impl::org::ortc::adapter::MediaStreamPtr wrapper::impl::org::ortc::adapter::MediaStream::toWrapper(IMediaStreamPtr native) noexcept +{ + if (!native) return MediaStreamPtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->defaultSubscription_ = false; + result->native_ = native; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +::ortc::adapter::IMediaStreamPtr wrapper::impl::org::ortc::adapter::MediaStream::toNative(::wrapper::org::ortc::adapter::MediaStreamPtr wrapper) noexcept +{ + if (!wrapper) return IMediaStreamPtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return IMediaStreamPtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::MediaStream::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.h b/ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.h new file mode 100644 index 00000000..c937f79d --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_MediaStream.h @@ -0,0 +1,78 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_MediaStream.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct MediaStream : public wrapper::org::ortc::adapter::MediaStream, + public ::ortc::adapter::IMediaStreamDelegate + { + MediaStreamWeakPtr thisWeak_; + + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IMediaStream, IMediaStream); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IMediaStreamTrack, IMediaStreamTrack); + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IMediaStreamDelegate, IMediaStreamDelegate); + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IMediaStreamSubscription, IMediaStreamSubscription); + + IMediaStreamPtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_ {}; + bool defaultSubscription_ {true}; + IMediaStreamSubscriptionPtr subscription_; + + MediaStream() noexcept; + virtual ~MediaStream() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods MediaStream + void wrapper_init_org_ortc_adapter_MediaStream() noexcept override; + void wrapper_init_org_ortc_adapter_MediaStream(wrapper::org::ortc::adapter::MediaStreamPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_MediaStream(shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > tracks) noexcept override; + wrapper::org::ortc::MediaStreamTrackPtr getTrackById(String id) noexcept override; + void addTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument + void removeTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept override; + wrapper::org::ortc::adapter::MediaStreamPtr clone() noexcept override; + + // properties MediaStream + uint64_t get_objectId() noexcept override; + String get_id() noexcept override; + bool get_active() noexcept override; + shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > get_tracks() noexcept override; + shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > get_audioTracks() noexcept override; + shared_ptr< list< wrapper::org::ortc::MediaStreamTrackPtr > > get_videoTracks() noexcept override; + uint64_t get_count() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onMediaStreamAddTrack( + IMediaStreamPtr stream, + IMediaStreamTrackPtr track + ) noexcept override; + virtual void onMediaStreamRemoveTrack( + IMediaStreamPtr stream, + IMediaStreamTrackPtr track + ) noexcept override; + + + static ::wrapper::impl::org::ortc::adapter::MediaStreamPtr toWrapper(IMediaStreamPtr native) noexcept; + static IMediaStreamPtr toNative(::wrapper::org::ortc::adapter::MediaStreamPtr wrapper) noexcept; + + void subscribe() noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.cpp new file mode 100644 index 00000000..ac12c462 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.cpp @@ -0,0 +1,69 @@ + +#include "impl_org_ortc_adapter_RTCAnswerOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCAnswerOptions::RTCAnswerOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCAnswerOptionsPtr wrapper::org::ortc::adapter::RTCAnswerOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCAnswerOptions::~RTCAnswerOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCAnswerOptions::wrapper_init_org_ortc_adapter_RTCAnswerOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCAnswerOptions::WrapperImplTypePtr wrapper::impl::org::ortc::adapter::RTCAnswerOptions::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCAnswerOptions::WrapperImplTypePtr wrapper::impl::org::ortc::adapter::RTCAnswerOptions::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->voiceActivityDetection = native.mVoiceActivityDetection; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCAnswerOptions::NativeTypePtr wrapper::impl::org::ortc::adapter::RTCAnswerOptions::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = make_shared < NativeType >(); + result->mVoiceActivityDetection = wrapper->voiceActivityDetection; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.h new file mode 100644 index 00000000..ffe9729b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCAnswerOptions.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCAnswerOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCAnswerOptions : public wrapper::org::ortc::adapter::RTCAnswerOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::AnswerOptions, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCAnswerOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCAnswerOptions, WrapperType); + RTCAnswerOptionsWeakPtr thisWeak_; + + RTCAnswerOptions() noexcept; + virtual ~RTCAnswerOptions() noexcept; + void wrapper_init_org_ortc_adapter_RTCAnswerOptions() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.cpp new file mode 100644 index 00000000..6c522792 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.cpp @@ -0,0 +1,75 @@ + +#include "impl_org_ortc_adapter_RTCCapabilityOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCCapabilityOptions::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCCapabilityOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCCapabilityOptions::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCCapabilityOptions::RTCCapabilityOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCCapabilityOptionsPtr wrapper::org::ortc::adapter::RTCCapabilityOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCCapabilityOptions::~RTCCapabilityOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCCapabilityOptions::wrapper_init_org_ortc_adapter_RTCCapabilityOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->voiceActivityDetection = native.mVoiceActivityDetection; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = make_shared < NativeType >(); + result->mVoiceActivityDetection = wrapper->voiceActivityDetection; + return result; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.h new file mode 100644 index 00000000..52c611cd --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCCapabilityOptions.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCCapabilityOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCCapabilityOptions : public wrapper::org::ortc::adapter::RTCCapabilityOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::CapabilityOptions, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCCapabilityOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCCapabilityOptions, WrapperType); + RTCCapabilityOptionsWeakPtr thisWeak_; + + RTCCapabilityOptions() noexcept; + virtual ~RTCCapabilityOptions() noexcept; + void wrapper_init_org_ortc_adapter_RTCCapabilityOptions() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.cpp new file mode 100644 index 00000000..225a914a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.cpp @@ -0,0 +1,106 @@ + +#include "impl_org_ortc_adapter_RTCConfiguration.h" +#include "impl_org_ortc_RTCIceGatherOptions.h" +#include "impl_org_ortc_RTCCertificate.h" +#include "impl_org_ortc_Helper.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCConfiguration::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCConfiguration::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCConfiguration::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCConfiguration::RTCConfiguration() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCConfigurationPtr wrapper::org::ortc::adapter::RTCConfiguration::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCConfiguration::~RTCConfiguration() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCConfiguration::wrapper_init_org_ortc_adapter_RTCConfiguration() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCConfiguration::wrapper_init_org_ortc_adapter_RTCConfiguration(wrapper::org::ortc::adapter::RTCConfigurationPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return RTCConfigurationPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->gatherOptions = RTCIceGatherOptions::toWrapper(native.mGatherOptions); + pThis->signalingMode = Helper::toWrapper(native.mSignalingMode); + pThis->negotiateSrtpSdes = native.mNegotiateSRTPSDES; + pThis->bundlePolicy = Helper::toWrapper(native.mBundlePolicy); + pThis->rtcpMuxPolicy = Helper::toWrapper(native.mRTCPMuxPolicy); + pThis->certificates = make_shared< list< wrapper::org::ortc::RTCCertificatePtr> >(); + for (auto iter = native.mCertificates.begin(); iter != native.mCertificates.end(); ++iter) { + pThis->certificates->push_back(RTCCertificate::toWrapper(*iter)); + } + pThis->iceCandidatePoolSize = native.mICECandidatePoolSize; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = make_shared < NativeType >(); + result->mGatherOptions = RTCIceGatherOptions::toNative(wrapper->gatherOptions); + result->mSignalingMode = Helper::toNative(wrapper->signalingMode); + result->mNegotiateSRTPSDES = wrapper->negotiateSrtpSdes; + result->mBundlePolicy = Helper::toNative(wrapper->bundlePolicy); + result->mRTCPMuxPolicy = Helper::toNative(wrapper->rtcpMuxPolicy); + if (wrapper->certificates) { + for (auto iter = wrapper->certificates->begin(); iter != wrapper->certificates->end(); ++iter) { + result->mCertificates.push_back(RTCCertificate::toNative(*iter)); + } + } + result->mICECandidatePoolSize = SafeIntmICECandidatePoolSize)>(wrapper->iceCandidatePoolSize); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.h new file mode 100644 index 00000000..26556443 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCConfiguration.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCConfiguration.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCConfiguration : public wrapper::org::ortc::adapter::RTCConfiguration + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::Configuration, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCConfiguration, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCConfiguration, WrapperType); + RTCConfigurationWeakPtr thisWeak_; + + RTCConfiguration() noexcept; + virtual ~RTCConfiguration() noexcept; + + // methods RTCConfiguration + void wrapper_init_org_ortc_adapter_RTCConfiguration() noexcept override; + void wrapper_init_org_ortc_adapter_RTCConfiguration(wrapper::org::ortc::adapter::RTCConfigurationPtr source) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.cpp new file mode 100644 index 00000000..9ae76bfa --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.cpp @@ -0,0 +1,185 @@ + +#include "impl_org_ortc_adapter_RTCIceCandidate.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_RTCIceCandidateComplete.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCIceCandidate::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCIceCandidate::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCIceCandidate::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCIceCandidate::RTCIceCandidate() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCIceCandidatePtr wrapper::org::ortc::adapter::RTCIceCandidate::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCIceCandidate::~RTCIceCandidate() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCIceCandidate::wrapper_init_org_ortc_adapter_RTCIceCandidate() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCIceCandidate::wrapper_init_org_ortc_adapter_RTCIceCandidate(wrapper::org::ortc::adapter::RTCIceCandidatePtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCIceCandidate::wrapper_init_org_ortc_adapter_RTCIceCandidate(wrapper::org::ortc::JsonPtr json) noexcept(false) +{ + if (!json) return; + + WrapperTypePtr wrapper = toWrapper(NativeType::createFromJSON(Json::toNative(json))); + WrapperTypePtr pThis = thisWeak_.lock(); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCIceCandidatePtr wrapper::org::ortc::adapter::RTCIceCandidate::fromSdpStringWithMLineIndex( + String sdp, + uint64_t mlineIndex + ) noexcept(false) +{ + auto native = NativeType::createFromSDP(sdp); + native->mMLineIndex = SafeIntmMLineIndex)::UseType>(mlineIndex); + + return WrapperImplType::toWrapper(native); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCIceCandidatePtr wrapper::org::ortc::adapter::RTCIceCandidate::fromSdpStringWithMid( + String sdp, + String mid + ) noexcept(false) +{ + auto native = NativeType::createFromSDP(sdp); + native->mMid = mid; + + return WrapperImplType::toWrapper(native); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCIceCandidate::toSdp() noexcept +{ + return toNative(thisWeak_.lock())->toSDP(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCIceCandidate::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->toJSON()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCIceCandidate::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCIceCandidate::get_sdpMid() noexcept +{ + return mid; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCIceCandidate::set_sdpMid(String value) noexcept +{ + mid = value; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->mid = native.mMid; + Helper::optionalSafeIntConvert(native.mMLineIndex, pThis->sdpMLineIndex); + if (native.mCandidate) { + { + auto nativeCandidate = std::dynamic_pointer_cast<::ortc::IICETypes::Candidate>(native.mCandidate); + if (nativeCandidate) { + pThis->candidate = impl::org::ortc::RTCIceCandidate::toWrapper(nativeCandidate); + } + } + { + auto nativeCandidate = std::dynamic_pointer_cast<::ortc::IICETypes::CandidateComplete>(native.mCandidate); + if (nativeCandidate) { + pThis->candidate = impl::org::ortc::RTCIceCandidateComplete::toWrapper(nativeCandidate); + } + } + } + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mMid = wrapper->mid; + Helper::optionalSafeIntConvert(wrapper->sdpMLineIndex, result->mMLineIndex); + if (wrapper->candidate) { + { + auto nativeCandidate = impl::org::ortc::RTCIceCandidate::toNative(wrapper->candidate); + if (nativeCandidate) { + result->mCandidate = nativeCandidate; + } + } + { + auto nativeCandidate = impl::org::ortc::RTCIceCandidateComplete::toNative(wrapper->candidate); + if (nativeCandidate) { + result->mCandidate = nativeCandidate; + } + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.h new file mode 100644 index 00000000..bffa5736 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCIceCandidate.h @@ -0,0 +1,47 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCIceCandidate.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCIceCandidate : public wrapper::org::ortc::adapter::RTCIceCandidate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::ICECandidate, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCIceCandidate, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCIceCandidate, WrapperType); + RTCIceCandidateWeakPtr thisWeak_; + + RTCIceCandidate() noexcept; + virtual ~RTCIceCandidate() noexcept; + + // methods RTCIceCandidate + void wrapper_init_org_ortc_adapter_RTCIceCandidate() noexcept override; + void wrapper_init_org_ortc_adapter_RTCIceCandidate(wrapper::org::ortc::adapter::RTCIceCandidatePtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCIceCandidate(wrapper::org::ortc::JsonPtr json) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument + String toSdp() noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // properties RTCIceCandidate + String get_sdpMid() noexcept override; + void set_sdpMid(String value) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp new file mode 100644 index 00000000..ee4d0fe1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp @@ -0,0 +1,89 @@ + +#include "impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h" +#include "impl_org_ortc_RTCRtpCapabilities.h" +#include "impl_org_ortc_RTCRtpParameters.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::RTCMediaStreamTrackConfiguration() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr wrapper::org::ortc::adapter::RTCMediaStreamTrackConfiguration::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::~RTCMediaStreamTrackConfiguration() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::wrapper_init_org_ortc_adapter_RTCMediaStreamTrackConfiguration() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCMediaStreamTrackConfiguration::wrapper_init_org_ortc_adapter_RTCMediaStreamTrackConfiguration(wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->capabilities = RTCRtpCapabilities::toWrapper(native.mCapabilities); + pThis->parameters = RTCRtpParameters::toWrapper(native.mParameters); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mCapabilities = RTCRtpCapabilities::toNative(wrapper->capabilities); + result->mParameters = RTCRtpParameters::toNative(wrapper->parameters); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h new file mode 100644 index 00000000..d18b39c0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCMediaStreamTrackConfiguration.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCMediaStreamTrackConfiguration : public wrapper::org::ortc::adapter::RTCMediaStreamTrackConfiguration + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::MediaStreamTrackConfiguration, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCMediaStreamTrackConfiguration, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCMediaStreamTrackConfiguration, WrapperType); + RTCMediaStreamTrackConfigurationWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCMediaStreamTrackConfiguration() noexcept; + virtual ~RTCMediaStreamTrackConfiguration() noexcept; + + // methods RTCMediaStreamTrackConfiguration + void wrapper_init_org_ortc_adapter_RTCMediaStreamTrackConfiguration() noexcept override; + void wrapper_init_org_ortc_adapter_RTCMediaStreamTrackConfiguration(wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr source) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp new file mode 100644 index 00000000..43994454 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp @@ -0,0 +1,69 @@ + +#include "impl_org_ortc_adapter_RTCOfferAnswerOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCOfferAnswerOptions::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCOfferAnswerOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCOfferAnswerOptions::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCOfferAnswerOptions::RTCOfferAnswerOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCOfferAnswerOptionsPtr wrapper::org::ortc::adapter::RTCOfferAnswerOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCOfferAnswerOptions::~RTCOfferAnswerOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return RTCOfferAnswerOptionsPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->voiceActivityDetection = native.mVoiceActivityDetection; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = make_shared < NativeType >(); + result->mVoiceActivityDetection = wrapper->voiceActivityDetection; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.h new file mode 100644 index 00000000..472879d5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferAnswerOptions.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCOfferAnswerOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCOfferAnswerOptions : public wrapper::org::ortc::adapter::RTCOfferAnswerOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::OfferAnswerOptions, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCOfferAnswerOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCOfferAnswerOptions, WrapperType); + RTCOfferAnswerOptionsWeakPtr thisWeak_; + + RTCOfferAnswerOptions() noexcept; + virtual ~RTCOfferAnswerOptions() noexcept; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.cpp new file mode 100644 index 00000000..4dabbcad --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.cpp @@ -0,0 +1,76 @@ + +#include "impl_org_ortc_adapter_RTCOfferOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCOfferOptions::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCOfferOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCOfferOptions::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCOfferOptions::RTCOfferOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCOfferOptionsPtr wrapper::org::ortc::adapter::RTCOfferOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCOfferOptions::~RTCOfferOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCOfferOptions::wrapper_init_org_ortc_adapter_RTCOfferOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return RTCOfferOptionsPtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->voiceActivityDetection = native.mVoiceActivityDetection; + pThis->iceRestart = native.mICERestart; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(wrapper::org::ortc::adapter::RTCOfferOptionsPtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = make_shared < NativeType >(); + result->mVoiceActivityDetection = wrapper->voiceActivityDetection; + result->mICERestart = wrapper->iceRestart; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.h new file mode 100644 index 00000000..b57813b3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCOfferOptions.h @@ -0,0 +1,36 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCOfferOptions.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCOfferOptions : public wrapper::org::ortc::adapter::RTCOfferOptions + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::OfferOptions, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCOfferOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCOfferOptions, WrapperType); + RTCOfferOptionsWeakPtr thisWeak_; + + RTCOfferOptions() noexcept; + virtual ~RTCOfferOptions() noexcept; + void wrapper_init_org_ortc_adapter_RTCOfferOptions() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.cpp new file mode 100644 index 00000000..f796e1c1 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.cpp @@ -0,0 +1,539 @@ + +#include "impl_org_ortc_adapter_RTCPeerConnection.h" +#include "impl_org_ortc_adapter_RTCConfiguration.h" +#include "impl_org_ortc_adapter_RTCSessionDescription.h" +#include "impl_org_ortc_adapter_RTCIceCandidate.h" +#include "impl_org_ortc_adapter_RTCCapabilityOptions.h" +#include "impl_org_ortc_adapter_RTCOfferOptions.h" +#include "impl_org_ortc_adapter_RTCAnswerOptions.h" +#include "impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h" +#include "impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h" +#include "impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h" +#include "impl_org_ortc_adapter_MediaStream.h" +#include "impl_org_ortc_adapter_RTCTrackEvent.h" +#include "impl_org_ortc_RTCDataChannelEvent.h" +#include "impl_org_ortc_RTCRtpSender.h" +#include "impl_org_ortc_RTCRtpReceiver.h" +#include "impl_org_ortc_RTCIceServer.h" +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_RTCDataChannel.h" +#include "impl_org_ortc_RTCDataChannelParameters.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper_adapter); } } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnection::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnection::NativeTypeSubscription, NativeTypeSubscription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnection::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnection::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCPeerConnection::RTCPeerConnection() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCPeerConnectionPtr wrapper::org::ortc::adapter::RTCPeerConnection::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCPeerConnection::~RTCPeerConnection() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + return Helper::getStats(native_, statTypes); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::wrapper_init_org_ortc_adapter_RTCPeerConnection() noexcept +{ + native_ = NativeType::create(thisWeak_.lock()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::wrapper_init_org_ortc_adapter_RTCPeerConnection(wrapper::org::ortc::adapter::RTCConfigurationPtr configuration) noexcept +{ + auto native = RTCConfiguration::toNative(configuration); + ZS_ASSERT(native); + native_ = NativeType::create(thisWeak_.lock(), *native); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createOffer() noexcept +{ + return toWrapper(native_->createOffer()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createOffer(wrapper::org::ortc::adapter::RTCOfferOptionsPtr options) noexcept +{ + Optional< ::ortc::adapter::IPeerConnectionTypes::OfferOptions > native; + auto convert = RTCOfferOptions::toNative(options); + if (convert) { + native = *convert; + } + + return toWrapper(native_->createOffer(native)); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createAnswer() noexcept +{ + return toWrapper(native_->createAnswer()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createAnswer(wrapper::org::ortc::adapter::RTCAnswerOptionsPtr options) noexcept +{ + Optional< ::ortc::adapter::IPeerConnectionTypes::AnswerOptions > native; + auto convert = RTCAnswerOptions::toNative(options); + if (convert) { + native = *convert; + } + + return toWrapper(native_->createAnswer(native)); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createCapabilities() noexcept +{ + return toWrapper(native_->createCapabilities()); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createCapabilities(wrapper::org::ortc::adapter::RTCCapabilityOptionsPtr options) noexcept +{ + Optional< ::ortc::adapter::IPeerConnectionTypes::CapabilityOptions > native; + auto convert = RTCCapabilityOptions::toNative(options); + if (convert) { + native = *convert; + } + + return toWrapper(native_->createCapabilities(native)); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::setLocalDescription(wrapper::org::ortc::adapter::RTCSessionDescriptionPtr description) noexcept +{ + return Helper::toWrapper(native_->setLocalDescription(RTCSessionDescription::toNative(description))); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::setRemoteDescription(wrapper::org::ortc::adapter::RTCSessionDescriptionPtr description) noexcept +{ + return Helper::toWrapper(native_->setRemoteDescription(RTCSessionDescription::toNative(description))); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::addIceCandidate(wrapper::org::ortc::adapter::RTCIceCandidatePtr candidate) noexcept +{ + auto native = RTCIceCandidate::toNative(candidate); + ZS_ASSERT(native); + native_->addICECandidate(*native); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCIceServerPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::getDefaultIceServers() noexcept +{ + auto resultList = make_shared< list< wrapper::org::ortc::RTCIceServerPtr > >(); + auto nativeList = native_->getDefaultIceServers(); + if (nativeList) { + for (auto iter = nativeList->begin(); iter != nativeList->end(); ++iter) { + auto wrapper = RTCIceServer::toWrapper(*iter); + if (!wrapper) continue; + resultList->push_back(wrapper); + } + } + return resultList; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::close() noexcept +{ + native_->close(); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCRtpSenderPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::getSenders() noexcept +{ + auto resultList = make_shared< list< wrapper::org::ortc::RTCRtpSenderPtr > >(); + auto nativeList = native_->getSenders(); + if (nativeList) { + for (auto iter = nativeList->begin(); iter != nativeList->end(); ++iter) { + auto wrapper = RTCRtpSender::toWrapper(*iter); + if (!wrapper) continue; + resultList->push_back(wrapper); + } + } + return resultList; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::RTCRtpReceiverPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::getReceivers() noexcept +{ + auto resultList = make_shared< list< wrapper::org::ortc::RTCRtpReceiverPtr > >(); + auto nativeList = native_->getReceivers(); + if (nativeList) { + for (auto iter = nativeList->begin(); iter != nativeList->end(); ++iter) { + auto wrapper = RTCRtpReceiver::toWrapper(*iter); + if (!wrapper) continue; + resultList->push_back(wrapper); + } + } + return resultList; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::addTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept +{ + return toWrapper(native_->addTrack(MediaStreamTrack::toNative(track))); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::addTrack( + wrapper::org::ortc::MediaStreamTrackPtr track, + wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr config + ) noexcept +{ + auto nativeTrack = MediaStreamTrack::toNative(track); + auto nativeConfig = RTCMediaStreamTrackConfiguration::toNative(config); + ZS_ASSERT(nativeConfig); + + return toWrapper(native_->addTrack(nativeTrack, *nativeConfig)); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::addTrack( + wrapper::org::ortc::MediaStreamTrackPtr track, + shared_ptr< list< wrapper::org::ortc::adapter::MediaStreamPtr > > mediaStreams, + wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr config + ) noexcept +{ + auto nativeTrack = MediaStreamTrack::toNative(track); + list<::ortc::adapter::IMediaStreamPtr> nativeList; + if (mediaStreams) { + for (auto iter = mediaStreams->begin(); iter != mediaStreams->end(); ++iter) { + auto native = MediaStream::toNative(*iter); + if (!native) continue; + nativeList.push_back(native); + } + } + auto nativeConfig = RTCMediaStreamTrackConfiguration::toNative(config); + ZS_ASSERT(nativeConfig); + + return toWrapper(native_->addTrack(nativeTrack, nativeList, *nativeConfig)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::removeTrack(wrapper::org::ortc::RTCRtpSenderPtr sender) noexcept +{ + native_->removeTrack(RTCRtpSender::toNative(sender)); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCDataChannelPtr > > wrapper::impl::org::ortc::adapter::RTCPeerConnection::createDataChannel(wrapper::org::ortc::RTCDataChannelParametersPtr parameters) noexcept +{ + auto native = RTCDataChannelParameters::toNative(parameters); + ZS_ASSERT(!native); + return toWrapper(native_->createDataChannel(*native)); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_localDescription() noexcept +{ + return RTCSessionDescription::toWrapper(native_->localDescription()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_currentDescription() noexcept +{ + return RTCSessionDescription::toWrapper(native_->currentDescription()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_pendingDescription() noexcept +{ + return RTCSessionDescription::toWrapper(native_->pendingDescription()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_remoteDescription() noexcept +{ + return RTCSessionDescription::toWrapper(native_->remoteDescription()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_currentRemoteDescription() noexcept +{ + return RTCSessionDescription::toWrapper(native_->currentRemoteDescription()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_pendingRemoteDescription() noexcept +{ + return RTCSessionDescription::toWrapper(native_->pendingRemoteDescription()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSignalingState wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_signalingState() noexcept +{ + return Helper::toWrapper(native_->signalingState()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCIceGathererState wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_iceGatheringState() noexcept +{ + return Helper::toWrapper(native_->iceGatheringState()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCIceConnectionState wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_iceConnectionState() noexcept +{ + return Helper::toPeerConnectionWrapper(native_->iceConnectionState()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCPeerConnectionState wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_connectionState() noexcept +{ + return Helper::toWrapper(native_->connectionState()); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_canTrickleCandidates() noexcept +{ + return native_->canTrickleCandidates(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCConfigurationPtr wrapper::impl::org::ortc::adapter::RTCPeerConnection::get_getConfiguration() noexcept +{ + return RTCConfiguration::toWrapper(native_->getConfiguration()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::set_getConfiguration(wrapper::org::ortc::adapter::RTCConfigurationPtr value) noexcept +{ + auto native = RTCConfiguration::toNative(value); + ZS_ASSERT(native); + native_->setConfiguration(*native); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCPeerConnection::wrapper_onObserverCountChanged(size_t count) noexcept +{ + subscriptionCount_ = count; + subscribe(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionNegotiationNeeded(IPeerConnectionPtr connection) noexcept +{ + onNegotiationNeeded(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionIceCandidate( + IPeerConnectionPtr connection, + ICECandidatePtr candidate, + const char *url +) noexcept +{ + onIceCandidate(RTCPeerConnectionIceEvent::toWrapper(candidate, String(url))); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionIceCandidateError( + IPeerConnectionPtr connection, + ICECandidateErrorEventPtr error +) noexcept +{ + onIceCandidateError(RTCPeerConnectionIceErrorEvent::toWrapper(error)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionSignalingStateChange( + IPeerConnectionPtr connection, + ZS_MAYBE_USED() SignalingStates state +) noexcept +{ + ZS_MAYBE_USED(state); + onSignalingStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionICEGatheringStateChange( + IPeerConnectionPtr connection, + ZS_MAYBE_USED() ICEGatheringStates state +) noexcept +{ + ZS_MAYBE_USED(state); + onIceGatheringStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionICEConnectionStateChange( + IPeerConnectionPtr connection, + ZS_MAYBE_USED() ICEConnectionStates state +) noexcept +{ + ZS_MAYBE_USED(state); + onIceConnectionStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionConnectionStateChange( + IPeerConnectionPtr connection, + ZS_MAYBE_USED() PeerConnectionStates state +) noexcept +{ + ZS_MAYBE_USED(state); + onConnectionStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionTrack( + IPeerConnectionPtr connection, + MediaStreamTrackEventPtr event +) noexcept +{ + onTrack(RTCTrackEvent::toWrapper(event)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionTrackGone( + IPeerConnectionPtr connection, + MediaStreamTrackEventPtr event +) noexcept +{ + onTrackGone(RTCTrackEvent::toWrapper(event)); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onPeerConnectionDataChannel( + IPeerConnectionPtr connection, + IDataChannelPtr dataChannel +) noexcept +{ + onDataChannel(RTCDataChannelEvent::toWrapper(dataChannel)); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr track) noexcept +{ + if (!track) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = track; + result->defaultSubscription_ = false; + result->subscribe(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto result = std::dynamic_pointer_cast(wrapper); + if (!result) return NativeTypePtr(); + return result->native_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::subscribe() noexcept +{ + if (defaultSubscription_) return; + if (!native_) return; + + zsLib::AutoLock lock(lock_); + if (subscriptionCount_ < 1) { + if (!subscription_) return; + subscription_->cancel(); + return; + } + if (subscription_) return; + subscription_ = native_->subscribe(thisWeak_.lock()); +} + +//------------------------------------------------------------------------------ +WrapperImplType::WrapperPromiseWithSessionDescriptionPtr WrapperImplType::toWrapper(NativePromiseWithSessionDescriptionPtr promise) noexcept +{ + if (!promise) return WrapperPromiseWithSessionDescriptionPtr(); + + auto result = WrapperPromiseWithSessionDescription::create(Helper::getGuiQueue()); + promise->thenClosure([result, promise] { + if (promise->isRejected()) { + Helper::reject(promise, result); + return; + } + result->resolve(RTCSessionDescription::toWrapper(promise->value())); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplType::WrapperPromiseWithSenderPtr WrapperImplType::toWrapper(NativePromiseWithSenderPtr promise) noexcept +{ + if (!promise) return WrapperPromiseWithSenderPtr(); + + auto result = WrapperPromiseWithSender::create(Helper::getGuiQueue()); + promise->thenClosure([result, promise] { + if (promise->isRejected()) { + Helper::reject(promise, result); + return; + } + result->resolve(RTCRtpSender::toWrapper(promise->value())); + }); + promise->background(); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplType::WrapperPromiseWithDataChannelPtr WrapperImplType::toWrapper(NativePromiseWithDataChannelPtr promise) noexcept +{ + if (!promise) return WrapperPromiseWithDataChannelPtr(); + + auto result = WrapperPromiseWithDataChannel::create(Helper::getGuiQueue()); + promise->thenClosure([result, promise] { + if (promise->isRejected()) { + Helper::reject(promise, result); + return; + } + result->resolve(RTCDataChannel::toWrapper(promise->value())); + }); + promise->background(); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.h new file mode 100644 index 00000000..43cd5622 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnection.h @@ -0,0 +1,150 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCPeerConnection.h" + +#include +#include +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCPeerConnection : public wrapper::org::ortc::adapter::RTCPeerConnection, + public ::ortc::adapter::IPeerConnectionDelegate + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnection, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnection, IPeerConnection); + ZS_DECLARE_TYPEDEF_PTR(::ortc::IDataChannel, IDataChannel); + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionSubscription, NativeTypeSubscription); + ZS_DECLARE_TYPEDEF_PTR(RTCPeerConnection, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCPeerConnection, WrapperType); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith< ::ortc::adapter::ISessionDescription >, NativePromiseWithSessionDescription); + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr >, WrapperPromiseWithSessionDescription); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith< ::ortc::IRTPSender >, NativePromiseWithSender); + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr >, WrapperPromiseWithSender); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith< ::ortc::IDataChannel >, NativePromiseWithDataChannel); + ZS_DECLARE_TYPEDEF_PTR(PromiseWithHolderPtr< wrapper::org::ortc::RTCDataChannelPtr >, WrapperPromiseWithDataChannel); + + RTCPeerConnectionWeakPtr thisWeak_; + NativeTypePtr native_; + zsLib::Lock lock_; + std::atomic subscriptionCount_{}; + bool defaultSubscription_{ true }; + NativeTypeSubscriptionPtr subscription_; + + RTCPeerConnection() noexcept; + virtual ~RTCPeerConnection() noexcept; + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCStatsReportPtr > > getStats(wrapper::org::ortc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // methods RTCPeerConnection + void wrapper_init_org_ortc_adapter_RTCPeerConnection() noexcept override; + void wrapper_init_org_ortc_adapter_RTCPeerConnection(wrapper::org::ortc::adapter::RTCConfigurationPtr configuration) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > createOffer() noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > createOffer(wrapper::org::ortc::adapter::RTCOfferOptionsPtr options) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > createAnswer() noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > createAnswer(wrapper::org::ortc::adapter::RTCAnswerOptionsPtr options) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > createCapabilities() noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::adapter::RTCSessionDescriptionPtr > > createCapabilities(wrapper::org::ortc::adapter::RTCCapabilityOptionsPtr options) noexcept override; + PromisePtr setLocalDescription(wrapper::org::ortc::adapter::RTCSessionDescriptionPtr description) noexcept override; + PromisePtr setRemoteDescription(wrapper::org::ortc::adapter::RTCSessionDescriptionPtr description) noexcept override; + void addIceCandidate(wrapper::org::ortc::adapter::RTCIceCandidatePtr candidate) noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCIceServerPtr > > getDefaultIceServers() noexcept override; + void close() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCRtpSenderPtr > > getSenders() noexcept override; + shared_ptr< list< wrapper::org::ortc::RTCRtpReceiverPtr > > getReceivers() noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr > > addTrack(wrapper::org::ortc::MediaStreamTrackPtr track) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr > > addTrack( + wrapper::org::ortc::MediaStreamTrackPtr track, + wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr config + ) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCRtpSenderPtr > > addTrack( + wrapper::org::ortc::MediaStreamTrackPtr track, + shared_ptr< list< wrapper::org::ortc::adapter::MediaStreamPtr > > mediaStreams, + wrapper::org::ortc::adapter::RTCMediaStreamTrackConfigurationPtr config + ) noexcept override; + void removeTrack(wrapper::org::ortc::RTCRtpSenderPtr sender) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::ortc::RTCDataChannelPtr > > createDataChannel(wrapper::org::ortc::RTCDataChannelParametersPtr parameters) noexcept override; + + // properties RTCPeerConnection + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionPtr get_localDescription() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionPtr get_currentDescription() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionPtr get_pendingDescription() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionPtr get_remoteDescription() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionPtr get_currentRemoteDescription() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionPtr get_pendingRemoteDescription() noexcept override; + wrapper::org::ortc::adapter::RTCSignalingState get_signalingState() noexcept override; + wrapper::org::ortc::RTCIceGathererState get_iceGatheringState() noexcept override; + wrapper::org::ortc::adapter::RTCIceConnectionState get_iceConnectionState() noexcept override; + wrapper::org::ortc::adapter::RTCPeerConnectionState get_connectionState() noexcept override; + bool get_canTrickleCandidates() noexcept override; + wrapper::org::ortc::adapter::RTCConfigurationPtr get_getConfiguration() noexcept override; + void set_getConfiguration(wrapper::org::ortc::adapter::RTCConfigurationPtr value) noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + virtual void onPeerConnectionNegotiationNeeded(IPeerConnectionPtr connection) noexcept override; + virtual void onPeerConnectionIceCandidate( + IPeerConnectionPtr connection, + ICECandidatePtr candidate, + const char *url + ) noexcept override; + virtual void onPeerConnectionIceCandidateError( + IPeerConnectionPtr connection, + ICECandidateErrorEventPtr error + ) noexcept override; + virtual void onPeerConnectionSignalingStateChange( + IPeerConnectionPtr connection, + SignalingStates state + ) noexcept override; + virtual void onPeerConnectionICEGatheringStateChange( + IPeerConnectionPtr connection, + ICEGatheringStates state + ) noexcept override; + virtual void onPeerConnectionICEConnectionStateChange( + IPeerConnectionPtr connection, + ICEConnectionStates state + ) noexcept override; + virtual void onPeerConnectionConnectionStateChange( + IPeerConnectionPtr connection, + PeerConnectionStates state + ) noexcept override; + virtual void onPeerConnectionTrack( + IPeerConnectionPtr connection, + MediaStreamTrackEventPtr event + ) noexcept override; + + virtual void onPeerConnectionTrackGone( + IPeerConnectionPtr connection, + MediaStreamTrackEventPtr event + ) noexcept override; + + virtual void onPeerConnectionDataChannel( + IPeerConnectionPtr connection, + IDataChannelPtr dataChannel + ) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr track) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + void subscribe() noexcept; + + static WrapperPromiseWithSessionDescriptionPtr toWrapper(NativePromiseWithSessionDescriptionPtr promise) noexcept; + static WrapperPromiseWithSenderPtr toWrapper(NativePromiseWithSenderPtr promise) noexcept; + static WrapperPromiseWithDataChannelPtr toWrapper(NativePromiseWithDataChannelPtr promise) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp new file mode 100644 index 00000000..fb759d64 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp @@ -0,0 +1,94 @@ + +#include "impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h" +#include "impl_org_ortc_adapter_RTCIceCandidate.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCPeerConnectionIceErrorEventPtr wrapper::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::~RTCPeerConnectionIceErrorEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCIceCandidatePtr wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::get_hostCandidate() noexcept +{ + return RTCIceCandidate::toWrapper(native_->mHostCandidate); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::get_url() noexcept +{ + return native_->mURL; +} + +//------------------------------------------------------------------------------ +Optional< uint16_t > wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::get_errorCode() noexcept +{ + Optional< uint16_t > result {}; + Helper::optionalSafeIntConvert(native_->mErrorCode, result); + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceErrorEvent::get_errorText() noexcept +{ + return native_->mErrorText; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto impl = std::dynamic_pointer_cast(wrapper); + if (!impl) return NativeTypePtr(); + + return impl->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h new file mode 100644 index 00000000..f1670e1f --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCPeerConnectionIceErrorEvent : public wrapper::org::ortc::adapter::RTCPeerConnectionIceErrorEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnectionTypes::ICECandidateErrorEvent, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCPeerConnectionIceErrorEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCPeerConnectionIceErrorEvent, WrapperType); + RTCPeerConnectionIceErrorEventWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCPeerConnectionIceErrorEvent() noexcept; + virtual ~RTCPeerConnectionIceErrorEvent() noexcept; + + // properties RTCPeerConnectionIceErrorEvent + wrapper::org::ortc::adapter::RTCIceCandidatePtr get_hostCandidate() noexcept override; + String get_url() noexcept override; + Optional< uint16_t > get_errorCode() noexcept override; + String get_errorText() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp new file mode 100644 index 00000000..7cd9ccc4 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp @@ -0,0 +1,69 @@ + +#include "impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h" +#include "impl_org_ortc_adapter_RTCIceCandidate.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceEvent::RTCPeerConnectionIceEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCPeerConnectionIceEventPtr wrapper::org::ortc::adapter::RTCPeerConnectionIceEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceEvent::~RTCPeerConnectionIceEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCIceCandidatePtr wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceEvent::get_candidate() noexcept +{ + return candidate_; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCPeerConnectionIceEvent::get_uri() noexcept +{ + return uri_; +} + + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper( + ::ortc::adapter::IPeerConnectionTypes::ICECandidatePtr candidate, + const String &uri +) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->candidate_ = RTCIceCandidate::toWrapper(candidate); + pThis->uri_ = uri; + return pThis; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h new file mode 100644 index 00000000..bd8148f7 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCPeerConnectionIceEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCPeerConnectionIceEvent : public wrapper::org::ortc::adapter::RTCPeerConnectionIceEvent + { + ZS_DECLARE_TYPEDEF_PTR(RTCPeerConnectionIceEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCPeerConnectionIceEvent, WrapperType); + RTCPeerConnectionIceEventWeakPtr thisWeak_; + wrapper::org::ortc::adapter::RTCIceCandidatePtr candidate_; + String uri_; + + RTCPeerConnectionIceEvent() noexcept; + virtual ~RTCPeerConnectionIceEvent() noexcept; + + // properties RTCPeerConnectionIceEvent + wrapper::org::ortc::adapter::RTCIceCandidatePtr get_candidate() noexcept override; + String get_uri() noexcept override; + + static WrapperImplTypePtr toWrapper( + ::ortc::adapter::IPeerConnectionTypes::ICECandidatePtr candidate, + const String &uri + ) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.cpp new file mode 100644 index 00000000..68a7595a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.cpp @@ -0,0 +1,175 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescription.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionDescription.h" +#include "impl_org_ortc_RTCRtpCapabilities.h" +#include "impl_org_ortc_RTCRtpParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace ortc { namespace adapter { ZS_DECLARE_SUBSYSTEM(org_ortc_wrapper_adapter); } } } } } + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescription::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescription::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescription::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescription::RTCSessionDescription() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionPtr wrapper::org::ortc::adapter::RTCSessionDescription::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescription::~RTCSessionDescription() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescription::wrapper_init_org_ortc_adapter_RTCSessionDescription( + wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType type, + String description + ) noexcept(false) +{ + native_ = NativeType::create(Helper::toNative(type), description); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescription::wrapper_init_org_ortc_adapter_RTCSessionDescription( + wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType type, + wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr description + ) noexcept(false) +{ + auto wrapperDescription = RTCSessionDescriptionDescription::toNative(description); + ZS_THROW_INVALID_ARGUMENT_IF(!wrapperDescription); + native_ = NativeType::create(Helper::toNative(type), *wrapperDescription); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpParametersPtr wrapper::org::ortc::adapter::RTCSessionDescription::convertCapabilitiesToParameters(wrapper::org::ortc::RTCRtpCapabilitiesPtr capabilitites) noexcept +{ + auto native = wrapper::impl::org::ortc::RTCRtpCapabilities::toNative(capabilitites); + if (!native) return RTCRtpParametersPtr(); + + auto result = ::ortc::adapter::IHelper::capabilitiesToParameters(*native); + return wrapper::impl::org::ortc::RTCRtpParameters::toWrapper(result); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpCapabilitiesPtr wrapper::org::ortc::adapter::RTCSessionDescription::ConvertParametersToCapabilitites(wrapper::org::ortc::RTCRtpParametersPtr parameters) noexcept +{ + auto native = wrapper::impl::org::ortc::RTCRtpParameters::toNative(parameters); + if (!native) return RTCRtpCapabilitiesPtr(); + + auto result = ::ortc::adapter::IHelper::parametersToCapabilities(*native); + return wrapper::impl::org::ortc::RTCRtpCapabilities::toWrapper(result); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_objectId() noexcept +{ + return native_->getID(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_type() noexcept +{ + return Helper::toWrapper(native_->type()); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSdpType wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_sdpType() noexcept +{ + auto type = native_->type(); + ZS_ASSERT_MESSAGE(NativeType::SignalingType_JSON != type, "JSON based signaling is not supported in the adapter"); + + switch (type) + { + case NativeType::SignalingType_JSON: break; + case NativeType::SignalingType_SDPOffer: return wrapper::org::ortc::adapter::RTCSdpType_offer; + case NativeType::SignalingType_SDPPranswer: return wrapper::org::ortc::adapter::RTCSdpType_pranswer; + case NativeType::SignalingType_SDPAnswer: return wrapper::org::ortc::adapter::RTCSdpType_answer; + case NativeType::SignalingType_SDPRollback: return wrapper::org::ortc::adapter::RTCSdpType_rollback; + } + + wrapper::org::ortc::adapter::RTCSdpType result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_isJsonSignalling() noexcept +{ + return NativeType::SignalingType_JSON == native_->type(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_isSdpSignaling() noexcept +{ + return NativeType::SignalingType_JSON != native_->type(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_description() noexcept +{ + return RTCSessionDescriptionDescription::toWrapper(native_->description()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_formattedDescription() noexcept +{ + return native_->formattedDescription(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescription::get_sdp() noexcept +{ + return native_->formattedDescription(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto impl = std::dynamic_pointer_cast(wrapper); + if (!impl) return NativeTypePtr(); + + return impl->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.h new file mode 100644 index 00000000..25c002a9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescription.h @@ -0,0 +1,55 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescription.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescription : public wrapper::org::ortc::adapter::RTCSessionDescription + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescription, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescription, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescription, WrapperType); + RTCSessionDescriptionWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCSessionDescription() noexcept; + virtual ~RTCSessionDescription() noexcept; + + // methods RTCSessionDescription + void wrapper_init_org_ortc_adapter_RTCSessionDescription( + wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType type, + String description + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + void wrapper_init_org_ortc_adapter_RTCSessionDescription( + wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType type, + wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr description + ) noexcept(false) override; // throws ::zsLib::Exceptions::InvalidArgument::zsLib::Exceptions::BadState + + // properties RTCSessionDescription + uint64_t get_objectId() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionSignalingType get_type() noexcept override; + wrapper::org::ortc::adapter::RTCSdpType get_sdpType() noexcept override; + bool get_isJsonSignalling() noexcept override; + bool get_isSdpSignaling() noexcept override; + wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr get_description() noexcept override; + String get_formattedDescription() noexcept override; + String get_sdp() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp new file mode 100644 index 00000000..17783ee6 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp @@ -0,0 +1,112 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::RTCSessionDescriptionConnectionData() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataPtr wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionData::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::~RTCSessionDescriptionConnectionData() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionData() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionData(wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionData(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionData::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->rtp = RTCSessionDescriptionConnectionDataDetails::toWrapper(native.mRTP); + pThis->rtcp = RTCSessionDescriptionConnectionDataDetails::toWrapper(native.mRTCP); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mRTP = RTCSessionDescriptionConnectionDataDetails::toNative(wrapper->rtp); + result->mRTCP = RTCSessionDescriptionConnectionDataDetails::toNative(wrapper->rtcp); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h new file mode 100644 index 00000000..35e1b8a9 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionConnectionData.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionConnectionData : public wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionData + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::ConnectionData, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionConnectionData, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionData, WrapperType); + RTCSessionDescriptionConnectionDataWeakPtr thisWeak_; + + RTCSessionDescriptionConnectionData() noexcept; + virtual ~RTCSessionDescriptionConnectionData() noexcept; + + // methods RTCSessionDescriptionConnectionData + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionData() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionData(wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionData(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp new file mode 100644 index 00000000..e6987479 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp @@ -0,0 +1,115 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::RTCSessionDescriptionConnectionDataDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetailsPtr wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::~RTCSessionDescriptionConnectionDataDetails() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetailsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mPort, pThis->port); + pThis->netType = native.mNetType; + pThis->addrType = native.mAddrType; + pThis->connectionAddress = native.mConnectionAddress; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->port, result->mPort); + result->mNetType = wrapper->netType; + result->mAddrType = wrapper->addrType; + result->mConnectionAddress = wrapper->connectionAddress; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h new file mode 100644 index 00000000..c70a2716 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionConnectionDataDetails : public wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::ConnectionData::Details, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionConnectionDataDetails, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetails, WrapperType); + RTCSessionDescriptionConnectionDataDetailsWeakPtr thisWeak_; + + RTCSessionDescriptionConnectionDataDetails() noexcept; + virtual ~RTCSessionDescriptionConnectionDataDetails() noexcept; + + // methods RTCSessionDescriptionConnectionDataDetails + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionConnectionDataDetailsPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp new file mode 100644 index 00000000..c9ca0c43 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp @@ -0,0 +1,167 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionDescription.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionTransport.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::RTCSessionDescriptionDescription() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr wrapper::org::ortc::adapter::RTCSessionDescriptionDescription::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::~RTCSessionDescriptionDescription() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescription() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescription(wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescription(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescription::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->details = RTCSessionDescriptionDescriptionDetails::toWrapper(native.mDetails); + pThis->transports = make_shared< list< wrapper::org::ortc::adapter::RTCSessionDescriptionTransportPtr > >(); + for (auto iter = native.mTransports.begin(); iter != native.mTransports.end(); ++iter) { + auto wrapper = RTCSessionDescriptionTransport::toWrapper(*iter); + if (!wrapper) continue; + pThis->transports->push_back(wrapper); + } + pThis->rtpMediaLines = make_shared< list< wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLinePtr > >(); + for (auto iter = native.mRTPMediaLines.begin(); iter != native.mRTPMediaLines.end(); ++iter) { + auto wrapper = RTCSessionDescriptionRtpMediaLine::toWrapper(*iter); + if (!wrapper) continue; + pThis->rtpMediaLines->push_back(wrapper); + } + pThis->sctpMediaLines = make_shared< list< wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLinePtr > >(); + for (auto iter = native.mSCTPMediaLines.begin(); iter != native.mSCTPMediaLines.end(); ++iter) { + auto wrapper = RTCSessionDescriptionSctpMediaLine::toWrapper(*iter); + if (!wrapper) continue; + pThis->sctpMediaLines->push_back(wrapper); + } + pThis->rtpSenders = make_shared< list< wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderPtr > >(); + for (auto iter = native.mRTPSenders.begin(); iter != native.mRTPSenders.end(); ++iter) { + auto wrapper = RTCSessionDescriptionRtpSender::toWrapper(*iter); + if (!wrapper) continue; + pThis->rtpSenders->push_back(wrapper); + } + + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mDetails = RTCSessionDescriptionDescriptionDetails::toNative(wrapper->details); + if (wrapper->transports) { + for (auto iter = wrapper->transports->begin(); iter != wrapper->transports->end(); ++iter) { + auto native = RTCSessionDescriptionTransport::toNative(*iter); + if (!native) continue; + result->mTransports.push_back(native); + } + } + if (wrapper->rtpMediaLines) { + for (auto iter = wrapper->rtpMediaLines->begin(); iter != wrapper->rtpMediaLines->end(); ++iter) { + auto native = RTCSessionDescriptionRtpMediaLine::toNative(*iter); + if (!native) continue; + result->mRTPMediaLines.push_back(native); + } + } + if (wrapper->sctpMediaLines) { + for (auto iter = wrapper->sctpMediaLines->begin(); iter != wrapper->sctpMediaLines->end(); ++iter) { + auto native = RTCSessionDescriptionSctpMediaLine::toNative(*iter); + if (!native) continue; + result->mSCTPMediaLines.push_back(native); + } + } + if (wrapper->rtpSenders) { + for (auto iter = wrapper->rtpSenders->begin(); iter != wrapper->rtpSenders->end(); ++iter) { + auto native = RTCSessionDescriptionRtpSender::toNative(*iter); + if (!native) continue; + result->mRTPSenders.push_back(native); + } + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.h new file mode 100644 index 00000000..b7f8ef6b --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescription.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionDescription.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionDescription : public wrapper::org::ortc::adapter::RTCSessionDescriptionDescription + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::Description, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionDescription, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionDescription, WrapperType); + RTCSessionDescriptionDescriptionWeakPtr thisWeak_; + + RTCSessionDescriptionDescription() noexcept; + virtual ~RTCSessionDescriptionDescription() noexcept; + + // methods RTCSessionDescriptionDescription + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescription() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescription(wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescription(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp new file mode 100644 index 00000000..6af6d5f5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp @@ -0,0 +1,125 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::RTCSessionDescriptionDescriptionDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionDetailsPtr wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::~RTCSessionDescriptionDescriptionDetails() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionDetailsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->username = native.mUsername; + pThis->sessionId = SafeIntsessionId)>(native.mSessionID); + pThis->sessionVersion = SafeIntsessionVersion)>(native.mSessionVersion); + pThis->unicaseAddress = RTCSessionDescriptionConnectionDataDetails::toWrapper(native.mUnicaseAddress); + pThis->sessionName = native.mSessionName; + pThis->startTime = SafeIntstartTime)>(native.mStartTime); + pThis->endTime = SafeIntendTime)>(native.mEndTime); + pThis->connectionData = RTCSessionDescriptionConnectionData::toWrapper(native.mConnectionData); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mUsername = wrapper->username; + result->mSessionID = SafeIntmSessionID)>(wrapper->sessionId); + result->mSessionVersion = SafeIntmSessionVersion)>(wrapper->sessionVersion); + result->mUnicaseAddress = RTCSessionDescriptionConnectionDataDetails::toNative(wrapper->unicaseAddress); + result->mSessionName = wrapper->sessionName; + result->mStartTime = SafeIntmStartTime)>(wrapper->startTime); + result->mEndTime = SafeIntmEndTime)>(wrapper->endTime); + result->mConnectionData = RTCSessionDescriptionConnectionData::toNative(wrapper->connectionData); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h new file mode 100644 index 00000000..d6eb931c --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionDescriptionDetails : public wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::Description::Details, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionDescriptionDetails, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionDetails, WrapperType); + RTCSessionDescriptionDescriptionDetailsWeakPtr thisWeak_; + + RTCSessionDescriptionDescriptionDetails() noexcept; + virtual ~RTCSessionDescriptionDescriptionDetails() noexcept; + + // methods RTCSessionDescriptionDescriptionDetails + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionDescriptionDetailsPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp new file mode 100644 index 00000000..a61b3d46 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp @@ -0,0 +1,107 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::RTCSessionDescriptionMediaLine() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLinePtr wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLine::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::~RTCSessionDescriptionMediaLine() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::toJson() noexcept +{ + { + auto obj = std::dynamic_pointer_cast<::ortc::adapter::ISessionDescriptionTypes::RTPMediaLine>(native_); + if (obj) return Json::toWrapper(obj->createElement()); + } + { + auto obj = std::dynamic_pointer_cast<::ortc::adapter::ISessionDescriptionTypes::SCTPMediaLine>(native_); + if (obj) return Json::toWrapper(obj->createElement()); + } + + return JsonPtr(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLine::hash() noexcept +{ + { + auto obj = std::dynamic_pointer_cast<::ortc::adapter::ISessionDescriptionTypes::RTPMediaLine>(native_); + if (obj) return obj->hash(); + } + { + auto obj = std::dynamic_pointer_cast<::ortc::adapter::ISessionDescriptionTypes::SCTPMediaLine>(native_); + if (obj) return obj->hash(); + } + + return String(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + { + auto obj = std::dynamic_pointer_cast(wrapper); + if (obj) return RTCSessionDescriptionRtpMediaLine::toNative(obj); + } + { + auto obj = std::dynamic_pointer_cast(wrapper); + if (obj) return RTCSessionDescriptionSctpMediaLine::toNative(obj); + } + + auto impl = std::dynamic_pointer_cast(wrapper); + if (!impl) return NativeTypePtr(); + + return impl->native_; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h new file mode 100644 index 00000000..52c2caa4 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionMediaLine.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionMediaLine : public wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLine + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::MediaLine, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionMediaLine, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLine, WrapperType); + RTCSessionDescriptionMediaLineWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCSessionDescriptionMediaLine() noexcept; + virtual ~RTCSessionDescriptionMediaLine() noexcept; + + // methods RTCSessionDescriptionMediaLine + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp new file mode 100644 index 00000000..ea2e3c18 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp @@ -0,0 +1,118 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::RTCSessionDescriptionMediaLineDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLineDetailsPtr wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::~RTCSessionDescriptionMediaLineDetails() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLineDetailsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mInternalIndex, pThis->internalIndex); + pThis->privateTransportID = native.mPrivateTransportID; + pThis->protocol = native.mProtocol; + pThis->connectionData = RTCSessionDescriptionConnectionData::toWrapper(native.mConnectionData); + pThis->mediaDirection = Helper::toWrapper(native.mMediaDirection); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->internalIndex, result->mInternalIndex); + result->mPrivateTransportID = wrapper->privateTransportID; + result->mProtocol = wrapper->protocol; + result->mConnectionData = RTCSessionDescriptionConnectionData::toNative(wrapper->connectionData); + result->mMediaDirection = Helper::toNative(wrapper->mediaDirection); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h new file mode 100644 index 00000000..d022ce07 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionMediaLineDetails : public wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::MediaLine::Details, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionMediaLineDetails, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLineDetails, WrapperType); + RTCSessionDescriptionMediaLineDetailsWeakPtr thisWeak_; + + RTCSessionDescriptionMediaLineDetails() noexcept; + virtual ~RTCSessionDescriptionMediaLineDetails() noexcept; + + // methods RTCSessionDescriptionMediaLineDetails + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionMediaLineDetailsPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp new file mode 100644 index 00000000..ae778b57 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp @@ -0,0 +1,120 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h" +#include "impl_org_ortc_RTCRtpCapabilities.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::RTCSessionDescriptionRtpMediaLine() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLinePtr wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::~RTCSessionDescriptionRtpMediaLine() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLinePtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->id = native.mID; + pThis->transportId = native.mTransportID; + pThis->mediaType = native.mMediaType; + pThis->details = RTCSessionDescriptionMediaLineDetails::toWrapper(native.mDetails); + pThis->senderCapabilities = RTCRtpCapabilities::toWrapper(native.mSenderCapabilities); + pThis->receiverCapabilities = RTCRtpCapabilities::toWrapper(native.mReceiverCapabilities); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mID = wrapper->id; + result->mTransportID = wrapper->transportId; + result->mMediaType = wrapper->mediaType; + result->mDetails = RTCSessionDescriptionMediaLineDetails::toNative(wrapper->details); + result->mSenderCapabilities = RTCRtpCapabilities::toNative(wrapper->senderCapabilities); + result->mReceiverCapabilities = RTCRtpCapabilities::toNative(wrapper->receiverCapabilities); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h new file mode 100644 index 00000000..59a53da5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h @@ -0,0 +1,44 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionRtpMediaLine : public wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::RTPMediaLine, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionRtpMediaLine, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLine, WrapperType); + RTCSessionDescriptionRtpMediaLineWeakPtr thisWeak_; + + RTCSessionDescriptionRtpMediaLine() noexcept; + virtual ~RTCSessionDescriptionRtpMediaLine() noexcept; + + // methods RTCSessionDescriptionMediaLine + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods RTCSessionDescriptionRtpMediaLine + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpMediaLinePtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine(wrapper::org::ortc::JsonPtr json) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp new file mode 100644 index 00000000..79a2effc --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp @@ -0,0 +1,122 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h" +#include "impl_org_ortc_RTCRtpParameters.h" +#include "impl_org_ortc_Json.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::RTCSessionDescriptionRtpSender() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderPtr wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSender::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::~RTCSessionDescriptionRtpSender() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSender() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSender(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSender(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSender::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->id = native.mID; + pThis->details = RTCSessionDescriptionRtpSenderDetails::toWrapper(native.mDetails); + pThis->rtpMediaLineId = native.mRTPMediaLineID; + pThis->parameters = RTCRtpParameters::toWrapper(native.mParameters); + pThis->mediaStreamTrackId = native.mMediaStreamTrackID; + pThis->mediaStreamIds = make_shared< set< String > >(native.mMediaStreamIDs); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mID = wrapper->id; + result->mDetails = RTCSessionDescriptionRtpSenderDetails::toNative(wrapper->details); + result->mRTPMediaLineID = wrapper->rtpMediaLineId; + result->mParameters = RTCRtpParameters::toNative(wrapper->parameters); + result->mMediaStreamTrackID = wrapper->mediaStreamTrackId; + if (wrapper->mediaStreamIds) { + result->mMediaStreamIDs = *(wrapper->mediaStreamIds); + } + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h new file mode 100644 index 00000000..e48e40df --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionRtpSender.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionRtpSender : public wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSender + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::RTPSender, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionRtpSender, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSender, WrapperType); + RTCSessionDescriptionRtpSenderWeakPtr thisWeak_; + + RTCSessionDescriptionRtpSender() noexcept; + virtual ~RTCSessionDescriptionRtpSender() noexcept; + + // methods RTCSessionDescriptionRtpSender + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSender() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSender(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSender(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp new file mode 100644 index 00000000..58403a03 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp @@ -0,0 +1,109 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::RTCSessionDescriptionRtpSenderDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetailsPtr wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::~RTCSessionDescriptionRtpSenderDetails() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetailsPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + Helper::optionalSafeIntConvert(native.mInternalRTPMediaLineIndex, pThis->internalRtpMediaLineIndex); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + Helper::optionalSafeIntConvert(wrapper->internalRtpMediaLineIndex, result->mInternalRTPMediaLineIndex); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h new file mode 100644 index 00000000..8c382de4 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionRtpSenderDetails : public wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::RTPSender::Details, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionRtpSenderDetails, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetails, WrapperType); + RTCSessionDescriptionRtpSenderDetailsWeakPtr thisWeak_; + + RTCSessionDescriptionRtpSenderDetails() noexcept; + virtual ~RTCSessionDescriptionRtpSenderDetails() noexcept; + + // methods RTCSessionDescriptionRtpSenderDetails + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails(wrapper::org::ortc::adapter::RTCSessionDescriptionRtpSenderDetailsPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp new file mode 100644 index 00000000..40177bb2 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp @@ -0,0 +1,122 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h" +#include "impl_org_ortc_RTCSctpCapabilities.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::RTCSessionDescriptionSctpMediaLine() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLinePtr wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::~RTCSessionDescriptionSctpMediaLine() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::wrapper_init_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::wrapper_init_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine(wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLinePtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine::wrapper_init_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->id = native.mID; + pThis->transportId = native.mTransportID; + pThis->mediaType = native.mMediaType; + pThis->details = RTCSessionDescriptionMediaLineDetails::toWrapper(native.mDetails); + pThis->capabilities = RTCSctpCapabilities::toWrapper(native.mCapabilities); + Helper::optionalSafeIntConvert(native.mPort, pThis->port); + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mID = wrapper->id; + result->mTransportID = wrapper->transportId; + result->mMediaType = wrapper->mediaType; + result->mDetails = RTCSessionDescriptionMediaLineDetails::toNative(wrapper->details); + result->mCapabilities = RTCSctpCapabilities::toNative(wrapper->capabilities); + Helper::optionalSafeIntConvert(wrapper->port, result->mPort); + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h new file mode 100644 index 00000000..5a61e0e0 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h @@ -0,0 +1,44 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionSctpMediaLine : public wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::SCTPMediaLine, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionSctpMediaLine, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLine, WrapperType); + RTCSessionDescriptionSctpMediaLineWeakPtr thisWeak_; + + RTCSessionDescriptionSctpMediaLine() noexcept; + virtual ~RTCSessionDescriptionSctpMediaLine() noexcept; + + // methods RTCSessionDescriptionMediaLine + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + // methods RTCSessionDescriptionSctpMediaLine + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine(wrapper::org::ortc::adapter::RTCSessionDescriptionSctpMediaLinePtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine(wrapper::org::ortc::JsonPtr json) noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp new file mode 100644 index 00000000..d0d10bb5 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp @@ -0,0 +1,116 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionTransport.h" +#include "impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::RTCSessionDescriptionTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionTransportPtr wrapper::org::ortc::adapter::RTCSessionDescriptionTransport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::~RTCSessionDescriptionTransport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransport() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransport(wrapper::org::ortc::adapter::RTCSessionDescriptionTransportPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransport(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransport::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->transportId = native.mID; + pThis->rtp = RTCSessionDescriptionTransportParameters::toWrapper(native.mRTP); + pThis->rtcp = RTCSessionDescriptionTransportParameters::toWrapper(native.mRTCP); + pThis->useMux = native.mUseMux; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mID = wrapper->transportId; + result->mRTP = RTCSessionDescriptionTransportParameters::toNative(wrapper->rtp); + result->mRTCP = RTCSessionDescriptionTransportParameters::toNative(wrapper->rtcp); + result->mUseMux = wrapper->useMux; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.h new file mode 100644 index 00000000..d2222215 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransport.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionTransport.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionTransport : public wrapper::org::ortc::adapter::RTCSessionDescriptionTransport + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::Transport, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionTransport, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionTransport, WrapperType); + RTCSessionDescriptionTransportWeakPtr thisWeak_; + + RTCSessionDescriptionTransport() noexcept; + virtual ~RTCSessionDescriptionTransport() noexcept; + + // methods RTCSessionDescriptionTransport + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransport() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransport(wrapper::org::ortc::adapter::RTCSessionDescriptionTransportPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransport(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp new file mode 100644 index 00000000..822bcf92 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp @@ -0,0 +1,133 @@ + +#include "impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h" +#include "impl_org_ortc_RTCIceParameters.h" +#include "impl_org_ortc_RTCDtlsParameters.h" +#include "impl_org_ortc_RTCSrtpSdesParameters.h" +#include "impl_org_ortc_RTCIceCandidate.h" +#include "impl_org_ortc_Json.h" +#include "impl_org_ortc_Helper.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::RTCSessionDescriptionTransportParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCSessionDescriptionTransportParametersPtr wrapper::org::ortc::adapter::RTCSessionDescriptionTransportParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::~RTCSessionDescriptionTransportParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransportParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransportParameters(wrapper::org::ortc::adapter::RTCSessionDescriptionTransportParametersPtr source) noexcept +{ + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(toNative(source)); + if (!wrapper) return; + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransportParameters(wrapper::org::ortc::JsonPtr json) noexcept +{ + if (!json) return; + + WrapperTypePtr pThis = thisWeak_.lock(); + WrapperTypePtr wrapper = toWrapper(make_shared(Json::toNative(json))); + if (!wrapper) return; + + (*pThis) = (*wrapper); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::JsonPtr wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::toJson() noexcept +{ + return Json::toWrapper(toNative(thisWeak_.lock())->createElement("RTCSessionDescriptionTransportParameters")); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::ortc::adapter::RTCSessionDescriptionTransportParameters::hash() noexcept +{ + return toNative(thisWeak_.lock())->hash(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->iceParameters = RTCIceParameters::toWrapper(native.mICEParameters); + pThis->dtlsParameters = RTCDtlsParameters::toWrapper(native.mDTLSParameters); + pThis->srtpSdesParameters = RTCSrtpSdesParameters::toWrapper(native.mSRTPSDESParameters); + pThis->iceCandidates = make_shared< list< wrapper::org::ortc::RTCIceCandidatePtr > >(); + for (auto iter = native.mICECandidates.begin(); iter != native.mICECandidates.end(); ++iter) { + auto wrapper = wrapper::impl::org::ortc::RTCIceCandidate::toWrapper(*iter); + if (!wrapper) continue; + pThis->iceCandidates->push_back(wrapper); + } + pThis->endOfCandidates = native.mEndOfCandidates; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto result = make_shared(); + result->mICEParameters = RTCIceParameters::toNative(wrapper->iceParameters); + result->mDTLSParameters = RTCDtlsParameters::toNative(wrapper->dtlsParameters); + result->mSRTPSDESParameters = RTCSrtpSdesParameters::toNative(wrapper->srtpSdesParameters); + if (wrapper->iceCandidates) { + for (auto iter = wrapper->iceCandidates->begin(); iter != wrapper->iceCandidates->end(); ++iter) { + auto native = wrapper::impl::org::ortc::RTCIceCandidate::toNative(*iter); + if (!native) continue; + result->mICECandidates.push_back(native); + } + } + result->mEndOfCandidates = wrapper->endOfCandidates; + return result; +} diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h new file mode 100644 index 00000000..389af5b3 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCSessionDescriptionTransportParameters.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCSessionDescriptionTransportParameters : public wrapper::org::ortc::adapter::RTCSessionDescriptionTransportParameters + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::ISessionDescriptionTypes::Transport::Parameters, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCSessionDescriptionTransportParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCSessionDescriptionTransportParameters, WrapperType); + RTCSessionDescriptionTransportParametersWeakPtr thisWeak_; + + RTCSessionDescriptionTransportParameters() noexcept; + virtual ~RTCSessionDescriptionTransportParameters() noexcept; + + // methods RTCSessionDescriptionTransportParameters + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransportParameters() noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransportParameters(wrapper::org::ortc::adapter::RTCSessionDescriptionTransportParametersPtr source) noexcept override; + void wrapper_init_org_ortc_adapter_RTCSessionDescriptionTransportParameters(wrapper::org::ortc::JsonPtr json) noexcept override; + wrapper::org::ortc::JsonPtr toJson() noexcept override; + String hash() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.cpp b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.cpp new file mode 100644 index 00000000..7909b496 --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.cpp @@ -0,0 +1,92 @@ + +#include "impl_org_ortc_adapter_RTCTrackEvent.h" +#include "impl_org_ortc_adapter_MediaStream.h" +#include "impl_org_ortc_MediaStreamTrack.h" +#include "impl_org_ortc_RTCRtpReceiver.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCTrackEvent::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCTrackEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::ortc::adapter::RTCTrackEvent::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCTrackEvent::RTCTrackEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::adapter::RTCTrackEventPtr wrapper::org::ortc::adapter::RTCTrackEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::ortc::adapter::RTCTrackEvent::~RTCTrackEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::RTCRtpReceiverPtr wrapper::impl::org::ortc::adapter::RTCTrackEvent::get_receiver() noexcept +{ + return wrapper::impl::org::ortc::RTCRtpReceiver::toWrapper(native_->mReceiver); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaStreamTrackPtr wrapper::impl::org::ortc::adapter::RTCTrackEvent::get_track() noexcept +{ + return wrapper::impl::org::ortc::MediaStreamTrack::toWrapper(native_->mTrack); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::ortc::adapter::MediaStreamPtr > > wrapper::impl::org::ortc::adapter::RTCTrackEvent::get_mediaStreams() noexcept +{ + auto result = make_shared< list< wrapper::org::ortc::adapter::MediaStreamPtr > >(); + for (auto iter = native_->mMediaStreams.begin(); iter != native_->mMediaStreams.end(); ++iter) { + auto wrapper = MediaStream::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + pThis->native_ = native; + return pThis; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto impl = std::dynamic_pointer_cast(wrapper); + if (!impl) return NativeTypePtr(); + + return impl->native_; +} + diff --git a/ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.h b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.h new file mode 100644 index 00000000..b16d9d5a --- /dev/null +++ b/ortc/idl/wrapper/impl_org_ortc_adapter_RTCTrackEvent.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_ortc_adapter_RTCTrackEvent.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace ortc { + namespace adapter { + + struct RTCTrackEvent : public wrapper::org::ortc::adapter::RTCTrackEvent + { + ZS_DECLARE_TYPEDEF_PTR(::ortc::adapter::IPeerConnection::MediaStreamTrackEvent, NativeType); + ZS_DECLARE_TYPEDEF_PTR(RTCTrackEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::ortc::adapter::RTCTrackEvent, WrapperType); + RTCTrackEventWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCTrackEvent() noexcept; + virtual ~RTCTrackEvent() noexcept; + + // properties RTCTrackEvent + wrapper::org::ortc::RTCRtpReceiverPtr get_receiver() noexcept override; + wrapper::org::ortc::MediaStreamTrackPtr get_track() noexcept override; + shared_ptr< list< wrapper::org::ortc::adapter::MediaStreamPtr > > get_mediaStreams() noexcept override; + + static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // adapter + } // ortc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_EventQueue.cpp b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueue.cpp new file mode 100644 index 00000000..3e287f44 --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueue.cpp @@ -0,0 +1,113 @@ + + +#ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#include +#include +#include +#include + +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperClone(org_ortc_EventQueue_t handle) +{ + typedef wrapper::org::ortc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast(new WrapperTypePtr(*reinterpret_cast(handle))); +} + +//------------------------------------------------------------------------------ +void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperDestroy(org_ortc_EventQueue_t handle) +{ + typedef wrapper::org::ortc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return; + delete reinterpret_cast(handle); +} + +//------------------------------------------------------------------------------ +instance_id_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperInstanceId(org_ortc_EventQueue_t handle) +{ + typedef wrapper::org::ortc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast((*reinterpret_cast(handle)).get()); +} + +#if 0 +//------------------------------------------------------------------------------ +org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperCreate_EventQueue(zs_Any_t queue) +{ + auto wrapperThis = wrapper::org::ortc::EventQueue::wrapper_create(); + wrapperThis->wrapper_init_org_ortc_EventQueue(wrapper::zs_Any_wrapperFromHandle(queue)); + return wrapper::org_ortc_EventQueue_wrapperToHandle(wrapperThis); +} +#endif /* 0 NOT USED */ + +//------------------------------------------------------------------------------ +org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_getDefaultForUi() +{ + return wrapper::org_ortc_EventQueue_wrapperToHandle(wrapper::org::ortc::EventQueue::getDefaultForUi()); +} + +//------------------------------------------------------------------------------ +org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_get_singleton() +{ + return wrapper::org_ortc_EventQueue_wrapperToHandle(wrapper::org::ortc::EventQueue::get_singleton()); +} + +//------------------------------------------------------------------------------ +void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_set_singleton(org_ortc_EventQueue_t value) +{ + wrapper::org::ortc::EventQueue::set_singleton(wrapper::org_ortc_EventQueue_wrapperFromHandle(value)); +} + +#if 0 +//------------------------------------------------------------------------------ +zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_get_queue(org_ortc_EventQueue_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_ortc_EventQueue_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_queue()); +} +#endif /* 0 NOT USED */ + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_ortc_EventQueue_t org_ortc_EventQueue_wrapperToHandle(wrapper::org::ortc::EventQueuePtr value) + { + typedef org_ortc_EventQueue_t CType; + typedef wrapper::org::ortc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::ortc::EventQueuePtr org_ortc_EventQueue_wrapperFromHandle(org_ortc_EventQueue_t handle) + { + typedef wrapper::org::ortc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUE */ diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_EventQueue.h b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueue.h new file mode 100644 index 00000000..02a530a2 --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueue.h @@ -0,0 +1,41 @@ + +#ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#pragma once + +#include + + +ORTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_ortc_EventQueue*/ + +ORTC_WRAPPER_C_EXPORT_API org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperClone(org_ortc_EventQueue_t handle); +ORTC_WRAPPER_C_EXPORT_API void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperDestroy(org_ortc_EventQueue_t handle); +ORTC_WRAPPER_C_EXPORT_API instance_id_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperInstanceId(org_ortc_EventQueue_t handle); +#if 0 +ORTC_WRAPPER_C_EXPORT_API org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_wrapperCreate_EventQueue(zs_Any_t queue); +#endif /* 0 NOT USED */ +ORTC_WRAPPER_C_EXPORT_API org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_getDefaultForUi(); +ORTC_WRAPPER_C_EXPORT_API org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_get_singleton(); +ORTC_WRAPPER_C_EXPORT_API void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_set_singleton(org_ortc_EventQueue_t value); +#if 0 +ORTC_WRAPPER_C_EXPORT_API zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueue_get_queue(org_ortc_EventQueue_t wrapperThisHandle); +#endif /* 0 NOT USED */ + + +ORTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_ortc_EventQueue_t org_ortc_EventQueue_wrapperToHandle(wrapper::org::ortc::EventQueuePtr value); + wrapper::org::ortc::EventQueuePtr org_ortc_EventQueue_wrapperFromHandle(org_ortc_EventQueue_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUE */ diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_EventQueueMaker.cpp b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueueMaker.cpp new file mode 100644 index 00000000..77fc584f --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueueMaker.cpp @@ -0,0 +1,65 @@ + + +#ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +#if 0 +//------------------------------------------------------------------------------ +org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueueMaker_bindQueue(zs_Any_t queue) +{ + return wrapper::org_ortc_EventQueue_wrapperToHandle(wrapper::org::ortc::EventQueueMaker::bindQueue(wrapper::zs_Any_wrapperFromHandle(queue))); +} + +//------------------------------------------------------------------------------ +zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueueMaker_extractQueue(org_ortc_EventQueue_t queue) +{ + return wrapper::zs_Any_wrapperToHandle(wrapper::org::ortc::EventQueueMaker::extractQueue(wrapper::org_ortc_EventQueue_wrapperFromHandle(queue))); +} +#endif //0 + +namespace wrapper +{ +#if 0 + //---------------------------------------------------------------------------- + org_ortc_EventQueueMaker_t org_ortc_EventQueueMaker_wrapperToHandle(wrapper::org::ortc::EventQueueMakerPtr value) + { + typedef org_ortc_EventQueueMaker_t CType; + typedef wrapper::org::ortc::EventQueueMakerPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::ortc::EventQueueMakerPtr org_ortc_EventQueueMaker_wrapperFromHandle(org_ortc_EventQueueMaker_t handle) + { + typedef wrapper::org::ortc::EventQueueMakerPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } +#endif //0 + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER */ + diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_EventQueueMaker.h b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueueMaker.h new file mode 100644 index 00000000..2f0bad1a --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_EventQueueMaker.h @@ -0,0 +1,35 @@ + + +#ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#pragma once + +#include + + +ORTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_ortc_EventQueueMaker*/ + +#if 0 +ORTC_WRAPPER_C_EXPORT_API org_ortc_EventQueue_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueueMaker_bindQueue(zs_Any_t queue); +ORTC_WRAPPER_C_EXPORT_API zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_EventQueueMaker_extractQueue(org_ortc_EventQueue_t queue); +#endif //0 + +ORTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ +#if 0 + org_ortc_EventQueueMaker_t org_ortc_EventQueueMaker_wrapperToHandle(wrapper::org::ortc::EventQueueMakerPtr value); + wrapper::org::ortc::EventQueueMakerPtr org_ortc_EventQueueMaker_wrapperFromHandle(org_ortc_EventQueueMaker_t handle); +#endif //0 + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER */ diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_MediaControl.cpp b/ortc/idl/wrapper/override/c/c_org_ortc_MediaControl.cpp new file mode 100644 index 00000000..ce1af485 --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_MediaControl.cpp @@ -0,0 +1,61 @@ + + +#ifndef C_USE_GENERATED_ORG_ORTC_MEDIACONTROL + +#include +#include +#include +#include + +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +//------------------------------------------------------------------------------ +zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaControl_get_displayOrientation() +{ + return wrapper::zs_Any_wrapperToHandle(wrapper::org::ortc::MediaControl::get_displayOrientation()); +} + +//------------------------------------------------------------------------------ +void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaControl_set_displayOrientation(zs_Any_t value) +{ + wrapper::org::ortc::MediaControl::set_displayOrientation(wrapper::zs_Any_wrapperFromHandle(value)); +} + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_ortc_MediaControl_t org_ortc_MediaControl_wrapperToHandle(wrapper::org::ortc::MediaControlPtr value) + { + typedef org_ortc_MediaControl_t CType; + typedef wrapper::org::ortc::MediaControlPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::ortc::MediaControlPtr org_ortc_MediaControl_wrapperFromHandle(org_ortc_MediaControl_t handle) + { + typedef wrapper::org::ortc::MediaControlPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_MEDIACONTROL */ diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_MediaControl.h b/ortc/idl/wrapper/override/c/c_org_ortc_MediaControl.h new file mode 100644 index 00000000..c8fe97c2 --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_MediaControl.h @@ -0,0 +1,31 @@ + +#ifndef C_USE_GENERATED_ORG_ORTC_MEDIACONTROL + +#pragma once + +#include + + +ORTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_ortc_MediaControl*/ + +ORTC_WRAPPER_C_EXPORT_API zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaControl_get_displayOrientation(); +ORTC_WRAPPER_C_EXPORT_API void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaControl_set_displayOrientation(zs_Any_t value); + + +ORTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_ortc_MediaControl_t org_ortc_MediaControl_wrapperToHandle(wrapper::org::ortc::MediaControlPtr value); + wrapper::org::ortc::MediaControlPtr org_ortc_MediaControl_wrapperFromHandle(org_ortc_MediaControl_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_MEDIACONTROL */ diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_MediaSource.cpp b/ortc/idl/wrapper/override/c/c_org_ortc_MediaSource.cpp new file mode 100644 index 00000000..eb562518 --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_MediaSource.cpp @@ -0,0 +1,107 @@ + + +#ifndef C_USE_GENERATED_ORG_ORTC_MEDIASOURCE + +#include +#include +#include +#include + +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_ortc_MediaSource_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperCreate_MediaSource() +{ + typedef org_ortc_MediaSource_t CType; + typedef wrapper::org::ortc::MediaSourcePtr WrapperTypePtr; + auto result = wrapper::org::ortc::MediaSource::wrapper_create(); + result->wrapper_init_org_ortc_MediaSource(); + return reinterpret_cast(new WrapperTypePtr(result)); +} + +//------------------------------------------------------------------------------ +org_ortc_MediaSource_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperClone(org_ortc_MediaSource_t handle) +{ + typedef wrapper::org::ortc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast(new WrapperTypePtr(*reinterpret_cast(handle))); +} + +//------------------------------------------------------------------------------ +void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperDestroy(org_ortc_MediaSource_t handle) +{ + typedef wrapper::org::ortc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return; + delete reinterpret_cast(handle); +} + +//------------------------------------------------------------------------------ +instance_id_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperInstanceId(org_ortc_MediaSource_t handle) +{ + typedef wrapper::org::ortc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast((*reinterpret_cast(handle)).get()); +} + +//------------------------------------------------------------------------------ +zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_get_source(org_ortc_MediaSource_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_ortc_MediaSource_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_source()); +} + +//------------------------------------------------------------------------------ +void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_set_source(org_ortc_MediaSource_t wrapperThisHandle, zs_Any_t value) +{ + auto wrapperThis = wrapper::org_ortc_MediaSource_wrapperFromHandle(wrapperThisHandle); + wrapperThis->set_source(wrapper::zs_Any_wrapperFromHandle(value)); +} + +//------------------------------------------------------------------------------ +zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_get_track(org_ortc_MediaSource_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_ortc_MediaSource_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_track()); +} + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_ortc_MediaSource_t org_ortc_MediaSource_wrapperToHandle(wrapper::org::ortc::MediaSourcePtr value) + { + typedef org_ortc_MediaSource_t CType; + typedef wrapper::org::ortc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::ortc::MediaSourcePtr org_ortc_MediaSource_wrapperFromHandle(org_ortc_MediaSource_t handle) + { + typedef wrapper::org::ortc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_MEDIASOURCE */ diff --git a/ortc/idl/wrapper/override/c/c_org_ortc_MediaSource.h b/ortc/idl/wrapper/override/c/c_org_ortc_MediaSource.h new file mode 100644 index 00000000..fc6678b5 --- /dev/null +++ b/ortc/idl/wrapper/override/c/c_org_ortc_MediaSource.h @@ -0,0 +1,36 @@ + +#ifndef C_USE_GENERATED_ORG_ORTC_MEDIASOURCE + +#pragma once + +#include + + +ORTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_ortc_MediaSource*/ + +ORTC_WRAPPER_C_EXPORT_API org_ortc_MediaSource_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperCreate_MediaSource(); +ORTC_WRAPPER_C_EXPORT_API org_ortc_MediaSource_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperClone(org_ortc_MediaSource_t handle); +ORTC_WRAPPER_C_EXPORT_API void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperDestroy(org_ortc_MediaSource_t handle); +ORTC_WRAPPER_C_EXPORT_API instance_id_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_wrapperInstanceId(org_ortc_MediaSource_t handle); +ORTC_WRAPPER_C_EXPORT_API zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_get_source(org_ortc_MediaSource_t wrapperThisHandle); +ORTC_WRAPPER_C_EXPORT_API void ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_set_source(org_ortc_MediaSource_t wrapperThisHandle, zs_Any_t value); +ORTC_WRAPPER_C_EXPORT_API zs_Any_t ORTC_WRAPPER_C_CALLING_CONVENTION org_ortc_MediaSource_get_track(org_ortc_MediaSource_t wrapperThisHandle); + + +ORTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_ortc_MediaSource_t org_ortc_MediaSource_wrapperToHandle(wrapper::org::ortc::MediaSourcePtr value); + wrapper::org::ortc::MediaSourcePtr org_ortc_MediaSource_wrapperFromHandle(org_ortc_MediaSource_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_ORTC_MEDIASOURCE */ diff --git a/ortc/idl/wrapper/override/cppwinrt/EventQueue.cpp b/ortc/idl/wrapper/override/cppwinrt/EventQueue.cpp new file mode 100644 index 00000000..27b8d148 --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/EventQueue.cpp @@ -0,0 +1,149 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#include +#include "EventQueue.h" + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueue > Org::Ortc::implementation::EventQueue::ToCppWinrtImpl(wrapper::org::ortc::EventQueuePtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueue > Org::Ortc::implementation::EventQueue::ToCppWinrtImpl(Org::Ortc::EventQueue const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::EventQueue > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueue > Org::Ortc::implementation::EventQueue::ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueue > Org::Ortc::implementation::EventQueue::ToCppWinrtImpl(Org::Ortc::IEventQueue const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::EventQueue > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueue Org::Ortc::implementation::EventQueue::ToCppWinrt(wrapper::org::ortc::EventQueuePtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueue Org::Ortc::implementation::EventQueue::ToCppWinrt(Org::Ortc::EventQueue const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueue Org::Ortc::implementation::EventQueue::ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value) +{ + return value.as< Org::Ortc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueue Org::Ortc::implementation::EventQueue::ToCppWinrt(Org::Ortc::IEventQueue const & value) +{ + return value.as< Org::Ortc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueue::ToCppWinrtInterface(wrapper::org::ortc::EventQueuePtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::IEventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueue::ToCppWinrtInterface(Org::Ortc::EventQueue const & value) +{ + return value.as< Org::Ortc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueue::ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value) +{ + return value.as< Org::Ortc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueue::ToCppWinrtInterface(Org::Ortc::IEventQueue const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr Org::Ortc::implementation::EventQueue::FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value) +{ + if (!value) return wrapper::org::ortc::EventQueuePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr Org::Ortc::implementation::EventQueue::FromCppWinrt(Org::Ortc::EventQueue const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr Org::Ortc::implementation::EventQueue::FromCppWinrt(wrapper::org::ortc::EventQueuePtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr Org::Ortc::implementation::EventQueue::FromCppWinrt(Org::Ortc::IEventQueue const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueue Org::Ortc::implementation::EventQueue::Cast(Org::Ortc::IEventQueue const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_Ortc_EventQueue(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::ortc::EventQueue >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueue::GetDefaultForUi() +{ + Org::Ortc::IEventQueue result {nullptr}; + result = ::Internal::Helper::ToCppWinrt_Org_Ortc_EventQueue(wrapper::org::ortc::EventQueue::getDefaultForUi()); + return result; +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueue::Singleton() +{ + return ::Internal::Helper::ToCppWinrt_Org_Ortc_EventQueue(wrapper::org::ortc::EventQueue::get_singleton()); +} + +//------------------------------------------------------------------------------ +void Org::Ortc::implementation::EventQueue::Singleton(Org::Ortc::IEventQueue const & value) +{ + wrapper::org::ortc::EventQueue::set_singleton(::Internal::Helper::FromCppWinrt_Org_Ortc_EventQueue(value)); +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUE diff --git a/ortc/idl/wrapper/override/cppwinrt/EventQueue.h b/ortc/idl/wrapper/override/cppwinrt/EventQueue.h new file mode 100644 index 00000000..6e242a6a --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/EventQueue.h @@ -0,0 +1,90 @@ + +#pragma once + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#include + +#include "EventQueue.g.h" +#include + +namespace winrt { + namespace Org { + namespace Ortc { + namespace implementation { + + + /// + /// A message queue for receiving delegate events. + /// + struct EventQueue : EventQueueT + { + // internal + wrapper::org::ortc::EventQueuePtr native_; + + struct WrapperCreate {}; + EventQueue(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::Ortc::implementation::EventQueue > ToCppWinrtImpl(wrapper::org::ortc::EventQueuePtr value); + static winrt::com_ptr< Org::Ortc::implementation::EventQueue > ToCppWinrtImpl(Org::Ortc::EventQueue const & value); + static winrt::com_ptr< Org::Ortc::implementation::EventQueue > ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value); + static winrt::com_ptr< Org::Ortc::implementation::EventQueue > ToCppWinrtImpl(Org::Ortc::IEventQueue const & value); + + // ToCppWinrt + static Org::Ortc::EventQueue ToCppWinrt(wrapper::org::ortc::EventQueuePtr value); + static Org::Ortc::EventQueue ToCppWinrt(Org::Ortc::EventQueue const & value); + static Org::Ortc::EventQueue ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value); + static Org::Ortc::EventQueue ToCppWinrt(Org::Ortc::IEventQueue const & value); + + // ToCppWinrtInterface + static Org::Ortc::IEventQueue ToCppWinrtInterface(wrapper::org::ortc::EventQueuePtr value); + static Org::Ortc::IEventQueue ToCppWinrtInterface(Org::Ortc::EventQueue const & value); + static Org::Ortc::IEventQueue ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value); + static Org::Ortc::IEventQueue ToCppWinrtInterface(Org::Ortc::IEventQueue const & value); + + // FromCppWinrt + static wrapper::org::ortc::EventQueuePtr FromCppWinrt(wrapper::org::ortc::EventQueuePtr value); + static wrapper::org::ortc::EventQueuePtr FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueue > const & value); + static wrapper::org::ortc::EventQueuePtr FromCppWinrt(Org::Ortc::EventQueue const & value); + static wrapper::org::ortc::EventQueuePtr FromCppWinrt(Org::Ortc::IEventQueue const & value); + + + + + public: + /// + /// Cast from Org::Ortc::IEventQueue to EventQueue + /// + static Org::Ortc::EventQueue Cast(Org::Ortc::IEventQueue const & value); + + // ::org::ortc::EventQueue + + /// + /// The default windows message queue for the system GUI thread. + /// + static Org::Ortc::IEventQueue GetDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + static Org::Ortc::IEventQueue Singleton(); + static void Singleton(Org::Ortc::IEventQueue const & value); + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct EventQueue : EventQueueT + { + }; + + } // namespace factory_implementation + + } // namespace Ortc + } // namespace Org +} // namespace winrt + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUE diff --git a/ortc/idl/wrapper/override/cppwinrt/EventQueueMaker.cpp b/ortc/idl/wrapper/override/cppwinrt/EventQueueMaker.cpp new file mode 100644 index 00000000..b23be3bd --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/EventQueueMaker.cpp @@ -0,0 +1,149 @@ +// Generated by zsLibEventingTool + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#include +#include "EventQueueMaker.h" +#include "EventQueue.h" + +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > Org::Ortc::implementation::EventQueueMaker::ToCppWinrtImpl(wrapper::org::ortc::EventQueueMakerPtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > Org::Ortc::implementation::EventQueueMaker::ToCppWinrtImpl(Org::Ortc::EventQueueMaker const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > Org::Ortc::implementation::EventQueueMaker::ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > Org::Ortc::implementation::EventQueueMaker::ToCppWinrtImpl(Org::Ortc::IEventQueueMaker const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrt(wrapper::org::ortc::EventQueueMakerPtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrt(Org::Ortc::EventQueueMaker const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value) +{ + return value.as< Org::Ortc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrt(Org::Ortc::IEventQueueMaker const & value) +{ + return value.as< Org::Ortc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrtInterface(wrapper::org::ortc::EventQueueMakerPtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::IEventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrtInterface(Org::Ortc::EventQueueMaker const & value) +{ + return value.as< Org::Ortc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value) +{ + return value.as< Org::Ortc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueueMaker Org::Ortc::implementation::EventQueueMaker::ToCppWinrtInterface(Org::Ortc::IEventQueueMaker const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueueMakerPtr Org::Ortc::implementation::EventQueueMaker::FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value) +{ + if (!value) return wrapper::org::ortc::EventQueueMakerPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueueMakerPtr Org::Ortc::implementation::EventQueueMaker::FromCppWinrt(Org::Ortc::EventQueueMaker const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueueMakerPtr Org::Ortc::implementation::EventQueueMaker::FromCppWinrt(wrapper::org::ortc::EventQueueMakerPtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueueMakerPtr Org::Ortc::implementation::EventQueueMaker::FromCppWinrt(Org::Ortc::IEventQueueMaker const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::Ortc::EventQueueMaker Org::Ortc::implementation::EventQueueMaker::Cast(Org::Ortc::IEventQueueMaker const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_Ortc_EventQueueMaker(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::ortc::EventQueueMaker >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IEventQueue Org::Ortc::implementation::EventQueueMaker::Bind(Windows::UI::Core::CoreDispatcher const & queue) +{ + Org::Ortc::IEventQueue result {nullptr}; + result = Org::Ortc::implementation::EventQueue::ToCppWinrtInterface(wrapper::impl::org::ortc::EventQueue::toWrapper(queue)); + return result; +} + +//------------------------------------------------------------------------------ +Windows::UI::Core::CoreDispatcher Org::Ortc::implementation::EventQueueMaker::Extract(Org::Ortc::IEventQueue const & queue) +{ + Windows::UI::Core::CoreDispatcher result {nullptr}; + result = wrapper::impl::org::ortc::EventQueue::toNative_winrt(Org::Ortc::implementation::EventQueue::FromCppWinrt(queue)); + return result; +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER diff --git a/ortc/idl/wrapper/override/cppwinrt/EventQueueMaker.h b/ortc/idl/wrapper/override/cppwinrt/EventQueueMaker.h new file mode 100644 index 00000000..1aa3aa8d --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/EventQueueMaker.h @@ -0,0 +1,86 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#include + +#include "EventQueueMaker.g.h" +#include + +namespace winrt { + namespace Org { + namespace Ortc { + namespace implementation { + + + struct EventQueueMaker : EventQueueMakerT + { + // internal + wrapper::org::ortc::EventQueueMakerPtr native_; + + struct WrapperCreate {}; + EventQueueMaker(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > ToCppWinrtImpl(wrapper::org::ortc::EventQueueMakerPtr value); + static winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > ToCppWinrtImpl(Org::Ortc::EventQueueMaker const & value); + static winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value); + static winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > ToCppWinrtImpl(Org::Ortc::IEventQueueMaker const & value); + + // ToCppWinrt + static Org::Ortc::EventQueueMaker ToCppWinrt(wrapper::org::ortc::EventQueueMakerPtr value); + static Org::Ortc::EventQueueMaker ToCppWinrt(Org::Ortc::EventQueueMaker const & value); + static Org::Ortc::EventQueueMaker ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value); + static Org::Ortc::EventQueueMaker ToCppWinrt(Org::Ortc::IEventQueueMaker const & value); + + // ToCppWinrtInterface + static Org::Ortc::IEventQueueMaker ToCppWinrtInterface(wrapper::org::ortc::EventQueueMakerPtr value); + static Org::Ortc::IEventQueueMaker ToCppWinrtInterface(Org::Ortc::EventQueueMaker const & value); + static Org::Ortc::IEventQueueMaker ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value); + static Org::Ortc::IEventQueueMaker ToCppWinrtInterface(Org::Ortc::IEventQueueMaker const & value); + + // FromCppWinrt + static wrapper::org::ortc::EventQueueMakerPtr FromCppWinrt(wrapper::org::ortc::EventQueueMakerPtr value); + static wrapper::org::ortc::EventQueueMakerPtr FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::EventQueueMaker > const & value); + static wrapper::org::ortc::EventQueueMakerPtr FromCppWinrt(Org::Ortc::EventQueueMaker const & value); + static wrapper::org::ortc::EventQueueMakerPtr FromCppWinrt(Org::Ortc::IEventQueueMaker const & value); + + + + + public: + /// + /// Cast from Org::Ortc::IEventQueueMaker to EventQueueMaker + /// + static Org::Ortc::EventQueueMaker Cast(Org::Ortc::IEventQueueMaker const & value); + + // ::org::ortc::EventQueueMaker + + /// + /// Creates an event queue object from a native queue type. + /// + static Org::Ortc::IEventQueue Bind(Windows::UI::Core::CoreDispatcher const & queue); + /// + /// Extracts a native queue from an event queue object. + /// + static Windows::UI::Core::CoreDispatcher Extract(Org::Ortc::IEventQueue const & queue); + + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct EventQueueMaker : EventQueueMakerT + { + }; + + } // namespace factory_implementation + + } // namespace Ortc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER diff --git a/ortc/idl/wrapper/override/cppwinrt/MediaControl.cpp b/ortc/idl/wrapper/override/cppwinrt/MediaControl.cpp new file mode 100644 index 00000000..48e6c85c --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/MediaControl.cpp @@ -0,0 +1,140 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIACONTROL +#include +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaControl > Org::Ortc::implementation::MediaControl::ToCppWinrtImpl(wrapper::org::ortc::MediaControlPtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaControl > Org::Ortc::implementation::MediaControl::ToCppWinrtImpl(Org::Ortc::MediaControl const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::MediaControl > impl{ nullptr }; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaControl > Org::Ortc::implementation::MediaControl::ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaControl > Org::Ortc::implementation::MediaControl::ToCppWinrtImpl(Org::Ortc::IMediaControl const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::MediaControl > impl{ nullptr }; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaControl Org::Ortc::implementation::MediaControl::ToCppWinrt(wrapper::org::ortc::MediaControlPtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::MediaControl >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaControl Org::Ortc::implementation::MediaControl::ToCppWinrt(Org::Ortc::MediaControl const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaControl Org::Ortc::implementation::MediaControl::ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value) +{ + return value.as< Org::Ortc::MediaControl >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaControl Org::Ortc::implementation::MediaControl::ToCppWinrt(Org::Ortc::IMediaControl const & value) +{ + return value.as< Org::Ortc::MediaControl >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaControl Org::Ortc::implementation::MediaControl::ToCppWinrtInterface(wrapper::org::ortc::MediaControlPtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::IMediaControl >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaControl Org::Ortc::implementation::MediaControl::ToCppWinrtInterface(Org::Ortc::MediaControl const & value) +{ + return value.as< Org::Ortc::MediaControl >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaControl Org::Ortc::implementation::MediaControl::ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value) +{ + return value.as< Org::Ortc::MediaControl >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaControl Org::Ortc::implementation::MediaControl::ToCppWinrtInterface(Org::Ortc::IMediaControl const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaControlPtr Org::Ortc::implementation::MediaControl::FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value) +{ + if (!value) return wrapper::org::ortc::MediaControlPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaControlPtr Org::Ortc::implementation::MediaControl::FromCppWinrt(Org::Ortc::MediaControl const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaControlPtr Org::Ortc::implementation::MediaControl::FromCppWinrt(wrapper::org::ortc::MediaControlPtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaControlPtr Org::Ortc::implementation::MediaControl::FromCppWinrt(Org::Ortc::IMediaControl const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaControl Org::Ortc::implementation::MediaControl::Cast(Org::Ortc::IMediaControl const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_Ortc_MediaControl(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::ortc::MediaControl >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Windows::Foundation::IInspectable Org::Ortc::implementation::MediaControl::DisplayOrientation() +{ + return nullptr; // ::Internal::Helper::ToCppWinrt(wrapper::org::ortc::MediaControl::get_displayOrientation()); +} + +//------------------------------------------------------------------------------ +void Org::Ortc::implementation::MediaControl::DisplayOrientation(Windows::Foundation::IInspectable const & value) +{ + //wrapper::org::ortc::MediaControl::set_displayOrientation(::Internal::Helper::FromCppWinrt(value)); +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIACONTROL diff --git a/ortc/idl/wrapper/override/cppwinrt/MediaControl.h b/ortc/idl/wrapper/override/cppwinrt/MediaControl.h new file mode 100644 index 00000000..f44cdeb6 --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/MediaControl.h @@ -0,0 +1,85 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIACONTROL + +#include "types.h" + +#include "MediaControl.g.h" +#include + +namespace winrt { + namespace Org { + namespace Ortc { + namespace implementation { + + + /// + /// Interface for controlling the behavior of media. + /// + struct MediaControl : MediaControlT + { + // internal + wrapper::org::ortc::MediaControlPtr native_; + + struct WrapperCreate {}; + MediaControl(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::Ortc::implementation::MediaControl > ToCppWinrtImpl(wrapper::org::ortc::MediaControlPtr value); + static winrt::com_ptr< Org::Ortc::implementation::MediaControl > ToCppWinrtImpl(Org::Ortc::MediaControl const & value); + static winrt::com_ptr< Org::Ortc::implementation::MediaControl > ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value); + static winrt::com_ptr< Org::Ortc::implementation::MediaControl > ToCppWinrtImpl(Org::Ortc::IMediaControl const & value); + + // ToCppWinrt + static Org::Ortc::MediaControl ToCppWinrt(wrapper::org::ortc::MediaControlPtr value); + static Org::Ortc::MediaControl ToCppWinrt(Org::Ortc::MediaControl const & value); + static Org::Ortc::MediaControl ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value); + static Org::Ortc::MediaControl ToCppWinrt(Org::Ortc::IMediaControl const & value); + + // ToCppWinrtInterface + static Org::Ortc::IMediaControl ToCppWinrtInterface(wrapper::org::ortc::MediaControlPtr value); + static Org::Ortc::IMediaControl ToCppWinrtInterface(Org::Ortc::MediaControl const & value); + static Org::Ortc::IMediaControl ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value); + static Org::Ortc::IMediaControl ToCppWinrtInterface(Org::Ortc::IMediaControl const & value); + + // FromCppWinrt + static wrapper::org::ortc::MediaControlPtr FromCppWinrt(wrapper::org::ortc::MediaControlPtr value); + static wrapper::org::ortc::MediaControlPtr FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaControl > const & value); + static wrapper::org::ortc::MediaControlPtr FromCppWinrt(Org::Ortc::MediaControl const & value); + static wrapper::org::ortc::MediaControlPtr FromCppWinrt(Org::Ortc::IMediaControl const & value); + + + + + public: + /// + /// Cast from Org::Ortc::IMediaControl to MediaControl + /// + static Org::Ortc::MediaControl Cast(Org::Ortc::IMediaControl const & value); + + /// + /// Gets or sets the media engine the application orientation has + /// changed. + /// + static Windows::Foundation::IInspectable DisplayOrientation(); + static void DisplayOrientation(Windows::Foundation::IInspectable const & value); + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct MediaControl : MediaControlT + { + }; + + } // namespace factory_implementation + + } // namespace Ortc + } // namespace Org +} // namespace winrt + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIACONTROL diff --git a/ortc/idl/wrapper/override/cppwinrt/MediaSource.cpp b/ortc/idl/wrapper/override/cppwinrt/MediaSource.cpp new file mode 100644 index 00000000..7dc46a85 --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/MediaSource.cpp @@ -0,0 +1,143 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIASOURCE + +#include +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaSource > Org::Ortc::implementation::MediaSource::ToCppWinrtImpl(wrapper::org::ortc::MediaSourcePtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaSource > Org::Ortc::implementation::MediaSource::ToCppWinrtImpl(Org::Ortc::MediaSource const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::MediaSource > impl{ nullptr }; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaSource > Org::Ortc::implementation::MediaSource::ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::Ortc::implementation::MediaSource > Org::Ortc::implementation::MediaSource::ToCppWinrtImpl(Org::Ortc::IMediaSource const & value) +{ + winrt::com_ptr< Org::Ortc::implementation::MediaSource > impl{ nullptr }; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaSource Org::Ortc::implementation::MediaSource::ToCppWinrt(wrapper::org::ortc::MediaSourcePtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaSource Org::Ortc::implementation::MediaSource::ToCppWinrt(Org::Ortc::MediaSource const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaSource Org::Ortc::implementation::MediaSource::ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value) +{ + return value.as< Org::Ortc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaSource Org::Ortc::implementation::MediaSource::ToCppWinrt(Org::Ortc::IMediaSource const & value) +{ + return value.as< Org::Ortc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaSource Org::Ortc::implementation::MediaSource::ToCppWinrtInterface(wrapper::org::ortc::MediaSourcePtr value) +{ + auto result = ToCppWinrtImpl(value); + return result.as< Org::Ortc::IMediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaSource Org::Ortc::implementation::MediaSource::ToCppWinrtInterface(Org::Ortc::MediaSource const & value) +{ + return value.as< Org::Ortc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaSource Org::Ortc::implementation::MediaSource::ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value) +{ + return value.as< Org::Ortc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::IMediaSource Org::Ortc::implementation::MediaSource::ToCppWinrtInterface(Org::Ortc::IMediaSource const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr Org::Ortc::implementation::MediaSource::FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value) +{ + if (!value) return wrapper::org::ortc::MediaSourcePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr Org::Ortc::implementation::MediaSource::FromCppWinrt(Org::Ortc::MediaSource const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr Org::Ortc::implementation::MediaSource::FromCppWinrt(wrapper::org::ortc::MediaSourcePtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr Org::Ortc::implementation::MediaSource::FromCppWinrt(Org::Ortc::IMediaSource const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::Ortc::implementation::MediaSource::MediaSource() + : native_(wrapper::org::ortc::MediaSource::wrapper_create()) +{ + native_->wrapper_init_org_ortc_MediaSource(); +} + +//------------------------------------------------------------------------------ +Org::Ortc::MediaSource Org::Ortc::implementation::MediaSource::Cast(Org::Ortc::IMediaSource const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_Ortc_MediaSource(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::ortc::MediaSource >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Windows::Media::Core::IMediaSource Org::Ortc::implementation::MediaSource::Source() +{ + if (!native_) { throw hresult_error(E_POINTER); } + return nullptr; // ::Internal::Helper::ToCppWinrt(native_->get_source()); +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIASOURCE diff --git a/ortc/idl/wrapper/override/cppwinrt/MediaSource.h b/ortc/idl/wrapper/override/cppwinrt/MediaSource.h new file mode 100644 index 00000000..21ac36c0 --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/MediaSource.h @@ -0,0 +1,84 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIASOURCE + +#include "types.h" + +#include "MediaSource.g.h" +#include + +namespace winrt { + namespace Org { + namespace Ortc { + namespace implementation { + + + /// + /// MediaSource represents an object holder for a platform specific + /// media source. + /// + struct MediaSource : MediaSourceT + { + // internal + wrapper::org::ortc::MediaSourcePtr native_; + + struct WrapperCreate {}; + MediaSource(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::Ortc::implementation::MediaSource > ToCppWinrtImpl(wrapper::org::ortc::MediaSourcePtr value); + static winrt::com_ptr< Org::Ortc::implementation::MediaSource > ToCppWinrtImpl(Org::Ortc::MediaSource const & value); + static winrt::com_ptr< Org::Ortc::implementation::MediaSource > ToCppWinrtImpl(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value); + static winrt::com_ptr< Org::Ortc::implementation::MediaSource > ToCppWinrtImpl(Org::Ortc::IMediaSource const & value); + + // ToCppWinrt + static Org::Ortc::MediaSource ToCppWinrt(wrapper::org::ortc::MediaSourcePtr value); + static Org::Ortc::MediaSource ToCppWinrt(Org::Ortc::MediaSource const & value); + static Org::Ortc::MediaSource ToCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value); + static Org::Ortc::MediaSource ToCppWinrt(Org::Ortc::IMediaSource const & value); + + // ToCppWinrtInterface + static Org::Ortc::IMediaSource ToCppWinrtInterface(wrapper::org::ortc::MediaSourcePtr value); + static Org::Ortc::IMediaSource ToCppWinrtInterface(Org::Ortc::MediaSource const & value); + static Org::Ortc::IMediaSource ToCppWinrtInterface(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value); + static Org::Ortc::IMediaSource ToCppWinrtInterface(Org::Ortc::IMediaSource const & value); + + // FromCppWinrt + static wrapper::org::ortc::MediaSourcePtr FromCppWinrt(wrapper::org::ortc::MediaSourcePtr value); + static wrapper::org::ortc::MediaSourcePtr FromCppWinrt(winrt::com_ptr< Org::Ortc::implementation::MediaSource > const & value); + static wrapper::org::ortc::MediaSourcePtr FromCppWinrt(Org::Ortc::MediaSource const & value); + static wrapper::org::ortc::MediaSourcePtr FromCppWinrt(Org::Ortc::IMediaSource const & value); + + + + + public: + MediaSource(); + /// + /// Cast from Org::Ortc::IMediaSource to MediaSource + /// + static Org::Ortc::MediaSource Cast(Org::Ortc::IMediaSource const & value); + + /// + /// Gets the platform specific media source. + /// + Windows::Media::Core::IMediaSource Source(); + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct MediaSource : MediaSourceT + { + }; + + } // namespace factory_implementation + + } // namespace Ortc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_ORTC_MEDIASOURCE diff --git a/ortc/idl/wrapper/override/cppwinrt/cppwinrt_Helpers_Throwers.cpp b/ortc/idl/wrapper/override/cppwinrt/cppwinrt_Helpers_Throwers.cpp new file mode 100644 index 00000000..4342f244 --- /dev/null +++ b/ortc/idl/wrapper/override/cppwinrt/cppwinrt_Helpers_Throwers.cpp @@ -0,0 +1,88 @@ + +#include "pch.h" + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#define CUSTOM_MAKE_HRESULT(xCustomerBit, xFacility, xErrorCode) ((HRESULT)(xErrorCode) <= 0 ? ((HRESULT)(xErrorCode)) : ((HRESULT) (((xErrorCode) & 0x0000FFFF) | ((xFacility) << 16) | ((xCustomerBit) << 29) | 0x80000000))) + +using namespace winrt; + +typedef Internal::Helper::Throwers ThrowersType; + +ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + +//----------------------------------------------------------------------------- +ThrowersType &ThrowersType::singleton() noexcept +{ + static ThrowersType result{}; + return result; +} + +//----------------------------------------------------------------------------- +void ThrowersType::customThrow(wrapper::org::ortc::OverconstrainedErrorPtr error) noexcept(false) +{ + if (!error) throw hresult_error(E_FAIL, L"No error object provided."); + + std::stringstream ss; + ss << error->name; + if (error->name.hasData()) ss << ": "; + ss << error->constraint; + if (error->message.hasData()) ss << " \""; + ss << error->message; + if (error->message.hasData()) ss << "\""; + + std::wstring message = String(ss.str()).wstring(); + + throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_DS_CONSTRAINT_VIOLATION), message); +} + +//----------------------------------------------------------------------------- +void ThrowersType::customThrow(wrapper::org::ortc::RTCIdentityErrorPtr error) noexcept(false) +{ + if (!error) throw hresult_error(E_FAIL, L"No error object provided."); + + std::stringstream ss; + if (error->protocol.hasData()) ss << "\""; + ss << error->protocol; + if (error->protocol.hasData()) ss << "\";"; + + if (error->loginUrl.hasData()) ss << "\""; + ss << error->loginUrl; + if (error->loginUrl.hasData()) ss << "\";"; + + if (error->idp.hasData()) ss << "\""; + ss << error->idp; + if (error->idp.hasData()) ss << "\";"; + + std::wstring message = String(ss.str()).wstring(); + + throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, RPC_S_INVALID_AUTH_IDENTITY)); +} + +//----------------------------------------------------------------------------- +void ThrowersType::customThrow(wrapper::org::ortc::ErrorPtr error) noexcept(false) +{ + if (!error) throw hresult_error(E_FAIL, L"No error object provided."); + + std::wstring message = String(error->name + (error->name.hasData() && error->reason.hasData() ? ": " : "") + error->reason).wstring(); + + HRESULT extractedCode = (HTTP_E_STATUS_BAD_REQUEST & 0x0000FFFF); + HRESULT otherParts = (HTTP_E_STATUS_BAD_REQUEST & 0xFFFF0000); + + extractedCode -= 400; + extractedCode += static_cast(error->errorCode); + + HRESULT mergedCode = extractedCode | otherParts; + + throw hresult_error(mergedCode, message); +} diff --git a/ortc/idl/wrapper/override/cx/MediaSourceHelper.cc b/ortc/idl/wrapper/override/cx/MediaSourceHelper.cc new file mode 100644 index 00000000..884cf013 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/MediaSourceHelper.cc @@ -0,0 +1,332 @@ +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + + +#include "MediaSourceHelper.h" + +#include +#include + +#include + +namespace Org +{ + namespace Ortc + { + + // Helper functions defined below. + bool IsSampleIDR(IMFSample* sample); + bool DropFramesToIDR(std::list& frames); + + + SampleData::SampleData() + : sizeHasChanged(false) + , size({ -1, -1 }) + , rotationHasChanged(false) + , rotation(-1) { + } + + MediaSourceHelper::MediaSourceHelper(bool isH264, + std::function mkSample, + std::function fpsCallback) + : _mkSample(mkSample) + , _fpsCallback(fpsCallback) + , _isFirstFrame(true) + , _futureOffsetMs(45) + , _lastSampleTime(0) + , _lastSize({ 0, 0 }) + , _lastRotation(-1) + , _isH264(isH264) + , _frameCounter(0) + , _startTime(0) + , _lastTimeFPSCalculated(webrtc::TickTime::Now()) + , _lock(webrtc::CriticalSectionWrapper::CreateCriticalSection()) { + + } + MediaSourceHelper::~MediaSourceHelper() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + // Clear the buffered frames. + while (!_frames.empty()) { + rtc::scoped_ptr frame(_frames.front()); + _frames.pop_front(); + } + } + + void MediaSourceHelper::QueueFrame(webrtc::VideoFrame* frame) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + + if (_isH264) { + // For H264 we keep all frames since they are encoded. + _frames.push_back(frame); + } + else { + // For I420 frame, keep only the latest. + for (auto oldFrame : _frames) { + delete oldFrame; + } + _frames.clear(); + _frames.push_back(frame); + } + } + + rtc::scoped_ptr MediaSourceHelper::DequeueFrame() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + + if (_frames.size() == 0) { + return nullptr; + } + + rtc::scoped_ptr data; + if (_isH264) { + data = DequeueH264Frame(); + } + else { + data = DequeueI420Frame(); + } + + // Set the timestamp property + if (_isFirstFrame) { + _isFirstFrame = false; + FirstFrameRenderHelper::FireEvent( + rtc::Timing::WallTimeNow() * rtc::kNumMillisecsPerSec); + LONGLONG frameTime = GetNextSampleTimeHns(data->renderTime); + data->sample->SetSampleTime(frameTime); + } else { + + LONGLONG frameTime = GetNextSampleTimeHns(data->renderTime); + + data->sample->SetSampleTime(frameTime); + + // Set the duration property + if (_isH264) { + data->sample->SetSampleDuration(frameTime - _lastSampleTime); + } + else { + LONGLONG duration = (LONGLONG)((1.0 / 30) * 1000 * 1000 * 10); + data->sample->SetSampleDuration(duration); + } + _lastSampleTime = frameTime; + } + + UpdateFrameRate(); + + return data; + } + + bool MediaSourceHelper::HasFrames() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + return _frames.size() > 0; + } + + // === Private functions below === + + rtc::scoped_ptr MediaSourceHelper::DequeueH264Frame() { + + if (_frames.size() > 15) + DropFramesToIDR(_frames); + + rtc::scoped_ptr frame(_frames.front()); + _frames.pop_front(); + + rtc::scoped_ptr data(new SampleData); + + // Get the IMFSample in the frame. + { + IMFSample* tmp = (IMFSample*)frame->video_frame_buffer()->native_handle(); + if (tmp != nullptr) { + tmp->AddRef(); + data->sample.Attach(tmp); + data->renderTime = frame->timestamp(); + + ComPtr sampleAttributes; + data->sample.As(&sampleAttributes); + if (IsSampleIDR(tmp)) { + sampleAttributes->SetUINT32(MFSampleExtension_CleanPoint, TRUE); + } + } + } + + CheckForAttributeChanges(frame.get(), data.get()); + return data; + } + + rtc::scoped_ptr MediaSourceHelper::DequeueI420Frame() { + rtc::scoped_ptr frame(_frames.front()); + _frames.pop_front(); + + rtc::scoped_ptr data(new SampleData); + + if (FAILED(_mkSample(frame.get(), &data->sample))) { + return nullptr; + } + + ComPtr sampleAttributes; + data->sample.As(&sampleAttributes); + sampleAttributes->SetUINT32(MFSampleExtension_CleanPoint, TRUE); + sampleAttributes->SetUINT32(MFSampleExtension_Discontinuity, TRUE); + + CheckForAttributeChanges(frame.get(), data.get()); + return data; + } + + // Guid to cache the IDR check result in the sample attributes. + const GUID GUID_IS_IDR = { 0x588e319a, 0x218c, 0x4d0d,{ 0x99, 0x6e, 0x77, 0x96, 0xb1, 0x46, 0x3e, 0x7e } }; + + bool IsSampleIDR(IMFSample* sample) { + ComPtr sampleAttributes; + sample->QueryInterface(&sampleAttributes); + + UINT32 isIdr; + if (SUCCEEDED(sampleAttributes->GetUINT32(GUID_IS_IDR, &isIdr))) { + return isIdr > 0; + } + + ComPtr pBuffer; + sample->GetBufferByIndex(0, &pBuffer); + BYTE* pBytes; + DWORD maxLength, curLength; + if (FAILED(pBuffer->Lock(&pBytes, &maxLength, &curLength))) { + return false; + } + + // Search for the beginnings of nal units. + for (DWORD i = 0; i < curLength - 5; ++i) { + BYTE* ptr = pBytes + i; + int prefixLengthFound = 0; + if (ptr[0] == 0x00 && ptr[1] == 0x00 && ptr[2] == 0x00 && ptr[3] == 0x01) { + prefixLengthFound = 4; + } + else if (ptr[0] == 0x00 && ptr[1] == 0x00 && ptr[2] == 0x01) { + prefixLengthFound = 3; + } + + if (prefixLengthFound > 0 && (ptr[prefixLengthFound] & 0x1f) == 0x05) { + // Found IDR NAL unit + pBuffer->Unlock(); + sampleAttributes->SetUINT32(GUID_IS_IDR, 1); // Cache result + return true; + } + } + pBuffer->Unlock(); + sampleAttributes->SetUINT32(GUID_IS_IDR, 0); // Cache result + return false; + } + + bool DropFramesToIDR(std::list& frames) { + webrtc::VideoFrame* idrFrame = nullptr; + // Go through the frames in reverse order (from newest to oldest) and look + // for an IDR frame. + for (auto it = frames.rbegin(); it != frames.rend(); ++it) { + IMFSample* pSample = (IMFSample*)(*it)->video_frame_buffer()->native_handle(); + if (pSample == nullptr) { + continue; // I don't expect this will ever happen. + } + + if (IsSampleIDR(pSample)) { + idrFrame = *it; + break; + } + } + + // If we have an IDR frame, drop all older frames. + if (idrFrame != nullptr) { + OutputDebugString(L"IDR found, dropping all other samples.\r\n"); + while (!frames.empty()) { + if (frames.front() == idrFrame) { + break; + } + auto frame = frames.front(); + frames.pop_front(); + delete frame; + } + } + return idrFrame != nullptr; + } + + void MediaSourceHelper::SetStartTimeNow() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + _startTickTime = webrtc::TickTime::Now(); + if (_isH264) { + if (!DropFramesToIDR(_frames)) { + // Flush all frames then. + while (!_frames.empty()) { + rtc::scoped_ptr frame(_frames.front()); + _frames.pop_front(); + } + } + } + } + +#define USE_WALL_CLOCK + LONGLONG MediaSourceHelper::GetNextSampleTimeHns(LONGLONG frameRenderTime) { + + if (_isH264) { +#ifdef USE_WALL_CLOCK + if (_startTickTime.Ticks() == 0) { + _startTickTime = webrtc::TickTime::Now(); + return 0; + } + LONGLONG frameTime = ((webrtc::TickTime::Now() - _startTickTime).Milliseconds() + _futureOffsetMs) * 1000 * 10; +#else + if (_startTime == 0) { + + _startTime = frameRenderTime; + // Return zero here so the first frame starts at zero. + // Only follow-up samples get an future offset. + return 0; + } + + LONGLONG frameTime = (frameRenderTime - _startTime) / 100 + (_futureOffsetMs * 1000 * 10); +#endif + + return frameTime; + } + else { + // Non-encoded samples seem to work best with a zero timestamp. + return 0; + } + } + + void MediaSourceHelper::CheckForAttributeChanges(webrtc::VideoFrame* frame, SampleData* data) { + SIZE currentSize = { (LONG)frame->width(), (LONG)frame->height() }; + if (_lastSize.cx != currentSize.cx || _lastSize.cy != currentSize.cy) { + data->sizeHasChanged = true; + data->size = currentSize; + _lastSize = currentSize; + } + + // Update rotation property + int currentRotation = frame->rotation(); + + // If the rotation has changed + if (_lastRotation == -1 || _lastRotation != currentRotation) { + data->rotationHasChanged = true; + data->rotation = currentRotation; + _lastRotation = currentRotation; + } + + } + + // Called whenever a new sample is sent for rendering. + void MediaSourceHelper::UpdateFrameRate() { + // Do FPS calculation and notification. + _frameCounter++; + // If we have about a second worth of frames + webrtc::TickTime now = webrtc::TickTime::Now(); + if ((now - _lastTimeFPSCalculated).Milliseconds() > 1000) { + _fpsCallback(_frameCounter); + _frameCounter = 0; + _lastTimeFPSCalculated = now; + } + } + + void FirstFrameRenderHelper::FireEvent(double timestamp) { + FirstFrameRendered(timestamp); + } + } // namespace ortc +} // namespace org diff --git a/ortc/idl/wrapper/override/cx/MediaSourceHelper.h b/ortc/idl/wrapper/override/cx/MediaSourceHelper.h new file mode 100644 index 00000000..86ff2243 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/MediaSourceHelper.h @@ -0,0 +1,113 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#pragma once + +#include +#include +#include +#include "api/mediastreaminterface.h" +#include "rtc_base/criticalsection.h" + +using Microsoft::WRL::ComPtr; + +namespace Org { + namespace Ortc { + /// + /// Delegate used to notify about first video frame rendering. + /// + public delegate void FirstFrameRenderedEventHandler(double timestamp); + + public ref class FirstFrameRenderHelper sealed { + public: + /// + /// Event fires when the first video frame renders. + /// + static event FirstFrameRenderedEventHandler^ FirstFrameRendered; + internal: + static void FireEvent(double timestamp); + }; + } +} +namespace Org { + namespace Ortc { + namespace Internal { + + enum VideoFrameType { + FrameTypeI420, + FrameTypeH264 + }; + + struct SampleData { + SampleData(); + ComPtr sample; + bool sizeHasChanged; + SIZE size; + bool rotationHasChanged; + int rotation; + LONGLONG renderTime; + }; + + class MediaSourceHelper { + public: + MediaSourceHelper( + VideoFrameType frameType, + std::function mkSample, + std::function fpsCallback); + ~MediaSourceHelper(); + + void SetStartTimeNow(); + void QueueFrame(webrtc::VideoFrame* frame); + std::unique_ptr DequeueFrame(); + bool HasFrames(); + + private: + rtc::CriticalSection _critSect; + std::list _frames; + VideoFrameType _frameType; + bool _isFirstFrame; + LONGLONG _startTime; + // One peculiarity, the timestamp of a sample should be slightly + // in the future for Media Foundation to handle it properly. + int _futureOffsetMs; + // We keep the last sample time to catch cases where samples are + // requested so quickly that the sample time doesn't change. + // We then increment it slightly to prevent giving MF duplicate times. + LONGLONG _lastSampleTime; + // Stored to detect changes. + SIZE _lastSize; + // In degrees. In practice it can only be 0, 90, 180 or 270. + int _lastRotation; + + std::unique_ptr DequeueH264Frame(); + std::unique_ptr DequeueI420Frame(); + + + // Gets the next timestamp using the clock. + // Guarantees no duplicate timestamps. + LONGLONG GetNextSampleTimeHns(LONGLONG frameRenderTime, bool isH264); + + void CheckForAttributeChanges(webrtc::VideoFrame* frame, SampleData* data); + + std::function _mkSample; + std::function _fpsCallback; + + // Called whenever a new sample is sent for rendering. + void UpdateFrameRate(); + // State related to calculating FPS. + int _frameCounter; + int64_t _lastTimeFPSCalculated; + + int64_t _startTickTime; + }; + } + } + + } // namespace ortc +} // namespace org diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueue.cpp b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueue.cpp new file mode 100644 index 00000000..0ea7a645 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueue.cpp @@ -0,0 +1,45 @@ + + +#ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#include +#include "Org_Ortc_EventQueue.h" + +//------------------------------------------------------------------------------ +::Org::Ortc::EventQueue^ Org::Ortc::EventQueue::ToCx(wrapper::org::ortc::EventQueuePtr value) +{ + if (!value) return nullptr; + auto result = ref new EventQueue(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueuePtr Org::Ortc::EventQueue::FromCx(::Org::Ortc::EventQueue^ value) +{ + if (nullptr == value) return wrapper::org::ortc::EventQueuePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +::Org::Ortc::EventQueue^ Org::Ortc::EventQueue::GetDefaultForUi() +{ + ::Org::Ortc::EventQueue^ result {}; + result = ::Internal::Helper::ToCx_Org_Ortc_EventQueue(wrapper::org::ortc::EventQueue::getDefaultForUi()); + return result; +} + +//------------------------------------------------------------------------------ +::Org::Ortc::EventQueue^ Org::Ortc::EventQueue::Singleton::get() +{ + return ::Internal::Helper::ToCx_Org_Ortc_EventQueue(wrapper::org::ortc::EventQueue::get_singleton()); +} + +//------------------------------------------------------------------------------ +void Org::Ortc::EventQueue::Singleton::set(::Org::Ortc::EventQueue^ value) +{ + wrapper::org::ortc::EventQueue::set_singleton(::Internal::Helper::FromCx_Org_Ortc_EventQueue(value)); +} + + +#endif //ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUE diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueue.h b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueue.h new file mode 100644 index 00000000..78344b75 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueue.h @@ -0,0 +1,51 @@ + +#pragma once + +#ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#include +#include + +namespace Org { + namespace Ortc { + + + + /// + /// A message queue for receiving delegate events. + /// + public ref class EventQueue sealed + { + internal: + wrapper::org::ortc::EventQueuePtr native_; + + struct WrapperCreate {}; + EventQueue(const WrapperCreate &) {} + + static EventQueue^ ToCx(wrapper::org::ortc::EventQueuePtr value); + static wrapper::org::ortc::EventQueuePtr FromCx(EventQueue^ value); + + + + public: + // ::org::ortc::EventQueue + + /// + /// The default windows message queue for the system GUI thread. + /// + static ::Org::Ortc::EventQueue^ GetDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + static property ::Org::Ortc::EventQueue^ Singleton + { + ::Org::Ortc::EventQueue^ get(); + void set(::Org::Ortc::EventQueue^ value); + } + + }; + + } // namespace Ortc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUE diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueueMaker.cpp b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueueMaker.cpp new file mode 100644 index 00000000..e166d2ca --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueueMaker.cpp @@ -0,0 +1,44 @@ + +#ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#include + +#include "Org_Ortc_EventQueueMaker.h" +#include "Org_Ortc_EventQueue.h" + +#include + +//------------------------------------------------------------------------------ +::Org::Ortc::EventQueueMaker^ Org::Ortc::EventQueueMaker::ToCx(wrapper::org::ortc::EventQueueMakerPtr value) +{ + if (!value) return nullptr; + auto result = ref new EventQueueMaker(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::EventQueueMakerPtr Org::Ortc::EventQueueMaker::FromCx(::Org::Ortc::EventQueueMaker^ value) +{ + if (nullptr == value) return wrapper::org::ortc::EventQueueMakerPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +::Org::Ortc::EventQueue^ Org::Ortc::EventQueueMaker::BindQueue(Windows::UI::Core::CoreDispatcher^ queue) +{ + ::Org::Ortc::EventQueue^ result {}; + result = ::Org::Ortc::EventQueue::ToCx(wrapper::impl::org::ortc::EventQueue::toWrapper(queue)); + return result; +} + +//------------------------------------------------------------------------------ +Windows::UI::Core::CoreDispatcher^ Org::Ortc::EventQueueMaker::ExtractQueue(::Org::Ortc::EventQueue^ queue) +{ + Windows::UI::Core::CoreDispatcher^ result {}; + result = wrapper::impl::org::ortc::EventQueue::toNative_cx(::Org::Ortc::EventQueue::FromCx(queue)); + return result; +} + + +#endif //ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueueMaker.h b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueueMaker.h new file mode 100644 index 00000000..38c8786b --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_EventQueueMaker.h @@ -0,0 +1,37 @@ + + +#ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#pragma once + +#include +#include + +namespace Org { + namespace Ortc { + + + + [Windows::Foundation::Metadata::WebHostHiddenAttribute] + public ref class EventQueueMaker sealed + { + internal: + wrapper::org::ortc::EventQueueMakerPtr native_; + + struct WrapperCreate {}; + EventQueueMaker(const WrapperCreate &) {} + + static EventQueueMaker^ ToCx(wrapper::org::ortc::EventQueueMakerPtr value); + static wrapper::org::ortc::EventQueueMakerPtr FromCx(EventQueueMaker^ value); + + public: + // ::org::ortc::EventQueueMaker + + static ::Org::Ortc::EventQueue^ BindQueue(Windows::UI::Core::CoreDispatcher^ queue); + static Windows::UI::Core::CoreDispatcher^ ExtractQueue(::Org::Ortc::EventQueue^ queue); + + }; + + } // namespace Ortc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_MediaControl.cpp b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaControl.cpp new file mode 100644 index 00000000..c5be62c2 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaControl.cpp @@ -0,0 +1,33 @@ + +#include "Org_Ortc_MediaControl.h" + +#include + +//------------------------------------------------------------------------------ +::Org::Ortc::MediaControl^ Org::Ortc::MediaControl::ToCx(wrapper::org::ortc::MediaControlPtr value) +{ + if (!value) return nullptr; + auto result = ref new MediaControl(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaControlPtr Org::Ortc::MediaControl::FromCx(::Org::Ortc::MediaControl^ value) +{ + if (nullptr == value) return wrapper::org::ortc::MediaControlPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +Windows::Graphics::Display::DisplayOrientations Org::Ortc::MediaControl::DisplayOrientation::get() +{ + //return webrtc::videocapturemodule::AppStateDispatcher::Instance()->GetOrientation(); + return Windows::Graphics::Display::DisplayOrientations::Landscape; +} + +//------------------------------------------------------------------------------ +void Org::Ortc::MediaControl::DisplayOrientation::set(Windows::Graphics::Display::DisplayOrientations value) +{ + //webrtc::videocapturemodule::AppStateDispatcher::Instance()->DisplayOrientationChanged(value); +} diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_MediaControl.h b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaControl.h new file mode 100644 index 00000000..dedb4be7 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaControl.h @@ -0,0 +1,36 @@ + +#pragma once + +#include +#include + +namespace Org { + namespace Ortc { + + /// + /// Interface for controlling the behaviour of media. + /// + public ref class MediaControl sealed + { + internal: + wrapper::org::ortc::MediaControlPtr native_; + + struct WrapperCreate {}; + MediaControl(const WrapperCreate &) {} + + static MediaControl^ ToCx(wrapper::org::ortc::MediaControlPtr value); + static wrapper::org::ortc::MediaControlPtr FromCx(MediaControl^ value); + + public: + /// + /// Notify that media engine the application orientation has changed. + /// + static property Windows::Graphics::Display::DisplayOrientations DisplayOrientation + { + Windows::Graphics::Display::DisplayOrientations get(); + void set(Windows::Graphics::Display::DisplayOrientations value); + } + }; + + } // namespace Ortc +} // namespace Org diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_MediaSource.cpp b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaSource.cpp new file mode 100644 index 00000000..21136f62 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaSource.cpp @@ -0,0 +1,27 @@ + +#include "Org_Ortc_MediaSource.h" +//#include "cx_custom_WebRtcMediaSource.h" + +#include + +//------------------------------------------------------------------------------ +::Org::Ortc::MediaSource^ Org::Ortc::MediaSource::ToCx(wrapper::org::ortc::MediaSourcePtr value) +{ + if (!value) return nullptr; + auto result = ref new MediaSource(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::ortc::MediaSourcePtr Org::Ortc::MediaSource::FromCx(::Org::Ortc::MediaSource^ value) +{ + if (nullptr == value) return wrapper::org::ortc::MediaSourcePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +Windows::Media::Core::IMediaSource^ Org::Ortc::MediaSource::Source::get() +{ + return nullptr; +} diff --git a/ortc/idl/wrapper/override/cx/Org_Ortc_MediaSource.h b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaSource.h new file mode 100644 index 00000000..d8615ec8 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/Org_Ortc_MediaSource.h @@ -0,0 +1,35 @@ + +#pragma once + +#include + +#include + +namespace Org { + namespace Ortc { + + public ref class MediaSource sealed + { + private: + zsLib::Lock lock_; + + struct Data : public zsLib::Any + { + Windows::Media::Core::IMediaSource^ source_; + }; + + internal: + wrapper::org::ortc::MediaSourcePtr native_; + + struct WrapperCreate {}; + MediaSource(const WrapperCreate &) {} + + static MediaSource^ ToCx(wrapper::org::ortc::MediaSourcePtr value); + static wrapper::org::ortc::MediaSourcePtr FromCx(MediaSource^ value); + + public: + property Windows::Media::Core::IMediaSource^ Source { Windows::Media::Core::IMediaSource^ get(); } + }; + + } // namespace Ortc +} // namespace Org diff --git a/ortc/idl/wrapper/override/cx/RTMediaStreamSource.cc b/ortc/idl/wrapper/override/cx/RTMediaStreamSource.cc new file mode 100644 index 00000000..b1220e60 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/RTMediaStreamSource.cc @@ -0,0 +1,59 @@ +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#include "RTMediaStreamSource.h" +#include "Org_Ortc_EventQueue.h" + +namespace Org +{ + namespace Ortc + { + + void FrameCounterHelper::FireEvent( + Platform::String^ id, + Platform::String^ str + ) + { + auto dispatcher = EventQueue::Singleton->Queue; + + if (dispatcher != nullptr) + { + dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler([id, str] { FramesPerSecondChanged(id, str); }) + ); + } + else + { + FramesPerSecondChanged(id, str); + } + } + + void ResolutionHelper::FireEvent( + Platform::String^ id, + unsigned int width, + unsigned int heigth + ) + { + auto dispatcher = EventQueue::Singleton->Queue; + if (dispatcher != nullptr) + { + dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler([id, width, heigth] { ResolutionChanged(id, width, heigth); }) + ); + } + else + { + ResolutionChanged(id, width, heigth); + } + } + + } // namespace ortc +} // namespace org + diff --git a/ortc/idl/wrapper/override/cx/RTMediaStreamSource.h b/ortc/idl/wrapper/override/cx/RTMediaStreamSource.h new file mode 100644 index 00000000..6d2c329d --- /dev/null +++ b/ortc/idl/wrapper/override/cx/RTMediaStreamSource.h @@ -0,0 +1,147 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#pragma once + +namespace Org +{ + namespace Ortc + { + + /// + /// Delegate used to notify an update of the frame per second on a video stream. + /// + public delegate void FramesPerSecondChangedEventHandler(Platform::String^ id, Platform::String^ fps); + + /// + /// Class used to get frame rate events from renderer. + /// + public ref class FrameCounterHelper sealed + { + public: + /// + /// Event fires when the frame rate changes. + /// + static event FramesPerSecondChangedEventHandler^ FramesPerSecondChanged; + + internal: + static void FireEvent(Platform::String^ id, Platform::String^ str); + }; + + /// + /// Delegate used to notify an update of the frame resolutions. + /// + public delegate void ResolutionChangedEventHandler(Platform::String^ id, unsigned int width, unsigned int height); + + /// + /// Class used to get frame size change events from renderer. + /// + public ref class ResolutionHelper sealed + { + public: + /// + /// Event fires when the resolution changes. + /// + static event ResolutionChangedEventHandler^ ResolutionChanged; + + internal: + static void FireEvent( + Platform::String^ id, + unsigned int width, + unsigned int height + ); + }; + + } // namespace ortc +} // namespace org + +#ifdef USE_OLD_RENDERER + +#include "modules/video_render/video_render.h" + +#include + +namespace org +{ + namespace ortc + { + using Windows::Media::Core::MediaStreamSourceSampleRequest; + using Windows::System::Threading::ThreadPoolTimer; + using Windows::Media::Core::MediaStreamSource; + using Platform::WeakReference; + using Platform::String; + + class MediaSourceHelper; + + ref class MediaStreamTrack; + + ref class RTMediaStreamSource sealed { + public: + virtual ~RTMediaStreamSource(); + void Teardown(); + + void OnSampleRequested(Windows::Media::Core::MediaStreamSource ^sender, + Windows::Media::Core::MediaStreamSourceSampleRequestedEventArgs ^args); + + internal: + static MediaStreamSource^ CreateMediaSource( + MediaStreamTrack^ track, uint32 frameRate, Platform::String^ id); + private: + class RTCRenderer : public webrtc::VideoRenderCallback { + public: + explicit RTCRenderer(RTMediaStreamSource^ streamSource); + virtual ~RTCRenderer(); + virtual void SetSize(uint32 width, uint32 height, uint32 reserved); + virtual int32_t RenderFrame(const uint32_t streamId, + const webrtc::VideoFrame& videoFrame); + virtual bool CanApplyRotation() { return true; } + private: + // This object is owned by RTMediaStreamSource + // so _streamSource must be a weak reference + WeakReference _streamSource; + }; + + RTMediaStreamSource(MediaStreamTrack^ videoTrack, bool isH264); + void ProcessReceivedFrame(webrtc::VideoFrame *frame); + bool ConvertFrame(IMFMediaBuffer* mediaBuffer, webrtc::VideoFrame* frame); + void ResizeSource(uint32 width, uint32 height); + + HRESULT MakeSampleCallback(webrtc::VideoFrame* frame, IMFSample** sample); + void FpsCallback(int fps); + + MediaStreamTrack^ _videoTrack; + Platform::String^ _id; // Provided by the calling API. + + // Keep a weak reference here. + // Its _mediaStreamSource that keeps a reference to this object. + WeakReference _mediaStreamSource; + rtc::scoped_ptr _rtcRenderer; + rtc::scoped_ptr _lock; + + rtc::scoped_ptr _helper; + + ThreadPoolTimer^ _progressTimer; + void ProgressTimerElapsedExecute(ThreadPoolTimer^ source); + + ThreadPoolTimer^ _fpsTimer; + void FPSTimerElapsedExecute(ThreadPoolTimer^ source); + bool _frameSentThisTime; + + Windows::Media::Core::VideoStreamDescriptor^ _videoDesc; + + void ReplyToSampleRequest(); + + MediaStreamSourceSampleRequest^ _request; + Windows::Media::Core::MediaStreamSourceSampleRequestDeferral^ _deferral; + Windows::Media::Core::MediaStreamSourceStartingRequestDeferral^ _startingDeferral; + }; + } // namespace ortc +} // namespace org + +#endif //USE_OLD_RENDERER diff --git a/ortc/idl/wrapper/override/cx/WebRtcMediaSource.cc b/ortc/idl/wrapper/override/cx/WebRtcMediaSource.cc new file mode 100644 index 00000000..1472a323 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/WebRtcMediaSource.cc @@ -0,0 +1,314 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#include "WebRtcMediaSource.h" +#include "WebRtcMediaStream.h" + +#include +#include + +using Microsoft::WRL::MakeAndInitialize; + +#define RETURN_ON_FAIL(code) { HRESULT hr = code; if (FAILED(hr)) {OutputDebugString(L"Failed"); return hr;} } + +namespace Org +{ + namespace Ortc + { + + WebRtcMediaSource::WebRtcMediaSource() : + _rateControlThin(FALSE), _rate(1.0f), _started(false), + _lock(webrtc::CriticalSectionWrapper::CreateCriticalSection()) { + } + + WebRtcMediaSource::~WebRtcMediaSource() { + } + + HRESULT WebRtcMediaSource::CreateMediaSource( + IMediaSource** source, + zsLib::AnyPtr track, + Platform::String^ id + ) + { + *source = nullptr; + ComPtr internalRet; + RETURN_ON_FAIL(MakeAndInitialize( + &internalRet, track, id)); + ComPtr ret; + internalRet.As(&ret); + *source = ret.Detach(); + return S_OK; + } + + HRESULT WebRtcMediaSource::RuntimeClassInitialize( + zsLib::AnyPtr track, + Platform::String^ id + ) + { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue != nullptr) + return S_OK; + + RETURN_ON_FAIL(MFCreateEventQueue(&_eventQueue)); + + // For now only allow one stream + RETURN_ON_FAIL(MakeAndInitialize( + &_stream, this, track, id)); + ComPtr streamDescriptor; + RETURN_ON_FAIL(_stream->GetStreamDescriptor(&streamDescriptor)); + RETURN_ON_FAIL(MFCreatePresentationDescriptor( + 1, streamDescriptor.GetAddressOf(), &_presDescriptor)); + RETURN_ON_FAIL(_presDescriptor->SelectStream(0)); + + return S_OK; + } + + // IMFMediaEventGenerator + IFACEMETHODIMP WebRtcMediaSource::GetEvent( + DWORD dwFlags, IMFMediaEvent **ppEvent) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->GetEvent(dwFlags, ppEvent); + } + + IFACEMETHODIMP WebRtcMediaSource::BeginGetEvent( + IMFAsyncCallback *pCallback, IUnknown *punkState) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->BeginGetEvent(pCallback, punkState); + } + + IFACEMETHODIMP WebRtcMediaSource::EndGetEvent( + IMFAsyncResult *pResult, IMFMediaEvent **ppEvent) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->EndGetEvent(pResult, ppEvent); + } + + IFACEMETHODIMP WebRtcMediaSource::QueueEvent( + MediaEventType met, const GUID& guidExtendedType, + HRESULT hrStatus, const PROPVARIANT *pvValue) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->QueueEventParamVar( + met, guidExtendedType, hrStatus, pvValue); + } + + // IMFMediaSource + IFACEMETHODIMP WebRtcMediaSource::GetCharacteristics( + DWORD *pdwCharacteristics) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + *pdwCharacteristics = MFMEDIASOURCE_IS_LIVE; + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::CreatePresentationDescriptor( + IMFPresentationDescriptor **ppPresentationDescriptor) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _presDescriptor->Clone(ppPresentationDescriptor); + } + + IFACEMETHODIMP WebRtcMediaSource::Start( + IMFPresentationDescriptor *pPresentationDescriptor, + const GUID *pguidTimeFormat, const PROPVARIANT *pvarStartPosition) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + OutputDebugString(L"WebRtcMediaSource::Start\r\n"); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + if (!_started) { + ComPtr unk; + _stream.As(&unk); + RETURN_ON_FAIL(_eventQueue->QueueEventParamUnk( + MENewStream, GUID_NULL, S_OK, unk.Get())); + } + // Start stream + RETURN_ON_FAIL(_stream->Start(pPresentationDescriptor, + pguidTimeFormat, pvarStartPosition)); + RETURN_ON_FAIL(QueueEvent(MESourceStarted, + GUID_NULL, S_OK, pvarStartPosition)); + _started = true; + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::Stop() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + OutputDebugString(L"WebRtcMediaSource::Stop\r\n"); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + RETURN_ON_FAIL(_stream->Stop()); + RETURN_ON_FAIL(QueueEvent(MESourceStopped, GUID_NULL, S_OK, nullptr)); + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::Pause() { + return MF_E_INVALID_STATE_TRANSITION; + } + + IFACEMETHODIMP WebRtcMediaSource::Shutdown() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + OutputDebugString(L"WebRtcMediaSource::Shutdown\r\n"); + if (_eventQueue != nullptr) { + _eventQueue->Shutdown(); + } + + RETURN_ON_FAIL(_stream->Shutdown()); + + _presDescriptor = nullptr; + _deviceManager = nullptr; + _eventQueue = nullptr; + _stream.Reset(); + return S_OK; + } + + // IMFMediaSourceEx + IFACEMETHODIMP WebRtcMediaSource::GetSourceAttributes( + IMFAttributes **ppAttributes) { + return E_NOTIMPL; + } + + IFACEMETHODIMP WebRtcMediaSource::GetStreamAttributes( + DWORD dwStreamIdentifier, IMFAttributes **ppAttributes) { + return E_NOTIMPL; + } + + IFACEMETHODIMP WebRtcMediaSource::SetD3DManager(IUnknown *pManager) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + RETURN_ON_FAIL(pManager->QueryInterface( + IID_IMFDXGIDeviceManager, + reinterpret_cast(_deviceManager.ReleaseAndGetAddressOf()))); + + RETURN_ON_FAIL(_stream->SetD3DManager(_deviceManager)); + + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::GetService( + REFGUID guidService, REFIID riid, LPVOID *ppvObject) { + if (guidService == MF_RATE_CONTROL_SERVICE || guidService == MF_MEDIASOURCE_SERVICE) { + HRESULT hr = QueryInterface(riid, ppvObject); + return hr; + } + return MF_E_UNSUPPORTED_SERVICE; + } + + IFACEMETHODIMP WebRtcMediaSource::SetRate(BOOL fThin, float flRate) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + if (fThin) { + return MF_E_THINNING_UNSUPPORTED; + } + + PROPVARIANT pv; + PropVariantInit(&pv); + pv.vt = VT_R4; + pv.fltVal = 1.0f; + RETURN_ON_FAIL(QueueEvent(MESourceRateChanged, GUID_NULL, S_OK, &pv)); + + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::GetRate(BOOL *pfThin, float *pflRate) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + *pfThin = FALSE; + *pflRate = 1.0f; + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::GetSlowestRate( + MFRATE_DIRECTION eDirection, BOOL fThin, float *pflRate) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + if (eDirection == MFRATE_REVERSE) { + return MF_E_REVERSE_UNSUPPORTED; + } + + if (fThin) { + return MF_E_THINNING_UNSUPPORTED; + } + + if (!pflRate) { + return E_POINTER; + } + + *pflRate = 1.0f; + + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::GetFastestRate( + MFRATE_DIRECTION eDirection, BOOL fThin, float *pflRate) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + if (eDirection == MFRATE_REVERSE) { + return MF_E_REVERSE_UNSUPPORTED; + } + + if (fThin) { + return MF_E_THINNING_UNSUPPORTED; + } + + if (!pflRate) { + return E_POINTER; + } + + *pflRate = 1.0f; + + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaSource::IsRateSupported( + BOOL fThin, float flRate, float *pflNearestSupportedRate) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + if (fThin) { + return MF_E_THINNING_UNSUPPORTED; + } + + if (pflNearestSupportedRate) { + *pflNearestSupportedRate = 1.0f; + } + + if (flRate != 1.0f) { + return MF_E_UNSUPPORTED_RATE; + } + + return S_OK; + } + } // namespace ortc +} // namespace org diff --git a/ortc/idl/wrapper/override/cx/WebRtcMediaSource.h b/ortc/idl/wrapper/override/cx/WebRtcMediaSource.h new file mode 100644 index 00000000..2c0569c0 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/WebRtcMediaSource.h @@ -0,0 +1,96 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#pragma once + +#include + +#include +#include + +//#include "webrtc/system_wrappers/include/critical_section_wrapper.h" +//#include "webrtc/rtc_base/scoped_ptr.h" + +#include + +namespace Org +{ + namespace Ortc + { + using Microsoft::WRL::ComPtr; + + using Microsoft::WRL::RuntimeClass; + using Microsoft::WRL::RuntimeClassFlags; + using Microsoft::WRL::RuntimeClassType; + + ref class MediaStreamTrack; + class WebRtcMediaStream; + + class WebRtcMediaSource : + public RuntimeClass, + IMFMediaSourceEx, IMFMediaSource, IMFMediaEventGenerator, + IMFGetService, + IMFRateControl, + IMFRateSupport, + ABI::Windows::Media::Core::IMediaSource, IInspectable> { + InspectableClass(L"WebRtcMediaSource", BaseTrust) + public: + static HRESULT CreateMediaSource( + ABI::Windows::Media::Core::IMediaSource** source, + zsLib::AnyPtr track, + Platform::String^ id + ); + + WebRtcMediaSource(); + virtual ~WebRtcMediaSource(); + HRESULT RuntimeClassInitialize(zsLib::AnyPtr track, Platform::String^ id); + + // IMFMediaEventGenerator + IFACEMETHOD(GetEvent)(DWORD dwFlags, IMFMediaEvent **ppEvent); + IFACEMETHOD(BeginGetEvent)(IMFAsyncCallback *pCallback, IUnknown *punkState); + IFACEMETHOD(EndGetEvent)(IMFAsyncResult *pResult, IMFMediaEvent **ppEvent); + IFACEMETHOD(QueueEvent)(MediaEventType met, const GUID& guidExtendedType, + HRESULT hrStatus, const PROPVARIANT *pvValue); + // IMFMediaSource + IFACEMETHOD(GetCharacteristics)(DWORD *pdwCharacteristics); + IFACEMETHOD(CreatePresentationDescriptor)( + IMFPresentationDescriptor **ppPresentationDescriptor); + IFACEMETHOD(Start)(IMFPresentationDescriptor *pPresentationDescriptor, + const GUID *pguidTimeFormat, const PROPVARIANT *pvarStartPosition); + IFACEMETHOD(Stop)(); + IFACEMETHOD(Pause)(); + IFACEMETHOD(Shutdown)(); + // IMFMediaSourceEx + IFACEMETHOD(GetSourceAttributes)(IMFAttributes **ppAttributes); + IFACEMETHOD(GetStreamAttributes)(DWORD dwStreamIdentifier, + IMFAttributes **ppAttributes); + IFACEMETHOD(SetD3DManager)(IUnknown *pManager); + // IMFGetService + IFACEMETHOD(GetService)(REFGUID guidService, REFIID riid, LPVOID *ppvObject); + // IMFRateControl + IFACEMETHOD(SetRate)(BOOL fThin, float flRate); + IFACEMETHOD(GetRate)(BOOL *pfThin, float *pflRate); + // IMFRateSupport + IFACEMETHOD(GetSlowestRate)(MFRATE_DIRECTION eDirection, BOOL fThin, float *pflRate); + IFACEMETHOD(GetFastestRate)(MFRATE_DIRECTION eDirection, BOOL fThin, float *pflRate); + IFACEMETHOD(IsRateSupported)(BOOL fThin, float flRate, float *pflNearestSupportedRate); + + private: + rtc::scoped_ptr _lock; + ComPtr _eventQueue; + ComPtr _stream; + ComPtr _presDescriptor; + ComPtr _deviceManager; + BOOL _rateControlThin; + float _rate; + bool _started; + }; + + } // namespace ortc +} // namespace org diff --git a/ortc/idl/wrapper/override/cx/WebRtcMediaStream.cc b/ortc/idl/wrapper/override/cx/WebRtcMediaStream.cc new file mode 100644 index 00000000..2b8c27c5 --- /dev/null +++ b/ortc/idl/wrapper/override/cx/WebRtcMediaStream.cc @@ -0,0 +1,547 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#include "WebRtcMediaStream.h" +#include "WebRtcMediaSource.h" +#include "RTMediaStreamSource.h" +#include "MediaSourceHelper.h" + +//#include +#include + +#include + +#include +#include +#include + +#include +#include + +using Windows::System::Threading::TimerElapsedHandler; + +namespace webrtc +{ + namespace vcm + { + // How we trigger a key frame request when + // registering an H264 renderer. We render + // encoded samples so we have to request a + // key frame as fast as possible otherwise + // we don't render anything until the next + // key frame. + extern bool globalRequestKeyFrame; + } +} + +typedef zsLib::AnyHolder< ::ortc::IMediaStreamTrackPtr > AnyTrackHolder; + +static ortc::IMediaStreamTrackPtr getTrack(zsLib::AnyPtr holder) +{ + ortc::IMediaStreamTrackPtr result; + if (!holder) return result; + auto trackHolder = std::dynamic_pointer_cast(holder); + if (!trackHolder) return result; + result = trackHolder->value_; + return result; +} + + +namespace Org +{ + namespace Ortc + { +#define MAX_FRAME_DELAY_MS 30 +#define RETURN_ON_FAIL(code) { HRESULT hr = code; if (FAILED(hr)) {OutputDebugString(L"[Failed]"); return hr;} } + + // #define USE_MEMORY_BUFFERS + + class AutoFunction { + public: + explicit AutoFunction(std::function fn) : _fn(fn) {} + ~AutoFunction() { _fn(); } + private: + std::function _fn; + }; + + WebRtcMediaStream::WebRtcMediaStream() : + _lock(webrtc::CriticalSectionWrapper::CreateCriticalSection()), + _selfReferenceHolder(std::make_shared(this)) + { + _mediaBuffers.resize(BufferCount); + } + + WebRtcMediaStream::~WebRtcMediaStream() { + // To be safe. Sometimes we get destroyed + // without having been shutdown. + Shutdown(); + + _selfReferenceHolder->_shuttingDown = true; + + // Wait until no frames are being queued + // from the webrtc callback. + while (_selfReferenceHolder->_framesBeingQueued > 0) { + Sleep(1); + } + } + + HRESULT WebRtcMediaStream::RuntimeClassInitialize( + WebRtcMediaSource* source, + zsLib::AnyPtr track, + Platform::String^ id + ) + { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue != nullptr) + return S_OK; + + _source = source; + _track = track; + _id = id; + _rtcRenderer = std::make_shared(_selfReferenceHolder); + + auto nativeTrack = getTrack(track); + + _isH264 = nativeTrack->isH264Rendering(); + + // Create the helper with the callback functions. + _helper.reset(new MediaSourceHelper(_isH264, + [this](webrtc::VideoFrame* frame, IMFSample** sample) -> HRESULT { + return MakeSampleCallback(frame, sample); + }, + [this](int fps) { + return FpsCallback(fps); + })); + + RETURN_ON_FAIL(CreateMediaType(64, 64, 0, &_mediaType, _isH264)); + RETURN_ON_FAIL(MFCreateEventQueue(&_eventQueue)); + RETURN_ON_FAIL(MFCreateStreamDescriptor(1, 1, _mediaType.GetAddressOf(), &_streamDescriptor)); + ComPtr mediaTypeHandler; + RETURN_ON_FAIL(_streamDescriptor->GetMediaTypeHandler(&mediaTypeHandler)); + RETURN_ON_FAIL(mediaTypeHandler->SetCurrentMediaType(_mediaType.Get())); + + nativeTrack->setVideoRenderCallback(_rtcRenderer); + if (_isH264) { + webrtc::vcm::globalRequestKeyFrame = true; + } + return S_OK; + } + + // IMFMediaEventGenerator + IFACEMETHODIMP WebRtcMediaStream::GetEvent( + DWORD dwFlags, IMFMediaEvent **ppEvent) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->GetEvent(dwFlags, ppEvent); + } + + IFACEMETHODIMP WebRtcMediaStream::BeginGetEvent( + IMFAsyncCallback *pCallback, IUnknown *punkState) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->BeginGetEvent(pCallback, punkState); + } + + IFACEMETHODIMP WebRtcMediaStream::EndGetEvent( + IMFAsyncResult *pResult, IMFMediaEvent **ppEvent) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->EndGetEvent(pResult, ppEvent); + } + + IFACEMETHODIMP WebRtcMediaStream::QueueEvent( + MediaEventType met, const GUID& guidExtendedType, + HRESULT hrStatus, const PROPVARIANT *pvValue) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + return _eventQueue->QueueEventParamVar( + met, guidExtendedType, hrStatus, pvValue); + } + + // IMFMediaStream + IFACEMETHODIMP WebRtcMediaStream::GetMediaSource( + IMFMediaSource **ppMediaSource) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + return _source->QueryInterface(IID_IMFMediaSource, + reinterpret_cast(ppMediaSource)); + } + + IFACEMETHODIMP WebRtcMediaStream::GetStreamDescriptor( + IMFStreamDescriptor **ppStreamDescriptor) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + *ppStreamDescriptor = _streamDescriptor.Get(); + (*ppStreamDescriptor)->AddRef(); + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaStream::RequestSample(IUnknown *pToken) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return E_POINTER; + } + InterlockedIncrement(&_frameReady); + ReplyToSampleRequest(); + + return S_OK; + } + + IFACEMETHODIMP WebRtcMediaStream::GetService( + REFGUID guidService, REFIID riid, LPVOID *ppvObject) { + return MF_E_UNSUPPORTED_SERVICE; + } + + HRESULT WebRtcMediaStream::CreateMediaType( + unsigned int width, unsigned int height, + unsigned int rotation, IMFMediaType** ppType, bool isH264) { + // Create media type + // Make sure the dimensions are even + width &= ~((unsigned int)1); + height &= ~((unsigned int)1); + ComPtr mediaType; + RETURN_ON_FAIL(MFCreateMediaType(&mediaType)); + RETURN_ON_FAIL(mediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video)); + + if (isH264) { + RETURN_ON_FAIL(mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264)); + } + else { + RETURN_ON_FAIL(mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_NV12)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, TRUE)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_MT_SAMPLE_SIZE, width * height * 3 / 2)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_MT_DEFAULT_STRIDE, width)); + } + + RETURN_ON_FAIL(MFSetAttributeSize(mediaType.Get(), MF_MT_FRAME_SIZE, width, height)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_LOW_LATENCY, TRUE)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_MT_VIDEO_ROTATION, rotation)); + RETURN_ON_FAIL(mediaType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive)); + *ppType = mediaType.Detach(); + return S_OK; + } + + HRESULT WebRtcMediaStream::MakeSampleCallback( + webrtc::VideoFrame* frame, IMFSample** sample) { + ComPtr spSample; + RETURN_ON_FAIL(MFCreateSample(&spSample)); + + // Make sure the destination buffer in even. Crop one pixel if odd. + unsigned int destWidth = (unsigned int)(frame->width() & (~((size_t)1))); + unsigned int destHeight = (unsigned int)(frame->height() & (~((size_t)1))); + // Make sure the buffers are the right size + { + unsigned int width, height; + RETURN_ON_FAIL(MFGetAttributeSize( + _mediaType.Get(), MF_MT_FRAME_SIZE, &width, &height)); + if (destWidth != width || destHeight != height) { + RETURN_ON_FAIL(CreateMediaType(destWidth, destHeight, + frame->rotation(), &_mediaType, _isH264)); + ResetMediaBuffers(); + } + } + + // Pick the next buffer. + ComPtr buffer; + buffer = _mediaBuffers[_frameBufferIndex]; + if (buffer == nullptr) + return E_FAIL; + _frameBufferIndex++; + _frameBufferIndex %= BufferCount; + + RETURN_ON_FAIL(spSample->AddBuffer(buffer.Get())); + + ComPtr buffer2d; + RETURN_ON_FAIL(buffer.As(&buffer2d)); + + BYTE* destRawData; + BYTE* bufferStart; + LONG pitch; + DWORD destMediaBufferSize; + + RETURN_ON_FAIL(buffer2d->Lock2DSize(MF2DBuffer_LockFlags_Write, + &destRawData, &pitch, &bufferStart, &destMediaBufferSize)); + AutoFunction autoUnlockBuffer([buffer2d]() {buffer2d->Unlock2D(); }); + + //frame->MakeExclusive(); + if (!frame->video_frame_buffer()->HasOneRef()) + { + // Not exclusive already, need to copy buffer. + rtc::scoped_refptr new_buffer = + new rtc::RefCountedObject( + frame->video_frame_buffer()->width(), frame->video_frame_buffer()->height(), + frame->video_frame_buffer()->stride(webrtc::PlaneType::kYPlane), + frame->video_frame_buffer()->stride(webrtc::PlaneType::kUPlane), + frame->video_frame_buffer()->stride(webrtc::PlaneType::kVPlane)); + + int32_t src_width = static_cast(frame->video_frame_buffer()->width()); + int32_t src_height = static_cast(frame->video_frame_buffer()->height()); + libyuv::I420Copy( + frame->video_frame_buffer()->data(webrtc::PlaneType::kYPlane), frame->video_frame_buffer()->stride(webrtc::PlaneType::kYPlane), + frame->video_frame_buffer()->data(webrtc::PlaneType::kUPlane), frame->video_frame_buffer()->stride(webrtc::PlaneType::kUPlane), + frame->video_frame_buffer()->data(webrtc::PlaneType::kVPlane), frame->video_frame_buffer()->stride(webrtc::PlaneType::kVPlane), + new_buffer->MutableData(webrtc::PlaneType::kYPlane), new_buffer->stride(webrtc::PlaneType::kYPlane), + new_buffer->MutableData(webrtc::PlaneType::kUPlane), new_buffer->stride(webrtc::PlaneType::kUPlane), + new_buffer->MutableData(webrtc::PlaneType::kVPlane), new_buffer->stride(webrtc::PlaneType::kVPlane), + src_width, src_height); + + frame->video_frame_buffer() = new_buffer; + } + + + // Convert to NV12 + uint8* uvDest = destRawData + (pitch * destHeight); + libyuv::I420ToNV12(frame->video_frame_buffer()->data(webrtc::PlaneType::kYPlane), frame->video_frame_buffer()->stride(webrtc::PlaneType::kYPlane), + frame->video_frame_buffer()->data(webrtc::PlaneType::kUPlane), frame->video_frame_buffer()->stride(webrtc::PlaneType::kUPlane), + frame->video_frame_buffer()->data(webrtc::PlaneType::kVPlane), frame->video_frame_buffer()->stride(webrtc::PlaneType::kVPlane), + reinterpret_cast(destRawData), pitch, + uvDest, pitch, + static_cast(destWidth), + static_cast(destHeight)); + + *sample = spSample.Detach(); + return S_OK; + } + + void WebRtcMediaStream::FpsCallback(int fps) { + Concurrency::create_async([this, fps] { + FrameCounterHelper::FireEvent( + _id, fps.ToString()); + }); + } + + HRESULT WebRtcMediaStream::ReplyToSampleRequest() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_frameReady == 0 || !_helper->HasFrames()) { + return S_OK; + } + + _frameCount++; + + auto sampleData = _helper->DequeueFrame(); + + if (sampleData == nullptr) { + return S_OK; + } + + // Update rotation property + if (sampleData->rotationHasChanged || sampleData->sizeHasChanged) { + unsigned int width, height; + if (sampleData->sizeHasChanged) { + width = sampleData->size.cx; + height = sampleData->size.cy; + } + else { + RETURN_ON_FAIL(MFGetAttributeSize( + _mediaType.Get(), MF_MT_FRAME_SIZE, &width, &height)); + } + + unsigned int rotation; + if (sampleData->rotationHasChanged) { + rotation = sampleData->rotation; + } + else { + RETURN_ON_FAIL(_mediaType->GetUINT32(MF_MT_VIDEO_ROTATION, &rotation)); + } + + if (_isH264) + OutputDebugString((L"Frame format changed: " + + width.ToString() + L"x" + height.ToString() + + " rotation:" + rotation.ToString() + L"\r\n")->Data()); + + CreateMediaType(width, height, rotation, &_mediaType, _isH264); + _eventQueue->QueueEventParamUnk(MEStreamFormatChanged, + GUID_NULL, S_OK, _mediaType.Get()); + ResetMediaBuffers(); + + ResolutionHelper::FireEvent( + _id, width, height); + } + + _eventQueue->QueueEventParamUnk(MEMediaSample, + GUID_NULL, S_OK, sampleData->sample.Get()); + + InterlockedDecrement(&_frameReady); + return S_OK; + } + + STDMETHODIMP WebRtcMediaStream::Start( + IMFPresentationDescriptor *pPresentationDescriptor, + const GUID *pguidTimeFormat, const PROPVARIANT *pvarStartPosition) { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + // Start stream + RETURN_ON_FAIL(QueueEvent(MEStreamStarted, GUID_NULL, S_OK, pvarStartPosition)); + + if (!_started) { + _helper->SetStartTimeNow(); + _started = true; + } + return S_OK; + } + + STDMETHODIMP WebRtcMediaStream::Stop() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + if (_eventQueue == nullptr) { + return MF_E_SHUTDOWN; + } + RETURN_ON_FAIL(QueueEvent(MEStreamStopped, GUID_NULL, S_OK, nullptr)); + return S_OK; + } + + STDMETHODIMP WebRtcMediaStream::Shutdown() { + webrtc::CriticalSectionScoped csLock(_lock.get()); + + //_track->UnsetRenderer(this); + if (_eventQueue != nullptr) { + _eventQueue->Shutdown(); + } + + _deviceManager = nullptr; + _eventQueue = nullptr; + + _helper.reset(); + return S_OK; + } + + STDMETHODIMP WebRtcMediaStream::SetD3DManager( + ComPtr manager) { + + webrtc::CriticalSectionScoped csLock(_lock.get()); + _deviceManager = manager; + HANDLE deviceHandle; + _deviceManager->OpenDeviceHandle(&deviceHandle); + AutoFunction autoCloseHandle([this, deviceHandle]() { + _deviceManager->CloseDeviceHandle(deviceHandle); }); + ComPtr device; + _deviceManager->LockDevice(deviceHandle, IID_ID3D11Device, &device, TRUE); + AutoFunction autoUnlockDevice([this, deviceHandle]() { + _deviceManager->UnlockDevice(deviceHandle, TRUE); }); + if ((unsigned int)device->GetFeatureLevel() >= + (unsigned int)D3D_FEATURE_LEVEL_11_1) { + _gpuVideoBuffer = true; + OutputDebugString(L"DirectX 11.1 or greater detected, using GPU video render buffers\r\n"); + } + else { + _gpuVideoBuffer = false; + OutputDebugString(L"GPU video render buffers are NOT supported\r\n"); + } + _deviceManager->UnlockDevice(deviceHandle, FALSE); + ResetMediaBuffers(); + return S_OK; + } + + HRESULT WebRtcMediaStream::ResetMediaBuffers() { + for (auto&& buffer : _mediaBuffers) { + buffer.Reset(); + } + + unsigned int width, height; + RETURN_ON_FAIL(MFGetAttributeSize(_mediaType.Get(), + MF_MT_FRAME_SIZE, &width, &height)); + + if (_deviceManager == nullptr) { + return S_OK; + } + if (_gpuVideoBuffer) { + HANDLE hDevice = NULL; + ComPtr device; + RETURN_ON_FAIL(_deviceManager->OpenDeviceHandle(&hDevice)); + AutoFunction autoCloseHandle([this, hDevice]() { + _deviceManager->CloseDeviceHandle(hDevice); }); + + RETURN_ON_FAIL(_deviceManager->LockDevice(hDevice, IID_ID3D11Device, &device, TRUE)); + AutoFunction autoUnlockDevice([this, hDevice]() { + _deviceManager->UnlockDevice(hDevice, TRUE); }); + + for (auto&& buffer : _mediaBuffers) { + D3D11_TEXTURE2D_DESC texDesc; + ComPtr frameTexture; + ZeroMemory(&texDesc, sizeof(texDesc)); + texDesc.Width = width; + texDesc.Height = height; + texDesc.MipLevels = 1; + texDesc.ArraySize = 1; + texDesc.Format = DXGI_FORMAT_NV12; + texDesc.SampleDesc.Count = 1; + texDesc.Usage = D3D11_USAGE_DEFAULT; + if (FAILED(device->CreateTexture2D(&texDesc, nullptr, + frameTexture.ReleaseAndGetAddressOf()))) { + _gpuVideoBuffer = false; + OutputDebugString( + L"Failed to create DirectX 2D texture for video buffers, falling back to main memory buffers\r\n"); + return ResetMediaBuffers(); + } + RETURN_ON_FAIL(MFCreateDXGISurfaceBuffer(__uuidof(ID3D11Texture2D), + frameTexture.Get(), 0, FALSE, &buffer)); + } + } + else { + for (auto&& buffer : _mediaBuffers) { + MFCreate2DMediaBuffer( + width, height, + MFVideoFormat_NV12.Data1, FALSE, + &buffer); + } + } + return S_OK; + } + + WebRtcMediaStream::RTCRenderer::RTCRenderer( + OuterReferenceHolderPtr outer) + { + _outer = outer; + } + + WebRtcMediaStream::RTCRenderer::~RTCRenderer() { + //LOG(LS_INFO) << "RTMediaStreamSource::RTCRenderer::~RTCRenderer"; + } + + int32_t WebRtcMediaStream::RTCRenderer::RenderFrame( + const uint32_t streamId, + const webrtc::VideoFrame& frame + ) { + webrtc::VideoFrame* frameCopy = new webrtc::VideoFrame(); + frameCopy->CopyFrame(frame); + auto outer = _outer.lock(); + if (!outer) return 0; + + ++(outer->_framesBeingQueued); + if (outer->_shuttingDown) { + --(outer->_framesBeingQueued); + return 0; + } + + auto stream = outer->_streamSource; + + // Do the processing async because there's a risk of a deadlock otherwise. + Concurrency::create_async([outer, stream, frameCopy] { + { + webrtc::CriticalSectionScoped csLock(stream->_lock.get()); + if (stream->_helper != nullptr) { + stream->_helper->QueueFrame(frameCopy); + stream->ReplyToSampleRequest(); + } + } + --(outer->_framesBeingQueued); + }); + + return 0; + } + } // namespace ortc +} // namespace org diff --git a/ortc/idl/wrapper/override/cx/WebRtcMediaStream.h b/ortc/idl/wrapper/override/cx/WebRtcMediaStream.h new file mode 100644 index 00000000..67eafb9f --- /dev/null +++ b/ortc/idl/wrapper/override/cx/WebRtcMediaStream.h @@ -0,0 +1,139 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#pragma once + +//#include "webrtc/modules/video_render/video_render.h" +//#include "webrtc/system_wrappers/include/critical_section_wrapper.h" + +#include +#include + +#include + +namespace Org +{ + namespace Ortc + { + using Microsoft::WRL::ComPtr; + + using Microsoft::WRL::RuntimeClass; + using Microsoft::WRL::RuntimeClassFlags; + using Microsoft::WRL::RuntimeClassType; + + using Windows::System::Threading::ThreadPoolTimer; + + class MediaSourceHelper; + + class WebRtcMediaSource; + + class WebRtcMediaStream : + public RuntimeClass, + IMFMediaStream, IMFMediaEventGenerator, + IMFGetService> + { + InspectableClass(L"WebRtcMediaStream", BaseTrust); + + ZS_DECLARE_CLASS_PTR(RTCRenderer); + ZS_DECLARE_STRUCT_PTR(OuterReferenceHolder); + + public: + WebRtcMediaStream(); + virtual ~WebRtcMediaStream(); + HRESULT RuntimeClassInitialize( + WebRtcMediaSource* source, + zsLib::AnyPtr track, + Platform::String^ id + ); + + // IMFMediaEventGenerator + IFACEMETHOD(GetEvent)(DWORD dwFlags, IMFMediaEvent **ppEvent); + IFACEMETHOD(BeginGetEvent)(IMFAsyncCallback *pCallback, IUnknown *punkState); + IFACEMETHOD(EndGetEvent)(IMFAsyncResult *pResult, IMFMediaEvent **ppEvent); + IFACEMETHOD(QueueEvent)(MediaEventType met, const GUID& guidExtendedType, + HRESULT hrStatus, const PROPVARIANT *pvValue); + // IMFMediaStream + IFACEMETHOD(GetMediaSource)(IMFMediaSource **ppMediaSource); + IFACEMETHOD(GetStreamDescriptor)(IMFStreamDescriptor **ppStreamDescriptor); + IFACEMETHOD(RequestSample)(IUnknown *pToken); + // IMFGetService + IFACEMETHOD(GetService)(REFGUID guidService, REFIID riid, LPVOID *ppvObject); + + STDMETHOD(Start)(IMFPresentationDescriptor *pPresentationDescriptor, + const GUID *pguidTimeFormat, const PROPVARIANT *pvarStartPosition); + STDMETHOD(Stop)(); + STDMETHOD(Shutdown)(); + STDMETHOD(SetD3DManager)(ComPtr manager); + + rtc::scoped_ptr _lock; + + private: + struct OuterReferenceHolder + { + OuterReferenceHolder(WebRtcMediaStream* streamSource) : _streamSource(streamSource) {} + + WebRtcMediaStream* _streamSource; + + std::atomic _shuttingDown{}; + std::atomic _framesBeingQueued{}; + }; + + class RTCRenderer : public ::ortc::IMediaStreamTrackRenderCallback, + public webrtc::VideoRenderCallback + { + public: + explicit RTCRenderer(OuterReferenceHolderPtr outer); + virtual ~RTCRenderer(); + virtual int32_t RenderFrame(const uint32_t streamId, + const webrtc::VideoFrame& videoFrame) override; + virtual bool CanApplyRotation() { return true; } + private: + // This object is owned by RTMediaStreamSource + // so _streamSource must be a weak reference + OuterReferenceHolderWeakPtr _outer; + }; + + private: + ComPtr _eventQueue; + + WebRtcMediaSource* _source; + zsLib::AnyPtr _track; + Platform::String^ _id; + + static HRESULT CreateMediaType(unsigned int width, unsigned int height, + unsigned int rotation, IMFMediaType** ppType, bool isH264); + HRESULT MakeSampleCallback(webrtc::VideoFrame* frame, IMFSample** sample); + void FpsCallback(int fps); + + HRESULT ReplyToSampleRequest(); + + rtc::scoped_ptr _helper; + RTCRendererPtr _rtcRenderer; + OuterReferenceHolderPtr _selfReferenceHolder; + + ComPtr _mediaType; + ComPtr _deviceManager; + ComPtr _streamDescriptor; + ULONGLONG _startTickCount{}; + ULONGLONG _frameCount{}; + int _index{}; + ULONG _frameReady{}; + + // From the sample manager. + HRESULT ResetMediaBuffers(); + static const int BufferCount = 3; + std::vector> _mediaBuffers; + int _frameBufferIndex{}; + + bool _gpuVideoBuffer{}; + bool _isH264{}; + bool _started{}; + }; + } // namespace ortc +} // namespace org diff --git a/ortc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp b/ortc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp new file mode 100644 index 00000000..cd41e2ef --- /dev/null +++ b/ortc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp @@ -0,0 +1,84 @@ + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#define CUSTOM_MAKE_HRESULT(xCustomerBit, xFacility, xErrorCode) ((HRESULT)(xErrorCode) <= 0 ? ((HRESULT)(xErrorCode)) : ((HRESULT) (((xErrorCode) & 0x0000FFFF) | ((xFacility) << 16) | ((xCustomerBit) << 29) | 0x80000000))) + +typedef Internal::Helper::Throwers ThrowersType; + +ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + +//----------------------------------------------------------------------------- +ThrowersType &ThrowersType::singleton() noexcept +{ + static ThrowersType result{}; + return result; +} + +//----------------------------------------------------------------------------- +void ThrowersType::customThrow(wrapper::org::ortc::OverconstrainedErrorPtr error) noexcept(false) +{ + if (!error) throw ref new Platform::FailureException(L"No error object provided."); + + std::stringstream ss; + ss << error->name; + if (error->name.hasData()) ss << ": "; + ss << error->constraint; + if (error->message.hasData()) ss << " \""; + ss << error->message; + if (error->message.hasData()) ss << "\""; + + auto message = Internal::Helper::ToCx_String(String(ss.str())); + + throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_DS_CONSTRAINT_VIOLATION), message); +} + +//----------------------------------------------------------------------------- +void ThrowersType::customThrow(wrapper::org::ortc::RTCIdentityErrorPtr error) noexcept(false) +{ + if (!error) throw ref new Platform::FailureException(L"No error object provided."); + + std::stringstream ss; + if (error->protocol.hasData()) ss << "\""; + ss << error->protocol; + if (error->protocol.hasData()) ss << "\";"; + + if (error->loginUrl.hasData()) ss << "\""; + ss << error->loginUrl; + if (error->loginUrl.hasData()) ss << "\";"; + + if (error->idp.hasData()) ss << "\""; + ss << error->idp; + if (error->idp.hasData()) ss << "\";"; + + auto message = Internal::Helper::ToCx_String(String(ss.str())); + + throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, RPC_S_INVALID_AUTH_IDENTITY)); +} + +//----------------------------------------------------------------------------- +void ThrowersType::customThrow(wrapper::org::ortc::ErrorPtr error) noexcept(false) +{ + if (!error) throw ref new Platform::FailureException(L"No error object provided."); + + auto message = Internal::Helper::ToCx_String(String(error->name + (error->name.hasData() && error->reason.hasData() ? ": " : "") + error->reason)); + + HRESULT extractedCode = (HTTP_E_STATUS_BAD_REQUEST & 0x0000FFFF); + HRESULT otherParts = (HTTP_E_STATUS_BAD_REQUEST & 0xFFFF0000); + + extractedCode -= 400; + extractedCode += static_cast(error->errorCode); + + HRESULT mergedCode = extractedCode | otherParts; + + throw ref new Platform::Exception(mergedCode, message); +} diff --git a/ortc/idl/wrapper/override/msidl/Org.Ortc.EventQueue.idl b/ortc/idl/wrapper/override/msidl/Org.Ortc.EventQueue.idl new file mode 100644 index 00000000..a2eaf615 --- /dev/null +++ b/ortc/idl/wrapper/override/msidl/Org.Ortc.EventQueue.idl @@ -0,0 +1,45 @@ +//import "windows.foundation.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace Ortc + { + + + /// + /// A message queue for receiving delegate events. + /// + [version(1.0)] + [uuid(8494c796-81c9-dc99-e460-2de261b993ea)] + interface IEventQueue : IInspectable + { + }; + + /// + /// A message queue for receiving delegate events. + /// + runtimeclass EventQueue : [default] IEventQueue + { + /// + /// Cast from Org.Ortc.IEventQueue to Org.Ortc.EventQueue + /// + [default_overload] + [method_name("CastFromIEventQueue")] + static Org.Ortc.EventQueue Cast(Org.Ortc.IEventQueue source); + + /// + /// The default windows message queue for the system GUI thread. + /// + static Org.Ortc.IEventQueue GetDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + static Org.Ortc.IEventQueue Singleton { get; set; }; + }; + + } // namespace Ortc +} // namespace Org + diff --git a/ortc/idl/wrapper/override/msidl/Org.Ortc.EventQueueMaker.idl b/ortc/idl/wrapper/override/msidl/Org.Ortc.EventQueueMaker.idl new file mode 100644 index 00000000..86ce709c --- /dev/null +++ b/ortc/idl/wrapper/override/msidl/Org.Ortc.EventQueueMaker.idl @@ -0,0 +1,41 @@ +//import "windows.foundation.customattributes.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace Ortc + { + + + [version(1.0)] + [uuid(816737fb-1b37-067b-949a-438355312aa2)] + [webhosthidden] + interface IEventQueueMaker : IInspectable + { + }; + + [webhosthidden] + runtimeclass EventQueueMaker : [default] IEventQueueMaker + { + /// + /// Cast from Org.Ortc.IEventQueueMaker to Org.Ortc.EventQueueMaker + /// + [default_overload] + [method_name("CastFromIEventQueueMaker")] + static Org.Ortc.EventQueueMaker Cast(Org.Ortc.IEventQueueMaker source); + + /// + /// Creates an event queue object from a native queue type. + /// + static Org.Ortc.IEventQueue Bind(Windows.UI.Core.CoreDispatcher Queue); + + /// + /// Extracts a native queue from an event queue object. + /// + static Windows.UI.Core.CoreDispatcher Extract(Org.Ortc.IEventQueue Queue); + }; + + } // namespace Ortc +} // namespace Org + diff --git a/ortc/idl/wrapper/override/msidl/Org.Ortc.MediaControl.idl b/ortc/idl/wrapper/override/msidl/Org.Ortc.MediaControl.idl new file mode 100644 index 00000000..185af456 --- /dev/null +++ b/ortc/idl/wrapper/override/msidl/Org.Ortc.MediaControl.idl @@ -0,0 +1,41 @@ +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace Ortc + { + + + /// + /// Interface for controlling the behaviour of media. + /// + [version(1.0)] + [uuid(56d05370-3095-1aff-ba87-47414cb8a5a3)] + interface IMediaControl : IInspectable + { + }; + + /// + /// Interface for controlling the behaviour of media. + /// + runtimeclass MediaControl : [default] IMediaControl + { + + /// + /// Cast from Org.Ortc.IMediaControl to Org.Ortc.MediaControl + /// + [default_overload] + [method_name("CastFromIMediaControl")] + static Org.Ortc.MediaControl Cast(Org.Ortc.IMediaControl source); + + /// + /// Gets or sets the media engine the application orientation has + /// changed. + /// + static Object DisplayOrientation { get; set; }; + }; + + } // namespace Ortc +} // namespace Org + diff --git a/ortc/idl/wrapper/override/msidl/Org.Ortc.MediaSource.idl b/ortc/idl/wrapper/override/msidl/Org.Ortc.MediaSource.idl new file mode 100644 index 00000000..6ebd8da9 --- /dev/null +++ b/ortc/idl/wrapper/override/msidl/Org.Ortc.MediaSource.idl @@ -0,0 +1,42 @@ +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace Ortc + { + + + /// + /// MediaSource represents an object holder for a platform specific + /// media source. + /// + [version(1.0)] + [uuid(4e781912-6b0a-4d4f-06ee-f41b1ff03a4a)] + interface IMediaSource : IInspectable + { + + /// + /// Gets the platform specific media source. + /// + Windows.Media.Core.IMediaSource Source { get; }; + }; + + /// + /// MediaSource represents an object holder for a platform specific + /// media source. + /// + runtimeclass MediaSource : [default] IMediaSource + { + + /// + /// Cast from Org.Ortc.IMediaSource to Org.Ortc.MediaSource + /// + [default_overload] + [method_name("CastFromIMediaSource")] + static Org.Ortc.MediaSource Cast(Org.Ortc.IMediaSource source); + }; + + } // namespace Ortc +} // namespace Org + diff --git a/ortc/idl/wrapper/override/org_ortc_EventQueue.h b/ortc/idl/wrapper/override/org_ortc_EventQueue.h new file mode 100644 index 00000000..1768a97c --- /dev/null +++ b/ortc/idl/wrapper/override/org_ortc_EventQueue.h @@ -0,0 +1,32 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_ORTC_EVENTQUEUE + +#pragma once + +#include + +namespace wrapper { + namespace org { + namespace ortc { + + struct EventQueue + { + static EventQueuePtr wrapper_create() noexcept; + virtual ~EventQueue() noexcept {} + + virtual void wrapper_init_org_ortc_EventQueue(AnyPtr queue) noexcept { ZS_MAYBE_USED(queue); } + + static wrapper::org::ortc::EventQueuePtr getDefaultForUi() noexcept; + + static wrapper::org::ortc::EventQueuePtr get_singleton() noexcept; + static void set_singleton(wrapper::org::ortc::EventQueuePtr value) noexcept; + + virtual AnyPtr get_queue() noexcept = 0; + + }; + + } // ortc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_ORTC_EVENTQUEUE diff --git a/ortc/idl/wrapper/override/org_ortc_EventQueueMaker.h b/ortc/idl/wrapper/override/org_ortc_EventQueueMaker.h new file mode 100644 index 00000000..e1ac07ac --- /dev/null +++ b/ortc/idl/wrapper/override/org_ortc_EventQueueMaker.h @@ -0,0 +1,28 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER + +#pragma once + +#include +#include + +namespace wrapper { + namespace org { + namespace ortc { + + struct EventQueueMaker + { + virtual ~EventQueueMaker() noexcept {} + +#if 0 + static wrapper::org::ortc::EventQueuePtr bindQueue(AnyPtr queue) noexcept; + static AnyPtr extractQueue(wrapper::org::ortc::EventQueuePtr queue) noexcept; +#endif //0 + + }; + + } // ortc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_ORTC_EVENTQUEUEMAKER diff --git a/ortc/idl/wrapper/override/org_ortc_MediaControl.h b/ortc/idl/wrapper/override/org_ortc_MediaControl.h new file mode 100644 index 00000000..cdfb413c --- /dev/null +++ b/ortc/idl/wrapper/override/org_ortc_MediaControl.h @@ -0,0 +1,25 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_ORTC_MEDIACONTROL + +#pragma once + +#include + +namespace wrapper { + namespace org { + namespace ortc { + + struct MediaControl + { + virtual ~MediaControl() noexcept {} + + + static AnyPtr get_displayOrientation() noexcept; + static void set_displayOrientation(AnyPtr value) noexcept; + }; + + } // ortc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_ORTC_MEDIACONTROL diff --git a/ortc/idl/wrapper/override/org_ortc_MediaSource.h b/ortc/idl/wrapper/override/org_ortc_MediaSource.h new file mode 100644 index 00000000..978dd4c7 --- /dev/null +++ b/ortc/idl/wrapper/override/org_ortc_MediaSource.h @@ -0,0 +1,28 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_ORTC_MEDIASOURCE + +#pragma once + +#include + +namespace wrapper { + namespace org { + namespace ortc { + + struct MediaSource + { + static MediaSourcePtr wrapper_create() noexcept; + virtual ~MediaSource() noexcept {} + + virtual void wrapper_init_org_ortc_MediaSource() noexcept {} + + virtual AnyPtr get_source() noexcept = 0; + virtual void set_source(AnyPtr value) noexcept = 0; + virtual AnyPtr get_track() noexcept = 0; + }; + + } // ortc + } // org +} // namespace wrapper + +#endif // WRAPPER_USE_GENERATED_ORG_ORTC_MEDIASOURCE diff --git a/ortc/idl/wrapper/types.h b/ortc/idl/wrapper/types.h new file mode 100644 index 00000000..6cf3cc8f --- /dev/null +++ b/ortc/idl/wrapper/types.h @@ -0,0 +1,180 @@ + +#pragma once + +#include "generated/types.h" + +namespace wrapper { + namespace impl { + + namespace org { + namespace ortc { + namespace adapter { + + ZS_DECLARE_STRUCT_PTR(MediaStream); + ZS_DECLARE_STRUCT_PTR(RTCAnswerOptions); + ZS_DECLARE_STRUCT_PTR(RTCCapabilityOptions); + ZS_DECLARE_STRUCT_PTR(RTCConfiguration); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidate); + ZS_DECLARE_STRUCT_PTR(RTCMediaStreamTrackConfiguration); + ZS_DECLARE_STRUCT_PTR(RTCOfferAnswerOptions); + ZS_DECLARE_STRUCT_PTR(RTCOfferOptions); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnection); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnectionIceErrorEvent); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnectionIceEvent); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescription); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionConnectionData); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionConnectionDataDetails); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionDescription); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionDescriptionDetails); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionMediaLine); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionMediaLineDetails); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionRtpMediaLine); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionRtpSender); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionRtpSenderDetails); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionSctpMediaLine); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionTransport); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionTransportParameters); + ZS_DECLARE_STRUCT_PTR(RTCTrackEvent); + + } // namespace adapter + + namespace log { + } // namespace log + + ZS_DECLARE_STRUCT_PTR(ConstrainBoolean); + ZS_DECLARE_STRUCT_PTR(ConstrainBooleanParameters); + ZS_DECLARE_STRUCT_PTR(ConstrainDouble); + ZS_DECLARE_STRUCT_PTR(ConstrainDoubleRange); + ZS_DECLARE_STRUCT_PTR(ConstrainLong); + ZS_DECLARE_STRUCT_PTR(ConstrainLongRange); + ZS_DECLARE_STRUCT_PTR(ConstrainString); + ZS_DECLARE_STRUCT_PTR(ConstrainStringParameters); + ZS_DECLARE_STRUCT_PTR(DoubleRange); + ZS_DECLARE_STRUCT_PTR(Error); + ZS_DECLARE_STRUCT_PTR(ErrorEvent); + ZS_DECLARE_STRUCT_PTR(EventQueue); + ZS_DECLARE_STRUCT_PTR(EventQueueMaker); + ZS_DECLARE_STRUCT_PTR(Json); + ZS_DECLARE_STRUCT_PTR(Logger); + ZS_DECLARE_STRUCT_PTR(LongRange); + ZS_DECLARE_STRUCT_PTR(MediaControl); + ZS_DECLARE_STRUCT_PTR(MediaDeviceInfo); + ZS_DECLARE_STRUCT_PTR(MediaDevices); + ZS_DECLARE_STRUCT_PTR(MediaSource); + ZS_DECLARE_STRUCT_PTR(MediaStreamConstraints); + ZS_DECLARE_STRUCT_PTR(MediaStreamTrack); + ZS_DECLARE_STRUCT_PTR(MediaTrackCapabilities); + ZS_DECLARE_STRUCT_PTR(MediaTrackConstraintSet); + ZS_DECLARE_STRUCT_PTR(MediaTrackConstraints); + ZS_DECLARE_STRUCT_PTR(MediaTrackSettings); + ZS_DECLARE_STRUCT_PTR(MediaTrackSupportedConstraints); + ZS_DECLARE_STRUCT_PTR(OrtcLib); + ZS_DECLARE_STRUCT_PTR(OverconstrainedError); + ZS_DECLARE_STRUCT_PTR(OverconstrainedErrorEvent); + ZS_DECLARE_STRUCT_PTR(RTCCertificate); + ZS_DECLARE_STRUCT_PTR(RTCCertificateStats); + ZS_DECLARE_STRUCT_PTR(RTCCodec); + ZS_DECLARE_STRUCT_PTR(RTCDataChannel); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelEvent); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelParameters); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelStateChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelStats); + ZS_DECLARE_STRUCT_PTR(RTCDataTransport); + ZS_DECLARE_STRUCT_PTR(RTCDtlsCertificateBinary); + ZS_DECLARE_STRUCT_PTR(RTCDtlsFingerprint); + ZS_DECLARE_STRUCT_PTR(RTCDtlsParameters); + ZS_DECLARE_STRUCT_PTR(RTCDtlsTransport); + ZS_DECLARE_STRUCT_PTR(RTCDtlsTransportStateChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCDtlsTransportStats); + ZS_DECLARE_STRUCT_PTR(RTCDtmfSender); + ZS_DECLARE_STRUCT_PTR(RTCDtmfToneChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidate); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidateAttributes); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidateComplete); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidatePair); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidatePairChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidatePairStats); + ZS_DECLARE_STRUCT_PTR(RTCIceGatherInterfacePolicy); + ZS_DECLARE_STRUCT_PTR(RTCIceGatherOptions); + ZS_DECLARE_STRUCT_PTR(RTCIceGatherer); + ZS_DECLARE_STRUCT_PTR(RTCIceGathererCandidate); + ZS_DECLARE_STRUCT_PTR(RTCIceGathererCandidateCompleteEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceGathererCandidateEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceGathererIceErrorEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceGathererStateChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceGathererStats); + ZS_DECLARE_STRUCT_PTR(RTCIceParameters); + ZS_DECLARE_STRUCT_PTR(RTCIceServer); + ZS_DECLARE_STRUCT_PTR(RTCIceTransport); + ZS_DECLARE_STRUCT_PTR(RTCIceTransportController); + ZS_DECLARE_STRUCT_PTR(RTCIceTransportOptions); + ZS_DECLARE_STRUCT_PTR(RTCIceTransportStateChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCIceTransportStats); + ZS_DECLARE_STRUCT_PTR(RTCIdentity); + ZS_DECLARE_STRUCT_PTR(RTCIdentityAssertion); + ZS_DECLARE_STRUCT_PTR(RTCIdentityError); + ZS_DECLARE_STRUCT_PTR(RTCIdentityResult); + ZS_DECLARE_STRUCT_PTR(RTCInboundRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCMediaStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCMediaStreamTrackStats); + ZS_DECLARE_STRUCT_PTR(RTCMessageEvent); + ZS_DECLARE_STRUCT_PTR(RTCOutboundRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCRtcpFeedback); + ZS_DECLARE_STRUCT_PTR(RTCRtcpParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtcpTransport); + ZS_DECLARE_STRUCT_PTR(RTCRtpCapabilities); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecCapability); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecCapabilityOptions); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpContributingSource); + ZS_DECLARE_STRUCT_PTR(RTCRtpEncodingParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpFecParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpFlexFecCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpFlexFecCodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCRtpH264CodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpH264CodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCRtpHeaderExtension); + ZS_DECLARE_STRUCT_PTR(RTCRtpHeaderExtensionParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpListener); + ZS_DECLARE_STRUCT_PTR(RTCRtpOpusCodecCapabilityOptions); + ZS_DECLARE_STRUCT_PTR(RTCRtpOpusCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpOpusCodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCRtpParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpReceiver); + ZS_DECLARE_STRUCT_PTR(RTCRtpRedCodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCRtpRtxCodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpRtxCodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCRtpRtxParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpSender); + ZS_DECLARE_STRUCT_PTR(RTCRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCRtpTransport); + ZS_DECLARE_STRUCT_PTR(RTCRtpUnhandledEvent); + ZS_DECLARE_STRUCT_PTR(RTCRtpVp8CodecCapabilityParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpVp8CodecParameterSettings); + ZS_DECLARE_STRUCT_PTR(RTCSctpCapabilities); + ZS_DECLARE_STRUCT_PTR(RTCSctpTransport); + ZS_DECLARE_STRUCT_PTR(RTCSctpTransportListener); + ZS_DECLARE_STRUCT_PTR(RTCSctpTransportListenerEvent); + ZS_DECLARE_STRUCT_PTR(RTCSctpTransportStateChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCSctpTransportStats); + ZS_DECLARE_STRUCT_PTR(RTCSrtpSdesCryptoParameters); + ZS_DECLARE_STRUCT_PTR(RTCSrtpSdesKeyParameters); + ZS_DECLARE_STRUCT_PTR(RTCSrtpSdesParameters); + ZS_DECLARE_STRUCT_PTR(RTCSrtpSdesTransport); + ZS_DECLARE_STRUCT_PTR(RTCSrtpSdesTransportLifetimeRemainingEvent); + ZS_DECLARE_STRUCT_PTR(RTCSrtpTransportStats); + ZS_DECLARE_STRUCT_PTR(RTCSsrcConflictEvent); + ZS_DECLARE_STRUCT_PTR(RTCStats); + ZS_DECLARE_STRUCT_PTR(RTCStatsProvider); + ZS_DECLARE_STRUCT_PTR(RTCStatsReport); + ZS_DECLARE_STRUCT_PTR(RTCStatsTypeSet); + ZS_DECLARE_STRUCT_PTR(Settings); + ZS_DECLARE_STRUCT_PTR(StringOrStringList); + + } // namespace ortc + } // namespace org + } // namespace impl +} // namespace wrapper + diff --git a/ortc/internal/ifaddrs-android.h b/ortc/internal/ifaddrs-android.h index 8a5900db..b74608e7 100644 --- a/ortc/internal/ifaddrs-android.h +++ b/ortc/internal/ifaddrs-android.h @@ -46,7 +46,7 @@ struct ifaddrs { // We don't need them (yet?). }; -int getifaddrs(struct ifaddrs** result); -void freeifaddrs(struct ifaddrs* addrs); +int getifaddrs(struct ifaddrs** result) noexcept; +void freeifaddrs(struct ifaddrs* addrs) noexcept; #endif // TALK_BASE_IFADDRS_ANDROID_H_ \ No newline at end of file diff --git a/ortc/internal/ortc.h b/ortc/internal/ortc.h index 9251f503..ad34c417 100644 --- a/ortc/internal/ortc.h +++ b/ortc/internal/ortc.h @@ -37,26 +37,39 @@ #include #include #include +#include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include -#include #include #include -#include -#include -#include #include #include -#include -#include -#include #include -#include #include -#include #include diff --git a/ortc/internal/ortcEvents.h b/ortc/internal/ortcEvents.h new file mode 100644 index 00000000..404a2ebb --- /dev/null +++ b/ortc/internal/ortcEvents.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#ifdef _WIN32 + +#include "ortc.events_win.h" + +#else + +#include +#include + +namespace zsLib { + namespace eventing { + + template + void eventWriteBuffer(BYTE * &p, TWriteType value) noexcept + { + memcpy(&p, &value, sizeof(value)); + p += sizeof(value); + } + inline void eventWriteBuffer(BYTE ** &p, const BYTE *buffer, size_t * &bufferSizes, size_t size) noexcept + { + (*p) = const_cast(buffer); + (*bufferSizes) = size; + ++p; + ++bufferSizes; + } + inline void eventWriteBuffer(BYTE ** &p, const char *str, size_t * &bufferSizes) noexcept + { + (*p) = const_cast(reinterpret_cast(str)); + (*bufferSizes) = (NULL == str ? 0 : strlen(str)) * sizeof(char); + ++p; + ++bufferSizes; + } + inline void eventWriteBuffer(const BYTE ** &p, const wchar_t *str, size_t * &bufferSizes) noexcept + { + (*p) = reinterpret_cast(str); + (*bufferSizes) = (NULL == str ? 0 : wcslen(str)) * sizeof(wchar_t); + ++p; + ++bufferSizes; + } + } +} +#endif // _WIN32 diff --git a/ortc/internal/ortc_Certificate.h b/ortc/internal/ortc_Certificate.h index a8a44faf..a3b4f204 100644 --- a/ortc/internal/ortc_Certificate.h +++ b/ortc/internal/ortc_Certificate.h @@ -70,42 +70,42 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificateForDTLSTransport - #pragma mark + // + // ICertificateForDTLSTransport + // interaction ICertificateForDTLSTransport { ZS_DECLARE_TYPEDEF_PTR(ICertificateForDTLSTransport, ForDTLSTransport) ZS_DECLARE_TYPEDEF_PTR(ICertificateTypes::Fingerprint, Fingerprint) - static ElementPtr toDebug(ForDTLSTransportPtr certificate); + static ElementPtr toDebug(ForDTLSTransportPtr certificate) noexcept; typedef EVP_PKEY * KeyPairType; typedef X509 * CertificateObjectType; // not sure of type to use - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual KeyPairType getKeyPair() const = 0; - virtual CertificateObjectType getCertificate() const = 0; + virtual KeyPairType getKeyPair() const noexcept = 0; + virtual CertificateObjectType getCertificate() const noexcept = 0; - virtual SecureByteBlockPtr getDigest(const String &algorithm) const = 0; + virtual SecureByteBlockPtr getDigest(const String &algorithm) const noexcept = 0; - virtual FingerprintPtr fingerprint() const = 0; + virtual FingerprintPtr fingerprint() const noexcept = 0; static SecureByteBlockPtr getDigest( const String &algorithm, CertificateObjectType certificate - ); + ) noexcept; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate - #pragma mark + // + // Certificate + // class Certificate : public Noop, public MessageQueueAssociator, @@ -137,129 +137,129 @@ namespace ortc const make_private &, IMessageQueuePtr queue, ElementPtr keygenAlgorithm - ); + ) noexcept(false); // throws NotSupportedError protected: - Certificate(Noop) : + Certificate(Noop) noexcept(false) : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~Certificate(); + virtual ~Certificate() noexcept; - static CertificatePtr convert(ICertificatePtr object); - static CertificatePtr convert(ForDTLSTransportPtr object); + static CertificatePtr convert(ICertificatePtr object) noexcept; + static CertificatePtr convert(ForDTLSTransportPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => ICertificate - #pragma mark + // + // Certificate => ICertificate + // - static ElementPtr toDebug(CertificatePtr certificate); + static ElementPtr toDebug(CertificatePtr certificate) noexcept; - static PromiseWithCertificatePtr generateCertificate(ElementPtr keygenAlgorithm) throw (NotSupportedError); + static PromiseWithCertificatePtr generateCertificate(ElementPtr keygenAlgorithm) noexcept(false); // throws NotSupportedError - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual Time expires() const override; + Time expires() const noexcept override; - virtual FingerprintPtr fingerprint() const override; + FingerprintPtr fingerprint() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => ICertificateForDTLSTransport - #pragma mark + // + // Certificate => ICertificateForDTLSTransport + // // (duplicate) virtual PUID getID() const; - virtual KeyPairType getKeyPair() const override; - virtual CertificateObjectType getCertificate() const override; + KeyPairType getKeyPair() const noexcept override; + CertificateObjectType getCertificate() const noexcept override; - virtual SecureByteBlockPtr getDigest(const String &algorithm) const override; + SecureByteBlockPtr getDigest(const String &algorithm) const noexcept override; // (duplicate) virtual FingerprintPtr fingerprint() const override; static SecureByteBlockPtr getDigest( const String &algorithm, CertificateObjectType certificate - ); + ) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => IStatsProvider - #pragma mark + // + // Certificate => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => IWakeDelegate - #pragma mark + // + // Certificate => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate::PromiseCertificateHolder - #pragma mark + // + // Certificate::PromiseCertificateHolder + // struct PromiseCertificateHolder : public PromiseWithCertificate { - PromiseCertificateHolder(IMessageQueuePtr queue = IMessageQueuePtr()) : + PromiseCertificateHolder(IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : PromiseWithCertificate(Promise::make_private{}, queue) {} - ~PromiseCertificateHolder() {} + ~PromiseCertificateHolder() noexcept {} - void setThisWeak(PromisePtr promise) {mThisWeak = promise;} + void setThisWeak(PromisePtr promise) noexcept {mThisWeak = promise;} CertificatePtr mCertificate; }; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate::Digest - #pragma mark + // + // Certificate::Digest + // class Digest { public: - Digest(const String &algorithm); - ~Digest(); + Digest(const String &algorithm) noexcept; + ~Digest() noexcept; // Returns the digest output size (e.g. 16 bytes for MD5). - size_t Size() const; + size_t Size() const noexcept; // Updates the digest with |len| bytes from |buf|. - void Update(const void* buf, size_t len); + void Update(const void* buf, size_t len) noexcept; // Outputs the digest value to |buf| with length |len|. - size_t Finish(void* buf, size_t len); + size_t Finish(void* buf, size_t len) noexcept; // Helper function to look up a digest's EVP by name. static bool GetDigestEVP( const String &algorithm, const EVP_MD** md - ); + ) noexcept; // Helper function to look up a digest's name by EVP. static bool GetDigestName( const EVP_MD* md, String* algorithm - ); + ) noexcept; // Helper function to get the length of a digest. static bool GetDigestSize( const String &algorithm, size_t* len - ); + ) noexcept; private: EVP_MD_CTX ctx_; @@ -268,25 +268,25 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => (internal) - #pragma mark + // + // Certificate => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - void cancel(); - bool resolveStatPromises(); + void cancel() noexcept; + bool resolveStatPromises() noexcept; - evp_pkey_st* MakeKey(); - X509* MakeCertificate(EVP_PKEY* pkey); + evp_pkey_st* MakeKey() noexcept; + X509* MakeCertificate(EVP_PKEY* pkey) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Certificate => (data) - #pragma mark + // + // Certificate => (data) + // AutoPUID mID; CertificateWeakPtr mThisWeak; @@ -317,17 +317,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICertificateFactory - #pragma mark + // + // ICertificateFactory + // interaction ICertificateFactory { - static ICertificateFactory &singleton(); + static ICertificateFactory &singleton() noexcept; - ZS_DECLARE_TYPEDEF_PTR(ICertificateTypes::PromiseWithCertificate, PromiseWithCertificate) + ZS_DECLARE_TYPEDEF_PTR(ICertificateTypes::PromiseWithCertificate, PromiseWithCertificate); - virtual PromiseWithCertificatePtr generateCertificate(ElementPtr keygenAlgorithm) throw (NotSupportedError);; + virtual PromiseWithCertificatePtr generateCertificate(ElementPtr keygenAlgorithm) noexcept(false); // throws NotSupportedError }; class CertificateFactory : public IFactory {}; diff --git a/ortc/internal/ortc_DTLSTransport.h b/ortc/internal/ortc_DTLSTransport.h index 47bb3172..3bd06296 100644 --- a/ortc/internal/ortc_DTLSTransport.h +++ b/ortc/internal/ortc_DTLSTransport.h @@ -55,15 +55,15 @@ namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IICETransportForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(ICertificateForDTLSTransport) - ZS_DECLARE_INTERACTION_PTR(ISRTPTransportForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSecureTransport) + ZS_DECLARE_INTERACTION_PTR(IICETransportForSecureTransport); + ZS_DECLARE_INTERACTION_PTR(ICertificateForDTLSTransport); + ZS_DECLARE_INTERACTION_PTR(ISRTPTransportForSecureTransport); + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSecureTransport);; ZS_DECLARE_INTERACTION_PTR(IDataTransportForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(IDTLSTransportForSettings) + ZS_DECLARE_INTERACTION_PTR(IDTLSTransportForSettings); - ZS_DECLARE_INTERACTION_PROXY(IDTLSTransportAsyncDelegate) + ZS_DECLARE_INTERACTION_PROXY(IDTLSTransportAsyncDelegate); typedef struct ssl_st SSL; typedef struct ssl_ctx_st SSL_CTX; @@ -73,26 +73,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportForSettings - #pragma mark + // + // IDTLSTransportForSettings + // interaction IDTLSTransportForSettings { - ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportForSettings, ForSettings) + ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportForSettings, ForSettings); - static void applyDefaults(); + static void applyDefaults() noexcept; - virtual ~IDTLSTransportForSettings() {} + virtual ~IDTLSTransportForSettings() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportAsyncDelegate - #pragma mark + // + // IDTLSTransportAsyncDelegate + // interaction IDTLSTransportAsyncDelegate { @@ -104,9 +104,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport - #pragma mark + // + // DTLSTransport + // class DTLSTransport : public Noop, public MessageQueueAssociator, @@ -142,17 +142,17 @@ namespace ortc typedef IDTLSTransport::States States; - ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportTypes::CertificateList, CertificateList) + ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportTypes::CertificateList, CertificateList); - ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport) - ZS_DECLARE_TYPEDEF_PTR(ICertificateForDTLSTransport, UseCertificate) - ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSecureTransport, UseSRTPTransport) - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForSecureTransport, UseRTPListener) - ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, UseDataTransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport); + ZS_DECLARE_TYPEDEF_PTR(ICertificateForDTLSTransport, UseCertificate); + ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSecureTransport, UseSRTPTransport); + ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForSecureTransport, UseRTPListener); + ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, UseDataTransport); - ZS_DECLARE_TYPEDEF_PTR(std::list, UseCertificateList) + ZS_DECLARE_TYPEDEF_PTR(std::list, UseCertificateList); - ZS_DECLARE_CLASS_PTR(Adapter) + ZS_DECLARE_CLASS_PTR(Adapter); enum StreamResult { SR_ERROR, SR_SUCCESS, SR_BLOCK, SR_EOS }; @@ -168,333 +168,330 @@ namespace ortc IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificates - ); + ) noexcept(false); // throws InvalidParameters protected: DTLSTransport( Noop, IMessageQueuePtr queue = IMessageQueuePtr() - ) : + ) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~DTLSTransport(); + virtual ~DTLSTransport() noexcept; - static DTLSTransportPtr convert(IDTLSTransportPtr object); - static DTLSTransportPtr convert(ForDataTransportPtr object); - static DTLSTransportPtr convert(ForRTPSenderPtr object); - static DTLSTransportPtr convert(ForRTPReceiverPtr object); - static DTLSTransportPtr convert(ForICETransportPtr object); - static DTLSTransportPtr convert(ForSRTPPtr object); - static DTLSTransportPtr convert(ForRTPListenerPtr object); + static DTLSTransportPtr convert(IDTLSTransportPtr object) noexcept; + static DTLSTransportPtr convert(ForDataTransportPtr object) noexcept; + static DTLSTransportPtr convert(ForRTPSenderPtr object) noexcept; + static DTLSTransportPtr convert(ForRTPReceiverPtr object) noexcept; + static DTLSTransportPtr convert(ForICETransportPtr object) noexcept; + static DTLSTransportPtr convert(ForSRTPPtr object) noexcept; + static DTLSTransportPtr convert(ForRTPListenerPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IStatsProvider - #pragma mark + // + // DTLSTransport => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IDTLSTransport - #pragma mark + // + // DTLSTransport => IDTLSTransport + // - static ElementPtr toDebug(DTLSTransportPtr transport); + static ElementPtr toDebug(DTLSTransportPtr transport) noexcept; static DTLSTransportPtr create( IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificate - ); + ) noexcept; - static DTLSTransportPtr convert(IRTPTransportPtr rtpTransport); - static DTLSTransportPtr convert(IRTCPTransportPtr rtcpTransport); + static DTLSTransportPtr convert(IRTPTransportPtr rtpTransport) noexcept; + static DTLSTransportPtr convert(IRTCPTransportPtr rtcpTransport) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IDTLSTransportSubscriptionPtr subscribe(IDTLSTransportDelegatePtr delegate) override; + IDTLSTransportSubscriptionPtr subscribe(IDTLSTransportDelegatePtr delegate) noexcept override; - virtual CertificateListPtr certificates() const override; - virtual IICETransportPtr transport() const override; + CertificateListPtr certificates() const noexcept override; + IICETransportPtr transport() const noexcept override; - virtual States state() const override; + States state() const noexcept override; - virtual ParametersPtr getLocalParameters() const override; - virtual ParametersPtr getRemoteParameters() const override; + ParametersPtr getLocalParameters() const noexcept override; + ParametersPtr getRemoteParameters() const noexcept override; - virtual SecureByteBlockListPtr getRemoteCertificates() const override; + SecureByteBlockListPtr getRemoteCertificates() const noexcept override; - virtual void start(const Parameters &remoteParameters) throw ( - InvalidStateError, - InvalidParameters - ) override; + void start(const Parameters &remoteParameters) noexcept(false) override; // throws InvalidStateError, InvalidParameters - virtual void stop() override; + void stop() noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransport - #pragma mark + // + // DTLSTransport => ISecureTransport + // - // (duplicate) virtual PUID getID() const; + // (duplicate) virtual PUID getID() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPSender - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPSender + // - // (duplicate) virtual PUID getID() const; + // (duplicate) virtual PUID getID() const noexcept = 0; - // (duplicate) virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) = 0; + // (duplicate) virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept = 0; - // (duplicate) virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const = 0; + // (duplicate) virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const noexcept = 0; virtual bool sendPacket( IICETypes::Components sendOverICETransport, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) override; + ) noexcept override; - virtual IICETransportPtr getICETransport() const override; + IICETransportPtr getICETransport() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPReceiver + // - // (duplicate) virtual PUID getID() const; + // (duplicate) virtual PUID getID() const noexcept = 0; - // (duplicate) virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) = 0; + // (duplicate) virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept = 0; - // (duplicate) virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const = 0; + // (duplicate) virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const noexcept = 0; // (duplicate) virtual bool sendPacket( // IICETypes::Components sendOverICETransport, // IICETypes::Components packetType, // const BYTE *buffer, // size_t bufferLengthInBytes - // ) override; + // ) noexcept = 0; - // (duplicate) virtual IICETransportPtr getICETransport() const = 0; + // (duplicate) virtual IICETransportPtr getICETransport() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForICETransport - #pragma mark - - // (duplicate) virtual PUID getID() const; - - virtual void notifyAssociateTransportCreated( - IICETypes::Components associatedComponent, - ICETransportPtr assoicated - ) override; - - virtual bool handleReceivedPacket( - IICETypes::Components viaTransport, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; - virtual void handleReceivedSTUNPacket( - IICETypes::Components viaComponent, - STUNPacketPtr packet - ) override; + // + // DTLSTransport => ISecureTransportForICETransport + // + + // (duplicate) virtual PUID getID() const noexcept = 0; + + void notifyAssociateTransportCreated( + IICETypes::Components associatedComponent, + ICETransportPtr assoicated + ) noexcept override; + + bool handleReceivedPacket( + IICETypes::Components viaTransport, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; + void handleReceivedSTUNPacket( + IICETypes::Components viaComponent, + STUNPacketPtr packet + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForSRTPTransport - #pragma mark + // + // DTLSTransport => ISecureTransportForSRTPTransport + // - // (duplicate) static ElementPtr toDebug(ForSRTPPtr transport); + // (duplicate) static ElementPtr toDebug(ForSRTPPtr transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual bool sendEncryptedPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendEncryptedPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual bool handleReceivedDecryptedPacket( - IICETypes::Components viaTransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleReceivedDecryptedPacket( + IICETypes::Components viaTransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPListener - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPListener + // - // (duplicate) static ElementPtr toDebug(ForRTPListenerPtr transport); + // (duplicate) static ElementPtr toDebug(ForRTPListenerPtr transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual RTPListenerPtr getListener() const override; + RTPListenerPtr getListener() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForDataTransport - #pragma mark + // + // DTLSTransport => ISecureTransportForDataTransport + // - // (duplicate) static ElementPtr toDebug(ForDataTransport transport); + // (duplicate) static ElementPtr toDebug(ForDataTransport transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) override; + ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept override; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const override; + ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const noexcept override; - virtual bool isClientRole() const override; + bool isClientRole() const noexcept override; - virtual UseDataTransportPtr getDataTransport() const override; + UseDataTransportPtr getDataTransport() const noexcept override; - virtual bool sendDataPacket( - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendDataPacket( + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IWakeDelegate - #pragma mark + // + // DTLSTransport => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ITimerDelegate - #pragma mark + // + // DTLSTransport => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IDTLSTransportAsyncDelegate - #pragma mark + // + // DTLSTransport => IDTLSTransportAsyncDelegate + // - virtual void onAdapterSendPacket() override; - virtual void onDeliverPendingIncomingRTP() override; + void onAdapterSendPacket() override; + void onDeliverPendingIncomingRTP() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => IICETransportDelegate - #pragma mark - - virtual void onICETransportStateChange( - IICETransportPtr transport, - IICETransport::States state - ) override; - - virtual void onICETransportCandidatePairAvailable( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; - virtual void onICETransportCandidatePairGone( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; - virtual void onICETransportCandidatePairChanged( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; + // + // DTLSTransport => IICETransportDelegate + // + + void onICETransportStateChange( + IICETransportPtr transport, + IICETransport::States state + ) override; + + void onICETransportCandidatePairAvailable( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; + void onICETransportCandidatePairGone( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; + void onICETransportCandidatePairChanged( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISRTPTransportDelegate - #pragma mark - - virtual void onSRTPTransportLifetimeRemaining( - ISRTPTransportPtr transport, - ULONG leastLifetimeRemainingPercentageForAllKeys, - ULONG overallLifetimeRemainingPercentage - ) override; + // + // DTLSTransport => ISRTPTransportDelegate + // + + void onSRTPTransportLifetimeRemaining( + ISRTPTransportPtr transport, + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage + ) override; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => friend BIO_ - #pragma mark + // + // DTLSTransport => friend BIO_ + // StreamResult bioRead( void* data, size_t data_len, size_t* read, int* error - ); + ) noexcept; StreamResult bioWrite( const void* data, size_t data_len, size_t* written, int* error - ); + ) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => friend DTLSTransport::Adapter - #pragma mark + // + // DTLSTransport => friend DTLSTransport::Adapter + // void adapterSendPacket( const BYTE *buffer, size_t bufferLengthInBytes - ); + ) noexcept; - size_t adapterReadPacket(BYTE *buffer, size_t bufferLengthInBytes); + size_t adapterReadPacket(BYTE *buffer, size_t bufferLengthInBytes) noexcept; - ITimerPtr adapterCreateTimeout(Milliseconds timeout); + ITimerPtr adapterCreateTimeout(Milliseconds timeout) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => (internal) - #pragma mark + // + // DTLSTransport => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - IICETypes::Components component() const; + IICETypes::Components component() const noexcept; - bool isValidated() const {return IDTLSTransportTypes::State_Connected == mCurrentState;} + bool isValidated() const noexcept {return IDTLSTransportTypes::State_Connected == mCurrentState;} - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - bool stepStartSSL(); - bool stepValidate(); - bool stepFixState(); - bool stepNotifyReady(); + void step() noexcept; + bool stepStartSSL() noexcept; + bool stepValidate() noexcept; + bool stepFixState() noexcept; + bool stepNotifyReady() noexcept; - void cancel(); + void cancel() noexcept; - void setState(IDTLSTransportTypes::States state); - void setError(WORD error, const char *reason = NULL); + void setState(IDTLSTransportTypes::States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - void setState(ISecureTransportTypes::States state); + void setState(ISecureTransportTypes::States state) noexcept; - void wakeUpIfNeeded(); + void wakeUpIfNeeded() noexcept; - void setupSRTP(); + void setupSRTP() noexcept; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport::Adapter - #pragma mark + // + // DTLSTransport::Adapter + // class Adapter { @@ -513,63 +510,63 @@ namespace ortc enum { SSE_MSG_TRUNC = 0xff0001 }; enum Validation {VALIDATION_NA, VALIDATION_PASSED, VALIDATION_FAILED}; - static const char *toString(StreamState state); - static const char *toString(SSLRole role); - static const char *toString(SSLMode mode); - static const char *toString(SSLProtocolVersion version); - static const char *toString(Validation validation); + static const char *toString(StreamState state) noexcept; + static const char *toString(SSLRole role) noexcept; + static const char *toString(SSLMode mode) noexcept; + static const char *toString(SSLProtocolVersion version) noexcept; + static const char *toString(Validation validation) noexcept; public: - Adapter(DTLSTransportPtr outer); - ~Adapter(); + Adapter(DTLSTransportPtr outer) noexcept; + ~Adapter() noexcept; - void setIdentity(UseCertificatePtr identity); + void setIdentity(UseCertificatePtr identity) noexcept; // Default argument is for compatibility - SSLRole role() const {return role_;} - void setServerRole(SSLRole role = SSL_SERVER); + SSLRole role() const noexcept {return role_;} + void setServerRole(SSLRole role = SSL_SERVER) noexcept; - bool getPeerCertificate(X509 **cert) const; + bool getPeerCertificate(X509 **cert) const noexcept; Validation setPeerCertificateDigest( const String &digest_alg, const String &digest_value - ); + ) noexcept; - int startSSLWithServer(const char *server_name); - int startSSLWithPeer(); - void setMode(SSLMode mode); - void setMaxProtocolVersion(SSLProtocolVersion version); + int startSSLWithServer(const char *server_name) noexcept; + int startSSLWithPeer() noexcept; + void setMode(SSLMode mode) noexcept; + void setMaxProtocolVersion(SSLProtocolVersion version) noexcept; StreamResult bioRead( void* data, size_t data_len, size_t* read, int* error - ); + ) noexcept; StreamResult bioWrite( const void* data, size_t data_len, size_t* written, int* error - ); + ) noexcept; StreamResult read( void* data, size_t data_len, size_t* read, int* error - ); + ) noexcept; StreamResult write( const void* data, size_t data_len, size_t* written, int* error - ); - void close(); - StreamState getState() const; + ) noexcept; + void close() noexcept; + StreamState getState() const noexcept; - bool getSslCipher(String * cipher); + bool getSslCipher(String * cipher) noexcept; // Key Extractor interface bool exportKeyingMaterial( @@ -579,35 +576,35 @@ namespace ortc bool use_context, BYTE *result, size_t result_len - ); + ) noexcept; // DTLS-SRTP interface - bool setDtlsSrtpCiphers(const std::vector &ciphers); - bool getDtlsSrtpCipher(String * cipher); + bool setDtlsSrtpCiphers(const std::vector &ciphers) noexcept; + bool getDtlsSrtpCipher(String * cipher) noexcept; // Capabilities interfaces - static bool haveDtls(); - static bool haveDtlsSrtp(); - static bool haveExporter(); - static String getDefaultSslCipher(SSLProtocolVersion version); + static bool haveDtls() noexcept; + static bool haveDtlsSrtp() noexcept; + static bool haveExporter() noexcept; + static String getDefaultSslCipher(SSLProtocolVersion version) noexcept; // debug helpers - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; // Override MessageHandler - void onTimer(ITimerPtr timer); + void onTimer(ITimerPtr timer) noexcept; protected: - void onEvent(int events, int err); + void onEvent(int events, int err) noexcept; - Log::Params log(const char *message) const; - void logSSLErrors(const String &prefix); + Log::Params log(const char *message) const noexcept; + void logSSLErrors(const String &prefix) noexcept; - void set_client_auth_enabled(bool enabled) { client_auth_enabled_ = enabled; } - bool client_auth_enabled() const { return client_auth_enabled_; } + void set_client_auth_enabled(bool enabled) noexcept { client_auth_enabled_ = enabled; } + bool client_auth_enabled() const noexcept { return client_auth_enabled_; } - void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } - bool ignore_bad_cert() const { return ignore_bad_cert_; } + void set_ignore_bad_cert(bool ignore) noexcept { ignore_bad_cert_ = ignore; } + bool ignore_bad_cert() const noexcept { return ignore_bad_cert_; } private: enum SSLState { @@ -621,7 +618,7 @@ namespace ortc SSL_CLOSED // Clean close }; - static const char *toString(SSLState state); + static const char *toString(SSLState state) noexcept; // The following three methods return 0 on success and a negative // error code on failure. The error code may be from OpenSSL or -1 @@ -631,11 +628,11 @@ namespace ortc // Go from state SSL_NONE to either SSL_CONNECTING or SSL_WAIT, // depending on whether the underlying stream is already open or // not. - int startSSL(); + int startSSL() noexcept; // Prepare SSL library, state is SSL_CONNECTING. - int beginSSL(); + int beginSSL() noexcept; // Perform SSL negotiation steps. - int continueSSL(); + int continueSSL() noexcept; // Error handler helper. signal is given as true for errors in // asynchronous contexts (when an error method was not returned @@ -643,19 +640,19 @@ namespace ortc // raised on the stream with the specified error. // A 0 error means a graceful close, otherwise there is not really enough // context to interpret the error code. - void error(const char* context, int err, bool signal); - void cleanup(); + void error(const char* context, int err, bool signal) noexcept; + void cleanup() noexcept; // Flush the input buffers by reading left bytes (for DTLS) - void flushInput(unsigned int left); + void flushInput(unsigned int left) noexcept; // SSL library configuration - SSL_CTX* setupSSLContext(); + SSL_CTX* setupSSLContext() noexcept; // SSL verification check bool sslPostConnectionCheck( SSL* ssl, const char *server_name - ); + ) noexcept; // SSL certification verification error handler, called back from // the openssl library. Returns an int interpreted as a boolean in // the C style: zero means verification failure, non-zero means @@ -663,7 +660,7 @@ namespace ortc static int sslVerifyCallback( int ok, X509_STORE_CTX* store - ); + ) noexcept; protected: AutoPUID mID; @@ -709,9 +706,9 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => (data) - #pragma mark + // + // DTLSTransport => (data) + // AutoPUID mID; DTLSTransportWeakPtr mThisWeak; @@ -764,21 +761,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTLSTransportFactory - #pragma mark + // + // IDTLSTransportFactory + // interaction IDTLSTransportFactory { - ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportTypes::CertificateList, CertificateList) + ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportTypes::CertificateList, CertificateList); - static IDTLSTransportFactory &singleton(); + static IDTLSTransportFactory &singleton() noexcept; virtual DTLSTransportPtr create( IDTLSTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CertificateList &certificates - ); + ) noexcept; }; class DTLSTransportFactory : public IFactory {}; @@ -787,6 +784,6 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::internal::IDTLSTransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(zsLib::PromisePtr, PromisePtr) -ZS_DECLARE_PROXY_METHOD_0(onAdapterSendPacket) -ZS_DECLARE_PROXY_METHOD_0(onDeliverPendingIncomingRTP) +ZS_DECLARE_PROXY_METHOD(onAdapterSendPacket) +ZS_DECLARE_PROXY_METHOD(onDeliverPendingIncomingRTP) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_DTMFSender.h b/ortc/internal/ortc_DTMFSender.h index 21369a53..1bd7cef7 100644 --- a/ortc/internal/ortc_DTMFSender.h +++ b/ortc/internal/ortc_DTMFSender.h @@ -51,17 +51,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderForRTPSender - #pragma mark + // + // IDTMFSenderForRTPSender + // interaction IDTMFSenderForRTPSender { - ZS_DECLARE_TYPEDEF_PTR(IDTMFSenderForRTPSender, ForRTPSender) + ZS_DECLARE_TYPEDEF_PTR(IDTMFSenderForRTPSender, ForRTPSender); - static ElementPtr toDebug(ForRTPSenderPtr transport); + static ElementPtr toDebug(ForRTPSenderPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; @@ -69,9 +69,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender - #pragma mark + // + // DTMFSender + // class DTMFSender : public Noop, public MessageQueueAssociator, @@ -89,7 +89,7 @@ namespace ortc friend interaction IDTMFSenderFactory; friend interaction IDTMFSenderForRTPSender; - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForDTMFSender, UseRTPSender) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForDTMFSender, UseRTPSender); public: DTMFSender( @@ -97,116 +97,113 @@ namespace ortc IMessageQueuePtr queue, IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ); + ) noexcept; protected: - DTMFSender(Noop) : + DTMFSender(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~DTMFSender(); + virtual ~DTMFSender() noexcept; - static DTMFSenderPtr convert(IDTMFSenderPtr object); - static DTMFSenderPtr convert(ForRTPSenderPtr object); + static DTMFSenderPtr convert(IDTMFSenderPtr object) noexcept; + static DTMFSenderPtr convert(ForRTPSenderPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSender - #pragma mark + // + // DTMFSender => IDTMFSender + // - static ElementPtr toDebug(DTMFSenderPtr transport); + static ElementPtr toDebug(DTMFSenderPtr transport) noexcept; static DTMFSenderPtr create( IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ); + ) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) override; + IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) noexcept override; - virtual bool canInsertDTMF() const override; + bool canInsertDTMF() const noexcept override; - virtual void insertDTMF( - const char *tones, - Milliseconds duration = Milliseconds(70), - Milliseconds interToneGap = Milliseconds(70) - ) throw ( - InvalidStateError, - InvalidCharacterError - ) override; + void insertDTMF( + const char *tones, + Milliseconds duration = Milliseconds(70), + Milliseconds interToneGap = Milliseconds(70) + ) noexcept(false) override; // throws InvalidStateError, InvalidCharacterError - virtual IRTPSenderPtr sender() const override; + IRTPSenderPtr sender() const noexcept override; - virtual String toneBuffer() const override; - virtual Milliseconds duration() const override; - virtual Milliseconds interToneGap() const override; + String toneBuffer() const noexcept override; + Milliseconds duration() const noexcept override; + Milliseconds interToneGap() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSenderForRTPSender - #pragma mark + // + // DTMFSender => IDTMFSenderForRTPSender + // // (duplicate) static ElementPtr toDebug(DTMFSenderPtr transport); // (duplicate) virtual PUID getID() const = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IWakeDelegate - #pragma mark + // + // DTMFSender => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSenderDelegate - #pragma mark + // + // DTMFSender => IDTMFSenderDelegate + // - virtual void onDTMFSenderToneChanged( - IDTMFSenderPtr sender, - String tone - ) override; + void onDTMFSenderToneChanged( + IDTMFSenderPtr sender, + String tone + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => IDTMFSenderAsyncDelegate - #pragma mark + // + // DTMFSender => IDTMFSenderAsyncDelegate + // protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => (internal) - #pragma mark + // + // DTMFSender => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isClosed() const { return isShuttingDown() || isShutdown(); } - bool isShuttingDown() const; - bool isShutdown() const; + bool isClosed() const noexcept { return isShuttingDown() || isShutdown(); } + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); + void step() noexcept; - bool stepSubscribeSender(); + bool stepSubscribeSender() noexcept; - void cancel(); + void cancel() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTMFSender => (data) - #pragma mark + // + // DTMFSender => (data) + // AutoPUID mID; DTMFSenderWeakPtr mThisWeak; @@ -225,18 +222,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDTMFSenderFactory - #pragma mark + // + // IDTMFSenderFactory + // interaction IDTMFSenderFactory { - static IDTMFSenderFactory &singleton(); + static IDTMFSenderFactory &singleton() noexcept; virtual DTMFSenderPtr create( IDTMFSenderDelegatePtr delegate, IRTPSenderPtr sender - ); + ) noexcept; }; class DTMFSenderFactory : public IFactory {}; diff --git a/ortc/internal/ortc_DataChannel.h b/ortc/internal/ortc_DataChannel.h index f6bba105..2488404c 100644 --- a/ortc/internal/ortc_DataChannel.h +++ b/ortc/internal/ortc_DataChannel.h @@ -59,54 +59,58 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelForSCTPTransport - #pragma mark + // + // IDataChannelForSCTPTransport + // interaction IDataChannelForSCTPTransport { - ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, ForDataTransport) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, ForDataTransport); - ZS_DECLARE_TYPEDEF_PTR(IDataChannelTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelTypes::Parameters, Parameters); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel, UseDataTransport) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel, UseDataTransport); - static ElementPtr toDebug(ForDataTransportPtr dataChannel); + static ElementPtr toDebug(ForDataTransportPtr dataChannel) noexcept; static ForDataTransportPtr create( UseDataTransportPtr transport, WORD sessionID - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual bool isIncoming() const = 0; + virtual bool isIncoming() const noexcept = 0; - virtual bool handleSCTPPacket(SCTPPacketIncomingPtr packet) = 0; + virtual bool handleSCTPPacket(SCTPPacketIncomingPtr packet) noexcept = 0; - virtual void requestShutdown() = 0; - virtual void notifyClosed() = 0; + virtual void requestShutdown() noexcept = 0; + virtual void notifyClosed() noexcept = 0; + + virtual void notifyRemapFailure() noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelAsyncDelegate - #pragma mark + // + // IDataChannelAsyncDelegate + // interaction IDataChannelAsyncDelegate { virtual void onRequestShutdown() = 0; virtual void onNotifiedClosed() = 0; + virtual void onNotifiedRemapFailure() = 0; }; } } ZS_DECLARE_PROXY_BEGIN(ortc::internal::IDataChannelAsyncDelegate) -ZS_DECLARE_PROXY_METHOD_0(onRequestShutdown) -ZS_DECLARE_PROXY_METHOD_0(onNotifiedClosed) +ZS_DECLARE_PROXY_METHOD(onRequestShutdown) +ZS_DECLARE_PROXY_METHOD(onNotifiedClosed) +ZS_DECLARE_PROXY_METHOD(onNotifiedRemapFailure) ZS_DECLARE_PROXY_END() namespace ortc @@ -117,9 +121,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel - #pragma mark + // + // DataChannel + // class DataChannel : public Noop, public MessageQueueAssociator, @@ -157,180 +161,183 @@ namespace ortc UseDataTransportPtr transport, ParametersPtr params, WORD sessionID = ORTC_SCTP_INVALID_DATA_CHANNEL_SESSION_ID - ); + ) noexcept; protected: - DataChannel(Noop) : + DataChannel(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~DataChannel(); + virtual ~DataChannel() noexcept; - static DataChannelPtr convert(IDataChannelPtr object); - static DataChannelPtr convert(ForDataTransportPtr object); + static DataChannelPtr convert(IDataChannelPtr object) noexcept; + static DataChannelPtr convert(ForDataTransportPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannel - #pragma mark + // + // DataChannel => IDataChannel + // - static ElementPtr toDebug(DataChannelPtr transport); + static ElementPtr toDebug(DataChannelPtr transport) noexcept; static DataChannelPtr create( IDataChannelDelegatePtr delegate, IDataTransportPtr transport, const Parameters ¶ms - ); + ) noexcept(false); // throws InvalidParameters - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IDataChannelSubscriptionPtr subscribe(IDataChannelDelegatePtr delegate) override; + IDataChannelSubscriptionPtr subscribe(IDataChannelDelegatePtr delegate) noexcept override; - virtual IDataTransportPtr transport() const override; + IDataTransportPtr transport() const noexcept override; - virtual ParametersPtr parameters() const override; + ParametersPtr parameters() const noexcept override; - virtual States readyState() const override; + States readyState() const noexcept override; - virtual size_t bufferedAmount() const override; - virtual size_t bufferedAmountLowThreshold() const override; - virtual void bufferedAmountLowThreshold(size_t value) override; + size_t bufferedAmount() const noexcept override; + size_t bufferedAmountLowThreshold() const noexcept override; + void bufferedAmountLowThreshold(size_t value) noexcept override; - virtual String binaryType() const override; - virtual void binaryType(const char *str) override; + String binaryType() const noexcept override; + void binaryType(const char *str) noexcept override; - virtual void close() override; + void close() noexcept override; - virtual void send(const String &data) override; - virtual void send(const SecureByteBlock &data) override; - virtual void send( - const BYTE *buffer, - size_t bufferSizeInBytes - ) override; + void send(const String &data) noexcept override; + void send(const SecureByteBlock &data) noexcept override; + void send( + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept(false) override; // throws InvalidParameters //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IStatsProvider - #pragma mark + // + // DataChannel => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelForSCTPTransport - #pragma mark + // + // DataChannel => IDataChannelForSCTPTransport + // // (duplicate) static ElementPtr toDebug(DataChannelPtr transport); static ForDataTransportPtr create( UseDataTransportPtr transport, WORD sessionID - ); + ) noexcept; // (duplicate) virtual PUID getID() const = 0; - virtual bool isIncoming() const override {return mIncoming;} + bool isIncoming() const noexcept override {return mIncoming;} + + bool handleSCTPPacket(SCTPPacketIncomingPtr packet) noexcept override; - virtual bool handleSCTPPacket(SCTPPacketIncomingPtr packet) override; + void requestShutdown() noexcept override; + void notifyClosed() noexcept override; - virtual void requestShutdown() override; - virtual void notifyClosed() override; + void notifyRemapFailure() noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => ISCTPTransportForDataChannelDelegate - #pragma mark + // + // DataChannel => ISCTPTransportForDataChannelDelegate + // - virtual void onSCTPTransportStateChanged() override; + void onSCTPTransportStateChanged() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelAsyncDelegate - #pragma mark + // + // DataChannel => IDataChannelAsyncDelegate + // - virtual void onRequestShutdown() override; - virtual void onNotifiedClosed() override; + void onRequestShutdown() override; + void onNotifiedClosed() override; + void onNotifiedRemapFailure() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IWakeDelegate - #pragma mark + // + // DataChannel => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IPromiseSettledDelegate - #pragma mark + // + // DataChannel => IPromiseSettledDelegate + // - virtual void onPromiseSettled(PromisePtr promise) override; + void onPromiseSettled(PromisePtr promise) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => IDataChannelAsyncDelegate - #pragma mark + // + // DataChannel => IDataChannelAsyncDelegate + // protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => (internal) - #pragma mark + // + // DataChannel => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isOpen() const; - bool isShuttingDown() const; - bool isShutdown() const; + bool isOpen() const noexcept; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - bool stepSCTPTransport(); - bool stepIssueConnect(); - bool stepWaitConnectAck(); - bool stepOpen(); - bool stepSendData(bool onlyControlPackets = false); - bool stepDeliveryIncomingPacket(); + void step() noexcept; + bool stepSCTPTransport() noexcept; + bool stepIssueConnect() noexcept; + bool stepWaitConnectAck() noexcept; + bool stepOpen() noexcept; + bool stepSendData(bool onlyControlPackets = false) noexcept; + bool stepDeliveryIncomingPacket() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; bool send( SCTPPayloadProtocolIdentifier ppid, const BYTE *buffer, size_t bufferSizeInBytes - ); + ) noexcept; - void sendControlOpen(); - void sendControlAck(); + void sendControlOpen() noexcept; + void sendControlAck() noexcept; bool deliverOutgoing( SCTPPacketOutgoingPtr packet, bool fixPacket = true - ); + ) noexcept; - bool handleOpenPacket(SecureByteBlock &buffer); - bool handleAckPacket(SecureByteBlock &buffer); - void forwardDataPacketAsEvent(const SCTPPacketIncoming &packet); + bool handleOpenPacket(SecureByteBlock &buffer) noexcept; + bool handleAckPacket(SecureByteBlock &buffer) noexcept; + void forwardDataPacketAsEvent(const SCTPPacketIncoming &packet) noexcept; - void outgoingPacketAdded(SCTPPacketOutgoingPtr packet); - void outgoingPacketRemoved(SCTPPacketOutgoingPtr packet); + void outgoingPacketAdded(SCTPPacketOutgoingPtr packet) noexcept; + void outgoingPacketRemoved(SCTPPacketOutgoingPtr packet) noexcept; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel::TearAwayData - #pragma mark + // + // DataChannel::TearAwayData + // struct TearAwayData { @@ -339,9 +346,9 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark DataChannel => (data) - #pragma mark + // + // DataChannel => (data) + // AutoPUID mID; DataChannelWeakPtr mThisWeak; @@ -381,30 +388,30 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataChannelFactory - #pragma mark + // + // IDataChannelFactory + // interaction IDataChannelFactory { - ZS_DECLARE_TYPEDEF_PTR(IDataChannelTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelTypes::Parameters, Parameters); - ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, ForDataTransport) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, ForDataTransport); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel, UseDataTransport) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel, UseDataTransport); - static IDataChannelFactory &singleton(); + static IDataChannelFactory &singleton() noexcept; virtual DataChannelPtr create( IDataChannelDelegatePtr delegate, IDataTransportPtr transport, const Parameters ¶ms - ); + ) noexcept(false); // throws InvalidParameters, InvalidStateError virtual ForDataTransportPtr create( UseDataTransportPtr transport, WORD sessionID - ); + ) noexcept; }; class DataChannelFactory : public IFactory {}; @@ -424,19 +431,19 @@ ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::IDataChannelTypes::States, States) ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::SecureByteBlock, SecureByteBlock) ZS_DECLARE_TEAR_AWAY_TYPEDEF(zsLib::String, String) ZS_DECLARE_TEAR_AWAY_TYPEDEF(zsLib::BYTE, BYTE) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_1(getStats, PromiseWithStatsReportPtr, const StatsTypeSet &) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(getID, PUID) -ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_1(subscribe, IDataChannelSubscriptionPtr, IDataChannelDelegatePtr) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(transport, IDataTransportPtr) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(parameters, ParametersPtr) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(readyState, States) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(binaryType, String) -ZS_DECLARE_TEAR_AWAY_METHOD_1(binaryType, const char *) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(bufferedAmount, size_t) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(bufferedAmountLowThreshold, size_t) -ZS_DECLARE_TEAR_AWAY_METHOD_1(bufferedAmountLowThreshold, size_t) -ZS_DECLARE_TEAR_AWAY_METHOD_0(close) -ZS_DECLARE_TEAR_AWAY_METHOD_1(send, const String &) -ZS_DECLARE_TEAR_AWAY_METHOD_1(send, const SecureByteBlock &) -ZS_DECLARE_TEAR_AWAY_METHOD_2(send, const BYTE *, size_t) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(getStats, PromiseWithStatsReportPtr, const StatsTypeSet &) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(getID, PUID) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN(subscribe, IDataChannelSubscriptionPtr, IDataChannelDelegatePtr) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(transport, IDataTransportPtr) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(parameters, ParametersPtr) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(readyState, States) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(binaryType, String) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC(binaryType, const char *) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(bufferedAmount, size_t) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(bufferedAmountLowThreshold, size_t) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC(bufferedAmountLowThreshold, size_t) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC(close) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC(send, const String &) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC(send, const SecureByteBlock &) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC_THROWS(send, const BYTE *, size_t) ZS_DECLARE_TEAR_AWAY_END() diff --git a/ortc/internal/ortc_Helper.h b/ortc/internal/ortc_Helper.h index 36939ffe..2fd86a23 100644 --- a/ortc/internal/ortc_Helper.h +++ b/ortc/internal/ortc_Helper.h @@ -43,14 +43,14 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Helper - #pragma mark + // + // Helper + // class Helper : public IHelper { public: - static Log::Params slog(const char *message); + static Log::Params slog(const char *message) noexcept; }; } } diff --git a/ortc/internal/ortc_ICEGatherer.h b/ortc/internal/ortc_ICEGatherer.h index a99a21c2..d4667169 100644 --- a/ortc/internal/ortc_ICEGatherer.h +++ b/ortc/internal/ortc_ICEGatherer.h @@ -100,76 +100,76 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererForICETransport - #pragma mark + // + // IICEGathererForICETransport + // interaction IICEGathererForICETransport { - ZS_DECLARE_TYPEDEF_PTR(IICEGathererForICETransport, ForICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICEGathererForICETransport, ForICETransport); - ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, UseICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, UseICETransport); - ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateList, CandidateList) + ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateList, CandidateList); typedef IICEGatherer::States States; - ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute) + ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute); - static ElementPtr toDebug(ForICETransportPtr gatherer); + static ElementPtr toDebug(ForICETransportPtr gatherer) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IICETypes::Components component() const = 0; - virtual States state() const = 0; + virtual IICETypes::Components component() const noexcept = 0; + virtual States state() const noexcept = 0; virtual void installTransport( ICETransportPtr transport, const String &remoteUFrag - ) = 0; - virtual void notifyTransportStateChange(ICETransportPtr transport) = 0; - virtual void removeTransport(ICETransport &transport) = 0; + ) noexcept = 0; + virtual void notifyTransportStateChange(ICETransportPtr transport) noexcept = 0; + virtual void removeTransport(ICETransport &transport) noexcept = 0; - virtual ForICETransportPtr getRTCPGatherer() const = 0; + virtual ForICETransportPtr getRTCPGatherer() const noexcept = 0; - virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) = 0; + virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) noexcept = 0; - virtual bool isContinousGathering() const = 0; - virtual String getUsernameFrag() const = 0; - virtual String getPassword() const = 0; + virtual bool isContinousGathering() const noexcept = 0; + virtual String getUsernameFrag() const noexcept = 0; + virtual String getPassword() const noexcept = 0; - virtual CandidateListPtr getLocalCandidates() const = 0; + virtual CandidateListPtr getLocalCandidates() const noexcept = 0; - virtual ICEGathererRouterPtr getGathererRouter() const = 0; + virtual ICEGathererRouterPtr getGathererRouter() const noexcept = 0; - virtual void removeRoute(RouterRoutePtr routerRoute) = 0; - virtual void remoteAllRelatedRoutes(ICETransport &transport) = 0; + virtual void removeRoute(RouterRoutePtr routerRoute) noexcept = 0; + virtual void remoteAllRelatedRoutes(ICETransport &transport) noexcept = 0; virtual bool sendPacket( UseICETransport &transport, RouterRoutePtr routerRoute, const BYTE *buffer, size_t bufferSizeInBytes - ) = 0; + ) noexcept = 0; - virtual void notifyLikelyReflexiveActivity(RouterRoutePtr routerRoute) = 0; + virtual void notifyLikelyReflexiveActivity(RouterRoutePtr routerRoute) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IGathererAsyncDelegate - #pragma mark + // + // IGathererAsyncDelegate + // interaction IGathererAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, UseICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, UseICETransport); virtual void onNotifyDeliverRouteBufferedPackets( UseICETransportPtr transport, PUID routerRouteID - ) = 0; + ) = 0; virtual void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise) = 0; }; @@ -177,9 +177,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer - #pragma mark + // + // ICEGatherer + // class ICEGatherer : public Noop, public MessageQueueAssociator, @@ -217,8 +217,8 @@ namespace ortc InternalState_Shutdown, }; - static const char *toString(InternalStates state); - static States toState(InternalStates state); + static const char *toString(InternalStates state) noexcept; + static States toState(InternalStates state) noexcept; enum InterfaceTypes { @@ -234,8 +234,8 @@ namespace ortc InterfaceType_Last = InterfaceType_VPN }; - static const char *toString(InterfaceTypes type); - static InterfaceTypes toInterfaceType(const char *type); + static const char *toString(InterfaceTypes type) noexcept; + static InterfaceTypes toInterfaceType(const char *type) noexcept; enum AddressFamilies { @@ -246,8 +246,8 @@ namespace ortc AddressFamily_Last = AddressFamily_IPv6 }; - static const char *toString(AddressFamilies family); - static AddressFamilies toAddressFamily(const char *family); + static const char *toString(AddressFamilies family) noexcept; + static AddressFamilies toAddressFamily(const char *family) noexcept; enum PreferenceTypes { @@ -258,17 +258,17 @@ namespace ortc PreferenceType_Last = PreferenceType_Unfreeze }; - static const char *toString(PreferenceTypes family); - static PreferenceTypes toPreferenceType(const char *family); - - ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, UseICETransport) - ZS_DECLARE_TYPEDEF_PTR(ortc::services::ISTUNDiscovery, UseSTUNDiscovery) - ZS_DECLARE_TYPEDEF_PTR(ortc::services::ITURNSocket, UseTURNSocket) - ZS_DECLARE_TYPEDEF_PTR(ortc::services::IBackOffTimer, UseBackOffTimer) - ZS_DECLARE_TYPEDEF_PTR(zsLib::Socket, Socket) - ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate) - ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateList, CandidateList) - ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute) + static const char *toString(PreferenceTypes family) noexcept; + static PreferenceTypes toPreferenceType(const char *family) noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, UseICETransport); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::ISTUNDiscovery, UseSTUNDiscovery); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::ITURNSocket, UseTURNSocket); + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IBackOffTimer, UseBackOffTimer); + ZS_DECLARE_TYPEDEF_PTR(zsLib::Socket, Socket); + ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate); + ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateList, CandidateList); + ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute); typedef std::list IPAddressList; @@ -342,188 +342,188 @@ namespace ortc ICEGatherer( const make_private &, const ConstructorOptions &options - ); + ) noexcept; protected: - ICEGatherer(Noop) : + ICEGatherer(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~ICEGatherer(); + virtual ~ICEGatherer() noexcept; - static ICEGathererPtr convert(IICEGathererPtr object); - static ICEGathererPtr convert(ForICETransportPtr object); + static ICEGathererPtr convert(IICEGathererPtr object) noexcept; + static ICEGathererPtr convert(ForICETransportPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IStatsProvider - #pragma mark + // + // ICEGatherer => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IICETransport - #pragma mark + // + // ICEGatherer => IICETransport + // - static ElementPtr toDebug(ICEGathererPtr gatherer); + static ElementPtr toDebug(ICEGathererPtr gatherer) noexcept; static ICEGathererPtr create( IICEGathererDelegatePtr delegate, const Options &options - ); + ) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) override; + IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) noexcept override; - virtual Components component() const override; - virtual States state() const override; + Components component() const noexcept override; + States state() const noexcept override; - virtual ParametersPtr getLocalParameters() const override; - virtual CandidateListPtr getLocalCandidates() const override; + ParametersPtr getLocalParameters() const noexcept override; + CandidateListPtr getLocalCandidates() const noexcept override; - virtual IICEGathererPtr createAssociatedGatherer(IICEGathererDelegatePtr delegate) throw(InvalidStateError) override; + IICEGathererPtr createAssociatedGatherer(IICEGathererDelegatePtr delegate) noexcept(false) override; // throws InvalidStateError - virtual void gather(const Optional &options = Optional()) override; + void gather(const Optional &options = Optional()) noexcept override; - virtual void close() override; + void close() noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IICEGathererForICETransport - #pragma mark + // + // ICEGatherer => IICEGathererForICETransport + // // (duplicate) virtual PUID getID() const; // (duplicate) virtual Components component() const = 0; // (duplicate) virtual States state() const = 0; - virtual void installTransport( - ICETransportPtr transport, - const String &remoteUFrag - ) override; - virtual void notifyTransportStateChange(ICETransportPtr transport) override; - virtual void removeTransport(ICETransport &transport) override; + void installTransport( + ICETransportPtr transport, + const String &remoteUFrag + ) noexcept override; + void notifyTransportStateChange(ICETransportPtr transport) noexcept override; + void removeTransport(ICETransport &transport) noexcept override; - virtual ForICETransportPtr getRTCPGatherer() const override; + ForICETransportPtr getRTCPGatherer() const noexcept override; - // (duplicate) virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) = 0; - // (duplicate) virtual CandidateListPtr getLocalCandidates() const = 0; + // (duplicate) virtual IICEGathererSubscriptionPtr subscribe(IICEGathererDelegatePtr delegate) noexcept = 0; + // (duplicate) virtual CandidateListPtr getLocalCandidates() const noexcept = 0; - virtual bool isContinousGathering() const override; - virtual String getUsernameFrag() const override {return mUsernameFrag;} - virtual String getPassword() const override {return mPassword;} + bool isContinousGathering() const noexcept override; + String getUsernameFrag() const noexcept override {return mUsernameFrag;} + String getPassword() const noexcept override {return mPassword;} - virtual ICEGathererRouterPtr getGathererRouter() const override; + ICEGathererRouterPtr getGathererRouter() const noexcept override; - virtual void removeRoute(RouterRoutePtr routerRoute) override; - virtual void remoteAllRelatedRoutes(ICETransport &transport) override; + void removeRoute(RouterRoutePtr routerRoute) noexcept override; + void remoteAllRelatedRoutes(ICETransport &transport) noexcept override; - virtual bool sendPacket( - UseICETransport &transport, - RouterRoutePtr routerRoute, - const BYTE *buffer, - size_t bufferSizeInBytes - ) override; + bool sendPacket( + UseICETransport &transport, + RouterRoutePtr routerRoute, + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept override; - virtual void notifyLikelyReflexiveActivity(RouterRoutePtr routerRoute) override; + void notifyLikelyReflexiveActivity(RouterRoutePtr routerRoute) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IGathererAsyncDelegate - #pragma mark + // + // ICEGatherer => IGathererAsyncDelegate + // - virtual void onNotifyDeliverRouteBufferedPackets( - UseICETransportPtr transport, - PUID routerRouteID - ) override; + void onNotifyDeliverRouteBufferedPackets( + UseICETransportPtr transport, + PUID routerRouteID + ) override; - virtual void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise) override; + void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IWakeDelegate - #pragma mark + // + // ICEGatherer => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IDNSDelegate - #pragma mark + // + // ICEGatherer => IDNSDelegate + // - virtual void onLookupCompleted(IDNSQueryPtr query) override; + void onLookupCompleted(IDNSQueryPtr query) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ITimerDelegate - #pragma mark + // + // ICEGatherer => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ISocketDelegate - #pragma mark + // + // ICEGatherer => ISocketDelegate + // - virtual void onReadReady(SocketPtr socket) override; - virtual void onWriteReady(SocketPtr socket) override; - virtual void onException(SocketPtr socket) override; + void onReadReady(SocketPtr socket) override; + void onWriteReady(SocketPtr socket) override; + void onException(SocketPtr socket) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => IBackOffDelegate - #pragma mark + // + // ICEGatherer => IBackOffDelegate + // - virtual void onBackOffTimerStateChanged( - IBackOffTimerPtr timer, - IBackOffTimer::States state - ) override; + void onBackOffTimerStateChanged( + IBackOffTimerPtr timer, + IBackOffTimer::States state + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ISTUNDiscoveryDelegate - #pragma mark + // + // ICEGatherer => ISTUNDiscoveryDelegate + // - virtual void onSTUNDiscoverySendPacket( - ISTUNDiscoveryPtr discovery, - IPAddress destination, - SecureByteBlockPtr packet - ) override; + void onSTUNDiscoverySendPacket( + ISTUNDiscoveryPtr discovery, + IPAddress destination, + SecureByteBlockPtr packet + ) override; - virtual void onSTUNDiscoveryCompleted(ISTUNDiscoveryPtr discovery) override; + void onSTUNDiscoveryCompleted(ISTUNDiscoveryPtr discovery) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => ITURNSocketDelegate - #pragma mark + // + // ICEGatherer => ITURNSocketDelegate + // - virtual void onTURNSocketStateChanged( - ITURNSocketPtr socket, - TURNSocketStates state - ) override; + void onTURNSocketStateChanged( + ITURNSocketPtr socket, + TURNSocketStates state + ) override; - virtual void handleTURNSocketReceivedPacket( - ITURNSocketPtr socket, - IPAddress source, - const BYTE *packet, - size_t packetLengthInBytes - ) override; + void handleTURNSocketReceivedPacket( + ITURNSocketPtr socket, + IPAddress source, + const BYTE *packet, + size_t packetLengthInBytes + ) noexcept override; - virtual bool notifyTURNSocketSendPacket( - ITURNSocketPtr socket, - IPAddress destination, - const BYTE *packet, - size_t packetLengthInBytes - ) override; + bool notifyTURNSocketSendPacket( + ITURNSocketPtr socket, + IPAddress destination, + const BYTE *packet, + size_t packetLengthInBytes + ) noexcept override; - virtual void onTURNSocketWriteReady(ITURNSocketPtr socket) override; + void onTURNSocketWriteReady(ITURNSocketPtr socket) override; public: @@ -531,9 +531,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::SocketDelegate - #pragma mark + // + // ICEGatherer::SocketDelegate + // struct SocketDelegate : public zsLib::MessageQueueAssociator, public zsLib::ISocketDelegate @@ -546,7 +546,7 @@ namespace ortc const make_private &, IMessageQueuePtr queue, ICEGathererPtr gatherer - ) : + ) noexcept : MessageQueueAssociator(queue), iceGatherer_(gatherer) { @@ -555,27 +555,27 @@ namespace ortc static SocketDelegatePtr create( IMessageQueuePtr queue, ICEGathererPtr gatherer - ) + ) noexcept { auto pThis(std::make_shared(make_private{}, queue, gatherer)); return pThis; } - virtual void onReadReady(SocketPtr socket) override + void onReadReady(SocketPtr socket) override { auto outer = iceGatherer_.lock(); if (!outer) return; outer->onReadReady(socket); } - virtual void onWriteReady(SocketPtr socket) override + void onWriteReady(SocketPtr socket) override { auto outer = iceGatherer_.lock(); if (!outer) return; outer->onWriteReady(socket); } - virtual void onException(SocketPtr socket) override + void onException(SocketPtr socket) override { auto outer = iceGatherer_.lock(); if (!outer) return; @@ -590,9 +590,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::HostIPSorter - #pragma mark + // + // ICEGatherer::HostIPSorter + // class HostIPSorter { @@ -601,9 +601,9 @@ namespace ortc typedef ULONG OrderID; typedef String InterfaceName; - ZS_DECLARE_STRUCT_PTR(Data) - ZS_DECLARE_STRUCT_PTR(QueryData) - ZS_DECLARE_STRUCT_PTR(InterfaceNameMappingInfo) + ZS_DECLARE_STRUCT_PTR(Data); + ZS_DECLARE_STRUCT_PTR(QueryData); + ZS_DECLARE_STRUCT_PTR(InterfaceNameMappingInfo); //--------------------------------------------------------------------- struct Data { @@ -619,7 +619,7 @@ namespace ortc ULONG mIndex {}; bool mIsTemporaryIP {false}; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //--------------------------------------------------------------------- @@ -637,12 +637,12 @@ namespace ortc InterfaceTypes mInterfaceType {InterfaceType_Unknown}; OrderID mOrderIndex {}; - static InterfaceNameMappingInfo create(ElementPtr el); + static InterfaceNameMappingInfo create(ElementPtr el) noexcept; - ElementPtr createElement(const char *objectName = "interface") const; - bool hasData() const; + ElementPtr createElement(const char *objectName = "interface") const noexcept; + bool hasData() const noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::list DataList; @@ -652,17 +652,17 @@ namespace ortc typedef std::list InterfaceMappingList; - static bool compareLocalIPs(const DataPtr &data1, const DataPtr &data2); + static bool compareLocalIPs(const DataPtr &data1, const DataPtr &data2) noexcept; static DataPtr prepare( const IPAddress &ip, const Options &options - ); + ) noexcept; static DataPtr prepare( const char *hostName, const IPAddress &ip, const Options &options - ); + ) noexcept; static DataPtr prepare( const char *interfaceName, @@ -670,7 +670,7 @@ namespace ortc const IPAddress &ip, const InterfaceMappingList &prefs, const Options &options - ); + ) noexcept; static DataPtr prepare( const char *interfaceName, const char *interfaceDescription, @@ -678,34 +678,34 @@ namespace ortc ULONG metric, const InterfaceMappingList &prefs, const Options &options - ); + ) noexcept; static DataPtr prepare( const char *interfaceName, const IPAddress &ip, const InterfaceMappingList &prefs, const Options &options - ); + ) noexcept; static void fixMapping( Data &ioData, const InterfaceMappingList &prefs - ); + ) noexcept; static void fixPolicy( Data &ioData, const Options &options - ); - static void sort(DataList &ioDataList); + ) noexcept; + static void sort(DataList &ioDataList) noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::ReflexivePort - #pragma mark + // + // ICEGatherer::ReflexivePort + // struct ReflexivePort { @@ -720,16 +720,16 @@ namespace ortc Time mLastActivity; ITimerPtr mInactivityTimer; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::RelayPort - #pragma mark + // + // ICEGatherer::RelayPort + // struct RelayPort { @@ -746,16 +746,16 @@ namespace ortc Time mLastActivity; ITimerPtr mInactivityTimer; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::HostPort - #pragma mark + // + // ICEGatherer::HostPort + // struct HostPort { @@ -789,16 +789,16 @@ namespace ortc SocketToTCPPortMap mTCPPorts; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::TCPPort - #pragma mark + // + // ICEGatherer::TCPPort + // struct TCPPort { @@ -818,16 +818,16 @@ namespace ortc TransportID mTransportID {0}; UseICETransportWeakPtr mTransport; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::BufferedPacket - #pragma mark + // + // ICEGatherer::BufferedPacket + // struct BufferedPacket { @@ -839,16 +839,16 @@ namespace ortc SecureByteBlockPtr mBuffer; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::Route - #pragma mark + // + // ICEGatherer::Route + // struct Route { @@ -868,33 +868,36 @@ namespace ortc RelayPortPtr mRelayPort; // send via relay port TCPPortPtr mTCPPort; // send via TCP socket - void trace(const char *function, const char *message = NULL) const; - ElementPtr toDebug() const; + void trace( + const char *function = NULL, + const char *message = NULL + ) const noexcept; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::InstalledTransport - #pragma mark + // + // ICEGatherer::InstalledTransport + // struct InstalledTransport { TransportID mTransportID {}; UseICETransportWeakPtr mTransport; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer::Preference - #pragma mark + // + // ICEGatherer::Preference + // struct Preference { @@ -905,90 +908,90 @@ namespace ortc DWORD *mInterfaceTypePreferences {NULL}; DWORD *mAddressFamilyPreferences {NULL}; - Preference(); - Preference(PreferenceTypes type); - ~Preference(); + Preference() noexcept; + Preference(PreferenceTypes type) noexcept; + ~Preference() noexcept; void getSettingsPrefixes( const char * &outCandidateType, const char * &outProtocolType, const char * &outInterfaceType, const char * &outAddressFamily - ) const; - void load(); - void save() const; + ) const noexcept; + void load() noexcept; + void save() const noexcept; - Log::Params log(const char *message) const; - ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + ElementPtr toDebug() const noexcept; }; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => (internal) - #pragma mark - - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - ElementPtr toDebug() const; - - bool isComplete() const; - bool isShuttingDown() const; - bool isShutdown() const; - - void step(); - bool stepRecheckIPTimer(); - bool stepCalculateOptionsHash(); - bool stepResolveHostIPs(); - bool stepGetHostIPs(); - void stepGetHostIPs_WinRT(); - void stepGetHostIPs_Win32(); - void stepGetHostIPs_ifaddr(); - bool stepCalculateHostsHash(); - bool stepFixHostPorts(); - bool stepBindHostPorts(); - bool stepCheckTransportsNeedWarmth(); - bool stepWarmUpAfterInterfaceBinding(); - bool stepSetupReflexive(); - bool stepTearDownReflexive(); - bool stepSetupRelay(); - bool stepTearDownRelay(); - bool stepCleanPendingShutdownTURNSockets(); - bool stepCheckIfReady(); - - void cancel(); - - void setState(InternalStates state); - void setError(WORD error, const char *reason = NULL); - - bool hasSTUNServers(); - bool hasTURNServers(); + // + // ICETransport => (internal) + // + + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + ElementPtr toDebug() const noexcept; + + bool isComplete() const noexcept; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; + + void step() noexcept; + bool stepRecheckIPTimer() noexcept; + bool stepCalculateOptionsHash() noexcept; + bool stepResolveHostIPs() noexcept; + bool stepGetHostIPs() noexcept; + void stepGetHostIPs_WinUWP() noexcept; + void stepGetHostIPs_Win32() noexcept; + void stepGetHostIPs_ifaddr() noexcept; + bool stepCalculateHostsHash() noexcept; + bool stepFixHostPorts() noexcept; + bool stepBindHostPorts() noexcept; + bool stepCheckTransportsNeedWarmth() noexcept; + bool stepWarmUpAfterInterfaceBinding() noexcept; + bool stepSetupReflexive() noexcept; + bool stepTearDownReflexive() noexcept; + bool stepSetupRelay() noexcept; + bool stepTearDownRelay() noexcept; + bool stepCleanPendingShutdownTURNSockets() noexcept; + bool stepCheckIfReady() noexcept; + + void cancel() noexcept; + + void setState(InternalStates state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; + + bool hasSTUNServers() noexcept; + bool hasTURNServers() noexcept; bool isServerType( const Server &server, const char *urlPrefix - ) const; + ) const noexcept; StringList createDNSLookupString( const Server &server, const char *urlPrefix - ) const; + ) const noexcept; - bool needsHostPort(HostIPSorter::DataPtr hostData); + bool needsHostPort(HostIPSorter::DataPtr hostData) noexcept; - void shutdown(HostPortPtr hostPort); + void shutdown(HostPortPtr hostPort) noexcept; void shutdown( ReflexivePortPtr reflexivePort, HostPortPtr ownerHostPort - ); + ) noexcept; void shutdown( RelayPortPtr relayPort, HostPortPtr ownerHostPort - ); + ) noexcept; void shutdown( TCPPortPtr tcpPort, HostPortPtr ownerHostPort - ); + ) noexcept; void bind( SocketPtr &outSocket, @@ -996,7 +999,7 @@ namespace ortc bool firstAttempt, IPAddress &ioBindIP, IICETypes::Protocols protocol - ); + ) noexcept; CandidatePtr createCandidate( HostIPSorter::DataPtr hostData, @@ -1004,7 +1007,7 @@ namespace ortc const IPAddress &boundIP, IICETypes::Protocols protocol = IICETypes::Protocol_UDP, IICETypes::TCPCandidateTypes tcpType = IICETypes::TCPCandidateType_Active - ); + ) noexcept; CandidatePtr createCandidate( HostIPSorter::DataPtr hostData, IICETypes::CandidateTypes candidateType, @@ -1012,75 +1015,75 @@ namespace ortc const IPAddress &relatedIP, const IPAddress &boundIP, const Server &server - ); + ) noexcept; void addCandidate( const HostIPSorter::Data &hostData, const IPAddress &ip, CandidatePtr candidate - ); - void removeCandidate(CandidatePtr candidate); + ) noexcept; + void removeCandidate(CandidatePtr candidate) noexcept; bool isFiltered( FilterPolicies policy, const IPAddress &ip, const Candidate &candidate - ) const; + ) const noexcept; bool read( HostPortPtr hostPort, SocketPtr socket - ); + ) noexcept; void read( HostPort &hostPort, TCPPort &tcpPort - ); + ) noexcept; void write( HostPort &hostPort, SocketPtr socket - ); - bool writeIfTCPPort(SocketPtr socket); + ) noexcept; + bool writeIfTCPPort(SocketPtr socket) noexcept; void close( HostPortPtr hostPort, SocketPtr socket - ); + ) noexcept; void close( TCPPortPtr tcpPort, HostPortPtr hostPort - ); + ) noexcept; SecureByteBlockPtr handleIncomingPacket( CandidatePtr localCandidate, const IPAddress &remoteIP, STUNPacketPtr stunPacket - ); + ) noexcept; void handleIncomingPacket( CandidatePtr localCandidate, const IPAddress &remoteIP, const BYTE *buffer, size_t bufferSizeInBytes - ); + ) noexcept; - CandidatePtr findSentFromLocalCandidate(RouterRoutePtr routerRoute); + CandidatePtr findSentFromLocalCandidate(RouterRoutePtr routerRoute) noexcept; RoutePtr installRoute( RouterRoutePtr routerRoute, UseICETransportPtr transport - ); + ) noexcept; RoutePtr installRoute( CandidatePtr sentFromLocalCandidate, const IPAddress &remoteIP, UseICETransportPtr transport - ); + ) noexcept; - void fix(STUNPacketPtr stunPacket) const; + void fix(STUNPacketPtr stunPacket) const noexcept; void removeAllRelatedRoutes( TransportID transportID, UseICETransportPtr transportIfAvailable - ); + ) noexcept; bool sendUDPPacket( SocketPtr socket, @@ -1088,18 +1091,18 @@ namespace ortc const IPAddress &remoteIP, const BYTE *buffer, size_t bufferSizeInBytes - ); + ) noexcept; - bool shouldKeepWarm() const; - bool shouldWarmUpAfterInterfaceBinding() const; + bool shouldKeepWarm() const noexcept; + bool shouldWarmUpAfterInterfaceBinding() const noexcept; - void fixSTUNParserOptions(const STUNPacketPtr &packet); + void fixSTUNParserOptions(const STUNPacketPtr &packet) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => (data) - #pragma mark + // + // ICETransport => (data) + // ICEGathererWeakPtr mThisWeak; AutoPUID mID; @@ -1206,18 +1209,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICEGathererFactory - #pragma mark + // + // IICEGathererFactory + // interaction IICEGathererFactory { - static IICEGathererFactory &singleton(); + static IICEGathererFactory &singleton() noexcept; virtual ICEGathererPtr create( IICEGathererDelegatePtr delegate, const IICEGathererTypes::Options &options - ); + ) noexcept; }; class ICEGathererFactory : public IFactory {}; @@ -1227,6 +1230,6 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::internal::IGathererAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IGathererAsyncDelegate::UseICETransportPtr, UseICETransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProvider::PromiseWithStatsReportPtr, PromiseWithStatsReportPtr) -ZS_DECLARE_PROXY_METHOD_2(onNotifyDeliverRouteBufferedPackets, UseICETransportPtr, PUID) -ZS_DECLARE_PROXY_METHOD_1(onResolveStatsPromise, PromiseWithStatsReportPtr) +ZS_DECLARE_PROXY_METHOD(onNotifyDeliverRouteBufferedPackets, UseICETransportPtr, PUID) +ZS_DECLARE_PROXY_METHOD(onResolveStatsPromise, PromiseWithStatsReportPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_ICEGathererRouter.h b/ortc/internal/ortc_ICEGathererRouter.h index e84d5d63..13f7b8f1 100644 --- a/ortc/internal/ortc_ICEGathererRouter.h +++ b/ortc/internal/ortc_ICEGathererRouter.h @@ -47,9 +47,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererRouter - #pragma mark + // + // ICEGathererRouter + // class ICEGathererRouter : public SharedRecursiveLock, public MessageQueueAssociator, @@ -59,9 +59,9 @@ namespace ortc struct make_private {}; public: - ZS_DECLARE_STRUCT_PTR(Route) + ZS_DECLARE_STRUCT_PTR(Route); - ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate) + ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate); typedef String LocalCandidateHash; typedef std::pair CandidateRemoteIPPair; @@ -71,57 +71,57 @@ namespace ortc ICEGathererRouter( const make_private &, IMessageQueuePtr queue - ); + ) noexcept; protected: - void init(); + void init() noexcept; public: - ~ICEGathererRouter(); + ~ICEGathererRouter() noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererRouter => (friends) - #pragma mark + // + // ICEGathererRouter => (friends) + // - static ElementPtr toDebug(ICEGathererRouterPtr router); + static ElementPtr toDebug(ICEGathererRouterPtr router) noexcept; - static ICEGathererRouterPtr create(); + static ICEGathererRouterPtr create() noexcept; - virtual PUID getID() const {return mID;} + virtual PUID getID() const noexcept {return mID;} virtual RoutePtr findRoute( CandidatePtr localCandidate, const IPAddress &remoteIP, bool createRouteIfNeeded - ); + ) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererRouter => ITimerDelegate - #pragma mark + // + // ICEGathererRouter => ITimerDelegate + // void onTimer(ITimerPtr timer); protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererRouter => (internal) - #pragma mark + // + // ICEGathererRouter => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + ElementPtr toDebug() const noexcept; - void cancel(); + void cancel() noexcept; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererRouter::Route - #pragma mark + // + // ICEGathererRouter::Route + // struct Route { @@ -130,15 +130,18 @@ namespace ortc CandidatePtr mLocalCandidate; IPAddress mRemoteIP; - void trace(const char *function, const char *message = NULL) const; - ElementPtr toDebug() const; + void trace( + const char *function = NULL, + const char *message = NULL + ) const noexcept; + ElementPtr toDebug() const noexcept; }; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGathererRouter (data) - #pragma mark + // + // ICEGathererRouter (data) + // AutoPUID mID; ICEGathererRouterWeakPtr mThisWeak; diff --git a/ortc/internal/ortc_ICETransport.h b/ortc/internal/ortc_ICETransport.h index ea44bd8e..9e7a9b5b 100644 --- a/ortc/internal/ortc_ICETransport.h +++ b/ortc/internal/ortc_ICETransport.h @@ -66,146 +66,146 @@ namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IICETransportForSettings) - ZS_DECLARE_INTERACTION_PTR(IICETransportForICEGatherer) - ZS_DECLARE_INTERACTION_PTR(IICETransportForICETransportContoller) - ZS_DECLARE_INTERACTION_PTR(IICETransportForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(IICETransportForDataTransport) + ZS_DECLARE_INTERACTION_PTR(IICETransportForSettings); + ZS_DECLARE_INTERACTION_PTR(IICETransportForICEGatherer); + ZS_DECLARE_INTERACTION_PTR(IICETransportForICETransportContoller); + ZS_DECLARE_INTERACTION_PTR(IICETransportForSecureTransport); + ZS_DECLARE_INTERACTION_PTR(IICETransportForDataTransport); - ZS_DECLARE_INTERACTION_PROXY(IICETransportAsyncDelegate) + ZS_DECLARE_INTERACTION_PROXY(IICETransportAsyncDelegate); - ZS_DECLARE_INTERACTION_PTR(IICEGathererForICETransport) - ZS_DECLARE_INTERACTION_PTR(IICETransportControllerForICETransport) + ZS_DECLARE_INTERACTION_PTR(IICEGathererForICETransport); + ZS_DECLARE_INTERACTION_PTR(IICETransportControllerForICETransport); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForICEGatherer - #pragma mark + // + // IICETransportForICEGatherer + // interaction IICETransportForICEGatherer { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, ForICEGatherer) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForICEGatherer, ForICEGatherer); - ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute) + ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ForICEGathererPtr getForGatherer() const = 0; + virtual ForICEGathererPtr getForGatherer() const noexcept = 0; virtual void notifyPacket( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) = 0; + ) noexcept = 0; virtual void notifyPacket( RouterRoutePtr routerRoute, const BYTE *buffer, size_t bufferSizeInBytes - ) = 0; + ) noexcept = 0; - virtual bool needsMoreCandidates() const = 0; + virtual bool needsMoreCandidates() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForICETransportContoller - #pragma mark + // + // IICETransportForICETransportContoller + // interaction IICETransportForICETransportContoller { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForICETransportContoller, ForTransportContoller) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForICETransportContoller, ForTransportContoller); - static ElementPtr toDebug(ForTransportContollerPtr transport); + static ElementPtr toDebug(ForTransportContollerPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void notifyControllerAttached(ICETransportControllerPtr controller) = 0; - virtual void notifyControllerDetached(ICETransportController &controller) = 0; + virtual void notifyControllerAttached(ICETransportControllerPtr controller) noexcept = 0; + virtual void notifyControllerDetached(ICETransportController &controller) noexcept = 0; virtual bool hasCandidatePairFoundation( const String &localFoundation, const String &remoteFoundation, PromisePtr promise - ) = 0; + ) noexcept = 0; - virtual IICETypes::Components component() const = 0; - virtual IICETransport::States state() const = 0; + virtual IICETypes::Components component() const noexcept = 0; + virtual IICETransport::States state() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForSecureTransport - #pragma mark + // + // IICETransportForSecureTransport + // interaction IICETransportForSecureTransport { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, ForSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, ForSecureTransport); - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForICETransport, UseSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForICETransport, UseSecureTransport); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual void notifyAttached( PUID secureTransportID, UseSecureTransportPtr transport - ) = 0; - virtual void notifyDetached(PUID secureTransportID) = 0; + ) noexcept = 0; + virtual void notifyDetached(PUID secureTransportID) noexcept = 0; - virtual IICETypes::Components component() const = 0; + virtual IICETypes::Components component() const noexcept = 0; - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) = 0; + virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) noexcept = 0; - virtual IICETransport::States state() const = 0; + virtual IICETransport::States state() const noexcept = 0; - virtual IICETypes::Roles getRole() const = 0; + virtual IICETypes::Roles getRole() const noexcept = 0; - virtual ICETransportPtr getRTPTransport() const = 0; - virtual ICETransportPtr getRTCPTransport() const = 0; + virtual ICETransportPtr getRTPTransport() const noexcept = 0; + virtual ICETransportPtr getRTCPTransport() const noexcept = 0; - virtual UseSecureTransportPtr getSecureTransport() const = 0; + virtual UseSecureTransportPtr getSecureTransport() const noexcept = 0; virtual bool sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportForDataTransport - #pragma mark + // + // IICETransportForDataTransport + // interaction IICETransportForDataTransport { - ZS_DECLARE_TYPEDEF_PTR(IICETransportForDataTransport, ForDataTransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForDataTransport, ForDataTransport); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) = 0; + virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) noexcept = 0; - virtual IICETransport::States state() const = 0; + virtual IICETransport::States state() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportAsyncDelegate - #pragma mark + // + // IICETransportAsyncDelegate + // interaction IICETransportAsyncDelegate { @@ -227,9 +227,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport - #pragma mark + // + // ICETransport + // class ICETransport : public Noop, public MessageQueueAssociator, @@ -257,18 +257,18 @@ namespace ortc friend interaction IICETransportForSecureTransport; friend interaction IICETransportForDataTransport; - ZS_DECLARE_STRUCT_PTR(RouteStateTracker) - ZS_DECLARE_STRUCT_PTR(Route) - ZS_DECLARE_STRUCT_PTR(ReasonNoMoreRelationship) + ZS_DECLARE_STRUCT_PTR(RouteStateTracker); + ZS_DECLARE_STRUCT_PTR(Route); + ZS_DECLARE_STRUCT_PTR(ReasonNoMoreRelationship); - ZS_DECLARE_TYPEDEF_PTR(ortc::services::ISTUNRequester, ISTUNRequester) - ZS_DECLARE_TYPEDEF_PTR(IICEGathererForICETransport, UseICEGatherer) - ZS_DECLARE_TYPEDEF_PTR(IICETransportControllerForICETransport, UseICETransportController) - ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate) - ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateComplete, CandidateComplete) - ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateList, CandidateList) - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForICETransport, UseSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute) + ZS_DECLARE_TYPEDEF_PTR(ortc::services::ISTUNRequester, ISTUNRequester); + ZS_DECLARE_TYPEDEF_PTR(IICEGathererForICETransport, UseICEGatherer); + ZS_DECLARE_TYPEDEF_PTR(IICETransportControllerForICETransport, UseICETransportController); + ZS_DECLARE_TYPEDEF_PTR(IICETypes::Candidate, Candidate); + ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateComplete, CandidateComplete); + ZS_DECLARE_TYPEDEF_PTR(IICETypes::CandidateList, CandidateList); + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForICETransport, UseSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(ICEGathererRouter::Route, RouterRoute); typedef String Hash; typedef std::map CandidateMap; @@ -306,257 +306,257 @@ namespace ortc IMessageQueuePtr queue, IICETransportDelegatePtr delegate, UseICEGathererPtr gatherer - ); + ) noexcept; protected: ICETransport( Noop, IMessageQueuePtr queue = IMessageQueuePtr(), const SharedRecursiveLock &lock = SharedRecursiveLock::create() - ) : + ) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(lock) {} - void init(); + void init() noexcept; public: - virtual ~ICETransport(); + virtual ~ICETransport() noexcept; - static ICETransportPtr convert(IICETransportPtr object); - static ICETransportPtr convert(IRTCPTransportPtr object); - static ICETransportPtr convert(ForICEGathererPtr object); - static ICETransportPtr convert(ForTransportContollerPtr object); - static ICETransportPtr convert(ForSecureTransportPtr object); - static ICETransportPtr convert(ForDataTransportPtr object); + static ICETransportPtr convert(IICETransportPtr object) noexcept; + static ICETransportPtr convert(IRTCPTransportPtr object) noexcept; + static ICETransportPtr convert(ForICEGathererPtr object) noexcept; + static ICETransportPtr convert(ForTransportContollerPtr object) noexcept; + static ICETransportPtr convert(ForSecureTransportPtr object) noexcept; + static ICETransportPtr convert(ForDataTransportPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IStatsProvider - #pragma mark + // + // ICETransport => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransport - #pragma mark + // + // ICETransport => IICETransport + // - static ElementPtr toDebug(ICETransportPtr transport); + static ElementPtr toDebug(ICETransportPtr transport) noexcept; static ICETransportPtr create( IICETransportDelegatePtr delegate, IICEGathererPtr gatherer - ); + ) noexcept(false); // throws InvalidParmaters - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) override; + IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) noexcept override; - virtual IICEGathererPtr iceGatherer() const override; + IICEGathererPtr iceGatherer() const noexcept override; - virtual Roles role() const override; - virtual Components component() const override; - virtual States state() const override; + Roles role() const noexcept override; + Components component() const noexcept override; + States state() const noexcept override; - virtual CandidateListPtr getRemoteCandidates() const override; + CandidateListPtr getRemoteCandidates() const noexcept override; - virtual CandidatePairPtr getSelectedCandidatePair() const override; + CandidatePairPtr getSelectedCandidatePair() const noexcept override; - virtual void start( - IICEGathererPtr gatherer, - const Parameters &remoteParameters, - Optional options = Optional() - ) throw (InvalidParameters) override; + void start( + IICEGathererPtr gatherer, + const Parameters &remoteParameters, + Optional options = Optional() + ) noexcept(false) override; // throws InvalidParameters - virtual void stop() override; + void stop() noexcept override; - virtual ParametersPtr getRemoteParameters() const override; + ParametersPtr getRemoteParameters() const noexcept override; - virtual IICETransportPtr createAssociatedTransport(IICETransportDelegatePtr delegate) throw (InvalidStateError) override; + IICETransportPtr createAssociatedTransport(IICETransportDelegatePtr delegate) noexcept(false) override; // throws InvalidStateError - virtual void addRemoteCandidate(const GatherCandidate &remoteCandidate) throw (InvalidStateError, InvalidParameters) override; - virtual void setRemoteCandidates(const CandidateList &remoteCandidates) throw (InvalidStateError, InvalidParameters) override; - virtual void removeRemoteCandidate(const GatherCandidate &remoteCandidate) throw (InvalidStateError, InvalidParameters) override; + void addRemoteCandidate(const GatherCandidate &remoteCandidate) noexcept(false) override; // throws InvalidStateError, InvalidParameters + void setRemoteCandidates(const CandidateList &remoteCandidates) noexcept(false) override; // throws InvalidStateError, InvalidParameters + void removeRemoteCandidate(const GatherCandidate &remoteCandidate) noexcept(false) override; // throws InvalidStateError, InvalidParameters virtual void keepWarm( const CandidatePair &candidatePair, bool keepWarm = true - ) throw (InvalidStateError) override; + ) noexcept(false) override; // throws InvalidStateError //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForICEGatherer - #pragma mark + // + // ICETransport => IICETransportForICEGatherer + // - virtual ForICEGathererPtr getForGatherer() const override; + virtual ForICEGathererPtr getForGatherer() const noexcept override; virtual void notifyPacket( RouterRoutePtr routerRoute, STUNPacketPtr packet - ) override; + ) noexcept override; virtual void notifyPacket( RouterRoutePtr routerRoute, const BYTE *buffer, size_t bufferSizeInBytes - ) override; + ) noexcept override; - virtual bool needsMoreCandidates() const override; + virtual bool needsMoreCandidates() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForICETransportContoller - #pragma mark + // + // ICETransport => IICETransportForICETransportContoller + // - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual void notifyControllerAttached(ICETransportControllerPtr controller) override; - virtual void notifyControllerDetached(ICETransportController &controller) override; + virtual void notifyControllerAttached(ICETransportControllerPtr controller) noexcept override; + virtual void notifyControllerDetached(ICETransportController &controller) noexcept override; virtual bool hasCandidatePairFoundation( const String &localFoundation, const String &remoteFoundation, PromisePtr promise - ) override; + ) noexcept override; - // (duplicate) virtual IICETypes::Components component() const = 0; - // (duplicate) virtual IICETransport::States state() const = 0; + // (duplicate) virtual IICETypes::Components component() const noexcept = 0; + // (duplicate) virtual IICETransport::States state() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForSecureTransport - #pragma mark + // + // ICETransport => IICETransportForSecureTransport + // - // (duplicate) virtual PUID getID() const override; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual void notifyAttached( - PUID secureTransportID, - UseSecureTransportPtr transport - ) override; - virtual void notifyDetached(PUID secureTransportID) override; + void notifyAttached( + PUID secureTransportID, + UseSecureTransportPtr transport + ) noexcept override; + void notifyDetached(PUID secureTransportID) noexcept override; - // (duplicate) virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate); + // (duplicate) virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) noexcept = 0; - // (duplicate) virtual IICETransport::States state() const override; + // (duplicate) virtual IICETransport::States state() const noexcept = 0; - virtual IICETypes::Roles getRole() const override; + IICETypes::Roles getRole() const noexcept override; - virtual ICETransportPtr getRTPTransport() const override; - virtual ICETransportPtr getRTCPTransport() const override; + ICETransportPtr getRTPTransport() const noexcept override; + ICETransportPtr getRTCPTransport() const noexcept override; - virtual UseSecureTransportPtr getSecureTransport() const override; + UseSecureTransportPtr getSecureTransport() const noexcept override; - virtual bool sendPacket( - const BYTE *buffer, - size_t bufferSizeInBytes - ) override; + bool sendPacket( + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportForDataTransport - #pragma mark + // + // ICETransport => IICETransportForDataTransport + // - // (duplicate) virtual PUID getID() const override; + // (duplicate) virtual PUID getID() const noexcept = 0; - // (duplicate) virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate); + // (duplicate) virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr delegate) noexcept = 0; - // (duplciate) virtual IICETransport::States state() const = 0; + // (duplciate) virtual IICETransport::States state() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICETransportAsyncDelegate - #pragma mark + // + // ICETransport => IICETransportAsyncDelegate + // - virtual void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise) override; - virtual void onNotifyPacketRetried( - IICETypes::CandidatePtr localCandidate, - IPAddress remoteIP, - STUNPacketPtr stunPacket - ) override; - virtual void onWarmRoutesChanged() override; + void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise) override; + void onNotifyPacketRetried( + IICETypes::CandidatePtr localCandidate, + IPAddress remoteIP, + STUNPacketPtr stunPacket + ) override; + void onWarmRoutesChanged() override; - virtual void onNotifyAttached(PUID secureTransportID) override; - virtual void onNotifyDetached(PUID secureTransportID) override; + void onNotifyAttached(PUID secureTransportID) override; + void onNotifyDetached(PUID secureTransportID) override; - virtual void onDeliverPendingPackets() override; + void onDeliverPendingPackets() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IWakeDelegate - #pragma mark + // + // ICETransport => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => ITimerDelegate - #pragma mark + // + // ICETransport => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IPromiseSettledDelegate - #pragma mark + // + // ICETransport => IPromiseSettledDelegate + // - virtual void onPromiseSettled(PromisePtr promise) override; + void onPromiseSettled(PromisePtr promise) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => IICEGathererDelegate - #pragma mark + // + // ICETransport => IICEGathererDelegate + // - virtual void onICEGathererStateChange( - IICEGathererPtr gatherer, - IICEGatherer::States state - ) override; + void onICEGathererStateChange( + IICEGathererPtr gatherer, + IICEGatherer::States state + ) override; - virtual void onICEGathererLocalCandidate( + void onICEGathererLocalCandidate( + IICEGathererPtr gatherer, + CandidatePtr candidate + ) override; + + void onICEGathererLocalCandidateComplete( IICEGathererPtr gatherer, - CandidatePtr candidate + CandidateCompletePtr candidate ) override; - virtual void onICEGathererLocalCandidateComplete( - IICEGathererPtr gatherer, - CandidateCompletePtr candidate - ) override; - - virtual void onICEGathererLocalCandidateGone( - IICEGathererPtr gatherer, - CandidatePtr candidate - ) override; + void onICEGathererLocalCandidateGone( + IICEGathererPtr gatherer, + CandidatePtr candidate + ) override; - virtual void onICEGathererError( - IICEGathererPtr gatherer, - ErrorEventPtr errorEvent - ) override; + void onICEGathererError( + IICEGathererPtr gatherer, + ErrorEventPtr errorEvent + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => ISTUNRequesterDelegate - #pragma mark - - virtual void onSTUNRequesterSendPacket( - ISTUNRequesterPtr requester, - IPAddress destination, - SecureByteBlockPtr packet - ) override; - - virtual bool handleSTUNRequesterResponse( - ISTUNRequesterPtr requester, - IPAddress fromIPAddress, - STUNPacketPtr response - ) override; + // + // ICETransport => ISTUNRequesterDelegate + // + + void onSTUNRequesterSendPacket( + ISTUNRequesterPtr requester, + IPAddress destination, + SecureByteBlockPtr packet + ) override; + + bool handleSTUNRequesterResponse( + ISTUNRequesterPtr requester, + IPAddress fromIPAddress, + STUNPacketPtr response + ) noexcept override; - virtual void onSTUNRequesterTimedOut(ISTUNRequesterPtr requester) override; + void onSTUNRequesterTimedOut(ISTUNRequesterPtr requester) override; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport::Route - #pragma mark + // + // ICETransport::Route + // struct Route { @@ -575,7 +575,7 @@ namespace ortc State_Last = State_Blacklisted, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; AutoPUID mID; @@ -605,33 +605,36 @@ namespace ortc Time mLastRoundTripCheck; Microseconds mLastRoundTripMeasurement {}; - Route(RouteStateTrackerPtr tracker); - ~Route(); + Route(RouteStateTrackerPtr tracker) noexcept; + ~Route() noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; - QWORD getPreference(bool localIsControlling) const; + QWORD getPreference(bool localIsControlling) const noexcept; QWORD getActivationPriority( bool localIsControlling, bool useUnfreezePreference - ) const; + ) const noexcept; - States state() const; - void state(States state); + States state() const noexcept; + void state(States state) noexcept; - bool isNew() const {return State_New == mState;} - bool isPending() const {return State_Pending == mState;} - bool isFrozen() const {return State_Frozen == mState;} - bool isInProgress() const {return State_InProgress == mState;} - bool isSucceeded() const {return State_Succeeded == mState;} - bool isIgnored() const {return State_Ignored == mState;} - bool isFailed() const {return State_Failed == mState;} - bool isBlacklisted() const {return State_Blacklisted == mState;} + bool isNew() const noexcept {return State_New == mState;} + bool isPending() const noexcept {return State_Pending == mState;} + bool isFrozen() const noexcept {return State_Frozen == mState;} + bool isInProgress() const noexcept {return State_InProgress == mState;} + bool isSucceeded() const noexcept {return State_Succeeded == mState;} + bool isIgnored() const noexcept {return State_Ignored == mState;} + bool isFailed() const noexcept {return State_Failed == mState;} + bool isBlacklisted() const noexcept {return State_Blacklisted == mState;} - void trace(const char *function, const char *message = NULL) const; + void trace( + const char *function = NULL, + const char *message = NULL + ) const noexcept; protected: - Log::Params log(const char *message) const; + Log::Params log(const char *message) const noexcept; States mState {State_New}; }; @@ -644,14 +647,14 @@ namespace ortc size_t mStates[Route::State_Last+1]; - RouteStateTracker(PUID outerObjectID); + RouteStateTracker(PUID outerObjectID) noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; - void inState(States state); - void outState(States state); + void inState(States state) noexcept; + void outState(States state) noexcept; - size_t count(States state); + size_t count(States state) noexcept; }; struct ReasonNoMoreRelationship : public Any @@ -660,141 +663,141 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransport => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - bool isConnected() const; - bool isComplete() const; - bool isDisconnected() const; - bool isFailed() const; - bool isShuttingDown() const; - bool isShutdown() const; - bool isContinousGathering() const; - - void step(); - bool stepCalculateLegalPairs(); - bool stepProcessLegalPairs(CandidatePairMap &pairings); - bool stepPendingActivation(); - bool stepActivationTimer(); - bool stepPickRoute(); - bool stepUseCandidate(); - bool stepDewarmRoutes(); - bool stepKeepWarmRoutes(); - bool stepExpireRouteTimer(); - bool stepLastReceivedPacketTimer(); - bool stepSetCurrentState(); - bool stepSetNeedsMoreCandidates(); - - void wakeUp(); - void warmRoutesChanged(); - bool hasWarmRoutesChanged(); - void cancel(); - - void setState(IICETransportTypes::States state); - void setError(WORD error, const char *reason = NULL); - - void handleExpireRouteTimer(); - void handleLastReceivedPacket(); - void handleActivationTimer(); - void handleNextKeepWarmTimer(RoutePtr route); - - void forceActive(RoutePtr route); - void shutdown(RoutePtr route); - - void pruneAllCandidatePairs(bool keepActiveAlive); - CandidatePairPtr cloneCandidatePair(RoutePtr route) const; - - void setPending(RoutePtr route); + // + // ICETransport => (internal) + // + + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; + + bool isConnected() const noexcept; + bool isComplete() const noexcept; + bool isDisconnected() const noexcept; + bool isFailed() const noexcept; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; + bool isContinousGathering() const noexcept; + + void step() noexcept; + bool stepCalculateLegalPairs() noexcept; + bool stepProcessLegalPairs(CandidatePairMap &pairings) noexcept; + bool stepPendingActivation() noexcept; + bool stepActivationTimer() noexcept; + bool stepPickRoute() noexcept; + bool stepUseCandidate() noexcept; + bool stepDewarmRoutes() noexcept; + bool stepKeepWarmRoutes() noexcept; + bool stepExpireRouteTimer() noexcept; + bool stepLastReceivedPacketTimer() noexcept; + bool stepSetCurrentState() noexcept; + bool stepSetNeedsMoreCandidates() noexcept; + + void wakeUp() noexcept; + void warmRoutesChanged() noexcept; + bool hasWarmRoutesChanged() noexcept; + void cancel() noexcept; + + void setState(IICETransportTypes::States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; + + void handleExpireRouteTimer() noexcept; + void handleLastReceivedPacket() noexcept; + void handleActivationTimer() noexcept; + void handleNextKeepWarmTimer(RoutePtr route) noexcept; + + void forceActive(RoutePtr route) noexcept; + void shutdown(RoutePtr route) noexcept; + + void pruneAllCandidatePairs(bool keepActiveAlive) noexcept; + CandidatePairPtr cloneCandidatePair(RoutePtr route) const noexcept; + + void setPending(RoutePtr route) noexcept; void setFrozen( RoutePtr route, PromisePtr promise - ); - void setInProgress(RoutePtr route); - void setSucceeded(RoutePtr route); - void setIgnored(RoutePtr route); - void setFailed(RoutePtr route); - void setBlacklisted(RoutePtr route); + ) noexcept; + void setInProgress(RoutePtr route) noexcept; + void setSucceeded(RoutePtr route) noexcept; + void setIgnored(RoutePtr route) noexcept; + void setFailed(RoutePtr route) noexcept; + void setBlacklisted(RoutePtr route) noexcept; - void updateAfterPacket(RoutePtr route); + void updateAfterPacket(RoutePtr route) noexcept; - bool installGathererRoute(RoutePtr route); + bool installGathererRoute(RoutePtr route) noexcept; - void installFoundation(RoutePtr route); + void installFoundation(RoutePtr route) noexcept; - void removeLegal(RoutePtr route); - void removeFoundation(RoutePtr route); - void removeFrozen(RoutePtr route); + void removeLegal(RoutePtr route) noexcept; + void removeFoundation(RoutePtr route) noexcept; + void removeFrozen(RoutePtr route) noexcept; void removeFrozenDependencies( RoutePtr route, bool succeeded, AnyPtr reason = AnyPtr() - ); - void removeActive(RoutePtr route); - void removePendingActivation(RoutePtr route); - void removeOutgoingCheck(RoutePtr route); - void removeGathererRoute(RoutePtr route); - void removeKeepWarmTimer(RoutePtr route); - void removeWarm(RoutePtr route); + ) noexcept; + void removeActive(RoutePtr route) noexcept; + void removePendingActivation(RoutePtr route) noexcept; + void removeOutgoingCheck(RoutePtr route) noexcept; + void removeGathererRoute(RoutePtr route) noexcept; + void removeKeepWarmTimer(RoutePtr route) noexcept; + void removeWarm(RoutePtr route) noexcept; RoutePtr findRoute( IICETypes::CandidatePtr localCandidate, const IPAddress &remoteIP - ); + ) noexcept; RoutePtr findClosestRoute( IICETypes::CandidatePtr localCandidate, const IPAddress &remoteIP, DWORD remotePriority - ); - Time getLastRemoteActivity(RoutePtr route) const; + ) noexcept; + Time getLastRemoteActivity(RoutePtr route) const noexcept; ISTUNRequesterPtr createBindRequest( RoutePtr route, bool useCandidate = false, IBackOffTimerPatternPtr pattern = IBackOffTimerPatternPtr() - ) const; + ) const noexcept; STUNPacketPtr createBindResponse( STUNPacketPtr request, RoutePtr route - ) const; + ) const noexcept; STUNPacketPtr createErrorResponse( STUNPacketPtr request, STUNPacket::ErrorCodes error - ); - void setRole(STUNPacketPtr packet) const; - void fix(STUNPacketPtr stun) const; + ) noexcept; + void setRole(STUNPacketPtr packet) const noexcept; + void fix(STUNPacketPtr stun) const noexcept; void sendPacket( RouterRoutePtr routerRoute, STUNPacketPtr packet - ); + ) noexcept; bool handleSwitchRolesAndConflict( RouterRoutePtr routerRoute, STUNPacketPtr packet - ); + ) noexcept; RoutePtr findOrCreateMissingRoute( RouterRoutePtr routerRoute, STUNPacketPtr packet - ); + ) noexcept; void handlePassThroughSTUNPacket( // do not call within a lock RouterRoutePtr routerRoute, STUNPacketPtr packet - ); + ) noexcept; - bool getNeedsMoreCandidates() const; + bool getNeedsMoreCandidates() const noexcept; private: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICEGatherer => (data) - #pragma mark + // + // ICEGatherer => (data) + // AutoPUID mID; @@ -895,18 +898,18 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportFactory - #pragma mark + // + // IICETransportFactory + // interaction IICETransportFactory { - static IICETransportFactory &singleton(); + static IICETransportFactory &singleton() noexcept; virtual ICETransportPtr create( IICETransportDelegatePtr delegate, IICEGathererPtr gatherer - ); + ) noexcept(false); // throws InvalidParameters }; class ICETransportFactory : public IFactory {}; @@ -918,11 +921,11 @@ ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProvider::PromiseWithStatsReportPtr, Promis ZS_DECLARE_PROXY_TYPEDEF(ortc::IICETypes::CandidatePtr, CandidatePtr) ZS_DECLARE_PROXY_TYPEDEF(zsLib::IPAddress, IPAddress) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::STUNPacketPtr, STUNPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onResolveStatsPromise, PromiseWithStatsReportPtr) -ZS_DECLARE_PROXY_METHOD_3(onNotifyPacketRetried, CandidatePtr, IPAddress, STUNPacketPtr) -ZS_DECLARE_PROXY_METHOD_0(onWarmRoutesChanged) -ZS_DECLARE_PROXY_METHOD_1(onNotifyAttached, PUID) -ZS_DECLARE_PROXY_METHOD_1(onNotifyDetached, PUID) -ZS_DECLARE_PROXY_METHOD_0(onDeliverPendingPackets) +ZS_DECLARE_PROXY_METHOD(onResolveStatsPromise, PromiseWithStatsReportPtr) +ZS_DECLARE_PROXY_METHOD(onNotifyPacketRetried, CandidatePtr, IPAddress, STUNPacketPtr) +ZS_DECLARE_PROXY_METHOD(onWarmRoutesChanged) +ZS_DECLARE_PROXY_METHOD(onNotifyAttached, PUID) +ZS_DECLARE_PROXY_METHOD(onNotifyDetached, PUID) +ZS_DECLARE_PROXY_METHOD(onDeliverPendingPackets) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_ICETransportController.h b/ortc/internal/ortc_ICETransportController.h index e5de6bd1..1e318f44 100644 --- a/ortc/internal/ortc_ICETransportController.h +++ b/ortc/internal/ortc_ICETransportController.h @@ -42,44 +42,44 @@ namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IICETransportControllerForICETransport) + ZS_DECLARE_INTERACTION_PTR(IICETransportControllerForICETransport); - ZS_DECLARE_INTERACTION_PROXY(ITransportControllerAsyncDelegate) + ZS_DECLARE_INTERACTION_PROXY(ITransportControllerAsyncDelegate); - ZS_DECLARE_INTERACTION_PTR(IICETransportForICETransportContoller) + ZS_DECLARE_INTERACTION_PTR(IICETransportForICETransportContoller); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportControllerForICETransport - #pragma mark + // + // IICETransportControllerForICETransport + // interaction IICETransportControllerForICETransport { - ZS_DECLARE_TYPEDEF_PTR(IICETransportControllerForICETransport, ForICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportControllerForICETransport, ForICETransport); - static ElementPtr toDebug(ForICETransportPtr controller); + static ElementPtr toDebug(ForICETransportPtr controller) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual PromisePtr notifyWhenUnfrozen( ICETransportPtr transport, const String &localFoundation, const String &remoteFoundation - ) = 0; + ) noexcept = 0; - virtual void notifyDetached(ICETransportPtr transport) = 0; + virtual void notifyDetached(ICETransportPtr transport) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ITransportControllerAsyncDelegate - #pragma mark + // + // ITransportControllerAsyncDelegate + // interaction ITransportControllerAsyncDelegate { @@ -104,9 +104,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController - #pragma mark + // + // ICETransportController + // class ICETransportController : public Noop, public MessageQueueAssociator, @@ -124,7 +124,7 @@ namespace ortc friend interaction IICETransportControllerFactory; friend interaction IICETransportControllerForICETransport; - ZS_DECLARE_TYPEDEF_PTR(IICETransportForICETransportContoller, UseICETransport) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForICETransportContoller, UseICETransport); typedef size_t AttachedOrderID; typedef std::pair AttachedTransportPair; @@ -134,109 +134,106 @@ namespace ortc ICETransportController( const make_private &, IMessageQueuePtr queue - ); + ) noexcept; protected: - ICETransportController(Noop) : + ICETransportController(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~ICETransportController(); + virtual ~ICETransportController() noexcept; - static ICETransportControllerPtr convert(IICETransportControllerPtr object); - static ICETransportControllerPtr convert(ForICETransportPtr object); + static ICETransportControllerPtr convert(IICETransportControllerPtr object) noexcept; + static ICETransportControllerPtr convert(ForICETransportPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IICETransportController - #pragma mark + // + // ICETransportController => IICETransportController + // - static ElementPtr toDebug(ICETransportControllerPtr controller); + static ElementPtr toDebug(ICETransportControllerPtr controller) noexcept; - static ICETransportControllerPtr create(); + static ICETransportControllerPtr create() noexcept; - virtual PUID getID() const; + PUID getID() const noexcept override; - virtual ICETransportList getTransports() const; - virtual void addTransport( - IICETransportPtr transport, - Optional index = Optional() - ) throw( - InvalidParameters, - InvalidStateError - ); + ICETransportList getTransports() const noexcept override; + void addTransport( + IICETransportPtr transport, + Optional index = Optional() + ) noexcept(false) override; // throws InvalidParameters, InvalidStateError //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IStatsProvider - #pragma mark + // + // ICETransportController => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IICETransportControllerForICETransport - #pragma mark + // + // ICETransportController => IICETransportControllerForICETransport + // - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept= 0; - virtual PromisePtr notifyWhenUnfrozen( - ICETransportPtr transport, - const String &localFoundation, - const String &remoteFoundation - ); + PromisePtr notifyWhenUnfrozen( + ICETransportPtr transport, + const String &localFoundation, + const String &remoteFoundation + ) noexcept override; - virtual void notifyDetached(ICETransportPtr transport); + void notifyDetached(ICETransportPtr transport) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => ITransportControllerAsyncDelegate - #pragma mark - - virtual void onTransportControllerNotifyWhenUnfrozen( - PromisePtr promise, - UseICETransportPtr transport, - const char *localFoundation, - const char *remoteFoundation - ); - - virtual void onTransportControllerNotifyDetached( - UseICETransportPtr transport, - AttachedOrderID detachedOrder - ); + // + // ICETransportController => ITransportControllerAsyncDelegate + // + + void onTransportControllerNotifyWhenUnfrozen( + PromisePtr promise, + UseICETransportPtr transport, + const char *localFoundation, + const char *remoteFoundation + ) override; + + void onTransportControllerNotifyDetached( + UseICETransportPtr transport, + AttachedOrderID detachedOrder + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => IWakeDelegate - #pragma mark + // + // ICETransportController => IWakeDelegate + // - virtual void onWake(); + void onWake() override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => (internal) - #pragma mark + // + // ICETransportController => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + ElementPtr toDebug() const noexcept; - void step(); + void step() noexcept; - void cancel(); + void cancel() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportController => (data) - #pragma mark + // + // ICETransportController => (data) + // AutoPUID mID; ICETransportControllerWeakPtr mThisWeak; @@ -250,15 +247,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IICETransportControllerFactory - #pragma mark + // + // IICETransportControllerFactory + // interaction IICETransportControllerFactory { - static IICETransportControllerFactory &singleton(); + static IICETransportControllerFactory &singleton() noexcept; - virtual ICETransportControllerPtr create(); + virtual ICETransportControllerPtr create() noexcept; }; class ICETransportControllerFactory : public IFactory {}; @@ -269,6 +266,6 @@ ZS_DECLARE_PROXY_BEGIN(ortc::internal::ITransportControllerAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(zsLib::PromisePtr, PromisePtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ITransportControllerAsyncDelegate::UseICETransportPtr, UseICETransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ITransportControllerAsyncDelegate::AttachedOrderID, AttachedOrderID) -ZS_DECLARE_PROXY_METHOD_4(onTransportControllerNotifyWhenUnfrozen, PromisePtr, UseICETransportPtr, const char *, const char *) -ZS_DECLARE_PROXY_METHOD_2(onTransportControllerNotifyDetached, UseICETransportPtr, AttachedOrderID) +ZS_DECLARE_PROXY_METHOD(onTransportControllerNotifyWhenUnfrozen, PromisePtr, UseICETransportPtr, const char *, const char *) +ZS_DECLARE_PROXY_METHOD(onTransportControllerNotifyDetached, UseICETransportPtr, AttachedOrderID) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPReceiverChannelMediaBase.h b/ortc/internal/ortc_IMediaDevice.h similarity index 50% rename from ortc/internal/ortc_RTPReceiverChannelMediaBase.h rename to ortc/internal/ortc_IMediaDevice.h index 1ad9b726..dc2e3dd8 100644 --- a/ortc/internal/ortc_RTPReceiverChannelMediaBase.h +++ b/ortc/internal/ortc_IMediaDevice.h @@ -1,6 +1,6 @@ /* - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. + Copyright (c) 2017, Optical Tone Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -32,92 +32,81 @@ #pragma once #include -#include -#include -#include -#include -#include - -#include -#include - - -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" +#include namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelMediaBaseForRTPReceiverChannel) - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelMediaBaseForMediaStreamTrack) - - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiverChannelMediaBase) - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannelMediaBase) + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceForMediaEngine); + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark - - interaction IRTPReceiverChannelMediaBaseForRTPReceiverChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPReceiverChannel, ForRTPReceiverChannel); - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - static ElementPtr toDebug(ForRTPReceiverChannelPtr object); - - virtual PUID getID() const = 0; - - virtual void notifyTransportState(ISecureTransportTypes::States state) = 0; - - virtual void notifyUpdate(ParametersPtr params) = 0; + // + // (helpers) + // - virtual bool handlePacket(RTPPacketPtr packet) = 0; - - virtual bool handlePacket(RTCPPacketPtr packet) = 0; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) = 0; - }; + IMediaStreamTrackTypes::SettingsPtr obtainBestMode( + const std::list &allConstraints, + const std::list &availableModes + ) noexcept; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelMediaBaseForMediaStreamTrack - #pragma mark + // + // IMediaDevice + // - interaction IRTPReceiverChannelMediaBaseForMediaStreamTrack + interaction IMediaDevice { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForMediaStreamTrack, ForMediaStreamTrack) + typedef PUID MediaDeviceObjectID; + + enum States + { + State_First, + + State_Pending = State_First, + State_Active, + State_Reinitializing, + State_ShuttingDown, + State_Shutdown, + + State_Last = State_Shutdown, + }; - static ElementPtr toDebug(ForMediaStreamTrackPtr object); + static const char *toString(States state) noexcept; - virtual PUID getID() const = 0; + virtual MediaDeviceObjectID getID() const noexcept = 0; + virtual void cancel() noexcept = 0; + + virtual States getState() const noexcept = 0; }; - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelMediaBaseForRTPMediaEngine - #pragma mark + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaDeviceForMediaEngine + // - interaction IRTPReceiverChannelMediaBaseForRTPMediaEngine + interaction IMediaDeviceForMediaEngine { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPMediaEngine, ForRTPMediaEngine) + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceForMediaEngine, ForMediaEngine); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::States, States); - static ElementPtr toDebug(ForRTPMediaEnginePtr object); + virtual bool isDeviceIdle() noexcept = 0; + virtual void shutdown() noexcept = 0; - virtual PUID getID() const = 0; + virtual States getState() const noexcept = 0; + bool isShuttingDown() const noexcept { return IMediaDevice::State_ShuttingDown == getState(); } + bool isShutdown() const noexcept { return IMediaDevice::State_Shutdown == getState(); } }; } diff --git a/ortc/internal/ortc_IMediaDeviceCapture.h b/ortc/internal/ortc_IMediaDeviceCapture.h new file mode 100644 index 00000000..92658436 --- /dev/null +++ b/ortc/internal/ortc_IMediaDeviceCapture.h @@ -0,0 +1,242 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureVideoForMediaEngine); + + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDevice); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCapture); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCaptureAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCaptureVideo); + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCapture + // + + interaction IMediaDeviceCapture : public IMediaDevice + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + typedef zsLib::PromiseWithHolderPtr MediaDeviceCapturePromise; + ZS_DECLARE_PTR(MediaDeviceCapturePromise); + + static MediaDeviceCapturePromisePtr create( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + virtual ~IMediaDeviceCapture() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureDelegate + // + + interaction IMediaDeviceCaptureDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::States, States); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void notifyMediaDeviceCaptureAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyMediaDeviceCaptureVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept = 0; + virtual void onMediaDeviceCaptureStateChanged( + IMediaDeviceCapturePtr device, + States state + ) = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaDeviceCaptureSubscription + // + + interaction IMediaDeviceCaptureSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureAudio + // + + interaction IMediaDeviceCaptureAudio : public IMediaDeviceCapture + { + virtual ~IMediaDeviceCaptureAudio() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureVideo + // + + interaction IMediaDeviceCaptureVideo : public IMediaDeviceCapture + { + virtual ~IMediaDeviceCaptureVideo() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaDeviceCaptureForMediaEngine + // + + interaction IMediaDeviceCaptureForMediaEngine : public IMediaDeviceForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCaptureForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + typedef zsLib::PromiseWithHolderPtr MediaDeviceCapturePromise; + ZS_DECLARE_PTR(MediaDeviceCapturePromise); + + virtual void mediaDeviceCaptureSubscribe( + MediaDeviceCapturePromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept = 0; + }; + + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaDeviceCaptureAudioForMediaEngine + // + + interaction IMediaDeviceCaptureAudioForMediaEngine : public IMediaDeviceCaptureForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCaptureAudioForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCaptureAudio, UseMediaEngine); + + static ForMediaEnginePtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + }; + + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaDeviceCaptureVideoForMediaEngine + // + + interaction IMediaDeviceCaptureVideoForMediaEngine : public IMediaDeviceCaptureForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCaptureVideoForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCaptureVideo, UseMediaEngine); + + static ForMediaEnginePtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + }; + } +} + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IMediaDeviceCaptureDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaDeviceCapturePtr, IMediaDeviceCapturePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaDevice::States, States) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyMediaDeviceCaptureAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyMediaDeviceCaptureVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_METHOD(onMediaDeviceCaptureStateChanged, IMediaDeviceCapturePtr, States) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::IMediaDeviceCaptureDelegate, ortc::internal::IMediaDeviceCaptureSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IMediaDeviceCapturePtr, IMediaDeviceCapturePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IMediaDevice::States, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyMediaDeviceCaptureAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyMediaDeviceCaptureVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaDeviceCaptureStateChanged, IMediaDeviceCapturePtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/internal/ortc_IMediaDeviceRender.h b/ortc/internal/ortc_IMediaDeviceRender.h new file mode 100644 index 00000000..e88d99a2 --- /dev/null +++ b/ortc/internal/ortc_IMediaDeviceRender.h @@ -0,0 +1,207 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceRenderForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceRenderAudioForMediaEngine); + + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDevice); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceRender); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceRenderAudio); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceRender + // + + interaction IMediaDeviceRender : public IMediaDevice + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceRender, ForMediaStreamTrack); + + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + typedef zsLib::PromiseWithHolderPtr MediaDeviceRenderPromise; + ZS_DECLARE_PTR(MediaDeviceRenderPromise); + + static MediaDeviceRenderPromisePtr create( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept; + + virtual void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept = 0; + + virtual ~IMediaDeviceRender() noexcept {} + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceRenderAudio + // + + interaction IMediaDeviceRenderAudio : public IMediaDeviceRender + { + void notifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept override {} // ignored + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceRenderDelegate + // + + interaction IMediaDeviceRenderDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::States, States); + + virtual void onMediaDeviceRenderStateChanged( + IMediaDeviceRenderPtr device, + States state + ) = 0; + + virtual ~IMediaDeviceRenderDelegate() noexcept {} + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaDeviceRenderSubscription + // + + interaction IMediaDeviceRenderSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaDeviceRenderForMediaEngine + // + + interaction IMediaDeviceRenderForMediaEngine : public IMediaDeviceForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceRenderForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + typedef zsLib::PromiseWithHolderPtr MediaDeviceRenderPromise; + ZS_DECLARE_PTR(MediaDeviceRenderPromise); + + virtual void mediaDeviceRenderSubscribe( + MediaDeviceRenderPromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept = 0; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaDeviceRenderAudioForMediaEngine + // + + interaction IMediaDeviceRenderAudioForMediaEngine : public IMediaDeviceRenderForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceRenderAudioForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceRenderAudio, UseMediaEngine); + + static ForMediaEnginePtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + }; + + } +} + + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IMediaDeviceRenderDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaDeviceRenderPtr, IMediaDeviceRenderPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaDevice::States, States) +ZS_DECLARE_PROXY_METHOD(onMediaDeviceRenderStateChanged, IMediaDeviceRenderPtr, States) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::IMediaDeviceRenderDelegate, ortc::internal::IMediaDeviceRenderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IMediaDeviceRenderPtr, IMediaDeviceRenderPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IMediaDevice::States, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaDeviceRenderStateChanged, IMediaDeviceRenderPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/internal/ortc_IMediaStreamTrack.h b/ortc/internal/ortc_IMediaStreamTrack.h new file mode 100644 index 00000000..5da402d4 --- /dev/null +++ b/ortc/internal/ortc_IMediaStreamTrack.h @@ -0,0 +1,321 @@ +/* + + Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrack); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackRTPDelegate); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackRTPSubscription); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForMediaStreamTrackChannel); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForMediaStreamTrackSubscriber); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForMediaStreamTrackSubscriberMedia); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForMediaStreamTrackSubscriberRTP); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrack); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackSubscriberForMediaStreamTrack); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackSubscriberMediaForMediaStreamTrack); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackSubscriberRTPForMediaStreamTrack); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiver); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannel); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSender); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannel); + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrack + // + + interaction IMediaStreamTrack : public ortc::IMediaStreamTrack + { + // WARNING: extreme caution must be done not to cause a deadlock or delaying media by blocking. Gather information + // needed within a lock but do any operations outside a lock as fast as possible. + virtual IMediaStreamTrackRTPSubscriptionPtr subscribeRTP( + const Parameters &rtpEncodingParams, + IMediaStreamTrackRTPDelegatePtr delegate + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackRTPDelegate + // + + interaction IMediaStreamTrackRTPDelegate : public IMediaStreamTrackDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + virtual void notifyMediaStreamTrackRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + virtual void notifyMediaStreamTrackRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackRTPSubscription + // + + interaction IMediaStreamTrackRTPSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStreamTrackChannel + // + + interaction IMediaStreamTrackForMediaStreamTrackChannel + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaStreamTrackChannel, ForMediaStreamTrackChannel); + + virtual ~IMediaStreamTrackForMediaStreamTrackChannel() noexcept {} + }; + + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStreamTrackSubscriber + // + + interaction IMediaStreamTrackForMediaStreamTrackSubscriber + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaStreamTrackSubscriber, ForMediaStreamTrackSubscriber); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberForMediaStreamTrack, UseSubscriber); + + virtual void notifySubscriberCancelled(UseSubscriberPtr subscriber) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStreamTrackSubscriberMedia + // + + interaction IMediaStreamTrackForMediaStreamTrackSubscriberMedia : public IMediaStreamTrackForMediaStreamTrackSubscriber + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaStreamTrackSubscriberMedia, ForMediaStreamTrackSubscriberMedia); + + virtual ~IMediaStreamTrackForMediaStreamTrackSubscriberMedia() noexcept {} + }; + + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStreamTrackSubscriberRTP + // + + interaction IMediaStreamTrackForMediaStreamTrackSubscriberRTP : public IMediaStreamTrackForMediaStreamTrackSubscriber + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaStreamTrackSubscriberRTP, ForMediaStreamTrackSubscriberRTP); + + virtual ~IMediaStreamTrackForMediaStreamTrackSubscriberRTP() noexcept {} + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaDevices + // + + interaction IMediaStreamTrackForMediaDevices + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaDevices, ForMediaDevices); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + static ForMediaDevicesPtr createForMediaDevices( + IMediaStreamTrackTypes::Kinds kind, + const TrackConstraints &constraints + ) noexcept; + + virtual PUID getID() const noexcept = 0; + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForMediaStreamTrackSelector + // + + interaction IMediaStreamTrackForMediaStreamTrackSelector + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaStreamTrackSelector, ForMediaStreamTrackSelector); + + static ForMediaStreamTrackSelectorPtr createForMediaStreamTrackSelector(IMediaStreamTrackTypes::Kinds kind) noexcept; + + virtual PUID getID() const noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPReceiver + // + + interaction IMediaStreamTrackForRTPReceiver + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiver, ForReceiver); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + static ForReceiverPtr createForReceiver(IMediaStreamTrackTypes::Kinds kind) noexcept; + + virtual PUID getID() const noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPReceiverChannel + // + + interaction IMediaStreamTrackForRTPReceiverChannel + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannel, ForReceiverChannel); + + typedef IMediaStreamTrackTypes::Kinds Kinds; + + virtual PUID getID() const noexcept = 0; + virtual Kinds kind() const noexcept = 0; + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPSender + // + + interaction IMediaStreamTrackForRTPSender + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSender, ForSender); + + typedef IMediaStreamTrackTypes::Kinds Kinds; + + virtual PUID getID() const noexcept = 0; + virtual Kinds kind() const noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackForRTPSenderChannel + // + + interaction IMediaStreamTrackForRTPSenderChannel + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannel, ForSenderChannel); + + virtual PUID getID() const noexcept = 0; + }; + + } +} + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IMediaStreamTrackRTPDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyMediaStreamTrackRTPPacket, ImmutableMediaChannelTracePtr, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyMediaStreamTrackRTCPPacket, ImmutableMediaChannelTracePtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::IMediaStreamTrackRTPDelegate, ortc::internal::IMediaStreamTrackRTPSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::OverconstrainedErrorPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackEnded, IMediaStreamTrackPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamTrackOverConstrained, IMediaStreamTrackPtr, OverconstrainedErrorPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyMediaStreamTrackRTPPacket, ImmutableMediaChannelTracePtr, RTPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyMediaStreamTrackRTCPPacket, ImmutableMediaChannelTracePtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/internal/ortc_IMediaStreamTrackChannel.h b/ortc/internal/ortc_IMediaStreamTrackChannel.h new file mode 100644 index 00000000..4bfecab5 --- /dev/null +++ b/ortc/internal/ortc_IMediaStreamTrackChannel.h @@ -0,0 +1,231 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelDelegate); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelMediaDelegate); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelRTPDelegate); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrack); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP); + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelDelegate + // + + interaction IMediaStreamTrackChannelDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + virtual void notifyMediaChannelCancelled(ImmutableMediaChannelTracePtr trace) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelMediaDelegate + // + + interaction IMediaStreamTrackChannelMediaDelegate : public IMediaStreamTrackChannelDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void notifyMediaChannelAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyMediaChannelVideoFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelRTPDelegate + // + + interaction IMediaStreamTrackChannelRTPDelegate : public IMediaStreamTrackChannelDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void notifyMediaChannelRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + virtual void notifyMediaChannelRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelForMediaStreamTrack + // + + interaction IMediaStreamTrackChannelForMediaStreamTrack + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrack, ForMediaStreamTrack); + + typedef PUID SubscriberObjectID; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + static ForMediaStreamTrackPtr create( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace + ) noexcept; + + virtual PUID getID() const noexcept = 0; + + virtual void shutdown() noexcept = 0; + + virtual void notifyAudioFrame( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyVideoFrame( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept = 0; + + virtual void notifyRTPPacket( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + virtual void notifyRTCPPacket( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + + virtual void subscribeComplete() noexcept = 0; + + virtual bool shouldCancel(size_t cleanOlderThanTimeIndex) noexcept = 0; + + virtual void notifyMediaChannelGone(ImmutableMediaChannelTracePtr trace) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelForMediaStreamTrackSubscriber + // + + interaction IMediaStreamTrackChannelForMediaStreamTrackSubscriber + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber, ForMediaStreamTrackSubscriber); + + typedef PUID SubscriberObjectID; + + virtual void notifyCancelled(SubscriberObjectID subscriberID) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia + // + + interaction IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia : public IMediaStreamTrackChannelForMediaStreamTrackSubscriber + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia, ForMediaStreamTrackSubscriberMedia); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + virtual void subscribeMedia( + SubscriberObjectID subscriberID, + IMediaStreamTrackChannelMediaDelegatePtr delegate + ) noexcept = 0; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP + // + + interaction IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP : public IMediaStreamTrackChannelForMediaStreamTrackSubscriber + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP, ForMediaStreamTrackSubscriberRTP); + + typedef PUID SubscriberObjectID; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::ImmutableParameters, ImmutableParameters); + + virtual void subscribeRTP( + SubscriberObjectID subscriberID, + ImmutableParametersPtr params, + IMediaStreamTrackChannelRTPDelegatePtr delegate + ) noexcept = 0; + }; + + + } // namespace internal +} // namespace ortc diff --git a/ortc/internal/ortc_IMediaStreamTrackMonitor.h b/ortc/internal/ortc_IMediaStreamTrackMonitor.h new file mode 100644 index 00000000..86f880f4 --- /dev/null +++ b/ortc/internal/ortc_IMediaStreamTrackMonitor.h @@ -0,0 +1,360 @@ +/* + + Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitor); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitorMediaChannel); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitorSubscriberMedia); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitorSubscriberRTP); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackMonitorDelegate); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitorMediaChannelDelegate); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitorMediaSubscriberMediaDelegate); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackMonitorMediaSubscriberRTPDelegate); + + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForMediaStreamTrackMonitor); + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorTypes + // + + interaction IMediaStreamTrackMonitorTypes + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::ImmutableParameters, ImmutableParameters); + + typedef PUID ChannelID; + typedef PUID SubscriberID; + + typedef PUID MonitorChannelID; + typedef PUID MonitorSubscriberMediaID; + typedef PUID MonitorSubscriberRTPID; + + typedef AnyPtr MonitorChannelContextPtr; + typedef AnyPtr MonitorSubscriberMediaContextPtr; + typedef AnyPtr MonitorSubscriberRTPContextPtr; + + struct NotifyMediaChannelAvailableInput + { + ChannelID channelID_ {}; + ImmutableMediaChannelTracePtr inMediaChannelTrace_; + IMediaStreamTrackMonitorMediaChannelDelegatePtr delegate; + }; + + struct NotifyMediaChannelAvailableOutput + { + MonitorChannelID id_ {}; + MonitorChannelContextPtr context_ {}; + IMediaStreamTrackMonitorMediaChannelPtr monitor_; + }; + + struct NotifyMediaChannelSubscribedMediaInput + { + SubscriberID subscriberID_ {}; + IMediaStreamTrackMonitorMediaSubscriberMediaDelegatePtr delegate_; + }; + + struct NotifyMediaChannelSubscribedMediaOutput + { + MonitorSubscriberMediaID id_ {}; + MonitorSubscriberMediaContextPtr context_ {}; + IMediaStreamTrackMonitorSubscriberMediaPtr monitor_; + }; + + struct NotifyMediaChannelSubscribedRTPInput + { + SubscriberID subscriberID_{}; + IMediaStreamTrackMonitorMediaSubscriberRTPDelegatePtr delegate_; + }; + + struct NotifyMediaChannelSubscribedRTPOutput + { + MonitorSubscriberRTPID id_ {}; + MonitorSubscriberRTPContextPtr context_ {}; + IMediaStreamTrackMonitorSubscriberRTPPtr monitor_; + }; + + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitor + // + + interaction IMediaStreamTrackMonitor : public IMediaStreamTrackMonitorTypes + { + static IMediaStreamTrackMonitorPtr create(ortc::IMediaStreamTrackPtr track) noexcept; + + virtual PUID getID() const noexcept = 0; + + virtual void stop() const noexcept = 0; + + virtual void notifyMediaChannelAvailable( + NotifyMediaChannelAvailableInput &input, + NotifyMediaChannelAvailableInput &output + ) noexcept = 0; + + virtual void notifyMediaChannelSubscribedMedia( + NotifyMediaChannelSubscribedMediaInput &input, + NotifyMediaChannelSubscribedMediaInput &output + ) noexcept = 0; + + virtual void notifyMediaChannelSubscribedRTP( + NotifyMediaChannelSubscribedRTPInput &input, + NotifyMediaChannelSubscribedRTPInput &output + ) noexcept = 0; + + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorDelegate + // + + interaction IMediaStreamTrackMonitorDelegate + { + virtual ~IMediaStreamTrackMonitorDelegate() noexcept {} + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorSubscription + // + + interaction IMediaStreamTrackMonitorSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorMediaChannel + // + + interaction IMediaStreamTrackMonitorMediaChannel : public IMediaStreamTrackMonitorTypes + { + virtual void notifyMediaChannelGone( + MonitorChannelID id, + MonitorChannelContextPtr context + ) noexcept = 0; + + virtual void notifyMediaChannelRTPPacket( + MonitorChannelID id, + MonitorChannelContextPtr context, + RTPPacketPtr packet, + bool &outFilterPacket + ) noexcept = 0; + + virtual void notifyMediaChannelRTCPPacket( + MonitorChannelID id, + MonitorChannelContextPtr context, + RTCPPacketPtr packet, + bool &outFilterPacket + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorMediaChannelDelegate + // + + interaction IMediaStreamTrackMonitorMediaChannelDelegate : public IMediaStreamTrackMonitorTypes + { + virtual void notifyMonitorMediaChannelRTPPacket( + MonitorChannelID id, + RTPPacketPtr packet + ) noexcept = 0; + virtual void notifyMonitorMediaChannelRTCPPacket( + MonitorChannelID id, + RTPPacketPtr packet + ) noexcept = 0; + }; + + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorSubscriberMedia + // + + interaction IMediaStreamTrackMonitorSubscriberMedia : public IMediaStreamTrackMonitorTypes + { + virtual void notifyMonitorSubscriberMediaGone( + MonitorSubscriberMediaID id, + MonitorSubscriberMediaContextPtr context + ) noexcept = 0; + + virtual void notifyMonitorSubscriberMediaAudio( + MonitorSubscriberMediaID id, + MonitorSubscriberMediaContextPtr context, + AudioFramePtr frame, + bool &outFilterFrame + ) noexcept = 0; + + virtual void notifyMonitorSubscriberMediaVideo( + MonitorSubscriberMediaID id, + MonitorSubscriberMediaContextPtr context, + VideoFramePtr frame, + bool &outFilterFrame + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorSubscriberMediaDelegate + // + + interaction IMediaStreamTrackMonitorSubscriberMediaDelegate : public IMediaStreamTrackMonitorTypes + { + virtual void notifyMonitorSubscriberMediaAudio( + MonitorSubscriberMediaID id, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyMonitorSubscriberMediaVideo( + MonitorSubscriberMediaID id, + VideoFramePtr frame + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorSubscriberRTP + // + + interaction IMediaStreamTrackMonitorSubscriberRTP : public IMediaStreamTrackMonitorTypes + { + virtual void notifyMonitorSubscriberRTPGone( + MonitorSubscriberRTPID id, + MonitorSubscriberMediaContextPtr context + ) noexcept = 0; + + virtual void notifyMonitorSubscriberEncoderRTPPacket( + MonitorSubscriberRTPID id, + MonitorSubscriberMediaContextPtr context, + RTPPacketPtr packet, + bool &outFilterPacket + ) noexcept = 0; + + virtual void notifyMonitorSubscriberEncoderRTPRTCPPacket( + MonitorSubscriberRTPID id, + MonitorSubscriberMediaContextPtr context, + RTCPPacketPtr packet, + bool &outFilterPacket + ) noexcept = 0; + + virtual void notifyMonitorSubscriberRTPFeedback( + MonitorSubscriberRTPID id, + MonitorSubscriberMediaContextPtr context, + RTCPPacketPtr packet, + bool &outFilterPacket + ) noexcept = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IMediaStreamTrackMonitorSubscriberRTPDelegate + // + + interaction IMediaStreamTrackMonitorSubscriberRTPDelegate : public IMediaStreamTrackMonitorTypes + { + virtual void notifyMonitorSubscriberRTPEncoderRTPPacket( + MonitorSubscriberRTPID id, + RTPPacketPtr packet + ) = 0; + virtual void notifyMonitorSubscriberRTPEncoderRTCPPacket( + MonitorSubscriberRTPID id, + RTPPacketPtr packet + ) = 0; + + virtual void notifyMonitorSubscriberRTPFeedback( + MonitorSubscriberRTPID id, + RTPPacketPtr packet + ) = 0; + }; + } +} + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IMediaStreamTrackMonitorDelegate) +//ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +//ZS_DECLARE_PROXY_METHOD_2(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::IMediaStreamTrackMonitorDelegate, ortc::internal::IMediaStreamTrackMonitorSubscription) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackPtr, IMediaStreamTrackPtr) +//ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onMediaStreamTrackMute, IMediaStreamTrackPtr, bool) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/internal/ortc_IMediaStreamTrackSubscriber.h b/ortc/internal/ortc_IMediaStreamTrackSubscriber.h new file mode 100644 index 00000000..8414b465 --- /dev/null +++ b/ortc/internal/ortc_IMediaStreamTrackSubscriber.h @@ -0,0 +1,143 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP); + + + //----------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberForMediaStreamTrack + // + + interaction IMediaStreamTrackSubscriberForMediaStreamTrack + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberForMediaStreamTrack, ForMediaStreamTrack); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber, UseMediaChannelBase); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::OverconstrainedError, OverconstrainedError); + + virtual PUID getID() const noexcept = 0; + + virtual void shutdown() noexcept = 0; + + virtual void notifyTrackMute(bool isMuted) noexcept = 0; + virtual void notifyTrackEnded() noexcept = 0; + virtual void notifyOverConstrained(OverconstrainedErrorPtr error) noexcept = 0; + + virtual void notifyChannel( + UseMediaChannelBasePtr mediaChannel, + ImmutableMediaChannelTracePtr trace + ) noexcept = 0; + }; + + //----------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberMediaForMediaStreamTrack + // + + interaction IMediaStreamTrackSubscriberMediaForMediaStreamTrack : public IMediaStreamTrackSubscriberForMediaStreamTrack + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberMediaForMediaStreamTrack, ForMediaStreamTrack); + + static ForMediaStreamTrackPtr create( + IMediaStreamTrackMediaSubscriptionPtr &outSubscription, + IMediaStreamTrackSyncMediaDelegatePtr syncDelegate, + IMediaStreamTrackAsyncMediaDelegatePtr asyncDelegate + ) noexcept; + + virtual ~IMediaStreamTrackSubscriberMediaForMediaStreamTrack() noexcept; + }; + + //----------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberRTPForMediaStreamTrack + // + + interaction IMediaStreamTrackSubscriberRTPForMediaStreamTrack : public IMediaStreamTrackSubscriberForMediaStreamTrack + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberRTPForMediaStreamTrack, ForMediaStreamTrack); + + static ForMediaStreamTrackPtr create( + IMediaStreamTrackMediaSubscriptionPtr &outSubscription, + IMediaStreamTrackRTPDelegatePtr delegate + ) noexcept; + + virtual ~IMediaStreamTrackSubscriberRTPForMediaStreamTrack() noexcept; + }; + + + //----------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberForMediaStreamTrackChannel + // + + interaction IMediaStreamTrackSubscriberForMediaStreamTrackChannel + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberForMediaStreamTrackChannel, ForMediaStreamTrackChannel); + + }; + + //----------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel + // + + interaction IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel, ForMediaStreamTrackChannel); + }; + + //----------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel + // + + interaction IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel, ForMediaStreamTrackChannel); + }; + + } // namespace internal +} // namespace ortc diff --git a/ortc/internal/ortc_IRTP.h b/ortc/internal/ortc_IRTP.h new file mode 100644 index 00000000..60b69977 --- /dev/null +++ b/ortc/internal/ortc_IRTP.h @@ -0,0 +1,105 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IRTPForMediaEngine); + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTP + // + + interaction IRTP + { + typedef PUID RTPObjectID; + + enum States + { + State_First, + + State_Pending = State_First, + State_Ready, + State_ShuttingDown, + State_Shutdown, + + State_Last = State_Shutdown, + }; + + static const char *toString(States state) noexcept; + static States toState(const char *stateStr) noexcept(false); // throws InvalidParameters + + virtual RTPObjectID getID() const noexcept = 0; + virtual void cancel() noexcept = 0; + + virtual States getState() const noexcept = 0; + + virtual ~IRTP() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPForMediaEngine + // + + interaction IRTPForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPForMediaEngine, ForMediaEngine); + + typedef IRTP::RTPObjectID RTPObjectID; + ZS_DECLARE_TYPEDEF_PTR(IRTP::States, States); + + virtual RTPObjectID getID() const noexcept = 0; + virtual void shutdown() noexcept = 0; + + virtual States getState() const noexcept = 0; + bool isShuttingDown() const noexcept { return IRTP::State_ShuttingDown == getState(); } + bool isShutdown() const noexcept { return IRTP::State_Shutdown == getState(); } + + virtual ~IRTPForMediaEngine() noexcept {} + }; + + } +} diff --git a/ortc/internal/ortc_IRTPDecoder.h b/ortc/internal/ortc_IRTPDecoder.h new file mode 100644 index 00000000..6f311ae3 --- /dev/null +++ b/ortc/internal/ortc_IRTPDecoder.h @@ -0,0 +1,286 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderVideoForMediaEngine); + + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPDecoderAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPDecoderVideo); + + ZS_DECLARE_INTERACTION_PROXY(IRTPDecoderAysncDelegate); + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPDecoder + // + + interaction IRTPDecoder : public IRTP + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + virtual void notifyRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + virtual void notifyRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept = 0; + + virtual ~IRTPDecoder() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPDecoderAudio + // + + interaction IRTPDecoderAudio : public IRTPDecoder + { + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderAudio); + + static PromiseWithRTPDecoderAudioPtr create( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPDecoderAudio() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPDecoderVideo + // + + interaction IRTPDecoderVideo : public IRTPDecoder + { + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderVideo); + + static PromiseWithRTPDecoderVideoPtr create( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPDecoderVideo() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderDelegate + // + + interaction IRTPDecoderDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IRTP::States, States); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void notifyRTPDecoderAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyRTPDecoderVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept = 0; + + virtual void onRTPDecoderStateChanged( + IRTPDecoderPtr decoder, + States state + ) = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IRTPDecoderSubscription + // + + interaction IRTPDecoderSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPDecoderForMediaEngine + // + + interaction IRTPDecoderForMediaEngine : public IRTPForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPDecoderForMediaEngine, ForMediaEngine); + + virtual ~IRTPDecoderForMediaEngine() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPDecoderAudioForMediaEngine + // + + interaction IRTPDecoderAudioForMediaEngine : public IRTPDecoderForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPDecoderAudioForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderAudio, UseMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderAudio); + + static ForMediaEnginePtr create( + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPDecoderAudioForMediaEngine() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPDecoderVideoForMediaEngine + // + + interaction IRTPDecoderVideoForMediaEngine : public IRTPDecoderForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPDecoderVideoForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderVideo, UseMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderVideo); + + static ForMediaEnginePtr create( + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPDecoderVideoForMediaEngine() noexcept {} + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderAsyncDelegate + // + + interaction IRTPDecoderAysncDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + virtual void onRTPDecoderRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) = 0; + virtual void onRTPDecoderRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) = 0; + }; + } +} + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPDecoderDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPDecoderPtr, IRTPDecoderPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTP::States, States) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyRTPDecoderAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyRTPDecoderVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_METHOD(onRTPDecoderStateChanged, IRTPDecoderPtr, States) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::IRTPDecoderDelegate, ortc::internal::IRTPDecoderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IRTPDecoderPtr, IRTPDecoderPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IRTP::States, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyRTPDecoderAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyRTPDecoderVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onRTPDecoderStateChanged, IRTPDecoderPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() + + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPDecoderAysncDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_METHOD(onRTPDecoderRTPPacket, ImmutableMediaChannelTracePtr, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onRTPDecoderRTCPPacket, ImmutableMediaChannelTracePtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_IRTPEncoder.h b/ortc/internal/ortc_IRTPEncoder.h new file mode 100644 index 00000000..b5623761 --- /dev/null +++ b/ortc/internal/ortc_IRTPEncoder.h @@ -0,0 +1,293 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderVideoForMediaEngine); + + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPEncoderAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPEncoderVideo); + + ZS_DECLARE_INTERACTION_PROXY(IRTPEncoderAysncDelegate); + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPEncoder + // + + interaction IRTPEncoder : public IRTP + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept = 0; + virtual void notifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept = 0; + + virtual ~IRTPEncoder() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPEncoderAudio + // + + interaction IRTPEncoderAudio : public IRTPEncoder + { + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderAudio); + + static PromiseWithRTPEncoderAudioPtr create( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPEncoderAudio() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPEncoderVideo + // + + interaction IRTPEncoderVideo : public IRTPEncoder + { + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderVideo); + + static PromiseWithRTPEncoderVideoPtr create( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPEncoderVideo() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderDelegate + // + + interaction IRTPEncoderDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IRTP::States, States); + + virtual void notifyRTPEncoderRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept = 0; + virtual void notifyRTPEncoderRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept = 0; + + virtual void onRTPEncoderStateChanged( + IRTPEncoderPtr encoder, + States state + ) = 0; + }; + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // IRTPEncoderSubscription + // + + interaction IRTPEncoderSubscription + { + virtual PUID getID() const noexcept = 0; + + virtual void cancel() noexcept = 0; + + virtual void background() noexcept = 0; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPEncoderForMediaEngine + // + + interaction IRTPEncoderForMediaEngine : public IRTPForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPEncoderForMediaEngine, ForMediaEngine); + + virtual ~IRTPEncoderForMediaEngine() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPEncoderAudioForMediaEngine + // + + interaction IRTPEncoderAudioForMediaEngine : public IRTPEncoderForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPEncoderAudioForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderAudio, UseMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderAudio); + + static ForMediaEnginePtr create( + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPEncoderAudioForMediaEngine() noexcept {} + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IRTPEncoderVideoForMediaEngine + // + + interaction IRTPEncoderVideoForMediaEngine : public IRTPEncoderForMediaEngine + { + ZS_DECLARE_TYPEDEF_PTR(IRTPEncoderVideoForMediaEngine, ForMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderVideo, UseMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderVideo); + + static ForMediaEnginePtr create( + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + virtual ~IRTPEncoderVideoForMediaEngine() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderAsyncDelegate + // + + interaction IRTPEncoderAysncDelegate + { + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + virtual void onRTPEncoderAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) = 0; + virtual void onRTPEncoderVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) = 0; + }; + + } +} + + + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPEncoderDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPEncoderPtr, IRTPEncoderPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTP::States, States) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyRTPEncoderRTPPacket, ImmutableMediaChannelTracePtr, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD_SYNC(notifyRTPEncoderRTCPPacket, ImmutableMediaChannelTracePtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onRTPEncoderStateChanged, IRTPEncoderPtr, States) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::IRTPEncoderDelegate, ortc::internal::IRTPEncoderSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IRTPEncoderPtr, IRTPEncoderPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::IRTP::States, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyRTPEncoderRTPPacket, ImmutableMediaChannelTracePtr, RTPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_SYNC(notifyRTPEncoderRTCPPacket, ImmutableMediaChannelTracePtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onRTPEncoderStateChanged, IRTPEncoderPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() + +ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPEncoderAysncDelegate) +ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::ImmutableMediaChannelTracePtr, ImmutableMediaChannelTracePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPEncoderAysncDelegate::AudioFramePtr, AudioFramePtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPEncoderAysncDelegate::VideoFramePtr, VideoFramePtr) +ZS_DECLARE_PROXY_METHOD(onRTPEncoderAudioFrame, ImmutableMediaChannelTracePtr, AudioFramePtr) +ZS_DECLARE_PROXY_METHOD(onRTPEncoderVideoFrame, ImmutableMediaChannelTracePtr, VideoFramePtr) +ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_ISRTPTransport.h b/ortc/internal/ortc_ISRTPTransport.h index daed0f73..c3a9da3e 100644 --- a/ortc/internal/ortc_ISRTPTransport.h +++ b/ortc/internal/ortc_ISRTPTransport.h @@ -48,9 +48,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportTypes - #pragma mark + // + // ISRTPTransportTypes + // interaction ISRTPTransportTypes { @@ -60,22 +60,22 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransport - #pragma mark + // + // ISRTPTransport + // interaction ISRTPTransport : public ISRTPTransportTypes { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportDelegate - #pragma mark + // + // ISRTPTransportDelegate + // interaction ISRTPTransportDelegate { @@ -90,27 +90,27 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportSubscription - #pragma mark + // + // ISRTPTransportSubscription + // interaction ISRTPTransportSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } } ZS_DECLARE_PROXY_BEGIN(ortc::internal::ISRTPTransportDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISRTPTransportPtr, ISRTPTransportPtr) -ZS_DECLARE_PROXY_METHOD_3(onSRTPTransportLifetimeRemaining, ISRTPTransportPtr, ULONG, ULONG) +ZS_DECLARE_PROXY_METHOD(onSRTPTransportLifetimeRemaining, ISRTPTransportPtr, ULONG, ULONG) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::ISRTPTransportDelegate, ortc::internal::ISRTPTransportSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::ISRTPTransportPtr, ISRTPTransportPtr) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_3(onSRTPTransportLifetimeRemaining, ISRTPTransportPtr, ULONG, ULONG) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSRTPTransportLifetimeRemaining, ISRTPTransportPtr, ULONG, ULONG) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/internal/ortc_ISecureTransport.h b/ortc/internal/ortc_ISecureTransport.h index f9cae518..772479d5 100644 --- a/ortc/internal/ortc_ISecureTransport.h +++ b/ortc/internal/ortc_ISecureTransport.h @@ -43,9 +43,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportTypes - #pragma mark + // + // ISecureTransportTypes + // interaction ISecureTransportTypes { @@ -57,29 +57,29 @@ namespace ortc State_Closed, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransport - #pragma mark + // + // ISecureTransport + // interaction ISecureTransport : public ISecureTransportTypes { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportDelegate - #pragma mark + // + // ISecureTransportDelegate + // interaction ISecureTransportDelegate { @@ -95,32 +95,32 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportSubscription - #pragma mark + // + // ISecureTransportSubscription + // interaction ISecureTransportSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForRTPSender - #pragma mark + // + // ISecureTransportForRTPSender + // interaction ISecureTransportForRTPSender { - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPSender, ForRTPSender) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPSender, ForRTPSender); - static ElementPtr toDebug(ForRTPSenderPtr transport); + static ElementPtr toDebug(ForRTPSenderPtr transport) noexcept; static void getSendingTransport( IRTPTransportPtr inRTPTransport, @@ -129,37 +129,37 @@ namespace ortc IICETypes::Components &outWhenSendingRTCPUseSendOverComponent, ForRTPSenderPtr &outRTPSecureTransport, ForRTPSenderPtr &outRTCPSecureTransport - ); + ) noexcept(false); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) = 0; + virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept = 0; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const = 0; + virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const noexcept = 0; virtual bool sendPacket( IICETypes::Components sendOverICETransport, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; - virtual IICETransportPtr getICETransport() const = 0; + virtual IICETransportPtr getICETransport() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForRTPReceiver - #pragma mark + // + // ISecureTransportForRTPReceiver + // interaction ISecureTransportForRTPReceiver { - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPReceiver, ForRTPReceiver) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPReceiver, ForRTPReceiver); - static ElementPtr toDebug(ForRTPReceiverPtr transport); + static ElementPtr toDebug(ForRTPReceiverPtr transport) noexcept; static void getReceivingTransport( IRTPTransportPtr inRTPTransport, @@ -168,165 +168,165 @@ namespace ortc IICETypes::Components &outWhenReceivingRTCPUseReceiveOverComponent, ForRTPReceiverPtr &outRTPSecureTransport, ForRTPReceiverPtr &outRTCPSecureTransport - ); + ) noexcept(false); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) = 0; + virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept = 0; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const = 0; + virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const noexcept = 0; virtual bool sendPacket( IICETypes::Components sendOverICETransport, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; - virtual IICETransportPtr getICETransport() const = 0; + virtual IICETransportPtr getICETransport() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForSRTPTransport - #pragma mark + // + // ISecureTransportForSRTPTransport + // interaction ISecureTransportForSRTPTransport { - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, ForSRTP) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, ForSRTP); - static ElementPtr toDebug(ForSRTPPtr transport); + static ElementPtr toDebug(ForSRTPPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual bool sendEncryptedPacket( IICETypes::Components sendOverICETransport, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; virtual bool handleReceivedDecryptedPacket( IICETypes::Components viaTransport, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForICETransport - #pragma mark + // + // ISecureTransportForICETransport + // interaction ISecureTransportForICETransport { - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForICETransport, ForICETransport) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForICETransport, ForICETransport); - static ElementPtr toDebug(ForICETransportPtr transport); + static ElementPtr toDebug(ForICETransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual void notifyAssociateTransportCreated( IICETypes::Components associatedComponent, ICETransportPtr assoicated - ) = 0; + ) noexcept = 0; virtual bool handleReceivedPacket( IICETypes::Components viaComponent, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; virtual void handleReceivedSTUNPacket( IICETypes::Components viaComponent, STUNPacketPtr packet - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForRTPListener - #pragma mark + // + // ISecureTransportForRTPListener + // interaction ISecureTransportForRTPListener { ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPListener, ForRTPListener) - static ElementPtr toDebug(ForRTPListenerPtr transport); + static ElementPtr toDebug(ForRTPListenerPtr transport) noexcept; - static ForRTPListenerPtr convert(IRTPTransportPtr transport); + static ForRTPListenerPtr convert(IRTPTransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual RTPListenerPtr getListener() const = 0; + virtual RTPListenerPtr getListener() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISecureTransportForDataTransport - #pragma mark + // + // ISecureTransportForDataTransport + // interaction ISecureTransportForDataTransport { - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, ForDataTransport) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, ForDataTransport); - ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, UseDataTransport) + ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, UseDataTransport); - static ElementPtr toDebug(ForDataTransportPtr transport); + static ElementPtr toDebug(ForDataTransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) = 0; + virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept = 0; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const = 0; + virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const noexcept = 0; - virtual bool isClientRole() const = 0; + virtual bool isClientRole() const noexcept = 0; - virtual UseDataTransportPtr getDataTransport() const = 0; + virtual UseDataTransportPtr getDataTransport() const noexcept = 0; virtual bool sendDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDataTransportForSecureTransport - #pragma mark + // + // IDataTransportForSecureTransport + // interaction IDataTransportForSecureTransport { - ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, ForSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, ForSecureTransport); - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport); - static ElementPtr toDebug(ForSecureTransportPtr transport); + static ElementPtr toDebug(ForSecureTransportPtr transport) noexcept; - static ForSecureTransportPtr create(UseSecureTransportPtr transport); + static ForSecureTransportPtr create(UseSecureTransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual bool handleDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; }; } @@ -335,11 +335,11 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::internal::ISecureTransportDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransportPtr, ISecureTransportPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransportTypes::States, States) -ZS_DECLARE_PROXY_METHOD_2(onSecureTransportStateChanged, ISecureTransportPtr, States) +ZS_DECLARE_PROXY_METHOD(onSecureTransportStateChanged, ISecureTransportPtr, States) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::ISecureTransportDelegate, ortc::internal::ISecureTransportSubscription) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::ISecureTransportPtr, ISecureTransportPtr) ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(ortc::internal::ISecureTransportTypes::States, States) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_2(onSecureTransportStateChanged, ISecureTransportPtr, States) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSecureTransportStateChanged, ISecureTransportPtr, States) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() diff --git a/ortc/internal/ortc_Identity.h b/ortc/internal/ortc_Identity.h index 15037728..e8c49c50 100644 --- a/ortc/internal/ortc_Identity.h +++ b/ortc/internal/ortc_Identity.h @@ -48,9 +48,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark Identity - #pragma mark + // + // Identity + // class Identity : public Noop, public MessageQueueAssociator, @@ -71,92 +71,92 @@ namespace ortc const make_private &, IMessageQueuePtr queue, IDTLSTransportPtr transport - ); + ) noexcept; protected: - Identity(Noop) : + Identity(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~Identity(); + virtual ~Identity() noexcept; - static IdentityPtr convert(IIdentityPtr object); + static IdentityPtr convert(IIdentityPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IIdentity - #pragma mark + // + // Identity => IIdentity + // - static ElementPtr toDebug(IdentityPtr object); + static ElementPtr toDebug(IdentityPtr object) noexcept; - static IdentityPtr create(IDTLSTransportPtr transport); + static IdentityPtr create(IDTLSTransportPtr transport) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual AssertionPtr peerIdentity() const override; + AssertionPtr peerIdentity() const noexcept override; - virtual IDTLSTransportPtr transport() const override; + IDTLSTransportPtr transport() const noexcept override; - virtual PromiseWithResultPtr getIdentityAssertion( - const char *provider, - const char *protoocl = "default", - const char *username = NULL - ) throw (InvalidStateError) override; + PromiseWithResultPtr getIdentityAssertion( + const char *provider, + const char *protoocol = "default", + const char *username = NULL + ) noexcept(false) override; // throws InvalidStateError - virtual PromiseWithAssertionPtr setIdentityAssertion(const String &assertion) override; + PromiseWithAssertionPtr setIdentityAssertion(const String &assertion) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IWakeDelegate - #pragma mark + // + // Identity => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => ITimerDelegate - #pragma mark + // + // Identity => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => IIdentityAsyncDelegate - #pragma mark + // + // Identity => IIdentityAsyncDelegate + // protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => (internal) - #pragma mark + // + // Identity => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); + void step() noexcept; - bool stepBogusDoSomething(); + bool stepBogusDoSomething() noexcept; - void cancel(); + void cancel() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark Identity => (data) - #pragma mark + // + // Identity => (data) + // AutoPUID mID; IdentityWeakPtr mThisWeak; @@ -169,15 +169,15 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IIdentityFactory - #pragma mark + // + // IIdentityFactory + // interaction IIdentityFactory { - static IIdentityFactory &singleton(); + static IIdentityFactory &singleton() noexcept; - virtual IdentityPtr create(IDTLSTransportPtr transport); + virtual IdentityPtr create(IDTLSTransportPtr transport) noexcept; }; class IdentityFactory : public IFactory {}; diff --git a/ortc/internal/ortc_MediaChannelTraceHelper.h b/ortc/internal/ortc_MediaChannelTraceHelper.h new file mode 100644 index 00000000..36585f84 --- /dev/null +++ b/ortc/internal/ortc_MediaChannelTraceHelper.h @@ -0,0 +1,90 @@ +/* + + Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include + +#include + +#define ORTC_SETTING_MEDIA_CHANNEL_TRACE_HELPER_USAGE_INACTIVITY_AGE_PURGE_TIME_IN_SECONDS "ortc/media-channel-trace-helper/usage-inactivity-age-purge-time-in-seconds" +#define ORTC_SETTING_MEDIA_CHANNEL_TRACE_HELPER_USAGE_INACTIVITY_AGE_CHECK_MODULAS_VALUE "ortc/media-channel-trace-helper/usage-inactivity-age-check-modulas-value" + +namespace ortc +{ + namespace internal + { + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // MediaChannelTraceHelper + // + + class MediaChannelTraceHelper : public SharedRecursiveLock + { + public: + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + typedef uintptr_t TraceHandle; + + struct TraceSourceInfo + { + int lastUsageAt_ {}; + ImmutableMediaChannelTracePtr trace_; + }; + + typedef std::unordered_map TraceSourceInfoMap; + + public: + MediaChannelTraceHelper(MediaChannelID mediaChannelID) noexcept; + + ImmutableMediaChannelTracePtr trace(ImmutableMediaChannelTracePtr sourceTrace) noexcept; + + protected: + void doPurge() noexcept; + + protected: + AutoPUID id_; + MediaChannelID selfChannelID_ {}; + std::atomic lastUsageCount_ {}; + TraceSourceInfoMap traceSources_; + + Time lastAgeCountTimeAt_ {}; + int lastAgeCountValueAtTime_ {}; + Seconds agePurge_ {}; + int ageCheck_ {}; + }; + } +} diff --git a/ortc/internal/ortc_MediaDeviceCaptureAudio.h b/ortc/internal/ortc_MediaDeviceCaptureAudio.h new file mode 100644 index 00000000..eb057500 --- /dev/null +++ b/ortc/internal/ortc_MediaDeviceCaptureAudio.h @@ -0,0 +1,497 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include +#include + +#include + +namespace ortc +{ + namespace internal + { + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio + // + + class MediaDeviceCaptureAudio : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaDeviceCaptureAudioForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IMediaDeviceCaptureAudioForMediaEngine; + + ZS_DECLARE_CLASS_PTR(Media); + ZS_DECLARE_CLASS_PTR(MediaSubscriber); + + friend class Media; + friend class MediaSubscriber; + + typedef PUID ObjectID; + typedef std::map MediaSubscriberMap; + ZS_DECLARE_PTR(MediaSubscriberMap); + + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::MediaChannelTrace, MediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, PromiseWithSettingsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::States, States); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, UsePromiseWithSettingsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, UseSettings); + ZS_DECLARE_TYPEDEF_PTR(std::list, SettingsList); + + ZS_DECLARE_TYPEDEF_PTR(std::list, TrackConstraintsList); + + struct PendingSubscriber + { + MediaDeviceCapturePromisePtr promise_; + MediaDeviceObjectID repaceExistingDeviceObjectID_ {}; + TrackConstraintsPtr constraints_; + IMediaDeviceCaptureDelegatePtr delegate_; + }; + + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingSubscriberList); + + public: + MediaDeviceCaptureAudio( + const make_private &, + IMessageQueuePtr queue, + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + + protected: + MediaDeviceCaptureAudio(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + void init() noexcept; + + public: + virtual ~MediaDeviceCaptureAudio() noexcept; + + static MediaDeviceCaptureAudioPtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + + static MediaDeviceCaptureAudioPtr convert(ForMediaEnginePtr object) noexcept; + + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (for Media) + // + + void notifyMediaStateChanged() noexcept; + void notifyMediaFailure( + MediaPtr media, + WORD errorCode, + const char *reason + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (for MediaSubscribers) + // + + PUID getID() const noexcept { return id_; } + void notifySusbcriberGone() noexcept; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IMediaDeviceForMediaEngine + // + + bool isDeviceIdle() noexcept override; + void shutdown() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IMediaDeviceCaptureForMediaEngine + // + + void mediaDeviceCaptureSubscribe( + MediaDeviceCapturePromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IMediaDeviceCaptureAudioForMediaEngine + // + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (internal) + // + + bool isPending() const noexcept { return IMediaDevice::State_Pending == currentState_; } + bool isReady() const noexcept { return IMediaDevice::State_Active == currentState_; } + bool isReinitializing() const noexcept { return IMediaDevice::State_Reinitializing == currentState_; } + bool isShuttingDown() const noexcept { return IMediaDevice::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IMediaDevice::State_Shutdown == currentState_; } + + void cancel() noexcept; + + bool stepShutdownPendingRequests() noexcept; + bool stepShutdownSubscribers() noexcept; + bool stepShutdownMedia() noexcept; + + void step() noexcept; + bool stepMediaReinitializationShutdown() noexcept; + bool stepDiscoverModes() noexcept; + bool stepFigureOutMode() noexcept; + bool stepWaitForMediaDevice() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + public: + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media + // + + class Media : public MessageQueueAssociator, + public SharedRecursiveLock, + public zsLib::IWakeDelegate + { + protected: + struct make_private {}; + + enum MediaStates + { + MediaState_Pending, + MediaState_Ready, + MediaState_ShuttingDown, + MediaState_Shutdown, + }; + + static const char *toString(MediaStates state) noexcept; + + public: + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceCaptureAudio, UseOuter); + + public: + Media( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept; + + protected: + void init() noexcept; + + public: + virtual ~Media() noexcept; + + static MediaPtr create( + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept; + + public: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => (for MediaDeviceCaptureAudio) + // + + MediaChannelID getID() const noexcept { return id_; } + + void shutdown() noexcept; + bool isReady() const noexcept; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; + + void notifySubscribersChanged(MediaSubscriberMapPtr subscribers) noexcept; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => IWakeDelegate + // + + void onWake() override; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => (internal) + // + + void cancel() noexcept; + void step() noexcept; + + void setState(MediaStates state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD errorCode, const char *inReason) noexcept; + + void internalNotifySubscribersOfFrame(AudioFramePtr frame) noexcept; + + public: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::Media => (data) + // + + AutoPUID id_; + MediaWeakPtr thisWeak_; + + MediaPtr gracefulShutdownReference_; + + UseOuterWeakPtr outer_; + MediaSubscriberMapPtr subscribers_; + String deviceID_; + UseSettingsPtr settings_; + MediaChannelTracePtr trace_; + + MediaStates currentState_ {MediaState_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber + // + + class MediaSubscriber : public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaDeviceCaptureAudio + { + protected: + struct make_private {}; + + public: + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceCaptureAudio, UseOuter); + + public: + MediaSubscriber( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + protected: + void init() noexcept; + + public: + virtual ~MediaSubscriber() noexcept; + + static MediaSubscriberPtr create( + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (for MediaDeviceCaptureAudio) + // + + MediaDeviceObjectID getID() const noexcept override { return id_; } + void shutdown() noexcept; + bool isShutdown() const noexcept; + void notifyStateChanged(States state) noexcept; + TrackConstraintsPtr getConstraints() const noexcept { return constraints_; } + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (for Media) + // + + void notifyFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => IMediaDevice + // + + // (duplicate) virtual MediaDeviceObjectID getID() const override { return id_; } + void cancel() noexcept override; + + States getState() const noexcept override; + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => IMediaDeviceCapture + // + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => IMediaDeviceCaptureAudio + // + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (internal) + // + + void setState(States state) noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio::MediaSubscriber => (data) + // + + AutoPUID id_; + MediaSubscriberWeakPtr thisWeak_; + + UseOuterWeakPtr outer_; + TrackConstraintsPtr constraints_; + + IMediaDeviceCaptureDelegateWeakPtr notifyDelegate_; + IMediaDeviceCaptureDelegatePtr delegate_; + + States lastReportedState_; + + MediaChannelTraceHelper traceHelper_; + }; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureAudio => (data) + // + + AutoPUID id_; + MediaDeviceCaptureAudioWeakPtr thisWeak_; + + MediaDeviceCaptureAudioPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + String deviceID_; + + States currentState_ {IMediaDevice::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithSettingsListPtr deviceModesPromise_; + SettingsList deviceModes_; + + PendingSubscriberList pendingSubscribers_; + MediaSubscriberMapPtr subscribers_; + + std::atomic recheckMode_ {}; + UseSettingsPtr requiredSettings_; + MediaPtr media_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureAudioFactory + // + + interaction IMediaDeviceCaptureAudioFactory + { + static IMediaDeviceCaptureAudioFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCaptureAudio, UseMediaEngine); + + virtual MediaDeviceCaptureAudioPtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + }; + + class MediaDeviceCaptureAudioFactory : public IFactory {}; + } +} diff --git a/ortc/internal/ortc_MediaDeviceCaptureVideo.h b/ortc/internal/ortc_MediaDeviceCaptureVideo.h new file mode 100644 index 00000000..1915a1c2 --- /dev/null +++ b/ortc/internal/ortc_MediaDeviceCaptureVideo.h @@ -0,0 +1,502 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include +#include + +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureVideoForMediaEngine); + + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCaptureVideo); + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo (helpers) + // + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo + // + + class MediaDeviceCaptureVideo : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaDeviceCaptureVideoForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IMediaDeviceCaptureVideoForMediaEngine; + + ZS_DECLARE_CLASS_PTR(Media); + ZS_DECLARE_CLASS_PTR(MediaSubscriber); + + friend class Media; + friend class MediaSubscriber; + + typedef PUID ObjectID; + typedef std::map MediaSubscriberMap; + ZS_DECLARE_PTR(MediaSubscriberMap); + + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::MediaChannelTrace, MediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, PromiseWithSettingsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::States, States); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, UsePromiseWithSettingsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, UseSettings); + ZS_DECLARE_TYPEDEF_PTR(std::list, SettingsList); + + ZS_DECLARE_TYPEDEF_PTR(std::list, TrackConstraintsList); + + struct PendingSubscriber + { + MediaDeviceCapturePromisePtr promise_; + MediaDeviceObjectID repaceExistingDeviceObjectID_ {}; + TrackConstraintsPtr constraints_; + IMediaDeviceCaptureDelegatePtr delegate_; + }; + + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingSubscriberList); + + public: + MediaDeviceCaptureVideo( + const make_private &, + IMessageQueuePtr queue, + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + + protected: + MediaDeviceCaptureVideo(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + void init() noexcept; + + public: + virtual ~MediaDeviceCaptureVideo() noexcept; + + static MediaDeviceCaptureVideoPtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + + static MediaDeviceCaptureVideoPtr convert(ForMediaEnginePtr object) noexcept; + + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (for Media) + // + + void notifyMediaStateChanged() noexcept; + void notifyMediaFailure( + MediaPtr media, + WORD errorCode, + const char *reason + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (for MediaSubscribers) + // + + PUID getID() const noexcept { return id_; } + void notifySusbcriberGone() noexcept; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IMediaDeviceForMediaEngine + // + + bool isDeviceIdle() noexcept override; + void shutdown() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IMediaDeviceCaptureForMediaEngine + // + + virtual void mediaDeviceCaptureSubscribe( + MediaDeviceCapturePromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IMediaDeviceCaptureVideoForMediaEngine + // + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (internal) + // + + bool isPending() const noexcept { return IMediaDevice::State_Pending == currentState_; } + bool isReady() const noexcept { return IMediaDevice::State_Active == currentState_; } + bool isReinitializing() const noexcept { return IMediaDevice::State_Reinitializing == currentState_; } + bool isShuttingDown() const noexcept { return IMediaDevice::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IMediaDevice::State_Shutdown == currentState_; } + + void cancel() noexcept; + + bool stepShutdownPendingRequests() noexcept; + bool stepShutdownSubscribers() noexcept; + bool stepShutdownMedia() noexcept; + + void step() noexcept; + bool stepMediaReinitializationShutdown() noexcept; + bool stepDiscoverModes() noexcept; + bool stepFigureOutMode() noexcept; + bool stepWaitForMediaDevice() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + public: + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media + // + + class Media : public MessageQueueAssociator, + public SharedRecursiveLock, + public zsLib::IWakeDelegate + { + protected: + struct make_private {}; + + enum MediaStates + { + MediaState_Pending, + MediaState_Ready, + MediaState_ShuttingDown, + MediaState_Shutdown, + }; + + static const char *toString(MediaStates state) noexcept; + + public: + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceCaptureVideo, UseOuter); + + public: + Media( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept; + + protected: + void init() noexcept; + + public: + virtual ~Media() noexcept; + + static MediaPtr create( + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept; + + public: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => (for MediaDeviceCaptureVideo) + // + + MediaChannelID getID() const noexcept { return id_; } + + void shutdown() noexcept; + bool isReady() const noexcept; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; + + void notifySubscribersChanged(MediaSubscriberMapPtr subscribers) noexcept; + + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => IWakeDelegate + // + + void onWake() override; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => (internal) + // + + void cancel() noexcept; + void step() noexcept; + + void setState(MediaStates state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD errorCode, const char *inReason) noexcept; + + void internalNotifySubscribersOfFrame(VideoFramePtr frame) noexcept; + + public: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::Media => (data) + // + + AutoPUID id_; + MediaWeakPtr thisWeak_; + + MediaPtr gracefulShutdownReference_; + + UseOuterWeakPtr outer_; + MediaSubscriberMapPtr subscribers_; + String deviceID_; + UseSettingsPtr settings_; + MediaChannelTracePtr trace_; + + MediaStates currentState_ {MediaState_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber + // + + class MediaSubscriber : public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaDeviceCaptureVideo + { + protected: + struct make_private {}; + + public: + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceCaptureVideo, UseOuter); + + public: + MediaSubscriber( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + protected: + void init() noexcept; + + public: + virtual ~MediaSubscriber() noexcept; + + static MediaSubscriberPtr create( + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (for MediaDeviceCaptureVideo) + // + + MediaDeviceObjectID getID() const noexcept override { return id_; } + void shutdown() noexcept; + bool isShutdown() const noexcept; + void notifyStateChanged(States state) noexcept; + TrackConstraintsPtr getConstraints() const noexcept { return constraints_; } + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (for Media) + // + + void notifyFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => IMediaDevice + // + + // (duplicate) virtual MediaDeviceObjectID getID() const override { return id_; } + void cancel() noexcept override; + + States getState() const noexcept override; + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => IMediaDeviceCapture + // + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => IMediaDeviceCaptureVideo + // + + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (internal) + // + + void setState(States state) noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo::MediaSubscriber => (data) + // + + AutoPUID id_; + MediaSubscriberWeakPtr thisWeak_; + + UseOuterWeakPtr outer_; + TrackConstraintsPtr constraints_; + + IMediaDeviceCaptureDelegateWeakPtr notifyDelegate_; + IMediaDeviceCaptureDelegatePtr delegate_; + + States lastReportedState_; + + MediaChannelTraceHelper traceHelper_; + }; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceCaptureVideo => (data) + // + + AutoPUID id_; + MediaDeviceCaptureVideoWeakPtr thisWeak_; + + MediaDeviceCaptureVideoPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + String deviceID_; + + States currentState_ {IMediaDevice::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithSettingsListPtr deviceModesPromise_; + SettingsList deviceModes_; + + PendingSubscriberList pendingSubscribers_; + MediaSubscriberMapPtr subscribers_; + + std::atomic recheckMode_ {}; + UseSettingsPtr requiredSettings_; + MediaPtr media_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceCaptureVideoFactory + // + + interaction IMediaDeviceCaptureVideoFactory + { + static IMediaDeviceCaptureVideoFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCaptureVideo, UseMediaEngine); + + virtual MediaDeviceCaptureVideoPtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + }; + + class MediaDeviceCaptureVideoFactory : public IFactory {}; + } +} diff --git a/ortc/internal/ortc_MediaDeviceRenderAudio.h b/ortc/internal/ortc_MediaDeviceRenderAudio.h new file mode 100644 index 00000000..8b21624c --- /dev/null +++ b/ortc/internal/ortc_MediaDeviceRenderAudio.h @@ -0,0 +1,502 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include +#include + +#include + +namespace ortc +{ + namespace internal + { + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaDeviceRenderAudio + // + + class MediaDeviceRenderAudio : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaDeviceRenderAudioForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IMediaDeviceRenderAudioForMediaEngine; + + ZS_DECLARE_CLASS_PTR(Media); + ZS_DECLARE_CLASS_PTR(MediaSubscriber); + + friend class Media; + friend class MediaSubscriber; + + typedef PUID ObjectID; + typedef std::map MediaSubscriberMap; + ZS_DECLARE_PTR(MediaSubscriberMap); + + typedef IMediaStreamTrackTypes::MediaChannelID MediaChannelID; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, PromiseWithSettingsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::States, States); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, UsePromiseWithSettingsList); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, UseSettings); + ZS_DECLARE_TYPEDEF_PTR(std::list, SettingsList); + + ZS_DECLARE_TYPEDEF_PTR(std::list, TrackConstraintsList); + + struct PendingSubscriber + { + MediaDeviceRenderPromisePtr promise_; + MediaDeviceObjectID repaceExistingDeviceObjectID_ {}; + TrackConstraintsPtr constraints_; + IMediaDeviceRenderDelegatePtr delegate_; + }; + + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingSubscriberList); + + public: + MediaDeviceRenderAudio( + const make_private &, + IMessageQueuePtr queue, + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + + protected: + MediaDeviceRenderAudio(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + void init() noexcept; + + public: + virtual ~MediaDeviceRenderAudio() noexcept; + + static MediaDeviceRenderAudioPtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + + static MediaDeviceRenderAudioPtr convert(ForMediaEnginePtr object) noexcept; + + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (for Media) + // + + void notifyMediaStateChanged() noexcept; + void notifyMediaFailure( + MediaPtr media, + WORD errorCode, + const char *reason + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (for MediaSubscribers) + // + + PUID getID() const noexcept { return id_; } + void notifySusbcriberGone() noexcept; + void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IMediaDeviceForMediaEngine + // + + bool isDeviceIdle() noexcept override; + void shutdown() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IMediaDeviceRenderForMediaEngine + // + + void mediaDeviceRenderSubscribe( + MediaDeviceRenderPromisePtr promise, + MediaDeviceObjectID repaceExistingDeviceObjectID, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IMediaDeviceRenderAudioForMediaEngine + // + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (internal) + // + + bool isPending() const noexcept { return IMediaDevice::State_Pending == currentState_; } + bool isReady() const noexcept { return IMediaDevice::State_Active == currentState_; } + bool isReinitializing() const noexcept { return IMediaDevice::State_Reinitializing == currentState_; } + bool isShuttingDown() const noexcept { return IMediaDevice::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IMediaDevice::State_Shutdown == currentState_; } + + void cancel() noexcept; + + bool stepShutdownPendingRequests() noexcept; + bool stepShutdownSubscribers() noexcept; + bool stepShutdownMedia() noexcept; + + void step() noexcept; + bool stepMediaReinitializationShutdown() noexcept; + bool stepDiscoverModes() noexcept; + bool stepFigureOutMode() noexcept; + bool stepWaitForMediaDevice() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + public: + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media + // + + class Media : public MessageQueueAssociator, + public SharedRecursiveLock, + public zsLib::IWakeDelegate + { + protected: + struct make_private {}; + + enum MediaStates + { + MediaState_Pending, + MediaState_Ready, + MediaState_ShuttingDown, + MediaState_Shutdown, + }; + + static const char *toString(MediaStates state) noexcept; + + public: + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceRenderAudio, UseOuter); + + public: + Media( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept; + + protected: + void init() noexcept; + + public: + virtual ~Media() noexcept; + + static MediaPtr create( + IMessageQueuePtr queue, + UseOuterPtr outer, + const String &deviceID, + UseSettingsPtr settings + ) noexcept; + + public: + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => (for MediaDeviceRenderAudio) + // + + MediaChannelID getID() const noexcept { return id_; } + + void shutdown() noexcept; + bool isReady() const noexcept; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; + + void notifySubscribersChanged(MediaSubscriberMapPtr subscribers) noexcept; + + void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => IWakeDelegate + // + + virtual void onWake() override; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => (internal) + // + + void cancel() noexcept; + void step() noexcept; + + void setState(MediaStates state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD errorCode, const char *inReason) noexcept; + + public: + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::Media => (data) + // + + AutoPUID id_; + MediaWeakPtr thisWeak_; + + MediaPtr gracefulShutdownReference_; + + UseOuterWeakPtr outer_; + MediaSubscriberMapPtr subscribers_; + String deviceID_; + UseSettingsPtr settings_; + + MediaStates currentState_ {MediaState_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + }; + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber + // + + class MediaSubscriber : public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaDeviceRenderAudio + { + protected: + struct make_private {}; + + public: + ZS_DECLARE_TYPEDEF_PTR(MediaDeviceRenderAudio, UseOuter); + + public: + MediaSubscriber( + const make_private &, + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept; + + protected: + void init() noexcept; + + public: + virtual ~MediaSubscriber() noexcept; + + static MediaSubscriberPtr create( + IMessageQueuePtr queue, + UseOuterPtr outer, + TrackConstraintsPtr constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept; + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (for MediaDeviceRenderAudio) + // + + MediaDeviceObjectID getID() const noexcept override { return id_; } + void shutdown() noexcept; + bool isShutdown() const noexcept; + void notifyStateChanged(States state) noexcept; + TrackConstraintsPtr getConstraints() const noexcept { return constraints_; } + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (for Media) + // + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDevice + // + + // (duplicate) virtual MediaDeviceObjectID getID() const override { return id_; } + virtual void cancel() noexcept override; + + virtual States getState() const noexcept override; + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDeviceRender + // + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => IMediaDeviceRenderAudio + // + + virtual void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (internal) + // + + void setState(States state) noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaDeviceRenderAudio::MediaSubscriber => (data) + // + + AutoPUID id_; + MediaSubscriberWeakPtr thisWeak_; + + UseOuterWeakPtr outer_; + TrackConstraintsPtr constraints_; + + IMediaDeviceRenderDelegateWeakPtr notifyDelegate_; + IMediaDeviceRenderDelegatePtr delegate_; + + States lastReportedState_; + MediaChannelTraceHelper traceHelper_; + }; + + protected: + //----------------------------------------------------------------------- + // + // MediaDeviceRenderAudio => (data) + // + + AutoPUID id_; + MediaDeviceRenderAudioWeakPtr thisWeak_; + + MediaDeviceRenderAudioPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + String deviceID_; + + States currentState_ {IMediaDevice::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithSettingsListPtr deviceModesPromise_; + SettingsList deviceModes_; + + PendingSubscriberList pendingSubscribers_; + MediaSubscriberMapPtr subscribers_; + + std::atomic recheckMode_ {}; + UseSettingsPtr requiredSettings_; + MediaPtr media_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaDeviceRenderAudioFactory + // + + interaction IMediaDeviceRenderAudioFactory + { + static IMediaDeviceRenderAudioFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceRenderAudio, UseMediaEngine); + + virtual MediaDeviceRenderAudioPtr create( + UseMediaEnginePtr mediaEngine, + const String &deviceID + ) noexcept; + }; + + class MediaDeviceRenderAudioFactory : public IFactory {}; + } +} diff --git a/ortc/internal/ortc_MediaDevices.h b/ortc/internal/ortc_MediaDevices.h index a695d8da..b4d2aed6 100644 --- a/ortc/internal/ortc_MediaDevices.h +++ b/ortc/internal/ortc_MediaDevices.h @@ -52,17 +52,19 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesAsyncDelegate - #pragma mark + // + // IMediaDevicesAsyncDelegate + // interaction IMediaDevicesAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::Constraints, Constraints) - ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithDeviceList, PromiseWithDeviceList) - ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr, PromiseWithMediaStreamTrackListPtr) + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::Constraints, Constraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithDeviceList, PromiseWithDeviceList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithMediaStreamTrackList, PromiseWithMediaStreamTrackList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, PromiseWithSettingsList); virtual void onEnumerateDevices(PromiseWithDeviceListPtr promise) = 0; + virtual void onEnumerateDefaultModes(PromiseWithSettingsListPtr promise, const char *deviceID) = 0; virtual void onGetUserMedia(PromiseWithMediaStreamTrackListPtr promise, ConstraintsPtr constraints) = 0; }; @@ -71,9 +73,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices - #pragma mark + // + // MediaDevices + // class MediaDevices : public Noop, public MessageQueueAssociator, @@ -98,108 +100,114 @@ namespace ortc State_ShuttingDown, State_Shutdown, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; - ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::Constraints, Constraints) - ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithDeviceList, PromiseWithDeviceList) - ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithMediaStreamTrackList, PromiseWithMediaStreamTrackList) + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::Constraints, Constraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithDeviceList, PromiseWithDeviceList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithMediaStreamTrackList, PromiseWithMediaStreamTrackList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, PromiseWithSettingsList); public: MediaDevices( const make_private &, IMessageQueuePtr queue - ); + ) noexcept; protected: - MediaDevices(Noop) : + MediaDevices(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; - static MediaDevicesPtr create(); - static MediaDevicesPtr singleton(); + static MediaDevicesPtr create() noexcept; + static MediaDevicesPtr singleton() noexcept; public: - virtual ~MediaDevices(); + virtual ~MediaDevices() noexcept; - static MediaDevicesPtr convert(IMediaDevicesPtr object); + static MediaDevicesPtr convert(IMediaDevicesPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => IMediaDevices - #pragma mark + // + // MediaDevices => IMediaDevices + // - static ElementPtr singletonToDebug(); + static ElementPtr singletonToDebug() noexcept; - static SupportedConstraintsPtr getSupportedConstraints(); + static SupportedConstraintsPtr getSupportedConstraints() noexcept; - static PromiseWithDeviceListPtr enumerateDevices(); + static PromiseWithDeviceListPtr enumerateDevices() noexcept; + static PromiseWithSettingsListPtr enumerateDefaultModes(const char *deviceID) noexcept; - static PromiseWithMediaStreamTrackListPtr getUserMedia(const Constraints &constraints = Constraints()); + static PromiseWithMediaStreamTrackListPtr getUserMedia(const Constraints &constraints = Constraints()) noexcept; - static IMediaDevicesSubscriptionPtr subscribe(IMediaDevicesDelegatePtr delegate); + static IMediaDevicesSubscriptionPtr subscribe(IMediaDevicesDelegatePtr delegate) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => IWakeDelegate - #pragma mark + // + // MediaDevices => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => ITimerDelegate - #pragma mark + // + // MediaDevices => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => IMediaDevicesAsyncDelegate - #pragma mark + // + // MediaDevices => IMediaDevicesAsyncDelegate + // - virtual void onEnumerateDevices(PromiseWithDeviceListPtr promise) override; + void onEnumerateDevices(PromiseWithDeviceListPtr promise) override; + void onEnumerateDefaultModes( + PromiseWithSettingsListPtr promise, + const char *deviceID + ) override; - virtual void onGetUserMedia(PromiseWithMediaStreamTrackListPtr promise, ConstraintsPtr constraints) override; + void onGetUserMedia(PromiseWithMediaStreamTrackListPtr promise, ConstraintsPtr constraints) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark MessageQueueManager => ISingletonManagerDelegate - #pragma mark + // + // MessageQueueManager => ISingletonManagerDelegate + // - virtual void notifySingletonCleanup() override; + void notifySingletonCleanup() noexcept override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => (internal) - #pragma mark + // + // MediaDevices => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - bool stepBogusDoSomething(); + void step() noexcept; + bool stepBogusDoSomething() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaDevices => (data) - #pragma mark + // + // MediaDevices => (data) + // AutoPUID mID; MediaDevicesWeakPtr mThisWeak; @@ -217,30 +225,32 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaDevicesFactory - #pragma mark + // + // IMediaDevicesFactory + // interaction IMediaDevicesFactory { - typedef IMediaDevicesTypes::Constraints Constraints; - typedef IMediaDevicesTypes::SupportedConstraintsPtr SupportedConstraintsPtr; - typedef IMediaDevicesTypes::PromiseWithDeviceListPtr PromiseWithDeviceListPtr; - typedef IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr PromiseWithMediaStreamTrackListPtr; + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::Constraints, Constraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::SupportedConstraints, SupportedConstraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithDeviceList, PromiseWithDeviceList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithMediaStreamTrackList, PromiseWithMediaStreamTrackList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithSettingsList, PromiseWithSettingsList); - static IMediaDevicesFactory &singleton(); + static IMediaDevicesFactory &singleton() noexcept; - virtual MediaDevicesPtr create(); + virtual MediaDevicesPtr create() noexcept; - virtual ElementPtr singletonToDebug(); + virtual ElementPtr singletonToDebug() noexcept; - virtual SupportedConstraintsPtr getSupportedConstraints(); + virtual SupportedConstraintsPtr getSupportedConstraints() noexcept; - virtual PromiseWithDeviceListPtr enumerateDevices(); + virtual PromiseWithDeviceListPtr enumerateDevices() noexcept; + virtual PromiseWithSettingsListPtr enumerateDefaultModes(const char *deviceID) noexcept; - virtual PromiseWithMediaStreamTrackListPtr getUserMedia(const Constraints &constraints = Constraints()); + virtual PromiseWithMediaStreamTrackListPtr getUserMedia(const Constraints &constraints = Constraints()) noexcept; - virtual IMediaDevicesSubscriptionPtr subscribe(IMediaDevicesDelegatePtr delegate); + virtual IMediaDevicesSubscriptionPtr subscribe(IMediaDevicesDelegatePtr delegate) noexcept; }; class MediaDevicesFactory : public IFactory {}; @@ -251,7 +261,8 @@ ZS_DECLARE_PROXY_BEGIN(ortc::internal::IMediaDevicesAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaDevicesTypes::ConstraintsPtr, ConstraintsPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaDevicesAsyncDelegate::PromiseWithDeviceListPtr, PromiseWithDeviceListPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaDevicesAsyncDelegate::PromiseWithMediaStreamTrackListPtr, PromiseWithMediaStreamTrackListPtr) -ZS_DECLARE_PROXY_METHOD_1(onEnumerateDevices, PromiseWithDeviceListPtr) -ZS_DECLARE_PROXY_METHOD_2(onGetUserMedia, PromiseWithMediaStreamTrackListPtr, ConstraintsPtr) +ZS_DECLARE_PROXY_METHOD(onEnumerateDevices, PromiseWithDeviceListPtr) +ZS_DECLARE_PROXY_METHOD(onEnumerateDefaultModes, PromiseWithSettingsListPtr, const char *) +ZS_DECLARE_PROXY_METHOD(onGetUserMedia, PromiseWithMediaStreamTrackListPtr, ConstraintsPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_MediaEngine.h b/ortc/internal/ortc_MediaEngine.h new file mode 100644 index 00000000..6d780cc6 --- /dev/null +++ b/ortc/internal/ortc_MediaEngine.h @@ -0,0 +1,978 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include +#include +//#include +//#include +#include + +namespace ortc +{ + namespace internal + { + ZS_DECLARE_INTERACTION_PTR(IMediaEngineFactory); + + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCapture); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCaptureAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceCaptureVideo); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceRender); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaDeviceRenderAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPSenderChannelAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPSenderChannelVideo); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPReceiverChannelAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForRTPReceiverChannelVideo); + + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureVideoForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceRenderAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderVideoForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderAudioForMediaEngine); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderVideoForMediaEngine); + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // IMediaEngineForORTC + // + + interaction IMediaEngineForORTC + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForORTC, ForORTC); + + static void setLogLevel(Log::Level level) noexcept; + static void ntpServerTime(const Milliseconds &value) noexcept; + static void startMediaTracing() noexcept; + static void stopMediaTracing() noexcept; + static bool isMediaTracing() noexcept; + static bool saveMediaTrace(String filename) noexcept; + static bool saveMediaTrace(String host, int port) noexcept; + + virtual ~IMediaEngineForORTC() noexcept {} + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDevice + // + + interaction IMediaEngineForMediaDevice + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDevice, ForDevice); + + virtual void notifyDeviceIsIdleOrShutdownStateChanged() noexcept = 0; + + virtual ~IMediaEngineForMediaDevice() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceCapture + // + + interaction IMediaEngineForMediaDeviceCapture : public IMediaEngineForMediaDevice + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCapture, ForMediaDeviceCapture); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + typedef zsLib::PromiseWithHolderPtr MediaDeviceCapturePromise; + ZS_DECLARE_PTR(MediaDeviceCapturePromise); + + static MediaDeviceCapturePromisePtr createMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + virtual ~IMediaEngineForMediaDeviceCapture() noexcept {} + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceCaptureAudio + // + + interaction IMediaEngineForMediaDeviceCaptureAudio : public IMediaEngineForMediaDeviceCapture + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCaptureAudio, ForMediaDeviceCaptureAudio); + + virtual ~IMediaEngineForMediaDeviceCaptureAudio() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceCaptureVideo + // + + interaction IMediaEngineForMediaDeviceCaptureVideo : public IMediaEngineForMediaDeviceCapture + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceCaptureVideo, ForMediaDeviceCaptureVideo); + + virtual ~IMediaEngineForMediaDeviceCaptureVideo() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceRender + // + + interaction IMediaEngineForMediaDeviceRender : public IMediaEngineForMediaDevice + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceRender, ForMediaDeviceRender); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + typedef zsLib::PromiseWithHolderPtr MediaDeviceRenderPromise; + ZS_DECLARE_PTR(MediaDeviceRenderPromise); + + static MediaDeviceRenderPromisePtr createMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept; + + virtual ~IMediaEngineForMediaDeviceRender() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForMediaDeviceRenderAudio : public IMediaEngineForMediaDeviceRender + // + + interaction IMediaEngineForMediaDeviceRenderAudio : public IMediaEngineForMediaDeviceRender + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaDeviceRenderAudio, ForMediaDeviceRenderAudio); + + virtual ~IMediaEngineForMediaDeviceRenderAudio() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTP + // + + interaction IMediaEngineForRTP + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTP, ForRTP); + + virtual void notifyRTPShutdownStateChanged() noexcept = 0; + + virtual ~IMediaEngineForRTP() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoder + // + + interaction IMediaEngineForRTPDecoder : public IMediaEngineForRTP + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoder, ForRTPDecode); + + virtual ~IMediaEngineForRTPDecoder() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoderAudio + // + + interaction IMediaEngineForRTPDecoderAudio : public IMediaEngineForRTPDecoder + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderAudio, ForRTPDecodeAudio); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderAudio); + + static PromiseWithRTPDecoderAudioPtr createRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual ~IMediaEngineForRTPDecoderAudio() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPDecoderVideo + // + + interaction IMediaEngineForRTPDecoderVideo : public IMediaEngineForRTPDecoder + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderVideo, ForRTPDecodeVideo); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderVideo); + + static PromiseWithRTPDecoderVideoPtr createRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual ~IMediaEngineForRTPDecoderVideo() noexcept {} + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoder + // + + interaction IMediaEngineForRTPEncoder : public IMediaEngineForRTP + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoder, ForRTPEncode); + + virtual ~IMediaEngineForRTPEncoder() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoderAudio + // + + interaction IMediaEngineForRTPEncoderAudio : public IMediaEngineForRTPEncoder + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderAudio, ForRTPEncodeAudio); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderAudio); + + static PromiseWithRTPEncoderAudioPtr createRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + virtual ~IMediaEngineForRTPEncoderAudio() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineForRTPEncoderVideo + // + + interaction IMediaEngineForRTPEncoderVideo : public IMediaEngineForRTPEncoder + { + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderVideo, ForRTPEncodeVideo); + + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderVideo); + + static PromiseWithRTPEncoderVideoPtr createRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + virtual ~IMediaEngineForRTPEncoderVideo() noexcept {} + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaEngine + // + + class MediaEngine : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaEngineForORTC, + public IMediaEngineForMediaDeviceCaptureAudio, + public IMediaEngineForMediaDeviceCaptureVideo, + public IMediaEngineForMediaDeviceRenderAudio, + public IMediaEngineForRTPDecoderAudio, + public IMediaEngineForRTPDecoderVideo, + public IMediaEngineForRTPEncoderAudio, + public IMediaEngineForRTPEncoderVideo, + public IMediaDevicesDelegate, + public zsLib::IWakeDelegate, + public zsLib::ITimerDelegate, + public zsLib::IPromiseSettledDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IMediaEngineFactory; + friend interaction IMediaEngineForORTC; + friend interaction IMediaEngineForMediaDeviceCapture; + friend interaction IMediaEngineForMediaDeviceCaptureAudio; + friend interaction IMediaEngineForMediaDeviceCaptureVideo; + friend interaction IMediaEngineForMediaDeviceRender; + friend interaction IMediaEngineForMediaDeviceRenderAudio; + friend interaction IMediaEngineForRTPSenderChannelAudio; + friend interaction IMediaEngineForRTPSenderChannelVideo; + friend interaction IMediaEngineForRTPReceiverChannelAudio; + friend interaction IMediaEngineForRTPReceiverChannelVideo; + friend interaction IMediaEngineForRTPDecoder; + friend interaction IMediaEngineForRTPDecoderAudio; + friend interaction IMediaEngineForRTPDecoderVideo; + friend interaction IMediaEngineForRTPEncoder; + friend interaction IMediaEngineForRTPEncoderAudio; + friend interaction IMediaEngineForRTPEncoderVideo; + + enum States + { + State_First, + + State_Pending = State_First, + State_WakingUp, + State_Ready, + State_GoingToSleep, + State_Sleeping, + State_ShuttingDown, + State_Shutdown, + + State_Last = State_Shutdown, + }; + + static const char *toString(States state) noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::PromiseWithDeviceList, PromiseWithDeviceList); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevicesTypes::DeviceList, DeviceList); + ZS_DECLARE_TYPEDEF_PTR(std::list, StringList); + + struct PendingForMediaDeviceCapture + { + MediaDeviceObjectID repaceExistingDeviceObjectID_ {}; + Kinds kind_ { IMediaStreamTrackTypes::Kind_Audio}; + MediaDeviceCapturePromisePtr promise_; + TrackConstraintsPtr constraints_; + IMediaDeviceCaptureDelegatePtr delegate_; + }; + + struct PendingForMediaDeviceRenderInfo + { + MediaDeviceObjectID repaceExistingDeviceObjectID_{}; + MediaDeviceRenderPromisePtr promise_; + TrackConstraintsPtr constraints_; + IMediaDeviceRenderDelegatePtr delegate_; + }; + + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingForMediaDeviceCaptureList); + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingForMediaDeviceRenderList); + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderAudio); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderVideo); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderAudio); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderVideo); + + struct PendingForRTPDecodeAudio + { + PromiseWithRTPDecoderAudioPtr promise_; + ParametersPtr parameters_; + IRTPDecoderDelegatePtr delegate_; + }; + + struct PendingForRTPDecodeVideo + { + PromiseWithRTPDecoderVideoPtr promise_; + ParametersPtr parameters_; + IRTPDecoderDelegatePtr delegate_; + }; + + struct PendingForRTPEncodeAudio + { + PromiseWithRTPEncoderAudioPtr promise_; + ParametersPtr parameters_; + IRTPEncoderDelegatePtr delegate_; + }; + + struct PendingForRTPEncodeVideo + { + PromiseWithRTPEncoderVideoPtr promise_; + ParametersPtr parameters_; + IRTPEncoderDelegatePtr delegate_; + }; + + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingForRTPDecodeAudioList); + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingForRTPDecodeVideoList); + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingForRTPEncodeAudioList); + ZS_DECLARE_TYPEDEF_PTR(std::list, PendingForRTPEncodeVideoList); + + ZS_DECLARE_TYPEDEF_PTR(ortc::services::IHTTP, UseHTTP); + ZS_DECLARE_TYPEDEF_PTR(IMediaDevices, UseMediaDevices); + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCaptureForMediaEngine, UseMediaDeviceCapture); + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCaptureAudioForMediaEngine, UseMediaDeviceCaptureAudio); + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCaptureVideoForMediaEngine, UseMediaDeviceCaptureVideo); + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceRenderForMediaEngine, UseMediaDeviceRender); + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceRenderAudioForMediaEngine, UseMediaDeviceRenderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPForMediaEngine, UseRTP); + ZS_DECLARE_TYPEDEF_PTR(IRTPEncoderForMediaEngine, UseRTPEncoder); + ZS_DECLARE_TYPEDEF_PTR(IRTPEncoderAudioForMediaEngine, UseRTPEncoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPEncoderVideoForMediaEngine, UseRTPEncoderVideo); + ZS_DECLARE_TYPEDEF_PTR(IRTPDecoderForMediaEngine, UseRTPDecoder); + ZS_DECLARE_TYPEDEF_PTR(IRTPDecoderAudioForMediaEngine, UseRTPDecoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPDecoderVideoForMediaEngine, UseRTPDecoderVideo); + + typedef String DeviceID; + typedef std::map DeviceCaptureMap; + typedef std::map DeviceRenderMap; + + typedef PUID ObjectID; + typedef std::map RTPDecoderMap; + typedef std::map RTPEncoderMap; + + typedef PUID PromiseID; + typedef std::map PromiseMap; + + public: + MediaEngine( + const make_private &, + IMessageQueuePtr queue + ) noexcept; + + protected: + MediaEngine(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + void init() noexcept; + + public: + virtual ~MediaEngine() noexcept; + + static MediaEnginePtr singleton() noexcept; + static MediaEnginePtr create() noexcept; + + static MediaEnginePtr convert(ForORTCPtr object) noexcept; + static MediaEnginePtr convert(ForMediaDeviceCapturePtr object) noexcept; + static MediaEnginePtr convert(ForMediaDeviceRenderPtr object) noexcept; + static MediaEnginePtr convert(ForMediaDeviceRenderAudioPtr object) noexcept; + static MediaEnginePtr convert(ForMediaDeviceCaptureAudioPtr object) noexcept; + static MediaEnginePtr convert(ForMediaDeviceCaptureVideoPtr object) noexcept; + static MediaEnginePtr convert(ForRTPPtr object) noexcept; + static MediaEnginePtr convert(ForRTPDecodePtr object) noexcept; + static MediaEnginePtr convert(ForRTPDecodeAudioPtr object) noexcept; + static MediaEnginePtr convert(ForRTPDecodeVideoPtr object) noexcept; + static MediaEnginePtr convert(ForRTPEncodePtr object) noexcept; + static MediaEnginePtr convert(ForRTPEncodeAudioPtr object) noexcept; + static MediaEnginePtr convert(ForRTPEncodeVideoPtr object) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForORTC + // + + static void setLogLevel(Log::Level level) noexcept { auto engine = singleton(); if (!engine) return; engine->internalSetLogLevel(level); } + static void ntpServerTime(const Milliseconds &value)noexcept { auto engine = singleton(); if (!engine) return; engine->internalNTPServerTime(value); } + static void startMediaTracing() noexcept { auto engine = singleton(); if (!engine) return; engine->internalStartMediaTracing(); } + static void stopMediaTracing() noexcept { auto engine = singleton(); if (!engine) return; engine->internalStopMediaTracing(); } + static bool isMediaTracing() noexcept { auto engine = singleton(); if (!engine) return false; return engine->internalIsMediaTracing(); } + static bool saveMediaTrace(String filename) noexcept { auto engine = singleton(); if (!engine) return false; return engine->internalSaveMediaTrace(filename); } + static bool saveMediaTrace(String host, int port) noexcept { auto engine = singleton(); if (!engine) return false; return engine->internalSaveMediaTrace(host, port); } + + virtual void internalSetLogLevel(Log::Level level) noexcept; + virtual void internalNTPServerTime(const Milliseconds &value) noexcept; + virtual void internalStartMediaTracing() noexcept; + virtual void internalStopMediaTracing() noexcept; + virtual bool internalIsMediaTracing() noexcept; + virtual bool internalSaveMediaTrace(String filename) noexcept; + virtual bool internalSaveMediaTrace(String host, int port) noexcept; + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDevice + // + + void notifyDeviceIsIdleOrShutdownStateChanged() noexcept override; + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceCapture + // + + static MediaDeviceCapturePromisePtr createMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept { auto engine = singleton(); if (!engine) return MediaDeviceCapturePromise::createRejected(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "singleton gone"), IORTCForInternal::queueDelegate()); return engine->innerCreateMediaDeviceCapture(repaceExistingDeviceObjectID, kind, constraints, delegate); } + + virtual MediaDeviceCapturePromisePtr innerCreateMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceCaptureAudio + // + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceCaptureVideo + // + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceRender + // + + + static MediaDeviceRenderPromisePtr createMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept { auto engine = singleton(); if (!engine) return MediaDeviceRenderPromise::createRejected(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "singleton gone"), IORTCForInternal::queueDelegate()); return engine->innerCreateMediaDeviceRender(repaceExistingDeviceObjectID, constraints, delegate); } + + virtual MediaDeviceRenderPromisePtr innerCreateMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForMediaDeviceRenderAudio + // + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTP + // + + void notifyRTPShutdownStateChanged() noexcept override; + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPDecoder + // + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPDecoderAudio + // + + static PromiseWithRTPDecoderAudioPtr createRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept { auto engine = singleton(); if (!engine) return PromiseWithRTPDecoderAudio::createRejected(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "singleton gone"), IORTCForInternal::queueDelegate()); return engine->innerCreateRTPDecoderAudio(parameters, delegate); } + + virtual PromiseWithRTPDecoderAudioPtr innerCreateRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPDecoderVideo + // + + static PromiseWithRTPDecoderVideoPtr createRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept { auto engine = singleton(); if (!engine) return PromiseWithRTPDecoderVideo::createRejected(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "singleton gone"), IORTCForInternal::queueDelegate()); return engine->innerCreateRTPDecoderVideo(parameters, delegate); } + + virtual PromiseWithRTPDecoderVideoPtr innerCreateRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPEncoder + // + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPEncoderAudio + // + + static PromiseWithRTPEncoderAudioPtr createRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept { auto engine = singleton(); if (!engine) return PromiseWithRTPEncoderAudio::createRejected(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "singleton gone"), IORTCForInternal::queueDelegate()); return engine->createRTPEncoderAudio(parameters, delegate); } + + virtual PromiseWithRTPEncoderAudioPtr innerCreateRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaEngineForRTPEncoderVideo + // + + static PromiseWithRTPEncoderVideoPtr createRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept { auto engine = singleton(); if (!engine) return PromiseWithRTPEncoderVideo::createRejected(ErrorAny::create(UseHTTP::HTTPStatusCode_Gone, "singleton gone"), IORTCForInternal::queueDelegate()); return engine->innerCreateRTPEncoderVideo(parameters, delegate); } + + virtual PromiseWithRTPEncoderVideoPtr innerCreateRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + protected: + + //----------------------------------------------------------------------- + // + // MediaEngine => IMediaDevicesDelegate + // + + //----------------------------------------------------------------------- + void onMediaDevicesChanged() override; + + //----------------------------------------------------------------------- + // + // MediaEngine => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // MediaEngine => ITimerDelegate + // + + void onTimer(ITimerPtr timer) override; + + //----------------------------------------------------------------------- + // + // MediaEngine => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + protected: + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaEngine::WebRtcTraceCallback + // + + /*class WebRtcTraceCallback : public webrtc::TraceCallback + { + public: + void Print(webrtc::TraceLevel level, const char* message, int length) override; + };*/ + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // MediaEngine::WebRtcTraceCallback + // + + class WebRtcLogSink : public rtc::LogSink + { + public: + void OnLogMessage(const std::string& message) override; + }; + + //----------------------------------------------------------------------- + // + // MediaEngine => webrtc::SetupEventTracer + // + +#if defined(WINUWP) + static const unsigned char *GetCategoryGroupEnabled(const char *categoryGroup); + + static void __cdecl AddTraceEvent( + char phase, + const unsigned char *categoryGroupEnabled, + const char *name, + uint64 id, + int numArgs, + const char **argNames, + const unsigned char *argTypes, + const uint64 *argValues, + unsigned char flags + ); +#endif //defined(WINUWP) + + //----------------------------------------------------------------------- + // + // (internal) + // + +#if defined(WINUWP) + virtual void internalAddTraceEvent( + char phase, + const unsigned char *categoryGroupEnabled, + const char *name, + uint64_t id, + int numArgs, + const char **argNames, + const unsigned char *argTypes, + const uint64_t *argValues, + unsigned char flags + ) noexcept; +#endif //defined(WINUWP) + + bool isPending() const noexcept { return State_Pending == currentState_; } + bool isWakingUp() const noexcept { return State_WakingUp == currentState_; } + bool isReady() const noexcept { return State_Ready == currentState_; } + bool isGoingToSleep() const noexcept { return State_GoingToSleep == currentState_; } + bool isSleeping() const noexcept { return State_Sleeping == currentState_; } + bool isShuttingDown() const noexcept { return State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return State_Shutdown == currentState_; } + + void cancel() noexcept; + bool stepShutdownPendingRequests() noexcept; + bool stepShutdownDevicesAndRTP() noexcept; + + void step() noexcept; + + bool stepPendingPromises() noexcept; + + bool stepRefreshDeviceList() noexcept; + + void stepFixState() noexcept; + + bool stepWakeUp1() noexcept; + void onStepWakeUp1(PromisePtr promise); + + bool stepGoingToSleep1() noexcept; + void onStepGoingToSleep1(PromisePtr promise); + + bool stepShutdownDevices() noexcept; + bool stepShutdownRTP() noexcept; + bool stepStartPendingDevices() noexcept; + bool stepStartPendingRTP() noexcept; + bool stepReady1() noexcept; + void onReady1(PromisePtr promise) noexcept; + + void performAsync(std::function func) noexcept; + + template + PromisePtr performAsyncClosure(const Closure &closure) noexcept { auto promise = Promise::create(); pendingPromises_[promise->getID()] = promise; postClosure([promise, closure] { closure(); promise->resolve(); }); return promise; } + + template + void performAsyncClosure(PromisePtr promise, const Closure &closure) noexcept { pendingPromises_[promise->getID()] = promise; postClosure([closure] { closure(); }); } + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD errorCode, const char *inReason) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // (data) + // + + AutoPUID id_; + MediaEngineWeakPtr thisWeak_; + + MediaEnginePtr gracefulShutdownReference_; + + //std::unique_ptr traceCallback_; + std::unique_ptr logSink_; + //rtc::TraceLog traceLog_; + + States currentState_ {State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + bool refreshDevicesList_ {true}; + IMediaDevicesSubscriptionPtr devicesSubscription_; + PromiseWithDeviceListPtr devicesListPromise_; + DeviceListPtr mediaDevices_; + + PendingForMediaDeviceCaptureList pendingForMediaDeviceCaptures_; + PendingForMediaDeviceRenderList pendingForMediaDeviceRenders_; + + PendingForRTPDecodeAudioList pendingForRTPDecodeAudios_; + PendingForRTPDecodeVideoList pendingForRTPDecodeVideos_; + PendingForRTPEncodeAudioList pendingForRTPEncodeAudios_; + PendingForRTPEncodeVideoList pendingForRTPEncodeVideos_; + + std::atomic checkForIdleDevices_ {}; + std::atomic shuttingDownIdleDevices_ {}; + DeviceCaptureMap captureDevices_; + DeviceRenderMap renderDevices_; + + std::atomic checkForShutdownRTP_ {}; + RTPEncoderMap rtpEncoders_; + RTPDecoderMap rtpDecoders_; + + std::atomic completedWakeUp1_ {}; + + std::atomic completedGoingToSleep1_ {}; + + PromiseMap pendingPromises_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaEngineFactory + // + + interaction IMediaEngineFactory + { + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCapture::MediaDeviceCapturePromise, MediaDeviceCapturePromise); + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceRender::MediaDeviceRenderPromise, MediaDeviceRenderPromise); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderAudio::PromiseWithRTPDecoderAudio, PromiseWithRTPDecoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderVideo::PromiseWithRTPDecoderVideo, PromiseWithRTPDecoderVideo); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderAudio::PromiseWithRTPEncoderAudio, PromiseWithRTPEncoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderVideo::PromiseWithRTPEncoderVideo, PromiseWithRTPEncoderVideo); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDevice::MediaDeviceObjectID, MediaDeviceObjectID); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + static IMediaEngineFactory &singleton() noexcept; + + virtual MediaEnginePtr create() noexcept; + + virtual void setLogLevel(Log::Level level) noexcept; + virtual void ntpServerTime(const Milliseconds &value) noexcept; + virtual void startMediaTracing() noexcept; + virtual void stopMediaTracing() noexcept; + virtual bool isMediaTracing() noexcept; + virtual bool saveMediaTrace(String filename) noexcept; + virtual bool saveMediaTrace(String host, int port) noexcept; + + virtual MediaDeviceCapturePromisePtr createMediaDeviceCapture( + MediaDeviceObjectID repaceExistingDeviceObjectID, + Kinds kind, + const TrackConstraints &constraints, + IMediaDeviceCaptureDelegatePtr delegate + ) noexcept; + + virtual MediaDeviceRenderPromisePtr createMediaDeviceRender( + MediaDeviceObjectID repaceExistingDeviceObjectID, + const TrackConstraints &constraints, + IMediaDeviceRenderDelegatePtr delegate + ) noexcept; + + virtual PromiseWithRTPDecoderAudioPtr createRTPDecoderAudio( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + virtual PromiseWithRTPDecoderVideoPtr createRTPDecoderVideo( + const Parameters ¶meters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + virtual PromiseWithRTPEncoderAudioPtr createRTPEncoderAudio( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + virtual PromiseWithRTPEncoderVideoPtr createRTPEncoderVideo( + const Parameters ¶meters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + }; + + class MediaEngineFactory : public IFactory {}; + } +} diff --git a/ortc/internal/ortc_MediaStreamTrack.h b/ortc/internal/ortc_MediaStreamTrack.h index 43483bb9..778f5083 100644 --- a/ortc/internal/ortc_MediaStreamTrack.h +++ b/ortc/internal/ortc_MediaStreamTrack.h @@ -33,265 +33,41 @@ #include -#include -#include +#include +#include +#include +#include + +#include #include #include #include -#include +#include namespace ortc { namespace internal { ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForSettings); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSender); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannel); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelAudio); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelVideo); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiver); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannelAudio); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannelVideo); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForMediaDevices); - - ZS_DECLARE_INTERACTION_PTR(IRTPSenderForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForMediaStreamTrack); + ZS_DECLARE_INTERACTION_PTR(IMediaEngineForMediaStreamTrack); ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackAsyncDelegate); - - using zsLib::FLOAT; - using zsLib::INT; - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPSender - #pragma mark - - interaction IMediaStreamTrackForRTPSender - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSender, ForSender) - - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds) - - virtual PUID getID() const = 0; - - virtual void setSender(IRTPSenderPtr sender) = 0; - - virtual Kinds kind() const = 0; - - virtual void notifyAttachSenderChannel(RTPSenderChannelPtr channel) = 0; - virtual void notifyDetachSenderChannel(RTPSenderChannelPtr channel) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPSenderChannel - #pragma mark - - interaction IMediaStreamTrackForRTPSenderChannel - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannel, ForSenderChannel) - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPSenderChannelMediaBase - #pragma mark - - interaction IMediaStreamTrackForRTPSenderChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase, ForSenderChannelMediaBase) - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPSenderChannelAudio - #pragma mark - - interaction IMediaStreamTrackForRTPSenderChannelAudio : public IMediaStreamTrackForRTPSenderChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelAudio, ForSenderChannelAudio) - - virtual ~IMediaStreamTrackForRTPSenderChannelAudio() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPSenderChannelVideo - #pragma mark + ZS_DECLARE_INTERACTION_PTR(IMediaChannelForMediaStreamTrack); - interaction IMediaStreamTrackForRTPSenderChannelVideo : public IMediaStreamTrackForRTPSenderChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelVideo, ForSenderChannelVideo) - - virtual ~IMediaStreamTrackForRTPSenderChannelVideo() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPReceiver - #pragma mark - - interaction IMediaStreamTrackForRTPReceiver - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiver, ForReceiver) - - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds) - - static MediaStreamTrackPtr create(Kinds kind); - - virtual PUID getID() const = 0; - - virtual void setReceiver(IRTPReceiverPtr receiver) = 0; - - virtual void notifyActiveReceiverChannel(RTPReceiverChannelPtr channel) = 0; - - virtual void setH264Rendering(bool h264Rendering) = 0; - virtual bool isH264Rendering() = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPReceiverChannel - #pragma mark - - interaction IMediaStreamTrackForRTPReceiverChannel - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannel, ForReceiverChannel) - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPReceiverChannelMediabase - #pragma mark - - interaction IMediaStreamTrackForRTPReceiverChannelMediabase - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannelMediabase, ForReceiverChannelMediaBase) - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPReceiverChannelAudio - #pragma mark - - interaction IMediaStreamTrackForRTPReceiverChannelAudio : public IMediaStreamTrackForRTPReceiverChannelMediabase - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannelAudio, ForReceiverChannelAudio) - - virtual ~IMediaStreamTrackForRTPReceiverChannelAudio() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPReceiverChannelVideo - #pragma mark - - interaction IMediaStreamTrackForRTPReceiverChannelVideo : public IMediaStreamTrackForRTPReceiverChannelMediabase - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannelVideo, ForReceiverChannelVideo) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - virtual void renderVideoFrame(VideoFramePtr videoFrame) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForMediaDevices - #pragma mark - - interaction IMediaStreamTrackForMediaDevices - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaDevices, ForMediaDevices) - - virtual ~IMediaStreamTrackForMediaDevices() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForRTPMediaEngine - #pragma mark - - interaction IMediaStreamTrackForRTPMediaEngine - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPMediaEngine, ForMediaEngine) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, Settings) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame) - - virtual Kinds kind() const = 0; - virtual String id() const = 0; - virtual bool remote() const = 0; - - virtual TrackConstraintsPtr getConstraints() const = 0; - virtual SettingsPtr getSettings() const = 0; - - virtual void renderVideoFrame(VideoFramePtr videoFrame) = 0; - virtual void sendCapturedVideoFrame(VideoFramePtr videoFrame) = 0; - }; + using zsLib::FLOAT; + using zsLib::INT; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackForMediaStream - #pragma mark + // + // IMediaStreamTrackForMediaStream + // interaction IMediaStreamTrackForMediaStream { @@ -299,27 +75,27 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); - virtual bool isEnded() const = 0; + virtual bool isEnded() const noexcept = 0; - virtual Kinds kind() const = 0; - virtual String id() const = 0; - virtual ElementPtr toDebug() const = 0; + virtual Kinds kind() const noexcept = 0; + virtual String id() const noexcept = 0; + virtual void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept = 0; }; - //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackAsyncDelegate - #pragma mark + // + // IMediaStreamTrackAsyncDelegate + // interaction IMediaStreamTrackAsyncDelegate { ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelForMediaStreamTrack, UseReceiverChannel); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForMediaStreamTrack, UseSenderChannel); virtual void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) = 0; @@ -327,36 +103,30 @@ namespace ortc PromisePtr promise, TrackConstraintsPtr constraints ) = 0; - - virtual void onSetActiveReceiverChannel(UseReceiverChannelPtr channel) = 0; - - virtual void onAttachSenderChannel(UseSenderChannelPtr channel) = 0; - virtual void onDetachSenderChannel(UseSenderChannelPtr channel) = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack - #pragma mark + // + // MediaStreamTrack + // class MediaStreamTrack : public Noop, public MessageQueueAssociator, public SharedRecursiveLock, - public IMediaStreamTrack, - public IMediaStreamTrackForRTPSender, - public IMediaStreamTrackForRTPSenderChannel, - public IMediaStreamTrackForRTPSenderChannelAudio, - public IMediaStreamTrackForRTPSenderChannelVideo, + public internal::IMediaStreamTrack, + public IMediaStreamTrackForMediaStream, + public IMediaStreamTrackForMediaStreamTrackChannel, + public IMediaStreamTrackForMediaStreamTrackSubscriberMedia, + public IMediaStreamTrackForMediaStreamTrackSubscriberRTP, + public IMediaStreamTrackForMediaDevices, + public IMediaStreamTrackForMediaStreamTrackSelector, public IMediaStreamTrackForRTPReceiver, public IMediaStreamTrackForRTPReceiverChannel, - public IMediaStreamTrackForRTPReceiverChannelAudio, - public IMediaStreamTrackForRTPReceiverChannelVideo, - public IMediaStreamTrackForMediaDevices, - public IMediaStreamTrackForRTPMediaEngine, - public IMediaStreamTrackForMediaStream, + public IMediaStreamTrackForRTPSender, + public IMediaStreamTrackForRTPSenderChannel, public IWakeDelegate, public zsLib::ITimerDelegate, public zsLib::IPromiseSettledDelegate, @@ -366,362 +136,356 @@ namespace ortc struct make_private {}; public: - friend interaction IMediaStreamTrack; + friend interaction ortc::IMediaStreamTrack; + friend interaction internal::IMediaStreamTrack; friend interaction IMediaStreamTrackFactory; - friend interaction IMediaStreamTrackForRTPSender; - friend interaction IMediaStreamTrackForRTPSenderChannel; - friend interaction IMediaStreamTrackForRTPSenderChannelAudio; - friend interaction IMediaStreamTrackForRTPSenderChannelVideo; + friend interaction IMediaStreamTrackForMediaStream; + friend interaction IMediaStreamTrackForMediaStreamTrackChannel; + friend interaction IMediaStreamTrackForMediaStreamTrackSubscriberMedia; + friend interaction IMediaStreamTrackForMediaStreamTrackSubscriberRTP; + friend interaction IMediaStreamTrackForMediaDevices; + friend interaction IMediaStreamTrackForMediaStreamTrackSelector; friend interaction IMediaStreamTrackForRTPReceiver; friend interaction IMediaStreamTrackForRTPReceiverChannel; - friend interaction IMediaStreamTrackForRTPReceiverChannelMediaBase; - friend interaction IMediaStreamTrackForRTPReceiverChannelAudio; - friend interaction IMediaStreamTrackForRTPReceiverChannelVideo; - friend interaction IMediaStreamTrackForMediaDevices; - friend interaction IMediaStreamTrackForRTPMediaEngine; - friend interaction IMediaStreamTrackForMediaStream; + friend interaction IMediaStreamTrackForRTPSender; + friend interaction IMediaStreamTrackForRTPSenderChannel; - ZS_DECLARE_CLASS_PTR(Transport) - friend class Transport; - - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForMediaStreamTrack, UseSender) - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForMediaStreamTrack, UseSenderChannel) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForMediaStreamTrack, UseReceiver) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelForMediaStreamTrack, UseReceiverChannel) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForMediaStreamTrack, UseMediaEngine) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineDeviceResource, UseDeviceResource) + enum MediaStreamTrackTypes + { + MediaStreamTrackType_First, + + MediaStreamTrackType_Capture = MediaStreamTrackType_First, + MediaStreamTrackType_Receiver, + MediaStreamTrackType_Selector, - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Constraints, Constraints) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, Settings) + MediaStreamTrackType_Last = MediaStreamTrackType_Selector, + }; - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame) + static const char *toString(MediaStreamTrackTypes type) noexcept; + MediaStreamTrackTypes toMediaStreamTrackType(const char *inputStr) noexcept(false); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForMediaStreamTrack, UseMediaEngine); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Constraints, Constraints); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Settings, Settings); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrack, UseChannel); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberForMediaStreamTrack, UseSubscriber); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberMediaForMediaStreamTrack, UseSubscriberMedia); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberRTPForMediaStreamTrack, UseSubscriberRTP); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); + + ZS_DECLARE_TYPEDEF_PTR(IMediaDeviceCapture::MediaDeviceCapturePromise, MediaDeviceCapturePromise); + + typedef std::unordered_map SubscriberMap; + ZS_DECLARE_PTR(SubscriberMap); + + typedef std::unordered_map ChannelMap; + ZS_DECLARE_PTR(ChannelMap); public: + struct MediaStreamTrackArguments + { + IMessageQueuePtr queue_; + Kinds kind_; + MediaStreamTrackTypes type_ {MediaStreamTrackType_First}; + TrackConstraintsPtr constraints_; + }; + MediaStreamTrack( const make_private &, - IMessageQueuePtr queue, - Kinds kind, - bool remote, - TrackConstraintsPtr constraints - ); + const MediaStreamTrackArguments &args + ) noexcept; protected: - MediaStreamTrack(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : + MediaStreamTrack(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~MediaStreamTrack(); - - static MediaStreamTrackPtr create( - Kinds kind, - bool remote, - TrackConstraintsPtr constraints - ); - - static MediaStreamTrackPtr convert(IMediaStreamTrackPtr object); - static MediaStreamTrackPtr convert(ForSenderPtr object); - static MediaStreamTrackPtr convert(ForSenderChannelPtr object); - static MediaStreamTrackPtr convert(ForSenderChannelMediaBasePtr object); - static MediaStreamTrackPtr convert(ForSenderChannelAudioPtr object); - static MediaStreamTrackPtr convert(ForSenderChannelVideoPtr object); - static MediaStreamTrackPtr convert(ForReceiverPtr object); - static MediaStreamTrackPtr convert(ForReceiverChannelPtr object); - static MediaStreamTrackPtr convert(ForReceiverChannelMediaBasePtr object); - static MediaStreamTrackPtr convert(ForReceiverChannelAudioPtr object); - static MediaStreamTrackPtr convert(ForReceiverChannelVideoPtr object); - static MediaStreamTrackPtr convert(ForMediaDevicesPtr object); - static MediaStreamTrackPtr convert(ForMediaEnginePtr object); - static MediaStreamTrackPtr convert(ForMediaStreamPtr object); + virtual ~MediaStreamTrack() noexcept; + + static MediaStreamTrackPtr convert(ortc::IMediaStreamTrackPtr object) noexcept; + static MediaStreamTrackPtr convert(internal::IMediaStreamTrackPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaStreamPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaStreamTrackChannelPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaStreamTrackSubscriberPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaStreamTrackSubscriberMediaPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaStreamTrackSubscriberRTPPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaDevicesPtr object) noexcept; + static MediaStreamTrackPtr convert(ForMediaStreamTrackSelectorPtr object) noexcept; + static MediaStreamTrackPtr convert(ForReceiverPtr object) noexcept; + static MediaStreamTrackPtr convert(ForReceiverChannelPtr object) noexcept; + static MediaStreamTrackPtr convert(ForSenderPtr object) noexcept; + static MediaStreamTrackPtr convert(ForSenderChannelPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IStatsProvider - #pragma mark + // + // MediaStreamTrack => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrack - #pragma mark + // + // MediaStreamTrack => ortc::IMediaStreamTrack + // - static ElementPtr toDebug(MediaStreamTrackPtr object); + PUID getID() const noexcept override {return id_;} - virtual PUID getID() const override {return mID;} + void trace( + const char *func = NULL, + const char *message = NULL + ) const noexcept override; - virtual IMediaStreamTrackSubscriptionPtr subscribe(IMediaStreamTrackDelegatePtr delegate) override; + IMediaStreamTrackSubscriptionPtr subscribe(IMediaStreamTrackDelegatePtr delegate) noexcept override; - virtual Kinds kind() const override; - virtual String id() const override; - virtual String deviceID() const override; - virtual String label() const override; - virtual bool enabled() const override; - virtual void enabled(bool enabled) override; - virtual bool muted() const override; - virtual void muted(bool muted) override; - virtual bool remote() const override; - virtual States readyState() const override; + Kinds kind() const noexcept override; + String id() const noexcept override; + String deviceID() const noexcept override; + String label() const noexcept override; + bool enabled() const noexcept override; + void enabled(bool enabled) noexcept override; + bool muted() const noexcept override; + void muted(bool muted) noexcept override; + bool remote() const noexcept override; + States readyState() const noexcept override; - virtual IMediaStreamTrackPtr clone() const override; + ortc::IMediaStreamTrackPtr clone() const noexcept override; - virtual void stop() override; + void stop() noexcept override; - virtual CapabilitiesPtr getCapabilities() const override; - virtual TrackConstraintsPtr getConstraints() const override; - virtual SettingsPtr getSettings() const override; + CapabilitiesPtr getCapabilities() const noexcept override; + TrackConstraintsPtr getConstraints() const noexcept override; + SettingsPtr getSettings() const noexcept override; - virtual PromisePtr applyConstraints(const TrackConstraints &constraints) override; + PromisePtr applyConstraints(const TrackConstraints &constraints) noexcept override; - virtual void setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) override; - virtual void setH264Rendering(bool h264Rendering) override; - virtual bool isH264Rendering() override; + IMediaStreamTrackMediaSubscriptionPtr subscribeMedia(IMediaStreamTrackSyncMediaDelegatePtr delegate) noexcept override; - //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForSettings - #pragma mark + IMediaStreamTrackMediaSubscriptionPtr subscribeMedia(IMediaStreamTrackAsyncMediaDelegatePtr delegate) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSender - #pragma mark - - // (duplicate) virtual PUID getID() const = 0; - - // (duplicate) virtual Kinds kind() const = 0; - - virtual void setSender(IRTPSenderPtr sender) override; - - virtual void notifyAttachSenderChannel(RTPSenderChannelPtr channel) override; - virtual void notifyDetachSenderChannel(RTPSenderChannelPtr channel) override; + // + // MediaStreamTrack => internal::IMediaStreamTrack + // + + virtual IMediaStreamTrackRTPSubscriptionPtr subscribeRTP( + const Parameters &rtpEncodingParams, + IMediaStreamTrackRTPDelegatePtr delegate + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannel - #pragma mark - - // (duplicate) virtual PUID getID() const = 0; + // + // MediaStreamTrack => IMediaStreamTrackForSettings + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannelMediaBase - #pragma mark - - // (duplicate) virtual PUID getID() const = 0; + // + // MediaStreamTrack => IMediaStreamTrackForMediaStream + // - //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannelAudio - #pragma mark + bool isEnded() const noexcept override; + // (duplicate) virtual Kinds kind() const noexcept = 0; + // (duplicate) virtual String id() const noexcept= 0; + // (duplicate) virtual ElementPtr toDebug() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPSenderChannelVideo - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackChannel + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiver - #pragma mark - - static MediaStreamTrackPtr create(Kinds kind); - - // (duplicate) virtual PUID getID() const = 0; + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSubscriber + // - virtual void setReceiver(IRTPReceiverPtr receiver) override; + void notifySubscriberCancelled(UseSubscriberPtr subscriber) noexcept override; - virtual void notifyActiveReceiverChannel(RTPReceiverChannelPtr channel) override; + //----------------------------------------------------------------------- + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSubscriberMedia + // - // (duplicate) virtual void setH264Rendering(bool h264Rendering) = 0; - // (duplicate) virtual bool isH264Rendering() = 0; + //----------------------------------------------------------------------- + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSubscriberRTP + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaDevices + // // (duplicate) virtual PUID getID() const = 0; + static ForMediaDevicesPtr createForMediaDevices( + IMediaStreamTrackTypes::Kinds kind, + const TrackConstraints &constraints + ) noexcept; + //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelMediaBase - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForMediaStreamTrackSelector + // // (duplicate) virtual PUID getID() const = 0; - //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelAudio - #pragma mark + static ForMediaDevicesPtr createForMediaStreamTrackSelector(IMediaStreamTrackTypes::Kinds kind) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelVideo - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForRTPReceiver + // - virtual void renderVideoFrame(VideoFramePtr videoFrame) override; + static ForReceiverPtr createForReceiver(IMediaStreamTrackTypes::Kinds kind) noexcept; - //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForMediaDevices - #pragma mark + // (duplicate) virtual PUID getID() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForMediaEngine - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel + // - // (duplicate) virtual Kinds kind() const = 0; - // (duplicate) virtual String id() const = 0; - // (duplicate) virtual bool remote() const = 0; - - // (duplicate) virtual TrackConstraintsPtr getConstraints() const = 0; - // (duplicate) virtual SettingsPtr getSettings() const = 0; - - // (duplicate) virtual void renderVideoFrame(const webrtc::VideoFrame& videoFrame) = 0; - - virtual void sendCapturedVideoFrame(VideoFramePtr videoFrame) override; + // (duplicate) virtual PUID getID() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPMediaEngine - #pragma mark - - virtual bool isEnded() const override; - // (duplicate) virtual Kinds kind() const = 0; - // (duplicate) virtual String id() const = 0; - // (duplicate) virtual ElementPtr toDebug() const = 0; + // + // MediaStreamTrack => IMediaStreamTrackForRTPSender + // + + // (duplicate) virtual PUID getID() const noexcept = 0; + // (duplicate) virtual Kinds kind() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IWakeDelegate - #pragma mark - - virtual void onWake() override; + // + // MediaStreamTrack => IMediaStreamTrackForRTPSenderChannel + // + + // (duplicate) virtual PUID getID() const noexcept = 0; + // (duplicate) virtual Kinds kind() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => ITimerDelegate - #pragma mark + // + // MediaStreamTrack => IWakeDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IPromiseSettledDelegate - #pragma mark + // + // MediaStreamTrack => ITimerDelegate + // - virtual void onPromiseSettled(PromisePtr promise) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackAsyncDelegate - #pragma mark + // + // MediaStreamTrack => IPromiseSettledDelegate + // - virtual void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; + void onPromiseSettled(PromisePtr promise) override; - virtual void onApplyConstraints( - PromisePtr promise, - TrackConstraintsPtr constraints - ) override; + //----------------------------------------------------------------------- + // + // MediaStreamTrack => IMediaStreamTrackAsyncDelegate + // - virtual void onSetActiveReceiverChannel(UseReceiverChannelPtr channel) override; + void onResolveStatsPromise(IStatsProvider::PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; - virtual void onAttachSenderChannel(UseSenderChannelPtr channel) override; - virtual void onDetachSenderChannel(UseSenderChannelPtr channel) override; + void onApplyConstraints( + PromisePtr promise, + TrackConstraintsPtr constraints + ) override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => (internal) - #pragma mark + // + // MediaStreamTrack => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + void step() noexcept; + bool stepDevicePromise() noexcept; + bool stepSetupDevice() noexcept; - void step(); - bool stepDevicePromise(); - bool stepSetupDevice(); + void cancel() noexcept; - void cancel(); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); - protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => (data) - #pragma mark + // + // MediaStreamTrack => (data) + // - AutoPUID mID; - MediaStreamTrackWeakPtr mThisWeak; - MediaStreamTrackPtr mGracefulShutdownReference; + AutoPUID id_; + MediaStreamTrackWeakPtr thisWeak_; + MediaStreamTrackPtr gracefulShutdownReference_; - IMediaStreamTrackDelegateSubscriptions mSubscriptions; + IMediaStreamTrackDelegateSubscriptions subscriptions_; - States mCurrentState {State_Live}; + States currentState_ {State_First}; - WORD mLastError {}; - String mLastErrorReason; + WORD lastError_ {}; + String lastErrorReason_; - String mTrackID; - Kinds mKind {Kind_First}; - bool mRemote {false}; - String mDeviceID; - bool mH264Rendering {false}; + String trackId_; + String label_; + Kinds kind_ {Kind_First}; + bool enabled_ {false}; + bool muted_ {false}; + MediaStreamTrackTypes type_ {MediaStreamTrackType_First}; + String deviceId_; - UseSenderWeakPtr mSender; - UseSenderChannelWeakPtr mSenderChannel; - UseReceiverWeakPtr mReceiver; - UseReceiverChannelWeakPtr mReceiverChannel; + CapabilitiesPtr capabilities_; + TrackConstraintsPtr constraints_; + SettingsPtr settings_; - CapabilitiesPtr mCapabilities; - TrackConstraintsPtr mConstraints; - SettingsPtr mSettings; + SubscriberMapPtr subscribers_; + ChannelMapPtr channels_; - PromiseWithRTPMediaEngineDeviceResourcePtr mDeviceResourceLifetimeHolderPromise; - UseDeviceResourcePtr mDeviceResource; - IMediaStreamTrackRenderCallbackPtr mVideoRendererCallback; - - PromisePtr mCloseDevicePromise; - - ITimerPtr mStatsTimer; + ITimerPtr statsTimer_; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IMediaStreamTrackFactory - #pragma mark + // + // IMediaStreamTrackFactory + // interaction IMediaStreamTrackFactory { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints) + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::TrackConstraints, TrackConstraints); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaDevices, ForMediaDevices); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiver, ForReceiver); + + static IMediaStreamTrackFactory &singleton() noexcept; + + virtual ForMediaDevicesPtr createForMediaDevices( + IMediaStreamTrackTypes::Kinds kind, + const TrackConstraints &constraints + ) noexcept; - static IMediaStreamTrackFactory &singleton(); + virtual ForReceiverPtr createForReceiver(IMediaStreamTrackTypes::Kinds kind) noexcept; - virtual MediaStreamTrackPtr create( - IMediaStreamTrackTypes::Kinds kind, - bool remote, - TrackConstraintsPtr constraints - ); - virtual MediaStreamTrackPtr create(IMediaStreamTrackTypes::Kinds kind); }; class MediaStreamTrackFactory : public IFactory {}; @@ -733,11 +497,6 @@ ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProvider::PromiseWithStatsReportPtr, Promis ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsReportTypes::StatsTypeSet, StatsTypeSet) ZS_DECLARE_PROXY_TYPEDEF(zsLib::PromisePtr, PromisePtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IMediaStreamTrackTypes::TrackConstraintsPtr, TrackConstraintsPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaStreamTrackAsyncDelegate::UseReceiverChannelPtr, UseReceiverChannelPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaStreamTrackAsyncDelegate::UseSenderChannelPtr, UseSenderChannelPtr) -ZS_DECLARE_PROXY_METHOD_2(onResolveStatsPromise, PromiseWithStatsReportPtr, StatsTypeSet) -ZS_DECLARE_PROXY_METHOD_2(onApplyConstraints, PromisePtr, TrackConstraintsPtr) -ZS_DECLARE_PROXY_METHOD_1(onSetActiveReceiverChannel, UseReceiverChannelPtr) -ZS_DECLARE_PROXY_METHOD_1(onAttachSenderChannel, UseSenderChannelPtr) -ZS_DECLARE_PROXY_METHOD_1(onDetachSenderChannel, UseSenderChannelPtr) +ZS_DECLARE_PROXY_METHOD(onResolveStatsPromise, PromiseWithStatsReportPtr, StatsTypeSet) +ZS_DECLARE_PROXY_METHOD(onApplyConstraints, PromisePtr, TrackConstraintsPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_MediaStreamTrackChannel.h b/ortc/internal/ortc_MediaStreamTrackChannel.h new file mode 100644 index 00000000..33679d9f --- /dev/null +++ b/ortc/internal/ortc_MediaStreamTrackChannel.h @@ -0,0 +1,236 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include +#include + +#include + +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + + //----------------------------------------------------------------------- + // + // MediaStreamTrackChannel + // + + class MediaStreamTrackChannel : public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaStreamTrackChannelForMediaStreamTrack, + public IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia, + public IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP + { + protected: + struct make_private {}; + + public: + friend interaction IMediaStreamTrackChannelForMediaStreamTrack; + friend interaction IMediaStreamTrackChannelForMediaStreamTrackSubscriber; + friend interaction IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia; + friend interaction IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP; + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber, ForMediaStreamTrackSubscriber); + + typedef PUID SubscriberObjectID; + + typedef std::map MediaDelegateMap; + typedef std::map RTPDelegateMap; + + typedef std::queue RTPPacketQueue; + typedef std::queue RTCPPacketQueue; + typedef std::queue AudioFrameQueue; + typedef std::queue VideoFrameQueue; + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::ImmutableParameters, ImmutableParameters); + + ZS_DECLARE_PTR(MediaDelegateMap); + ZS_DECLARE_PTR(RTPDelegateMap); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForMediaStreamTrackChannel, UseMediaStreamTrack); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberForMediaStreamTrackChannel, UseMediaStreamTrackSubscriber); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel, UseMediaStreamTrackSubscriberMedia); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel, UseMediaStreamTrackSubscriberRTP); + + public: + MediaStreamTrackChannel( + const make_private &, + IMessageQueuePtr queue + ) noexcept; + + MediaStreamTrackChannel(Noop, IMessageQueuePtr queue) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + protected: + void init() noexcept; + + public: + ~MediaStreamTrackChannel() noexcept; + + MediaStreamTrackChannelPtr convert(ForMediaStreamTrackPtr object) noexcept; + MediaStreamTrackChannelPtr convert(ForMediaStreamTrackSubscriberPtr object) noexcept; + MediaStreamTrackChannelPtr convert(ForMediaStreamTrackSubscriberMediaPtr object) noexcept; + MediaStreamTrackChannelPtr convert(ForMediaStreamTrackSubscriberRTPPtr object) noexcept; + + protected: + + //--------------------------------------------------------------------- + // + // MediaChannel (for MediaStreamTrack) + // + + static ForMediaStreamTrackPtr create( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace + ) noexcept; + + PUID getID() const noexcept override { return id_; } + + void shutdown() noexcept override; + + void notifyAudioFrame( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + void notifyVideoFrame( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept override; + + void notifyRTPPacket( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept override; + void notifyRTCPPacket( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept override; + + void subscribeComplete() noexcept override; + + bool shouldCancel(size_t cleanOlderThanTimeIndex) noexcept override; + + //--------------------------------------------------------------------- + // + // MediaChannel (ForMediaStreamTrackSubscriber) + // + + virtual void notifyCancelled(SubscriberObjectID subscriberID) noexcept override; + + //--------------------------------------------------------------------- + // + // MediaChannel (ForMediaStreamTrackSubscriberMedia) + // + + virtual void subscribeMedia( + SubscriberObjectID subscriberID, + IMediaStreamTrackChannelMediaDelegatePtr delegate + ) noexcept override; + + //--------------------------------------------------------------------- + // + // MediaChannel (ForMediaStreamTrackSubscriberRTP) + // + + virtual void subscribeRTP( + SubscriberObjectID subscriberID, + ImmutableParametersPtr params, + IMediaStreamTrackChannelRTPDelegatePtr delegate + ) noexcept override; + + protected: + //--------------------------------------------------------------------- + // + // MediaStreamTrack::RTPSubscriber => (data) + // + + AutoPUID id_; + MediaStreamTrackChannelWeakPtr thisWeak_; + + bool shutdown_{ false }; + + ImmutableMediaChannelTracePtr trace_; + + size_t lastUsageTimeIndex_ {}; + + MediaDelegateMap mediaSubscribers_; + RTPDelegateMap rtpSubscribers_; + + RTPPacketQueue rtpQueue_; + RTCPPacketQueue rtcpQueue_; + AudioFrameQueue audioFrames_; + VideoFrameQueue videoFrames_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackChannelFactory + // + + interaction IMediaStreamTrackChannelFactory + { + static IMediaStreamTrackChannelFactory &singleton(); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrack, ForMediaStreamTrack); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + + virtual ForMediaStreamTrackPtr create( + size_t timeIndex, + ImmutableMediaChannelTracePtr trace + ) noexcept; + }; + + class MediaStreamTrackChannelFactory : public IFactory {}; + + } // namespace internal +} // namespace ortc diff --git a/ortc/internal/ortc_MediaStreamTrackMonitor.h b/ortc/internal/ortc_MediaStreamTrackMonitor.h new file mode 100644 index 00000000..9239a9e3 --- /dev/null +++ b/ortc/internal/ortc_MediaStreamTrackMonitor.h @@ -0,0 +1,52 @@ +/* + + Copyright (c) 2017, Hookflash Inc. + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +//#define ORTC_USE_ALTERNATIVE_MEDIASTREAMTRACK_MONITOR + +#ifdef ORTC_USE_ALTERNATIVE_MEDIASTREAMTRACK_MONITOR +#include +#else + +#include + +#include + +namespace ortc +{ + namespace internal + { + } +} + +#endif //ORTC_USE_ALTERNATIVE_MEDIASTREAMTRACK_MONITOR diff --git a/ortc/internal/ortc_MediaStreamTrackSubscriberMedia.h b/ortc/internal/ortc_MediaStreamTrackSubscriberMedia.h new file mode 100644 index 00000000..5928990a --- /dev/null +++ b/ortc/internal/ortc_MediaStreamTrackSubscriberMedia.h @@ -0,0 +1,268 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include +#include + +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia + // + + class MediaStreamTrackSubscriberMedia : public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaStreamTrackSubscriberMediaForMediaStreamTrack, + public IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel, + public IMediaStreamTrackChannelMediaDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IMediaStreamTrackSubscriberForMediaStreamTrack; + friend interaction IMediaStreamTrackSubscriberMediaForMediaStreamTrack; + friend interaction IMediaStreamTrackSubscriberForMediaStreamTrackChannel; + friend interaction IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel; + + ZS_DECLARE_CLASS_PTR(Subscriber); + + + ZS_DECLARE_TYPEDEF_PTR(MediaStreamTrackSubscriberMedia, UseOuter); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber, UseMediaChannelBase); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberMedia, UseMediaChannel); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::OverconstrainedError, OverconstrainedError); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + + public: + MediaStreamTrackSubscriberMedia( + IMessageQueuePtr queue + ) noexcept; + + MediaStreamTrackSubscriberMedia(Noop, IMessageQueuePtr queue) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + protected: + void init() noexcept; + + public: + ~MediaStreamTrackSubscriberMedia() noexcept; + + protected: + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia => IMediaStreamTrackSubscriberForMediaStreamTrack + // + + PUID getID() const noexcept override { return id_; } + + void shutdown() noexcept override; + + void notifyChannel( + UseMediaChannelBasePtr mediaChannel, + ImmutableMediaChannelTracePtr trace + ) noexcept override; + + void notifyTrackMute(bool isMuted) noexcept override; + void notifyTrackEnded() noexcept override; + void notifyOverConstrained(OverconstrainedErrorPtr error) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia => IMediaStreamTrackSubscriberMediaForMediaStreamTrack + // + + static ForMediaStreamTrackPtr create( + IMediaStreamTrackMediaSubscriptionPtr &outSubscription, + IMediaStreamTrackSyncMediaDelegatePtr syncDelegate, + IMediaStreamTrackAsyncMediaDelegatePtr asyncDelegate + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia => IMediaStreamTrackSubscriberForMediaStreamTrackChannel + // + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia => IMediaStreamTrackSubscriberMediaForMediaStreamTrackChannel + // + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackChannelDelegate + // + + void notifyMediaChannelCancelled(ImmutableMediaChannelTracePtr trace) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackChannelMediaDelegate + // + + + void notifyMediaChannelAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + void notifyMediaChannelVideoFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia (for Subscriber) + // + + void notifySubscriberCancel() noexcept; + + public: + + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia::Subscriber + // + + class Subscriber : public IMediaStreamTrackMediaSubscription, + public SharedRecursiveLock + { + public: + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia::Subscriber => (for MediaSubscriber) + // + + static SubscriberPtr create(const SharedRecursiveLock &lock) noexcept; + + void shutdown() noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia::Subscriber => IMediaStreamTrackMediaSubscription + // + + virtual PUID getID() const noexcept { return id_; } + + virtual void cancel() noexcept; + + virtual void background() noexcept; + + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia::Subscriber => (internal) + // + + protected: + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia::Subscriber => (data) + // + + AutoPUID id_; + SubscriberWeakPtr thisWeak_; + + bool shutdown_ {false}; + + UseOuterPtr outer_; + + SubscriberPtr backgroundReference_; + }; + + protected: + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberMedia => (data) + // + + AutoPUID id_; + MediaStreamTrackSubscriberMediaWeakPtr thisWeak_; + + bool shutdown_{ false }; + + SubscriberWeakPtr subscriber_; + + IMediaStreamTrackSyncMediaDelegatePtr syncDelegate_; + IMediaStreamTrackAsyncMediaDelegatePtr asyncDelegate_; + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberMediaFactory + // + + interaction IMediaStreamTrackSubscriberMediaFactory + { + static IMediaStreamTrackSubscriberMediaFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberMediaForMediaStreamTrack, ForMediaStreamTrack); + + static ForMediaStreamTrackPtr create( + IMediaStreamTrackMediaSubscriptionPtr &outSubscription, + IMediaStreamTrackSyncMediaDelegatePtr syncDelegate, + IMediaStreamTrackAsyncMediaDelegatePtr asyncDelegate + ) noexcept; + }; + + class MediaStreamTrackSubscriberMediaFactory : public IFactory {}; + + } // namespace internal +} // namespace ortc diff --git a/ortc/internal/ortc_MediaStreamTrackSubscriberRTP.h b/ortc/internal/ortc_MediaStreamTrackSubscriberRTP.h new file mode 100644 index 00000000..f7ec6f4c --- /dev/null +++ b/ortc/internal/ortc_MediaStreamTrackSubscriberRTP.h @@ -0,0 +1,283 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include +#include +#include + +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP + // + + class MediaStreamTrackSubscriberRTP : public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IMediaStreamTrackSubscriberRTPForMediaStreamTrack, + public IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel, + public IMediaStreamTrackChannelMediaDelegate, + public IMediaStreamTrackChannelRTPDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IMediaStreamTrackSubscriberForMediaStreamTrack; + friend interaction IMediaStreamTrackSubscriberRTPForMediaStreamTrack; + friend interaction IMediaStreamTrackSubscriberForMediaStreamTrackChannel; + friend interaction IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel; + + ZS_DECLARE_CLASS_PTR(Subscriber); + + ZS_DECLARE_TYPEDEF_PTR(MediaStreamTrackSubscriberRTP, UseOuter); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriber, UseMediaChannelBase); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackChannelForMediaStreamTrackSubscriberRTP, UseMediaChannel); + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::OverconstrainedError, OverconstrainedError); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + public: + MediaStreamTrackSubscriberRTP( + IMessageQueuePtr queue + ) noexcept; + + MediaStreamTrackSubscriberRTP(Noop, IMessageQueuePtr queue) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()) + {} + + protected: + void init() noexcept; + + public: + ~MediaStreamTrackSubscriberRTP() noexcept; + + protected: + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackSubscriberForMediaStreamTrack + // + + PUID getID() const noexcept override { return id_; } + + void shutdown() noexcept override; + + void notifyChannel( + UseMediaChannelBasePtr mediaChannel, + ImmutableMediaChannelTracePtr trace + ) noexcept override; + + void notifyTrackMute(bool isMuted) noexcept override; + void notifyTrackEnded() noexcept override; + void notifyOverConstrained(OverconstrainedErrorPtr error) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackSubscriberRTPForMediaStreamTrack + // + + static ForMediaStreamTrackPtr create( + IMediaStreamTrackMediaSubscriptionPtr &outSubscription, + IMediaStreamTrackRTPDelegatePtr delegate + ) noexcept; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackSubscriberForMediaStreamTrackChannel + // + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackSubscriberRTPForMediaStreamTrackChannel + // + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackChannelDelegate + // + + void notifyMediaChannelCancelled(ImmutableMediaChannelTracePtr trace) noexcept override; + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackChannelMediaDelegate + // + + + void notifyMediaChannelAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + void notifyMediaChannelVideoFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => IMediaStreamTrackChannelRTPDelegate + // + + + void notifyMediaChannelRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept override; + void notifyMediaChannelRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept override; + + + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => (for Subscriber) + // + + void notifySubscriberCancel() noexcept; + + public: + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP::Subscriber + // + + class Subscriber : public IMediaStreamTrackMediaSubscription, + public SharedRecursiveLock + { + public: + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP::Subscriber => (for MediaSubscriber) + // + + static SubscriberPtr create(const SharedRecursiveLock &lock) noexcept; + + void shutdown() noexcept; + + protected: + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP::Subscriber => IMediaStreamTrackMediaSubscription + // + + virtual PUID getID() const noexcept { return id_; } + + virtual void cancel() noexcept; + + virtual void background() noexcept; + + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP::Subscriber => (internal) + // + + protected: + //--------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP::Subscriber => (data) + // + + AutoPUID id_; + SubscriberWeakPtr thisWeak_; + + bool shutdown_ {false}; + + UseOuterPtr outer_; + + SubscriberPtr backgroundReference_; + }; + + protected: + //----------------------------------------------------------------------- + // + // MediaStreamTrackSubscriberRTP => (data) + // + + AutoPUID id_; + MediaStreamTrackSubscriberRTPWeakPtr thisWeak_; + + bool shutdown_{ false }; + + SubscriberWeakPtr subscriber_; + + IMediaStreamTrackRTPDelegatePtr delegate_; + + ParametersPtr parameters_; + }; + + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IMediaStreamTrackSubscriberRTPFactory + // + + interaction IMediaStreamTrackSubscriberRTPFactory + { + static IMediaStreamTrackSubscriberRTPFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackSubscriberRTPForMediaStreamTrack, ForMediaStreamTrack); + + static ForMediaStreamTrackPtr create( + IMediaStreamTrackMediaSubscriptionPtr &outSubscription, + IMediaStreamTrackRTPDelegatePtr delegate + ) noexcept; + }; + + class MediaStreamTrackSubscriberRTPFactory : public IFactory {}; + + + } // namespace internal +} // namespace ortc diff --git a/ortc/internal/ortc_ORTC.h b/ortc/internal/ortc_ORTC.h index bd7e3b71..85533512 100644 --- a/ortc/internal/ortc_ORTC.h +++ b/ortc/internal/ortc_ORTC.h @@ -31,18 +31,33 @@ #pragma once +#ifdef WINUWP +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION +#include +#endif //CPPWINRT_VERSION +#endif //WINUWP + #include #include -#define ORTC_QUEUE_MAIN_THREAD_NAME "org.ortc.ortcLibMainThread" -#define ORTC_QUEUE_PIPELINE_THREAD_NAME "org.ortc.ortcLibPipeline" -#define ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME "org.ortc.ortcLibBlockingMedia" -#define ORTC_QUEUE_CERTIFICATE_GENERATION_NAME "org.ortc.ortcLibCertificateGeneration" -#define ORTC_QUEUE_PACKET_THREAD_NAME "org.ortc.ortcLibPacketThread." -#define ORTC_QUEUE_TOTAL_PACKET_THREADS 4 - -#define ORTC_QUEUE_THREAD_MAIN_PRIORITY "ortc/ortc-thread-main-priority" -#define ORTC_QUEUE_THREAD_PIPELINE_PRIORITY "ortc/ortc-thread-pipeline-priority" +#define ORTC_QUEUE_MAIN_THREAD_NAME "org.ortc.ortcLib.MainThread" +#define ORTC_QUEUE_PIPELINE_THREAD_NAME "org.ortc.ortcLib.Pipeline" +#define ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME "org.ortc.ortcLib.BlockingMedia" +#define ORTC_QUEUE_CERTIFICATE_GENERATION_NAME "org.ortc.ortcLib.CertificateGeneration" +#define ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME "org.ortc.ortcLib.MediaDeviceThread." +#define ORTC_QUEUE_RTP_THREAD_NAME "org.ortc.ortcLib.RTP." +#define ORTC_QUEUE_TOTAL_MEDIA_DEVICE_THREADS 4 +#define ORTC_QUEUE_TOTAL_RTP_THREADS 4 + +#define ORTC_SETTING_ORTC_QUEUE_MAIN_THREAD_NAME "ortc/ortc/" ORTC_QUEUE_MAIN_THREAD_NAME +#define ORTC_SETTING_ORTC_QUEUE_PIPELINE_THREAD_NAME "ortc/ortc/" ORTC_QUEUE_PIPELINE_THREAD_NAME +#define ORTC_SETTING_ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME "ortc/ortc/" ORTC_QUEUE_BLOCKING_MEDIA_STARTUP_THREAD_NAME +#define ORTC_SETTING_ORTC_QUEUE_CERTIFICATE_GENERATION_NAME "ortc/ortc/" ORTC_QUEUE_CERTIFICATE_GENERATION_NAME +#define ORTC_SETTING_ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME "ortc/ortc/" ORTC_QUEUE_MEDIA_DEVICE_THREAD_NAME +#define ORTC_SETTING_ORTC_QUEUE_RTP_THREAD_NAME "ortc/ortc/" ORTC_QUEUE_RTP_THREAD_NAME namespace ortc { @@ -52,32 +67,33 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IORTCForInternal - #pragma mark + // + // IORTCForInternal + // interaction IORTCForInternal { ZS_DECLARE_TYPEDEF_PTR(IORTCForInternal, ForInternal) - static void overrideQueueDelegate(IMessageQueuePtr queue); - static IMessageQueuePtr queueDelegate(); - static IMessageQueuePtr queueORTC(); - static IMessageQueuePtr queueORTCPipeline(); - static IMessageQueuePtr queuePacket(); - static IMessageQueuePtr queueBlockingMediaStartStopThread(); - static IMessageQueuePtr queueCertificateGeneration(); + static void overrideQueueDelegate(IMessageQueuePtr queue) noexcept; + static IMessageQueuePtr queueDelegate() noexcept; + static IMessageQueuePtr queueORTC() noexcept; + static IMessageQueuePtr queueORTCPipeline() noexcept; + static IMessageQueuePtr queueBlockingMediaStartStopThread() noexcept; + static IMessageQueuePtr queueMediaDevices() noexcept; + static IMessageQueuePtr queueRTP() noexcept; + static IMessageQueuePtr queueCertificateGeneration() noexcept; - static Optional webrtcLogLevel(); + static Optional webrtcLogLevel() noexcept; }; //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Stack - #pragma mark + // + // Stack + // class ORTC : public IORTC, public IORTCForInternal, @@ -91,73 +107,81 @@ namespace ortc friend interaction IORTCForInternal; public: - ORTC(const make_private &); + ORTC(const make_private &) noexcept; protected: - void init(); + void init() noexcept; public: - virtual ~ORTC(); + virtual ~ORTC() noexcept; - static ORTCPtr create(); - static ORTCPtr convert(IORTCPtr object); + static ORTCPtr create() noexcept; + static ORTCPtr convert(IORTCPtr object) noexcept; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark ORTC => IORTC - #pragma mark + // + // ORTC => IORTC + // - static ORTCPtr singleton(); + static ORTCPtr singleton() noexcept; - virtual PUID getID() const {return mID;} + PUID getID() const noexcept {return mID;} - virtual void setup(IMessageQueuePtr defaultDelegateMessageQueue); -#ifdef WINRT - virtual void setup(Windows::UI::Core::CoreDispatcher ^dispatcher); -#endif //WINRT + void setup(IMessageQueuePtr defaultDelegateMessageQueue) noexcept; +#ifdef WINUWP +#ifdef __cplusplus_winrt + void setup(Windows::UI::Core::CoreDispatcher ^dispatcher) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + void setup(winrt::Windows::UI::Core::CoreDispatcher dispatcher) noexcept; +#endif //CPPWINRT_VERSION +#endif //WINUWP - virtual Milliseconds ntpServerTime() const; - virtual void ntpServerTime(const Milliseconds &value); + Milliseconds ntpServerTime() const noexcept; + void ntpServerTime(const Milliseconds &value) noexcept; - virtual void defaultWebrtcLogLevel(Log::Level level); - virtual void webrtcLogLevel(Log::Level level); + void defaultWebrtcLogLevel(Log::Level level) noexcept; + void webrtcLogLevel(Log::Level level) noexcept; - virtual void startMediaTracing(); - virtual void stopMediaTracing(); - virtual bool isMediaTracing(); - virtual bool saveMediaTrace(String filename); - virtual bool saveMediaTrace(String host, int port); - virtual bool isMRPInstalled(); + void startMediaTracing() noexcept; + void stopMediaTracing() noexcept; + bool isMediaTracing() noexcept; + bool saveMediaTrace(String filename) noexcept; + bool saveMediaTrace(String host, int port) noexcept; + bool isMRPInstalled() noexcept; //--------------------------------------------------------------------- - #pragma mark - #pragma mark ORTC => IORTCForInternal - #pragma mark + // + // ORTC => IORTCForInternal + // - virtual void overrideQueueDelegate(IMessageQueuePtr queue); - virtual IMessageQueuePtr queueDelegate() const; - virtual IMessageQueuePtr queueORTC() const; - virtual IMessageQueuePtr queueORTCPipeline() const; - virtual IMessageQueuePtr queuePacket() const; - virtual IMessageQueuePtr queueBlockingMediaStartStopThread() const; - virtual IMessageQueuePtr queueCertificateGeneration() const; + void overrideQueueDelegate(IMessageQueuePtr queue) noexcept; + IMessageQueuePtr queueDelegate() const noexcept; + IMessageQueuePtr queueORTC() const noexcept; + IMessageQueuePtr queueMediaDevices() const noexcept; + IMessageQueuePtr queueRTP() const noexcept; + IMessageQueuePtr queueORTCPipeline() const noexcept; + IMessageQueuePtr queueBlockingMediaStartStopThread() const noexcept; + IMessageQueuePtr queueCertificateGeneration() const noexcept; - virtual Optional webrtcLogLevel() const; + Optional webrtcLogLevel() const noexcept; //--------------------------------------------------------------------- - #pragma mark - #pragma mark ORTC => (internal) - #pragma mark + // + // ORTC => (internal) + // + + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); + void internalSetup() noexcept; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark ORTC => (data) - #pragma mark + // + // ORTC => (data) + // AutoPUID mID; ORTCWeakPtr mThisWeak; @@ -167,8 +191,10 @@ namespace ortc mutable IMessageQueuePtr mBlockingMediaStartStopThread; mutable IMessageQueuePtr mCertificateGeneration; - mutable IMessageQueuePtr mPacketQueues[ORTC_QUEUE_TOTAL_PACKET_THREADS]; - mutable size_t mNextPacketQueueThread {}; + mutable IMessageQueuePtr mMediaDeviceQueues[ORTC_QUEUE_TOTAL_MEDIA_DEVICE_THREADS]; + mutable IMessageQueuePtr mRTPQueues[ORTC_QUEUE_TOTAL_RTP_THREADS]; + mutable size_t mNextMediaQueueThread {}; + mutable size_t mNextRTPQueueThread {}; Milliseconds mNTPServerTime {}; diff --git a/ortc/internal/ortc_RTCPPacket.h b/ortc/internal/ortc_RTCPPacket.h deleted file mode 100644 index 7fd5ba8e..00000000 --- a/ortc/internal/ortc_RTCPPacket.h +++ /dev/null @@ -1,1594 +0,0 @@ -/* - - Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include - -#include - -namespace ortc -{ - namespace internal - { - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket - #pragma mark - - class RTCPPacket - { - protected: - struct make_private {}; - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::Report - #pragma mark - - struct Report - { - Report *next() const {return mNext;} - - const BYTE *ptr() const {return mPtr;} - size_t size() const {return mSize;} - - BYTE version() const {return mVersion;} - size_t padding() const {return static_cast(mPadding);} - BYTE reportSpecific() const {return mReportSpecific;} - - BYTE pt() const {return mPT;} - static const char *ptToString(BYTE pt); - const char *ptToString() const {return ptToString(mPT);} - - public: - Report *mNext {}; - - const BYTE *mPtr {}; - size_t mSize {}; - - BYTE mVersion {}; - BYTE mPadding {}; - BYTE mReportSpecific {}; - - BYTE mPT {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SenderReceiverCommonReport - #pragma mark - - struct SenderReceiverCommonReport : public Report - { - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SenderReceiverCommonReport::ReportBlock - #pragma mark - - struct ReportBlock - { - ReportBlock *next() const {return mNext;} - - DWORD ssrc() const {return mSSRC;} - BYTE fractionLost() const {return mFractionLost;} - DWORD cumulativeNumberOfPacketsLost() const {return mCumulativeNumberOfPacketsLost;} - DWORD extendedHighestSequenceNumberReceived() const {return mExtendedHighestSequenceNumberReceived;} - DWORD interarrivalJitter() const {return mInterarrivalJitter;} - DWORD lsr() const {return mLSR;} - DWORD dlsr() const {return mDLSR;} - - public: - ReportBlock *mNext {}; - - DWORD mSSRC {}; - BYTE mFractionLost {}; - DWORD mCumulativeNumberOfPacketsLost {}; - DWORD mExtendedHighestSequenceNumberReceived {}; - DWORD mInterarrivalJitter {}; - DWORD mLSR {}; // last SR timestamp - DWORD mDLSR {}; // delay since last SR - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SenderReceiverCommonReport (public) - #pragma mark - - size_t rc() const {return static_cast(mReportSpecific);} - DWORD ssrcOfSender() const {return mSSRCOfSender;} - - ReportBlock *firstReportBlock() const {return mFirstReportBlock;} - - const BYTE *extension() const {return mExtension;} - size_t extensionSize() const {return mExtensionSize;} - - public: - DWORD mSSRCOfSender {}; - - const BYTE *mExtension {}; - size_t mExtensionSize {}; - - ReportBlock *mFirstReportBlock {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SenderReport - #pragma mark - - struct SenderReport : public SenderReceiverCommonReport - { - // https://tools.ietf.org/html/rfc3550#section-6.4.1 - - static const BYTE kPayloadType {200}; - - SenderReport *nextSenderReport() const {return mNextSenderReport;} - - DWORD ntpTimestampMS() const {return mNTPTimestampMS;} - DWORD ntpTimestampLS() const {return mNTPTimestampLS;} - Time ntpTimestamp() const; - DWORD rtpTimestamp() const {return mRTPTimestamp;} - DWORD senderPacketCount() const {return mSenderPacketCount;} - DWORD senderOctetCount() const {return mSenderOctetCount;} - - public: - SenderReport *mNextSenderReport {}; - - DWORD mNTPTimestampMS {}; - DWORD mNTPTimestampLS {}; - DWORD mRTPTimestamp {}; - DWORD mSenderPacketCount {}; - DWORD mSenderOctetCount {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::ReceiverReport - #pragma mark - - struct ReceiverReport : public SenderReceiverCommonReport - { - // https://tools.ietf.org/html/rfc3550#section-6.4.2 - - static const BYTE kPayloadType {201}; - - ReceiverReport *nextReceiverReport() const {return mNextReceiverReport;} - - DWORD ssrcOfPacketSender() const {return mSSRCOfSender;} - - public: - ReceiverReport *mNextReceiverReport {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES - #pragma mark - - struct SDES : public Report - { - // https://tools.ietf.org/html/rfc3550#section-6.5 - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk - #pragma mark - - struct Chunk - { - static const BYTE kEndOfItemsType = 0; - - struct StringItem - { - BYTE type() const {return mType;} - size_t length() const {return mLength;} - const char *value() const {return mValue;} - - static const char *typeToString(BYTE type); - const char *typeToString() const {return typeToString(mType);} - - public: - StringItem *mNext {}; - - BYTE mType {}; - size_t mLength {}; - const char *mValue {}; - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::CName - #pragma mark - - struct CName : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.1 - - static const BYTE kItemType = 1; - - CName *next() const {return static_cast(mNext);} - - const char *userAndDomainName() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Name - #pragma mark - - struct Name : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.2 - - static const BYTE kItemType = 2; - - Name *next() const {return static_cast(mNext);} - - const char *commonName() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Email - #pragma mark - - struct Email : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.3 - - static const BYTE kItemType = 3; - - Email *next() const {return static_cast(mNext);} - - const char *emailAddress() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Phone - #pragma mark - - struct Phone : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.4 - - static const BYTE kItemType = 4; - - Phone *next() const {return static_cast(mNext);} - - const char *phoneNumber() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Loc - #pragma mark - - struct Loc : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.5 - - static const BYTE kItemType = 5; - - Loc *next() const {return static_cast(mNext);} - - const char *geographicLocation() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Tool - #pragma mark - - struct Tool : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.6 - - static const BYTE kItemType = 6; - - Tool *next() const {return static_cast(mNext);} - - const char *nameVersion() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Note - #pragma mark - - struct Note : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.7 - - static const BYTE kItemType = 7; - - Note *next() const {return static_cast(mNext);} - - const char *note() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Priv - #pragma mark - - struct Priv : public StringItem - { - // https://tools.ietf.org/html/rfc3550#section-6.5.8 - - static const BYTE kItemType = 8; - - Priv *next() const {return static_cast(mNext);} - - size_t prefixLength() const {return mPrefixLength;} - const char *prefix() const {return mPrefix;} - - public: - size_t mPrefixLength {}; - const char *mPrefix {}; - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Unknown - #pragma mark - - struct Unknown : public StringItem - { - Unknown *next() const {return static_cast(mNext);} - - const BYTE *ptr() const {return reinterpret_cast(value());} - size_t size() const {return length();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Mid - #pragma mark - - struct Mid : public StringItem - { - // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-23#section-14.2 - static const BYTE kItemType = 12; // TBD - - Mid *next() const {return static_cast(mNext);} - - const char *mid() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk::Rid - #pragma mark - - struct Rid : public StringItem - { - // https://tools.ietf.org/html/draft-roach-avtext-rid-02#section-4.1 - static const BYTE kItemType = 13; // TBD - - Rid *next() const {return static_cast(mNext);} - - const char *rid() const {return value();} - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::SDES::Chunk - #pragma mark - - Chunk *next() const {return mNext;} - - DWORD ssrc() const {return mSSRC;} - - size_t count() const {return mCount;} - - CName *firstCName() const {return mFirstCName;} - Name *firstName() const {return mFirstName;} - Email *firstEmail() const {return mFirstEmail;} - Phone *firstPhone() const {return mFirstPhone;} - Loc *firstLoc() const {return mFirstLoc;} - Tool *firstTool() const {return mFirstTool;} - Note *firstNote() const {return mFirstNote;} - Priv *firstPriv() const {return mFirstPriv;} - Mid *firstMid() const {return mFirstMid;} - Rid *firstRid() const {return mFirstRid;} - Unknown *firstUnknown() const {return mFirstUnknown;} - - size_t cNameCount() const {return mCNameCount;} - size_t nameCount() const {return mNameCount;} - size_t emailCount() const {return mEmailCount;} - size_t phoneCount() const {return mPhoneCount;} - size_t locCount() const {return mLocCount;} - size_t toolCount() const {return mToolCount;} - size_t noteCount() const {return mNoteCount;} - size_t privCount() const {return mPrivCount;} - size_t midCount() const {return mMidCount;} - size_t ridCount() const {return mRidCount;} - size_t unknownCount() const {return mUnknownCount;} - - CName *cNameAtIndex(size_t index) const; - Name *nameAtIndex(size_t index) const; - Email *emailAtIndex(size_t index) const; - Phone *phoneAtIndex(size_t index) const; - Loc *locAtIndex(size_t index) const; - Tool *toolAtIndex(size_t index) const; - Note *noteAtIndex(size_t index) const; - Priv *privAtIndex(size_t index) const; - Mid *midAtIndex(size_t index) const; - Rid *ridAtIndex(size_t index) const; - Unknown *unknownAtIndex(size_t index) const; - - public: - Chunk *mNext {}; - - DWORD mSSRC {}; - - size_t mCount {}; - - size_t mCNameCount {}; - size_t mNameCount {}; - size_t mEmailCount {}; - size_t mPhoneCount {}; - size_t mLocCount {}; - size_t mToolCount {}; - size_t mNoteCount {}; - size_t mPrivCount {}; - size_t mMidCount {}; - size_t mRidCount {}; - size_t mUnknownCount {}; - - CName *mFirstCName {}; - Name *mFirstName {}; - Email *mFirstEmail {}; - Phone *mFirstPhone {}; - Loc *mFirstLoc {}; - Tool *mFirstTool {}; - Note *mFirstNote {}; - Priv *mFirstPriv {}; - Mid *mFirstMid {}; - Rid *mFirstRid {}; - Unknown *mFirstUnknown {}; - }; - - static const BYTE kPayloadType {202}; - - SDES *nextSDES() const {return mNextSDES;} - - size_t sc() const {return static_cast(mReportSpecific);} - - Chunk *firstChunk() const {return mFirstChunk;} - - public: - SDES *mNextSDES {}; - - Chunk *mFirstChunk {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::Bye - #pragma mark - - struct Bye : public Report - { - // https://tools.ietf.org/html/rfc3550#section-6.6 - - static const BYTE kPayloadType {203}; - - Bye *nextBye() const {return mNextBye;} - - size_t sc() const {return static_cast(mReportSpecific);} - - DWORD ssrc(size_t index) const; - - const char *reasonForLeaving() const {return mReasonForLeaving;} - - public: - Bye *mNextBye {}; - - const char *mReasonForLeaving {}; - - DWORD *mSSRCs {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::App - #pragma mark - - struct App : public Report - { - // https://tools.ietf.org/html/rfc3550#section-6.7 - - static const BYTE kPayloadType {204}; - - App *nextApp() const {return mNextApp;} - - BYTE subtype() const {return mReportSpecific;} - - DWORD ssrc() const {return mSSRC;} - const char *name() const {return &(mName[0]);} - - const BYTE *data() const {return mData;} - size_t dataSize() const {return mDataSize;} - - public: - App *mNextApp {}; - - DWORD mSSRC {}; - char mName[sizeof(DWORD)+1] {}; - - const BYTE *mData {}; - size_t mDataSize {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::FeedbackMessage - #pragma mark - - struct FeedbackMessage : public Report - { - // https://tools.ietf.org/html/rfc4585#section-6.1 - - BYTE fmt() const {return mReportSpecific;} - - DWORD ssrcOfPacketSender() const {return mSSRCOfPacketSender;} - DWORD ssrcOfMediaSource() const {return mSSRCOfMediaSource;} - - const BYTE *fci() const {return mFCI;} - size_t fciSize() const {return mFCISize;} - - static const char *fmtToString(BYTE pt, BYTE fmt, DWORD subFmt = 0); - const char *fmtToString() const; - - public: - DWORD mSSRCOfPacketSender {}; - DWORD mSSRCOfMediaSource {}; - - const BYTE *mFCI {}; - size_t mFCISize {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage - #pragma mark - - struct TransportLayerFeedbackMessage : public FeedbackMessage - { - // https://tools.ietf.org/html/rfc4585#section-6.2 - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage::GenericNACK - #pragma mark - - struct GenericNACK - { - // https://tools.ietf.org/html/rfc4585#section-6.2.1 - - static const BYTE kFmt {1}; - - WORD pid() const {return mPID;} - WORD blp() const {return mBLP;} - - public: - WORD mPID {}; - WORD mBLP {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage::TMMBRCommon - #pragma mark - - struct TMMBRCommon - { - DWORD ssrc() const {return mSSRC;} - - BYTE mxTBRExp() const {return mMxTBRExp;} - DWORD mxTBRMantissa() const {return mMxTBRMantissa;} - WORD measuredOverhead() const {return mMeasuredOverhead;} - - public: - DWORD mSSRC {}; - - BYTE mMxTBRExp {}; - DWORD mMxTBRMantissa {}; - WORD mMeasuredOverhead {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage::TMMBR - #pragma mark - - struct TMMBR : public TMMBRCommon - { - // http://tools.ietf.org/html/rfc5104#section-4.2.1.1 - - static const BYTE kFmt {3}; - - public: - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage::TMMBN - #pragma mark - - struct TMMBN : public TMMBRCommon - { - // http://tools.ietf.org/html/rfc5104#section-4.2.2.1 - - static const BYTE kFmt {4}; - - public: - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::TransportLayerFeedbackMessage (public) - #pragma mark - - static const BYTE kPayloadType {205}; - - TransportLayerFeedbackMessage *nextTransportLayerFeedbackMessage() const {return mNextTransportLayerFeedbackMessage;} - - size_t genericNACKCount() const {return mGenericNACKCount;} - GenericNACK *genericNACKAtIndex(size_t index) const; - - size_t tmmbrCount() const {return mTMMBRCount;} - TMMBR *tmmbrAtIndex(size_t index) const; - - size_t tmmbnCount() const {return mTMMBNCount;} - TMMBN *tmmbnAtIndex(size_t index) const; - - TransportLayerFeedbackMessage *unknown() const {return mUnknown;} - - public: - TransportLayerFeedbackMessage *mNextTransportLayerFeedbackMessage {}; - - size_t mGenericNACKCount {}; - GenericNACK *mFirstGenericNACK {}; - - size_t mTMMBRCount {}; - TMMBR *mFirstTMMBR {}; - - size_t mTMMBNCount {}; - TMMBN *mFirstTMMBN {}; - - TransportLayerFeedbackMessage *mUnknown {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage - #pragma mark - - struct PayloadSpecificFeedbackMessage : public FeedbackMessage - { - // https://tools.ietf.org/html/rfc4585#section-6.3 - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::PLI - #pragma mark - - struct PLI - { - // https://tools.ietf.org/html/rfc4585#section-6.3.1 - - static const BYTE kFmt {1}; - public: - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::SLI - #pragma mark - - struct SLI - { - // https://tools.ietf.org/html/rfc4585#section-6.3.2 - - static const BYTE kFmt {2}; - - WORD first() const {return mFirst;} - WORD number() const {return mNumber;} - BYTE pictureID() const {return mPictureID;} - - public: - WORD mFirst {}; - WORD mNumber {}; - BYTE mPictureID {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::RPSI - #pragma mark - - struct RPSI - { - // https://tools.ietf.org/html/rfc4585#section-6.3.3 - - static const BYTE kFmt {3}; - - BYTE zeroBit() const {return mZeroBit;} - BYTE payloadType() const {return mPayloadType;} - - const BYTE *nativeRPSIBitString() const {return mNativeRPSIBitString;} - size_t nativeRPSIBitStringSizeInBits() const {return mNativeRPSIBitStringSizeInBits;} - - public: - BYTE mZeroBit {}; - BYTE mPayloadType {}; - - const BYTE *mNativeRPSIBitString {}; - size_t mNativeRPSIBitStringSizeInBits {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::FIR - #pragma mark - - struct CodecControlCommon - { - DWORD ssrc() const {return mSSRC;} - BYTE seqNr() const {return mSeqNr;} - DWORD reserved() const {return mReserved;} - - public: - DWORD mSSRC {}; - BYTE mSeqNr {}; - DWORD mReserved {}; - DWORD mControlSpecific {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::FIR - #pragma mark - - struct FIR : public CodecControlCommon - { - // http://tools.ietf.org/html/rfc5104#section-4.3.1.1 - - static const BYTE kFmt {4}; - - public: - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::TSTR - #pragma mark - - struct TSTR : public CodecControlCommon - { - // http://tools.ietf.org/html/rfc5104#section-4.3.2.1 - - static const BYTE kFmt {5}; - - BYTE index() const {return static_cast(mControlSpecific);} - - public: - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::TSTN - #pragma mark - - struct TSTN : public CodecControlCommon - { - // http://tools.ietf.org/html/rfc5104#section-4.3.3.1 - - static const BYTE kFmt {6}; - - BYTE index() const {return static_cast(mControlSpecific);} - - public: - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::VBCM - #pragma mark - - struct VBCM : public CodecControlCommon - { - // http://tools.ietf.org/html/rfc5104#section-4.3.4.1 - - static const BYTE kFmt {7}; - - BYTE zeroBit() const; - BYTE payloadType() const; - - const BYTE *vbcmOctetString() const {return mVBCMOctetString;} - size_t vbcmOctetStringSize() const; - - public: - const BYTE *mVBCMOctetString {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::AFB - #pragma mark - - struct AFB - { - // https://tools.ietf.org/html/rfc4585#section-6.4 - - static const BYTE kFmt {15}; - - const BYTE *data() const {return mData;} - size_t dataSize() const {return mDataSize;} - - public: - const BYTE *mData {}; - size_t mDataSize {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage::REMB - #pragma mark - - struct REMB - { - // https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03#section-2.2 - - static const BYTE kFmt {15}; - - size_t numSSRC() const {return static_cast(mNumSSRC);} - BYTE brExp() const {return mBRExp;} - DWORD brMantissa() const {return mBRMantissa;} - - DWORD ssrcAtIndex(size_t index) const; - - public: - BYTE mNumSSRC {}; - BYTE mBRExp {}; - DWORD mBRMantissa {}; - DWORD *mSSRCs {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::PayloadSpecificFeedbackMessage (public) - #pragma mark - - static const BYTE kPayloadType {206}; - - PayloadSpecificFeedbackMessage *nextPayloadSpecificFeedbackMessage() const {return mNextPayloadSpecificFeedbackMessage;} - - size_t sliCount() const {return mSLICount;} - size_t firCount() const {return mFIRCount;} - size_t tstrCount() const {return mTSTRCount;} - size_t tstnCount() const {return mTSTNCount;} - size_t vbcmCount() const {return mVBCMCount;} - - PLI *pli() const; - SLI *sliAtIndex(size_t index) const; - RPSI *rpsi() const; - FIR *firAtIndex(size_t index) const; - TSTR *tstrAtIndex(size_t index) const; - TSTN *tstnAtIndex(size_t index) const; - VBCM *vbcmAtIndex(size_t index) const; - AFB *afb() const; - REMB *remb() const; - PayloadSpecificFeedbackMessage *unknown() const {return mUnknown;} - - public: - PayloadSpecificFeedbackMessage *mNextPayloadSpecificFeedbackMessage {}; - - PLI mPLI {}; - size_t mSLICount {}; - SLI *mFirstSLI {}; - RPSI mRPSI {}; - size_t mFIRCount {}; - FIR *mFirstFIR {}; - size_t mTSTRCount {}; - TSTR *mFirstTSTR {}; - size_t mTSTNCount {}; - TSTN *mFirstTSTN {}; - size_t mVBCMCount {}; - VBCM *mFirstVBCM {}; - AFB mAFB {}; - bool mHasREMB {false}; - REMB mREMB {}; - - PayloadSpecificFeedbackMessage *mUnknown {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR - #pragma mark - - struct XR : public Report - { - // https://tools.ietf.org/html/rfc3611#section-2 - // https://tools.ietf.org/html/rfc3611#section-3 - - typedef WORD RLEChunk; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::ReportBlock - #pragma mark - - struct ReportBlock - { - ReportBlock *next() const {return mNext;} - - BYTE blockType() const {return mBlockType;} - BYTE typeSpecific() const {return mTypeSpecific;} - - const BYTE *typeSpecificContents() const {return mTypeSpecificContents;} - size_t typeSpecificContentSize() const {return mTypeSpecificContentSize;} - - static const char *blockTypeToString(BYTE blockType); - const char *blockTypeToString() const {return blockTypeToString(mBlockType);} - - public: - ReportBlock *mNext {}; - - BYTE mBlockType {}; - BYTE mTypeSpecific {}; - - const BYTE *mTypeSpecificContents {}; - size_t mTypeSpecificContentSize {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::ReportBlockRange - #pragma mark - - struct ReportBlockRange : public ReportBlock - { - BYTE reserved() const; - BYTE thinning() const; - - DWORD ssrcOfSource() const {return mSSRCOfSource;} - WORD beginSeq() const {return mBeginSeq;} - WORD endSeq() const {return mEndSeq;} - - public: - DWORD mSSRCOfSource {}; - WORD mBeginSeq {}; - WORD mEndSeq {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::RLEReportBlock - #pragma mark - - struct RLEReportBlock : public ReportBlockRange - { - size_t chunkCount() const {return mChunkCount;} - RLEChunk chunkAtIndex(size_t index) const; - - public: - size_t mChunkCount {}; - RLEChunk *mChunks {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::LossRLEReportBlock - #pragma mark - - struct LossRLEReportBlock : public RLEReportBlock - { - // https://tools.ietf.org/html/rfc3611#section-4.1 - - static const BYTE kBlockType {1}; - - LossRLEReportBlock *nextLossRLE() const {return mNextLossRLE;} - - public: - LossRLEReportBlock *mNextLossRLE {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::DuplicateRLEReportBlock - #pragma mark - - struct DuplicateRLEReportBlock : public RLEReportBlock - { - // https://tools.ietf.org/html/rfc3611#section-4.2 - - static const BYTE kBlockType {2}; - - DuplicateRLEReportBlock *nextDuplicateRLE() const {return mNextDuplicateRLE;} - - public: - DuplicateRLEReportBlock *mNextDuplicateRLE {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::PacketReceiptTimesReportBlock - #pragma mark - - struct PacketReceiptTimesReportBlock : public ReportBlockRange - { - // https://tools.ietf.org/html/rfc3611#section-4.3 - - static const BYTE kBlockType {3}; - - PacketReceiptTimesReportBlock *nextPacketReceiptTimesReportBlock() const {return mNextPacketReceiptTimesReportBlock;} - - size_t receiptTimeCount() const {return mReceiptTimeCount;} - DWORD receiptTimeAtIndex(size_t index) const; - - public: - PacketReceiptTimesReportBlock *mNextPacketReceiptTimesReportBlock {}; - - size_t mReceiptTimeCount {}; - DWORD *mReceiptTimes {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::ReceiverReferenceTimeReportBlock - #pragma mark - - struct ReceiverReferenceTimeReportBlock : public ReportBlock - { - // https://tools.ietf.org/html/rfc3611#section-4.4 - - static const BYTE kBlockType {4}; - - ReceiverReferenceTimeReportBlock *nextReceiverReferenceTimeReportBlock() const {return mNextReceiverReferenceTimeReportBlock;} - - DWORD ntpTimestampMS() const {return mNTPTimestampMS;} - DWORD ntpTimestampLS() const {return mNTPTimestampLS;} - Time ntpTimestamp() const; - - public: - ReceiverReferenceTimeReportBlock *mNextReceiverReferenceTimeReportBlock {}; - - DWORD mNTPTimestampMS {}; - DWORD mNTPTimestampLS {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::DLRRReportBlock - #pragma mark - - struct DLRRReportBlock : public ReportBlock - { - // https://tools.ietf.org/html/rfc3611#section-4.5 - - static const BYTE kBlockType {5}; - - struct SubBlock - { - DWORD ssrc() const {return mSSRC;} - DWORD lrr() const {return mLRR;} - DWORD dlrr() const {return mDLRR;} - - DWORD mSSRC {}; - DWORD mLRR {}; - DWORD mDLRR {}; - }; - - DLRRReportBlock *nextDLRRReportBlock() const {return mNextDLRRReportBlock;} - - size_t subBlockCount() const {return mSubBlockCount;} - SubBlock *subBlockAtIndex(size_t index) const; - - public: - DLRRReportBlock *mNextDLRRReportBlock {}; - - size_t mSubBlockCount {}; - SubBlock *mSubBlocks {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::StatisticsSummaryReportBlock - #pragma mark - - struct StatisticsSummaryReportBlock : public ReportBlockRange - { - // https://tools.ietf.org/html/rfc3611#section-4.6 - - static const BYTE kBlockType {6}; - - StatisticsSummaryReportBlock *nextStatisticsSummaryReportBlock() const {return mNextStatisticsSummaryReportBlock;} - - bool lossReportFlag() const; - bool duplicateReportFlag() const; - bool jitterFlag() const; - bool ttlFlag() const; - bool hopLimitFlag() const; - - DWORD lostPackets() const {return mLostPackets;} - DWORD dupPackets() const {return mDupPackets;} - - DWORD minJitter() const {return mMinJitter;} - DWORD maxJitter() const {return mMaxJitter;} - DWORD meanJitter() const {return mMeanJitter;} - DWORD devJitter() const {return mDevJitter;} - - BYTE minTTL() const {return mMinTTLOrHL;} - BYTE maxTTL() const {return mMaxTTLOrHL;} - BYTE meanTTL() const {return mMeanTTLOrHL;} - BYTE devTTL() const {return mDevTTLOrHL;} - - BYTE minHopLimit() const {return mMinTTLOrHL;} - BYTE maxHopLimit() const {return mMaxTTLOrHL;} - BYTE meanHopLimit() const {return mMeanTTLOrHL;} - BYTE devHopLimit() const {return mDevTTLOrHL;} - - public: - StatisticsSummaryReportBlock *mNextStatisticsSummaryReportBlock {}; - - DWORD mLostPackets {}; - DWORD mDupPackets {}; - DWORD mMinJitter {}; - DWORD mMaxJitter {}; - DWORD mMeanJitter {}; - DWORD mDevJitter {}; - - BYTE mMinTTLOrHL {}; - BYTE mMaxTTLOrHL {}; - BYTE mMeanTTLOrHL {}; - BYTE mDevTTLOrHL {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::VoIPMetricsReportBlock - #pragma mark - - struct VoIPMetricsReportBlock : public ReportBlock - { - // https://tools.ietf.org/html/rfc3611#section-4.7 - - static const BYTE kBlockType {7}; - - VoIPMetricsReportBlock *nextVoIPMetricsReportBlock() const {return mNextVoIPMetricsReportBlock;} - - DWORD ssrcOfSource() const {return mSSRCOfSource;} - - BYTE lossRate() const {return mLossRate;} - BYTE discardRate() const {return mDiscardRate;} - BYTE burstDensity() const {return mBurstDensity;} - BYTE gapDensity() const {return mGapDensity;} - - WORD burstDuration() const {return mBurstDuration;} - WORD gapDuration() const {return mGapDuration;} - - WORD roundTripDelay() const {return mRoundTripDelay;} - WORD endSystemDelay() const {return mEndSystemDelay;} - - BYTE signalLevel() const {return mSignalLevel;} - BYTE noiseLevel() const {return mNoiseLevel;} - BYTE rerl() const {return mRERL;} - BYTE Gmin() const {return mGmin;} - - BYTE rFactor() const {return mRFactor;} - BYTE extRFactor() const {return mExtRFactor;} - BYTE mosLQ() const {return mMOSLQ;} - BYTE mosCQ() const {return mMOSCQ;} - - BYTE rxConfig() const {return mRXConfig;} - BYTE plc() const; - BYTE jba() const; - BYTE jbRate() const; - - WORD jbNominal() const {return mJBNominal;} - WORD jbMaximum() const {return mJBMaximum;} - WORD jbAbsMax() const {return mJBAbsMax;} - - public: - VoIPMetricsReportBlock *mNextVoIPMetricsReportBlock {}; - - DWORD mSSRCOfSource {}; - - BYTE mLossRate {}; - BYTE mDiscardRate {}; - BYTE mBurstDensity {}; - BYTE mGapDensity {}; - - WORD mBurstDuration {}; - WORD mGapDuration {}; - - WORD mRoundTripDelay {}; - WORD mEndSystemDelay {}; - - BYTE mSignalLevel {}; - BYTE mNoiseLevel {}; - BYTE mRERL {}; - BYTE mGmin {}; - - BYTE mRFactor {}; - BYTE mExtRFactor {}; - BYTE mMOSLQ {}; - BYTE mMOSCQ {}; - - BYTE mRXConfig {}; - BYTE mReservedVoIP {}; - - WORD mJBNominal {}; - WORD mJBMaximum {}; - WORD mJBAbsMax {}; - }; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::UnknownReportBlock - #pragma mark - - struct UnknownReportBlock : public ReportBlock - { - UnknownReportBlock *nextUnknownReportBlock() const {return mNextUnknownReportBlock;} - - public: - UnknownReportBlock *mNextUnknownReportBlock {}; - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::RunLength - #pragma mark - - struct RunLength - { - // https://tools.ietf.org/html/rfc3611#section-4.1.1 - - RunLength(RLEChunk chunk); - - BYTE runType() const {return mRunType;} - size_t runLength() const {return static_cast(mRunLength);} - - public: - BYTE mRunType {}; // Zero indicates a run of 0s. One indicates a run of 1s. - WORD mRunLength {}; // A value between 1 and 16,383. - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR::BitVector - #pragma mark - - struct BitVector - { - // https://tools.ietf.org/html/rfc3611#section-4.1.2 - - BitVector(RLEChunk chunk); - - BYTE bitAtIndex(size_t index) const; // Zero indicates loss. - - public: - WORD mBitVector {}; - }; - - //------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::XR - #pragma mark - - static const BYTE kPayloadType {207}; - - XR *nextXR() const {return mNextXR;} - - BYTE reserved() const {return mReportSpecific;} - - DWORD ssrc() const {return mSSRC;} - - ReportBlock *firstReportBlock() const {return mFirstReportBlock;} - - LossRLEReportBlock *firstLossRLEReportBlock() const {return mFirstLossRLEReportBlock;} - DuplicateRLEReportBlock *firstDuplicateRLEReportBlock() const {return mFirstDuplicateRLEReportBlock;} - PacketReceiptTimesReportBlock *firstPacketReceiptTimesReportBlock() const {return mFirstPacketReceiptTimesReportBlock;} - ReceiverReferenceTimeReportBlock *firstReceiverReferenceTimeReportBlock() const {return mFirstReceiverReferenceTimeReportBlock;} - DLRRReportBlock *firstDLRRReportBlock() const {return mFirstDLRRReportBlock;} - StatisticsSummaryReportBlock *firstStatisticsSummaryReportBlock() const {return mFirstStatisticsSummaryReportBlock;} - VoIPMetricsReportBlock *firstVoIPMetricsReportBlock() const {return mFirstVoIPMetricsReportBlock;} - UnknownReportBlock *firstUnknownReportBlock() const {return mFirstUnknownReportBlock;} - - size_t reportBlockCount() const {return mReportBlockCount;} - - size_t lossRLEReportBlockCount() const {return mLossRLEReportBlockCount;} - size_t duplicateRLEReportBlockCount() const {return mDuplicateRLEReportBlockCount;} - size_t packetReceiptTimesReportBlockCount() const {return mPacketReceiptTimesReportBlockCount;} - size_t receiverReferenceTimeReportBlockCount() const {return mReceiverReferenceTimeReportBlockCount;} - size_t dlrrReportBlockCount() const {return mDLRRReportBlockCount;} - size_t statisticsSummaryReportBlockCount() const {return mStatisticsSummaryReportBlockCount;} - size_t voIPMetricsReportBlockCount() const {return mVoIPMetricsReportBlockCount;} - size_t unknownReportBlockCount() const {return mUnknownReportBlockCount;} - - LossRLEReportBlock *lossRLEReportBlockAtIndex(size_t index) const; - DuplicateRLEReportBlock *duplicateRLEReportBlockAtIndex(size_t index) const; - PacketReceiptTimesReportBlock *packetReceiptTimesReportBlockAtIndex(size_t index) const; - ReceiverReferenceTimeReportBlock *receiverReferenceTimeReportBlockAtIndex(size_t index) const; - DLRRReportBlock *dlrrReportBlockAtIndex(size_t index) const; - StatisticsSummaryReportBlock *statisticsSummaryReportBlockAtIndex(size_t index) const; - VoIPMetricsReportBlock *voIPMetricsReportBlockAtIndex(size_t index) const; - UnknownReportBlock *unknownReportBlockAtIndex(size_t index) const; - - static bool isRunLengthChunk(RLEChunk chunk); - static bool isBitVectorChunk(RLEChunk chunk); - - static RunLength runLength(RLEChunk chunk) {return RunLength(chunk);} - static BitVector bitVector(RLEChunk chunk) {return BitVector(chunk);} - - public: - XR *mNextXR {}; - - DWORD mSSRC {}; - - size_t mReportBlockCount {}; - - size_t mLossRLEReportBlockCount {}; - size_t mDuplicateRLEReportBlockCount {}; - size_t mPacketReceiptTimesReportBlockCount {}; - size_t mReceiverReferenceTimeReportBlockCount {}; - size_t mDLRRReportBlockCount {}; - size_t mStatisticsSummaryReportBlockCount {}; - size_t mVoIPMetricsReportBlockCount {}; - size_t mUnknownReportBlockCount {}; - - ReportBlock *mFirstReportBlock {}; - - LossRLEReportBlock *mFirstLossRLEReportBlock {}; - DuplicateRLEReportBlock *mFirstDuplicateRLEReportBlock {}; - PacketReceiptTimesReportBlock *mFirstPacketReceiptTimesReportBlock {}; - ReceiverReferenceTimeReportBlock *mFirstReceiverReferenceTimeReportBlock {}; - DLRRReportBlock *mFirstDLRRReportBlock {}; - StatisticsSummaryReportBlock *mFirstStatisticsSummaryReportBlock {}; - VoIPMetricsReportBlock *mFirstVoIPMetricsReportBlock {}; - UnknownReportBlock *mFirstUnknownReportBlock {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTCPPacket::UnknownReport - #pragma mark - - struct UnknownReport : public Report - { - UnknownReport *nextUnknown() const {return mNextUnknown;} - - public: - UnknownReport *mNextUnknown {}; - }; - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark (public) - #pragma mark - - RTCPPacket(const make_private &); - ~RTCPPacket(); - - static RTCPPacketPtr create(const BYTE *buffer, size_t bufferLengthInBytes); - static RTCPPacketPtr create(const SecureByteBlock &buffer); - static RTCPPacketPtr create(SecureByteBlockPtr buffer); // NOTE: ownership of buffer is taken - static RTCPPacketPtr create(const Report *first); - static SecureByteBlockPtr generateFrom(const Report *first); - - const BYTE *ptr() const; - size_t size() const; - SecureByteBlockPtr buffer() const; - - Report *first() const {return mFirst;} - - SenderReport *firstSenderReport() const {return mFirstSenderReport;} - ReceiverReport *firstReceiverReport() const {return mFirstReceiverReport;} - SDES *firstSDES() const {return mFirstSDES;} - Bye *firstBye() const {return mFirstBye;} - App *firstApp() const {return mFirstApp;} - TransportLayerFeedbackMessage *firstTransportLayerFeedbackMessage() const {return mFirstTransportLayerFeedbackMessage;} - PayloadSpecificFeedbackMessage *firstPayloadSpecificFeedbackMessage() const {return mFirstPayloadSpecificFeedbackMessage;} - XR *firstXR() const {return mFirstXR;} - UnknownReport *firstUnknownReport() const {return mFirstUnknownReport;} - - size_t count() const {return mCount;} - - size_t senderReportCount() const {return mSenderReportCount;} - size_t receiverReportCount() const {return mReceiverReportCount;} - size_t sdesCount() const {return mSDESCount;} - size_t byeCount() const {return mByeCount;} - size_t appCount() const {return mAppCount;} - size_t transportLayerFeedbackMessageCount() const {return mTransportLayerFeedbackMessageCount;} - size_t payloadSpecificFeedbackMessage() const {return mPayloadSpecificFeedbackMessageCount;} - size_t xrCount() const {return mXRCount;} - size_t unknownReportCount() const {return mUnknownReportCount;} - - SenderReport *senderReportAtIndex(size_t index) const; - ReceiverReport *receiverReportAtIndex(size_t index) const; - SDES *sdesAtIndex(size_t index) const; - Bye *byeAtIndex(size_t index) const; - App *appAtIndex(size_t index) const; - TransportLayerFeedbackMessage *transportLayerFeedbackReportAtIndex(size_t index) const; - PayloadSpecificFeedbackMessage *payloadSpecificFeedbackReportAtIndex(size_t index) const; - XR *xrAtIndex(size_t index) const; - UnknownReport *unknownAtIndex(size_t index) const; - - ElementPtr toDebug() const; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark (internal) - #pragma mark - - static Log::Params slog(const char *message); - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - - bool parse(); - - bool getAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, BYTE pt, const BYTE *contents, size_t contentSize); - bool getSenderReportAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getReceiverReportAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getSDESAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getByeAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getAppAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getTransportLayerFeedbackMessageAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getXRAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - bool getUnknownReportAllocationSize(BYTE version, BYTE padding, BYTE reportSpecific, const BYTE *contents, size_t contentSize); - - bool getTransportLayerFeedbackMessageGenericNACKAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getTransportLayerFeedbackMessageTMMBRAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getTransportLayerFeedbackMessageTMMBNAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - - bool getPayloadSpecificFeedbackMessagePLIAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageSLIAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageRPSIAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageFIRAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageTSTRAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageTSTNAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageVBCMAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageAFBAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - bool getPayloadSpecificFeedbackMessageREMBAllocationSize(BYTE fmt, const BYTE *contents, size_t contentSize); - - bool getXRLossRLEReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRDuplicateRLEReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRPacketReceiptTimesReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRReceiverReferenceTimeReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRDLRRReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRStatisticsSummaryReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRVoIPMetricsReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - bool getXRUnknownReportBlockAllocationSize(BYTE typeSpecific, const BYTE *contents, size_t contentSize); - - bool parse(Report * &ioLastReport, BYTE version, BYTE padding, BYTE reportSpecific, BYTE pt, const BYTE *contents, size_t contentSize); - void fill(Report *report, BYTE version, BYTE padding, BYTE reportSpecific, BYTE pt, const BYTE *contents, size_t contentSize); - - bool parseCommon( - SenderReceiverCommonReport *report, - size_t detailedHeaderSize - ); - bool parse(SenderReport *report); - bool parse(ReceiverReport *report); - bool parse(SDES *report); - bool parse(Bye *report); - bool parse(App *report); - bool parse(TransportLayerFeedbackMessage *report); - bool parse(PayloadSpecificFeedbackMessage *report); - bool parse(XR *report); - bool parse(UnknownReport *report); - - void fill(FeedbackMessage *report, const BYTE *contents, size_t contentSize); - void fill(XR *report, XR::ReportBlock *reportBlock, XR::ReportBlock * &ioPreviousReportBlock, BYTE blockType, BYTE typeSpecific, const BYTE *contents, size_t contentSize); - - bool parseGenericNACK(TransportLayerFeedbackMessage *report); - void fillTMMBRCommon(TransportLayerFeedbackMessage *report, TransportLayerFeedbackMessage::TMMBRCommon *common, const BYTE *pos); - bool parseTMMBR(TransportLayerFeedbackMessage *report); - bool parseTMMBN(TransportLayerFeedbackMessage *report); - bool parseUnknown(TransportLayerFeedbackMessage *report); - - //CodecControlCommon - bool parsePLI(PayloadSpecificFeedbackMessage *report); - bool parseSLI(PayloadSpecificFeedbackMessage *report); - bool parseRPSI(PayloadSpecificFeedbackMessage *report); - void fillCodecControlCommon(PayloadSpecificFeedbackMessage *report, PayloadSpecificFeedbackMessage::CodecControlCommon *common, const BYTE *pos); - bool parseFIR(PayloadSpecificFeedbackMessage *report); - bool parseTSTR(PayloadSpecificFeedbackMessage *report); - bool parseTSTN(PayloadSpecificFeedbackMessage *report); - bool parseVBCM(PayloadSpecificFeedbackMessage *report); - bool parseAFB(PayloadSpecificFeedbackMessage *report); - bool parseREMB(PayloadSpecificFeedbackMessage *report); - bool parseUnknown(PayloadSpecificFeedbackMessage *report); - - bool parseCommonRange(XR *xr, XR::ReportBlockRange *reportBlock); - bool parseCommonRLE(XR *xr, XR::RLEReportBlock *reportBlock); - bool parse(XR *xr, XR::LossRLEReportBlock *reportBlock); - bool parse(XR *xr, XR::DuplicateRLEReportBlock *reportBlock); - bool parse(XR *xr, XR::PacketReceiptTimesReportBlock *reportBlock); - bool parse(XR *xr, XR::ReceiverReferenceTimeReportBlock *reportBlock); - bool parse(XR *xr, XR::DLRRReportBlock *reportBlock); - bool parse(XR *xr, XR::StatisticsSummaryReportBlock *reportBlock); - bool parse(XR *xr, XR::VoIPMetricsReportBlock *reportBlock); - bool parse(XR *xr, XR::UnknownReportBlock *reportBlock); - - void *allocateBuffer(size_t size); - - static size_t getPacketSize(const Report *first); - static void writePacket(const Report *first, BYTE * &ioPos, size_t &ioRemaining); - - public: - SecureByteBlockPtr mBuffer; - SecureByteBlockPtr mAllocationBuffer; - - BYTE *mAllocationPos {}; - size_t mAllocationSize {}; - - Report *mFirst {}; - - size_t mCount {}; - - size_t mSenderReportCount {}; - size_t mReceiverReportCount {}; - size_t mSDESCount {}; - size_t mByeCount {}; - size_t mAppCount {}; - size_t mTransportLayerFeedbackMessageCount {}; - size_t mPayloadSpecificFeedbackMessageCount {}; - size_t mXRCount {}; - size_t mUnknownReportCount {}; - - SenderReport *mFirstSenderReport {}; - ReceiverReport *mFirstReceiverReport {}; - SDES *mFirstSDES {}; - Bye *mFirstBye {}; - App *mFirstApp {}; - TransportLayerFeedbackMessage *mFirstTransportLayerFeedbackMessage {}; - PayloadSpecificFeedbackMessage *mFirstPayloadSpecificFeedbackMessage {}; - XR *mFirstXR {}; - UnknownReport *mFirstUnknownReport {}; - }; - - } -} - diff --git a/ortc/internal/ortc_RTPDecoderAudio.h b/ortc/internal/ortc_RTPDecoderAudio.h new file mode 100644 index 00000000..b55966a5 --- /dev/null +++ b/ortc/internal/ortc_RTPDecoderAudio.h @@ -0,0 +1,293 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include + +#include +#include +#include + +#include + +namespace ortc +{ + namespace internal + { + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // RTPDecoderAudio (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderAudio + // + + class RTPDecoderAudio : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IRTPDecoderAudio, + public IRTPDecoderAudioForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate, + public IRTPDecoderAysncDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IRTPDecoderAudioForMediaEngine; + friend interaction IRTPDecoderAysncDelegate; + + typedef IRTP::RTPObjectID RTPObjectID; + typedef IRTP::States States; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderAudio, UseMediaEngine); + + public: + RTPDecoderAudio( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + protected: + RTPDecoderAudio(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + traceHelper_(id_) + {} + + void init() noexcept; + + public: + virtual ~RTPDecoderAudio() noexcept; + + static RTPDecoderAudioPtr create( + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + static RTPDecoderAudioPtr convert(ForMediaEnginePtr object) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTP + // + + RTPObjectID getID() const noexcept override { return id_; } + void cancel() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoder + // + + void notifyRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept override; + void notifyRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept override; + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderAudio + // + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPForMediaEngine + // + + // (duplicate) virtual RTPObjectID getID() const = 0; + void shutdown() noexcept override; + + // (duplciate) virtual States getState() const override; + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderAudioForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => IRTPDecoderAysncDelegate + // + + void onRTPDecoderRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) override; + void onRTPDecoderRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) override; + + protected: + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => (internal) + // + + bool isPending() const noexcept { return IRTP::State_Pending == currentState_; } + bool isReady() const noexcept { return IRTP::State_Ready == currentState_; } + bool isShuttingDown() const noexcept { return IRTP::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IRTP::State_Shutdown == currentState_; } + + void innerCancel() noexcept; + + bool stepShutdownPendingPromise() noexcept; + bool stepShutdownCoder() noexcept; + + void step() noexcept; + bool stepSetup() noexcept; + bool stepResolve() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + void innerNotifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept; + void innerNotifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept {} // ignored + + public: + + protected: + //----------------------------------------------------------------------- + // + // RTPDecoderAudio => (data) + // + + AutoPUID id_; + RTPDecoderAudioWeakPtr thisWeak_; + + RTPDecoderAudioPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + + States currentState_ {IRTP::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithRTPDecoderAudioPtr promise_; + ParametersPtr parameters_; + IRTPDecoderDelegateWeakPtr notifyDelegate_; + IRTPDecoderDelegatePtr delegate_; + + IRTPDecoderAysncDelegatePtr asyncThisDelegate_; + + MediaChannelTraceHelper traceHelper_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderAudioFactory + // + + interaction IRTPDecoderAudioFactory + { + static IRTPDecoderAudioFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderAudio, UseMediaEngine); + + virtual RTPDecoderAudioPtr create( + PromiseWithRTPDecoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + }; + + class RTPDecoderAudioFactory : public IFactory {}; + } +} + diff --git a/ortc/internal/ortc_RTPDecoderVideo.h b/ortc/internal/ortc_RTPDecoderVideo.h new file mode 100644 index 00000000..ca559533 --- /dev/null +++ b/ortc/internal/ortc_RTPDecoderVideo.h @@ -0,0 +1,292 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include + +#include +#include +#include + +#include + +namespace ortc +{ + namespace internal + { + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // RTPDecoderVideo (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPDecoderVideo + // + + class RTPDecoderVideo : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IRTPDecoderVideo, + public IRTPDecoderVideoForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate, + public IRTPDecoderAysncDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IRTPDecoderVideoForMediaEngine; + friend interaction IRTPDecoderAysncDelegate; + + typedef IRTP::RTPObjectID RTPObjectID; + typedef IRTP::States States; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderVideo); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderVideo, UseMediaEngine); + + public: + RTPDecoderVideo( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + protected: + RTPDecoderVideo(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + traceHelper_(id_) + {} + + void init() noexcept; + + public: + virtual ~RTPDecoderVideo() noexcept; + + static RTPDecoderVideoPtr create( + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + + static RTPDecoderVideoPtr convert(ForMediaEnginePtr object) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTP + // + + RTPObjectID getID() const noexcept override { return id_; } + void cancel() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoder + // + + void notifyRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept override; + void notifyRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept override; + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderVideo + // + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPForMediaEngine + // + + // (duplicate) virtual RTPObjectID getID() const = 0; + void shutdown() noexcept override; + + // (duplciate) virtual States getState() const override; + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderVideoForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => IRTPDecoderAysncDelegate + // + + void onRTPDecoderRTPPacket( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) override; + void onRTPDecoderRTCPPacket( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) override; + + protected: + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => (internal) + // + + bool isPending() const noexcept { return IRTP::State_Pending == currentState_; } + bool isReady() const noexcept { return IRTP::State_Ready == currentState_; } + bool isShuttingDown() const noexcept { return IRTP::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IRTP::State_Shutdown == currentState_; } + + void innerCancel() noexcept; + + bool stepShutdownPendingPromise() noexcept; + bool stepShutdownCoder() noexcept; + + void step() noexcept; + bool stepSetup() noexcept; + bool stepResolve() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + void innerNotifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept {} // ignored + void innerNotifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept; + + public: + + protected: + //----------------------------------------------------------------------- + // + // RTPDecoderVideo => (data) + // + + AutoPUID id_; + RTPDecoderVideoWeakPtr thisWeak_; + + RTPDecoderVideoPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + + States currentState_ {IRTP::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithRTPDecoderVideoPtr promise_; + ParametersPtr parameters_; + IRTPDecoderDelegateWeakPtr notifyDelegate_; + IRTPDecoderDelegatePtr delegate_; + + IRTPDecoderAysncDelegatePtr asyncThisDelegate_; + MediaChannelTraceHelper traceHelper_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPDecoderVideoFactory + // + + interaction IRTPDecoderVideoFactory + { + static IRTPDecoderVideoFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPDecoderVideo); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPDecoderVideo, UseMediaEngine); + + virtual RTPDecoderVideoPtr create( + PromiseWithRTPDecoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPDecoderDelegatePtr delegate + ) noexcept; + }; + + class RTPDecoderVideoFactory : public IFactory {}; + } +} + diff --git a/ortc/internal/ortc_RTPEncoderAudio.h b/ortc/internal/ortc_RTPEncoderAudio.h new file mode 100644 index 00000000..6db35c77 --- /dev/null +++ b/ortc/internal/ortc_RTPEncoderAudio.h @@ -0,0 +1,292 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include + +#include +#include +#include + +#include + +namespace ortc +{ + namespace internal + { + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // RTPEncoderAudio (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderAudio + // + + class RTPEncoderAudio : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IRTPEncoderAudio, + public IRTPEncoderAudioForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate, + public IRTPEncoderAysncDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IRTPEncoderAudioForMediaEngine; + friend interaction IRTPEncoderAysncDelegate; + + typedef IRTP::RTPObjectID RTPObjectID; + typedef IRTP::States States; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderAudio, UseMediaEngine); + + public: + RTPEncoderAudio( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + protected: + RTPEncoderAudio(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + traceHelper_(id_) + {} + + void init() noexcept; + + public: + virtual ~RTPEncoderAudio() noexcept; + + static RTPEncoderAudioPtr create( + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + static RTPEncoderAudioPtr convert(ForMediaEnginePtr object) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTP + // + + RTPObjectID getID() const noexcept override { return id_; } + void cancel() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoder + // + + void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override; + void notifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept override {} + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderAudio + // + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPForMediaEngine + // + + // (duplicate) virtual RTPObjectID getID() const = 0; + void shutdown() noexcept override; + + // (duplciate) virtual States getState() const override; + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderAudioForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => IRTPEncoderAysncDelegate + // + + void onRTPEncoderAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) override; + void onRTPEncoderVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) override {} // ignored + + protected: + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => (internal) + // + + bool isPending() const noexcept { return IRTP::State_Pending == currentState_; } + bool isReady() const noexcept { return IRTP::State_Ready == currentState_; } + bool isShuttingDown() const noexcept { return IRTP::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IRTP::State_Shutdown == currentState_; } + + void innerCancel() noexcept; + + bool stepShutdownPendingPromise() noexcept; + bool stepShutdownCoder() noexcept; + + void step() noexcept; + bool stepSetup() noexcept; + bool stepResolve() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + void innerNotifyRTP( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept; + void innerNotifyRTCP( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept; + + public: + + protected: + //----------------------------------------------------------------------- + // + // RTPEncoderAudio => (data) + // + + AutoPUID id_; + RTPEncoderAudioWeakPtr thisWeak_; + + RTPEncoderAudioPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + + States currentState_ {IRTP::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithRTPEncoderAudioPtr promise_; + ParametersPtr parameters_; + IRTPEncoderDelegateWeakPtr notifyDelegate_; + IRTPEncoderDelegatePtr delegate_; + + IRTPEncoderAysncDelegatePtr asyncThisDelegate_; + MediaChannelTraceHelper traceHelper_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderAudioFactory + // + + interaction IRTPEncoderAudioFactory + { + static IRTPEncoderAudioFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderAudio); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderAudio, UseMediaEngine); + + virtual RTPEncoderAudioPtr create( + PromiseWithRTPEncoderAudioPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + }; + + class RTPEncoderAudioFactory : public IFactory {}; + } +} + diff --git a/ortc/internal/ortc_RTPEncoderVideo.h b/ortc/internal/ortc_RTPEncoderVideo.h new file mode 100644 index 00000000..edb91c3a --- /dev/null +++ b/ortc/internal/ortc_RTPEncoderVideo.h @@ -0,0 +1,293 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#pragma once + +#include + +#include +#include + +#include +#include + +#include + +#include + +namespace ortc +{ + namespace internal + { + + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + //----------------------------------------------------------------------- + // + // RTPEncoderVideo (helpers) + // + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // RTPEncoderVideo + // + + class RTPEncoderVideo : public Any, + public Noop, + public MessageQueueAssociator, + public SharedRecursiveLock, + public IRTPEncoderVideo, + public IRTPEncoderVideoForMediaEngine, + public zsLib::IWakeDelegate, + public zsLib::IPromiseSettledDelegate, + public IRTPEncoderAysncDelegate + { + protected: + struct make_private {}; + + public: + friend interaction IRTPEncoderVideoForMediaEngine; + friend interaction IRTPEncoderAysncDelegate; + + typedef IRTP::RTPObjectID RTPObjectID; + typedef IRTP::States States; + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ImmutableMediaChannelTrace, ImmutableMediaChannelTrace); + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderVideo); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::AudioFrame, AudioFrame); + ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::VideoFrame, VideoFrame); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderVideo, UseMediaEngine); + + public: + RTPEncoderVideo( + const make_private &, + IMessageQueuePtr queue, + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + protected: + RTPEncoderVideo(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : + Noop(true), + MessageQueueAssociator(queue), + SharedRecursiveLock(SharedRecursiveLock::create()), + traceHelper_(id_) + {} + + void init() noexcept; + + public: + virtual ~RTPEncoderVideo() noexcept; + + static RTPEncoderVideoPtr create( + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + + static RTPEncoderVideoPtr convert(ForMediaEnginePtr object) noexcept; + + protected: + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTP + // + + RTPObjectID getID() const noexcept override { return id_; } + void cancel() noexcept override; + + States getState() const noexcept override; + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoder + // + + void notifyAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) noexcept override {} + void notifyVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) noexcept override; + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderVideo + // + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPForMediaEngine + // + + // (duplicate) virtual RTPObjectID getID() const = 0; + void shutdown() noexcept override; + + // (duplciate) virtual States getState() const override; + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderVideoForMediaEngine + // + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IWakeDelegate + // + + void onWake() override; + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IPromiseSettledDelegate + // + + void onPromiseSettled(PromisePtr promise) override; + + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => IRTPEncoderAysncDelegate + // + + void onRTPEncoderAudioFrame( + ImmutableMediaChannelTracePtr trace, + AudioFramePtr frame + ) override {} // ignored + void onRTPEncoderVideoFrame( + ImmutableMediaChannelTracePtr trace, + VideoFramePtr frame + ) override; + + protected: + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => (internal) + // + + bool isPending() const noexcept { return IRTP::State_Pending == currentState_; } + bool isReady() const noexcept { return IRTP::State_Ready == currentState_; } + bool isShuttingDown() const noexcept { return IRTP::State_ShuttingDown == currentState_; } + bool isShutdown() const noexcept { return IRTP::State_Shutdown == currentState_; } + + void innerCancel() noexcept; + + bool stepShutdownPendingPromise() noexcept; + bool stepShutdownCoder() noexcept; + + void step() noexcept; + bool stepSetup() noexcept; + bool stepResolve() noexcept; + + void setState(States state) noexcept; + void setError(PromisePtr promise) noexcept; + void setError(WORD error, const char *inReason) noexcept; + + void innerNotifyRTP( + ImmutableMediaChannelTracePtr trace, + RTPPacketPtr packet + ) noexcept; + void innerNotifyRTCP( + ImmutableMediaChannelTracePtr trace, + RTCPPacketPtr packet + ) noexcept; + + public: + + protected: + //----------------------------------------------------------------------- + // + // RTPEncoderVideo => (data) + // + + AutoPUID id_; + RTPEncoderVideoWeakPtr thisWeak_; + + RTPEncoderVideoPtr gracefulShutdownReference_; + + UseMediaEngineWeakPtr mediaEngine_; + + States currentState_ {IRTP::State_Pending}; + WORD lastError_ {}; + String lastErrorReason_; + + PromiseWithRTPEncoderVideoPtr promise_; + ParametersPtr parameters_; + IRTPEncoderDelegateWeakPtr notifyDelegate_; + IRTPEncoderDelegatePtr delegate_; + + IRTPEncoderAysncDelegatePtr asyncThisDelegate_; + MediaChannelTraceHelper traceHelper_; + }; + + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // + // IRTPEncoderVideoFactory + // + + interaction IRTPEncoderVideoFactory + { + static IRTPEncoderVideoFactory &singleton() noexcept; + + ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWithHolderPtr, PromiseWithRTPEncoderVideo); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + + ZS_DECLARE_TYPEDEF_PTR(IMediaEngineForRTPEncoderVideo, UseMediaEngine); + + virtual RTPEncoderVideoPtr create( + PromiseWithRTPEncoderVideoPtr promise, + UseMediaEnginePtr mediaEngine, + ParametersPtr parameters, + IRTPEncoderDelegatePtr delegate + ) noexcept; + }; + + class RTPEncoderVideoFactory : public IFactory {}; + } +} + diff --git a/ortc/internal/ortc_RTPListener.h b/ortc/internal/ortc_RTPListener.h index 9e31f094..6ab679e2 100644 --- a/ortc/internal/ortc_RTPListener.h +++ b/ortc/internal/ortc_RTPListener.h @@ -56,126 +56,126 @@ namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPListener) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderForRTPListener) + ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPListener); + ZS_DECLARE_INTERACTION_PTR(IRTPSenderForRTPListener); - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSettings) - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPReceiver) - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPSender) + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSettings); + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSecureTransport); + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPReceiver); + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPSender); - ZS_DECLARE_INTERACTION_PROXY(IRTPListenerAsyncDelegate) + ZS_DECLARE_INTERACTION_PROXY(IRTPListenerAsyncDelegate); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerForSecureTransport - #pragma mark + // + // IRTPListenerForSecureTransport + // interaction IRTPListenerForSecureTransport { - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForSecureTransport, ForSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForSecureTransport, ForSecureTransport); - static ElementPtr toDebug(ForSecureTransportPtr listener); + static ElementPtr toDebug(ForSecureTransportPtr listener) noexcept; - static RTPListenerPtr create(IRTPTransportPtr transport); + static RTPListenerPtr create(IRTPTransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual bool handleRTPPacket( IICETypes::Components viaComponent, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerForRTPReceiver - #pragma mark + // + // IRTPListenerForRTPReceiver + // interaction IRTPListenerForRTPReceiver { - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForRTPReceiver, ForRTPReceiver) + ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForRTPReceiver, ForRTPReceiver); - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, UseReceiver) - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, UseReceiver); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); typedef std::list RTCPPacketList; - static ElementPtr toDebug(ForRTPReceiverPtr listener); + static ElementPtr toDebug(ForRTPReceiverPtr listener) noexcept; - static ForRTPReceiverPtr getListener(IRTPTransportPtr rtpTransport); + static ForRTPReceiverPtr getListener(IRTPTransportPtr rtpTransport) noexcept(false); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual void registerReceiver( Optional kind, UseReceiverPtr inReceiver, const Parameters &inParams, RTCPPacketList *outPacketList = NULL - ) = 0; + ) noexcept(false) = 0; // throws InvalidParameters - virtual void unregisterReceiver(UseReceiver &inReceiver) = 0; + virtual void unregisterReceiver(UseReceiver &inReceiver) noexcept = 0; - virtual void getPackets(RTCPPacketList &outPacketList) = 0; + virtual void getPackets(RTCPPacketList &outPacketList) noexcept = 0; virtual void notifyUnhandled( const String &muxID, const String &rid, IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerForRTPSender - #pragma mark + // + // IRTPListenerForRTPSender + // interaction IRTPListenerForRTPSender { - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForRTPSender, ForRTPSender) + ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForRTPSender, ForRTPSender); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPListener, UseSender) - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPListener, UseSender); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); typedef std::list RTCPPacketList; - static ElementPtr toDebug(ForRTPSenderPtr listener); + static ElementPtr toDebug(ForRTPSenderPtr listener) noexcept; - static ForRTPSenderPtr getListener(IRTPTransportPtr rtpTransport); + static ForRTPSenderPtr getListener(IRTPTransportPtr rtpTransport) noexcept(false); - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual void registerSender( UseSenderPtr inSender, const Parameters &inParams, RTCPPacketList &outPacketList - ) = 0; + ) noexcept = 0; - virtual void unregisterSender(UseSender &inSender) = 0; + virtual void unregisterSender(UseSender &inSender) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerAsyncDelegate - #pragma mark + // + // IRTPListenerAsyncDelegate + // interaction IRTPListenerAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, UseRTPReceiver) + ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, UseRTPReceiver); virtual void onDeliverPacket( IICETypes::Components viaComponent, @@ -188,9 +188,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener - #pragma mark + // + // RTPListener + // class RTPListener : public Noop, public MessageQueueAssociator, @@ -213,17 +213,17 @@ namespace ortc friend interaction IRTPListenerForRTPReceiver; friend interaction IRTPListenerForRTPSender; - ZS_DECLARE_STRUCT_PTR(TearAwayData) - ZS_DECLARE_STRUCT_PTR(RegisteredHeaderExtension) - ZS_DECLARE_STRUCT_PTR(ReceiverInfo) - ZS_DECLARE_STRUCT_PTR(SSRCInfo) - ZS_DECLARE_STRUCT_PTR(UnhandledEventInfo) + ZS_DECLARE_STRUCT_PTR(TearAwayData); + ZS_DECLARE_STRUCT_PTR(RegisteredHeaderExtension); + ZS_DECLARE_STRUCT_PTR(ReceiverInfo); + ZS_DECLARE_STRUCT_PTR(SSRCInfo); + ZS_DECLARE_STRUCT_PTR(UnhandledEventInfo); - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, UseRTPReceiver) - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPListener, UseRTPSender) - ZS_DECLARE_TYPEDEF_PTR(IRTPTransport, UseRTPTransport) - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPListener, UseSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, UseRTPReceiver); + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPListener, UseRTPSender); + ZS_DECLARE_TYPEDEF_PTR(IRTPTransport, UseRTPTransport); + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForRTPListener, UseSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); typedef std::list RTCPPacketList; @@ -241,9 +241,9 @@ namespace ortc typedef size_t ReferenceCount; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::RegisteredHeaderExtension - #pragma mark + // + // RTPListener::RegisteredHeaderExtension + // struct RegisteredHeaderExtension { @@ -255,7 +255,7 @@ namespace ortc ReferenceMap mReferences; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map HeaderExtensionMap; @@ -266,9 +266,9 @@ namespace ortc typedef ObjectID SenderID; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::ReceiverInfo - #pragma mark + // + // RTPListener::ReceiverInfo + // struct ReceiverInfo { @@ -282,21 +282,21 @@ namespace ortc SSRCMap mRegisteredSSRCs; - SSRCInfoPtr registerSSRCUsage(SSRCInfoPtr ssrcInfo); - void unregisterSSRCUsage(SSRCType ssrc); + SSRCInfoPtr registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept; + void unregisterSSRCUsage(SSRCType ssrc) noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map ReceiverObjectMap; typedef std::map SenderObjectMap; - ZS_DECLARE_PTR(ReceiverObjectMap) - ZS_DECLARE_PTR(SenderObjectMap) + ZS_DECLARE_PTR(ReceiverObjectMap); + ZS_DECLARE_PTR(SenderObjectMap); //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::SSRCInfo - #pragma mark + // + // RTPListener::SSRCInfo + // struct SSRCInfo { @@ -306,17 +306,17 @@ namespace ortc ReceiverInfoPtr mReceiverInfo; // can be NULL - SSRCInfo(); - ElementPtr toDebug() const; + SSRCInfo() noexcept; + ElementPtr toDebug() const noexcept; }; typedef String MuxID; typedef std::map MuxIDMap; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::UnhandledEventInfo - #pragma mark + // + // RTPListener::UnhandledEventInfo + // struct UnhandledEventInfo { @@ -325,9 +325,9 @@ namespace ortc String mMuxID; String mRID; - bool operator<(const UnhandledEventInfo &) const; + bool operator<(const UnhandledEventInfo &) const noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map UnhandledEventMap; @@ -339,7 +339,7 @@ namespace ortc State_ShuttingDown, State_Shutdown, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; public: RTPListener( @@ -347,147 +347,147 @@ namespace ortc IMessageQueuePtr queue, IRTPListenerDelegatePtr delegate, UseRTPTransportPtr transport - ); + ) noexcept; protected: - RTPListener(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : + RTPListener(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~RTPListener(); + virtual ~RTPListener() noexcept; - static RTPListenerPtr convert(IRTPListenerPtr object); - static RTPListenerPtr convert(ForSecureTransportPtr object); - static RTPListenerPtr convert(ForRTPReceiverPtr object); - static RTPListenerPtr convert(ForRTPSenderPtr object); + static RTPListenerPtr convert(IRTPListenerPtr object) noexcept; + static RTPListenerPtr convert(ForSecureTransportPtr object) noexcept; + static RTPListenerPtr convert(ForRTPReceiverPtr object) noexcept; + static RTPListenerPtr convert(ForRTPSenderPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListener - #pragma mark + // + // RTPListener => IRTPListener + // - static ElementPtr toDebug(RTPListenerPtr listener); + static ElementPtr toDebug(RTPListenerPtr listener) noexcept; static IRTPListenerPtr create( IRTPListenerDelegatePtr delegate, IRTPTransportPtr transport, Optional headerExtensions - ); + ) noexcept(false); - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr delegate) override; + IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr delegate) noexcept override; - virtual IRTPTransportPtr transport() const override; + IRTPTransportPtr transport() const noexcept override; - virtual void setHeaderExtensions(const HeaderExtensionParametersList &headerExtensions) override; + void setHeaderExtensions(const HeaderExtensionParametersList &headerExtensions) noexcept(false) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IStatsProvider - #pragma mark + // + // RTPListener => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerForSecureTransport - #pragma mark + // + // RTPListener => IRTPListenerForSecureTransport + // - // (duplciate) static ElementPtr toDebug(ForSecureTransportPtr transport); + // (duplciate) static ElementPtr toDebug(ForSecureTransportPtr transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - static RTPListenerPtr create(IRTPTransportPtr transport); + static RTPListenerPtr create(IRTPTransportPtr transport) noexcept; - virtual bool handleRTPPacket( - IICETypes::Components viaComponent, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleRTPPacket( + IICETypes::Components viaComponent, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerForRTPReceiver - #pragma mark + // + // RTPListener => IRTPListenerForRTPReceiver + // - // (duplicate) static ElementPtr toDebug(ForRTPReceiverPtr listener); + // (duplicate) static ElementPtr toDebug(ForRTPReceiverPtr listener) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual void registerReceiver( - Optional kind, - UseReceiverPtr inReceiver, - const Parameters &inParams, - RTCPPacketList *outPacketList = NULL - ) override; + void registerReceiver( + Optional kind, + UseReceiverPtr inReceiver, + const Parameters &inParams, + RTCPPacketList *outPacketList = NULL + ) noexcept(false) override; - virtual void unregisterReceiver(UseReceiver &inReceiver) override; + void unregisterReceiver(UseReceiver &inReceiver) noexcept override; - virtual void getPackets(RTCPPacketList &outPacketList) override; + void getPackets(RTCPPacketList &outPacketList) noexcept override; - virtual void notifyUnhandled( - const String &muxID, - const String &rid, - IRTPTypes::SSRCType ssrc, - IRTPTypes::PayloadType payloadType - ) override; + void notifyUnhandled( + const String &muxID, + const String &rid, + IRTPTypes::SSRCType ssrc, + IRTPTypes::PayloadType payloadType + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerForRTPSender - #pragma mark + // + // RTPListener => IRTPListenerForRTPSender + // - // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr listener); + // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr listener) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual void registerSender( - UseSenderPtr inSender, - const Parameters &inParams, - RTCPPacketList &outPacketList - ) override; + void registerSender( + UseSenderPtr inSender, + const Parameters &inParams, + RTCPPacketList &outPacketList + ) noexcept override; - virtual void unregisterSender(UseSender &inReceiver) override; + void unregisterSender(UseSender &inReceiver) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IWakeDelegate - #pragma mark + // + // RTPListener => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => ITimerDelegate - #pragma mark + // + // RTPListener => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => IRTPListenerAsyncDelegate - #pragma mark + // + // RTPListener => IRTPListenerAsyncDelegate + // - virtual void onDeliverPacket( - IICETypes::Components viaComponent, - UseRTPReceiverPtr receiver, - RTPPacketPtr packet - ) override; + void onDeliverPacket( + IICETypes::Components viaComponent, + UseRTPReceiverPtr receiver, + RTPPacketPtr packet + ) override; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener::TearAwayData - #pragma mark + // + // RTPListener::TearAwayData + // struct TearAwayData { @@ -497,95 +497,95 @@ namespace ortc protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => (internal) - #pragma mark + // + // RTPListener => (internal) + // - static Log::Params slog(const char *message); - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + static Log::Params slog(const char *message) noexcept; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - bool stepAttemptDelivery(); + void step() noexcept; + bool stepAttemptDelivery() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - void expireRTPPackets(); - void expireRTCPPackets(); + void expireRTPPackets() noexcept; + void expireRTCPPackets() noexcept; void registerHeaderExtensionReference( PUID objectID, HeaderExtensionURIs extensionURI, LocalID localID, bool encrytped - ); + ) noexcept(false); - void unregisterAllHeaderExtensionReferences(PUID objectID); + void unregisterAllHeaderExtensionReferences(PUID objectID) noexcept; bool findMapping( const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo, String &outMuxID - ); + ) noexcept; bool findMappingUsingMuxID( const String &muxID, const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo - ); + ) noexcept; bool findMappingUsingSSRCInEncodingParams( const String &muxID, const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo - ); + ) noexcept; bool findMappingUsingPayloadType( const String &muxID, const RTPPacket &rtpPacket, ReceiverInfoPtr &outReceiverInfo - ); + ) noexcept; String extractMuxID( const RTPPacket &rtpPacket, ReceiverInfoPtr &ioReceiverInfo - ); - String extractRID(const RTPPacket &rtpPacket); + ) noexcept; + String extractRID(const RTPPacket &rtpPacket) noexcept; bool fillMuxIDParameters( const String &muxID, ReceiverInfoPtr &ioReceiverInfo - ); + ) noexcept; - void setReceiverInfo(ReceiverInfoPtr receiverInfo); + void setReceiverInfo(ReceiverInfoPtr receiverInfo) noexcept; - void processByes(const RTCPPacket &rtcpPacket); - void processSDESMid(const RTCPPacket &rtcpPacket); - void processSenderReports(const RTCPPacket &rtcpPacket); + void processByes(const RTCPPacket &rtcpPacket) noexcept; + void processSDESMid(const RTCPPacket &rtcpPacket) noexcept; + void processSenderReports(const RTCPPacket &rtcpPacket) noexcept; void handleDeltaChanges( ReceiverInfoPtr replacementInfo, const EncodingParameters &existing, EncodingParameters &ioReplacement - ); + ) noexcept; - void unregisterEncoding(const EncodingParameters &existing); + void unregisterEncoding(const EncodingParameters &existing) noexcept; SSRCInfoPtr setSSRCUsage( SSRCType ssrc, String &ioMuxID, ReceiverInfoPtr &ioReceiverInfo - ); - void registerSSRCUsage(SSRCInfoPtr ssrcInfo); + ) noexcept; + void registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept; - void reattemptDelivery(); + void reattemptDelivery() noexcept; void processUnhandled( const String &muxID, @@ -593,13 +593,13 @@ namespace ortc IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType, const Time &tick - ); + ) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListener => (data) - #pragma mark + // + // RTPListener => (data) + // AutoPUID mID; RTPListenerWeakPtr mThisWeak; @@ -650,23 +650,23 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPListenerFactory - #pragma mark + // + // IRTPListenerFactory + // interaction IRTPListenerFactory { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionParametersList, HeaderExtensionParametersList) + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::HeaderExtensionParametersList, HeaderExtensionParametersList); - static IRTPListenerFactory &singleton(); + static IRTPListenerFactory &singleton() noexcept; virtual IRTPListenerPtr create( IRTPListenerDelegatePtr delegate, IRTPTransportPtr transport, Optional headerExtensions = Optional() - ); + ) noexcept(false); - virtual RTPListenerPtr create(IRTPTransportPtr transport); + virtual RTPListenerPtr create(IRTPTransportPtr transport) noexcept; }; class RTPListenerFactory : public IFactory {}; @@ -676,8 +676,8 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPListenerAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICETypes::Components, Components) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPListenerAsyncDelegate::UseRTPReceiverPtr, UseRTPReceiverPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) -ZS_DECLARE_PROXY_METHOD_3(onDeliverPacket, Components, UseRTPReceiverPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onDeliverPacket, Components, UseRTPReceiverPtr, RTPPacketPtr) ZS_DECLARE_PROXY_END() @@ -691,9 +691,9 @@ ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::IRTPListenerSubscriptionPtr, IRTPListenerSubs ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::IRTPListenerDelegatePtr, IRTPListenerDelegatePtr) ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::IRTPTransportPtr, IRTPTransportPtr) ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::IRTPTypes::HeaderExtensionParametersList, HeaderExtensionParametersList) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_1(getStats, PromiseWithStatsReportPtr, const StatsTypeSet &) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(getID, PUID) -ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_1(subscribe, IRTPListenerSubscriptionPtr, IRTPListenerDelegatePtr) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(transport, IRTPTransportPtr) -ZS_DECLARE_TEAR_AWAY_METHOD_1(setHeaderExtensions, const HeaderExtensionParametersList &) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(getStats, PromiseWithStatsReportPtr, const StatsTypeSet &) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(getID, PUID) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN(subscribe, IRTPListenerSubscriptionPtr, IRTPListenerDelegatePtr) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(transport, IRTPTransportPtr) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC_THROWS(setHeaderExtensions, const HeaderExtensionParametersList &) ZS_DECLARE_TEAR_AWAY_END() diff --git a/ortc/internal/ortc_RTPMediaEngine.h b/ortc/internal/ortc_RTPMediaEngine.h deleted file mode 100644 index b6340de0..00000000 --- a/ortc/internal/ortc_RTPMediaEngine.h +++ /dev/null @@ -1,2045 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "webrtc/base/scoped_ptr.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" - -namespace ortc -{ - namespace internal - { - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineRegistration); - - // resource based interfaces - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineDeviceResource); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineChannelResource); - ZS_DECLARE_INTERACTION_PROXY(IRTPMediaEngineDeviceResourceAsyncDelegate); - ZS_DECLARE_INTERACTION_PTR(IDeviceResourceForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PROXY(IRTPMediaEngineChannelResourceAsyncDelegate); - ZS_DECLARE_INTERACTION_PTR(IChannelResourceForRTPMediaEngine); - - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForORTC); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForSettings); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForSingleton); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPReceiverChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPReceiverChannelAudio); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPReceiverChannelVideo); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPSenderChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPSenderChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPSenderChannelAudio); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForRTPSenderChannelVideo); - ZS_DECLARE_INTERACTION_PTR(IRTPMediaEngineForMediaStreamTrack); - - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelMediaBaseForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelAudioForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelVideoForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelAudioForRTPMediaEngine); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelVideoForRTPMediaEngine); - - ZS_DECLARE_INTERACTION_PROXY(IRTPMediaEngineAsyncDelegate); - ZS_DECLARE_INTERACTION_PROXY(IRTPMediaEngineHandlePacketAsyncDelegate); - - ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith, PromiseWithRTPMediaEngine); - ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith, PromiseWithRTPMediaEngineDeviceResource); - ZS_DECLARE_TYPEDEF_PTR(zsLib::PromiseWith, PromiseWithRTPMediaEngineChannelResource); - - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrack::TrackConstraints, TrackConstraints); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrack::Settings, TrackSettings); - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark VoiceEngineDeleter - #pragma mark - - struct VoiceEngineDeleter { - VoiceEngineDeleter() {} - inline void operator()(webrtc::VoiceEngine* ptr) const { - webrtc::VoiceEngine::Delete(ptr); - } - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineRegistration - #pragma mark - - interaction IRTPMediaEngineRegistration : public Any - { - template - std::shared_ptr engine() const {return ZS_DYNAMIC_PTR_CAST(data_type, getRTPEngine());} - - virtual RTPMediaEnginePtr getRTPEngine() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineDeviceResource - #pragma mark - - interaction IRTPMediaEngineDeviceResource : public Any - { - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - virtual PUID getID() const = 0; - virtual String getDeviceID() const = 0; - - virtual PromisePtr shutdown() = 0; - - virtual void stop() = 0; - - virtual void updateConstraints(PromisePtr promise, TrackConstraintsPtr constraints) = 0; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) = 0; - - virtual void setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) = 0; - - virtual void renderVideoFrame(VideoFramePtr videoFrame) = 0; - - virtual void setFrameCount() = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineChannelResource - #pragma mark - - interaction IRTPMediaEngineChannelResource : public Any - { - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - virtual PUID getID() const = 0; - - virtual PromisePtr shutdown() = 0; - - virtual void notifyTransportState(ISecureTransportTypes::States state) = 0; - - virtual void notifyUpdate(ParametersPtr params) = 0; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineDeviceResourceAsyncDelegate - #pragma mark - - interaction IRTPMediaEngineDeviceResourceAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrack::TrackConstraints, TrackConstraints); - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - virtual void onUpdateConstraints(PromisePtr promise, TrackConstraintsPtr constraints) = 0; - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) = 0; - virtual void onCapturedVideoFrame(VideoFramePtr frame) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IDeviceResourceForRTPMediaEngine - #pragma mark - - interaction IDeviceResourceForRTPMediaEngine - { - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - interaction IRTPMediaEngineChannelResourceAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - virtual void onSecureTransportState(ISecureTransport::States state) = 0; - virtual void onUpdate(ParametersPtr params) = 0; - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) = 0; - virtual void onSendDTMFTone() = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IChannelResourceForRTPMediaEngine - #pragma mark - - interaction IChannelResourceForRTPMediaEngine - { - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineAudioReceiverChannelResource - #pragma mark - - interaction IRTPMediaEngineAudioReceiverChannelResource : public IRTPMediaEngineChannelResource - { - virtual bool handlePacket(const RTPPacket &packet) = 0; - virtual bool handlePacket(const RTCPPacket &packet) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineAudioSenderChannelResource - #pragma mark - - interaction IRTPMediaEngineAudioSenderChannelResource : public IRTPMediaEngineChannelResource - { - virtual bool handlePacket(const RTCPPacket &packet) = 0; - - virtual void insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) = 0; - - virtual String toneBuffer() const = 0; - virtual Milliseconds duration() const = 0; - virtual Milliseconds interToneGap() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineVideoReceiverChannelResource - #pragma mark - - interaction IRTPMediaEngineVideoReceiverChannelResource : public IRTPMediaEngineChannelResource - { - virtual bool handlePacket(const RTPPacket &packet) = 0; - virtual bool handlePacket(const RTCPPacket &packet) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineVideoSenderChannelResource - #pragma mark - - interaction IRTPMediaEngineVideoSenderChannelResource : public IRTPMediaEngineChannelResource - { - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - virtual bool handlePacket(const RTCPPacket &packet) = 0; - virtual void sendVideoFrame(VideoFramePtr videoFrame) = 0; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForORTC - #pragma mark - - interaction IRTPMediaEngineForORTC - { - static void setLogLevel(Log::Level level); - static void ntpServerTime(const Milliseconds &value); - static void startMediaTracing(); - static void stopMediaTracing(); - static bool isMediaTracing(); - static bool saveMediaTrace(String filename); - static bool saveMediaTrace(String host, int port); - static bool isMRPInstalled(); - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForSettings - #pragma mark - - interaction IRTPMediaEngineForSettings - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForSettings, ForSettings) - - static void applyDefaults(); - - virtual ~IRTPMediaEngineForSettings() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForSingleton - #pragma mark - - interaction IRTPMediaEngineForSingleton - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForSingleton, ForSingleton) - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPReceiverChannel - #pragma mark - - interaction IRTPMediaEngineForRTPReceiverChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPReceiverChannel, ForRTPReceiverChannel) - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPReceiverChannelMediaBase - #pragma mark - - interaction IRTPMediaEngineForRTPReceiverChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPReceiverChannelMediaBase, ForRTPReceiverChannelMediaBase) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPMediaEngine, UseReceiverChannelMediaBase) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPMediaEngine, UseMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(webrtc::Transport, Transport) - - ElementPtr toDebug(ForRTPReceiverChannelMediaBasePtr object); - - static PromiseWithRTPMediaEnginePtr create(); - - static PromiseWithRTPMediaEngineChannelResourcePtr setupChannel( - UseReceiverChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPReceiverChannelAudio - #pragma mark - - interaction IRTPMediaEngineForRTPReceiverChannelAudio : public IRTPMediaEngineForRTPReceiverChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPReceiverChannelAudio, ForRTPReceiverChannelAudio) - - virtual ~IRTPMediaEngineForRTPReceiverChannelAudio() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPReceiverChannelVideo - #pragma mark - - interaction IRTPMediaEngineForRTPReceiverChannelVideo : public IRTPMediaEngineForRTPReceiverChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPReceiverChannelVideo, ForRTPReceiverChannelVideo) - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPSenderChannel - #pragma mark - - interaction IRTPMediaEngineForRTPSenderChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPSenderChannel, ForRTPSenderChannel) - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPSenderChannelMediaBase - #pragma mark - - interaction IRTPMediaEngineForRTPSenderChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPSenderChannelMediaBase, ForRTPSenderChannelMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPMediaEngine, UseSenderChannelMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPMediaEngine, UseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(webrtc::Transport, Transport); - - ElementPtr toDebug(ForRTPSenderChannelMediaBasePtr object); - - static PromiseWithRTPMediaEnginePtr create(); - - static PromiseWithRTPMediaEngineChannelResourcePtr setupChannel( - UseSenderChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPSenderChannelAudio - #pragma mark - - interaction IRTPMediaEngineForRTPSenderChannelAudio : public IRTPMediaEngineForRTPSenderChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPSenderChannelAudio, ForRTPSenderChannelAudio) - - virtual ~IRTPMediaEngineForRTPSenderChannelAudio() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForRTPSenderChannelVideo - #pragma mark - - interaction IRTPMediaEngineForRTPSenderChannelVideo : public IRTPMediaEngineForRTPSenderChannelMediaBase - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPSenderChannelVideo, ForRTPSenderChannelVideo) - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForMediaStreamTrack - #pragma mark - - interaction IRTPMediaEngineForMediaStreamTrack - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForMediaStreamTrack, ForMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPMediaEngine, UseMediaStreamTrack) - - ElementPtr toDebug(ForMediaStreamTrackPtr object); - - static PromiseWithRTPMediaEnginePtr create(); - - static PromiseWithRTPMediaEngineDeviceResourcePtr setupDevice(UseMediaStreamTrackPtr track); - - virtual ~IRTPMediaEngineForMediaStreamTrack() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForDeviceResource - #pragma mark - - interaction IRTPMediaEngineForDeviceResource - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForDeviceResource, ForDeviceResource) - - virtual void notifyResourceGone(IDeviceResourceForRTPMediaEngine &resource) = 0; - - virtual webrtc::VoiceEngine *getVoiceEngine() = 0; - virtual const SharedRecursiveLock &getSharedLock() const = 0; - virtual IMessageQueuePtr getMessageQueue() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineForChannelResource - #pragma mark - - interaction IRTPMediaEngineForChannelResource - { - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForChannelResource, ForChannelResource) - - virtual void notifyResourceGone(IChannelResourceForRTPMediaEngine &resource) = 0; - - virtual webrtc::VoiceEngine *getVoiceEngine() = 0; - virtual rtc::scoped_refptr getAudioState() = 0; - virtual const SharedRecursiveLock &getSharedLock() const = 0; - virtual IMessageQueuePtr getMessageQueue() const = 0; - }; - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineAsyncDelegate - #pragma mark - - interaction IRTPMediaEngineAsyncDelegate - { - ZS_DECLARE_STRUCT_PTR(SetupSenderChannel); - ZS_DECLARE_STRUCT_PTR(SetupReceiverChannel); - ZS_DECLARE_STRUCT_PTR(SetupDevice); - - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPMediaEngine, UseReceiverChannelMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPMediaEngine, UseSenderChannelMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPMediaEngine, UseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(webrtc::Transport, Transport); - - struct SetupResource - { - IRTPMediaEngineRegistrationPtr mRegistration; - }; - - struct SetupChannel : public SetupResource - { - PromiseWithRTPMediaEngineChannelResourcePtr mPromise; - TransportPtr mTransport; - UseMediaStreamTrackPtr mTrack; - ParametersPtr mParameters; - }; - - struct SetupSenderChannel : public SetupChannel - { - UseSenderChannelMediaBasePtr mChannel; - IDTMFSenderDelegatePtr mDTMFDelegate; - }; - - struct SetupReceiverChannel : public SetupChannel - { - UseReceiverChannelMediaBasePtr mChannel; - RTPPacketPtr mPacket; - }; - - struct SetupDevice : public SetupResource - { - PromiseWithRTPMediaEngineDeviceResourcePtr mPromise; - UseMediaStreamTrackPtr mTrack; - }; - - virtual void onSetupSenderChannel(SetupSenderChannelPtr channel) = 0; - virtual void onSetupReceiverChannel(SetupReceiverChannelPtr channel) = 0; - virtual void onSetupDevice(SetupDevicePtr device) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - interaction IRTPMediaEngineHandlePacketAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - virtual void onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) = 0; - virtual void onHandleRTCPPacket(SecureByteBlockPtr buffer) = 0; - virtual void onSendVideoFrame(VideoFramePtr videoFrame) = 0; - }; - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine - #pragma mark - - class RTPMediaEngine : public Any, - public Noop, - public MessageQueueAssociator, - public SharedRecursiveLock, - public IRTPMediaEngineForORTC, - public IRTPMediaEngineForSettings, - public IRTPMediaEngineForSingleton, - public IRTPMediaEngineForRTPReceiverChannel, - public IRTPMediaEngineForRTPReceiverChannelAudio, - public IRTPMediaEngineForRTPReceiverChannelVideo, - public IRTPMediaEngineForRTPSenderChannel, - public IRTPMediaEngineForRTPSenderChannelAudio, - public IRTPMediaEngineForRTPSenderChannelVideo, - public IRTPMediaEngineForMediaStreamTrack, - public IRTPMediaEngineForDeviceResource, - public IRTPMediaEngineForChannelResource, - public IWakeDelegate, - public zsLib::ITimerDelegate, - public IRTPMediaEngineAsyncDelegate - { - protected: - struct make_private {}; - - public: - friend class RTPMediaEngineRegistration; - - friend interaction IRTPMediaEngine; - friend interaction IRTPMediaEngineFactory; - friend interaction IRTPMediaEngineForORTC; - friend interaction IRTPMediaEngineForSettings; - friend interaction IRTPMediaEngineForSingleton; - friend interaction IRTPMediaEngineForRTPReceiverChannel; - friend interaction IRTPMediaEngineForRTPReceiverChannelMediaBase; - friend interaction IRTPMediaEngineForRTPReceiverChannelAudio; - friend interaction IRTPMediaEngineForRTPReceiverChannelVideo; - friend interaction IRTPMediaEngineForRTPSenderChannel; - friend interaction IRTPMediaEngineForRTPSenderChannelMediaBase; - friend interaction IRTPMediaEngineForRTPSenderChannelAudio; - friend interaction IRTPMediaEngineForRTPSenderChannelVideo; - friend interaction IRTPMediaEngineForMediaStreamTrack; - friend interaction IRTPMediaEngineForDeviceResource; - friend interaction IRTPMediaEngineForChannelResource; - - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPMediaEngine, UseReceiverChannelMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPMediaEngine, UseSenderChannelMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPMediaEngine, UseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(webrtc::Transport, Transport); - - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ConstraintSet, ConstraintSet); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ConstrainLongRange, ConstrainLongRange); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::ConstrainDoubleRange, ConstrainDoubleRange); - - ZS_DECLARE_CLASS_PTR(BaseResource); - ZS_DECLARE_CLASS_PTR(DeviceResource); - ZS_DECLARE_CLASS_PTR(ChannelResource); - ZS_DECLARE_CLASS_PTR(AudioReceiverChannelResource); - ZS_DECLARE_CLASS_PTR(AudioSenderChannelResource); - ZS_DECLARE_CLASS_PTR(VideoReceiverChannelResource); - ZS_DECLARE_CLASS_PTR(VideoSenderChannelResource); - - struct VideoCaptureCapabilityWithDistance - { - webrtc::VideoCaptureCapability mCapability; - FLOAT mDistance; - }; - - enum States - { - State_Pending, - State_Ready, - State_ShuttingDown, - State_Shutdown, - }; - static const char *toString(States state); - - ZS_DECLARE_TYPEDEF_PTR(std::list, PromiseWithRTPMediaEngineList) - - typedef std::map DeviceResourceWeakMap; - typedef std::list DeviceResourceList; - typedef std::map ChannelResourceWeakMap; - typedef std::list ChannelResourceList; - - public: - RTPMediaEngine( - const make_private &, - IMessageQueuePtr queue, - IRTPMediaEngineRegistrationPtr registration - ); - - protected: - RTPMediaEngine(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : - Noop(true), - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()) - {} - - void init(); - - public: - virtual ~RTPMediaEngine(); - - static RTPMediaEnginePtr convert(ForSettingsPtr object); - static RTPMediaEnginePtr convert(ForRTPReceiverChannelPtr object); - static RTPMediaEnginePtr convert(ForRTPReceiverChannelMediaBasePtr object); - static RTPMediaEnginePtr convert(ForRTPReceiverChannelAudioPtr object); - static RTPMediaEnginePtr convert(ForRTPReceiverChannelVideoPtr object); - static RTPMediaEnginePtr convert(ForRTPSenderChannelMediaBasePtr object); - static RTPMediaEnginePtr convert(ForRTPSenderChannelAudioPtr object); - static RTPMediaEnginePtr convert(ForRTPSenderChannelVideoPtr object); - static RTPMediaEnginePtr convert(ForMediaStreamTrackPtr object); - static RTPMediaEnginePtr convert(ForDeviceResourcePtr object); - static RTPMediaEnginePtr convert(ForChannelResourcePtr object); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => RTPMediaEngineRegistration - #pragma mark - - static PromiseWithRTPMediaEnginePtr createEnginePromise(); - - static RTPMediaEnginePtr create(IRTPMediaEngineRegistrationPtr registration); - - void notify(PromiseWithRTPMediaEnginePtr promise); - - void shutdown(); - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForORTC - #pragma mark - - static void ntpServerTime(const Milliseconds &value); - static void setLogLevel(Log::Level level); - static void startMediaTracing(); - static void stopMediaTracing(); - static bool isMediaTracing(); - static bool saveMediaTrace(String filename); - static bool saveMediaTrace(String host, int port); - static bool isMRPInstalled(); - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannel - #pragma mark - - virtual PUID getID() const override {return mID;} - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannelMediaBase - #pragma mark - - PromiseWithRTPMediaEngineChannelResourcePtr setupChannel( - UseReceiverChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannelAudio - #pragma mark - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPReceiverChannelVideo - #pragma mark - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannel - #pragma mark - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannelMediaBase - #pragma mark - - PromiseWithRTPMediaEngineChannelResourcePtr setupChannel( - UseSenderChannelMediaBasePtr channel, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannelAudio - #pragma mark - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForRTPSenderChannelVideo - #pragma mark - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForMediaStreamTrack - #pragma mark - - PromiseWithRTPMediaEngineDeviceResourcePtr setupDevice(UseMediaStreamTrackPtr track); - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForDeviceResource - #pragma mark - - virtual void notifyResourceGone(IDeviceResourceForRTPMediaEngine &resource) override; - - virtual webrtc::VoiceEngine *getVoiceEngine() override; - - virtual const SharedRecursiveLock &getSharedLock() const override { return *this; } - virtual IMessageQueuePtr getMessageQueue() const override { return getAssociatedMessageQueue(); } - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineForChannelResource - #pragma mark - - virtual void notifyResourceGone(IChannelResourceForRTPMediaEngine &resource) override; - - // (duplicate) virtual webrtc::VoiceEngine *getVoiceEngine() = 0; - - virtual rtc::scoped_refptr getAudioState() override; - - // (duplicate) virtual const SharedRecursiveLock &getSharedLock() const = 0; - // (duplicate) virtual IMessageQueuePtr getMessageQueue() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IWakeDelegate - #pragma mark - - virtual void onWake() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => ITimerDelegate - #pragma mark - - virtual void onTimer(ITimerPtr timer) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => IRTPMediaEngineAsyncDelegate - #pragma mark - - virtual void onSetupSenderChannel(SetupSenderChannelPtr setup) override; - virtual void onSetupReceiverChannel(SetupReceiverChannelPtr setup) override; - virtual void onSetupDevice(SetupDevicePtr setup) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (friend DeviceResource) - #pragma mark - - void shutdownDeviceResource(DeviceResourcePtr deviceResource); - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => webrtc::SetupEventTracer - #pragma mark - -#if defined(WINRT) - static const unsigned char *GetCategoryGroupEnabled(const char *categoryGroup); - - static void __cdecl AddTraceEvent( - char phase, - const unsigned char *categoryGroupEnabled, - const char *name, - uint64 id, - int numArgs, - const char **argNames, - const unsigned char *argTypes, - const uint64 *argValues, - unsigned char flags - ); -#endif - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (friend ChannelResource) - #pragma mark - - void shutdownChannelResource(ChannelResourcePtr channelResource); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - virtual void internalSetLogLevel(Log::Level level); - virtual void internalStartMediaTracing(); - virtual void internalStopMediaTracing(); - virtual bool internalIsMediaTracing(); - virtual bool internalSaveMediaTrace(String filename); - virtual bool internalSaveMediaTrace(String host, int port); - virtual void internalAddTraceEvent( - char phase, - const unsigned char *categoryGroupEnabled, - const char *name, - uint64_t id, - int numArgs, - const char **argNames, - const unsigned char *argTypes, - const uint64_t *argValues, - unsigned char flags - ); - virtual bool internalIsMRPInstalled(); - - bool isReady() const; - bool isShuttingDown() const; - bool isShutdown() const; - - void step(); - bool stepSetup(); - bool stepSetupDevices(); - bool stepCloseDevices(); - bool stepSetupChannels(); - bool stepCloseChannels(); - - void cancel(); - void stepCancel(); - - void setState(States state); - void setError(WORD error, const char *reason = NULL); - - public: - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::WebRtcTraceCallback - #pragma mark - - class WebRtcTraceCallback : public webrtc::TraceCallback - { - public: - virtual void Print(webrtc::TraceLevel level, const char* message, int length) override; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::WebRtcTraceCallback - #pragma mark - - class WebRtcLogSink : public rtc::LogSink - { - public: - virtual void OnLogMessage(const std::string& message) override; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::BaseResource - #pragma mark - - class BaseResource : public Any, - public SharedRecursiveLock, - public MessageQueueAssociator - { - protected: - struct make_private {}; - - public: - typedef std::list PendingPromiseList; - - ZS_DECLARE_STRUCT_PTR(LifetimeHolder); - - struct LifetimeHolder : public Any - { - BaseResourcePtr mResource; - - LifetimeHolder(BaseResourcePtr resource) : mResource(resource) {} - virtual ~LifetimeHolder() { if (!mResource) return; mResource->lifetimeHolderGone(); } - }; - - public: - BaseResource( - const make_private &, - IRTPMediaEngineRegistrationPtr registration, - RTPMediaEnginePtr engine - ); - virtual ~BaseResource(); - - void notifyPromisesResolve(); - void notifyPromisesReject(); - - //std::shared_ptr createPromise() { return internalSetupPromise(Promise::create(delegateQueue())); } - - //template - //static std::shared_ptr > createPromise() {return ZS_DYNAMIC_PTR_CAST(PromiseWith, internalSetupPromise(PromiseWith::create(delegateQueue())));} - - void registerPromise(PromisePtr promise) {internalSetupPromise(promise);} - - template - std::shared_ptr getThis() const {return ZS_DYNAMIC_PTR_CAST(self_type, mThisWeak.lock());} - - template - std::shared_ptr getEngine() const {return mMediaEngine.lock();} - - virtual void lifetimeHolderGone() {} - - protected: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::BaseResource => (internal) - #pragma mark - - static IMessageQueuePtr delegateQueue(); - PromisePtr internalSetupPromise(PromisePtr promise); - void internalFixState(); - - protected: - AutoPUID mID; - BaseResourceWeakPtr mThisWeak; - - bool mNotifiedReady {false}; - bool mNotifiedRejected {false}; - PendingPromiseList mPendingPromises; - - IRTPMediaEngineRegistrationPtr mRegistration; - RTPMediaEngineWeakPtr mMediaEngine; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource - #pragma mark - - class DeviceResource : public IRTPMediaEngineDeviceResource, - public BaseResource, - public IDeviceResourceForRTPMediaEngine, - public IRTPMediaEngineDeviceResourceAsyncDelegate - { - public: - ZS_DECLARE_CLASS_PTR(VideoCaptureTransport) - friend class VideoCaptureTransport; - - typedef std::list PromiseList; - - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackTypes::Kinds, Kinds) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForDeviceResource, UseEngine) - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet); - - struct AutoIncrementLock - { - AutoIncrementLock(std::atomic &accessFromNonLockedMethods) : mAccessFromNonLockedMethods(accessFromNonLockedMethods) { ++mAccessFromNonLockedMethods; } - ~AutoIncrementLock() { --mAccessFromNonLockedMethods; } - - std::atomic &mAccessFromNonLockedMethods; - }; - - public: - DeviceResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration, - UseMediaStreamTrackPtr track - ); - virtual ~DeviceResource(); - - static DeviceResourcePtr create( - IRTPMediaEngineRegistrationPtr registration, - UseMediaStreamTrackPtr track - ); - - virtual void lifetimeHolderGone() override; - - protected: - void init(); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => IRTPMediaEngineDeviceResource - #pragma mark - - virtual PUID getID() const override { return mID; } - virtual String getDeviceID() const override; - virtual PromisePtr shutdown() override; - virtual void stop() override; - virtual void updateConstraints(PromisePtr promise, TrackConstraintsPtr constraints) override; - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; - - virtual void setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) override; - - virtual void renderVideoFrame(VideoFramePtr videoFrame) override; - - virtual void setFrameCount() override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => IRTPMediaEngineDeviceResourceAsyncDelegate - #pragma mark - - virtual void onUpdateConstraints(PromisePtr promise, TrackConstraintsPtr constraints) override; - - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; - - virtual void onCapturedVideoFrame(VideoFramePtr frame) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => (friend RTPMediaEngine) - #pragma mark - - virtual void stepSetup(); - virtual void stepShutdown(); - - protected: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => (internal friend derived) - #pragma mark - - bool isShuttingDown() const { return mShuttingDown; } - bool isShutdown() const { return mShutdown; } - void notifyPromisesShutdown(); - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => friend VideoCaptureTransport - #pragma mark - - virtual void OnIncomingCapturedFrame(const int32_t id, const webrtc::VideoFrame& videoFrame); - - virtual void OnCaptureDelayChanged(const int32_t id, const int32_t delay); - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource::VideoCaptureTransport - #pragma mark - - class VideoCaptureTransport : public webrtc::VideoCaptureDataCallback - { - struct make_private {}; - - protected: - void init(); - - public: - VideoCaptureTransport( - const make_private &, - DeviceResourcePtr outer - ); - - ~VideoCaptureTransport(); - - static VideoCaptureTransportPtr create(DeviceResourcePtr outer); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource::Transport => webrtc::VideoCaptureDataCallback - #pragma mark - - virtual void OnIncomingCapturedFrame(const int32_t id, const webrtc::VideoFrame& videoFrame) override; - - virtual void OnCaptureDelayChanged(const int32_t id, const int32_t delay) override; - - private: - VideoCaptureTransportWeakPtr mThisWeak; - DeviceResourceWeakPtr mOuter; - }; - - protected: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::DeviceResource => (internal) - #pragma mark - - PromisePtr getShutdownPromise(); - - int getAudioDeviceIndex(webrtc::VoiceEngine *voiceEngine, String deviceID); - - FLOAT calculateSizeDistance( - ConstrainLongRange width, - ConstrainLongRange height, - webrtc::VideoCaptureCapability capability - ); - FLOAT calculateFrameRateDistance( - ConstrainDoubleRange frameRate, - webrtc::VideoCaptureCapability capability - ); - FLOAT calculateAspectRatioDistance( - ConstrainDoubleRange aspectRatio, - webrtc::VideoCaptureCapability capability - ); - FLOAT calculateFormatDistance(webrtc::VideoCaptureCapability capability); - - protected: - String mDeviceID; - - bool mShuttingDown {false}; - bool mShutdown {false}; - PromiseList mShutdownPromises; - - IMessageQueuePtr mHandleDataQueue; - std::atomic mAccessFromNonLockedMethods {}; - std::atomic mDenyNonLockedAccess {}; - - UseMediaStreamTrackWeakPtr mTrack; - - VideoCaptureTransportPtr mTransport; // keep lifetime of webrtc callback separate from this object - - webrtc::VideoCaptureModule* mVideoCaptureModule {NULL}; - webrtc::VideoRenderCallback* mVideoRendererCallback {NULL}; - IMediaStreamTrackRenderCallbackPtr mVideoRenderCallbackReferenceHolder; - - std::atomic mFramesSent {}; - std::atomic mFramesReceived {}; - WeightedMovingAverageUsingTotalDouble mAverageFramesSent; - WeightedMovingAverageUsingTotalDouble mAverageFramesReceived; - }; - - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource - #pragma mark - - class ChannelResource : public BaseResource, - public IRTPMediaEngineHandlePacketAsyncDelegate, - public IChannelResourceForRTPMediaEngine, - public IRTPMediaEngineChannelResourceAsyncDelegate - { - public: - typedef std::list PromiseList; - - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForChannelResource, UseEngine); - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet); - - struct AutoIncrementLock - { - AutoIncrementLock(std::atomic &accessFromNonLockedMethods) : mAccessFromNonLockedMethods(accessFromNonLockedMethods) { ++mAccessFromNonLockedMethods; } - ~AutoIncrementLock() { --mAccessFromNonLockedMethods; } - - std::atomic &mAccessFromNonLockedMethods; - }; - - public: - ChannelResource( - const make_private &priv, - IRTPMediaEngineRegistrationPtr registration - ); - - virtual ~ChannelResource(); - - virtual void lifetimeHolderGone() override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - virtual PUID getID() const override { return mID; } - virtual PromisePtr shutdown(); - virtual void notifyTransportState(ISecureTransportTypes::States state); - virtual void notifyUpdate(ParametersPtr params); - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats); - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - virtual void onSendDTMFTone() override { } - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => (friend RTPMediaEngine) - #pragma mark - - virtual void stepSetup() = 0; - virtual void stepShutdown() = 0; - - protected: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => (internal friend derived) - #pragma mark - - bool isShuttingDown() const {return mShuttingDown;} - bool isShutdown() const {return mShutdown;} - void notifyPromisesShutdown(); - - protected: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::ChannelResource => (internal) - #pragma mark - - PromisePtr getShutdownPromise(); - - protected: - String mCodecPayloadName; - BYTE mCodecPayloadType {0}; - UINT mCurrentTargetBitrate {0}; - - rtc::scoped_ptr mModuleProcessThread; - rtc::scoped_ptr mPacerThread; - webrtc::Clock *mClock; - webrtc::VieRemb mRemb; - rtc::scoped_ptr mCallStats; - rtc::scoped_ptr mCongestionController; - rtc::scoped_ptr mBitrateAllocator; - - bool mShuttingDown {false}; - bool mShutdown {false}; - PromiseList mShutdownPromises; - - IMessageQueuePtr mHandlePacketQueue; - std::atomic mAccessFromNonLockedMethods {}; - std::atomic mDenyNonLockedAccess {}; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource - #pragma mark - - class AudioReceiverChannelResource : public IRTPMediaEngineAudioReceiverChannelResource, - public ChannelResource, - public webrtc::BitrateObserver - { - public: - friend class RTPMediaEngine; - - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - public: - AudioReceiverChannelResource( - const make_private &, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ); - virtual ~AudioReceiverChannelResource(); - - static AudioReceiverChannelResourcePtr create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ); - - protected: - void init(); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - virtual PUID getID() const override {return ChannelResource::getID();} - - virtual PromisePtr shutdown() override {return ChannelResource::shutdown();} - - virtual void notifyTransportState(ISecureTransportTypes::States state) override { return ChannelResource::notifyTransportState(state); } - - virtual void notifyUpdate(ParametersPtr params) override { return ChannelResource::notifyUpdate(params); } - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override { return ChannelResource::requestStats(promise, stats); } - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineAudioReceiverChannelResource - #pragma mark - - virtual bool handlePacket(const RTPPacket &packet) override; - virtual bool handlePacket(const RTCPPacket &packet) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - virtual void onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) override; - virtual void onHandleRTCPPacket(SecureByteBlockPtr buffer) override; - virtual void onSendVideoFrame(VideoFramePtr videoFrame) override {} - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => webrtc::BitrateObserver - #pragma mark - - virtual void OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) override; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => friend RTPMediaEngine - #pragma mark - - virtual void stepSetup() override; - virtual void stepShutdown() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioReceiverChannelResource => (internal) - #pragma mark - - int getChannel() const; - webrtc::CodecInst getAudioCodec( - webrtc::VoiceEngine *voiceEngine, - String payloadName - ); - - protected: - int mChannel {}; - - TransportPtr mTransport; - std::atomic mTransportState { ISecureTransport::State_Pending }; - - UseMediaStreamTrackWeakPtr mTrack; - - ParametersPtr mParameters; - - RTPPacketPtr mInitPacket; - - rtc::scoped_ptr mReceiveStream; - - int mDTMFPayloadType{ 0 }; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource - #pragma mark - - class AudioSenderChannelResource : public IRTPMediaEngineAudioSenderChannelResource, - public ChannelResource, - public zsLib::ITimerDelegate, - public webrtc::BitrateObserver - { - public: - friend class RTPMediaEngine; - - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - const int dtmfTwoSecondsDelayCode = -1; - const int dtmfTwoSecondInMs = 2000; - const char dtmfValidTones[22] = ",0123456789*#ABCDabcd"; - const char dtmfTonesTable[18] = ",0123456789*#ABCD"; - - public: - AudioSenderChannelResource( - const make_private &, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ); - virtual ~AudioSenderChannelResource(); - - static AudioSenderChannelResourcePtr create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - IDTMFSenderDelegatePtr dtmfDelegate - ); - - protected: - void init(); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - virtual PUID getID() const override {return ChannelResource::getID();} - - virtual PromisePtr shutdown() override {return ChannelResource::shutdown();} - - virtual void notifyTransportState(ISecureTransportTypes::States state) override { return ChannelResource::notifyTransportState(state); } - - virtual void notifyUpdate(ParametersPtr params) override { return ChannelResource::notifyUpdate(params); } - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override { return ChannelResource::requestStats(promise, stats); } - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; - - virtual void onSendDTMFTone() override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineAudioSenderChannelResource - #pragma mark - - virtual bool handlePacket(const RTCPPacket &packet) override; - - virtual void insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) override; - - virtual String toneBuffer() const override; - virtual Milliseconds duration() const override; - virtual Milliseconds interToneGap() const override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - virtual void onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) override {} - virtual void onHandleRTCPPacket(SecureByteBlockPtr buffer) override; - virtual void onSendVideoFrame(VideoFramePtr videoFrame) override {} - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => ITimerDelegate - #pragma mark - - virtual void onTimer(ITimerPtr timer) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => webrtc::BitrateObserver - #pragma mark - - virtual void OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) override; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => friend RTPMediaEngine - #pragma mark - - virtual void stepSetup() override; - virtual void stepShutdown() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::AudioSenderChannelResource => (internal) - #pragma mark - - webrtc::CodecInst getAudioCodec( - webrtc::VoiceEngine *voiceEngine, - String payloadName - ); - - void notifyToneEvent(const char *tone); - - protected: - int mChannel{}; - - TransportPtr mTransport; - std::atomic mTransportState { ISecureTransport::State_Pending }; - - UseMediaStreamTrackWeakPtr mTrack; - - ParametersPtr mParameters; - - String mSendCodecPayloadName; - BYTE mSendCodecPayloadType {0}; - - rtc::scoped_ptr mSendStream; - - int mDTMFPayloadType {0}; - IDTMFSenderDelegatePtr mDTMFSenderDelegate; - ITimerPtr mDTMFTimer; - String mDTMFTones; - Milliseconds mDTMFDuration; - Milliseconds mDTMFInterToneGap; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource - #pragma mark - - class VideoReceiverChannelResource : public IRTPMediaEngineVideoReceiverChannelResource, - public ChannelResource, - public webrtc::BitrateObserver - { - public: - friend class RTPMediaEngine; - - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - class ReceiverVideoRenderer : public webrtc::VideoRenderer - { - public: - void setMediaStreamTrack(UseMediaStreamTrackPtr videoTrack); - - virtual void RenderFrame( - const webrtc::VideoFrame &videoFrame, - int timeToRenderMs - ) override; - - virtual bool IsTextureSupported() const override; - - private: - UseMediaStreamTrackWeakPtr mVideoTrack; - }; - - public: - VideoReceiverChannelResource( - const make_private &, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ); - virtual ~VideoReceiverChannelResource(); - - static VideoReceiverChannelResourcePtr create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters, - RTPPacketPtr packet - ); - - protected: - void init(); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - virtual PUID getID() const override {return ChannelResource::getID();} - - virtual PromisePtr shutdown() override {return ChannelResource::shutdown();} - - virtual void notifyTransportState(ISecureTransportTypes::States state) override { return ChannelResource::notifyTransportState(state); } - - virtual void notifyUpdate(ParametersPtr params) override { return ChannelResource::notifyUpdate(params); } - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override { return ChannelResource::requestStats(promise, stats); } - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineVideoReceiverChannelResource - #pragma mark - - virtual bool handlePacket(const RTPPacket &packet) override; - virtual bool handlePacket(const RTCPPacket &packet) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - virtual void onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) override; - virtual void onHandleRTCPPacket(SecureByteBlockPtr buffer) override; - virtual void onSendVideoFrame(VideoFramePtr videoFrame) override {} - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => friend RTPMediaEngine - #pragma mark - - virtual void stepSetup() override; - virtual void stepShutdown() override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoReceiverChannelResource => webrtc::BitrateObserver - #pragma mark - - virtual void OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) override; - - protected: - TransportPtr mTransport; - std::atomic mTransportState { ISecureTransport::State_Pending }; - - UseMediaStreamTrackWeakPtr mTrack; - - ParametersPtr mParameters; - - RTPPacketPtr mInitPacket; - - String mReceiveCodecPayloadName; - BYTE mReceiveCodecPayloadType; - - rtc::scoped_ptr mReceiveStream; - ReceiverVideoRenderer mReceiverVideoRenderer; - }; - - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource - #pragma mark - - class VideoSenderChannelResource : public IRTPMediaEngineVideoSenderChannelResource, - public ChannelResource, - public webrtc::BitrateObserver - { - public: - friend class RTPMediaEngine; - - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - union VideoEncoderSettings { - webrtc::VideoCodecVP8 mVp8; - webrtc::VideoCodecVP9 mVp9; - webrtc::VideoCodecH264 mH264; - }; - - public: - VideoSenderChannelResource( - const make_private &, - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters - ); - virtual ~VideoSenderChannelResource(); - - static VideoSenderChannelResourcePtr create( - IRTPMediaEngineRegistrationPtr registration, - TransportPtr transport, - UseMediaStreamTrackPtr track, - ParametersPtr parameters - ); - - protected: - void init(); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineChannelResource - #pragma mark - - virtual PUID getID() const override {return ChannelResource::getID();} - - virtual PromisePtr shutdown() override {return ChannelResource::shutdown();} - - virtual void notifyTransportState(ISecureTransportTypes::States state) override { return ChannelResource::notifyTransportState(state); } - - virtual void notifyUpdate(ParametersPtr params) override { return ChannelResource::notifyUpdate(params); } - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override { return ChannelResource::requestStats(promise, stats); } - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineChannelResourceAsyncDelegate - #pragma mark - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - virtual void onProvideStats(PromiseWithStatsReportPtr promise, IStatsReportTypes::StatsTypeSet stats) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineVideoSenderChannelResource - #pragma mark - - virtual bool handlePacket(const RTCPPacket &packet) override; - virtual void sendVideoFrame(VideoFramePtr videoFrame) override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => IRTPMediaEngineHandlePacketAsyncDelegate - #pragma mark - - virtual void onHandleRTPPacket(DWORD timestamp, SecureByteBlockPtr buffer) override {} - virtual void onHandleRTCPPacket(SecureByteBlockPtr buffer) override; - virtual void onSendVideoFrame(VideoFramePtr videoFrame) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => friend RTPMediaEngine - #pragma mark - - virtual void stepSetup() override; - virtual void stepShutdown() override; - - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine::VideoSenderChannelResource => webrtc::BitrateObserver - #pragma mark - - virtual void OnNetworkChanged(uint32_t targetBitrateBps, uint8_t fractionLoss, int64_t rttMs) override; - - protected: - TransportPtr mTransport; - std::atomic mTransportState { ISecureTransport::State_Pending }; - - UseMediaStreamTrackWeakPtr mTrack; - - ParametersPtr mParameters; - - String mSendCodecPayloadName; - BYTE mSendCodecPayloadType {0}; - - rtc::scoped_ptr mSendStream; - VideoEncoderSettings mVideoEncoderSettings; - }; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPMediaEngine => (data) - #pragma mark - - AutoPUID mID; - RTPMediaEngineWeakPtr mThisWeak; - RTPMediaEnginePtr mGracefulShutdownReference; - - States mCurrentState {State_Pending}; - - WORD mLastError {}; - String mLastErrorReason; - - IRTPMediaEngineRegistrationWeakPtr mRegistration; - PromiseWithRTPMediaEngineList mPendingReady; - - DeviceResourceWeakMap mDeviceResources; - DeviceResourceList mPendingSetupDeviceResources; - DeviceResourceList mPendingCloseDeviceResources; - - ChannelResourceWeakMap mChannelResources; - ChannelResourceList mPendingSetupChannelResources; - ChannelResourceList mPendingCloseChannelResources; - - rtc::scoped_refptr mAudioState; - rtc::scoped_ptr mVoiceEngine; - - rtc::scoped_ptr mTraceCallback; - rtc::scoped_ptr mLogSink; - rtc::TraceLog mTraceLog; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPMediaEngineFactory - #pragma mark - - interaction IRTPMediaEngineFactory - { - static IRTPMediaEngineFactory &singleton(); - - virtual RTPMediaEnginePtr create(IRTPMediaEngineRegistrationPtr registration); - }; - - class RTPMediaEngineFactory : public IFactory {}; - } -} - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPMediaEngineDeviceResourceAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProviderTypes::PromiseWithStatsReportPtr, PromiseWithStatsReportPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsReportTypes::StatsTypeSet, StatsTypeSet) -ZS_DECLARE_PROXY_METHOD_2(onUpdateConstraints, PromisePtr, TrackConstraintsPtr) -ZS_DECLARE_PROXY_METHOD_2(onProvideStats, PromiseWithStatsReportPtr, StatsTypeSet) -ZS_DECLARE_PROXY_METHOD_1(onCapturedVideoFrame, VideoFramePtr) -ZS_DECLARE_PROXY_END() - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPMediaEngineChannelResourceAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) -ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsProviderTypes::PromiseWithStatsReportPtr, PromiseWithStatsReportPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::IStatsReportTypes::StatsTypeSet, StatsTypeSet) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) -ZS_DECLARE_PROXY_METHOD_2(onProvideStats, PromiseWithStatsReportPtr, StatsTypeSet) -ZS_DECLARE_PROXY_METHOD_0(onSendDTMFTone) -ZS_DECLARE_PROXY_END() - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPMediaEngineAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPMediaEngineAsyncDelegate::SetupSenderChannelPtr, SetupSenderChannelPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPMediaEngineAsyncDelegate::SetupReceiverChannelPtr, SetupReceiverChannelPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPMediaEngineAsyncDelegate::SetupDevicePtr, SetupDevicePtr) -ZS_DECLARE_PROXY_METHOD_1(onSetupSenderChannel, SetupSenderChannelPtr) -ZS_DECLARE_PROXY_METHOD_1(onSetupReceiverChannel, SetupReceiverChannelPtr) -ZS_DECLARE_PROXY_METHOD_1(onSetupDevice, SetupDevicePtr) -ZS_DECLARE_PROXY_END() - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPMediaEngineHandlePacketAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPMediaEngineHandlePacketAsyncDelegate::VideoFramePtr, VideoFramePtr) -ZS_DECLARE_PROXY_METHOD_2(onHandleRTPPacket, DWORD, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onHandleRTCPPacket, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onSendVideoFrame, VideoFramePtr) -ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPPacket.h b/ortc/internal/ortc_RTPPacket.h deleted file mode 100644 index 9b16846f..00000000 --- a/ortc/internal/ortc_RTPPacket.h +++ /dev/null @@ -1,421 +0,0 @@ -/* - - Copyright (c) 2014, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include - -#include - -namespace ortc -{ - namespace internal - { - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket - #pragma mark - - class RTPPacket - { - protected: - struct make_private {}; - - public: - struct HeaderExtension; - struct VideoOrientationHeaderExtension; - struct VideoOrientation6HeaderExtension; - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::CreationParams - #pragma mark - - struct CreationParams - { - BYTE mVersion {2}; - size_t mPadding {}; - bool mM {}; - BYTE mPT {}; - WORD mSequenceNumber {}; - DWORD mTimestamp {}; - DWORD mSSRC {}; - - size_t mCC {}; - DWORD *mCSRCList {}; - - const BYTE *mPayload {}; - size_t mPayloadSize {}; - - HeaderExtension *mFirstHeaderExtension {}; - BYTE mHeaderExtensionAppBits {}; - - size_t mHeaderExtensionPrepaddedSize {}; - const BYTE *mHeaderExtensionStopParsePos {}; - size_t mHeaderExtensionStopParseSize {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::Extension - #pragma mark - - struct HeaderExtension - { - // see https://tools.ietf.org/html/rfc5285 - - BYTE mID {}; - - const BYTE *mData {}; - size_t mDataSizeInBytes {}; - size_t mPostPaddingSize {}; - - HeaderExtension *mNext {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::ClientToMixerExtension - #pragma mark - - struct ClientToMixerExtension : public HeaderExtension - { - // see https://tools.ietf.org/html/rfc6464 - - ClientToMixerExtension(const HeaderExtension &header); - ClientToMixerExtension( - BYTE id, - bool voiceActivity, - BYTE level - ); - - bool voiceActivity() const; - BYTE level() const; - - public: - BYTE mLevelBuffer {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::MixerToClientExtension - #pragma mark - - struct MixerToClientExtension : public HeaderExtension - { - // see https://tools.ietf.org/html/rfc6464 - - static const size_t kMaxLevelCount {0xF}; - - MixerToClientExtension(const HeaderExtension &header); - MixerToClientExtension( - BYTE id, - BYTE *levels, - size_t count - ); - - size_t levelsCount() const; - - BYTE unusedBit(size_t index) const; - BYTE level(size_t index) const; - - public: - BYTE mLevelBuffer[kMaxLevelCount] {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::StringHeaderExtension - #pragma mark - - struct StringHeaderExtension : public HeaderExtension - { - static const size_t kMaxStringLength {0xFF}; - - StringHeaderExtension(const HeaderExtension &header); - StringHeaderExtension( - BYTE id, - const char *str - ); - - const char *str() const; - - ElementPtr toDebug() const; - - public: - BYTE mStringBuffer[kMaxStringLength+sizeof(char)] {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::NumberHeaderExtension - #pragma mark - - struct NumberHeaderExtension : public HeaderExtension - { - static const size_t kMaxNumberByteLength {0xFF}; - - NumberHeaderExtension(const HeaderExtension &header); - NumberHeaderExtension( - BYTE id, - const BYTE *number, - size_t lengthInBytes - ); - NumberHeaderExtension( - BYTE id, - const char *valueInBase10 - ); - - const BYTE *number() const; - size_t length() const; - - String str() const; - - ElementPtr toDebug() const; - - public: - BYTE mNumberBuffer[kMaxNumberByteLength] {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::MidHeaderExtension - #pragma mark - - struct MidHeaderExtension : public StringHeaderExtension - { - // https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-23#section-14.3 - - static const size_t kMaxMidLength = kMaxStringLength; - - MidHeaderExtension(const HeaderExtension &header) : StringHeaderExtension(header) {} - MidHeaderExtension( - BYTE id, - const char *mid - ) : StringHeaderExtension(id, mid) {} - - const char *mid() const {return str();} - - ElementPtr toDebug() const; - - public: - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::RidHeaderExtension - #pragma mark - - struct RidHeaderExtension : public StringHeaderExtension - { - // https://tools.ietf.org/html/draft-pthatcher-mmusic-rid-00 - - static const size_t kMaxMidLength = kMaxStringLength; - - RidHeaderExtension(const HeaderExtension &header) : StringHeaderExtension(header) {} - RidHeaderExtension( - BYTE id, - const char *rid - ) : StringHeaderExtension(id, rid) {} - - const char *rid() const {return str();} - - ElementPtr toDebug() const; - - public: - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::VideoOrientationHeaderExtension - #pragma mark - - struct VideoOrientationHeaderExtension : public HeaderExtension - { - struct Clockwise {}; - struct CounterClockwise {}; - - VideoOrientationHeaderExtension(const HeaderExtension &header); - VideoOrientationHeaderExtension(const VideoOrientation6HeaderExtension &); - VideoOrientationHeaderExtension( - const Clockwise &, - bool frontFacingCamera, // true = front facing, false = backfacing - bool flip, // horizontal left-right flip (mirro) - UINT orientation - ); - VideoOrientationHeaderExtension( - const CounterClockwise &, - bool frontFacingCamera, // true = front facing, false = backfacing - bool flip, // horizontal left-right flip (mirro) - UINT orientation - ); - - bool frontFacing() const; - bool backFacing() const; - bool flip() const; - UINT degreesClockwise() const; - UINT degreesCounterClockwise() const; - - ElementPtr toDebug() const; - - public: - BYTE mEncoded[1] {}; - }; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPPacket::VideoOrientationHeaderExtension - #pragma mark - - struct VideoOrientation6HeaderExtension : public VideoOrientationHeaderExtension - { - VideoOrientation6HeaderExtension(const HeaderExtension &header); - VideoOrientation6HeaderExtension( - const Clockwise &, - bool frontFacingCamera, // true = front facing, false = backfacing - bool flip, // horizontal left-right flip (mirro) - UINT orientation - ); - VideoOrientation6HeaderExtension( - const CounterClockwise &, - bool frontFacingCamera, // true = front facing, false = backfacing - bool flip, // horizontal left-right flip (mirro) - UINT orientation - ); - - UINT degreesClockwise() const; - UINT degreesCounterClockwise() const; - - ElementPtr toDebug() const; - - public: - }; - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark (public) - #pragma mark - - RTPPacket(const make_private &); - ~RTPPacket(); - - static RTPPacketPtr create(const RTPPacket &packet); - static RTPPacketPtr create(const CreationParams ¶ms); - static RTPPacketPtr create(const BYTE *buffer, size_t bufferLengthInBytes); - static RTPPacketPtr create(const SecureByteBlock &buffer); - static RTPPacketPtr create(SecureByteBlockPtr buffer); // NOTE: ownership of buffer is taken - - const BYTE *ptr() const; - size_t size() const; - SecureByteBlockPtr buffer() const; - - BYTE version() const {return mVersion;} - size_t padding() const {return mPadding;} - size_t cc() const {return static_cast(mCC);} - bool m() const {return mM;} - BYTE pt() const {return mPT;} - WORD sequenceNumber() const {return mSequenceNumber;} - DWORD timestamp() const {return mTimestamp;} - DWORD ssrc() const {return mSSRC;} - - size_t headerSize() {return mHeaderSize;} - size_t headerExtensionSize() {return mHeaderExtensionSize;} - size_t payloadSize() {return mPayloadSize;} - - DWORD getCSRC(size_t index) const; - const BYTE *payload() const; - size_t payloadSize() const {return mPayloadSize;} - - size_t totalHeaderExtensions() const {return mTotalHeaderExtensions;} - HeaderExtension *firstHeaderExtension() const {return mHeaderExtensions;} - HeaderExtension *getHeaderExtensionAtIndex(size_t index) const; - BYTE headerExtensionAppBits() const {return mHeaderExtensionAppBits;} - - size_t headerExtensionPrepaddedSize() const {return mHeaderExtensionPrepaddedSize;} - const BYTE *headerExtensionParseStopped() const {return mHeaderExtensionParseStoppedPos;} - size_t headerExtensionParseStoppedSize() const {return mHeaderExtensionParseStoppedSize;} - - void changeHeaderExtensions(HeaderExtension *firstExtension); - - ElementPtr toDebug() const; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark (internal) - #pragma mark - - static Log::Params slog(const char *message); - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - - bool parse(); - - void writeHeaderExtensions( - HeaderExtension *firstExtension, - bool twoByteHeader - ); - void generate(const RTPPacket ¶ms); - void generate(const CreationParams ¶ms); - - public: - SecureByteBlockPtr mBuffer; - - BYTE mVersion {}; - size_t mPadding {}; - BYTE mCC {}; - bool mM {}; - BYTE mPT {}; - WORD mSequenceNumber {}; - DWORD mTimestamp {}; - DWORD mSSRC {}; - - size_t mHeaderSize {}; - size_t mHeaderExtensionSize {}; - size_t mPayloadSize {}; - - size_t mTotalHeaderExtensions {}; - HeaderExtension *mHeaderExtensions {}; - BYTE mHeaderExtensionAppBits {}; - - size_t mHeaderExtensionPrepaddedSize {}; - const BYTE *mHeaderExtensionParseStoppedPos {}; - size_t mHeaderExtensionParseStoppedSize {}; - }; - - } -} - diff --git a/ortc/internal/ortc_RTPReceiver.h b/ortc/internal/ortc_RTPReceiver.h index de3158b7..c3ea0666 100644 --- a/ortc/internal/ortc_RTPReceiver.h +++ b/ortc/internal/ortc_RTPReceiver.h @@ -59,101 +59,101 @@ namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPListener) - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForMediaStreamTrack) + ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPListener); + ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiver) + ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiver); - ZS_DECLARE_INTERACTION_PTR(ISecureTransportForRTPReceiver) - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPReceiver) - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPReceiverChannel) - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiver) + ZS_DECLARE_INTERACTION_PTR(ISecureTransportForRTPReceiver); + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPReceiver); + ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPReceiverChannel); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiver); - ZS_DECLARE_INTERACTION_PROXY(IRTPReceiverAsyncDelegate) + ZS_DECLARE_INTERACTION_PROXY(IRTPReceiverAsyncDelegate); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverForRTPListener - #pragma mark + // + // IRTPReceiverForRTPListener + // interaction IRTPReceiverForRTPListener { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, ForRTPListener) + ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPListener, ForRTPListener); - static ElementPtr toDebug(ForRTPListenerPtr transport); + static ElementPtr toDebug(ForRTPListenerPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual bool handlePacket( IICETypes::Components viaTransport, RTPPacketPtr packet - ) = 0; + ) noexcept = 0; virtual bool handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // IRTPReceiverForRTPReceiverChannel + // interaction IRTPReceiverForRTPReceiverChannel { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPReceiverChannel, ForRTPReceiverChannel) + ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPReceiverChannel, ForRTPReceiverChannel); - static ElementPtr toDebug(ForRTPReceiverChannelPtr object); + static ElementPtr toDebug(ForRTPReceiverChannelPtr object) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual bool sendPacket(RTCPPacketPtr packet) = 0; + virtual bool sendPacket(RTCPPacketPtr packet) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverForMediaStreamTrack - #pragma mark + // + // IRTPReceiverForMediaStreamTrack + // interaction IRTPReceiverForMediaStreamTrack { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForMediaStreamTrack, ForMediaStreamTrack) + ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForMediaStreamTrack, ForMediaStreamTrack); - static ElementPtr toDebug(ForMediaStreamTrackPtr object); + static ElementPtr toDebug(ForMediaStreamTrackPtr object) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverAsyncDelegate - #pragma mark + // + // IRTPReceiverAsyncDelegate + // interaction IRTPReceiverAsyncDelegate { - virtual ~IRTPReceiverAsyncDelegate() {} + virtual ~IRTPReceiverAsyncDelegate() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver - #pragma mark + // + // RTPReceiver + // class RTPReceiver : public Noop, public MessageQueueAssociator, @@ -204,8 +204,8 @@ namespace ortc CodecType_Last = CodecType_RTX, }; - static const char *toString(CodecTypes codecType); - static CodecTypes toCodecType(const char *type); + static const char *toString(CodecTypes codecType) noexcept; + static CodecTypes toCodecType(const char *type) noexcept(false); // throws InvalidParameters typedef IRTPTypes::SSRCType SSRCType; typedef std::list RTCPPacketList; @@ -230,9 +230,9 @@ namespace ortc typedef std::map SSRCRoutingWeakMap; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::RegisteredHeaderExtension - #pragma mark + // + // RTPReceiver::RegisteredHeaderExtension + // typedef USHORT LocalID; typedef size_t ReferenceCount; @@ -243,7 +243,7 @@ namespace ortc LocalID mLocalID {}; bool mEncrypted {}; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map HeaderExtensionMap; @@ -251,9 +251,9 @@ namespace ortc typedef std::map ContributingSourceMap; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::ChannelHolder - #pragma mark + // + // RTPReceiver::ChannelHolder + // struct ChannelHolder { @@ -262,29 +262,29 @@ namespace ortc ChannelInfoPtr mChannelInfo; std::atomic mLastReportedState {ISecureTransport::State_Pending}; - ChannelHolder(); - ~ChannelHolder(); + ChannelHolder() noexcept; + ~ChannelHolder() noexcept; - PUID getID() const; - void notify(ISecureTransport::States state); + PUID getID() const noexcept; + void notify(ISecureTransport::States state) noexcept; - void notify(RTPPacketPtr packet); - void notify(RTCPPacketListPtr packets); + void notify(RTPPacketPtr packet) noexcept; + void notify(RTCPPacketListPtr packets) noexcept; - void update(const Parameters ¶ms); + void update(const Parameters ¶ms) noexcept; - bool handle(RTPPacketPtr packet); - bool handle(RTCPPacketPtr packet); + bool handle(RTPPacketPtr packet) noexcept; + bool handle(RTCPPacketPtr packet) noexcept; - void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats); + void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::ChannelInfo - #pragma mark + // + // RTPReceiver::ChannelInfo + // struct ChannelInfo { @@ -296,41 +296,41 @@ namespace ortc ChannelHolderWeakPtr mChannelHolder; // NOTE: might be null if channel is not created yet (or previously destoyed) SSRCRoutingMap mRegisteredSSRCs; - bool shouldLatchAll() const; - String rid() const; + bool shouldLatchAll() const noexcept; + String rid() const noexcept; - void registerHolder(ChannelHolderPtr channelHolder); + void registerHolder(ChannelHolderPtr channelHolder) noexcept; - SSRCInfoPtr registerSSRCUsage(SSRCInfoPtr ssrcInfo); + SSRCInfoPtr registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept; void unregisterSSRCUsage( SSRCType ssrc, RoutingPayloadType routingPayload - ); + ) noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map ParametersToChannelInfoMap; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::RIDInfo - #pragma mark + // + // RTPReceiver::RIDInfo + // struct RIDInfo { String mRID; ChannelInfoPtr mChannelInfo; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map RIDToChannelMap; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::SSRCInfo - #pragma mark + // + // RTPReceiver::SSRCInfo + // struct SSRCInfo { @@ -341,15 +341,15 @@ namespace ortc ChannelHolderPtr mChannelHolder; // can be NULL - SSRCInfo(); + SSRCInfo() noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::CodecInfo - #pragma mark + // + // RTPReceiver::CodecInfo + // struct CodecInfo { @@ -358,15 +358,15 @@ namespace ortc CodecInfo *mOriginalCodec {}; // used for rtx to point to original codec IRTPTypes::CodecParameters *mOriginalCodecParams {}; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; typedef std::map CodecInfoMap; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver::States - #pragma mark + // + // RTPReceiver::States + // enum States { @@ -375,7 +375,7 @@ namespace ortc State_ShuttingDown, State_Shutdown, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; public: RTPReceiver( @@ -385,219 +385,219 @@ namespace ortc Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept(false); // throws InvalidParameters protected: - RTPReceiver(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : + RTPReceiver(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~RTPReceiver(); + virtual ~RTPReceiver() noexcept; - static RTPReceiverPtr convert(IRTPReceiverPtr object); - static RTPReceiverPtr convert(ForRTPListenerPtr object); - static RTPReceiverPtr convert(ForRTPReceiverChannelPtr object); - static RTPReceiverPtr convert(ForMediaStreamTrackPtr object); + static RTPReceiverPtr convert(IRTPReceiverPtr object) noexcept; + static RTPReceiverPtr convert(ForRTPListenerPtr object) noexcept; + static RTPReceiverPtr convert(ForRTPReceiverChannelPtr object) noexcept; + static RTPReceiverPtr convert(ForMediaStreamTrackPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IStatsProvider - #pragma mark + // + // RTPReceiver => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiver - #pragma mark + // + // RTPReceiver => IRTPReceiver + // - static ElementPtr toDebug(RTPReceiverPtr receiver); + static ElementPtr toDebug(RTPReceiverPtr receiver) noexcept; static RTPReceiverPtr create( IRTPReceiverDelegatePtr delegate, Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IRTPReceiverSubscriptionPtr subscribe(IRTPReceiverDelegatePtr delegate) override; + IRTPReceiverSubscriptionPtr subscribe(IRTPReceiverDelegatePtr delegate) noexcept override; - virtual IMediaStreamTrackPtr track() const override; - virtual IRTPTransportPtr transport() const override; - virtual IRTCPTransportPtr rtcpTransport() const override; + ortc::IMediaStreamTrackPtr track() const noexcept override; + IRTPTransportPtr transport() const noexcept override; + IRTCPTransportPtr rtcpTransport() const noexcept override; - virtual void setTransport( - IRTPTransportPtr transport, - IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ) override; + void setTransport( + IRTPTransportPtr transport, + IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() + ) noexcept(false) override; // throws InvalidParameters - static CapabilitiesPtr getCapabilities(Optional kind); + static CapabilitiesPtr getCapabilities(Optional kind) noexcept; - virtual PromisePtr receive(const Parameters ¶meters) override; - virtual void stop() override; + PromisePtr receive(const Parameters ¶meters) noexcept(false) override; // throws InvalidParameters + void stop() noexcept override; - virtual ContributingSourceList getContributingSources() const override; + ContributingSourceList getContributingSources() const noexcept override; - virtual void requestSendCSRC(SSRCType csrc) override; + void requestSendCSRC(SSRCType csrc) noexcept(false) override; // throws NotImplemented //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverForRTPListener - #pragma mark + // + // RTPReceiver => IRTPReceiverForRTPListener + // // (duplciate) static ElementPtr toDebug(ForRTPListenerPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTPPacketPtr packet + ) noexcept override; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTCPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTCPPacketPtr packet + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // RTPReceiver => IRTPReceiverForRTPReceiverChannel + // - // (duplicate) static ElementPtr toDebug(ForRTPReceiverChannelPtr object); + // (duplicate) static ElementPtr toDebug(ForRTPReceiverChannelPtr object) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual bool sendPacket(RTCPPacketPtr packet) override; + bool sendPacket(RTCPPacketPtr packet) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverForMediaStreamTrack - #pragma mark + // + // RTPReceiver => IRTPReceiverForMediaStreamTrack + // - // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object); + // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => ISecureTransportDelegate - #pragma mark + // + // RTPReceiver => ISecureTransportDelegate + // - virtual void onSecureTransportStateChanged( - ISecureTransportPtr transport, - ISecureTransport::States state - ) override; + void onSecureTransportStateChanged( + ISecureTransportPtr transport, + ISecureTransport::States state + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IWakeDelegate - #pragma mark + // + // RTPReceiver => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => ITimerDelegate - #pragma mark + // + // RTPReceiver => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => IRTPReceiverAsyncDelegate - #pragma mark + // + // RTPReceiver => IRTPReceiverAsyncDelegate + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => (friend RTPReceiver::ChannelHolder) - #pragma mark + // + // RTPReceiver => (friend RTPReceiver::ChannelHolder) + // - void notifyChannelGone(); + void notifyChannelGone() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => (internal) - #pragma mark + // + // RTPReceiver => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - bool stepAttemptDelivery(); - bool stepCleanChannels(); + void step() noexcept; + bool stepAttemptDelivery() noexcept; + bool stepCleanChannels() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - bool shouldLatchAll(); - void notifyChannelsOfTransportState(); + bool shouldLatchAll() noexcept; + void notifyChannelsOfTransportState() noexcept; - void flushAllAutoLatchedChannels(); + void flushAllAutoLatchedChannels() noexcept; - void addChannel(ParametersPtr params); + void addChannel(ParametersPtr params) noexcept; void updateChannel( ChannelInfoPtr channelInfo, ParametersPtr newParams - ); - void removeChannel(const ChannelInfo &channelInfo); + ) noexcept; + void removeChannel(const ChannelInfo &channelInfo) noexcept; - void registerHeaderExtensions(const Parameters ¶ms); + void registerHeaderExtensions(const Parameters ¶ms) noexcept; SSRCInfoPtr setSSRCUsage( SSRCType ssrc, RoutingPayloadType routingPayload, String &ioRID, ChannelHolderPtr &ioChannelHolder - ); + ) noexcept; void setRIDUsage( const String &rid, ChannelInfoPtr &ioChannelInfo - ); + ) noexcept; - void registerSSRCUsage(SSRCInfoPtr ssrcInfo); + void registerSSRCUsage(SSRCInfoPtr ssrcInfo) noexcept; void registerUsage( const IRTPTypes::EncodingParameters &encodingParams, ChannelInfoPtr channelInfo, ChannelHolderPtr &ioChannelHolder - ); + ) noexcept; - void reattemptDelivery(); - void expireRTPPackets(); + void reattemptDelivery() noexcept; + void expireRTPPackets() noexcept; - bool shouldCleanChannel(bool objectExists); - void cleanChannels(); + bool shouldCleanChannel(bool objectExists) noexcept; + void cleanChannels() noexcept; bool findMapping( const RTPPacket &rtpPacket, ChannelHolderPtr &outChannelHolder, String &outRID - ); + ) noexcept; String extractRID( RoutingPayloadType routingPayload, const RTPPacket &rtpPacket, ChannelHolderPtr &outChannelHolder - ); + ) noexcept; - String extractMuxID(const RTPPacket &rtpPacket); + String extractMuxID(const RTPPacket &rtpPacket) noexcept; bool findMappingUsingRID( const String &ridID, @@ -605,7 +605,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ); + ) noexcept; bool findMappingUsingSSRCInEncodingParams( const String &rid, @@ -613,7 +613,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ); + ) noexcept; bool findMappingUsingPayloadType( const String &rid, @@ -621,7 +621,7 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ); + ) noexcept; bool findBestExistingLatchAllOrCreateNew( const RTPTypesHelper::DecodedCodecInfo &decodedCodec, @@ -630,12 +630,12 @@ namespace ortc const RTPPacket &rtpPacket, ChannelInfoPtr &outChannelInfo, ChannelHolderPtr &outChannelHolder - ); + ) noexcept; bool fillRIDParameters( const String &rid, ChannelInfoPtr &ioChannelInfo - ); + ) noexcept; void createChannel( SSRCType ssrc, @@ -643,47 +643,47 @@ namespace ortc const String &rid, ChannelInfoPtr channelInfo, ChannelHolderPtr &ioChannelHolder - ); + ) noexcept; void processUnhandled( const String &muxID, const String &rid, IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType - ); + ) noexcept; - void processByes(const RTCPPacket &rtcpPacket); - void processSenderReports(const RTCPPacket &rtcpPacket); + void processByes(const RTCPPacket &rtcpPacket) noexcept; + void processSenderReports(const RTCPPacket &rtcpPacket) noexcept; - void extractCSRCs(const RTPPacket &rtpPacket); + void extractCSRCs(const RTPPacket &rtpPacket) noexcept; void setContributingSource( SSRCType csrc, BYTE level, const Optional &voiceActivityFlag - ); + ) noexcept; void postFindMappingProcessPacket( const RTPPacket &rtpPacket, ChannelHolderPtr &channelHolder - ); + ) noexcept; - void resetActiveReceiverChannel(); + void resetActiveReceiverChannel() noexcept; Optional decodeREDRoutingPayloadType( const BYTE *buffer, size_t bufferSizeInBytes - ); + ) noexcept; Optional decodeFECPayloadType( const BYTE *buffer, size_t bufferSizeInBytes - ); + ) noexcept; - Optional getRoutingPayloadType(const RTPPacket &rtpPacket); + Optional getRoutingPayloadType(const RTPPacket &rtpPacket) noexcept; - Optional getRoutingPayload(const RTPTypesHelper::DecodedCodecInfo &decodedCodec); + Optional getRoutingPayload(const RTPTypesHelper::DecodedCodecInfo &decodedCodec) noexcept; - RoutingPayloadType getMediaCodecRoutingPayload(PayloadType originalPayload); + RoutingPayloadType getMediaCodecRoutingPayload(PayloadType originalPayload) noexcept; void getFECMediaCodecRoutingPayload( PayloadType originalPayload, @@ -692,21 +692,21 @@ namespace ortc Optional &resultFECv2, PayloadType *outPayloadTypeFECv1 = NULL, PayloadType *outPayloadTypeFECv2 = NULL - ); + ) noexcept; - Optional getRtxMediaCodecRoutingPayload(PayloadType originalPayload); + Optional getRtxMediaCodecRoutingPayload(PayloadType originalPayload) noexcept; void getRtxFECMediaCodecRoutingPayload( PayloadType originalPayload, IRTPTypes::KnownFECMechanisms mechanism, Optional &resultFECv1, Optional &resultFECv2 - ); + ) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => (data) - #pragma mark + // + // RTPReceiver => (data) + // AutoPUID mID; RTPReceiverWeakPtr mThisWeak; @@ -777,25 +777,25 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverFactory - #pragma mark + // + // IRTPReceiverFactory + // interaction IRTPReceiverFactory { typedef IRTPReceiverTypes::Kinds Kinds; typedef IRTPReceiverTypes::CapabilitiesPtr CapabilitiesPtr; - static IRTPReceiverFactory &singleton(); + static IRTPReceiverFactory &singleton() noexcept; virtual RTPReceiverPtr create( IRTPReceiverDelegatePtr delegate, Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept; - virtual CapabilitiesPtr getCapabilities(Optional kind); + virtual CapabilitiesPtr getCapabilities(Optional kind) noexcept; }; class RTPReceiverFactory : public IFactory {}; @@ -803,5 +803,5 @@ namespace ortc } ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPReceiverAsyncDelegate) -//ZS_DECLARE_PROXY_METHOD_2(onDeliverPacket, UseChannelPtr, RTPPacketPtr) +//ZS_DECLARE_PROXY_METHOD(onDeliverPacket, UseChannelPtr, RTPPacketPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPReceiverChannel.h b/ortc/internal/ortc_RTPReceiverChannel.h index 2f475497..7dadc333 100644 --- a/ortc/internal/ortc_RTPReceiverChannel.h +++ b/ortc/internal/ortc_RTPReceiverChannel.h @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -52,15 +53,8 @@ namespace ortc { ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiver); ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiverChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiverChannelAudio); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiverChannelVideo); ZS_DECLARE_INTERACTION_PTR(IRTPReceiverForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelMediaBaseForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelAudioForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelVideoForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannel); ZS_DECLARE_INTERACTION_PROXY(IRTPReceiverChannelAsyncDelegate); @@ -69,9 +63,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // IRTPReceiverChannelForRTPReceiver + // interaction IRTPReceiverChannelForRTPReceiver { @@ -83,39 +77,39 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - static ElementPtr toDebug(ForRTPReceiverPtr object); + static ElementPtr toDebug(ForRTPReceiverPtr object) noexcept; static RTPReceiverChannelPtr create( RTPReceiverPtr receiver, MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void notifyTransportState(ISecureTransportTypes::States state) = 0; + virtual void notifyTransportState(ISecureTransportTypes::States state) noexcept = 0; - virtual void notifyPacket(RTPPacketPtr packet) = 0; + virtual void notifyPacket(RTPPacketPtr packet) noexcept = 0; - virtual void notifyPackets(RTCPPacketListPtr packets) = 0; + virtual void notifyPackets(RTCPPacketListPtr packets) noexcept = 0; - virtual void notifyUpdate(const Parameters ¶ms) = 0; + virtual void notifyUpdate(const Parameters ¶ms) noexcept = 0; - virtual bool handlePacket(RTPPacketPtr packet) = 0; + virtual bool handlePacket(RTPPacketPtr packet) noexcept = 0; - virtual bool handlePacket(RTCPPacketPtr packet) = 0; + virtual bool handlePacket(RTCPPacketPtr packet) noexcept = 0; - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) = 0; + virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // IRTPReceiverChannelForMediaStreamTrack + // interaction IRTPReceiverChannelForMediaStreamTrack { @@ -123,25 +117,25 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - static ElementPtr toDebug(ForMediaStreamTrackPtr object); + static ElementPtr toDebug(ForMediaStreamTrackPtr object) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual int32_t getAudioSamples( const size_t numberOfSamples, const uint8_t numberOfChannels, void* audioSamples, size_t& numberOfSamplesOut - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAsyncDelegate - #pragma mark + // + // IRTPReceiverChannelAsyncDelegate + // interaction IRTPReceiverChannelAsyncDelegate { @@ -162,26 +156,26 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForRTPReceiverChannelMediaBase - #pragma mark + // + // IRTPReceiverChannelForRTPReceiverChannelMediaBase + // interaction IRTPReceiverChannelForRTPReceiverChannelMediaBase { ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelForRTPReceiverChannelMediaBase, ForRTPReceiverChannelMediaBase) - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual bool sendPacket(RTCPPacketPtr packet) = 0; + virtual bool sendPacket(RTCPPacketPtr packet) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForRTPReceiverChannelAudio - #pragma mark + // + // IRTPReceiverChannelForRTPReceiverChannelAudio + // interaction IRTPReceiverChannelForRTPReceiverChannelAudio : public IRTPReceiverChannelForRTPReceiverChannelMediaBase { @@ -192,9 +186,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelForRTPReceiverChannelVideo - #pragma mark + // + // IRTPReceiverChannelForRTPReceiverChannelVideo + // interaction IRTPReceiverChannelForRTPReceiverChannelVideo : public IRTPReceiverChannelForRTPReceiverChannelMediaBase { @@ -206,9 +200,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel - #pragma mark + // + // RTPReceiverChannel + // class RTPReceiverChannel : public Noop, public MessageQueueAssociator, @@ -236,10 +230,6 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverForRTPReceiverChannel, UseReceiver) ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannel, UseMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPReceiverChannel, UseMediaBase) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelAudioForRTPReceiverChannel, UseAudio) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelVideoForRTPReceiverChannel, UseVideo) - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) typedef std::list RTCPPacketList; ZS_DECLARE_PTR(RTCPPacketList) @@ -251,7 +241,7 @@ namespace ortc State_ShuttingDown, State_Shutdown, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; public: RTPReceiverChannel( @@ -260,145 +250,145 @@ namespace ortc UseReceiverPtr receiver, UseMediaStreamTrackPtr track, const Parameters ¶ms - ); + ) noexcept; protected: - RTPReceiverChannel(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : + RTPReceiverChannel(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(const RTCPPacketList &packets); + void init(const RTCPPacketList &packets) noexcept; public: - virtual ~RTPReceiverChannel(); + virtual ~RTPReceiverChannel() noexcept; - static RTPReceiverChannelPtr convert(ForRTPReceiverPtr object); - static RTPReceiverChannelPtr convert(ForRTPReceiverChannelMediaBasePtr object); - static RTPReceiverChannelPtr convert(ForRTPReceiverChannelAudioPtr object); - static RTPReceiverChannelPtr convert(ForRTPReceiverChannelVideoPtr object); - static RTPReceiverChannelPtr convert(ForMediaStreamTrackPtr object); + static RTPReceiverChannelPtr convert(ForRTPReceiverPtr object) noexcept; + static RTPReceiverChannelPtr convert(ForRTPReceiverChannelMediaBasePtr object) noexcept; + static RTPReceiverChannelPtr convert(ForRTPReceiverChannelAudioPtr object) noexcept; + static RTPReceiverChannelPtr convert(ForRTPReceiverChannelVideoPtr object) noexcept; + static RTPReceiverChannelPtr convert(ForMediaStreamTrackPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelForRTPReceiver + // - static ElementPtr toDebug(RTPReceiverChannelPtr object); + static ElementPtr toDebug(RTPReceiverChannelPtr object) noexcept; static RTPReceiverChannelPtr create( RTPReceiverPtr receiver, MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ); + ) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual void notifyTransportState(ISecureTransportTypes::States state) override; + void notifyTransportState(ISecureTransportTypes::States state) noexcept override; - virtual void notifyPacket(RTPPacketPtr packet) override; + void notifyPacket(RTPPacketPtr packet) noexcept override; - virtual void notifyPackets(RTCPPacketListPtr packets) override; + void notifyPackets(RTCPPacketListPtr packets) noexcept override; - virtual void notifyUpdate(const Parameters ¶ms) override; + void notifyUpdate(const Parameters ¶ms) noexcept override; - virtual bool handlePacket(RTPPacketPtr packet) override; + bool handlePacket(RTPPacketPtr packet) noexcept override; - virtual bool handlePacket(RTCPPacketPtr packet) override; + bool handlePacket(RTCPPacketPtr packet) noexcept override; - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; + void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object); // (duplicate) virtual PUID getID() const = 0; - virtual int32_t getAudioSamples( - const size_t numberOfSamples, - const uint8_t numberOfChannels, - void *audioSamples, - size_t& numberOfSamplesOut - ) override; + int32_t getAudioSamples( + const size_t numberOfSamples, + const uint8_t numberOfChannels, + void *audioSamples, + size_t& numberOfSamplesOut + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelMediaBase - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelMediaBase + // // (duplicate) virtual PUID getID() const = 0; - virtual bool sendPacket(RTCPPacketPtr packet) override; + bool sendPacket(RTCPPacketPtr packet) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelAudio - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelAudio + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelVideo - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelVideo + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IWakeDelegate - #pragma mark + // + // RTPReceiverChannel => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => ITimerDelegate - #pragma mark + // + // RTPReceiverChannel => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => IRTPReceiverChannelAsyncDelegate - #pragma mark + // + // RTPReceiverChannel => IRTPReceiverChannelAsyncDelegate + // - virtual void onSecureTransportState(ISecureTransport::States state) override; + void onSecureTransportState(ISecureTransport::States state) override; - virtual void onNotifyPacket(RTPPacketPtr packet) override; + void onNotifyPacket(RTPPacketPtr packet) override; - virtual void onNotifyPackets(RTCPPacketListPtr packets) override; + void onNotifyPackets(RTCPPacketListPtr packets) override; - virtual void onUpdate(ParametersPtr params) override; + void onUpdate(ParametersPtr params) override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => (internal) - #pragma mark + // + // RTPReceiverChannel => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); + void step() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannel => (data) - #pragma mark + // + // RTPReceiverChannel => (data) + // AutoPUID mID; RTPReceiverChannelWeakPtr mThisWeak; @@ -419,33 +409,35 @@ namespace ortc Optional mKind; UseMediaStreamTrackPtr mTrack; - // NO lockk is needed: + // NO lock is needed: +#if 0 UseMediaBasePtr mMediaBase; // valid UseAudioPtr mAudio; // either UseVideoPtr mVideo; // or valid +#endif //0 }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelFactory - #pragma mark + // + // IRTPReceiverChannelFactory + // interaction IRTPReceiverChannelFactory { ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) typedef std::list RTCPPacketList; - static IRTPReceiverChannelFactory &singleton(); + static IRTPReceiverChannelFactory &singleton() noexcept; virtual RTPReceiverChannelPtr create( RTPReceiverPtr receiver, MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ); + ) noexcept; }; class RTPReceiverChannelFactory : public IFactory {}; @@ -455,11 +447,11 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPReceiverChannelAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPReceiverChannelAsyncDelegate::RTCPPacketListPtr, RTCPPacketListPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPReceiverChannelAsyncDelegate::ParametersPtr, ParametersPtr) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onNotifyPacket, RTPPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onNotifyPackets, RTCPPacketListPtr) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) +ZS_DECLARE_PROXY_METHOD(onSecureTransportState, States) +ZS_DECLARE_PROXY_METHOD(onNotifyPacket, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onNotifyPackets, RTCPPacketListPtr) +ZS_DECLARE_PROXY_METHOD(onUpdate, ParametersPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPReceiverChannelAudio.h b/ortc/internal/ortc_RTPReceiverChannelAudio.h deleted file mode 100644 index 4b271e87..00000000 --- a/ortc/internal/ortc_RTPReceiverChannelAudio.h +++ /dev/null @@ -1,465 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" - -namespace ortc -{ - namespace internal - { - ZS_DECLARE_USING_PTR(zsLib, Event) - - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelAudioForRTPReceiverChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelAudioForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelAudioForRTPMediaEngine); - - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiverChannelAudio); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannelAudio); - - ZS_DECLARE_INTERACTION_PROXY(IRTPReceiverChannelAudioAsyncDelegate); - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark - - interaction IRTPReceiverChannelAudioForRTPReceiverChannel : public IRTPReceiverChannelMediaBaseForRTPReceiverChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelAudioForRTPReceiverChannel, ForRTPReceiverChannel) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static ElementPtr toDebug(ForRTPReceiverChannelPtr object); - - static RTPReceiverChannelAudioPtr create( - RTPReceiverChannelPtr receiver, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - virtual int32_t getAudioSamples( - const size_t numberOfSamples, - const uint8_t numberOfChannels, - void *audioSamples, - size_t& numberOfSamplesOut - ) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark - - interaction IRTPReceiverChannelAudioForMediaStreamTrack : public IRTPReceiverChannelMediaBaseForMediaStreamTrack - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelAudioForMediaStreamTrack, ForMediaStreamTrack) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioForRTPMediaEngine - #pragma mark - - interaction IRTPReceiverChannelAudioForRTPMediaEngine : public IRTPReceiverChannelMediaBaseForRTPMediaEngine - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelAudioForRTPMediaEngine, ForRTPMediaEngine) - - static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioAsyncDelegate - #pragma mark - - interaction IRTPReceiverChannelAudioAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - virtual void onReceiverChannelAudioDeliverPackets() = 0; - virtual void onSecureTransportState(ISecureTransport::States state) = 0; - virtual void onUpdate(ParametersPtr params) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio - #pragma mark - - class RTPReceiverChannelAudio : public Noop, - public MessageQueueAssociator, - public SharedRecursiveLock, - public IRTPReceiverChannelAudioForRTPReceiverChannel, - public IRTPReceiverChannelAudioForMediaStreamTrack, - public IRTPReceiverChannelAudioForRTPMediaEngine, - public IWakeDelegate, - public zsLib::ITimerDelegate, - public zsLib::IPromiseSettledDelegate, - public IRTPReceiverChannelAudioAsyncDelegate - { - protected: - struct make_private {}; - - public: - friend interaction IRTPReceiverChannelAudio; - friend interaction IRTPReceiverChannelAudioFactory; - friend interaction IRTPReceiverChannelMediaBaseForRTPReceiverChannel; - friend interaction IRTPReceiverChannelAudioForRTPReceiverChannel; - friend interaction IRTPReceiverChannelMediaBaseForMediaStreamTrack; - friend interaction IRTPReceiverChannelAudioForMediaStreamTrack; - friend interaction IRTPReceiverChannelAudioForRTPMediaEngine; - - ZS_DECLARE_CLASS_PTR(Transport) - friend class Transport; - - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelForRTPReceiverChannelAudio, UseChannel) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannelAudio, UseMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPReceiverChannelAudio, UseMediaEngine) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineDeviceResource, UseDeviceResource) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineAudioReceiverChannelResource, UseChannelResource) - - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPReceiverChannel, ForReceiverChannelFromMediaBase) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForMediaStreamTrack, ForMediaStreamTrackFromMediaBase) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - typedef std::list RTCPPacketList; - ZS_DECLARE_PTR(RTCPPacketList) - typedef std::queue RTPPacketQueue; - typedef std::queue RTCPPacketQueue; - - enum States - { - State_Pending, - State_Ready, - State_ShuttingDown, - State_Shutdown, - }; - static const char *toString(States state); - - struct VoiceEngineDeleter { - VoiceEngineDeleter() {} - inline void operator()(webrtc::VoiceEngine* ptr) const { - webrtc::VoiceEngine::Delete(ptr); - } - }; - - public: - RTPReceiverChannelAudio( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr receiverChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ); - - protected: - RTPReceiverChannelAudio(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : - Noop(true), - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()) - {} - - void init(); - - public: - virtual ~RTPReceiverChannelAudio(); - - static RTPReceiverChannelAudioPtr convert(ForReceiverChannelFromMediaBasePtr object); - static RTPReceiverChannelAudioPtr convert(ForRTPReceiverChannelPtr object); - static RTPReceiverChannelAudioPtr convert(ForMediaStreamTrackFromMediaBasePtr object); - static RTPReceiverChannelAudioPtr convert(ForMediaStreamTrackPtr object); - static RTPReceiverChannelAudioPtr convert(ForRTPMediaEnginePtr object); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark - - virtual PUID getID() const override {return mID;} - - virtual void notifyTransportState(ISecureTransportTypes::States state) override; - - virtual void notifyUpdate(ParametersPtr params) override; - - virtual bool handlePacket(RTPPacketPtr packet) override; - - virtual bool handlePacket(RTCPPacketPtr packet) override; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark - - static RTPReceiverChannelAudioPtr create( - RTPReceiverChannelPtr receiver, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - virtual int32_t getAudioSamples( - const size_t numberOfSamples, - const uint8_t numberOfChannels, - void *audioSamples, - size_t& numberOfSamplesOut - ) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPMediaEngine - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IWakeDelegate - #pragma mark - - virtual void onWake() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => ITimerDelegate - #pragma mark - - virtual void onTimer(ITimerPtr timer) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IPromiseSettledDelegate - #pragma mark - - virtual void onPromiseSettled(PromisePtr promise) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IRTPReceiverChannelAudioAsyncDelegate - #pragma mark - - virtual void onReceiverChannelAudioDeliverPackets() override; - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => friend Transport - #pragma mark - - virtual bool SendRtcp(const uint8_t* packet, size_t length); - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio::Transport - #pragma mark - - class Transport : public webrtc::Transport - { - struct make_private {}; - - protected: - void init(); - - public: - Transport( - const make_private &, - RTPReceiverChannelAudioPtr outer - ); - - ~Transport(); - - static TransportPtr create(RTPReceiverChannelAudioPtr outer); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio::Transport => webrtc::Transport - #pragma mark - - virtual bool SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) override; - - virtual bool SendRtcp(const uint8_t* packet, size_t length) override; - - private: - TransportWeakPtr mThisWeak; - RTPReceiverChannelAudioWeakPtr mOuter; - }; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - bool isShuttingDown() const; - bool isShutdown() const; - - void step(); - bool stepChannelPromise(); - bool stepSetupChannel(); - - void cancel(); - - void setState(States state); - void setError(WORD error, const char *reason = NULL); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => (data) - #pragma mark - - AutoPUID mID; - RTPReceiverChannelAudioWeakPtr mThisWeak; - RTPReceiverChannelAudioPtr mGracefulShutdownReference; - - States mCurrentState {State_Pending}; - - WORD mLastError {}; - String mLastErrorReason; - - UseChannelWeakPtr mReceiverChannel; - - ParametersPtr mParameters; - - PromiseWithRTPMediaEngineChannelResourcePtr mChannelResourceLifetimeHolderPromise; - UseChannelResourcePtr mChannelResource; - - PromisePtr mCloseChannelPromise; - - Optional mKind; - UseMediaStreamTrackPtr mTrack; - - TransportPtr mTransport; // allow lifetime of callback to exist separate from "this" object - std::atomic mTransportState { ISecureTransport::State_Pending }; - - RTPPacketQueue mQueuedRTP; - RTCPPacketQueue mQueuedRTCP; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelAudioFactory - #pragma mark - - interaction IRTPReceiverChannelAudioFactory - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static IRTPReceiverChannelAudioFactory &singleton(); - - virtual RTPReceiverChannelAudioPtr create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - }; - - class RTPReceiverChannelAudioFactory : public IFactory {}; - } -} - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPReceiverChannelAudioAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) -ZS_DECLARE_PROXY_METHOD_0(onReceiverChannelAudioDeliverPackets) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) -ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPReceiverChannelVideo.h b/ortc/internal/ortc_RTPReceiverChannelVideo.h deleted file mode 100644 index f458f809..00000000 --- a/ortc/internal/ortc_RTPReceiverChannelVideo.h +++ /dev/null @@ -1,466 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" - -namespace ortc -{ - namespace internal - { - ZS_DECLARE_USING_PTR(zsLib, Event) - - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelVideoForSettings) - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelVideoForRTPReceiverChannel) - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelVideoForMediaStreamTrack) - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelVideoForRTPMediaEngine) - - ZS_DECLARE_INTERACTION_PTR(IRTPReceiverChannelForRTPReceiverChannelVideo) - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPReceiverChannelVideo) - - ZS_DECLARE_INTERACTION_PROXY(IRTPReceiverChannelVideoAsyncDelegate) - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForSettings - #pragma mark - - interaction IRTPReceiverChannelVideoForSettings - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelVideoForSettings, ForSettings) - - static void applyDefaults(); - - virtual ~IRTPReceiverChannelVideoForSettings() {} - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark - - interaction IRTPReceiverChannelVideoForRTPReceiverChannel : public IRTPReceiverChannelMediaBaseForRTPReceiverChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelVideoForRTPReceiverChannel, ForRTPReceiverChannel) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static ElementPtr toDebug(ForRTPReceiverChannelPtr object); - - static RTPReceiverChannelVideoPtr create( - RTPReceiverChannelPtr receiver, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark - - interaction IRTPReceiverChannelVideoForMediaStreamTrack : public IRTPReceiverChannelMediaBaseForMediaStreamTrack - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelVideoForMediaStreamTrack, ForMediaStreamTrack) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioForRTPMediaEngine - #pragma mark - - interaction IRTPReceiverChannelVideoForRTPMediaEngine : public IRTPReceiverChannelMediaBaseForRTPMediaEngine - { - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelVideoForRTPMediaEngine, ForRTPMediaEngine) - - static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoAsyncDelegate - #pragma mark - - interaction IRTPReceiverChannelVideoAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - virtual void onReceiverChannelVideoDeliverPackets() = 0; - virtual void onSecureTransportState(ISecureTransport::States state) = 0; - virtual void onUpdate(ParametersPtr params) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo - #pragma mark - - class RTPReceiverChannelVideo : public Noop, - public MessageQueueAssociator, - public SharedRecursiveLock, - public IRTPReceiverChannelVideoForSettings, - public IRTPReceiverChannelVideoForRTPReceiverChannel, - public IRTPReceiverChannelVideoForMediaStreamTrack, - public IRTPReceiverChannelVideoForRTPMediaEngine, - public IWakeDelegate, - public zsLib::ITimerDelegate, - public zsLib::IPromiseSettledDelegate, - public IRTPReceiverChannelVideoAsyncDelegate - { - protected: - struct make_private {}; - - public: - friend interaction IRTPReceiverChannelVideo; - friend interaction IRTPReceiverChannelVideoFactory; - friend interaction IRTPReceiverChannelVideoForSettings; - friend interaction IRTPReceiverChannelMediaBaseForRTPReceiverChannel; - friend interaction IRTPReceiverChannelVideoForRTPReceiverChannel; - friend interaction IRTPReceiverChannelMediaBaseForMediaStreamTrack; - friend interaction IRTPReceiverChannelVideoForMediaStreamTrack; - friend interaction IRTPReceiverChannelVideoForRTPMediaEngine; - - ZS_DECLARE_CLASS_PTR(Transport) - friend class Transport; - - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelForRTPReceiverChannelVideo, UseChannel) - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPReceiverChannelVideo, UseMediaStreamTrack) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPReceiverChannelVideo, UseMediaEngine) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineDeviceResource, UseDeviceResource) - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineVideoReceiverChannelResource, UseChannelResource) - - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForRTPReceiverChannel, ForReceiverChannelFromMediaBase) - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverChannelMediaBaseForMediaStreamTrack, ForMediaStreamTrackFromMediaBase) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - typedef std::list RTCPPacketList; - ZS_DECLARE_PTR(RTCPPacketList) - typedef std::queue RTPPacketQueue; - typedef std::queue RTCPPacketQueue; - - enum States - { - State_Pending, - State_Ready, - State_ShuttingDown, - State_Shutdown, - }; - static const char *toString(States state); - - public: - RTPReceiverChannelVideo( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr receiverChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ); - - protected: - RTPReceiverChannelVideo(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : - Noop(true), - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()) - {} - - void init(); - - public: - virtual ~RTPReceiverChannelVideo(); - - static RTPReceiverChannelVideoPtr convert(ForSettingsPtr object); - static RTPReceiverChannelVideoPtr convert(ForReceiverChannelFromMediaBasePtr object); - static RTPReceiverChannelVideoPtr convert(ForRTPReceiverChannelPtr object); - static RTPReceiverChannelVideoPtr convert(ForMediaStreamTrackFromMediaBasePtr object); - static RTPReceiverChannelVideoPtr convert(ForMediaStreamTrackPtr object); - static RTPReceiverChannelVideoPtr convert(ForRTPMediaEnginePtr object); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark - - virtual PUID getID() const override {return mID;} - - virtual void notifyTransportState(ISecureTransportTypes::States state) override; - - virtual void notifyUpdate(ParametersPtr params) override; - - virtual bool handlePacket(RTPPacketPtr packet) override; - - virtual bool handlePacket(RTCPPacketPtr packet) override; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark - - static RTPReceiverChannelVideoPtr create( - RTPReceiverChannelPtr receiver, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPMediaEngine - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IWakeDelegate - #pragma mark - - virtual void onWake() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => ITimerDelegate - #pragma mark - - virtual void onTimer(ITimerPtr timer) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IPromiseSettledDelegate - #pragma mark - - virtual void onPromiseSettled(PromisePtr promise) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => IRTPReceiverChannelVideoAsyncDelegate - #pragma mark - - virtual void onReceiverChannelVideoDeliverPackets() override; - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => friend Transport - #pragma mark - - virtual bool SendRtcp(const uint8_t* packet, size_t length); - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo::Transport - #pragma mark - - class Transport : public webrtc::Transport - { - struct make_private {}; - - protected: - void init(); - - public: - Transport( - const make_private &, - RTPReceiverChannelVideoPtr outer - ); - - ~Transport(); - - static TransportPtr create(RTPReceiverChannelVideoPtr outer); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo::Transport => webrtc::Transport - #pragma mark - - virtual bool SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) override; - - virtual bool SendRtcp(const uint8_t* packet, size_t length) override; - - private: - TransportWeakPtr mThisWeak; - RTPReceiverChannelVideoWeakPtr mOuter; - }; - - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - bool isShuttingDown() const; - bool isShutdown() const; - - void step(); - bool stepChannelPromise(); - bool stepSetupChannel(); - - void cancel(); - - void setState(States state); - void setError(WORD error, const char *reason = NULL); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelVideo => (data) - #pragma mark - - AutoPUID mID; - RTPReceiverChannelVideoWeakPtr mThisWeak; - RTPReceiverChannelVideoPtr mGracefulShutdownReference; - - States mCurrentState {State_Pending}; - - WORD mLastError {}; - String mLastErrorReason; - - UseChannelWeakPtr mReceiverChannel; - - ParametersPtr mParameters; - - PromiseWithRTPMediaEngineChannelResourcePtr mChannelResourceLifetimeHolderPromise; - UseChannelResourcePtr mChannelResource; - - PromisePtr mCloseChannelPromise; - - Optional mKind; - UseMediaStreamTrackPtr mTrack; - - TransportPtr mTransport; // allow lifetime of callback to exist separate from "this" object - std::atomic mTransportState { ISecureTransport::State_Pending }; - - RTPPacketQueue mQueuedRTP; - RTCPPacketQueue mQueuedRTCP; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPReceiverChannelVideoFactory - #pragma mark - - interaction IRTPReceiverChannelVideoFactory - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static IRTPReceiverChannelVideoFactory &singleton(); - - virtual RTPReceiverChannelVideoPtr create( - RTPReceiverChannelPtr receiverChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - }; - - class RTPReceiverChannelVideoFactory : public IFactory {}; - } -} - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPReceiverChannelVideoAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) -ZS_DECLARE_PROXY_METHOD_0(onReceiverChannelVideoDeliverPackets) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) -ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPSender.h b/ortc/internal/ortc_RTPSender.h index 8b44bc4d..0106661c 100644 --- a/ortc/internal/ortc_RTPSender.h +++ b/ortc/internal/ortc_RTPSender.h @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -58,7 +59,6 @@ namespace ortc ZS_DECLARE_INTERACTION_PTR(ISecureTransportForRTPSender); ZS_DECLARE_INTERACTION_PTR(IRTPListenerForRTPSender); ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForRTPSender); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSender); ZS_DECLARE_INTERACTION_PROXY(IRTPSenderAsyncDelegate) @@ -66,120 +66,114 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForSettings - #pragma mark + // + // IRTPSenderForSettings + // interaction IRTPSenderForSettings { ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForSettings, ForSettings) - static void applyDefaults(); + static void applyDefaults() noexcept; - virtual ~IRTPSenderForSettings() {} + virtual ~IRTPSenderForSettings() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForRTPListener - #pragma mark + // + // IRTPSenderForRTPListener + // interaction IRTPSenderForRTPListener { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPListener, ForRTPListener) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPListener, ForRTPListener); - static ElementPtr toDebug(ForRTPListenerPtr transport); + static ElementPtr toDebug(ForRTPListenerPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual bool handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForRTPSenderChannel - #pragma mark + // + // IRTPSenderForRTPSenderChannel + // interaction IRTPSenderForRTPSenderChannel { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPSenderChannel, ForRTPSenderChannel) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForRTPSenderChannel, ForRTPSenderChannel); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSender, UseChannel) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSender, UseChannel); - static ElementPtr toDebug(ForRTPSenderChannelPtr transport); + static ElementPtr toDebug(ForRTPSenderChannelPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual bool sendPacket(RTPPacketPtr packet) = 0; - virtual bool sendPacket(RTCPPacketPtr packet) = 0; + virtual bool sendPacket(RTPPacketPtr packet) noexcept = 0; + virtual bool sendPacket(RTCPPacketPtr packet) noexcept = 0; virtual void notifyConflict( UseChannelPtr channel, IRTPTypes::SSRCType ssrc, bool selfDestruct - ) = 0; + ) noexcept = 0; - virtual void notifyDTMFSenderToneChanged(const char *tone) = 0; + virtual void notifyDTMFSenderToneChanged(const char *tone) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForDTMFSender - #pragma mark + // + // IRTPSenderForDTMFSender + // interaction IRTPSenderForDTMFSender : public IDTMFSender { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForDTMFSender, ForDTMFSender) - - static ElementPtr toDebug(ForDTMFSenderPtr transport); - - virtual PUID getID() const = 0; + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForDTMFSender, ForDTMFSender); - virtual IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) override { return subscribeDTMF(delegate); } - - virtual IDTMFSenderSubscriptionPtr subscribeDTMF(IDTMFSenderDelegatePtr delegate) = 0; + static ElementPtr toDebug(ForDTMFSenderPtr transport) noexcept; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderForMediaStreamTrack - #pragma mark + // + // IRTPSenderForMediaStreamTrack + // interaction IRTPSenderForMediaStreamTrack { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForMediaStreamTrack, ForMediaStreamTrack) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderForMediaStreamTrack, ForMediaStreamTrack); - static ElementPtr toDebug(ForMediaStreamTrackPtr transport); + static ElementPtr toDebug(ForMediaStreamTrackPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderAsyncDelegate - #pragma mark + // + // IRTPSenderAsyncDelegate + // interaction IRTPSenderAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSender, UseChannel) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSender, UseChannel); virtual void onDestroyChannel(UseChannelPtr channel) = 0; }; @@ -188,9 +182,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender - #pragma mark + // + // RTPSender + // class RTPSender : public Noop, public MessageQueueAssociator, @@ -238,9 +232,9 @@ namespace ortc typedef std::list SSRCList; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender::ChannelHolder - #pragma mark + // + // RTPSender::ChannelHolder + // struct ChannelHolder { @@ -248,37 +242,37 @@ namespace ortc UseChannelPtr mChannel; std::atomic mLastReportedState {ISecureTransport::State_Pending}; - ChannelHolder(); - ~ChannelHolder(); + ChannelHolder() noexcept; + ~ChannelHolder() noexcept; - PUID getID() const; - void notify(ISecureTransport::States state); + PUID getID() const noexcept; + void notify(ISecureTransport::States state) noexcept; - void notify(RTCPPacketListPtr packets); + void notify(RTCPPacketListPtr packets) noexcept; - void update(const Parameters ¶ms); + void update(const Parameters ¶ms) noexcept; - bool handle(RTCPPacketPtr packet); + bool handle(RTCPPacketPtr packet) noexcept; - void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats); + void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept; void insertDTMF( const char *tones, Milliseconds duration, Milliseconds interToneGap - ); + ) noexcept; - String toneBuffer() const; - Milliseconds duration() const; - Milliseconds interToneGap() const; + String toneBuffer() const noexcept; + Milliseconds duration() const noexcept; + Milliseconds interToneGap() const noexcept; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender::States - #pragma mark + // + // RTPSender::States + // enum States { @@ -287,227 +281,228 @@ namespace ortc State_ShuttingDown, State_Shutdown, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; public: RTPSender( const make_private &, IMessageQueuePtr queue, IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept(false); // throws InvalidParameters, InvalidStateError protected: - RTPSender(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : + RTPSender(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~RTPSender(); + virtual ~RTPSender() noexcept; - static RTPSenderPtr convert(IRTPSenderPtr object); - static RTPSenderPtr convert(ForSettingsPtr object); - static RTPSenderPtr convert(ForRTPListenerPtr object); - static RTPSenderPtr convert(ForRTPSenderChannelPtr object); - static RTPSenderPtr convert(ForDTMFSenderPtr object); - static RTPSenderPtr convert(ForMediaStreamTrackPtr object); + static RTPSenderPtr convert(IRTPSenderPtr object) noexcept; + static RTPSenderPtr convert(ForSettingsPtr object) noexcept; + static RTPSenderPtr convert(ForRTPListenerPtr object) noexcept; + static RTPSenderPtr convert(ForRTPSenderChannelPtr object) noexcept; + static RTPSenderPtr convert(ForDTMFSenderPtr object) noexcept; + static RTPSenderPtr convert(ForMediaStreamTrackPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IStatsProvider - #pragma mark + // + // RTPSender => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSender - #pragma mark + // + // RTPSender => IRTPSender + // - static ElementPtr toDebug(RTPSenderPtr receiver); + static ElementPtr toDebug(RTPSenderPtr receiver) noexcept; static RTPSenderPtr create( IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IRTPSenderSubscriptionPtr subscribe(IRTPSenderDelegatePtr delegate) override; + IRTPSenderSubscriptionPtr subscribe(IRTPSenderDelegatePtr delegate) noexcept override; - virtual IMediaStreamTrackPtr track() const override; - virtual IRTPTransportPtr transport() const override; - virtual IRTCPTransportPtr rtcpTransport() const override; + ortc::IMediaStreamTrackPtr track() const noexcept override; + IRTPTransportPtr transport() const noexcept override; + IRTCPTransportPtr rtcpTransport() const noexcept override; virtual void setTransport( IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ) override; - virtual PromisePtr setTrack(IMediaStreamTrackPtr track) override; + ) noexcept(false) override; // throws InvalidParameters + PromisePtr setTrack(ortc::IMediaStreamTrackPtr track) noexcept override; - static CapabilitiesPtr getCapabilities(Optional kind); + static CapabilitiesPtr getCapabilities(Optional kind) noexcept; - virtual PromisePtr send(const Parameters ¶meters) override; - virtual void stop() override; + PromisePtr send(const Parameters ¶meters) noexcept(false) override; // throws InvalidParameters + void stop() noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForRTPListener - #pragma mark + // + // RTPSender => IRTPSenderForRTPListener + // - // (duplciate) static ElementPtr toDebug(ForRTPListenerPtr transport); + // (duplciate) static ElementPtr toDebug(ForRTPListenerPtr transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; virtual bool handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) override; + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForRTPSenderChannel - #pragma mark + // + // RTPSender => IRTPSenderForRTPSenderChannel + // // (duplciate) static ElementPtr toDebug(ForRTPSenderChannelPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual bool sendPacket(RTPPacketPtr packet) override; - virtual bool sendPacket(RTCPPacketPtr packet) override; + bool sendPacket(RTPPacketPtr packet) noexcept override; + bool sendPacket(RTCPPacketPtr packet) noexcept override; virtual void notifyConflict( UseChannelPtr channel, IRTPTypes::SSRCType ssrc, bool selfDestruct - ) override; + ) noexcept override; - virtual void notifyDTMFSenderToneChanged(const char *tone) override; + void notifyDTMFSenderToneChanged(const char *tone) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForMediaStreamTrack - #pragma mark + // + // RTPSender => IRTPSenderForMediaStreamTrack + // - // (duplciate) static ElementPtr toDebug(ForMediaStreamTrackPtr transport); + // (duplciate) static ElementPtr toDebug(ForMediaStreamTrackPtr transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderForDTMFSender - #pragma mark + // + // RTPSender => IRTPSenderForDTMFSender + // - // (duplciate) static ElementPtr toDebug(ForRTPSenderPtr transport); + // (duplciate) static ElementPtr toDebug(ForRTPSenderPtr transport) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; + + //IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) noexcept override { return subscribeDTMF(delegate); } + + //virtual IDTMFSenderSubscriptionPtr subscribeDTMF(IDTMFSenderDelegatePtr delegate) noexcept = 0; - virtual IDTMFSenderSubscriptionPtr subscribeDTMF(IDTMFSenderDelegatePtr delegate) override; + IDTMFSenderSubscriptionPtr subscribe(IDTMFSenderDelegatePtr delegate) noexcept override; - virtual bool canInsertDTMF() const override; + bool canInsertDTMF() const noexcept override; virtual void insertDTMF( const char *tones, Milliseconds duration = Milliseconds(70), Milliseconds interToneGap = Milliseconds(70) - ) throw ( - InvalidStateError, - InvalidCharacterError - ) override; + ) noexcept(false) override; // throws InvalidStateError, InvalidCharacterError - virtual IRTPSenderPtr sender() const override; + IRTPSenderPtr sender() const noexcept override; - virtual String toneBuffer() const override; - virtual Milliseconds duration() const override; - virtual Milliseconds interToneGap() const override; + String toneBuffer() const noexcept override; + Milliseconds duration() const noexcept override; + Milliseconds interToneGap() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => ISecureTransportDelegate - #pragma mark + // + // RTPReceiver => ISecureTransportDelegate + // - virtual void onSecureTransportStateChanged( - ISecureTransportPtr transport, - ISecureTransport::States state - ) override; + void onSecureTransportStateChanged( + ISecureTransportPtr transport, + ISecureTransport::States state + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IWakeDelegate - #pragma mark + // + // RTPSender => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IDTMFSenderDelegate - #pragma mark + // + // RTPSender => IDTMFSenderDelegate + // - virtual void onDTMFSenderToneChanged( - IDTMFSenderPtr sender, - String tone - ) override; + void onDTMFSenderToneChanged( + IDTMFSenderPtr sender, + String tone + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => IRTPSenderAsyncDelegate - #pragma mark + // + // RTPSender => IRTPSenderAsyncDelegate + // - virtual void onDestroyChannel(UseChannelPtr channel) override; + void onDestroyChannel(UseChannelPtr channel) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiver => (friend ChannelHolder) - #pragma mark + // + // RTPReceiver => (friend ChannelHolder) + // - void notifyChannelGone(); + void notifyChannelGone() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (internal) - #pragma mark + // + // RTPSender => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); + void step() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - ChannelHolderPtr addChannel(ParametersPtr newParams); + ChannelHolderPtr addChannel(ParametersPtr newParams) noexcept; void updateChannel( ChannelHolderPtr channel, ParametersPtr newParams - ); - void removeChannel(ChannelHolderPtr channel); + ) noexcept; + void removeChannel(ChannelHolderPtr channel) noexcept; - void notifyChannelsOfTransportState(); + void notifyChannelsOfTransportState() noexcept; - ChannelHolderPtr getDTMFChannelHolder() const; + ChannelHolderPtr getDTMFChannelHolder() const noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (data) - #pragma mark + // + // RTPSender => (data) + // AutoPUID mID; RTPSenderWeakPtr mThisWeak; @@ -551,25 +546,25 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderFactory - #pragma mark + // + // IRTPSenderFactory + // interaction IRTPSenderFactory { typedef IRTPSenderTypes::Kinds Kinds; typedef IRTPSenderTypes::CapabilitiesPtr CapabilitiesPtr; - static IRTPSenderFactory &singleton(); + static IRTPSenderFactory &singleton() noexcept; virtual RTPSenderPtr create( IRTPSenderDelegatePtr delegate, - IMediaStreamTrackPtr track, + ortc::IMediaStreamTrackPtr track, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ); + ) noexcept; - virtual CapabilitiesPtr getCapabilities(Optional kind); + virtual CapabilitiesPtr getCapabilities(Optional kind) noexcept; }; class RTPSenderFactory : public IFactory {}; @@ -578,5 +573,5 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPSenderAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPSenderAsyncDelegate::UseChannelPtr, UseChannelPtr) -ZS_DECLARE_PROXY_METHOD_1(onDestroyChannel, UseChannelPtr) +ZS_DECLARE_PROXY_METHOD(onDestroyChannel, UseChannelPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPSenderChannel.h b/ortc/internal/ortc_RTPSenderChannel.h index 4b38a51b..bd924075 100644 --- a/ortc/internal/ortc_RTPSenderChannel.h +++ b/ortc/internal/ortc_RTPSenderChannel.h @@ -33,18 +33,18 @@ #include #include -#include #include #include #include #include #include +#include #include #include -#include +#include #define ORTC_SETTING_RTP_SENDER_CHANNEL_RETAG_RTP_PACKETS_AFTER_SSRC_NOT_SENT_IN_SECONDS "ortc/rtp-sender-channel/retag-rtp-packets-after-ssrc-not-sent-in-seconds" #define ORTC_SETTING_RTP_SENDER_CHANNEL_TAG_MID_RID_IN_RTCP_SDES "ortc/rtp-sender-channel/tag-mid-rid-in-rtcp-sdes" @@ -71,9 +71,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForRTPSender - #pragma mark + // + // IRTPSenderChannelForRTPSender + // interaction IRTPSenderChannelForRTPSender { @@ -84,82 +84,82 @@ namespace ortc ZS_DECLARE_PTR(RTCPPacketList); ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) + ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet); - static ElementPtr toDebug(ForRTPSenderPtr object); + static ElementPtr toDebug(ForRTPSenderPtr object) noexcept; static RTPSenderChannelPtr create( RTPSenderPtr sender, MediaStreamTrackPtr track, const Parameters ¶ms - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void notifyTrackChanged(MediaStreamTrackPtr track) = 0; + virtual void notifyTrackChanged(MediaStreamTrackPtr track) noexcept = 0; - virtual void notifyTransportState(ISecureTransportTypes::States state) = 0; + virtual void notifyTransportState(ISecureTransportTypes::States state) noexcept = 0; - virtual void notifyPackets(RTCPPacketListPtr packets) = 0; + virtual void notifyPackets(RTCPPacketListPtr packets) noexcept = 0; - virtual void notifyUpdate(const Parameters ¶ms) = 0; + virtual void notifyUpdate(const Parameters ¶ms) noexcept = 0; - virtual bool handlePacket(RTCPPacketPtr packet) = 0; + virtual bool handlePacket(RTCPPacketPtr packet) noexcept = 0; - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) = 0; + virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept = 0; virtual void insertDTMF( const char *tones, Milliseconds duration, Milliseconds interToneGap - ) = 0; + ) noexcept = 0; - virtual String toneBuffer() const = 0; - virtual Milliseconds duration() const = 0; - virtual Milliseconds interToneGap() const = 0; + virtual String toneBuffer() const noexcept = 0; + virtual Milliseconds duration() const noexcept = 0; + virtual Milliseconds interToneGap() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForRTPSenderChannelMediaBase - #pragma mark + // + // IRTPSenderChannelForRTPSenderChannelMediaBase + // interaction IRTPSenderChannelForRTPSenderChannelMediaBase { ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSenderChannelMediaBase, ForRTPSenderChannelMediaBase) - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual bool sendPacket(RTPPacketPtr packet) = 0; + virtual bool sendPacket(RTPPacketPtr packet) noexcept = 0; - virtual bool sendPacket(RTCPPacketPtr packet) = 0; + virtual bool sendPacket(RTCPPacketPtr packet) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForRTPSenderChannelAudio - #pragma mark + // + // IRTPSenderChannelForRTPSenderChannelAudio + // interaction IRTPSenderChannelForRTPSenderChannelAudio : public IRTPSenderChannelForRTPSenderChannelMediaBase { ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSenderChannelAudio, ForRTPSenderChannelAudio) - virtual void notifyDTMFSenderToneChanged(const char *tone) = 0; + virtual void notifyDTMFSenderToneChanged(const char *tone) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForRTPSenderChannelVideo - #pragma mark + // + // IRTPSenderChannelForRTPSenderChannelVideo + // interaction IRTPSenderChannelForRTPSenderChannelVideo : public IRTPSenderChannelForRTPSenderChannelMediaBase { @@ -170,35 +170,35 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // IRTPSenderChannelForMediaStreamTrack + // interaction IRTPSenderChannelForMediaStreamTrack { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForMediaStreamTrack, ForMediaStreamTrack) + ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForMediaStreamTrack, ForMediaStreamTrack); ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - static ElementPtr toDebug(ForMediaStreamTrackPtr object); + static ElementPtr toDebug(ForMediaStreamTrackPtr object) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; virtual int32_t sendAudioSamples( const void* audioSamples, const size_t numberOfSamples, const uint8_t numberOfChannels - ) = 0; + ) noexcept = 0; - virtual void sendVideoFrame(VideoFramePtr videoFrame) = 0; + virtual void sendVideoFrame(VideoFramePtr videoFrame) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAsyncDelegate - #pragma mark + // + // IRTPSenderChannelAsyncDelegate + // interaction IRTPSenderChannelAsyncDelegate { @@ -221,9 +221,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel - #pragma mark + // + // RTPSenderChannel + // class RTPSenderChannel : public Noop, public MessageQueueAssociator, @@ -270,9 +270,9 @@ namespace ortc State_ShuttingDown, State_Shutdown, }; - static const char *toString(States state); + static const char *toString(States state) noexcept; - ZS_DECLARE_STRUCT_PTR(TaggingInfo) + ZS_DECLARE_STRUCT_PTR(TaggingInfo); struct TaggingInfo { @@ -294,159 +294,159 @@ namespace ortc UseSenderPtr sender, UseMediaStreamTrackPtr track, const Parameters ¶ms - ); + ) noexcept; protected: - RTPSenderChannel(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : + RTPSenderChannel(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) noexcept : Noop(true), MessageQueueAssociator(queue), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~RTPSenderChannel(); + virtual ~RTPSenderChannel() noexcept; - static RTPSenderChannelPtr convert(ForRTPSenderPtr object); - static RTPSenderChannelPtr convert(ForRTPSenderChannelMediaBasePtr object); - static RTPSenderChannelPtr convert(ForRTPSenderChannelAudioPtr object); - static RTPSenderChannelPtr convert(ForRTPSenderChannelVideoPtr object); - static RTPSenderChannelPtr convert(ForMediaStreamTrackPtr object); + static RTPSenderChannelPtr convert(ForRTPSenderPtr object) noexcept; + static RTPSenderChannelPtr convert(ForRTPSenderChannelMediaBasePtr object) noexcept; + static RTPSenderChannelPtr convert(ForRTPSenderChannelAudioPtr object) noexcept; + static RTPSenderChannelPtr convert(ForRTPSenderChannelVideoPtr object) noexcept; + static RTPSenderChannelPtr convert(ForMediaStreamTrackPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelForRTPSender - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelForRTPSender + // - static ElementPtr toDebug(RTPSenderChannelPtr receiver); + static ElementPtr toDebug(RTPSenderChannelPtr receiver) noexcept; static RTPSenderChannelPtr create( RTPSenderPtr sender, MediaStreamTrackPtr track, const Parameters ¶ms - ); + ) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual void notifyTrackChanged(MediaStreamTrackPtr track) override; + void notifyTrackChanged(MediaStreamTrackPtr track) noexcept override; - virtual void notifyTransportState(ISecureTransportTypes::States state) override; + void notifyTransportState(ISecureTransportTypes::States state) noexcept override; - virtual void notifyPackets(RTCPPacketListPtr packets) override; + void notifyPackets(RTCPPacketListPtr packets) noexcept override; - virtual void notifyUpdate(const Parameters ¶ms) override; + void notifyUpdate(const Parameters ¶ms) noexcept override; - virtual bool handlePacket(RTCPPacketPtr packet) override; + bool handlePacket(RTCPPacketPtr packet) noexcept override; - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; + void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) noexcept override; virtual void insertDTMF( const char *tones, Milliseconds duration, Milliseconds interToneGap - ) override; + ) noexcept override; - virtual String toneBuffer() const override; - virtual Milliseconds duration() const override; - virtual Milliseconds interToneGap() const override; + String toneBuffer() const noexcept override; + Milliseconds duration() const noexcept override; + Milliseconds interToneGap() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelForRTPSenderChannelMediaBase - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelForRTPSenderChannelMediaBase + // - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual bool sendPacket(RTPPacketPtr packet) override; + bool sendPacket(RTPPacketPtr packet) noexcept override; - virtual bool sendPacket(RTCPPacketPtr packet) override; + bool sendPacket(RTCPPacketPtr packet) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelForRTPSenderChannelAudio - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelForRTPSenderChannelAudio + // - virtual void notifyDTMFSenderToneChanged(const char *tone) override; + void notifyDTMFSenderToneChanged(const char *tone) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelForRTPSenderChannelVideo - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelForRTPSenderChannelVideo + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelForMediaStreamTrack + // - // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr receiver); + // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr receiver) noexcept; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept= 0; - virtual int32_t sendAudioSamples( - const void* audioSamples, - const size_t numberOfSamples, - const uint8_t numberOfChannels - ) override; + int32_t sendAudioSamples( + const void* audioSamples, + const size_t numberOfSamples, + const uint8_t numberOfChannels + ) noexcept override; - virtual void sendVideoFrame(VideoFramePtr videoFrame) override; + void sendVideoFrame(VideoFramePtr videoFrame) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IWakeDelegate - #pragma mark + // + // RTPSenderChannel => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => ITimerDelegate - #pragma mark + // + // RTPSenderChannel => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => IRTPSenderChannelAsyncDelegate - #pragma mark + // + // RTPSenderChannel => IRTPSenderChannelAsyncDelegate + // - virtual void onTrackChanged(UseMediaStreamTrackPtr track) override; + void onTrackChanged(UseMediaStreamTrackPtr track) override; - virtual void onSecureTransportState(ISecureTransport::States state) override; + void onSecureTransportState(ISecureTransport::States state) override; - virtual void onNotifyPackets(RTCPPacketListPtr packets) override; + void onNotifyPackets(RTCPPacketListPtr packets) override; - virtual void onUpdate(ParametersPtr params) override; + void onUpdate(ParametersPtr params) override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => (internal) - #pragma mark + // + // RTPSenderChannel => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); + void step() noexcept; - void cancel(); + void cancel() noexcept; - void setState(States state); - void setError(WORD error, const char *reason = NULL); + void setState(States state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - void setupTagging(); + void setupTagging() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannel => (data) - #pragma mark + // + // RTPSenderChannel => (data) + // AutoPUID mID; RTPSenderChannelWeakPtr mThisWeak; @@ -478,7 +478,7 @@ namespace ortc Optional mKind; UseMediaStreamTrackPtr mTrack; - // NO lockk is needed: + // NO lock is needed: UseMediaBasePtr mMediaBase; // valid UseAudioPtr mAudio; // either UseVideoPtr mVideo; // or valid @@ -488,21 +488,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelFactory - #pragma mark + // + // IRTPSenderChannelFactory + // interaction IRTPSenderChannelFactory { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - static IRTPSenderChannelFactory &singleton(); + static IRTPSenderChannelFactory &singleton() noexcept; virtual RTPSenderChannelPtr create( RTPSenderPtr sender, MediaStreamTrackPtr track, const Parameters ¶ms - ); + ) noexcept; }; class RTPSenderChannelFactory : public IFactory {}; @@ -514,8 +514,8 @@ ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPSenderChannelAsyncDelegate::RTCPPacketListPtr, RTCPPacketListPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IRTPSenderChannelAsyncDelegate::ParametersPtr, ParametersPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::IMediaStreamTrackForRTPSenderChannel, UseMediaStreamTrack) -ZS_DECLARE_PROXY_METHOD_1(onTrackChanged, UseMediaStreamTrackPtr) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onNotifyPackets, RTCPPacketListPtr) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) +ZS_DECLARE_PROXY_METHOD(onTrackChanged, UseMediaStreamTrackPtr) +ZS_DECLARE_PROXY_METHOD(onSecureTransportState, States) +ZS_DECLARE_PROXY_METHOD(onNotifyPackets, RTCPPacketListPtr) +ZS_DECLARE_PROXY_METHOD(onUpdate, ParametersPtr) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPSenderChannelAudio.h b/ortc/internal/ortc_RTPSenderChannelAudio.h deleted file mode 100644 index a5383f92..00000000 --- a/ortc/internal/ortc_RTPSenderChannelAudio.h +++ /dev/null @@ -1,492 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" - -#define ORTC_SENDER_CHANNEL_PENDING_TONE_LOCK_OUT_MAGIC_STRING "PENDING" - -namespace ortc -{ - namespace internal - { - ZS_DECLARE_USING_PTR(zsLib, Event) - - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelAudioForSettings) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForRTPSenderChannel) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelAudioForRTPSenderChannel) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForMediaStreamTrack) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelAudioForMediaStreamTrack) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelAudioForRTPMediaEngine) - - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForRTPSenderChannelMediaBase) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForRTPSenderChannelAudio) - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase) - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelAudio) - - ZS_DECLARE_INTERACTION_PROXY(IRTPSenderChannelAudioAsyncDelegate) - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark - - interaction IRTPSenderChannelAudioForRTPSenderChannel : public IRTPSenderChannelMediaBaseForRTPSenderChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelAudioForRTPSenderChannel, ForRTPSenderChannel) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static RTPSenderChannelAudioPtr create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - virtual int32_t sendAudioSamples( - const void* audioSamples, - const size_t numberOfSamples, - const uint8_t numberOfChannels - ) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioForMediaStreamTrack - #pragma mark - - interaction IRTPSenderChannelAudioForMediaStreamTrack : public IRTPSenderChannelMediaBaseForMediaStreamTrack - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelAudioForMediaStreamTrack, ForMediaStreamTrack) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioForRTPMediaEngine - #pragma mark - - interaction IRTPSenderChannelAudioForRTPMediaEngine : public IRTPSenderChannelMediaBaseForRTPMediaEngine - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelAudioForRTPMediaEngine, ForRTPMediaEngine) - - static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioAsyncDelegate - #pragma mark - - interaction IRTPSenderChannelAudioAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - - virtual void onSecureTransportState(ISecureTransport::States state) = 0; - virtual void onUpdate(ParametersPtr params) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio - #pragma mark - - class RTPSenderChannelAudio : public Noop, - public MessageQueueAssociator, - public SharedRecursiveLock, - public IRTPSenderChannelAudioForRTPSenderChannel, - public IRTPSenderChannelAudioForMediaStreamTrack, - public IRTPSenderChannelAudioForRTPMediaEngine, - public IWakeDelegate, - public IDTMFSenderDelegate, - public zsLib::ITimerDelegate, - public zsLib::IPromiseSettledDelegate, - public IRTPSenderChannelAudioAsyncDelegate - { - protected: - struct make_private {}; - - public: - friend interaction IRTPSenderChannelAudio; - friend interaction IRTPSenderChannelAudioFactory; - friend interaction IRTPSenderChannelMediaBaseForRTPSenderChannel; - friend interaction IRTPSenderChannelAudioForRTPSenderChannel; - friend interaction IRTPSenderChannelMediaBaseForMediaStreamTrack; - friend interaction IRTPSenderChannelAudioForMediaStreamTrack; - friend interaction IRTPSenderChannelAudioForRTPMediaEngine; - - ZS_DECLARE_CLASS_PTR(Transport) - friend class Transport; - - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSenderChannelAudio, UseChannel); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase, UseBaseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelAudio, UseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPSenderChannelAudio, UseMediaEngine); - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineDeviceResource, UseDeviceResource); - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineAudioSenderChannelResource, UseChannelResource); - - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPSenderChannel, ForRTPSenderChannelFromMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForMediaStreamTrack, ForMediaStreamTrackFromMediaBase); - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - typedef std::list RTCPPacketList; - ZS_DECLARE_PTR(RTCPPacketList); - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - enum States - { - State_Pending, - State_Ready, - State_ShuttingDown, - State_Shutdown, - }; - static const char *toString(States state); - - ZS_DECLARE_STRUCT_PTR(ToneInfo); - - struct ToneInfo - { - String mTones; - Milliseconds mDuration {}; - Milliseconds mInterToneGap {}; - - ElementPtr toDebug() const; - }; - - typedef std::list ToneInfoList; - - public: - RTPSenderChannelAudio( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr senderChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ); - - protected: - RTPSenderChannelAudio(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : - Noop(true), - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()) - {} - - void init(); - - public: - virtual ~RTPSenderChannelAudio(); - - static RTPSenderChannelAudioPtr convert(ForRTPSenderChannelFromMediaBasePtr object); - static RTPSenderChannelAudioPtr convert(ForRTPSenderChannelPtr object); - static RTPSenderChannelAudioPtr convert(ForMediaStreamTrackFromMediaBasePtr object); - static RTPSenderChannelAudioPtr convert(ForMediaStreamTrackPtr object); - static RTPSenderChannelAudioPtr convert(ForRTPMediaEnginePtr object); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark - - virtual PUID getID() const override {return mID;} - - virtual void onTrackChanged(UseBaseMediaStreamTrackPtr track) override; - - virtual void notifyTransportState(ISecureTransportTypes::States state) override; - - virtual void notifyUpdate(ParametersPtr params) override; - - virtual bool handlePacket(RTCPPacketPtr packet) override; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; - - virtual void insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) override; - - virtual String toneBuffer() const override; - virtual Milliseconds duration() const override; - virtual Milliseconds interToneGap() const override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark - - static RTPSenderChannelAudioPtr create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - virtual int32_t sendAudioSamples( - const void* audioSamples, - const size_t numberOfSamples, - const uint8_t numberOfChannels - ) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelAudioForMediaStreamTrack - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPMediaEngine - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IWakeDelegate - #pragma mark - - virtual void onWake() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IDTMFSenderDelegate - #pragma mark - - virtual void onDTMFSenderToneChanged( - IDTMFSenderPtr sender, - String tone - ) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => ITimerDelegate - #pragma mark - - virtual void onTimer(ITimerPtr timer) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverChannelAudio => IPromiseSettledDelegate - #pragma mark - - virtual void onPromiseSettled(PromisePtr promise) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => IRTPSenderChannelAudioAsyncDelegate - #pragma mark - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => friend Transport - #pragma mark - - virtual bool SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ); - - virtual bool SendRtcp(const uint8_t* packet, size_t length); - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio::Transport - #pragma mark - - class Transport : public webrtc::Transport - { - struct make_private {}; - - protected: - void init(); - - public: - Transport( - const make_private &, - RTPSenderChannelAudioPtr outer - ); - - ~Transport(); - - static TransportPtr create(RTPSenderChannelAudioPtr outer); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio::Transport => webrtc::Transport - #pragma mark - - virtual bool SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) override; - - virtual bool SendRtcp(const uint8_t* packet, size_t length) override; - - private: - TransportWeakPtr mThisWeak; - RTPSenderChannelAudioWeakPtr mOuter; - }; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - bool isShuttingDown() const; - bool isShutdown() const; - - void step(); - bool stepSetupChannel(); - - void cancel(); - - void setState(States state); - void setError(WORD error, const char *reason = NULL); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelAudio => (data) - #pragma mark - - AutoPUID mID; - RTPSenderChannelAudioWeakPtr mThisWeak; - RTPSenderChannelAudioPtr mGracefulShutdownReference; - - States mCurrentState {State_Pending}; - - WORD mLastError {}; - String mLastErrorReason; - - UseChannelWeakPtr mSenderChannel; - - ParametersPtr mParameters; - - PromiseWithRTPMediaEngineChannelResourcePtr mChannelResourceLifetimeHolderPromise; - UseChannelResourcePtr mChannelResource; - - PromisePtr mCloseChannelPromise; - - Optional mKind; - UseMediaStreamTrackPtr mTrack; - - TransportPtr mTransport; // allow lifetime of callback to exist separate from "this" object - std::atomic mTransportState { ISecureTransport::State_Pending }; - - ToneInfoList mPendingTones; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelAudioFactory - #pragma mark - - interaction IRTPSenderChannelAudioFactory - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static IRTPSenderChannelAudioFactory &singleton(); - - virtual RTPSenderChannelAudioPtr create( - RTPSenderChannelPtr sender, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - }; - - class RTPSenderChannelAudioFactory : public IFactory {}; - } -} - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPSenderChannelAudioAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) -ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPSenderChannelMediaBase.h b/ortc/internal/ortc_RTPSenderChannelMediaBase.h deleted file mode 100644 index 6ea9fc06..00000000 --- a/ortc/internal/ortc_RTPSenderChannelMediaBase.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include -#include - -#include -#include - -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" - -namespace ortc -{ - namespace internal - { - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForRTPSenderChannel) - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForMediaStreamTrack) - - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForRTPSenderChannelMediaBase) - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase) - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark - - interaction IRTPSenderChannelMediaBaseForRTPSenderChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPSenderChannel, ForRTPSenderChannel); - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase, UseBaseMediaStreamTrack); - - ZS_DECLARE_TYPEDEF_PTR(IStatsProvider::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - - static ElementPtr toDebug(ForRTPSenderChannelPtr object); - - virtual PUID getID() const = 0; - - virtual void onTrackChanged(UseBaseMediaStreamTrackPtr track) = 0; - - virtual void notifyTransportState(ISecureTransportTypes::States state) = 0; - - virtual void notifyUpdate(ParametersPtr params) = 0; - - virtual bool handlePacket(RTCPPacketPtr packet) = 0; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) = 0; - - virtual void insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) = 0; - - virtual String toneBuffer() const = 0; - virtual Milliseconds duration() const = 0; - virtual Milliseconds interToneGap() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelMediaBaseForMediaStreamTrack - #pragma mark - - interaction IRTPSenderChannelMediaBaseForMediaStreamTrack - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForMediaStreamTrack, ForMediaStreamTrack) - - static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelMediaBaseForRTPMediaEngine - #pragma mark - - interaction IRTPSenderChannelMediaBaseForRTPMediaEngine - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPMediaEngine, ForRTPMediaEngine) - - static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - virtual PUID getID() const = 0; - }; - } -} diff --git a/ortc/internal/ortc_RTPSenderChannelVideo.h b/ortc/internal/ortc_RTPSenderChannelVideo.h deleted file mode 100644 index b1488482..00000000 --- a/ortc/internal/ortc_RTPSenderChannelVideo.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - - Copyright (c) 2015, Hookflash Inc. / Hookflash Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - The views and conclusions contained in the software and documentation are those - of the authors and should not be interpreted as representing official policies, - either expressed or implied, of the FreeBSD Project. - - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -//#define ORTC_SETTING_SCTP_TRANSPORT_MAX_MESSAGE_SIZE "ortc/sctp/max-message-size" - -namespace ortc -{ - namespace internal - { - ZS_DECLARE_USING_PTR(zsLib, Event); - - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForRTPSenderChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelVideoForRTPSenderChannel); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelMediaBaseForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelVideoForMediaStreamTrack); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelVideoForRTPMediaEngine); - - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForRTPSenderChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IRTPSenderChannelForRTPSenderChannelVideo); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackForRTPSenderChannelVideo); - - ZS_DECLARE_INTERACTION_PROXY(IRTPSenderChannelVideoAsyncDelegate); - - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark - - interaction IRTPSenderChannelVideoForRTPSenderChannel : public IRTPSenderChannelMediaBaseForRTPSenderChannel - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelVideoForRTPSenderChannel, ForRTPSenderChannel) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - static RTPSenderChannelVideoPtr create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - virtual void sendVideoFrame(VideoFramePtr videoFrame) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoForMediaStreamTrack - #pragma mark - - interaction IRTPSenderChannelVideoForMediaStreamTrack : public IRTPSenderChannelMediaBaseForMediaStreamTrack - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelVideoForMediaStreamTrack, ForMediaStreamTrack) - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoForRTPMediaEngine - #pragma mark - - interaction IRTPSenderChannelVideoForRTPMediaEngine : public IRTPSenderChannelMediaBaseForRTPMediaEngine - { - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelVideoForRTPMediaEngine, ForRTPMediaEngine) - - static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - virtual PUID getID() const = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoAsyncDelegate - #pragma mark - - interaction IRTPSenderChannelVideoAsyncDelegate - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - virtual void onSecureTransportState(ISecureTransport::States state) = 0; - virtual void onUpdate(ParametersPtr params) = 0; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo - #pragma mark - - class RTPSenderChannelVideo : public Noop, - public MessageQueueAssociator, - public SharedRecursiveLock, - public IRTPSenderChannelVideoForRTPSenderChannel, - public IRTPSenderChannelVideoForMediaStreamTrack, - public IRTPSenderChannelVideoForRTPMediaEngine, - public IWakeDelegate, - public zsLib::ITimerDelegate, - public zsLib::IPromiseSettledDelegate, - public IRTPSenderChannelVideoAsyncDelegate - { - protected: - struct make_private {}; - - public: - friend interaction IRTPSenderChannelVideo; - friend interaction IRTPSenderChannelVideoFactory; - friend interaction IRTPSenderChannelMediaBaseForRTPSenderChannel; - friend interaction IRTPSenderChannelVideoForRTPSenderChannel; - friend interaction IRTPSenderChannelMediaBaseForMediaStreamTrack; - friend interaction IRTPSenderChannelVideoForMediaStreamTrack; - friend interaction IRTPSenderChannelVideoForRTPMediaEngine; - - ZS_DECLARE_CLASS_PTR(Transport); - friend class Transport; - - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelForRTPSenderChannelVideo, UseChannel); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelMediaBase, UseBaseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(IMediaStreamTrackForRTPSenderChannelVideo, UseMediaStreamTrack); - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineForRTPSenderChannelAudio, UseMediaEngine); - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineDeviceResource, UseDeviceResource); - ZS_DECLARE_TYPEDEF_PTR(IRTPMediaEngineVideoSenderChannelResource, UseChannelResource); - - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForRTPSenderChannel, ForRTPSenderChannelFromMediaBase); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderChannelMediaBaseForMediaStreamTrack, ForMediaStreamTrackFromMediaBase); - - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); - typedef std::list RTCPPacketList; - ZS_DECLARE_PTR(RTCPPacketList); - ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); - ZS_DECLARE_TYPEDEF_PTR(IStatsReportTypes::StatsTypeSet, StatsTypeSet) - ZS_DECLARE_TYPEDEF_PTR(webrtc::VideoFrame, VideoFrame); - - enum States - { - State_Pending, - State_Ready, - State_ShuttingDown, - State_Shutdown, - }; - static const char *toString(States state); - - public: - RTPSenderChannelVideo( - const make_private &, - IMessageQueuePtr queue, - UseChannelPtr senderChannel, - UseMediaStreamTrackPtr track, - const Parameters ¶ms - ); - - protected: - RTPSenderChannelVideo(Noop, IMessageQueuePtr queue = IMessageQueuePtr()) : - Noop(true), - MessageQueueAssociator(queue), - SharedRecursiveLock(SharedRecursiveLock::create()) - {} - - void init(); - - public: - virtual ~RTPSenderChannelVideo(); - - static RTPSenderChannelVideoPtr convert(ForRTPSenderChannelFromMediaBasePtr object); - static RTPSenderChannelVideoPtr convert(ForRTPSenderChannelPtr object); - static RTPSenderChannelVideoPtr convert(ForMediaStreamTrackFromMediaBasePtr object); - static RTPSenderChannelVideoPtr convert(ForMediaStreamTrackPtr object); - static RTPSenderChannelVideoPtr convert(ForRTPMediaEnginePtr object); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark - - virtual PUID getID() const override {return mID;} - - virtual void onTrackChanged(UseBaseMediaStreamTrackPtr track) override; - - virtual void notifyTransportState(ISecureTransportTypes::States state) override; - - virtual void notifyUpdate(ParametersPtr params) override; - - virtual bool handlePacket(RTCPPacketPtr packet) override; - - virtual void requestStats(PromiseWithStatsReportPtr promise, const StatsTypeSet &stats) override; - - virtual void insertDTMF( - const char *tones, - Milliseconds duration, - Milliseconds interToneGap - ) override {} - - virtual String toneBuffer() const override { return String(); } - virtual Milliseconds duration() const override { return Milliseconds(); } - virtual Milliseconds interToneGap() const override { return Milliseconds(); } - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark - - static RTPSenderChannelVideoPtr create( - RTPSenderChannelPtr senderChannel, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - - virtual void sendVideoFrame(VideoFramePtr videoFrame) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelVideoForMediaStreamTrack - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForMediaStreamTrackPtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPMediaEngine - #pragma mark - - // (duplicate) static ElementPtr toDebug(ForRTPMediaEnginePtr object); - - // (duplicate) virtual PUID getID() const = 0; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IWakeDelegate - #pragma mark - - virtual void onWake() override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => ITimerDelegate - #pragma mark - - virtual void onTimer(ITimerPtr timer) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IPromiseSettledDelegate - #pragma mark - - virtual void onPromiseSettled(PromisePtr promise) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => IRTPSenderChannelVideoAsyncDelegate - #pragma mark - - virtual void onSecureTransportState(ISecureTransport::States state) override; - - virtual void onUpdate(ParametersPtr params) override; - - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => friend Transport - #pragma mark - - virtual bool SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ); - - virtual bool SendRtcp(const uint8_t* packet, size_t length); - - public: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo::Transport - #pragma mark - - class Transport : public webrtc::Transport - { - struct make_private {}; - - protected: - void init(); - - public: - Transport( - const make_private &, - RTPSenderChannelVideoPtr outer - ); - - ~Transport(); - - static TransportPtr create(RTPSenderChannelVideoPtr outer); - - public: - //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo::Transport => webrtc::Transport - #pragma mark - - virtual bool SendRtp( - const uint8_t* packet, - size_t length, - const webrtc::PacketOptions& options - ) override; - - virtual bool SendRtcp(const uint8_t* packet, size_t length) override; - - private: - TransportWeakPtr mThisWeak; - RTPSenderChannelVideoWeakPtr mOuter; - }; - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => (internal) - #pragma mark - - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; - - bool isShuttingDown() const; - bool isShutdown() const; - - void step(); - bool stepSetupChannel(); - - void cancel(); - - void setState(States state); - void setError(WORD error, const char *reason = NULL); - - protected: - //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderChannelVideo => (data) - #pragma mark - - AutoPUID mID; - RTPSenderChannelVideoWeakPtr mThisWeak; - RTPSenderChannelVideoPtr mGracefulShutdownReference; - - States mCurrentState {State_Pending}; - - WORD mLastError {}; - String mLastErrorReason; - - UseChannelWeakPtr mSenderChannel; - - ParametersPtr mParameters; - - PromiseWithRTPMediaEngineChannelResourcePtr mChannelResourceLifetimeHolderPromise; - UseChannelResourcePtr mChannelResource; - - PromisePtr mCloseChannelPromise; - - Optional mKind; - UseMediaStreamTrackPtr mTrack; - - TransportPtr mTransport; // allow lifetime of callback to exist separate from "this" object - std::atomic mTransportState { ISecureTransport::State_Pending }; - }; - - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - //------------------------------------------------------------------------- - #pragma mark - #pragma mark IRTPSenderChannelVideoFactory - #pragma mark - - interaction IRTPSenderChannelVideoFactory - { - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - - static IRTPSenderChannelVideoFactory &singleton(); - - virtual RTPSenderChannelVideoPtr create( - RTPSenderChannelPtr sender, - MediaStreamTrackPtr track, - const Parameters ¶ms - ); - }; - - class RTPSenderChannelVideoFactory : public IFactory {}; - } -} - -ZS_DECLARE_PROXY_BEGIN(ortc::internal::IRTPSenderChannelVideoAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransport::States, States) -ZS_DECLARE_PROXY_METHOD_1(onSecureTransportState, States) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) -ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_RTPTypes.h b/ortc/internal/ortc_RTPTypes.h index 3078517c..a3ebe84f 100644 --- a/ortc/internal/ortc_RTPTypes.h +++ b/ortc/internal/ortc_RTPTypes.h @@ -47,17 +47,17 @@ namespace ortc public: typedef IRTPTypes::PayloadType PayloadType; - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::CodecParameters, CodecParameters) - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::EncodingParameters, EncodingParameters) - ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters) - ZS_DECLARE_TYPEDEF_PTR(std::list, ParametersPtrList) + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::CodecParameters, CodecParameters); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::EncodingParameters, EncodingParameters); + ZS_DECLARE_TYPEDEF_PTR(IRTPTypes::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(std::list, ParametersPtrList); - ZS_DECLARE_TYPEDEF_PTR(Parameters, OldParameters) - ZS_DECLARE_TYPEDEF_PTR(Parameters, NewParameters) + ZS_DECLARE_TYPEDEF_PTR(Parameters, OldParameters); + ZS_DECLARE_TYPEDEF_PTR(Parameters, NewParameters); typedef std::pair OldNewParametersPair; - ZS_DECLARE_TYPEDEF_PTR(std::list, ParametersPtrPairList) + ZS_DECLARE_TYPEDEF_PTR(std::list, ParametersPtrPairList); struct FindCodecOptions { @@ -77,7 +77,7 @@ namespace ortc Optional mDisallowMultipleMatches; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; struct DecodedCodecInfo @@ -88,29 +88,29 @@ namespace ortc IRTPTypes::SupportedCodecs mSupportedCodec {IRTPTypes::SupportedCodec_Unknown}; IRTPTypes::CodecKinds mCodecKind {IRTPTypes::CodecKind_Unknown}; - DepthInfo() {} - DepthInfo(const DepthInfo &info) {(*this) = info;} - ElementPtr toDebug() const; + DepthInfo() noexcept {} + DepthInfo(const DepthInfo &info) noexcept {(*this) = info;} + ElementPtr toDebug() const noexcept; }; size_t mFilledDepth {}; DepthInfo mDepth[ORTC_INTERNAL_RTPTYPESHELPER_MAX_CODEC_DEPTH]; - DecodedCodecInfo() {} - DecodedCodecInfo(const DecodedCodecInfo &info) {(*this) = info;} - ElementPtr toDebug() const; + DecodedCodecInfo() noexcept {} + DecodedCodecInfo(const DecodedCodecInfo &info) noexcept {(*this) = info;} + ElementPtr toDebug() const noexcept; }; static void validateCodecParameters( const Parameters ¶ms, Optional &ioKind - ) throw (InvalidParameters); + ) noexcept(false); // throws InvalidParameters static void splitParamsIntoChannels( const Parameters ¶ms, ParametersPtrList &outParamsGroupedIntoChannels - ); + ) noexcept(false); static void calculateDeltaChangesInChannels( Optional kind, @@ -120,23 +120,23 @@ namespace ortc ParametersPtrList &outNewChannels, ParametersPtrPairList &outUpdatedChannels, ParametersPtrList &outRemovedChannels - ); + ) noexcept; static bool isGeneralizedSSRCCompatibleChange( const Parameters &oldParams, const Parameters &newParams - ); + ) noexcept; static bool isCompatibleCodec( const CodecParameters &oldCodec, const CodecParameters &newCodec, float &ioRank - ); + ) noexcept; static const CodecParameters *findCodec( const Parameters ¶ms, const FindCodecOptions &options - ); + ) noexcept; static const CodecParameters *pickCodec( Optional kind, @@ -144,19 +144,19 @@ namespace ortc Optional packetPayloadType = Optional(), const EncodingParameters *encoding = NULL, const EncodingParameters *baseEncoding = NULL - ); + ) noexcept; static bool isRankableMatch( Optional kind, const Parameters &oldChannelParams, const Parameters &newChannelParams, float &outRank - ); + ) noexcept; static EncodingParameters *findEncodingBase( Parameters &inParams, EncodingParameters *inEncoding - ); + ) noexcept; static EncodingParameters *pickEncodingToFill( Optional kind, @@ -164,9 +164,9 @@ namespace ortc Parameters &filledParams, const DecodedCodecInfo &decodedCodec, EncodingParameters * &outBaseEncoding - ); + ) noexcept; - static Optional getCodecsKind(const Parameters ¶ms); + static Optional getCodecsKind(const Parameters ¶ms) noexcept; static bool decodePacketCodecs( @@ -174,28 +174,28 @@ namespace ortc const RTPPacket &packet, const Parameters ¶ms, DecodedCodecInfo &decodedCodecInfo - ); + ) noexcept; static void getRTXCodecPayload( const BYTE *packetPayload, size_t packetPayloadSizeInBytes, const BYTE * &outInnterPayload, size_t &outInnerPayloadSizeBytes - ); + ) noexcept; static Optional getRedCodecPayload( const BYTE *packetPayload, size_t packetPayloadSizeInBytes, const BYTE * &outInnterPayload, size_t &outInnerPayloadSizeBytes - ); + ) noexcept; static Optional getFecRecoveryPayloadType( const BYTE *packetPayload, size_t packetPayloadSizeInBytes - ); + ) noexcept; - static Log::Params slog(const char *message); + static Log::Params slog(const char *message) noexcept; }; } } diff --git a/ortc/internal/ortc_RTPUtils.h b/ortc/internal/ortc_RTPUtils.h index b792381a..a14700ac 100644 --- a/ortc/internal/ortc_RTPUtils.h +++ b/ortc/internal/ortc_RTPUtils.h @@ -43,45 +43,45 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark RTPHelpers - #pragma mark + // + // RTPHelpers + // class RTPUtils { public: //RTP Utils - static WORD getBE16(const void* memory); - static DWORD getBE32(const void* memory); - - static void setBE16(void* memory, WORD v); - static void setBE32(void* memory, DWORD v); - - static int getRtpPayloadType(const void* data, size_t len); - static int getRtpSeqNum(const void* data, size_t len); - static DWORD getRtpTimestamp(const void* data, size_t len); - static DWORD getRtpSsrc(const void* data, size_t len); - static size_t getRtpHeaderLen(const void* data, size_t len); - static int getRtcpType(const void* data, size_t len); - static DWORD getRtcpSsrc(const void* data, size_t len); - //bool getRtpHeader(const void* data, size_t len, RtpHeader* header); - - static bool setRtpSsrc(void* data, size_t len, DWORD value); + static WORD getBE16(const void* memory) noexcept; + static DWORD getBE32(const void* memory) noexcept; + + static void setBE16(void* memory, WORD v) noexcept; + static void setBE32(void* memory, DWORD v) noexcept; + + static int getRtpPayloadType(const void* data, size_t len) noexcept; + static int getRtpSeqNum(const void* data, size_t len) noexcept; + static DWORD getRtpTimestamp(const void* data, size_t len) noexcept; + static DWORD getRtpSsrc(const void* data, size_t len) noexcept; + static size_t getRtpHeaderLen(const void* data, size_t len) noexcept; + static int getRtcpType(const void* data, size_t len) noexcept; + static DWORD getRtcpSsrc(const void* data, size_t len) noexcept; + //bool getRtpHeader(const void* data, size_t len, RtpHeader* header) noexcept; + + static bool setRtpSsrc(void* data, size_t len, DWORD value) noexcept; // Assumes version 2, no padding, no extensions, no csrcs. - //bool setRtpHeader(void* data, size_t len, const RtpHeader& header); + //bool setRtpHeader(void* data, size_t len, const RtpHeader& header) noexcept; - static bool isRtpPacket(const void* data, size_t len); - static bool isRTCPPacketType(const BYTE *data, size_t len); + static bool isRtpPacket(const void* data, size_t len) noexcept; + static bool isRTCPPacketType(const BYTE *data, size_t len) noexcept; // True if |payload type| is 0-127. - static bool isValidRtpPayloadType(int payload_type); + static bool isValidRtpPayloadType(int payload_type) noexcept; static Time ntpToTime( DWORD ntpMS, DWORD ntpLS - ); + ) noexcept; - static Log::Params slog(const char *message); + static Log::Params slog(const char *message) noexcept; }; } diff --git a/ortc/internal/ortc_SCTPTransport.h b/ortc/internal/ortc_SCTPTransport.h index 9ba7f6bf..302d7c6f 100644 --- a/ortc/internal/ortc_SCTPTransport.h +++ b/ortc/internal/ortc_SCTPTransport.h @@ -46,6 +46,7 @@ #include #include +#include #define ORTC_SETTING_SCTP_TRANSPORT_MAX_SESSIONS_PER_PORT "ortc/sctp/max-sessions-per-port" @@ -53,32 +54,32 @@ namespace ortc { namespace internal { - ZS_DECLARE_CLASS_PTR(SCTPInit) - ZS_DECLARE_CLASS_PTR(SCTPTransport) + ZS_DECLARE_CLASS_PTR(SCTPInit); + ZS_DECLARE_CLASS_PTR(SCTPTransport); - ZS_DECLARE_STRUCT_PTR(SCTPPacketIncoming) - ZS_DECLARE_STRUCT_PTR(SCTPPacketOutgoing) + ZS_DECLARE_STRUCT_PTR(SCTPPacketIncoming); + ZS_DECLARE_STRUCT_PTR(SCTPPacketOutgoing); - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForSettings) - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForDataChannel) - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForSCTPTransportListener) - ZS_DECLARE_INTERACTION_PTR(IDataChannelForSCTPTransport) - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportListenerForSCTPTransport) + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForSettings); + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForDataChannel); + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForSCTPTransportListener); + ZS_DECLARE_INTERACTION_PTR(IDataChannelForSCTPTransport); + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportListenerForSCTPTransport); - ZS_DECLARE_INTERACTION_PTR(IICETransportForDataTransport) + ZS_DECLARE_INTERACTION_PTR(IICETransportForDataTransport); - ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportAsyncDelegate) - ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportForDataChannelDelegate) + ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportAsyncDelegate); + ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportForDataChannelDelegate); - ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(ISCTPTransportForDataChannelSubscription, ISCTPTransportForDataChannelDelegate) + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(ISCTPTransportForDataChannelSubscription, ISCTPTransportForDataChannelDelegate); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark PayloadProtocolIdentifier - #pragma mark + // + // PayloadProtocolIdentifier + // enum SCTPPayloadProtocolIdentifier { @@ -95,15 +96,15 @@ namespace ortc SCTP_PPID_STRING_PARTIAL = 54, SCTP_PPID_STRING_LAST = 51, }; - const char *toString(SCTPPayloadProtocolIdentifier state); + const char *toString(SCTPPayloadProtocolIdentifier state) noexcept; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPPacketIncoming - #pragma mark + // + // SCTPPacketIncoming + // struct SCTPPacketIncoming { @@ -115,16 +116,16 @@ namespace ortc int mFlags {}; SecureByteBlockPtr mBuffer; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPPacketOutgoing - #pragma mark + // + // SCTPPacketOutgoing + // struct SCTPPacketOutgoing { @@ -136,94 +137,94 @@ namespace ortc Optional mMaxRetransmits; SecureByteBlockPtr mBuffer; - ElementPtr toDebug() const; + ElementPtr toDebug() const noexcept; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportForSettings - #pragma mark + // + // ISCTPTransportForSettings + // interaction ISCTPTransportForSettings { ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSettings, ForSettings) - static void applyDefaults(); + static void applyDefaults() noexcept; - virtual ~ISCTPTransportForSettings() {} + virtual ~ISCTPTransportForSettings() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportForDataChannel - #pragma mark + // + // ISCTPTransportForDataChannel + // interaction ISCTPTransportForDataChannel { - ZS_DECLARE_STRUCT_PTR(RejectReason) + ZS_DECLARE_STRUCT_PTR(RejectReason); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel, ForDataChannel) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForDataChannel, ForDataChannel); - ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, UseDataChannel) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelForSCTPTransport, UseDataChannel); - ZS_DECLARE_TYPEDEF_PTR(IDataChannelTypes::Parameters, Parameters) + ZS_DECLARE_TYPEDEF_PTR(IDataChannelTypes::Parameters, Parameters); - static ElementPtr toDebug(ForDataChannelPtr transport); + static ElementPtr toDebug(ForDataChannelPtr transport) noexcept; struct RejectReason : public Any { - RejectReason(WORD error, const char *reason) : mError(error), mErrorReason(reason) {} - static RejectReasonPtr create(WORD error, const char *reason) {return make_shared(error, reason);} + RejectReason(WORD error, const char *reason) noexcept : mError(error), mErrorReason(reason) {} + static RejectReasonPtr create(WORD error, const char *reason) noexcept {return make_shared(error, reason);} WORD mError {}; String mErrorReason; }; - virtual PUID getID() const = 0; + virtual PUID getRealID() const noexcept = 0; virtual void registerNewDataChannel( UseDataChannelPtr &ioDataChannel, WORD &ioSessionID - ) = 0; + ) noexcept(false) = 0; - virtual ISCTPTransportForDataChannelSubscriptionPtr subscribe(ISCTPTransportForDataChannelDelegatePtr delegate) = 0; + virtual ISCTPTransportForDataChannelSubscriptionPtr subscribe(ISCTPTransportForDataChannelDelegatePtr delegate) noexcept = 0; - virtual bool isShuttingDown() const = 0; - virtual bool isShutdown() const = 0; - virtual bool isReady() const = 0; + virtual bool isShuttingDown() const noexcept = 0; + virtual bool isShutdown() const noexcept = 0; + virtual bool isReady() const noexcept = 0; virtual void announceIncoming( UseDataChannelPtr dataChannel, ParametersPtr params - ) = 0; + ) noexcept = 0; - virtual PromisePtr sendDataNow(SCTPPacketOutgoingPtr packet) = 0; + virtual PromisePtr sendDataNow(SCTPPacketOutgoingPtr packet) noexcept = 0; virtual void requestShutdown( UseDataChannelPtr dataChannel, WORD sessionID - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportForSCTPTransportListener - #pragma mark + // + // ISCTPTransportForSCTPTransportListener + // interaction ISCTPTransportForSCTPTransportListener { - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, ForListener) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, ForListener); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSCTPTransport, UseListener) - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSCTPTransport, UseListener); + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport); ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportTypes::Capabilities, Capabilities); @@ -231,33 +232,33 @@ namespace ortc UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getRealID() const noexcept = 0; - virtual void start( - const Capabilities &remoteCapabilities, - WORD remotePort - ) throw (InvalidStateError, InvalidParameters) = 0; + virtual void startFromListener( + const Capabilities &remoteCapabilities, + WORD remotePort + ) noexcept(false) = 0; // throws InvalidStateError, InvalidParameters virtual bool handleDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; - virtual void notifyShutdown() = 0; + virtual void notifyShutdown() noexcept = 0; - virtual bool isShuttingDown() const = 0; - virtual bool isShutdown() const = 0; + virtual bool isShuttingDown() const noexcept = 0; + virtual bool isShutdown() const noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportAsyncDelegate - #pragma mark + // + // ISCTPTransportAsyncDelegate + // interaction ISCTPTransportAsyncDelegate { @@ -269,9 +270,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportForDataChannelDelegate - #pragma mark + // + // ISCTPTransportForDataChannelDelegate + // interaction ISCTPTransportForDataChannelDelegate { @@ -282,33 +283,33 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportForDataChannelSubscription - #pragma mark + // + // ISCTPTransportForDataChannelSubscription + // interaction ISCTPTransportForDataChannelSubscription { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual void cancel() = 0; + virtual void cancel() noexcept = 0; - virtual void background() = 0; + virtual void background() noexcept = 0; }; } } ZS_DECLARE_PROXY_BEGIN(ortc::internal::ISCTPTransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::SCTPPacketIncomingPtr, SCTPPacketIncomingPtr) -ZS_DECLARE_PROXY_METHOD_1(onIncomingPacket, SCTPPacketIncomingPtr) -ZS_DECLARE_PROXY_METHOD_0(onNotifiedToShutdown) +ZS_DECLARE_PROXY_METHOD(onIncomingPacket, SCTPPacketIncomingPtr) +ZS_DECLARE_PROXY_METHOD(onNotifiedToShutdown) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::internal::ISCTPTransportForDataChannelDelegate) -ZS_DECLARE_PROXY_METHOD_0(onSCTPTransportStateChanged) +ZS_DECLARE_PROXY_METHOD(onSCTPTransportStateChanged) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(ortc::internal::ISCTPTransportForDataChannelDelegate, ortc::internal::ISCTPTransportForDataChannelSubscription) -ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD_0(onSCTPTransportStateChanged) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onSCTPTransportStateChanged) ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() namespace ortc @@ -319,9 +320,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport - #pragma mark + // + // SCTPTransport + // class SCTPTransport : public Noop, public MessageQueueAssociator, @@ -330,6 +331,7 @@ namespace ortc public ISCTPTransportForSettings, public ISCTPTransportForDataChannel, public ISCTPTransportForSCTPTransportListener, + public ISCTPTransportDelegate, public IWakeDelegate, public zsLib::ITimerDelegate, public ISCTPTransportAsyncDelegate, @@ -357,6 +359,7 @@ namespace ortc typedef PUID DataChannelID; typedef std::map DataChannelMap; + typedef std::set DataChannelIDSet; typedef WORD SessionID; typedef std::map DataChannelSessionMap; @@ -383,115 +386,116 @@ namespace ortc InternalState_Last = InternalState_Shutdown, }; - static const char *toString(InternalStates state); - ISCTPTransportTypes::States toState(InternalStates state); + static const char *toString(InternalStates state) noexcept; + ISCTPTransportTypes::States toState(InternalStates state) noexcept; public: SCTPTransport( const make_private &, IMessageQueuePtr queue, + ISCTPTransportDelegatePtr originalDelegate, UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort = 0, WORD remotePort = 0 - ); + ) noexcept; - SCTPTransport(Noop) : + SCTPTransport(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} protected: - void init(); + void init() noexcept; public: - virtual ~SCTPTransport(); + virtual ~SCTPTransport() noexcept; - static SCTPTransportPtr convert(ISCTPTransportPtr object); - static SCTPTransportPtr convert(IDataTransportPtr object); - static SCTPTransportPtr convert(ForSettingsPtr object); - static SCTPTransportPtr convert(ForDataChannelPtr object); - static SCTPTransportPtr convert(ForListenerPtr object); + static SCTPTransportPtr convert(ISCTPTransportPtr object) noexcept; + static SCTPTransportPtr convert(IDataTransportPtr object) noexcept; + static SCTPTransportPtr convert(ForSettingsPtr object) noexcept; + static SCTPTransportPtr convert(ForDataChannelPtr object) noexcept; + static SCTPTransportPtr convert(ForListenerPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IStatsProvider - #pragma mark + // + // SCTPTransport => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransport - #pragma mark + // + // SCTPTransport => ISCTPTransport + // - static ElementPtr toDebug(SCTPTransportPtr transport); + static ElementPtr toDebug(SCTPTransportPtr transport) noexcept; static ISCTPTransportPtr create( ISCTPTransportDelegatePtr delegate, IDTLSTransportPtr transport, WORD localPort = 0 - ) throw (InvalidParameters, InvalidStateError); + ) noexcept(false); // throws InvalidParameters, InvalidStateError - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override; - virtual IDTLSTransportPtr transport() const override; - virtual ISCTPTransportTypes::States state() const override; + IDTLSTransportPtr transport() const noexcept override; + ISCTPTransportTypes::States state() const noexcept override; - virtual WORD port() const override; + WORD port() const noexcept override; - virtual WORD localPort() const override; - virtual Optional remotePort() const override; + WORD localPort() const noexcept override; + Optional remotePort() const noexcept override; - virtual PromiseWithSocketOptionsPtr getOptions(const SocketOptions &inWhichOptions); - virtual PromisePtr setOptions(const SocketOptions &inOptions); + PromiseWithSocketOptionsPtr getOptions(const SocketOptions &inWhichOptions) noexcept override; + PromisePtr setOptions(const SocketOptions &inOptions) noexcept override; - virtual void start( - const Capabilities &remoteCapabilities, - WORD remotePort - ) throw (InvalidStateError, InvalidParameters) override; - virtual void stop() override; + void start( + const Capabilities &remoteCapabilities, + WORD remotePort + ) noexcept(false) override; // throws InvalidStateError, InvalidParameters + void stop() noexcept override; - virtual ISCTPTransportSubscriptionPtr subscribe(ISCTPTransportDelegatePtr delegate) override; + ISCTPTransportSubscriptionPtr subscribe(ISCTPTransportDelegatePtr delegate) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportForDataChannel - #pragma mark + // + // SCTPTransport => ISCTPTransportForDataChannel + // // (duplciate) static ElementPtr toDebug(ForDataChannelPtr transport); - virtual void registerNewDataChannel( - UseDataChannelPtr &ioDataChannel, - WORD &ioSessionID - ) override; + void registerNewDataChannel( + UseDataChannelPtr &ioDataChannel, + WORD &ioSessionID + ) noexcept(false) override; // throws InvalidParameters - // (duplicate) virtual PUID getID() const = 0; - virtual ISCTPTransportForDataChannelSubscriptionPtr subscribe(ISCTPTransportForDataChannelDelegatePtr delegate) override; + PUID getRealID() const noexcept override { return mID; } + ISCTPTransportForDataChannelSubscriptionPtr subscribe(ISCTPTransportForDataChannelDelegatePtr delegate) noexcept override; - // (duplicate) virtual bool isShuttingDown() const override; - // (duplicate) virtual bool isShutdown() const override; - virtual bool isReady() const override; + // (duplicate) virtual bool isShuttingDown() const noexcept override; + // (duplicate) virtual bool isShutdown() const noexcept override; + bool isReady() const noexcept override; - virtual void announceIncoming( - UseDataChannelPtr dataChannel, - ParametersPtr params - ) override; + void announceIncoming( + UseDataChannelPtr dataChannel, + ParametersPtr params + ) noexcept override; - virtual PromisePtr sendDataNow(SCTPPacketOutgoingPtr packet) override; + PromisePtr sendDataNow(SCTPPacketOutgoingPtr packet) noexcept override; - virtual void requestShutdown( - UseDataChannelPtr dataChannel, - WORD sessionID - ) override; + void requestShutdown( + UseDataChannelPtr dataChannel, + WORD sessionID + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportForSCTPTransportListener - #pragma mark + // + // SCTPTransport => ISCTPTransportForSCTPTransportListener + // // (duplicate) virtual PUID getID() const = 0; @@ -499,138 +503,151 @@ namespace ortc UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort - ); + ) noexcept; - // (duplicate) virtual void start( - // const Capabilities &remoteCapabilities, - // WORD remotePort - // ) throw (InvalidStateError, InvalidParameters) = 0; + void startFromListener( + const Capabilities &remoteCapabilities, + WORD remotePort + ) noexcept(false) override; // throws InvalidStateError, InvalidParameters - virtual bool handleDataPacket( - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleDataPacket( + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual void notifyShutdown() override; + void notifyShutdown() noexcept override; - // (duplicate) virtual bool isShuttingDown() const = 0; - // (duplicate) virtual bool isShutdown() const = 0; + // (duplicate) virtual bool isShuttingDown() const noexcept = 0; + // (duplicate) virtual bool isShutdown() const noexcept = 0; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => friend SCTPInit - #pragma mark - - virtual bool notifySendSCTPPacket( - const BYTE *buffer, - size_t bufferLengthInBytes - ); + // + // SCTPTransport => friend SCTPInit + // + + bool notifySendSCTPPacket( + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept; + + //----------------------------------------------------------------------- + // + // SCTPTransport => ISCTPTransportDelegate + // + + void onSCTPTransportStateChange( + ISCTPTransportPtr transport, + ISCTPTransportTypes::States state + ) override; + void onSCTPTransportDataChannel( + ISCTPTransportPtr transport, + IDataChannelPtr channel + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IWakeDelegate - #pragma mark + // + // SCTPTransport => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ITimerDelegate - #pragma mark + // + // SCTPTransport => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportAsyncDelegate - #pragma mark + // + // SCTPTransport => ISCTPTransportAsyncDelegate + // - virtual void onIncomingPacket(SCTPPacketIncomingPtr packet) override; - virtual void onNotifiedToShutdown() override; + void onIncomingPacket(SCTPPacketIncomingPtr packet) override; + void onNotifiedToShutdown() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (friend SCTPInit) - #pragma mark + // + // SCTPTransport => (friend SCTPInit) + // - virtual IMessageQueuePtr getDeliveryQueue() const { return mDeliveryQueue; } + virtual IMessageQueuePtr getDeliveryQueue() const noexcept { return mDeliveryQueue; } //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISecureTransportDelegate - #pragma mark + // + // SCTPTransport => ISecureTransportDelegate + // - virtual void onSecureTransportStateChanged( - ISecureTransportPtr transport, - ISecureTransportTypes::States state - ) override; + void onSecureTransportStateChanged( + ISecureTransportPtr transport, + ISecureTransportTypes::States state + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (internal) - #pragma mark + // + // SCTPTransport => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const override; - bool isShutdown() const override; + bool isShuttingDown() const noexcept override; + bool isShutdown() const noexcept override; - void step(); - bool stepStartCalled(); - bool stepSecureTransport(); - bool stepOpen(); - bool stepDeliverIncomingPackets(); - bool stepConnected(); - bool stepResetStream(); + void step() noexcept; + bool stepStartCalled() noexcept; + bool stepSecureTransport() noexcept; + bool stepOpen() noexcept; + bool stepDeliverIncomingPackets() noexcept; + bool stepConnected() noexcept; + bool stepResetStream() noexcept; - void cancel(); + void cancel() noexcept; - void setState(InternalStates state); - void setError(WORD error, const char *reason = NULL); + void setState(InternalStates state) noexcept; + void setError(WORD error, const char *reason = NULL) noexcept; - bool openConnectSCTPSocket(); - bool openSCTPSocket(); - bool prepareSocket(struct socket *sock); + bool openConnectSCTPSocket() noexcept; + bool openSCTPSocket() noexcept; + bool prepareSocket(struct socket *sock) noexcept; - bool isSessionAvailable(WORD sessionID); + bool isSessionAvailable(WORD sessionID) noexcept; bool attemptSend( const SCTPPacketOutgoing &inPacket, bool &outWouldBlock - ); - void notifyWriteReady(); + ) noexcept; + void notifyWriteReady() noexcept; - void handleNotificationPacket(const sctp_notification ¬ification); - void handleNotificationAssocChange(const sctp_assoc_change &change); - void handleStreamResetEvent(const sctp_stream_reset_event &event); + void handleNotificationPacket(const sctp_notification ¬ification) noexcept; + void handleNotificationAssocChange(const sctp_assoc_change &change) noexcept; + void handleStreamResetEvent(const sctp_stream_reset_event &event) noexcept; - virtual bool internalGetOptions(SocketOptions &ioOptions) const; - virtual bool internalSetOptions(const SocketOptions &inOptions); + virtual bool internalGetOptions(SocketOptions &ioOptions) const noexcept; + virtual bool internalSetOptions(const SocketOptions &inOptions) noexcept; public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport::TearAwayData - #pragma mark + // + // SCTPTransport::TearAwayData + // struct TearAwayData { UseListenerPtr mListener; - ISCTPTransportDelegateWeakPtr mDelegate; - ISCTPTransportSubscriptionPtr mDefaultSubscription; }; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (data) - #pragma mark + // + // SCTPTransport => (data) + // AutoPUID mID; + mutable std::atomic mObtainedID {}; SCTPTransportWeakPtr mThisWeak; SCTPTransportPtr mGracefulShutdownReference; @@ -638,6 +655,7 @@ namespace ortc size_t mMaxSessionsPerPort {}; ISCTPTransportDelegateSubscriptions mSubscriptions; + ISCTPTransportSubscriptionPtr mDefaultSubscription; ISCTPTransportForDataChannelDelegateSubscriptions mDataChannelSubscriptions; @@ -649,10 +667,18 @@ namespace ortc UseListenerWeakPtr mListener; + // If the transport is started after an existing transport was created + // by the remote party then two SCTP transports will exist pointing + // to the same local:remote mapping. This redirection forwards all + // requests to the existing object to prevent mapping confusion. + SCTPTransportPtr mRedirectToExistingTransport; + ISCTPTransportSubscriptionPtr mRedirectToExistingTransportSubscription; + UseSecureTransportWeakPtr mSecureTransport; // no lock needed ISecureTransportSubscriptionPtr mSecureTransportSubscription; CapabilitiesPtr mCapabilities; + bool mStartedFromListener {}; SCTPTransportWeakPtr *mThisSocket {}; ISCTPTransportWeakPtr mTearAway; @@ -674,6 +700,8 @@ namespace ortc DataChannelSessionMap mPendingResetSessions; DataChannelSessionMap mQueuedResetSessions; + DataChannelIDSet mFilterSessionRequests; + bool mSettledRole {false}; WORD mCurrentAllocationSessionID {}; WORD mMinAllocationSessionID {0}; @@ -695,31 +723,31 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportFactory - #pragma mark + // + // ISCTPTransportFactory + // interaction ISCTPTransportFactory { typedef ISCTPTransportTypes::CapabilitiesPtr CapabilitiesPtr; - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, ForListener) - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSCTPTransport, UseListener) - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, ForListener); + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSCTPTransport, UseListener); + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport); - static ISCTPTransportFactory &singleton(); + static ISCTPTransportFactory &singleton() noexcept; virtual ForListenerPtr create( UseListenerPtr listener, UseSecureTransportPtr secureTransport, WORD localPort - ); + ) noexcept; virtual ISCTPTransportPtr create( ISCTPTransportDelegatePtr delegate, IDTLSTransportPtr transport, WORD localPort = 0 - ); + ) noexcept; }; class SCTPTransportFactory : public IFactory {}; @@ -735,24 +763,24 @@ ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::ISCTPTransportDelegatePtr, ISCTPTransportDele ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::ISCTPTransportTypes::Capabilities, Capabilities) ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::IDTLSTransportPtr, IDTLSTransportPtr) ZS_DECLARE_TEAR_AWAY_TYPEDEF(ortc::ISCTPTransportTypes::States, States) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_1(getStats, PromiseWithStatsReportPtr, const StatsTypeSet &) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(getID, PUID) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(transport, IDTLSTransportPtr) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(state, States) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(port, WORD) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(localPort, WORD) -ZS_DECLARE_TEAR_AWAY_METHOD_CONST_RETURN_0(remotePort, Optional) - virtual PromiseWithSocketOptionsPtr getOptions(const SocketOptions &inWhichOptions) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(getStats, PromiseWithStatsReportPtr, const StatsTypeSet &) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(getID, PUID) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(transport, IDTLSTransportPtr) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(state, States) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(port, WORD) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(localPort, WORD) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_CONST(remotePort, Optional) + PromiseWithSocketOptionsPtr getOptions(const SocketOptions &inWhichOptions) noexcept override { return getDelegate()->getOptions(inWhichOptions); } - virtual PromisePtr setOptions(const SocketOptions &inOptions) + PromisePtr setOptions(const SocketOptions &inOptions) noexcept override { return getDelegate()->setOptions(inOptions); } - virtual void start(const Capabilities & v1, WORD v2) throw (ortc::InvalidStateError, ortc::InvalidParameters) override { + void start(const Capabilities & v1, WORD v2) noexcept(false) override { // throws ortc::InvalidStateError, ortc::InvalidParameters getDelegate()->start(v1, v2); } -ZS_DECLARE_TEAR_AWAY_METHOD_0(stop) -ZS_DECLARE_TEAR_AWAY_METHOD_RETURN_1(subscribe, ISCTPTransportSubscriptionPtr, ISCTPTransportDelegatePtr) +ZS_DECLARE_TEAR_AWAY_METHOD_SYNC(stop) +ZS_DECLARE_TEAR_AWAY_METHOD_RETURN(subscribe, ISCTPTransportSubscriptionPtr, ISCTPTransportDelegatePtr) ZS_DECLARE_TEAR_AWAY_END() diff --git a/ortc/internal/ortc_SCTPTransportListener.h b/ortc/internal/ortc_SCTPTransportListener.h index 3c8ed827..4529ffe3 100644 --- a/ortc/internal/ortc_SCTPTransportListener.h +++ b/ortc/internal/ortc_SCTPTransportListener.h @@ -56,52 +56,52 @@ namespace ortc { namespace internal { - ZS_DECLARE_CLASS_PTR(SCTPTransportListener) + ZS_DECLARE_CLASS_PTR(SCTPTransportListener); - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForSCTPTransportListener) + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportForSCTPTransportListener); - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportListenerForSettings) - ZS_DECLARE_INTERACTION_PTR(ISCTPTransportListenerForSCTPTransport) + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportListenerForSettings); + ZS_DECLARE_INTERACTION_PTR(ISCTPTransportListenerForSCTPTransport); - ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportListenerAsyncDelegate) + ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportListenerAsyncDelegate); //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerForSettings - #pragma mark + // + // ISCTPTransportListenerForSettings + // interaction ISCTPTransportListenerForSettings { - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSettings, ForSettings) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSettings, ForSettings); - static void applyDefaults(); + static void applyDefaults() noexcept; - virtual ~ISCTPTransportListenerForSettings() {} + virtual ~ISCTPTransportListenerForSettings() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerForSCTPTransport - #pragma mark + // + // ISCTPTransportListenerForSCTPTransport + // interaction ISCTPTransportListenerForSCTPTransport { - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSCTPTransport, ForSCTPTransport) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportListenerForSCTPTransport, ForSCTPTransport); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, UseSCTPTransport) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, UseSCTPTransport); - static ElementPtr toDebug(ForSCTPTransportPtr transport); + static ElementPtr toDebug(ForSCTPTransportPtr transport) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual WORD allocateLocalPort() = 0; - virtual void deallocateLocalPort(WORD previouslyAllocatedLocalPort) = 0; + virtual WORD allocateLocalPort() noexcept = 0; + virtual void deallocateLocalPort(WORD previouslyAllocatedLocalPort) noexcept = 0; virtual void registerNewTransport( IDTLSTransportPtr dtlsTransport, @@ -109,32 +109,32 @@ namespace ortc WORD &ioLocalPort, bool localPortWasPreallocated, WORD &ioRemotePort - ) = 0; + ) noexcept(false) = 0; // throws InvalidParameters virtual void announceTransport( UseSCTPTransportPtr transport, WORD localPort, WORD remotePort - ) = 0; + ) noexcept = 0; virtual void notifyShutdown( UseSCTPTransport &transport, WORD localPort, WORD remotePort - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerAsyncDelegate - #pragma mark + // + // ISCTPTransportListenerAsyncDelegate + // interaction ISCTPTransportListenerAsyncDelegate { - virtual ~ISCTPTransportListenerAsyncDelegate() {}; + virtual ~ISCTPTransportListenerAsyncDelegate() noexcept {}; }; } } @@ -150,9 +150,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransportListener - #pragma mark + // + // SCTPTransportListener + // class SCTPTransportListener : public Noop, public MessageQueueAssociator, @@ -173,8 +173,8 @@ namespace ortc friend interaction ISCTPTransportListenerForSCTPTransport; friend interaction IDataTransportForSecureTransport; - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, UseSCTPTransport) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportForSCTPTransportListener, UseSCTPTransport); typedef DWORD LocalRemoteTupleID; typedef std::map TransportMap; @@ -194,136 +194,136 @@ namespace ortc const make_private &, IMessageQueuePtr queue, UseSecureTransportPtr secureTransport - ); + ) noexcept; - SCTPTransportListener(Noop) : + SCTPTransportListener(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} protected: - void init(); + void init() noexcept; public: - virtual ~SCTPTransportListener(); + virtual ~SCTPTransportListener() noexcept; - static SCTPTransportListenerPtr convert(ForSettingsPtr object); - static SCTPTransportListenerPtr convert(ForSCTPTransportPtr object); - static SCTPTransportListenerPtr convert(ForSecureTransportPtr object); + static SCTPTransportListenerPtr convert(ForSettingsPtr object) noexcept; + static SCTPTransportListenerPtr convert(ForSCTPTransportPtr object) noexcept; + static SCTPTransportListenerPtr convert(ForSecureTransportPtr object) noexcept; - static ElementPtr toDebug(SCTPTransportListenerPtr object); + static ElementPtr toDebug(SCTPTransportListenerPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransport - #pragma mark + // + // SCTPTransport => ISCTPTransport + // - static CapabilitiesPtr getCapabilities(); + static CapabilitiesPtr getCapabilities() noexcept; static ISCTPTransportListenerSubscriptionPtr listen( ISCTPTransportListenerDelegatePtr delegate, IDTLSTransportPtr transport, const Capabilities &remoteCapabilities - ); + ) noexcept(false); // throws InvalidParameters //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => ISCTPTransportListenerForSCTPTransport - #pragma mark - - virtual PUID getID() const override {return mID;} - - virtual WORD allocateLocalPort() override; - virtual void deallocateLocalPort(WORD previouslyAllocatedLocalPort) override; - - virtual void registerNewTransport( - IDTLSTransportPtr dtlsTransport, - UseSCTPTransportPtr &ioTransport, - WORD &ioLocalPort, - bool localPortWasPreallocated, - WORD &ioRemotePort - ) override; - - virtual void announceTransport( - UseSCTPTransportPtr transport, - WORD localPort, - WORD remotePort - ) override; - - virtual void notifyShutdown( - UseSCTPTransport &transport, - WORD localPort, - WORD remotePort - ) override; + // + // SCTPTransport => ISCTPTransportListenerForSCTPTransport + // + + PUID getID() const noexcept override {return mID;} + + WORD allocateLocalPort() noexcept override; + void deallocateLocalPort(WORD previouslyAllocatedLocalPort) noexcept override; + + void registerNewTransport( + IDTLSTransportPtr dtlsTransport, + UseSCTPTransportPtr &ioTransport, + WORD &ioLocalPort, + bool localPortWasPreallocated, + WORD &ioRemotePort + ) noexcept(false) override; // throws InvalidParameters + + void announceTransport( + UseSCTPTransportPtr transport, + WORD localPort, + WORD remotePort + ) noexcept override; + + void notifyShutdown( + UseSCTPTransport &transport, + WORD localPort, + WORD remotePort + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => IDataTransportForSecureTransport - #pragma mark + // + // SCTPTransport => IDataTransportForSecureTransport + // // (duplciate) static ElementPtr toDebug(ForDTLSTransportPtr transport); // (duplicate) virtual PUID getID() const = 0; - static ForSecureTransportPtr create(UseSecureTransportPtr transport); + static ForSecureTransportPtr create(UseSecureTransportPtr transport) noexcept; - virtual bool handleDataPacket( - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleDataPacket( + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransportListener => ISCTPTransportListenerAsyncDelegate - #pragma mark + // + // SCTPTransportListener => ISCTPTransportListenerAsyncDelegate + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransportListener => IWakeDelegate - #pragma mark + // + // SCTPTransportListener => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (internal) - #pragma mark + // + // SCTPTransport => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - void cancel(); + void step() noexcept; + void cancel() noexcept; virtual ISCTPTransportListenerSubscriptionPtr subscribe( ISCTPTransportListenerDelegatePtr originalDelegate, const Capabilities &remoteCapabilities - ); + ) noexcept; - WORD allocateLocalPort(WORD remotePort); + WORD allocateLocalPort(WORD remotePort) noexcept; void allocatePort( AllocatedPortMap &useMap, WORD port - ); + ) noexcept; void deallocatePort( AllocatedPortMap &useMap, WORD port - ); + ) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTransport => (data) - #pragma mark + // + // SCTPTransport => (data) + // AutoPUID mID; SCTPTransportListenerWeakPtr mThisWeak; @@ -356,28 +356,28 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISCTPTransportListenerFactory - #pragma mark + // + // ISCTPTransportListenerFactory + // interaction ISCTPTransportListenerFactory { - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportTypes::Capabilities, Capabilities) + ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportTypes::Capabilities, Capabilities); - ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, ForSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(IDataTransportForSecureTransport, ForSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForDataTransport, UseSecureTransport); - static ISCTPTransportListenerFactory &singleton(); + static ISCTPTransportListenerFactory &singleton() noexcept; virtual ISCTPTransportListenerSubscriptionPtr listen( ISCTPTransportListenerDelegatePtr delegate, IDTLSTransportPtr transport, const Capabilities &remoteCapabilities - ); + ) noexcept; - virtual ForSecureTransportPtr create(UseSecureTransportPtr transport); + virtual ForSecureTransportPtr create(UseSecureTransportPtr transport) noexcept; - virtual CapabilitiesPtr getCapabilities(); + virtual CapabilitiesPtr getCapabilities() noexcept; }; class SCTPTransportListenerFactory : public IFactory {}; diff --git a/ortc/internal/ortc_SRTPSDESTransport.h b/ortc/internal/ortc_SRTPSDESTransport.h index 82566aaa..0aacc6dd 100644 --- a/ortc/internal/ortc_SRTPSDESTransport.h +++ b/ortc/internal/ortc_SRTPSDESTransport.h @@ -45,21 +45,22 @@ namespace ortc { namespace internal { - ZS_DECLARE_INTERACTION_PTR(IICETransportForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(ISRTPTransportForSecureTransport) - ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSecureTransport) + ZS_DECLARE_INTERACTION_PTR(IICETransportForSecureTransport); + ZS_DECLARE_INTERACTION_PTR(ISRTPTransportForSecureTransport); + ZS_DECLARE_INTERACTION_PTR(IRTPListenerForSecureTransport); + + ZS_DECLARE_INTERACTION_PTR(ISRTPSDESTransportForSettings); + ZS_DECLARE_INTERACTION_PROXY(ISRTPSDESTransportAsyncDelegate); - ZS_DECLARE_INTERACTION_PTR(ISRTPSDESTransportForSettings) - ZS_DECLARE_INTERACTION_PROXY(ISRTPSDESTransportAsyncDelegate) //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportAsyncDelegate - #pragma mark + // + // ISRTPSDESTransportAsyncDelegate + // interaction ISRTPSDESTransportAsyncDelegate { @@ -71,9 +72,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport - #pragma mark + // + // SRTPSDESTransport + // class SRTPSDESTransport : public Noop, public MessageQueueAssociator, @@ -101,9 +102,9 @@ namespace ortc friend interaction ISecureTransportForSRTPTransport; friend interaction ISecureTransportForRTPListener; - ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport) - ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSecureTransport, UseSRTPTransport) - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForSecureTransport, UseRTPListener) + ZS_DECLARE_TYPEDEF_PTR(IICETransportForSecureTransport, UseICETransport); + ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSecureTransport, UseSRTPTransport); + ZS_DECLARE_TYPEDEF_PTR(IRTPListenerForSecureTransport, UseRTPListener); public: SRTPSDESTransport( @@ -111,10 +112,10 @@ namespace ortc IMessageQueuePtr queue, ISRTPSDESTransportDelegatePtr delegate, IICETransportPtr iceTransport - ); + ) noexcept(false); // throws InvalidParameters protected: - SRTPSDESTransport(Noop) : + SRTPSDESTransport(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) @@ -123,238 +124,238 @@ namespace ortc void init( const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ); + ) noexcept; public: - virtual ~SRTPSDESTransport(); + virtual ~SRTPSDESTransport() noexcept; - static SRTPSDESTransportPtr convert(ISRTPSDESTransportPtr object); - static SRTPSDESTransportPtr convert(ForRTPSenderPtr object); - static SRTPSDESTransportPtr convert(ForRTPReceiverPtr object); - static SRTPSDESTransportPtr convert(ForICETransportPtr object); - static SRTPSDESTransportPtr convert(ForSRTPPtr object); - static SRTPSDESTransportPtr convert(ForRTPListenerPtr object); + static SRTPSDESTransportPtr convert(ISRTPSDESTransportPtr object) noexcept; + static SRTPSDESTransportPtr convert(ForRTPSenderPtr object) noexcept; + static SRTPSDESTransportPtr convert(ForRTPReceiverPtr object) noexcept; + static SRTPSDESTransportPtr convert(ForICETransportPtr object) noexcept; + static SRTPSDESTransportPtr convert(ForSRTPPtr object) noexcept; + static SRTPSDESTransportPtr convert(ForRTPListenerPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => IStatsProvider - #pragma mark + // + // SRTPSDESTransport => IStatsProvider + // - virtual PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const override; + PromiseWithStatsReportPtr getStats(const StatsTypeSet &stats = StatsTypeSet()) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransport - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransport + // - static ElementPtr toDebug(SRTPSDESTransportPtr transport); + static ElementPtr toDebug(SRTPSDESTransportPtr transport) noexcept; static SRTPSDESTransportPtr create( ISRTPSDESTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ); + ) noexcept(false); // throws InvalidParameters - static SRTPSDESTransportPtr convert(IRTPTransportPtr rtpTransport); + static SRTPSDESTransportPtr convert(IRTPTransportPtr rtpTransport) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual ISRTPSDESTransportSubscriptionPtr subscribe(ISRTPSDESTransportDelegatePtr delegate) override; + ISRTPSDESTransportSubscriptionPtr subscribe(ISRTPSDESTransportDelegatePtr delegate) noexcept override; - virtual IICETransportPtr transport() const override; - virtual IICETransportPtr rtcpTransport() const override; + IICETransportPtr transport() const noexcept override; + IICETransportPtr rtcpTransport() const noexcept override; - static ParametersPtr getLocalParameters(); + static ParametersPtr getLocalParameters() noexcept; - virtual void stop() override; + void stop() noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransport - #pragma mark + // + // DTLSTransport => ISecureTransport + // // (duplicate) virtual PUID getID() const; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForRTPSender - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForRTPSender + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); // (duplicate) virtual PUID getID() const; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) override; + ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept override; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const override; + ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const noexcept override; virtual bool sendPacket( IICETypes::Components sendOverICETransport, IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) override; + ) noexcept override; - virtual IICETransportPtr getICETransport() const override; + IICETransportPtr getICETransport() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForRTPReceiver + // - // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); + // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport) noexcept; - // (duplicate) virtual PUID getID() const; + // (duplicate) virtual PUID getID() const noexcept; - // (duplicate) virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) = 0; - // (duplicate) virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const = 0; + // (duplicate) virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept = 0; + // (duplicate) virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored = ISecureTransportTypes::States()) const noexcept = 0; // (duplicate) virtual bool sendPacket( // IICETypes::Components sendOverICETransport, // IICETypes::Components packetType, // const BYTE *buffer, // size_t bufferLengthInBytes - // ) override; + // ) noexcept override; - // (duplicate) virtual IICETransportPtr getICETransport() const override; + // (duplicate) virtual IICETransportPtr getICETransport() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransportForICETransport - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransportForICETransport + // - // (duplicate) static ElementPtr toDebug(ForICETransportPtr transport); + // (duplicate) static ElementPtr toDebug(ForICETransportPtr transport) noexcept; - // (duplicate) virtual PUID getID() const; + // (duplicate) virtual PUID getID() const noexcept; - virtual void notifyAssociateTransportCreated( - IICETypes::Components associatedComponent, - ICETransportPtr assoicated - ) override; - - virtual bool handleReceivedPacket( - IICETypes::Components viaTransport, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; - virtual void handleReceivedSTUNPacket( - IICETypes::Components viaComponent, - STUNPacketPtr packet - ) override; + void notifyAssociateTransportCreated( + IICETypes::Components associatedComponent, + ICETransportPtr assoicated + ) noexcept override; + + bool handleReceivedPacket( + IICETypes::Components viaTransport, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; + void handleReceivedSTUNPacket( + IICETypes::Components viaComponent, + STUNPacketPtr packet + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForSRTPTransport - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForSRTPTransport + // // (duplicate) static ElementPtr toDebug(ForSRTPPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual bool sendEncryptedPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendEncryptedPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual bool handleReceivedDecryptedPacket( - IICETypes::Components viaTransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleReceivedDecryptedPacket( + IICETypes::Components viaTransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISecureTransportForRTPListener - #pragma mark + // + // SRTPSDESTransport => ISecureTransportForRTPListener + // // (duplicate) static ElementPtr toDebug(ForRTPListenerPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual RTPListenerPtr getListener() const override; + RTPListenerPtr getListener() const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransportForSettings - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransportForSettings + // - // (duplicate) static void applyDefaults(); + // (duplicate) static void applyDefaults() noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPSDESTransportAsyncDelegate - #pragma mark + // + // SRTPSDESTransport => ISRTPSDESTransportAsyncDelegate + // - virtual void onAttachRTCP() override; + void onAttachRTCP() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => ISRTPTransportDelegate - #pragma mark - - virtual void onSRTPTransportLifetimeRemaining( - ISRTPTransportPtr transport, - ULONG leastLifetimeRemainingPercentageForAllKeys, - ULONG overallLifetimeRemainingPercentage - ) override; + // + // SRTPSDESTransport => ISRTPTransportDelegate + // + + void onSRTPTransportLifetimeRemaining( + ISRTPTransportPtr transport, + ULONG leastLifetimeRemainingPercentageForAllKeys, + ULONG overallLifetimeRemainingPercentage + ) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => IICETransportDelegate - #pragma mark - - virtual void onICETransportStateChange( - IICETransportPtr transport, - IICETransport::States state - ) override; - - virtual void onICETransportCandidatePairAvailable( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; - virtual void onICETransportCandidatePairGone( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; - - virtual void onICETransportCandidatePairChanged( - IICETransportPtr transport, - CandidatePairPtr candidatePair - ) override; + // + // SRTPSDESTransport => IICETransportDelegate + // + + void onICETransportStateChange( + IICETransportPtr transport, + IICETransport::States state + ) override; + + void onICETransportCandidatePairAvailable( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; + void onICETransportCandidatePairGone( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; + + void onICETransportCandidatePairChanged( + IICETransportPtr transport, + CandidatePairPtr candidatePair + ) override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => (internal) - #pragma mark + // + // SRTPSDESTransport => (internal) + // - Log::Params log(const char *message) const; - Log::Params debug(const char *message) const; - ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + Log::Params debug(const char *message) const noexcept; + ElementPtr toDebug() const noexcept; - bool isShuttingDown() const; - bool isShutdown() const; + bool isShuttingDown() const noexcept; + bool isShutdown() const noexcept; - void step(); - void cancel(); + void step() noexcept; + void cancel() noexcept; - bool stepIceState(); + bool stepIceState() noexcept; - void setError(WORD error, const char *reason = NULL); - void setState(ISecureTransportTypes::States state); + void setError(WORD error, const char *reason = NULL) noexcept; + void setState(ISecureTransportTypes::States state) noexcept; - UseICETransportPtr fixRTCPTransport() const; + UseICETransportPtr fixRTCPTransport() const noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPSDESTransport => (data) - #pragma mark + // + // SRTPSDESTransport => (data) + // AutoPUID mID; SRTPSDESTransportWeakPtr mThisWeak; @@ -385,25 +386,25 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPSDESTransportFactory - #pragma mark + // + // ISRTPSDESTransportFactory + // interaction ISRTPSDESTransportFactory { typedef ISRTPSDESTransportTypes::CryptoParameters CryptoParameters; typedef ISRTPSDESTransportTypes::ParametersPtr ParametersPtr; - static ISRTPSDESTransportFactory &singleton(); + static ISRTPSDESTransportFactory &singleton() noexcept; virtual SRTPSDESTransportPtr create( ISRTPSDESTransportDelegatePtr delegate, IICETransportPtr iceTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ); + ) noexcept; - virtual ParametersPtr getLocalParameters(); + virtual ParametersPtr getLocalParameters() noexcept; }; class SRTPSDESTransportFactory : public IFactory {}; @@ -411,5 +412,5 @@ namespace ortc } ZS_DECLARE_PROXY_BEGIN(ortc::internal::ISRTPSDESTransportAsyncDelegate) -ZS_DECLARE_PROXY_METHOD_0(onAttachRTCP) +ZS_DECLARE_PROXY_METHOD(onAttachRTCP) ZS_DECLARE_PROXY_END() diff --git a/ortc/internal/ortc_SRTPTransport.h b/ortc/internal/ortc_SRTPTransport.h index 0f425510..0309d355 100644 --- a/ortc/internal/ortc_SRTPTransport.h +++ b/ortc/internal/ortc_SRTPTransport.h @@ -38,10 +38,7 @@ #include #include -// Forward declaration to avoid pulling in libsrtp headers here -struct srtp_event_data_t; -struct srtp_ctx_t; -struct srtp_policy_t; +#include "srtp.h" //#define ORTC_SETTING_SRTP_TRANSPORT_WARN_OF_KEY_LIFETIME_EXHAUGSTION_WHEN_REACH_PERCENTAGE_USSED "ortc/srtp/warm-key-lifetime-exhaustion-when-reach-percentage-used" @@ -62,72 +59,72 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportForSettings - #pragma mark + // + // ISRTPTransportForSettings + // interaction ISRTPTransportForSettings { - ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSettings, ForSettings) + ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSettings, ForSettings); - static void applyDefaults(); + static void applyDefaults() noexcept; - virtual ~ISRTPTransportForSettings() {} + virtual ~ISRTPTransportForSettings() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportForSecureTransport - #pragma mark + // + // ISRTPTransportForSecureTransport + // interaction ISRTPTransportForSecureTransport { - ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSecureTransport, ForSecureTransport) + ZS_DECLARE_TYPEDEF_PTR(ISRTPTransportForSecureTransport, ForSecureTransport); - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, UseSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::Parameters, Parameters) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::CryptoParameters, CryptoParameters) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::KeyParameters, KeyParameters) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, UseSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::CryptoParameters, CryptoParameters); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::KeyParameters, KeyParameters); - static ElementPtr toDebug(ForSecureTransportPtr transport); + static ElementPtr toDebug(ForSecureTransportPtr transport) noexcept; - static ParametersPtr getLocalParameters(); + static ParametersPtr getLocalParameters() noexcept; static ForSecureTransportPtr create( ISRTPTransportDelegatePtr delegate, UseSecureTransportPtr transport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ); + ) noexcept; - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; - virtual ISRTPTransportSubscriptionPtr subscribe(ISRTPTransportDelegatePtr delegate) = 0; + virtual ISRTPTransportSubscriptionPtr subscribe(ISRTPTransportDelegatePtr delegate) noexcept = 0; virtual bool handleReceivedPacket( IICETypes::Components viaTransport, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; virtual bool sendPacket( IICETypes::Components sendOverICETransport, IICETypes::Components component, const BYTE *buffer, size_t bufferLengthInBytes - ) = 0; + ) noexcept = 0; }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport - #pragma mark + // + // SRTPTransport + // class SRTPTransport : public Noop, public MessageQueueAssociator, @@ -145,19 +142,19 @@ namespace ortc friend interaction ISRTPTransportFactory; friend interaction ISRTPTransportForSecureTransport; - ZS_DECLARE_STRUCT_PTR(KeyingMaterial) - ZS_DECLARE_STRUCT_PTR(DirectionMaterial) + ZS_DECLARE_STRUCT_PTR(KeyingMaterial); + ZS_DECLARE_STRUCT_PTR(DirectionMaterial); - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, UseSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::Parameters, Parameters) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::CryptoParameters, CryptoParameters) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::KeyParameters, KeyParameters) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, UseSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::Parameters, Parameters); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::CryptoParameters, CryptoParameters); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::KeyParameters, KeyParameters); - ZS_DECLARE_TYPEDEF_PTR(SecureByteBlock, MKIValue) + ZS_DECLARE_TYPEDEF_PTR(SecureByteBlock, MKIValue); struct MKIValueCompare { - bool operator() (const SecureByteBlockPtr &op1, const SecureByteBlockPtr &op2) const; + bool operator() (const SecureByteBlockPtr &op1, const SecureByteBlockPtr &op2) const noexcept; }; typedef std::map KeyMap; @@ -172,7 +169,7 @@ namespace ortc Direction_Last = Direction_Decrypt }; - static const char *toString(Directions state); + static const char *toString(Directions state) noexcept; public: SRTPTransport( @@ -182,117 +179,117 @@ namespace ortc UseSecureTransportPtr secureTransport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) throw(InvalidParameters); + ) noexcept(false); // throws InvalidParameters protected: - SRTPTransport(Noop) : + SRTPTransport(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; public: - virtual ~SRTPTransport(); + virtual ~SRTPTransport() noexcept; - static SRTPTransportPtr convert(ISRTPTransportPtr object); - static SRTPTransportPtr convert(ForSecureTransportPtr object); + static SRTPTransportPtr convert(ISRTPTransportPtr object) noexcept; + static SRTPTransportPtr convert(ForSecureTransportPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ISRTPTransport - #pragma mark + // + // SRTPTransport => ISRTPTransport + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ISRTPTransportForSecureTransport - #pragma mark + // + // SRTPTransport => ISRTPTransportForSecureTransport + // - static ElementPtr toDebug(SRTPTransportPtr transport); + static ElementPtr toDebug(SRTPTransportPtr transport) noexcept; static SRTPTransportPtr create( ISRTPTransportDelegatePtr delegate, UseSecureTransportPtr transport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ) throw(InvalidParameters); + ) noexcept(false); // throws InvalidParameters - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual ISRTPTransportSubscriptionPtr subscribe(ISRTPTransportDelegatePtr delegate) override; + ISRTPTransportSubscriptionPtr subscribe(ISRTPTransportDelegatePtr delegate) noexcept override; - virtual bool handleReceivedPacket( - IICETypes::Components viaTransport, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleReceivedPacket( + IICETypes::Components viaTransport, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual bool sendPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components component, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components component, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => IWakeDelegate - #pragma mark + // + // SRTPTransport => IWakeDelegate + // - virtual void onWake() override; + void onWake() override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ITimerDelegate - #pragma mark + // + // SRTPTransport => ITimerDelegate + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => ISRTPTransportAsyncDelegate - #pragma mark + // + // SRTPTransport => ISRTPTransportAsyncDelegate + // protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => (internal) - #pragma mark + // + // SRTPTransport => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - void cancel(); + void cancel() noexcept; void updateTotalPackets( Directions direction, IICETypes::Components component, KeyingMaterialPtr &keyingMaterial - ); + ) noexcept; - static size_t parseLifetime(const String &lifetime) throw(InvalidParameters); + static size_t parseLifetime(const String &lifetime) noexcept(false); // throws InvalidParameters static SecureByteBlockPtr convertIntegerToBigEndianEncodedBuffer( const String &base10Value, size_t maxByteLength - ) throw(InvalidParameters); + ) noexcept(false); // throws InvalidParameters public: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport::SRTPSession - #pragma mark + // + // SRTPTransport::SRTPSession + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport::KeyingMaterial - #pragma mark + // + // SRTPTransport::KeyingMaterial + // struct KeyingMaterial { @@ -310,14 +307,14 @@ namespace ortc // E.g. (converted into proper useable format by crypto routines) - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport::DirectionMaterial - #pragma mark + // + // SRTPTransport::DirectionMaterial + // struct DirectionMaterial { @@ -335,15 +332,15 @@ namespace ortc size_t mTotalPackets[IICETypes::Component_Last+1] {}; size_t mMaxTotalLifetime[IICETypes::Component_Last+1] {}; - ElementPtr toDebug() const; - String hash() const; + ElementPtr toDebug() const noexcept; + String hash() const noexcept; }; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTransport => (data) - #pragma mark + // + // SRTPTransport => (data) + // AutoPUID mID; SRTPTransportWeakPtr mThisWeak; @@ -367,23 +364,23 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTransportFactory - #pragma mark + // + // ISRTPTransportFactory + // interaction ISRTPTransportFactory { - ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, UseSecureTransport) - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::CryptoParameters, CryptoParameters) + ZS_DECLARE_TYPEDEF_PTR(ISecureTransportForSRTPTransport, UseSecureTransport); + ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport::CryptoParameters, CryptoParameters); - static ISRTPTransportFactory &singleton(); + static ISRTPTransportFactory &singleton() noexcept; virtual SRTPTransportPtr create( ISRTPTransportDelegatePtr delegate, UseSecureTransportPtr transport, const CryptoParameters &encryptParameters, const CryptoParameters &decryptParameters - ); + ) noexcept; }; class SRTPTransportFactory : public IFactory {}; diff --git a/ortc/internal/ortc_StatsReport.h b/ortc/internal/ortc_StatsReport.h index 772277c8..b391a7f7 100644 --- a/ortc/internal/ortc_StatsReport.h +++ b/ortc/internal/ortc_StatsReport.h @@ -52,9 +52,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportForInternal - #pragma mark + // + // IStatsReportForInternal + // interaction IStatsReportForInternal { @@ -68,23 +68,23 @@ namespace ortc typedef String StatID; typedef std::map StatMap; - static StatsReportPtr create(const StatMap &stats); + static StatsReportPtr create(const StatMap &stats) noexcept; static PromiseWithStatsReportPtr collectReports( const PromiseWithStatsReportList &promises, PromiseWithStatsReportPtr previouslyCreatedPromiseToResolve = PromiseWithStatsReportPtr() - ); + ) noexcept; - virtual ~IStatsReportForInternal() {} + virtual ~IStatsReportForInternal() noexcept {} }; //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport - #pragma mark + // + // StatsReport + // class StatsReport : public Noop, public MessageQueueAssociator, @@ -112,79 +112,79 @@ namespace ortc const make_private &, IMessageQueuePtr queue, const StatMap &stats - ); + ) noexcept; protected: - StatsReport(Noop) : + StatsReport(Noop) noexcept : Noop(true), MessageQueueAssociator(IMessageQueuePtr()), SharedRecursiveLock(SharedRecursiveLock::create()) {} - void init(); + void init() noexcept; void init( PromiseWithStatsReportPtr resolvePromise, const PromiseWithStatsReportList &promises - ); + ) noexcept; public: - virtual ~StatsReport(); + virtual ~StatsReport() noexcept; - static StatsReportPtr convert(IStatsReportPtr object); - static StatsReportPtr convert(ForInternalPtr object); + static StatsReportPtr convert(IStatsReportPtr object) noexcept; + static StatsReportPtr convert(ForInternalPtr object) noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => IStatsReport - #pragma mark + // + // StatsReport => IStatsReport + // - static ElementPtr toDebug(StatsReportPtr report); + static ElementPtr toDebug(StatsReportPtr report) noexcept; - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual IDListPtr getStatesIDs() const override; - virtual StatsPtr getStats(const char *id) const override; + IDListPtr getStatesIDs() const noexcept override; + StatsPtr getStats(const char *id) const noexcept override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => IStatsReportForInternal - #pragma mark + // + // StatsReport => IStatsReportForInternal + // - static StatsReportPtr create(const StatMap &stats); + static StatsReportPtr create(const StatMap &stats) noexcept; static PromiseWithStatsReportPtr collectReports( const PromiseWithStatsReportList &promises, PromiseWithStatsReportPtr previouslyCreatedPromiseToResolve = PromiseWithStatsReportPtr() - ); + ) noexcept; //----------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => IPromiseSettledDelegate - #pragma mark + // + // StatsReport => IPromiseSettledDelegate + // - virtual void onPromiseSettled(PromisePtr promise) override; + void onPromiseSettled(PromisePtr promise) override; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => (internal) - #pragma mark + // + // StatsReport => (internal) + // - Log::Params log(const char *message) const; - static Log::Params slog(const char *message); - Log::Params debug(const char *message) const; - virtual ElementPtr toDebug() const; + Log::Params log(const char *message) const noexcept; + static Log::Params slog(const char *message) noexcept; + Log::Params debug(const char *message) const noexcept; + virtual ElementPtr toDebug() const noexcept; - void cancel(); + void cancel() noexcept; protected: //----------------------------------------------------------------------- - #pragma mark - #pragma mark StatsReport => (data) - #pragma mark + // + // StatsReport => (data) + // AutoPUID mID; StatsReportWeakPtr mThisWeak; @@ -199,9 +199,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark IStatsReportFactory - #pragma mark + // + // IStatsReportFactory + // interaction IStatsReportFactory { @@ -209,14 +209,14 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(IStatsProviderTypes::PromiseWithStatsReport, PromiseWithStatsReport); ZS_DECLARE_TYPEDEF_PTR(std::list, PromiseWithStatsReportList); - static IStatsReportFactory &singleton(); + static IStatsReportFactory &singleton() noexcept; - virtual StatsReportPtr create(const StatMap &stats); + virtual StatsReportPtr create(const StatMap &stats) noexcept; virtual PromiseWithStatsReportPtr collectReports( const PromiseWithStatsReportList &promises, PromiseWithStatsReportPtr previouslyCreatedPromiseToResolve = PromiseWithStatsReportPtr() - ); + ) noexcept; }; class StatsReportFactory : public IFactory {}; diff --git a/ortc/internal/platform.h b/ortc/internal/platform.h index f699b0cc..dbc35ec2 100644 --- a/ortc/internal/platform.h +++ b/ortc/internal/platform.h @@ -47,8 +47,8 @@ #ifdef _WIN32 #ifdef __cplusplus_winrt -#undef WINRT -#define WINRT +#undef WINUWP +#define WINUWP #endif //__cplusplus_winrt @@ -59,22 +59,22 @@ #define HAVE_SPRINTF_S 1 #define HAVE_GETADAPTERADDRESSES 1 -#ifdef WINRT +#ifdef WINUWP -// WINRT has these defined +// WINUWP has these defined -// WINRT does not support these features (but WIN32 does) +// WINUWP does not support these features (but WIN32 does) #undef HAVE_GETADAPTERADDRESSES #if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -// WINRT phone has these defined +// WINUWP phone has these defined -// WINRT phone odes not support these features (but WINRT does) +// WINUWP phone odes not support these features (but WINUWP does) #undef HAVE_IPHLPAPI_H #endif //defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -#endif //WINRT +#endif //WINUWP #endif //_WIN32 @@ -108,21 +108,22 @@ #endif //__APPPLE__ -#ifdef _LINUX +#ifdef __linux__ // Linux has these options #define HAVE_SYS_TYPES_H 1 #define HAVE_IFADDRS_H 1 #define HAVE_NET_IF_H 1 -#define HAVE_NETINIT6_IN6_VAR_H 1 +//#define HAVE_NETINIT6_IN6_VAR_H 1 #define HAVE_GETIFADDRS 1 -#ifdef _ANDROID +#ifdef ANDROID // Android supports these additional features // Android does not support these features #undef HAVE_IFADDRS_H +#undef HAVE_GETIFADDRS -#endif //_ANDROID -#endif //_LINUX +#endif //ANDROID +#endif //__linux__ diff --git a/ortc/internal/types.h b/ortc/internal/types.h index d962b54f..e2f94b93 100644 --- a/ortc/internal/types.h +++ b/ortc/internal/types.h @@ -105,12 +105,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (forwards) - #pragma mark - - ZS_DECLARE_CLASS_PTR(RTPPacket); - ZS_DECLARE_CLASS_PTR(RTCPPacket); + // + // (forwards) + // ZS_DECLARE_INTERACTION_PTR(IDataTransportForSecureTransport); ZS_DECLARE_INTERACTION_PTR(ISecureTransport); @@ -119,6 +116,20 @@ namespace ortc ZS_DECLARE_INTERACTION_PTR(ISecureTransportForICETransport); ZS_DECLARE_INTERACTION_PTR(ISecureTransportForRTPListener); ZS_DECLARE_INTERACTION_PTR(ISRTPTransport); + ZS_DECLARE_INTERACTION_PTR(IMediaDevice); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCapture); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceCaptureVideo); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceRender); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceRenderAudio); + ZS_DECLARE_INTERACTION_PTR(IMediaDeviceRenderVideo); + ZS_DECLARE_INTERACTION_PTR(IRTP); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoder); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderAudio); + ZS_DECLARE_INTERACTION_PTR(IRTPDecoderVideo); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoder); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderAudio); + ZS_DECLARE_INTERACTION_PTR(IRTPEncoderVideo); ZS_DECLARE_CLASS_PTR(ORTC); ZS_DECLARE_CLASS_PTR(Certificate); @@ -130,10 +141,21 @@ namespace ortc ZS_DECLARE_CLASS_PTR(ICETransport); ZS_DECLARE_CLASS_PTR(ICETransportController); ZS_DECLARE_CLASS_PTR(Identity); + ZS_DECLARE_CLASS_PTR(MediaChannelTraceHelper); + ZS_DECLARE_CLASS_PTR(MediaDeviceCaptureAudio); + ZS_DECLARE_CLASS_PTR(MediaDeviceCaptureVideo); + ZS_DECLARE_CLASS_PTR(MediaDeviceRenderAudio); ZS_DECLARE_CLASS_PTR(MediaDevices); ZS_DECLARE_CLASS_PTR(MediaStreamTrack); + ZS_DECLARE_CLASS_PTR(MediaStreamTrackChannel); + ZS_DECLARE_CLASS_PTR(MediaStreamTrackSubscriberMedia); + ZS_DECLARE_CLASS_PTR(MediaStreamTrackSubscriberRTP); + ZS_DECLARE_CLASS_PTR(MediaEngine); + ZS_DECLARE_CLASS_PTR(RTPDecoderAudio); + ZS_DECLARE_CLASS_PTR(RTPDecoderVideo); + ZS_DECLARE_CLASS_PTR(RTPEncoderAudio); + ZS_DECLARE_CLASS_PTR(RTPEncoderVideo); ZS_DECLARE_CLASS_PTR(RTPListener); - ZS_DECLARE_CLASS_PTR(RTPMediaEngine); ZS_DECLARE_CLASS_PTR(RTPReceiver); ZS_DECLARE_CLASS_PTR(RTPReceiverChannel); ZS_DECLARE_CLASS_PTR(RTPReceiverChannelAudio); @@ -149,7 +171,22 @@ namespace ortc ZS_DECLARE_INTERACTION_PROXY(ISecureTransportDelegate); ZS_DECLARE_INTERACTION_PROXY(ISRTPTransportDelegate); + ZS_DECLARE_INTERACTION_PROXY(ISecureTransportDelegate); + + ZS_DECLARE_INTERACTION_PROXY(IMediaDeviceCaptureDelegate); + ZS_DECLARE_INTERACTION_PROXY(IMediaDeviceRenderDelegate); + ZS_DECLARE_INTERACTION_PROXY(IRTPDecoderDelegate); + ZS_DECLARE_INTERACTION_PROXY(IRTPEncoderDelegate); + + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackFeedbackDelegate); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackRTPDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaDeviceCaptureSubscription, IMediaDeviceCaptureDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaDeviceRenderSubscription, IMediaDeviceRenderDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamTrackFeedbackSubscription, IMediaStreamTrackFeedbackDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamTrackRTPSubscription, IMediaStreamTrackRTPDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IRTPDecoderSubscription, IRTPDecoderDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IRTPEncoderSubscription, IRTPEncoderDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(ISRTPTransportSubscription, ISRTPTransportDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(ISecureTransportSubscription, ISecureTransportDelegate); } diff --git a/ortc/internal/webrtc_post_include.h b/ortc/internal/webrtc_post_include.h new file mode 100644 index 00000000..4c523e5b --- /dev/null +++ b/ortc/internal/webrtc_post_include.h @@ -0,0 +1,35 @@ +/* + + Copyright (c) 2018, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#ifdef _MSC_VER +#pragma warning(pop) +#else +#endif //_MSC_VER diff --git a/ortc/internal/webrtc_pre_include.h b/ortc/internal/webrtc_pre_include.h new file mode 100644 index 00000000..f6404b9a --- /dev/null +++ b/ortc/internal/webrtc_pre_include.h @@ -0,0 +1,36 @@ +/* + + Copyright (c) 2018, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4100) +#else +#endif //_MSC_VER diff --git a/ortc/ortc.h b/ortc/ortc.h index ed9363ae..721310f4 100644 --- a/ortc/ortc.h +++ b/ortc/ortc.h @@ -46,7 +46,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/ortc/test/TestDTLS.cpp b/ortc/test/TestDTLS.cpp index 7edb2164..dc997a50 100644 --- a/ortc/test/TestDTLS.cpp +++ b/ortc/test/TestDTLS.cpp @@ -44,7 +44,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -71,9 +71,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeICETransportAsyncDelegate - #pragma mark + // + // IFakeICETransportAsyncDelegate + // interaction IFakeICETransportAsyncDelegate { @@ -86,7 +86,7 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::dtls::IFakeICETransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() namespace ortc @@ -102,9 +102,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //--------------------------------------------------------------------- class FakeICETransport : public ortc::internal::ICETransport, @@ -172,7 +172,7 @@ namespace ortc } //--------------------------------------------------------------------- - void role(IICETypes::Roles role) + void set_role(IICETypes::Roles role) noexcept { AutoRecursiveLock lock(*this); ZS_LOG_BASIC(log("setting role") + ZS_PARAM("role", IICETypes::toString(role))) @@ -181,12 +181,12 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override + virtual ElementPtr toDebug() const noexcept override { AutoRecursiveLock lock(*this); @@ -208,18 +208,18 @@ namespace ortc } //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransportForSecureTransport - #pragma mark + // + // FakeICETransport => IICETransportForSecureTransport + // //--------------------------------------------------------------------- - virtual PUID getID() const override {return ICETransport::getID();} + PUID getID() const noexcept override {return ICETransport::getID();} //--------------------------------------------------------------------- - virtual void notifyAttached( - PUID secureTransportID, - UseSecureTransportPtr transport - ) override + void notifyAttached( + PUID secureTransportID, + UseSecureTransportPtr transport + ) noexcept override { AutoRecursiveLock lock(*this); @@ -230,7 +230,7 @@ namespace ortc } //--------------------------------------------------------------------- - virtual void notifyDetached(PUID secureTransportID) override + void notifyDetached(PUID secureTransportID) noexcept override { AutoRecursiveLock lock(*this); if (mSecureTransportID != secureTransportID) { @@ -245,13 +245,13 @@ namespace ortc } //--------------------------------------------------------------------- - virtual IICETypes::Components component() const override + IICETypes::Components component() const noexcept override { return mComponent; } //--------------------------------------------------------------------- - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) override + IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) noexcept override { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -278,24 +278,24 @@ namespace ortc } //--------------------------------------------------------------------- - virtual IICETransport::States state() const override + IICETransport::States state() const noexcept override { AutoRecursiveLock lock(*this); return mCurrentState; } //--------------------------------------------------------------------- - virtual IICETypes::Roles getRole() const override + IICETypes::Roles getRole() const noexcept override { AutoRecursiveLock lock(*this); return mRole; } //--------------------------------------------------------------------- - virtual bool sendPacket( - const BYTE *buffer, - size_t bufferSizeInBytes - ) override + bool sendPacket( + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept override { FakeICETransportPtr transport; @@ -317,9 +317,9 @@ namespace ortc } //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //--------------------------------------------------------------------- virtual void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override @@ -344,9 +344,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // //--------------------------------------------------------------------- void setState(IICETransportTypes::States state) @@ -379,9 +379,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (data) - #pragma mark + // + // FakeICETransport => (data) + // FakeICETransportWeakPtr mThisWeak; @@ -404,9 +404,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTester - #pragma mark + // + // DTLSTester + // //--------------------------------------------------------------------- class DTLSTester : public SharedRecursiveLock, @@ -531,9 +531,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTester::IDTLSTransportDelegate - #pragma mark + // + // DTLSTester::IDTLSTransportDelegate + // //--------------------------------------------------------------------- virtual void onDTLSTransportStateChange( @@ -573,9 +573,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTester::IPromiseSettledDelegate - #pragma mark + // + // DTLSTester::IPromiseSettledDelegate + // //--------------------------------------------------------------------- virtual void onPromiseSettled(PromisePtr promise) override @@ -603,9 +603,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTester => (internal) - #pragma mark + // + // DTLSTester => (internal) + // //--------------------------------------------------------------------- Log::Params log(const char *message) const @@ -627,9 +627,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTester => (data) - #pragma mark + // + // DTLSTester => (data) + // AutoPUID mID; DTLSTesterWeakPtr mThisWeak; @@ -748,8 +748,8 @@ void doTestDTLS() break; } case 6: { - if (fakeIceObject1) fakeIceObject1->role(IICETypes::Role_Controlling); - if (fakeIceObject2) fakeIceObject1->role(IICETypes::Role_Controlled); + if (fakeIceObject1) fakeIceObject1->set_role(IICETypes::Role_Controlling); + if (fakeIceObject2) fakeIceObject1->set_role(IICETypes::Role_Controlled); break; } case 7: { @@ -814,6 +814,7 @@ void doTestDTLS() TESTING_SLEEP(2000) switch (testNumber) { + case 999999: break; default: { if (testDTLSObject1) {TESTING_CHECK(testDTLSObject1->matches(expectationsDTLS1))} diff --git a/ortc/test/TestICEGatherer.cpp b/ortc/test/TestICEGatherer.cpp index 6ce88c57..c28eabe9 100644 --- a/ortc/test/TestICEGatherer.cpp +++ b/ortc/test/TestICEGatherer.cpp @@ -41,7 +41,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -356,9 +356,9 @@ void doTestICEGatherer() expectations1.mStateGathering = 1; expectations1.mStateComplete = 1; expectations1.mStateClosed = 1; - expectations1.mCandidatesUDPHost = totalHostIPs; - expectations1.mCandidatesTCPHostActive = totalHostIPs; - expectations1.mCandidatesTCPHostPassive = totalHostIPs; + expectations1.mCandidatesUDPHost = static_cast(totalHostIPs); + expectations1.mCandidatesTCPHostActive = static_cast(totalHostIPs); + expectations1.mCandidatesTCPHostPassive = static_cast(totalHostIPs); expectations1.mCandidateGone = expectations1.mCandidatesUDPHost + expectations1.mCandidatesTCPHostActive + expectations1.mCandidatesTCPHostPassive; expectations1.mCandidateComplete = 1; diff --git a/ortc/test/TestICETransport.cpp b/ortc/test/TestICETransport.cpp index 5d1d3747..0fe9f757 100644 --- a/ortc/test/TestICETransport.cpp +++ b/ortc/test/TestICETransport.cpp @@ -42,7 +42,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -326,9 +326,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark ICETransportTester - #pragma mark + // + // ICETransportTester + // class ICETransportTester : public SharedRecursiveLock, public zsLib::MessageQueueAssociator, @@ -673,9 +673,9 @@ void doTestICETransport() expectationsGatherer1.mStateGathering = 1; expectationsGatherer1.mStateComplete = 1; expectationsGatherer1.mStateClosed = 1; - expectationsGatherer1.mCandidatesUDPHost = totalHostIPs; - expectationsGatherer1.mCandidatesTCPHostActive = totalHostIPs; - expectationsGatherer1.mCandidatesTCPHostPassive = totalHostIPs; + expectationsGatherer1.mCandidatesUDPHost = static_cast(totalHostIPs); + expectationsGatherer1.mCandidatesTCPHostActive = static_cast(totalHostIPs); + expectationsGatherer1.mCandidatesTCPHostPassive = static_cast(totalHostIPs); expectationsGatherer1.mCandidateGone = expectationsGatherer1.mCandidatesUDPHost + expectationsGatherer1.mCandidatesTCPHostActive + expectationsGatherer1.mCandidatesTCPHostPassive; expectationsGatherer1.mCandidateComplete = 1; diff --git a/ortc/test/TestMediaStreamTrack.cpp b/ortc/test/TestMediaStreamTrack.cpp index f52126ef..467f1913 100644 --- a/ortc/test/TestMediaStreamTrack.cpp +++ b/ortc/test/TestMediaStreamTrack.cpp @@ -29,6 +29,7 @@ */ +#if 0 #include "TestMediaStreamTrack.h" @@ -42,10 +43,12 @@ #include "config.h" #include "testing.h" -#include -#include +#include +#include +#include +#include -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -84,9 +87,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark WebRtcTraceCallback - #pragma mark + // + // WebRtcTraceCallback + // class WebRtcTraceCallback : public webrtc::TraceCallback { @@ -120,9 +123,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PromiseWithMediaStreamTrackListCallback - #pragma mark + // + // PromiseWithMediaStreamTrackListCallback + // class PromiseWithMediaStreamTrackListCallback : public IPromiseResolutionDelegate { @@ -146,12 +149,11 @@ namespace ortc ortc::IMediaDevicesTypes::MediaStreamTrackListPtr trackList = promise->value(); mTester.lock()->mLocalVideoMediaStreamTrack = MediaStreamTrack::convert(*trackList->begin()); - ZS_LOG_DEBUG(log("getUserMedia promise resolved for video") + IMediaStreamTrack::toDebug(mTester.lock()->mLocalVideoMediaStreamTrack)) - -#define WARNING_THIS_HAS_CHANGED 1 -#define WARNING_THIS_HAS_CHANGED 2 +#pragma ZS_BUILD_NOTE("TODO","warning is changed") #if 0 + ZS_LOG_DEBUG(log("getUserMedia promise resolved for video") + IMediaStreamTrack::toDebug(mTester.lock()->mLocalVideoMediaStreamTrack)) + IMediaStreamTrackPtr(mTester.lock()->mLocalVideoMediaStreamTrack)->setVideoRenderCallback(mTester.lock()->mVideoSurface); #endif //0 @@ -161,7 +163,11 @@ namespace ortc { ortc::IMediaDevicesTypes::MediaStreamTrackListPtr trackList = promise->value(); +#pragma ZS_BUILD_NOTE("TODO","warning is changed") + +#if 0 ZS_LOG_DEBUG(log("getUserMedia promise resolved for audio") + IMediaStreamTrack::toDebug(mTester.lock()->mLocalVideoMediaStreamTrack)) +#endif //0 mTester.lock()->mLocalAudioMediaStreamTrack = MediaStreamTrack::convert(*trackList->begin()); @@ -192,9 +198,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark PromiseWithDeviceListCallback - #pragma mark + // + // PromiseWithDeviceListCallback + // class PromiseWithDeviceListCallback : public IPromiseResolutionDelegate { @@ -303,18 +309,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- FakeReceiver::FakeReceiver( @@ -363,9 +369,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiver - #pragma mark + // + // FakeReceiver => IRTPReceiver + // //----------------------------------------------------------------------- ElementPtr FakeReceiver::toDebug() const @@ -383,17 +389,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IFakeReceiverAsyncDelegate - #pragma mark + // + // FakeReceiver => IFakeReceiverAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiver::log(const char *message) const @@ -408,9 +414,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- FakeReceiverChannel::FakeReceiverChannel( @@ -465,9 +471,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeReceiverChannel::toDebug() const @@ -524,17 +530,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate - #pragma mark + // + // FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => ITimerDelegate - #pragma mark + // + // FakeReceiverChannel => ITimerDelegate + // //----------------------------------------------------------------------- void FakeReceiverChannel::onTimer(ITimerPtr timer) @@ -550,7 +556,7 @@ namespace ortc webrtc::VideoFrame frame; frame.CreateEmptyFrame(width, height, width, width / 2, width / 2); - uint8_t* yBuffer = frame.buffer(webrtc::kYPlane); + uint8_t* yBuffer = frame.video_frame_buffer()->MutableDataY();//buffer(webrtc::kYPlane); for (int i = 0; i < height; i++) { memset(yBuffer, 0, width); @@ -560,8 +566,8 @@ namespace ortc yBuffer += width; } - uint8_t* uBuffer = frame.buffer(webrtc::kUPlane); - uint8_t* vBuffer = frame.buffer(webrtc::kVPlane); + uint8_t* uBuffer = frame.video_frame_buffer()->MutableDataU();//frame.buffer(webrtc::kUPlane); + uint8_t* vBuffer = frame.video_frame_buffer()->MutableDataV();//frame.buffer(webrtc::kVPlane); for (int i = 0; i < height / 2; i++) { memset(uBuffer, 128, width / 2); @@ -584,9 +590,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiverChannel::log(const char *message) const @@ -601,9 +607,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- FakeSender::FakeSender( @@ -652,9 +658,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForMediaStreamTrack - #pragma mark + // + // FakeSender => IRTPSenderForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeSender::toDebug() const @@ -672,17 +678,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IFakeSenderAsyncDelegate - #pragma mark + // + // FakeSender => IFakeSenderAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSender::log(const char *message) const @@ -697,9 +703,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- FakeSenderChannel::FakeSenderChannel( @@ -750,9 +756,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeSenderChannel::toDebug() const @@ -808,9 +814,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IFakeSenderChannelAsyncDelegate - #pragma mark + // + // FakeSenderChannel => IFakeSenderChannelAsyncDelegate + // void FakeSenderChannel::onNotifyLocalVideoTrackEvent() { @@ -823,9 +829,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSenderChannel::log(const char *message) const @@ -840,9 +846,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::Expectations - #pragma mark + // + // MediaStreamTrackTester::Expectations + // //----------------------------------------------------------------------- bool MediaStreamTrackTester::Expectations::operator==(const Expectations &op2) const @@ -857,9 +863,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::OverrideReceiverFactory - #pragma mark + // + // MediaStreamTrackTester::OverrideReceiverFactory + // //----------------------------------------------------------------------- MediaStreamTrackTester::OverrideReceiverFactoryPtr MediaStreamTrackTester::OverrideReceiverFactory::create(MediaStreamTrackTesterPtr tester) @@ -887,9 +893,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::OverrideReceiverChannelFactory - #pragma mark + // + // MediaStreamTrackTester::OverrideReceiverChannelFactory + // //----------------------------------------------------------------------- MediaStreamTrackTester::OverrideReceiverChannelFactoryPtr MediaStreamTrackTester::OverrideReceiverChannelFactory::create(MediaStreamTrackTesterPtr tester) @@ -917,9 +923,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester - #pragma mark + // + // MediaStreamTrackTester + // //----------------------------------------------------------------------- MediaStreamTrackTesterPtr MediaStreamTrackTester::create( @@ -1091,9 +1097,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::IMediaStreamTrackDelegate - #pragma mark + // + // MediaStreamTrackTester::IMediaStreamTrackDelegate + // //----------------------------------------------------------------------- void MediaStreamTrackTester::onMediaStreamTrackMute( @@ -1122,9 +1128,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake receiver) - #pragma mark + // + // MediaStreamTrackTester => (friend fake receiver) + // RTPReceiverPtr MediaStreamTrackTester::create( IRTPReceiverDelegatePtr delegate, @@ -1140,9 +1146,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake receiver channel) - #pragma mark + // + // MediaStreamTrackTester => (friend fake receiver channel) + // RTPReceiverChannelPtr MediaStreamTrackTester::create( RTPReceiverPtr receiver, @@ -1196,17 +1202,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake sender) - #pragma mark + // + // MediaStreamTrackTester => (friend fake sender) + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake sender channel) - #pragma mark + // + // MediaStreamTrackTester => (friend fake sender channel) + // //----------------------------------------------------------------------- void MediaStreamTrackTester::notifyReceivedVideoFrame() @@ -1250,9 +1256,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (internal) - #pragma mark + // + // MediaStreamTrackTester => (internal) + // //----------------------------------------------------------------------- Log::Params MediaStreamTrackTester::log(const char *message) const @@ -1459,3 +1465,5 @@ void doTestMediaStreamTrack(void* videoSurface) TESTING_EQUAL(zsLib::proxyGetTotalConstructed(), 0); } + +#endif //0 diff --git a/ortc/test/TestMediaStreamTrack.h b/ortc/test/TestMediaStreamTrack.h index 87b0dfa5..4749adcc 100644 --- a/ortc/test/TestMediaStreamTrack.h +++ b/ortc/test/TestMediaStreamTrack.h @@ -63,9 +63,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeReceiverAsyncDelegate - #pragma mark + // + // IFakeReceiverAsyncDelegate + // interaction IFakeReceiverAsyncDelegate { @@ -76,9 +76,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeReceiverChannelAsyncDelegate - #pragma mark + // + // IFakeReceiverChannelAsyncDelegate + // interaction IFakeReceiverChannelAsyncDelegate { @@ -89,9 +89,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSenderAsyncDelegate - #pragma mark + // + // IFakeSenderAsyncDelegate + // interaction IFakeSenderAsyncDelegate { @@ -102,9 +102,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSenderChannelAsyncDelegate - #pragma mark + // + // IFakeSenderChannelAsyncDelegate + // interaction IFakeSenderChannelAsyncDelegate { @@ -124,7 +124,7 @@ ZS_DECLARE_PROXY_BEGIN(ortc::test::mediastreamtrack::IFakeSenderAsyncDelegate) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::mediastreamtrack::IFakeSenderChannelAsyncDelegate) -ZS_DECLARE_PROXY_METHOD_0(onNotifyLocalVideoTrackEvent) +ZS_DECLARE_PROXY_METHOD(onNotifyLocalVideoTrackEvent) ZS_DECLARE_PROXY_END() namespace ortc @@ -161,9 +161,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //--------------------------------------------------------------------- class FakeReceiver : public ortc::internal::RTPReceiver, @@ -194,33 +194,33 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceverForMediaStreamTrack - #pragma mark + // + // FakeReceiver => IRTPReceverForMediaStreamTrack + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (duplicate) virtual PUID getID() const = 0; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IFakeReceiverAsyncDelegate - #pragma mark + // + // FakeReceiver => IFakeReceiverAsyncDelegate + // protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (data) - #pragma mark + // + // FakeReceiver => (data) + // FakeReceiverWeakPtr mThisWeak; @@ -234,9 +234,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- class FakeReceiverChannel : public ortc::internal::RTPReceiverChannel, @@ -271,38 +271,38 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; - virtual int32_t getAudioSamples( - const size_t numberOfSamples, - const uint8_t numberOfChannels, - void* audioSamples, - size_t& numberOfSamplesOut - ) override; + int32_t getAudioSamples( + const size_t numberOfSamples, + const uint8_t numberOfChannels, + void* audioSamples, + size_t& numberOfSamplesOut + ) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate - #pragma mark + // + // FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate + // protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => ITimerDelegate - #pragma mark + // + // FakeReceiverChannel => ITimerDelegate + // virtual void onTimer(ITimerPtr timer) override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // Log::Params log(const char *message) const; @@ -324,9 +324,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- class FakeSender : public ortc::internal::RTPSender, @@ -357,33 +357,33 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForMediaStreamTrack - #pragma mark + // + // FakeSender => IRTPSenderForMediaStreamTrack + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (duplicate) virtual PUID getID() const = 0; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IFakeSenderAsyncDelegate - #pragma mark + // + // FakeSender => IFakeSenderAsyncDelegate + // protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (data) - #pragma mark + // + // RTPSender => (data) + // FakeSenderWeakPtr mThisWeak; @@ -397,9 +397,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- class FakeSenderChannel : public ortc::internal::RTPSenderChannel, @@ -434,11 +434,11 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack + // - virtual ElementPtr toDebug() const override; + virtual ElementPtr toDebug() const noexcept override; //virtual void sendVideoFrame( // const uint8_t* videoFrame, @@ -452,17 +452,17 @@ namespace ortc // ) override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IFakeSenderChannelAsyncDelegate - #pragma mark + // + // FakeSenderChannel => IFakeSenderChannelAsyncDelegate + // virtual void onNotifyLocalVideoTrackEvent() override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // Log::Params log(const char *message) const; @@ -482,9 +482,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester - #pragma mark + // + // MediaStreamTrackTester + // //----------------------------------------------------------------------- class MediaStreamTrackTester : public SharedRecursiveLock, @@ -501,7 +501,7 @@ namespace ortc friend class PromiseWithDeviceListCallback; ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::Parameters, Parameters) - ZS_DECLARE_TYPEDEF_PTR(internal::RTCPPacket, RTCPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTCPPacket, RTCPPacket) typedef std::list RTCPPacketList; ZS_DECLARE_TYPEDEF_PTR(internal::RTPReceiver, RTPReceiver) @@ -517,9 +517,9 @@ namespace ortc friend class OverrideReceiverChannelFactory; //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::OverrideReceiverFactory - #pragma mark + // + // MediaStreamTrackTester::OverrideReceiverFactory + // class OverrideReceiverFactory : public RTPReceiverFactory { @@ -531,16 +531,16 @@ namespace ortc IMediaStreamTrackTypes::Kinds kind, IRTPTransportPtr transport, IRTCPTransportPtr rtcpTransport = IRTCPTransportPtr() - ) override; + ) noexcept override; protected: MediaStreamTrackTesterWeakPtr mTester; }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::OverrideReceiverChannelFactory - #pragma mark + // + // MediaStreamTrackTester::OverrideReceiverChannelFactory + // class OverrideReceiverChannelFactory : public RTPReceiverChannelFactory { @@ -552,7 +552,7 @@ namespace ortc MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ) override; + ) noexcept override; protected: MediaStreamTrackTesterWeakPtr mTester; @@ -584,9 +584,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester (api) - #pragma mark + // + // MediaStreamTrackTester (api) + // static MediaStreamTrackTesterPtr create( IMessageQueuePtr queue, @@ -632,9 +632,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester::IMediaStreamTrackDelegate - #pragma mark + // + // MediaStreamTrackTester::IMediaStreamTrackDelegate + // virtual void onMediaStreamTrackMute( IMediaStreamTrackPtr track, @@ -648,9 +648,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake receiver) - #pragma mark + // + // MediaStreamTrackTester => (friend fake receiver) + // RTPReceiverPtr create( IRTPReceiverDelegatePtr delegate, @@ -660,9 +660,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake receiver channel) - #pragma mark + // + // MediaStreamTrackTester => (friend fake receiver channel) + // RTPReceiverChannelPtr create( RTPReceiverPtr receiver, @@ -677,14 +677,14 @@ namespace ortc void notifyRemoteAudioTrackEvent(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake sender) - #pragma mark + // + // MediaStreamTrackTester => (friend fake sender) + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (friend fake sender channel) - #pragma mark + // + // MediaStreamTrackTester => (friend fake sender channel) + // void notifyReceivedVideoFrame(); void notifyLocalVideoTrackEvent(); @@ -693,9 +693,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (internal) - #pragma mark + // + // MediaStreamTrackTester => (internal) + // Log::Params log(const char *message) const; @@ -704,9 +704,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrackTester => (data) - #pragma mark + // + // MediaStreamTrackTester => (data) + // AutoPUID mID; MediaStreamTrackTesterWeakPtr mThisWeak; diff --git a/ortc/test/TestRTCPPacket.cpp b/ortc/test/TestRTCPPacket.cpp index 6ff29b0f..df79b7a9 100644 --- a/ortc/test/TestRTCPPacket.cpp +++ b/ortc/test/TestRTCPPacket.cpp @@ -30,7 +30,7 @@ */ -#include +#include #include #include @@ -42,7 +42,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using std::make_shared; @@ -263,15 +263,15 @@ namespace ortc } ZS_DECLARE_CLASS_PTR(Tester) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark Tester - #pragma mark + // + // Tester + // class Tester : public SharedRecursiveLock { @@ -374,9 +374,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark Tester => (clean routines) - #pragma mark + // + // Tester => (clean routines) + // //--------------------------------------------------------------------- static void cleanSenderReceiverCommonReport(SenderReceiverCommonReport *common) @@ -731,9 +731,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark Tester => (compare routines) - #pragma mark + // + // Tester => (compare routines) + // //--------------------------------------------------------------------- static void compareReport(Report *report1, Report *report2) @@ -2118,9 +2118,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark Tester => (sanity routines) - #pragma mark + // + // Tester => (sanity routines) + // //--------------------------------------------------------------------- static void checkSanity(const RTCPPacket &packet) { @@ -2332,9 +2332,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark Tester => (create routines) - #pragma mark + // + // Tester => (create routines) + // //--------------------------------------------------------------------- static void fillReport(Report *common) @@ -3386,7 +3386,7 @@ namespace ortc { if (!mGeneratedBuffer) generateBuffer(); TESTING_CHECK(mGeneratedBuffer) - mPacket = RTCPPacket::create(*mGeneratedBuffer, mGeneratedBuffer->SizeInBytes()); + mPacket = RTCPPacket::create(mGeneratedBuffer->BytePtr(), mGeneratedBuffer->SizeInBytes()); } //--------------------------------------------------------------------- @@ -3449,7 +3449,7 @@ static void bogusSleep() #define TEST_BASIC_RTCP 0 ZS_DECLARE_USING_PTR(ortc::test::rtcppacket, Tester) -ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) +ZS_DECLARE_USING_PTR(ortc, RTCPPacket) static signed gSeeds[] = {2286, 2075, -57479, 1000, 1001, -17, 89, -97, 523, 104297, -1269287, 0}; diff --git a/ortc/test/TestRTPChannel.cpp b/ortc/test/TestRTPChannel.cpp index 28f48e45..edd48da9 100644 --- a/ortc/test/TestRTPChannel.cpp +++ b/ortc/test/TestRTPChannel.cpp @@ -29,11 +29,12 @@ */ +#if 0 #include "TestRTPChannel.h" -#include -#include +#include +#include #include #include @@ -43,7 +44,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -86,9 +87,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- static bool isRTCPPacketType(const BYTE *data, size_t len) @@ -104,9 +105,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //----------------------------------------------------------------------- FakeICETransport::FakeICETransport( @@ -180,9 +181,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //----------------------------------------------------------------------- ElementPtr FakeICETransport::toDebug() const @@ -210,9 +211,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) @@ -262,9 +263,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onTimer(ITimerPtr timer) @@ -328,9 +329,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // //----------------------------------------------------------------------- void FakeICETransport::attachSecure(FakeSecureTransportPtr transport) @@ -433,9 +434,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // //----------------------------------------------------------------------- void FakeICETransport::setState(IICETransportTypes::States state) @@ -470,9 +471,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //----------------------------------------------------------------------- FakeSecureTransport::FakeSecureTransport( @@ -539,9 +540,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //----------------------------------------------------------------------- ElementPtr FakeSecureTransport::toDebug() const @@ -566,9 +567,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPReceiver + // //----------------------------------------------------------------------- RTPListenerPtr FakeSecureTransport::getListener() const @@ -580,17 +581,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPReceiver + // //----------------------------------------------------------------------- PUID FakeSecureTransport::getID() const @@ -660,9 +661,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => IICETransportDelegate + // //----------------------------------------------------------------------- void FakeSecureTransport::onICETransportStateChange( @@ -707,17 +708,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeICETransport - #pragma mark + // + // FakeICETransport => friend FakeICETransport + // //----------------------------------------------------------------------- bool FakeSecureTransport::handleReceivedPacket( @@ -751,9 +752,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // //----------------------------------------------------------------------- void FakeSecureTransport::setState(IDTLSTransportTypes::States state) @@ -855,9 +856,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener - #pragma mark + // + // FakeListener + // //----------------------------------------------------------------------- FakeListener::FakeListener(IMessageQueuePtr queue) : @@ -899,9 +900,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPReceiverForRTPReceiver - #pragma mark + // + // FakeListener => IRTPReceiverForRTPReceiver + // //----------------------------------------------------------------------- ElementPtr FakeListener::toDebug() const @@ -1059,9 +1060,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPSender - #pragma mark + // + // FakeListener => IRTPListenerForRTPSender + // //----------------------------------------------------------------------- void FakeListener::registerSender( @@ -1110,9 +1111,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForSecureTransport - #pragma mark + // + // FakeListener => IRTPListenerForSecureTransport + // //----------------------------------------------------------------------- bool FakeListener::handleRTPPacket( @@ -1233,9 +1234,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => ITimerDelegate - #pragma mark + // + // FakeListener => ITimerDelegate + // //----------------------------------------------------------------------- void FakeListener::onTimer(ITimerPtr timer) @@ -1269,9 +1270,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IFakeListenerAsyncDelegate - #pragma mark + // + // FakeListener => IFakeListenerAsyncDelegate + // //----------------------------------------------------------------------- void FakeListener::onForwardBufferedPacket(RTPPacketPtr packet) @@ -1297,9 +1298,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (friend RTPChannelTester) - #pragma mark + // + // FakeListener => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeListener::setTransport(RTPChannelTesterPtr tester) @@ -1332,9 +1333,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (internal) - #pragma mark + // + // FakeListener => (internal) + // //----------------------------------------------------------------------- Log::Params FakeListener::log(const char *message) const @@ -1364,9 +1365,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- FakeMediaStreamTrack::FakeMediaStreamTrack(IMessageQueuePtr queue) : @@ -1384,9 +1385,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel + // #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_RECEIVER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 1 #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_RECEIVER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 2 @@ -1400,9 +1401,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannel - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannel + // #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_SENDER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 1 #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_SENDER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 2 @@ -1411,9 +1412,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPChannelTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPChannelTester) + // //----------------------------------------------------------------------- FakeMediaStreamTrackPtr FakeMediaStreamTrack::create( @@ -1437,9 +1438,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // //----------------------------------------------------------------------- Log::Params FakeMediaStreamTrack::log(const char *message) const @@ -1468,9 +1469,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- FakeSender::FakeSender(IMessageQueuePtr queue) : @@ -1496,9 +1497,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPListener - #pragma mark + // + // FakeSender => IRTPSenderForRTPListener + // //----------------------------------------------------------------------- ElementPtr FakeSender::toDebug() const @@ -1543,9 +1544,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPListener - #pragma mark + // + // FakeSender => IRTPSenderForRTPListener + // //----------------------------------------------------------------------- bool FakeSender::sendPacket(RTPPacketPtr packet) @@ -1581,9 +1582,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (friend RTPChannelTester) - #pragma mark + // + // FakeSender => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeSender::setTransport(RTPChannelTesterPtr tester) @@ -1691,9 +1692,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSender::log(const char *message) const @@ -1708,9 +1709,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- FakeReceiver::FakeReceiver( @@ -1743,9 +1744,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPSenderForRTPListener - #pragma mark + // + // FakeReceiver => IRTPSenderForRTPListener + // //----------------------------------------------------------------------- ElementPtr FakeReceiver::toDebug() const @@ -1837,9 +1838,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // FakeReceiver => IRTPReceiverForRTPReceiverChannel + // //----------------------------------------------------------------------- bool FakeReceiver::sendPacket(RTCPPacketPtr packet) @@ -1852,9 +1853,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (friend RTPSenderTester) - #pragma mark + // + // FakeReceiver => (friend RTPSenderTester) + // //----------------------------------------------------------------------- void FakeReceiver::setTransport(RTPChannelTesterPtr tester) @@ -1961,9 +1962,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiver::log(const char *message) const @@ -1977,9 +1978,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio - #pragma mark + // + // FakeReceiverChannelAudio + // //----------------------------------------------------------------------- FakeReceiverChannelAudio::FakeReceiverChannelAudio( @@ -2015,9 +2016,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPReceiverChannel + // //----------------------------------------------------------------------- ElementPtr FakeReceiverChannelAudio::toDebug() const @@ -2080,17 +2081,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelAudio => IRTPReceiverChannelAudioForRTPReceiverChannel + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => (friend RTPChannelTester) - #pragma mark + // + // FakeReceiverChannelAudio => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeReceiverChannelAudio::setTransport(RTPChannelTesterPtr tester) @@ -2132,9 +2133,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => (internal) - #pragma mark + // + // FakeReceiverChannelAudio => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiverChannelAudio::log(const char *message) const @@ -2150,9 +2151,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo - #pragma mark + // + // FakeReceiverChannelVideo + // //----------------------------------------------------------------------- FakeReceiverChannelVideo::FakeReceiverChannelVideo( @@ -2188,9 +2189,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPReceiverChannel + // //----------------------------------------------------------------------- ElementPtr FakeReceiverChannelVideo::toDebug() const @@ -2253,17 +2254,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelVideo => IRTPReceiverChannelVideoForRTPReceiverChannel + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => (friend RTPChannelTester) - #pragma mark + // + // FakeReceiverChannelVideo => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeReceiverChannelVideo::setTransport(RTPChannelTesterPtr tester) @@ -2305,9 +2306,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => (internal) - #pragma mark + // + // FakeReceiverChannelVideo => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiverChannelVideo::log(const char *message) const @@ -2321,9 +2322,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio - #pragma mark + // + // FakeSenderChannelAudio + // //----------------------------------------------------------------------- FakeSenderChannelAudio::FakeSenderChannelAudio( @@ -2359,9 +2360,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPSenderChannel + // //----------------------------------------------------------------------- ElementPtr FakeSenderChannelAudio::toDebug() const @@ -2404,17 +2405,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelAudio => IRTPSenderChannelAudioForRTPSenderChannel + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannelAudio => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeSenderChannelAudio::setTransport(RTPChannelTesterPtr tester) @@ -2456,9 +2457,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => (internal) - #pragma mark + // + // FakeSenderChannelAudio => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSenderChannelAudio::log(const char *message) const @@ -2474,9 +2475,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo - #pragma mark + // + // FakeSenderChannelVideo + // //----------------------------------------------------------------------- FakeSenderChannelVideo::FakeSenderChannelVideo( @@ -2512,9 +2513,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPSenderChannel + // //----------------------------------------------------------------------- ElementPtr FakeSenderChannelVideo::toDebug() const @@ -2557,17 +2558,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelVideo => IRTPSenderChannelVideoForRTPSenderChannel + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannelVideo => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeSenderChannelVideo::setTransport(RTPChannelTesterPtr tester) @@ -2609,9 +2610,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => (internal) - #pragma mark + // + // FakeSenderChannelVideo => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSenderChannelVideo::log(const char *message) const @@ -2625,9 +2626,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::Expectations - #pragma mark + // + // RTPChannelTester::Expectations + // //----------------------------------------------------------------------- bool RTPChannelTester::Expectations::operator==(const Expectations &op2) const @@ -2640,9 +2641,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideReceiverChannelAudioFactory - #pragma mark + // + // RTPChannelTester::OverrideReceiverChannelAudioFactory + // //----------------------------------------------------------------------- RTPChannelTester::OverrideReceiverChannelAudioFactoryPtr RTPChannelTester::OverrideReceiverChannelAudioFactory::create(RTPChannelTesterPtr tester) @@ -2669,9 +2670,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideReceiverChannelVideoFactory - #pragma mark + // + // RTPChannelTester::OverrideReceiverChannelVideoFactory + // //----------------------------------------------------------------------- RTPChannelTester::OverrideReceiverChannelVideoFactoryPtr RTPChannelTester::OverrideReceiverChannelVideoFactory::create(RTPChannelTesterPtr tester) @@ -2698,9 +2699,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideSenderChannelAudioFactory - #pragma mark + // + // RTPChannelTester::OverrideSenderChannelAudioFactory + // //----------------------------------------------------------------------- RTPChannelTester::OverrideSenderChannelAudioFactoryPtr RTPChannelTester::OverrideSenderChannelAudioFactory::create(RTPChannelTesterPtr tester) @@ -2727,9 +2728,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideSenderChannelVideoFactory - #pragma mark + // + // RTPChannelTester::OverrideSenderChannelVideoFactory + // //----------------------------------------------------------------------- RTPChannelTester::OverrideSenderChannelVideoFactoryPtr RTPChannelTester::OverrideSenderChannelVideoFactory::create(RTPChannelTesterPtr tester) @@ -2756,9 +2757,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester - #pragma mark + // + // RTPChannelTester + // //----------------------------------------------------------------------- RTPChannelTesterPtr RTPChannelTester::create( @@ -3720,9 +3721,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // RTPChannelTester => IRTPReceiverChannelForRTPReceiver + // //----------------------------------------------------------------------- void RTPChannelTester::createReceiverChannel( @@ -3902,9 +3903,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // RTPChannelTester => IRTPReceiverChannelForRTPReceiver + // //----------------------------------------------------------------------- void RTPChannelTester::createSenderChannel( @@ -3930,9 +3931,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::IRTPReceiverDelegate - #pragma mark + // + // RTPChannelTester::IRTPReceiverDelegate + // //----------------------------------------------------------------------- void RTPChannelTester::onRTPListenerUnhandledRTP( @@ -3950,18 +3951,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::IRTPReceiverDelegate - #pragma mark + // + // RTPChannelTester::IRTPReceiverDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => (friend fake sender/receiver) - #pragma mark + // + // RTPChannelTester => (friend fake sender/receiver) + // //----------------------------------------------------------------------- FakeSecureTransportPtr RTPChannelTester::getFakeSecureTransport() const @@ -4076,9 +4077,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => (internal) - #pragma mark + // + // RTPChannelTester => (internal) + // //----------------------------------------------------------------------- Log::Params RTPChannelTester::log(const char *message) const @@ -4657,3 +4658,4 @@ void doTestRTPChannel() TESTING_EQUAL(zsLib::proxyGetTotalConstructed(), 0); } +#endif //0 diff --git a/ortc/test/TestRTPChannel.h b/ortc/test/TestRTPChannel.h index 458da388..7a29bfcd 100644 --- a/ortc/test/TestRTPChannel.h +++ b/ortc/test/TestRTPChannel.h @@ -29,6 +29,7 @@ */ +#if 0 #include #include @@ -36,11 +37,11 @@ #include #include #include -#include -#include +//#include +//#include #include -#include -#include +//#include +//#include #include #include #include @@ -72,9 +73,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeICETransportAsyncDelegate - #pragma mark + // + // IFakeICETransportAsyncDelegate + // interaction IFakeICETransportAsyncDelegate { @@ -85,9 +86,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSecureTransportAsyncDelegate - #pragma mark + // + // IFakeSecureTransportAsyncDelegate + // interaction IFakeSecureTransportAsyncDelegate { @@ -98,9 +99,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeListenerAsyncDelegate - #pragma mark + // + // IFakeListenerAsyncDelegate + // interaction IFakeListenerAsyncDelegate { @@ -115,7 +116,7 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpchannel::IFakeICETransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpchannel::IFakeSecureTransportAsyncDelegate) @@ -125,7 +126,7 @@ ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpchannel::IFakeListenerAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onForwardBufferedPacket, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onForwardBufferedPacket, RTPPacketPtr) ZS_DECLARE_PROXY_END() namespace ortc @@ -139,9 +140,9 @@ namespace ortc using zsLib::Milliseconds; ZS_DECLARE_USING_PTR(zsLib, ITimer) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTPReceiver) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPReceiver) ZS_DECLARE_CLASS_PTR(FakeICETransport) ZS_DECLARE_CLASS_PTR(FakeSecureTransport) @@ -159,9 +160,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //--------------------------------------------------------------------- class FakeICETransport : public ortc::internal::ICETransport, @@ -190,9 +191,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (test API) - #pragma mark + // + // FakeICETransport => (test API) + // ~FakeICETransport(); @@ -209,33 +210,33 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //--------------------------------------------------------------------- virtual ElementPtr toDebug() const override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //--------------------------------------------------------------------- virtual void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //--------------------------------------------------------------------- virtual void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // void attachSecure(FakeSecureTransportPtr transport); @@ -252,9 +253,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // void setState(IICETransportTypes::States state); @@ -264,9 +265,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (data) - #pragma mark + // + // FakeICETransport => (data) + // FakeICETransportWeakPtr mThisWeak; @@ -294,9 +295,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //--------------------------------------------------------------------- class FakeSecureTransport : public ortc::internal::DTLSTransport, @@ -335,9 +336,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (testing API) - #pragma mark + // + // FakeSecureTransport => (testing API) + // ~FakeSecureTransport(); @@ -352,17 +353,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //--------------------------------------------------------------------- virtual ElementPtr toDebug() const override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPListener - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPListener + // // (duplicate) static ElementPtr toDebug(ForRTPReceiverPtr transport); @@ -371,9 +372,9 @@ namespace ortc virtual RTPListenerPtr getListener() const override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); @@ -402,9 +403,9 @@ namespace ortc // (duplicate) virtual IICETransportPtr getICETransport() const = 0; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPReceiver + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); @@ -433,9 +434,9 @@ namespace ortc virtual IICETransportPtr getICETransport() const override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => IICETransportDelegate + // virtual void onICETransportStateChange( IICETransportPtr transport, @@ -458,14 +459,14 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => friend FakeICETransport - #pragma mark + // + // FakeSecureTransport => friend FakeICETransport + // //--------------------------------------------------------------------- bool handleReceivedPacket( @@ -476,9 +477,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // void setState(IDTLSTransportTypes::States state); @@ -495,9 +496,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (data) - #pragma mark + // + // FakeSecureTransport => (data) + // FakeSecureTransportWeakPtr mThisWeak; @@ -520,9 +521,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener - #pragma mark + // + // FakeListener + // //----------------------------------------------------------------------- class FakeListener : public ortc::internal::RTPListener, @@ -554,9 +555,9 @@ namespace ortc static FakeListenerPtr convert(RTPListenerPtr listener); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPReceiver - #pragma mark + // + // FakeListener => IRTPListenerForRTPReceiver + // virtual ElementPtr toDebug() const override; @@ -583,9 +584,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPSender - #pragma mark + // + // FakeListener => IRTPListenerForRTPSender + // // (duplciate) static ElementPtr toDebug(ForRTPSenderPtr listener); @@ -602,9 +603,9 @@ namespace ortc virtual void unregisterSender(UseSender &inSender) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForSecureTransport - #pragma mark + // + // FakeListener => IRTPListenerForSecureTransport + // // (duplicate) virtual ElementPtr toDebug() override; @@ -620,23 +621,23 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => Timer - #pragma mark + // + // FakeListener => Timer + // virtual void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IFakeListenerAsyncDelegate - #pragma mark + // + // FakeListener => IFakeListenerAsyncDelegate + // virtual void onForwardBufferedPacket(RTPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (friend RTPChannelTester) - #pragma mark + // + // FakeListener => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -644,9 +645,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (internal) - #pragma mark + // + // FakeListener => (internal) + // Log::Params log(const char *message) const; @@ -679,9 +680,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- class FakeMediaStreamTrack : public ortc::internal::MediaStreamTrack @@ -696,9 +697,9 @@ namespace ortc ~FakeMediaStreamTrack(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel + // #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_RECEIVER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 1 #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_RECEIVER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 2 @@ -708,18 +709,18 @@ namespace ortc //virtual void renderVideoFrame(const webrtc::VideoFrame& videoFrame) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannel - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannel + // #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_SENDER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 1 #define MOSA_THESE_METHODS_ARE_CALLED_BY_YOUR_REAL_SENDER_CHANNEL_CLASS_TO_FAKE_MEDIA_TRACK 2 //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPChannelTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPChannelTester) + // static FakeMediaStreamTrackPtr create( IMessageQueuePtr queue, @@ -730,9 +731,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // Log::Params log(const char *message) const; @@ -740,9 +741,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (data) - #pragma mark + // + // FakeMediaStreamTrack => (data) + // FakeMediaStreamTrackWeakPtr mThisWeak; @@ -755,9 +756,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- class FakeReceiver : public ortc::internal::RTPReceiver @@ -784,9 +785,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiverForRTPListener - #pragma mark + // + // FakeReceiver => IRTPReceiverForRTPListener + // virtual ElementPtr toDebug() const override; @@ -803,9 +804,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiverForRTPReceiverChannel - #pragma mark + // + // FakeReceiver => IRTPReceiverForRTPReceiverChannel + // // (duplicate) static ElementPtr toDebug(ForRTPReceiverChannelPtr object); @@ -817,9 +818,9 @@ namespace ortc virtual bool sendPacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (friend RTPChannelTester) - #pragma mark + // + // FakeReceiver => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -834,18 +835,18 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (data) - #pragma mark + // + // FakeReceiver => (data) + // FakeReceiverWeakPtr mThisWeak; @@ -867,9 +868,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- class FakeSender : public ortc::internal::RTPSender @@ -891,9 +892,9 @@ namespace ortc static FakeSenderPtr create(IMessageQueuePtr queue); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPListener - #pragma mark + // + // FakeSender => IRTPSenderForRTPListener + // virtual ElementPtr toDebug() const override; @@ -906,9 +907,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPSenderChannel - #pragma mark + // + // FakeSender => IRTPSenderForRTPSenderChannel + // virtual bool sendPacket(RTPPacketPtr packet) override; virtual bool sendPacket(RTCPPacketPtr packet) override; @@ -920,9 +921,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (friend RTPChannelTester) - #pragma mark + // + // FakeSender => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -937,18 +938,18 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (data) - #pragma mark + // + // RTPSender => (data) + // FakeSenderWeakPtr mThisWeak; @@ -968,9 +969,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio - #pragma mark + // + // FakeReceiverChannelAudio + // //----------------------------------------------------------------------- class FakeReceiverChannelAudio : public ortc::internal::RTPReceiverChannelAudio @@ -998,9 +999,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelAudio => IRTPReceiverChannelMediaBaseForRTPReceiverChannel + // virtual ElementPtr toDebug() const override; @@ -1011,14 +1012,14 @@ namespace ortc virtual bool handlePacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelAudio => IRTPReceiverChannelAudioForRTPReceiverChannel + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => (friend RTPChannelTester) - #pragma mark + // + // FakeReceiverChannelAudio => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -1031,17 +1032,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => (internal) - #pragma mark + // + // FakeReceiverChannelAudio => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelAudio => (data) - #pragma mark + // + // FakeReceiverChannelAudio => (data) + // FakeReceiverChannelAudioWeakPtr mThisWeak; @@ -1060,9 +1061,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo - #pragma mark + // + // FakeReceiverChannelVideo + // //----------------------------------------------------------------------- class FakeReceiverChannelVideo : public ortc::internal::RTPReceiverChannelVideo @@ -1090,9 +1091,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelVideo => IRTPReceiverChannelMediaBaseForRTPReceiverChannel + // virtual ElementPtr toDebug() const override; @@ -1103,14 +1104,14 @@ namespace ortc virtual bool handlePacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark + // + // FakeReceiverChannelVideo => IRTPReceiverChannelVideoForRTPReceiverChannel + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => (friend RTPChannelTester) - #pragma mark + // + // FakeReceiverChannelVideo => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -1123,17 +1124,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => (internal) - #pragma mark + // + // FakeReceiverChannelVideo => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannelVideo => (data) - #pragma mark + // + // FakeReceiverChannelVideo => (data) + // FakeReceiverChannelVideoWeakPtr mThisWeak; @@ -1152,9 +1153,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio - #pragma mark + // + // FakeSenderChannelAudio + // //----------------------------------------------------------------------- class FakeSenderChannelAudio : public ortc::internal::RTPSenderChannelAudio @@ -1182,9 +1183,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelAudio => IRTPSenderChannelMediaBaseForRTPSenderChannel + // virtual ElementPtr toDebug() const override; @@ -1193,14 +1194,14 @@ namespace ortc virtual bool handlePacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelAudio => IRTPSenderChannelAudioForRTPSenderChannel + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannelAudio => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -1213,17 +1214,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => (internal) - #pragma mark + // + // FakeSenderChannelAudio => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelAudio => (data) - #pragma mark + // + // FakeSenderChannelAudio => (data) + // FakeSenderChannelAudioWeakPtr mThisWeak; @@ -1242,9 +1243,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo - #pragma mark + // + // FakeSenderChannelVideo + // //----------------------------------------------------------------------- class FakeSenderChannelVideo : public ortc::internal::RTPSenderChannelVideo @@ -1272,9 +1273,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelVideo => IRTPSenderChannelMediaBaseForRTPSenderChannel + // virtual ElementPtr toDebug() const override; @@ -1283,14 +1284,14 @@ namespace ortc virtual bool handlePacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark + // + // FakeSenderChannelVideo => IRTPSenderChannelVideoForRTPSenderChannel + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannelVideo => (friend RTPChannelTester) + // void setTransport(RTPChannelTesterPtr tester); @@ -1303,17 +1304,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => (internal) - #pragma mark + // + // FakeSenderChannelVideo => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannelVideo => (data) - #pragma mark + // + // FakeSenderChannelVideo => (data) + // FakeSenderChannelVideoWeakPtr mThisWeak; @@ -1332,9 +1333,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester - #pragma mark + // + // RTPChannelTester + // //----------------------------------------------------------------------- class RTPChannelTester : public SharedRecursiveLock, @@ -1430,9 +1431,9 @@ namespace ortc typedef std::map FakeSenderChannelVideoMap; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideReceiverChannelAudioFactory - #pragma mark + // + // RTPChannelTester::OverrideReceiverChannelAudioFactory + // class OverrideReceiverChannelAudioFactory : public RTPReceiverChannelAudioFactory { @@ -1450,9 +1451,9 @@ namespace ortc }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideReceiverChannelVideoFactory - #pragma mark + // + // RTPChannelTester::OverrideReceiverChannelVideoFactory + // class OverrideReceiverChannelVideoFactory : public RTPReceiverChannelVideoFactory { @@ -1470,9 +1471,9 @@ namespace ortc }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideSenderChannelAudioFactory - #pragma mark + // + // RTPChannelTester::OverrideSenderChannelAudioFactory + // class OverrideSenderChannelAudioFactory : public RTPSenderChannelAudioFactory { @@ -1490,9 +1491,9 @@ namespace ortc }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::OverrideReceiverChannelVideoFactory - #pragma mark + // + // RTPChannelTester::OverrideReceiverChannelVideoFactory + // class OverrideSenderChannelVideoFactory : public RTPSenderChannelVideoFactory { @@ -1528,9 +1529,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester (api) - #pragma mark + // + // RTPChannelTester (api) + // static RTPChannelTesterPtr create( IMessageQueuePtr queue, @@ -1671,9 +1672,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // RTPChannelTester => IRTPReceiverChannelForRTPReceiver + // // simulate methods calls to IRTPReceiverChannelForRTPReceiver @@ -1710,9 +1711,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // RTPChannelTester => IRTPReceiverChannelForMediaStreamTrack + // // call methods calls to IRTPReceiverChannelForMediaStreamTrack @@ -1720,9 +1721,9 @@ namespace ortc #define MOSA_TODO_ADD_METHODS_NEEDED_TO_SIMULATE_CALLS_TO_RECEIVER_CHANNEL_FROM_MEDIA_STREAM_TRACK 2 //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => IRTPSenderChannelForRTPSender - #pragma mark + // + // RTPChannelTester => IRTPSenderChannelForRTPSender + // // call methods calls IRTPSenderChannelForRTPSender @@ -1754,9 +1755,9 @@ namespace ortc // ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // RTPChannelTester => IRTPReceiverChannelForMediaStreamTrack + // // call methods calls IRTPReceiverChannelForMediaStreamTrack @@ -1766,9 +1767,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::IRTPListenerDelegate - #pragma mark + // + // RTPChannelTester::IRTPListenerDelegate + // virtual void onRTPListenerUnhandledRTP( IRTPListenerPtr listener, @@ -1779,14 +1780,14 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester::IRTPReceiverDelegate - #pragma mark + // + // RTPChannelTester::IRTPReceiverDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => (friend fake listener, sender, receiver channel) - #pragma mark + // + // RTPChannelTester => (friend fake listener, sender, receiver channel) + // FakeSecureTransportPtr getFakeSecureTransport() const; @@ -1813,9 +1814,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => (internal) - #pragma mark + // + // RTPChannelTester => (internal) + // Log::Params log(const char *message) const; @@ -1848,9 +1849,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelTester => (data) - #pragma mark + // + // RTPChannelTester => (data) + // AutoPUID mID; RTPChannelTesterWeakPtr mThisWeak; @@ -1893,3 +1894,5 @@ namespace ortc } } } + +#endif //0 diff --git a/ortc/test/TestRTPChannelAudio.cpp b/ortc/test/TestRTPChannelAudio.cpp index c16434bd..6d07c660 100644 --- a/ortc/test/TestRTPChannelAudio.cpp +++ b/ortc/test/TestRTPChannelAudio.cpp @@ -29,11 +29,12 @@ */ +#if 0 #include "TestRTPChannelAudio.h" -#include -#include +#include +#include #include #include @@ -43,11 +44,13 @@ #include "config.h" #include "testing.h" -#include -#include -#include +#include +#include +#include +#include +#include -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -85,9 +88,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark WebRtcTraceCallback - #pragma mark + // + // WebRtcTraceCallback + // class WebRtcTraceCallback : public webrtc::TraceCallback { @@ -121,9 +124,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- FakeMediaStreamTrack::FakeMediaStreamTrack(IMessageQueuePtr queue, bool remote) : @@ -185,17 +188,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelAudio - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelAudio + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelAudio - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelAudio + // #if 0 webrtc::AudioDeviceModule* FakeMediaStreamTrack::getAudioDeviceModule() { @@ -233,9 +236,9 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => webrtc::AudioTransport - #pragma mark + // + // FakeMediaStreamTrack => webrtc::AudioTransport + // //------------------------------------------------------------------------- int32_t FakeMediaStreamTrack::RecordedDataIsAvailable( @@ -277,9 +280,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPChannelTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeMediaStreamTrack::setTransport(RTPChannelAudioTesterPtr tester) @@ -320,9 +323,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // //----------------------------------------------------------------------- Log::Params FakeMediaStreamTrack::log(const char *message) const @@ -351,9 +354,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- FakeReceiverChannel::FakeReceiverChannel( @@ -389,9 +392,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelBase - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelBase + // //----------------------------------------------------------------------- bool FakeReceiverChannel::sendPacket(RTCPPacketPtr packet) @@ -404,17 +407,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelAudio - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelAudio + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeReceiverChannel::toDebug() const @@ -436,9 +439,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPSenderTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPSenderTester) + // //----------------------------------------------------------------------- void FakeReceiverChannel::setTransport(RTPChannelAudioTesterPtr tester) @@ -481,9 +484,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiverChannel::log(const char *message) const @@ -498,9 +501,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- FakeSenderChannel::FakeSenderChannel( @@ -536,9 +539,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase + // //----------------------------------------------------------------------- bool FakeSenderChannel::sendPacket(RTPPacketPtr packet) @@ -558,17 +561,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelAudio - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelAudio + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeSenderChannel::toDebug() const @@ -590,9 +593,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPChannelTester) + // void FakeSenderChannel::setTransport(RTPChannelAudioTesterPtr tester) { @@ -623,9 +626,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSenderChannel::log(const char *message) const @@ -640,9 +643,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester::Expectations - #pragma mark + // + // RTPChannelAudioTester::Expectations + // //----------------------------------------------------------------------- bool RTPChannelAudioTester::Expectations::operator==(const Expectations &op2) const @@ -657,9 +660,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester::OverrideReceiverChannelAudioFactory - #pragma mark + // + // RTPChannelAudioTester::OverrideReceiverChannelAudioFactory + // //----------------------------------------------------------------------- RTPChannelAudioTester::OverrideReceiverChannelAudioFactoryPtr RTPChannelAudioTester::OverrideReceiverChannelAudioFactory::create(RTPChannelAudioTesterPtr tester) @@ -686,9 +689,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester::OverrideSenderChannelAudioFactory - #pragma mark + // + // RTPChannelAudioTester::OverrideSenderChannelAudioFactory + // //----------------------------------------------------------------------- RTPChannelAudioTester::OverrideSenderChannelAudioFactoryPtr RTPChannelAudioTester::OverrideSenderChannelAudioFactory::create(RTPChannelAudioTesterPtr tester) @@ -715,9 +718,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester - #pragma mark + // + // RTPChannelAudioTester + // //----------------------------------------------------------------------- RTPChannelAudioTesterPtr RTPChannelAudioTester::create( @@ -1363,9 +1366,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark + // + // RTPChannelAudioTester => IRTPReceiverChannelAudioForRTPReceiverChannel + // //----------------------------------------------------------------------- RTPReceiverChannelAudioPtr RTPChannelAudioTester::create( @@ -1380,17 +1383,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark + // + // RTPChannelAudioTester => IRTPReceiverChannelAudioForMediaStreamTrack + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark + // + // RTPChannelAudioTester => IRTPSenderChannelAudioForRTPSenderChannel + // //----------------------------------------------------------------------- RTPSenderChannelAudioPtr RTPChannelAudioTester::create( @@ -1405,18 +1408,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark + // + // RTPChannelAudioTester => IRTPReceiverChannelAudioForMediaStreamTrack + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => (friend fake media track, sender and receiver channel) - #pragma mark + // + // RTPChannelAudioTester => (friend fake media track, sender and receiver channel) + // //----------------------------------------------------------------------- RTPReceiverChannelAudioPtr RTPChannelAudioTester::createReceiverChannelAudio( @@ -1468,9 +1471,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => (internal) - #pragma mark + // + // RTPChannelAudioTester => (internal) + // //----------------------------------------------------------------------- Log::Params RTPChannelAudioTester::log(const char *message) const @@ -1993,3 +1996,5 @@ void doTestRTPChannelAudio() TESTING_EQUAL(zsLib::proxyGetTotalConstructed(), 0); } + +#endif //0 diff --git a/ortc/test/TestRTPChannelAudio.h b/ortc/test/TestRTPChannelAudio.h index 80dd397d..41206124 100644 --- a/ortc/test/TestRTPChannelAudio.h +++ b/ortc/test/TestRTPChannelAudio.h @@ -30,12 +30,10 @@ */ - +#if 0 #include -#include #include -#include #include #include @@ -61,8 +59,8 @@ namespace ortc using zsLib::Milliseconds; ZS_DECLARE_USING_PTR(zsLib, ITimer) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_CLASS_PTR(FakeMediaStreamTrack) ZS_DECLARE_CLASS_PTR(FakeReceiverChannel) @@ -74,9 +72,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- class FakeMediaStreamTrack : public ortc::internal::MediaStreamTrack @@ -87,8 +85,6 @@ namespace ortc ZS_DECLARE_TYPEDEF_PTR(internal::ISecureTransport, ISecureTransport) ZS_DECLARE_TYPEDEF_PTR(internal::IRTPReceiverChannelForMediaStreamTrack, UseReceiverChannel) ZS_DECLARE_TYPEDEF_PTR(internal::IRTPSenderChannelForMediaStreamTrack, UseSenderChannel) - ZS_DECLARE_TYPEDEF_PTR(internal::IRTPReceiverChannelAudioForMediaStreamTrack, UseReceiverChannelAudio) - ZS_DECLARE_TYPEDEF_PTR(internal::IRTPSenderChannelAudioForMediaStreamTrack, UseSenderChannelAudio) public: FakeMediaStreamTrack(IMessageQueuePtr queue, bool remote); @@ -100,9 +96,9 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelAudio - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelAudio + // //virtual webrtc::AudioDeviceModule* getAudioDeviceModule() override; @@ -111,9 +107,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelAudio - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelAudio + // // (duplicate) virtual webrtc::AudioDeviceModule* getAudioDeviceModule() = 0; @@ -122,9 +118,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => webrtc::AudioTransport - #pragma mark + // + // FakeMediaStreamTrack => webrtc::AudioTransport + // virtual int32_t RecordedDataIsAvailable( const void* audioSamples, @@ -152,9 +148,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPChannelTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPChannelTester) + // void setTransport(RTPChannelAudioTesterPtr tester); @@ -168,9 +164,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // Log::Params log(const char *message) const; @@ -178,9 +174,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (data) - #pragma mark + // + // FakeMediaStreamTrack => (data) + // FakeMediaStreamTrackWeakPtr mThisWeak; @@ -201,9 +197,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- class FakeReceiverChannel : public ortc::internal::RTPReceiverChannel @@ -231,30 +227,30 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelBase - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelBase + // // (base handles) virtual PUID getID() const = 0; virtual bool sendPacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelAudio - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelAudio + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // virtual ElementPtr toDebug() const override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPChannelAudioTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPChannelAudioTester) + // void setTransport(RTPChannelAudioTesterPtr tester); @@ -268,18 +264,18 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (data) - #pragma mark + // + // FakeReceiverChannel => (data) + // FakeReceiverChannelWeakPtr mThisWeak; @@ -299,9 +295,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- class FakeSenderChannel : public ortc::internal::RTPSenderChannel @@ -329,9 +325,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase + // // (base handles) virtual PUID getID() const = 0; @@ -340,21 +336,21 @@ namespace ortc virtual bool sendPacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelAudio - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelAudio + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack + // virtual ElementPtr toDebug() const override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPChannelTester) + // void setTransport(RTPChannelAudioTesterPtr tester); @@ -366,18 +362,18 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (data) - #pragma mark + // + // FakeSenderChannel => (data) + // FakeSenderChannelWeakPtr mThisWeak; @@ -396,9 +392,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester - #pragma mark + // + // RTPChannelAudioTester + // //----------------------------------------------------------------------- class RTPChannelAudioTester : public SharedRecursiveLock, @@ -480,9 +476,9 @@ namespace ortc typedef std::map SenderChannelAudioMap; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester::OverrideReceiverChannelAudioFactory - #pragma mark + // + // RTPChannelAudioTester::OverrideReceiverChannelAudioFactory + // class OverrideReceiverChannelAudioFactory : public RTPReceiverChannelAudioFactory { @@ -500,9 +496,9 @@ namespace ortc }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester::OverrideSenderChannelAudioFactory - #pragma mark + // + // RTPChannelAudioTester::OverrideSenderChannelAudioFactory + // class OverrideSenderChannelAudioFactory : public RTPSenderChannelAudioFactory { @@ -539,9 +535,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester (api) - #pragma mark + // + // RTPChannelAudioTester (api) + // static RTPChannelAudioTesterPtr create( IMessageQueuePtr queue, @@ -668,9 +664,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPReceiverChannelAudioForRTPReceiverChannel - #pragma mark + // + // RTPChannelAudioTester => IRTPReceiverChannelAudioForRTPReceiverChannel + // // simulate methods calls to IRTPReceiverChannelAudioForRTPReceiverChannel @@ -682,16 +678,16 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPReceiverChannelAudioForMediaStreamTrack - #pragma mark + // + // RTPChannelAudioTester => IRTPReceiverChannelAudioForMediaStreamTrack + // // call methods calls to IRTPReceiverChannelAudioForMediaStreamTrack //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPSenderChannelAudioForRTPSenderChannel - #pragma mark + // + // RTPChannelAudioTester => IRTPSenderChannelAudioForRTPSenderChannel + // // simulate methods calls to IRTPSenderChannelAudioForRTPSenderChannel @@ -703,18 +699,18 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => IRTPSenderChannelAudioForMediaStreamTrack - #pragma mark + // + // RTPChannelAudioTester => IRTPSenderChannelAudioForMediaStreamTrack + // // call methods calls to IRTPSenderChannelAudioForMediaStreamTrack protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => (friend fake media track, sender and receiver channel) - #pragma mark + // + // RTPChannelAudioTester => (friend fake media track, sender and receiver channel) + // RTPReceiverChannelAudioPtr createReceiverChannelAudio( RTPReceiverChannelPtr receiverChannel, @@ -733,9 +729,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => (internal) - #pragma mark + // + // RTPChannelAudioTester => (internal) + // Log::Params log(const char *message) const; @@ -762,9 +758,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelAudioTester => (data) - #pragma mark + // + // RTPChannelAudioTester => (data) + // AutoPUID mID; RTPChannelAudioTesterWeakPtr mThisWeak; @@ -791,3 +787,5 @@ namespace ortc } } } + +#endif //0 diff --git a/ortc/test/TestRTPChannelVideo.cpp b/ortc/test/TestRTPChannelVideo.cpp index f5b3139f..79236d95 100644 --- a/ortc/test/TestRTPChannelVideo.cpp +++ b/ortc/test/TestRTPChannelVideo.cpp @@ -29,11 +29,12 @@ */ +#if 0 #include "TestRTPChannelVideo.h" -#include -#include +#include +#include #include #include @@ -43,11 +44,13 @@ #include "config.h" #include "testing.h" -#include -#include -#include +#include +#include +#include +#include +#include -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -85,9 +88,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark WebRtcTraceCallback - #pragma mark + // + // WebRtcTraceCallback + // class WebRtcTraceCallback : public webrtc::TraceCallback { @@ -121,9 +124,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- FakeMediaStreamTrack::FakeMediaStreamTrack(IMessageQueuePtr queue, bool remote) : @@ -221,9 +224,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrack + // //------------------------------------------------------------------------- void FakeMediaStreamTrack::stop() @@ -255,17 +258,17 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelVideo - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelVideo + // #if 0 //------------------------------------------------------------------------- void FakeMediaStreamTrack::renderVideoFrame(const webrtc::VideoFrame& videoFrame) @@ -280,25 +283,26 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelVideo - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelVideo + // //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => webrtc::VideoCaptureDataCallback - #pragma mark + // + // MediaStreamTrack => webrtc::VideoCaptureDataCallback + // //------------------------------------------------------------------------- void FakeMediaStreamTrack::OnIncomingCapturedFrame(const int32_t id, const webrtc::VideoFrame& videoFrame) { AutoRecursiveLock lock(*this); - if (mVideoRendererCallback) - mVideoRendererCallback->RenderFrame(1, videoFrame); + //Renderer is not in use anymore + //if (mVideoRendererCallback) + // mVideoRendererCallback->RenderFrame(1, videoFrame); auto senderChannel = mSenderChannel.lock(); //if (senderChannel) @@ -315,9 +319,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPChannelTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPChannelTester) + // //----------------------------------------------------------------------- void FakeMediaStreamTrack::setTransport(RTPChannelVideoTesterPtr tester) @@ -358,9 +362,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // //----------------------------------------------------------------------- Log::Params FakeMediaStreamTrack::log(const char *message) const @@ -389,9 +393,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- FakeReceiverChannel::FakeReceiverChannel( @@ -427,9 +431,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelBase - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelBase + // //----------------------------------------------------------------------- bool FakeReceiverChannel::sendPacket(RTCPPacketPtr packet) @@ -442,17 +446,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelVideo - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverForRTPReceiverChannelVideo + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeReceiverChannel::toDebug() const @@ -485,9 +489,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPSenderTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPSenderTester) + // //----------------------------------------------------------------------- void FakeReceiverChannel::setTransport(RTPChannelVideoTesterPtr tester) @@ -530,9 +534,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiverChannel::log(const char *message) const @@ -547,9 +551,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- FakeSenderChannel::FakeSenderChannel( @@ -585,9 +589,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase + // //----------------------------------------------------------------------- bool FakeSenderChannel::sendPacket(RTPPacketPtr packet) @@ -607,17 +611,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelVideo - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelVideo + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack + // //----------------------------------------------------------------------- ElementPtr FakeSenderChannel::toDebug() const @@ -646,9 +650,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPChannelTester) + // void FakeSenderChannel::setTransport(RTPChannelVideoTesterPtr tester) { @@ -679,9 +683,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSenderChannel::log(const char *message) const @@ -696,9 +700,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester::Expectations - #pragma mark + // + // RTPChannelVideoTester::Expectations + // //----------------------------------------------------------------------- bool RTPChannelVideoTester::Expectations::operator==(const Expectations &op2) const @@ -713,9 +717,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester::OverrideReceiverChannelVideoFactory - #pragma mark + // + // RTPChannelVideoTester::OverrideReceiverChannelVideoFactory + // //----------------------------------------------------------------------- RTPChannelVideoTester::OverrideReceiverChannelVideoFactoryPtr RTPChannelVideoTester::OverrideReceiverChannelVideoFactory::create(RTPChannelVideoTesterPtr tester) @@ -742,9 +746,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester::OverrideSenderChannelVideoFactory - #pragma mark + // + // RTPChannelVideoTester::OverrideSenderChannelVideoFactory + // //----------------------------------------------------------------------- RTPChannelVideoTester::OverrideSenderChannelVideoFactoryPtr RTPChannelVideoTester::OverrideSenderChannelVideoFactory::create(RTPChannelVideoTesterPtr tester) @@ -771,9 +775,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester - #pragma mark + // + // RTPChannelVideoTester + // //----------------------------------------------------------------------- RTPChannelVideoTesterPtr RTPChannelVideoTester::create( @@ -1429,9 +1433,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark + // + // RTPChannelVideoTester => IRTPReceiverChannelVideoForRTPReceiverChannel + // //----------------------------------------------------------------------- RTPReceiverChannelVideoPtr RTPChannelVideoTester::create( @@ -1446,17 +1450,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark + // + // RTPChannelVideoTester => IRTPReceiverChannelVideoForMediaStreamTrack + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark + // + // RTPChannelVideoTester => IRTPSenderChannelVideoForRTPSenderChannel + // //----------------------------------------------------------------------- RTPSenderChannelVideoPtr RTPChannelVideoTester::create( @@ -1471,18 +1475,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark + // + // RTPChannelVideoTester => IRTPReceiverChannelVideoForMediaStreamTrack + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => (friend fake media track, sender and receiver channel) - #pragma mark + // + // RTPChannelVideoTester => (friend fake media track, sender and receiver channel) + // //----------------------------------------------------------------------- RTPReceiverChannelVideoPtr RTPChannelVideoTester::createReceiverChannelVideo( @@ -1536,9 +1540,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => (internal) - #pragma mark + // + // RTPChannelVideoTester => (internal) + // //----------------------------------------------------------------------- Log::Params RTPChannelVideoTester::log(const char *message) const @@ -2058,3 +2062,5 @@ void doTestRTPChannelVideo(void* localSurface, void* remoteSurface) zsLib::proxyDump(); TESTING_EQUAL(zsLib::proxyGetTotalConstructed(), 0); } + +#endif //0 diff --git a/ortc/test/TestRTPChannelVideo.h b/ortc/test/TestRTPChannelVideo.h index baa9623a..6a165cd7 100644 --- a/ortc/test/TestRTPChannelVideo.h +++ b/ortc/test/TestRTPChannelVideo.h @@ -30,12 +30,10 @@ */ - +#if 0 #include -#include #include -#include #include #include @@ -59,8 +57,8 @@ namespace ortc using zsLib::Milliseconds; ZS_DECLARE_USING_PTR(zsLib, ITimer) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_CLASS_PTR(FakeMediaStreamTrack) ZS_DECLARE_CLASS_PTR(FakeReceiverChannel) @@ -72,9 +70,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- class FakeMediaStreamTrack : public ortc::internal::MediaStreamTrack, @@ -100,37 +98,37 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrack + // virtual void stop() override; virtual void setVideoRenderCallback(IMediaStreamTrackRenderCallbackPtr callback) override; //----------------------------------------------------------------------- - #pragma mark - #pragma mark MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel - #pragma mark + // + // MediaStreamTrack => IMediaStreamTrackForRTPReceiverChannel + // // (duplicate) virtual PUID getID() const = 0; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelVideo - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiverChannelVideo + // //virtual void renderVideoFrame(const webrtc::VideoFrame& videoFrame) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelVideo - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSenderChannelVideo + // //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => webrtc::VideoCaptureDataCallback - #pragma mark + // + // FakeMediaStreamTrack => webrtc::VideoCaptureDataCallback + // virtual void OnIncomingCapturedFrame(const int32_t id, const webrtc::VideoFrame& videoFrame) override; @@ -138,9 +136,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPChannelTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPChannelTester) + // void setTransport(RTPChannelVideoTesterPtr tester); @@ -154,9 +152,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // Log::Params log(const char *message) const; @@ -164,9 +162,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (data) - #pragma mark + // + // FakeMediaStreamTrack => (data) + // FakeMediaStreamTrackWeakPtr mThisWeak; @@ -189,9 +187,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- class FakeReceiverChannel : public ortc::internal::RTPReceiverChannel @@ -219,23 +217,23 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelBase - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelBase + // // (base handles) virtual PUID getID() const = 0; virtual bool sendPacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelVideo - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForRTPReceiverChannelVideo + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForMediaStreamTrack + // virtual ElementPtr toDebug() const override; @@ -247,9 +245,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPChannelVideoTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPChannelVideoTester) + // void setTransport(RTPChannelVideoTesterPtr tester); @@ -263,18 +261,18 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (data) - #pragma mark + // + // FakeReceiverChannel => (data) + // FakeReceiverChannelWeakPtr mThisWeak; @@ -294,9 +292,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- class FakeSenderChannel : public ortc::internal::RTPSenderChannel @@ -324,9 +322,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelBase + // // (base handles) virtual PUID getID() const = 0; @@ -335,24 +333,24 @@ namespace ortc virtual bool sendPacket(RTCPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelVideo - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSenderChannelVideo + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForMediaStreamTrack + // virtual ElementPtr toDebug() const override; //virtual void sendVideoFrame(const webrtc::VideoFrame& videoFrame) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPChannelTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPChannelTester) + // void setTransport(RTPChannelVideoTesterPtr tester); @@ -364,18 +362,18 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (data) - #pragma mark + // + // FakeSenderChannel => (data) + // FakeSenderChannelWeakPtr mThisWeak; @@ -394,9 +392,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester - #pragma mark + // + // RTPChannelVideoTester + // //----------------------------------------------------------------------- class RTPChannelVideoTester : public SharedRecursiveLock, @@ -478,9 +476,9 @@ namespace ortc typedef std::map SenderChannelVideoMap; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester::OverrideReceiverChannelVideoFactory - #pragma mark + // + // RTPChannelVideoTester::OverrideReceiverChannelVideoFactory + // class OverrideReceiverChannelVideoFactory : public RTPReceiverChannelVideoFactory { @@ -498,9 +496,9 @@ namespace ortc }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester::OverrideSenderChannelVideoFactory - #pragma mark + // + // RTPChannelVideoTester::OverrideSenderChannelVideoFactory + // class OverrideSenderChannelVideoFactory : public RTPSenderChannelVideoFactory { @@ -537,9 +535,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester (api) - #pragma mark + // + // RTPChannelVideoTester (api) + // static RTPChannelVideoTesterPtr create( IMessageQueuePtr queue, @@ -668,9 +666,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPReceiverChannelVideoForRTPReceiverChannel - #pragma mark + // + // RTPChannelVideoTester => IRTPReceiverChannelVideoForRTPReceiverChannel + // // simulate methods calls to IRTPReceiverChannelVideoForRTPReceiverChannel @@ -682,16 +680,16 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPReceiverChannelVideoForMediaStreamTrack - #pragma mark + // + // RTPChannelVideoTester => IRTPReceiverChannelVideoForMediaStreamTrack + // // call methods calls to IRTPReceiverChannelVideoForMediaStreamTrack //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPSenderChannelVideoForRTPSenderChannel - #pragma mark + // + // RTPChannelVideoTester => IRTPSenderChannelVideoForRTPSenderChannel + // // simulate methods calls to IRTPSenderChannelVideoForRTPSenderChannel @@ -703,18 +701,18 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => IRTPSenderChannelVideoForMediaStreamTrack - #pragma mark + // + // RTPChannelVideoTester => IRTPSenderChannelVideoForMediaStreamTrack + // // call methods calls to IRTPSenderChannelVideoForMediaStreamTrack protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => (friend fake media track, sender and receiver channel) - #pragma mark + // + // RTPChannelVideoTester => (friend fake media track, sender and receiver channel) + // RTPReceiverChannelVideoPtr createReceiverChannelVideo( RTPReceiverChannelPtr receiverChannel, @@ -733,9 +731,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => (internal) - #pragma mark + // + // RTPChannelVideoTester => (internal) + // Log::Params log(const char *message) const; @@ -762,9 +760,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPChannelVideoTester => (data) - #pragma mark + // + // RTPChannelVideoTester => (data) + // AutoPUID mID; RTPChannelVideoTesterWeakPtr mThisWeak; @@ -793,3 +791,5 @@ namespace ortc } } } + +#endif //0 diff --git a/ortc/test/TestRTPListener.cpp b/ortc/test/TestRTPListener.cpp index ab74df49..dc58c053 100644 --- a/ortc/test/TestRTPListener.cpp +++ b/ortc/test/TestRTPListener.cpp @@ -32,8 +32,8 @@ #include "TestRTPListener.h" -#include -#include +#include +#include #include #include @@ -43,7 +43,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -76,9 +76,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- static bool isRTCPPacketType(const BYTE *data, size_t len) @@ -94,9 +94,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //----------------------------------------------------------------------- FakeICETransport::FakeICETransport( @@ -160,7 +160,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeICETransport::state(IICETransport::States newState) + void FakeICETransport::set_state(IICETransport::States newState) { AutoRecursiveLock lock(*this); setState(newState); @@ -170,12 +170,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeICETransport::toDebug() const + ElementPtr FakeICETransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -200,9 +200,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) @@ -252,9 +252,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onTimer(ITimerPtr timer) @@ -318,9 +318,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // //----------------------------------------------------------------------- void FakeICETransport::attachSecure(FakeSecureTransportPtr transport) @@ -344,7 +344,7 @@ namespace ortc bool FakeICETransport::sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { FakeICETransportPtr transport; @@ -394,9 +394,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // //----------------------------------------------------------------------- void FakeICETransport::setState(IICETransportTypes::States state) @@ -431,9 +431,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //----------------------------------------------------------------------- FakeSecureTransport::FakeSecureTransport( @@ -479,7 +479,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeSecureTransport::state(IDTLSTransport::States newState) + void FakeSecureTransport::set_state(IDTLSTransport::States newState) { AutoRecursiveLock lock(*this); setState(newState); @@ -496,12 +496,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeSecureTransport::toDebug() const + ElementPtr FakeSecureTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -523,12 +523,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPListener - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPListener + // //----------------------------------------------------------------------- - RTPListenerPtr FakeSecureTransport::getListener() const + RTPListenerPtr FakeSecureTransport::getListener() const noexcept { return RTPListener::convert(mListener); } @@ -537,12 +537,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // //----------------------------------------------------------------------- - PUID FakeSecureTransport::getID() const + PUID FakeSecureTransport::getID() const noexcept { return DTLSTransport::getID(); } @@ -553,7 +553,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { FakeICETransportPtr iceTransport; @@ -571,7 +571,7 @@ namespace ortc } //----------------------------------------------------------------------- - IICETransportPtr FakeSecureTransport::getICETransport() const + IICETransportPtr FakeSecureTransport::getICETransport() const noexcept { return mICETransport; } @@ -580,24 +580,24 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeICETransport - #pragma mark + // + // FakeICETransport => friend FakeICETransport + // //----------------------------------------------------------------------- bool FakeSecureTransport::handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { UseListenerPtr listener; @@ -624,9 +624,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // //----------------------------------------------------------------------- void FakeSecureTransport::setState(IDTLSTransportTypes::States state) @@ -670,9 +670,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- FakeReceiver::FakeReceiver(IMediaStreamTrackTypes::Kinds kind) : @@ -700,12 +700,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiverForRTPListener - #pragma mark + // + // FakeReceiver => IRTPReceiverForRTPListener + // //----------------------------------------------------------------------- - ElementPtr FakeReceiver::toDebug() const + ElementPtr FakeReceiver::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -723,9 +723,9 @@ namespace ortc bool FakeReceiver::handlePacket( IICETypes::Components viaTransport, RTPPacketPtr packet - ) + ) noexcept { - ZS_LOG_BASIC(log("received RTC packet") + packet->toDebug()) + // ZS_LOG_BASIC(log("received RTC packet") + packet->toDebug()) AutoRecursiveLock lock(*this); @@ -746,9 +746,9 @@ namespace ortc bool FakeReceiver::handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) + ) noexcept { - ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) + // ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) AutoRecursiveLock lock(*this); @@ -769,12 +769,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (friend RTPListenerTester) - #pragma mark + // + // FakeReceiver => (friend RTPListenerTester) + // //----------------------------------------------------------------------- - void FakeReceiver::setTransport(RTPListenerTesterPtr tester) + void FakeReceiver::set_Transport(RTPListenerTesterPtr tester) { auto secureTransport = (((bool)tester) ? tester->getFakeSecureTransport() : FakeSecureTransportPtr()); TESTING_CHECK(secureTransport) @@ -822,7 +822,7 @@ namespace ortc } //----------------------------------------------------------------------- - PromisePtr FakeReceiver::receive(const Parameters ¶meters) + PromisePtr FakeReceiver::receive(const Parameters ¶meters) noexcept { AutoRecursiveLock lock(*this); @@ -841,7 +841,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeReceiver::stop() + void FakeReceiver::stop() noexcept { AutoRecursiveLock lock(*this); @@ -854,9 +854,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiver::log(const char *message) const @@ -871,9 +871,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- FakeSender::FakeSender() : @@ -899,12 +899,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPListener - #pragma mark + // + // FakeSender => IRTPSenderForRTPListener + // //----------------------------------------------------------------------- - ElementPtr FakeSender::toDebug() const + ElementPtr FakeSender::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -923,9 +923,9 @@ namespace ortc bool FakeSender::handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) + ) noexcept { - ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) + // ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) AutoRecursiveLock lock(*this); @@ -946,12 +946,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (friend RTPListenerTester) - #pragma mark + // + // FakeSender => (friend RTPListenerTester) + // //----------------------------------------------------------------------- - void FakeSender::setTransport(RTPListenerTesterPtr tester) + void FakeSender::set_Transport(RTPListenerTesterPtr tester) { auto secureTransport = (((bool)tester) ? tester->getFakeSecureTransport() : FakeSecureTransportPtr()); TESTING_CHECK(secureTransport) @@ -987,7 +987,7 @@ namespace ortc } //----------------------------------------------------------------------- - PromisePtr FakeSender::send(const Parameters ¶meters) + PromisePtr FakeSender::send(const Parameters ¶meters) noexcept { AutoRecursiveLock lock(*this); @@ -1006,7 +1006,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeSender::stop() + void FakeSender::stop() noexcept { AutoRecursiveLock lock(*this); @@ -1028,7 +1028,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeSender::sendPacket(SecureByteBlockPtr buffer) + void FakeSender::send_Packet(SecureByteBlockPtr buffer) { UseSecureTransportPtr transport; @@ -1049,9 +1049,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSender::log(const char *message) const @@ -1066,9 +1066,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester - #pragma mark + // + // RTPListenerTester + // //----------------------------------------------------------------------- RTPListenerTester::UnhandledEventData::UnhandledEventData( @@ -1191,7 +1191,7 @@ namespace ortc AutoRecursiveLock lock(*this); transport = mICETransport; } - transport->state(newState); + transport->set_state(newState); } //----------------------------------------------------------------------- @@ -1202,7 +1202,7 @@ namespace ortc AutoRecursiveLock lock(*this); transport = mDTLSTransport; } - transport->state(newState); + transport->set_state(newState); } //----------------------------------------------------------------------- @@ -1337,12 +1337,12 @@ namespace ortc } previousReceiver = receiver; - receiver->setTransport(mThisWeak.lock()); + receiver->set_Transport(mThisWeak.lock()); return; } mAttached[String(receiverID)] = FakePair(receiver, FakeSenderPtr()); - receiver->setTransport(mThisWeak.lock()); + receiver->set_Transport(mThisWeak.lock()); } //----------------------------------------------------------------------- @@ -1362,12 +1362,12 @@ namespace ortc } previousSender = sender; - sender->setTransport(mThisWeak.lock()); + sender->set_Transport(mThisWeak.lock()); return; } mAttached[String(senderID)] = FakePair(FakeReceiverPtr(), sender); - sender->setTransport(mThisWeak.lock()); + sender->set_Transport(mThisWeak.lock()); } //----------------------------------------------------------------------- @@ -1384,7 +1384,7 @@ namespace ortc FakeReceiverPtr receiver = currentReceiver; if (receiver) { - receiver->setTransport(RTPListenerTesterPtr()); + receiver->set_Transport(RTPListenerTesterPtr()); } currentReceiver.reset(); @@ -1407,7 +1407,7 @@ namespace ortc FakeSenderPtr sender = currentSender; if (sender) { - sender->setTransport(RTPListenerTesterPtr()); + sender->set_Transport(RTPListenerTesterPtr()); } currentSender.reset(); @@ -1540,9 +1540,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester::IRTPListenerDelegate - #pragma mark + // + // RTPListenerTester::IRTPListenerDelegate + // //----------------------------------------------------------------------- void RTPListenerTester::onRTPListenerUnhandledRTP( @@ -1571,9 +1571,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester => (friend fake sender/receiver) - #pragma mark + // + // RTPListenerTester => (friend fake sender/receiver) + // //----------------------------------------------------------------------- FakeSecureTransportPtr RTPListenerTester::getFakeSecureTransport() const @@ -1594,9 +1594,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester => (internal) - #pragma mark + // + // RTPListenerTester => (internal) + // //----------------------------------------------------------------------- Log::Params RTPListenerTester::log(const char *message) const @@ -1663,7 +1663,7 @@ namespace ortc FakeSenderPtr sender = getSender(senderID); TESTING_CHECK(sender) - sender->sendPacket(secureBuffer); + sender->send_Packet(secureBuffer); } } } @@ -1678,8 +1678,8 @@ ZS_DECLARE_USING_PTR(ortc, IDataChannel) ZS_DECLARE_USING_PTR(ortc, IRTPListener) ZS_DECLARE_USING_PTR(ortc, IRTPTypes) -ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) -ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) +ZS_DECLARE_USING_PTR(ortc, RTPPacket) +ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::Parameters, Parameters) ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::EncodingParameters, EncodingParameters) diff --git a/ortc/test/TestRTPListener.h b/ortc/test/TestRTPListener.h index 8509db79..6c3a8bdc 100644 --- a/ortc/test/TestRTPListener.h +++ b/ortc/test/TestRTPListener.h @@ -65,9 +65,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeICETransportAsyncDelegate - #pragma mark + // + // IFakeICETransportAsyncDelegate + // interaction IFakeICETransportAsyncDelegate { @@ -78,9 +78,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSecureTransportAsyncDelegate - #pragma mark + // + // IFakeSecureTransportAsyncDelegate + // interaction IFakeSecureTransportAsyncDelegate { @@ -92,12 +92,12 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::rtplistener::IFakeICETransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtplistener::IFakeSecureTransportAsyncDelegate) //ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -//ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +//ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() namespace ortc @@ -111,8 +111,8 @@ namespace ortc using zsLib::Milliseconds; ZS_DECLARE_USING_PTR(zsLib, ITimer) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_USING_PTR(ortc::internal, RTPListener) ZS_DECLARE_CLASS_PTR(FakeICETransport) @@ -125,9 +125,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //--------------------------------------------------------------------- class FakeICETransport : public ortc::internal::ICETransport, @@ -156,9 +156,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (test API) - #pragma mark + // + // FakeICETransport => (test API) + // ~FakeICETransport(); @@ -171,37 +171,37 @@ namespace ortc void linkTransport(FakeICETransportPtr transport); - void state(IICETransport::States newState); + void set_state(IICETransport::States newState); protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //--------------------------------------------------------------------- virtual void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //--------------------------------------------------------------------- virtual void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // void attachSecure(FakeSecureTransportPtr transport); @@ -210,13 +210,13 @@ namespace ortc virtual bool sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) override; + ) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // void setState(IICETransportTypes::States state); @@ -227,9 +227,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (data) - #pragma mark + // + // FakeICETransport => (data) + // FakeICETransportWeakPtr mThisWeak; @@ -257,9 +257,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //--------------------------------------------------------------------- class FakeSecureTransport : public ortc::internal::DTLSTransport, @@ -293,9 +293,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (testing API) - #pragma mark + // + // FakeSecureTransport => (testing API) + // ~FakeSecureTransport(); @@ -304,68 +304,68 @@ namespace ortc FakeICETransportPtr iceTransport ); - void state(IDTLSTransport::States newState); + void set_state(IDTLSTransport::States newState); void setClientRole(bool clientRole); protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPListener - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPListener + // // (duplicate) static ElementPtr toDebug(ForRTPListenerPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual RTPListenerPtr getListener() const override; + RTPListenerPtr getListener() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // - virtual PUID getID() const override; + PUID getID() const noexcept override; - virtual bool sendPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual IICETransportPtr getICETransport() const override; + IICETransportPtr getICETransport() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => friend FakeICETransport - #pragma mark + // + // FakeSecureTransport => friend FakeICETransport + // //--------------------------------------------------------------------- bool handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) override; + ) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // void setState(IDTLSTransportTypes::States state); @@ -377,9 +377,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (data) - #pragma mark + // + // FakeSecureTransport => (data) + // FakeSecureTransportWeakPtr mThisWeak; @@ -396,9 +396,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- class FakeReceiver : public ortc::internal::RTPReceiver @@ -416,40 +416,40 @@ namespace ortc static FakeReceiverPtr create(IMediaStreamTrackTypes::Kinds kind); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiverForRTPListener - #pragma mark + // + // FakeReceiver => IRTPReceiverForRTPListener + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTPPacketPtr packet + ) noexcept override; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTCPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTCPPacketPtr packet + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (friend RTPListenerTester) - #pragma mark + // + // FakeReceiver => (friend RTPListenerTester) + // - void setTransport(RTPListenerTesterPtr tester); + void set_Transport(RTPListenerTesterPtr tester); void expectData(SecureByteBlockPtr data); - virtual PromisePtr receive(const Parameters ¶meters) override; + PromisePtr receive(const Parameters ¶meters) noexcept override; - virtual void stop() override; + void stop() noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // Log::Params log(const char *message) const; @@ -470,9 +470,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- class FakeSender : public ortc::internal::RTPSender @@ -491,48 +491,48 @@ namespace ortc static FakeSenderPtr create(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPListener - #pragma mark + // + // FakeSender => IRTPSenderForRTPListener + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; - // (duplicate) virtual PUID getID() const = 0; + // (duplicate) virtual PUID getID() const noexcept = 0; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTCPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTCPPacketPtr packet + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (friend RTPListenerTester) - #pragma mark + // + // FakeSender => (friend RTPListenerTester) + // - void setTransport(RTPListenerTesterPtr tester); + void set_Transport(RTPListenerTesterPtr tester); - virtual PromisePtr send(const Parameters ¶meters) override; - virtual void stop() override; + PromisePtr send(const Parameters ¶meters) noexcept override; + void stop() noexcept override; void expectData(SecureByteBlockPtr data); - void sendPacket(SecureByteBlockPtr buffer); + void send_Packet(SecureByteBlockPtr buffer); protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (data) - #pragma mark + // + // RTPSender => (data) + // FakeSenderWeakPtr mThisWeak; @@ -550,9 +550,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester - #pragma mark + // + // RTPListenerTester + // //----------------------------------------------------------------------- class RTPListenerTester : public SharedRecursiveLock, @@ -574,9 +574,9 @@ namespace ortc typedef std::map PacketMap; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester::UnhandledEventData - #pragma mark + // + // RTPListenerTester::UnhandledEventData + // struct UnhandledEventData { @@ -616,9 +616,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester (api) - #pragma mark + // + // RTPListenerTester (api) + // static RTPListenerTesterPtr create( IMessageQueuePtr queue, @@ -704,9 +704,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester::IRTPListenerDelegate - #pragma mark + // + // RTPListenerTester::IRTPListenerDelegate + // virtual void onRTPListenerUnhandledRTP( IRTPListenerPtr listener, @@ -717,9 +717,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester => (friend fake sender/receiver) - #pragma mark + // + // RTPListenerTester => (friend fake sender/receiver) + // FakeSecureTransportPtr getFakeSecureTransport() const; @@ -727,9 +727,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester => (internal) - #pragma mark + // + // RTPListenerTester => (internal) + // Log::Params log(const char *message) const; @@ -749,9 +749,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPListenerTester => (data) - #pragma mark + // + // RTPListenerTester => (data) + // AutoPUID mID; RTPListenerTesterWeakPtr mThisWeak; diff --git a/ortc/test/TestRTPPacket.cpp b/ortc/test/TestRTPPacket.cpp index 3f0ee14e..098c7f71 100644 --- a/ortc/test/TestRTPPacket.cpp +++ b/ortc/test/TestRTPPacket.cpp @@ -31,7 +31,7 @@ -#include +#include #include #include @@ -45,7 +45,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using std::make_shared; @@ -75,7 +75,7 @@ namespace ortc namespace rtppacket { ZS_DECLARE_CLASS_PTR(Tester) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) class Tester : public SharedRecursiveLock { @@ -239,7 +239,7 @@ static void bogusSleep() #define TEST_BASIC_RTP 0 ZS_DECLARE_USING_PTR(ortc::test::rtppacket, Tester) -ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) +ZS_DECLARE_USING_PTR(ortc, RTPPacket) static BYTE gHeader1[] = { diff --git a/ortc/test/TestRTPReceiver.cpp b/ortc/test/TestRTPReceiver.cpp index 41cb29aa..c7dd4ff5 100644 --- a/ortc/test/TestRTPReceiver.cpp +++ b/ortc/test/TestRTPReceiver.cpp @@ -32,8 +32,8 @@ #include "TestRTPReceiver.h" -#include -#include +#include +#include #include #include @@ -43,7 +43,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -81,9 +81,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- static bool isRTCPPacketType(const BYTE *data, size_t len) @@ -99,9 +99,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //----------------------------------------------------------------------- FakeICETransport::FakeICETransport( @@ -175,12 +175,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeICETransport::toDebug() const + ElementPtr FakeICETransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -205,9 +205,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) @@ -257,9 +257,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onTimer(ITimerPtr timer) @@ -323,9 +323,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // //----------------------------------------------------------------------- void FakeICETransport::attachSecure(FakeSecureTransportPtr transport) @@ -349,7 +349,7 @@ namespace ortc bool FakeICETransport::sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { FakeICETransportPtr transport; @@ -396,13 +396,13 @@ namespace ortc } //----------------------------------------------------------------------- - IICETransportTypes::States FakeICETransport::state() const + IICETransportTypes::States FakeICETransport::state() const noexcept { return mCurrentState; } //------------------------------------------------------------------------- - IICETransportSubscriptionPtr FakeICETransport::subscribe(IICETransportDelegatePtr originalDelegate) + IICETransportSubscriptionPtr FakeICETransport::subscribe(IICETransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -428,9 +428,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // //----------------------------------------------------------------------- void FakeICETransport::setState(IICETransportTypes::States state) @@ -465,9 +465,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //----------------------------------------------------------------------- FakeSecureTransport::FakeSecureTransport( @@ -534,12 +534,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeSecureTransport::toDebug() const + ElementPtr FakeSecureTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -561,12 +561,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPReceiver + // //----------------------------------------------------------------------- - RTPListenerPtr FakeSecureTransport::getListener() const + RTPListenerPtr FakeSecureTransport::getListener() const noexcept { return RTPListener::convert(mListener); } @@ -575,26 +575,26 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPReceiver + // //----------------------------------------------------------------------- - PUID FakeSecureTransport::getID() const + PUID FakeSecureTransport::getID() const noexcept { return DTLSTransport::getID(); } //----------------------------------------------------------------------- - FakeSecureTransport::ISecureTransportSubscriptionPtr FakeSecureTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) + FakeSecureTransport::ISecureTransportSubscriptionPtr FakeSecureTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -617,7 +617,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISecureTransportTypes::States FakeSecureTransport::state(ISecureTransportTypes::States ignored) const + ISecureTransportTypes::States FakeSecureTransport::state(ISecureTransportTypes::States ignored) const noexcept { return getSecureState(); } @@ -628,7 +628,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { FakeICETransportPtr iceTransport; @@ -646,7 +646,7 @@ namespace ortc } //----------------------------------------------------------------------- - IICETransportPtr FakeSecureTransport::getICETransport() const + IICETransportPtr FakeSecureTransport::getICETransport() const noexcept { return mICETransport; } @@ -655,9 +655,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => IICETransportDelegate + // //----------------------------------------------------------------------- void FakeSecureTransport::onICETransportStateChange( @@ -702,24 +702,24 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeICETransport - #pragma mark + // + // FakeICETransport => friend FakeICETransport + // //----------------------------------------------------------------------- bool FakeSecureTransport::handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { UseListenerPtr listener; @@ -746,9 +746,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // //----------------------------------------------------------------------- void FakeSecureTransport::setState(IDTLSTransportTypes::States state) @@ -790,7 +790,7 @@ namespace ortc } //----------------------------------------------------------------------- - IDTLSTransportTypes::States FakeSecureTransport::state() const + IDTLSTransportTypes::States FakeSecureTransport::state() const noexcept { return mCurrentState; } @@ -850,9 +850,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener - #pragma mark + // + // FakeListener + // //----------------------------------------------------------------------- FakeListener::FakeListener(IMessageQueuePtr queue) : @@ -894,12 +894,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPReceiverForRTPReceiver - #pragma mark + // + // FakeListener => IRTPReceiverForRTPReceiver + // //----------------------------------------------------------------------- - ElementPtr FakeListener::toDebug() const + ElementPtr FakeListener::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -929,7 +929,7 @@ namespace ortc UseReceiverPtr inReceiver, const Parameters &inParams, RTCPPacketList *outPacketList - ) + ) noexcept { ZS_LOG_BASIC(log("register receiver") + ZS_PARAM("receiver", inReceiver->getID()) + inParams.toDebug()) @@ -952,7 +952,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeListener::unregisterReceiver(UseReceiver &inReceiver) + void FakeListener::unregisterReceiver(UseReceiver &inReceiver) noexcept { ZS_LOG_BASIC(log("unregister receiver") + ZS_PARAM("receiver", inReceiver.getID())) @@ -970,7 +970,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeListener::getPackets(RTCPPacketList &outPacketList) + void FakeListener::getPackets(RTCPPacketList &outPacketList) noexcept { outPacketList.clear(); @@ -987,7 +987,7 @@ namespace ortc const String &rid, IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -1020,16 +1020,16 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPSender - #pragma mark + // + // FakeListener => IRTPListenerForRTPSender + // //----------------------------------------------------------------------- void FakeListener::registerSender( UseSenderPtr inSender, const Parameters &inParams, RTCPPacketList &outPacketList - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -1047,7 +1047,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeListener::unregisterSender(UseSender &inSender) + void FakeListener::unregisterSender(UseSender &inSender) noexcept { AutoRecursiveLock lock(*this); @@ -1071,9 +1071,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForSecureTransport - #pragma mark + // + // FakeListener => IRTPListenerForSecureTransport + // //----------------------------------------------------------------------- bool FakeListener::handleRTPPacket( @@ -1081,7 +1081,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { RTPPacketPtr rtpPacket; RTCPPacketPtr rtcpPacket; @@ -1155,9 +1155,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => ITimerDelegate - #pragma mark + // + // FakeListener => ITimerDelegate + // //----------------------------------------------------------------------- void FakeListener::onTimer(ITimerPtr timer) @@ -1191,9 +1191,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IFakeListenerAsyncDelegate - #pragma mark + // + // FakeListener => IFakeListenerAsyncDelegate + // //----------------------------------------------------------------------- void FakeListener::onForwardBufferedPacket(RTPPacketPtr packet) @@ -1206,11 +1206,11 @@ namespace ortc } if (!receiver) { - ZS_LOG_WARNING(Basic, log("dropping packet as receiver is gone") + packet->toDebug()) + //ZS_LOG_WARNING(Basic, log("dropping packet as receiver is gone") + packet->toDebug()) return; } - ZS_LOG_DEBUG(log("forwarding packet to receiver") + ZS_PARAM("receiver", receiver->getID()) + packet->toDebug()) + //ZS_LOG_DEBUG(log("forwarding packet to receiver") + ZS_PARAM("receiver", receiver->getID()) + packet->toDebug()) receiver->handlePacket(IICETypes::Component_RTP, packet); } @@ -1219,9 +1219,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (friend RTPReceiverTester) - #pragma mark + // + // FakeListener => (friend RTPReceiverTester) + // //----------------------------------------------------------------------- void FakeListener::setTransport(RTPReceiverTesterPtr tester) @@ -1232,7 +1232,7 @@ namespace ortc } //----------------------------------------------------------------------- - IRTPListenerSubscriptionPtr FakeListener::subscribe(IRTPListenerDelegatePtr originalDelegate) + IRTPListenerSubscriptionPtr FakeListener::subscribe(IRTPListenerDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to listener")) @@ -1260,9 +1260,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (internal) - #pragma mark + // + // FakeListener => (internal) + // //----------------------------------------------------------------------- Log::Params FakeListener::log(const char *message) const @@ -1295,9 +1295,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- FakeReceiverChannel::FakeReceiverChannel( @@ -1319,12 +1319,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForRTPReceiver + // //----------------------------------------------------------------------- - ElementPtr FakeReceiverChannel::toDebug() const + ElementPtr FakeReceiverChannel::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1368,33 +1368,33 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeReceiverChannel::notifyTransportState(ISecureTransport::States state) + void FakeReceiverChannel::notifyTransportState(ISecureTransport::States state) noexcept { IFakeReceiverChannelAsyncDelegateProxy::create(mThisWeak.lock())->onState(state); } //----------------------------------------------------------------------- - void FakeReceiverChannel::notifyPacket(RTPPacketPtr packet) + void FakeReceiverChannel::notifyPacket(RTPPacketPtr packet) noexcept { IFakeReceiverChannelAsyncDelegateProxy::create(mThisWeak.lock())->onRTPPacket(packet); } //----------------------------------------------------------------------- - void FakeReceiverChannel::notifyPackets(RTCPPacketListPtr packets) + void FakeReceiverChannel::notifyPackets(RTCPPacketListPtr packets) noexcept { IFakeReceiverChannelAsyncDelegateProxy::create(mThisWeak.lock())->onRTCPPackets(packets); } //----------------------------------------------------------------------- - void FakeReceiverChannel::notifyUpdate(const Parameters ¶ms) + void FakeReceiverChannel::notifyUpdate(const Parameters ¶ms) noexcept { IFakeReceiverChannelAsyncDelegateProxy::create(mThisWeak.lock())->onUpdate(make_shared(params)); } //----------------------------------------------------------------------- - bool FakeReceiverChannel::handlePacket(RTPPacketPtr packet) + bool FakeReceiverChannel::handlePacket(RTPPacketPtr packet) noexcept { - ZS_LOG_BASIC(log("handle packet") + packet->toDebug()) + //ZS_LOG_BASIC(log("handle packet") + packet->toDebug()) RTPReceiverTesterPtr tester; @@ -1417,9 +1417,9 @@ namespace ortc } //----------------------------------------------------------------------- - bool FakeReceiverChannel::handlePacket(RTCPPacketPtr packet) + bool FakeReceiverChannel::handlePacket(RTCPPacketPtr packet) noexcept { - ZS_LOG_BASIC(log("handle packet") + packet->toDebug()) + // ZS_LOG_BASIC(log("handle packet") + packet->toDebug()) RTPReceiverTesterPtr tester; @@ -1445,9 +1445,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate - #pragma mark + // + // FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate + // //----------------------------------------------------------------------- void FakeReceiverChannel::onState(ISecureTransportTypes::States state) @@ -1521,9 +1521,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPReceiverTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPReceiverTester) + // //----------------------------------------------------------------------- FakeReceiverChannelPtr FakeReceiverChannel::create( @@ -1546,7 +1546,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool FakeReceiverChannel::sendPacket(RTCPPacketPtr packet) + bool FakeReceiverChannel::send_Packet(RTCPPacketPtr packet) { UseReceiverPtr receiver; @@ -1595,9 +1595,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiverChannel::log(const char *message) const @@ -1613,9 +1613,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- FakeMediaStreamTrack::FakeMediaStreamTrack(IMessageQueuePtr queue) : @@ -1633,11 +1633,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiver - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiver + // //----------------------------------------------------------------------- +#if 0 ElementPtr FakeMediaStreamTrack::toDebug() const { AutoRecursiveLock lock(*this); @@ -1655,6 +1656,7 @@ namespace ortc return result; } +#endif //0 //----------------------------------------------------------------------- void FakeMediaStreamTrack::create(IMediaStreamTrackTypes::Kinds kind) @@ -1665,6 +1667,7 @@ namespace ortc TESTING_CHECK(mKind == kind) } +#if 0 //----------------------------------------------------------------------- void FakeMediaStreamTrack::notifyActiveReceiverChannel(RTPReceiverChannelPtr inChannel) { @@ -1691,14 +1694,15 @@ namespace ortc tester->notifyActiveReceiverChannel(); } +#endif //0 //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPReceiverTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPReceiverTester) + // //----------------------------------------------------------------------- FakeMediaStreamTrackPtr FakeMediaStreamTrack::create( @@ -1731,9 +1735,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // //----------------------------------------------------------------------- Log::Params FakeMediaStreamTrack::log(const char *message) const @@ -1747,9 +1751,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- FakeSender::FakeSender(IMessageQueuePtr queue) : @@ -1775,12 +1779,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPReceiver - #pragma mark + // + // FakeSender => IRTPSenderForRTPReceiver + // //----------------------------------------------------------------------- - ElementPtr FakeSender::toDebug() const + ElementPtr FakeSender::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1799,9 +1803,9 @@ namespace ortc bool FakeSender::handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) + ) noexcept { - ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) + //ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) AutoRecursiveLock lock(*this); @@ -1822,12 +1826,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (friend RTPReceiverTester) - #pragma mark + // + // FakeSender => (friend RTPReceiverTester) + // //----------------------------------------------------------------------- - void FakeSender::setTransport(RTPReceiverTesterPtr tester) + void FakeSender::set_Transport(RTPReceiverTesterPtr tester) { auto secureTransport = (((bool)tester) ? tester->getFakeSecureTransport() : FakeSecureTransportPtr()); TESTING_CHECK(secureTransport) @@ -1863,7 +1867,7 @@ namespace ortc } //----------------------------------------------------------------------- - PromisePtr FakeSender::send(const Parameters ¶meters) + PromisePtr FakeSender::send(const Parameters ¶meters) noexcept { AutoRecursiveLock lock(*this); @@ -1882,7 +1886,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeSender::stop() + void FakeSender::stop() noexcept { AutoRecursiveLock lock(*this); @@ -1904,7 +1908,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeSender::sendPacket(SecureByteBlockPtr buffer) + void FakeSender::send_Packet(SecureByteBlockPtr buffer) { UseSecureTransportPtr transport; @@ -1925,9 +1929,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSender::log(const char *message) const @@ -1942,9 +1946,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::UnhandledEventData - #pragma mark + // + // RTPReceiverTester::UnhandledEventData + // //----------------------------------------------------------------------- RTPReceiverTester::UnhandledEventData::UnhandledEventData( @@ -1973,9 +1977,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::Expectations - #pragma mark + // + // RTPReceiverTester::Expectations + // //----------------------------------------------------------------------- bool RTPReceiverTester::Expectations::operator==(const Expectations &op2) const @@ -1997,9 +2001,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::OverrideReceiverChannelFactory - #pragma mark + // + // RTPReceiverTester::OverrideReceiverChannelFactory + // //----------------------------------------------------------------------- RTPReceiverTester::OverrideReceiverChannelFactoryPtr RTPReceiverTester::OverrideReceiverChannelFactory::create(RTPReceiverTesterPtr tester) @@ -2015,7 +2019,7 @@ namespace ortc MediaStreamTrackPtr track, const Parameters ¶ms, const RTCPPacketList &packets - ) + ) noexcept { auto tester = mTester.lock(); TESTING_CHECK(tester) @@ -2027,9 +2031,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::OverrideReceiverChannelFactory - #pragma mark + // + // RTPReceiverTester::OverrideReceiverChannelFactory + // //----------------------------------------------------------------------- RTPReceiverTester::OverrideMediaStreamTrackFactoryPtr RTPReceiverTester::OverrideMediaStreamTrackFactory::create(RTPReceiverTesterPtr tester) @@ -2063,9 +2067,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester - #pragma mark + // + // RTPReceiverTester + // //----------------------------------------------------------------------- RTPReceiverTesterPtr RTPReceiverTester::create( @@ -2376,12 +2380,12 @@ namespace ortc } previousSender = sender; - sender->setTransport(mThisWeak.lock()); + sender->set_Transport(mThisWeak.lock()); return; } mAttached[String(senderID)] = FakeReceiverChannelFakeSenderPair(FakeReceiverChannelPtr(), sender); - sender->setTransport(mThisWeak.lock()); + sender->set_Transport(mThisWeak.lock()); } //----------------------------------------------------------------------- @@ -2438,7 +2442,7 @@ namespace ortc FakeSenderPtr sender = currentSender; if (sender) { - sender->setTransport(RTPReceiverTesterPtr()); + sender->set_Transport(RTPReceiverTesterPtr()); } currentSender.reset(); @@ -2703,9 +2707,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::IRTPReceiverDelegate - #pragma mark + // + // RTPReceiverTester::IRTPReceiverDelegate + // //----------------------------------------------------------------------- void RTPReceiverTester::onRTPListenerUnhandledRTP( @@ -2734,17 +2738,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::IRTPReceiverDelegate - #pragma mark + // + // RTPReceiverTester::IRTPReceiverDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester => (friend fake sender/receiver) - #pragma mark + // + // RTPReceiverTester => (friend fake sender/receiver) + // //----------------------------------------------------------------------- FakeSecureTransportPtr RTPReceiverTester::getFakeSecureTransport() const @@ -2852,9 +2856,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester => (internal) - #pragma mark + // + // RTPReceiverTester => (internal) + // //----------------------------------------------------------------------- Log::Params RTPReceiverTester::log(const char *message) const @@ -2921,7 +2925,7 @@ namespace ortc FakeSenderPtr sender = getSender(senderOrReceiverChannelID); TESTING_CHECK(sender) - sender->sendPacket(secureBuffer); + sender->send_Packet(secureBuffer); } } } @@ -2936,8 +2940,8 @@ ZS_DECLARE_USING_PTR(ortc, IDataChannel) ZS_DECLARE_USING_PTR(ortc, IRTPReceiver) ZS_DECLARE_USING_PTR(ortc, IRTPTypes) -ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) -ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) +ZS_DECLARE_USING_PTR(ortc, RTPPacket) +ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_TYPEDEF_PTR(ortc::internal::ISecureTransportTypes, ISecureTransportTypes) ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::Parameters, Parameters) diff --git a/ortc/test/TestRTPReceiver.h b/ortc/test/TestRTPReceiver.h index aad06b2a..9e316a1e 100644 --- a/ortc/test/TestRTPReceiver.h +++ b/ortc/test/TestRTPReceiver.h @@ -69,9 +69,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeICETransportAsyncDelegate - #pragma mark + // + // IFakeICETransportAsyncDelegate + // interaction IFakeICETransportAsyncDelegate { @@ -82,9 +82,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSecureTransportAsyncDelegate - #pragma mark + // + // IFakeSecureTransportAsyncDelegate + // interaction IFakeSecureTransportAsyncDelegate { @@ -95,13 +95,13 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeListenerAsyncDelegate - #pragma mark + // + // IFakeListenerAsyncDelegate + // interaction IFakeListenerAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTPPacket, RTPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTPPacket, RTPPacket) virtual void onForwardBufferedPacket(RTPPacketPtr packet) = 0; }; @@ -110,15 +110,15 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeReceiverChannelAsyncDelegate - #pragma mark + // + // IFakeReceiverChannelAsyncDelegate + // interaction IFakeReceiverChannelAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTPPacket, RTPPacket) - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTCPPacket, RTCPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTPPacket, RTPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTCPPacket, RTCPPacket) ZS_DECLARE_TYPEDEF_PTR(std::list, RTCPPacketList) ZS_DECLARE_TYPEDEF_PTR(ortc::internal::ISecureTransportTypes, ISecureTransportTypes) ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::Parameters, Parameters) @@ -135,7 +135,7 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpreceiver::IFakeICETransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpreceiver::IFakeSecureTransportAsyncDelegate) @@ -144,20 +144,20 @@ ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpreceiver::IFakeSecureTransportAsyncDelegat ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpreceiver::IFakeListenerAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onForwardBufferedPacket, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onForwardBufferedPacket, RTPPacketPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpreceiver::IFakeReceiverChannelAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransportTypes::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPTypes::Parameters, Parameters) -ZS_DECLARE_PROXY_METHOD_1(onState, States) -ZS_DECLARE_PROXY_METHOD_1(onRTPPacket, RTPPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onRTCPPacket, RTCPPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onRTCPPackets, RTCPPacketListPtr) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) +ZS_DECLARE_PROXY_METHOD(onState, States) +ZS_DECLARE_PROXY_METHOD(onRTPPacket, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onRTCPPacket, RTCPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onRTCPPackets, RTCPPacketListPtr) +ZS_DECLARE_PROXY_METHOD(onUpdate, ParametersPtr) ZS_DECLARE_PROXY_END() namespace ortc @@ -171,8 +171,8 @@ namespace ortc using zsLib::Milliseconds; ZS_DECLARE_USING_PTR(zsLib, ITimer) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_USING_PTR(ortc::internal, RTPReceiver) ZS_DECLARE_USING_PTR(ortc::internal, MediaStreamTrack) @@ -188,9 +188,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //--------------------------------------------------------------------- class FakeICETransport : public ortc::internal::ICETransport, @@ -219,9 +219,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (test API) - #pragma mark + // + // FakeICETransport => (test API) + // ~FakeICETransport(); @@ -238,52 +238,52 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //--------------------------------------------------------------------- - virtual void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; + void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //--------------------------------------------------------------------- - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // void attachSecure(FakeSecureTransportPtr transport); void detachSecure(FakeSecureTransport &transport); - virtual bool sendPacket( - const BYTE *buffer, - size_t bufferSizeInBytes - ) override; + bool sendPacket( + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept override; - virtual States state() const override; + States state() const noexcept override; - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) override; + IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // void setState(IICETransportTypes::States state); @@ -293,9 +293,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (data) - #pragma mark + // + // FakeICETransport => (data) + // FakeICETransportWeakPtr mThisWeak; @@ -323,9 +323,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //--------------------------------------------------------------------- class FakeSecureTransport : public ortc::internal::DTLSTransport, @@ -363,9 +363,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (testing API) - #pragma mark + // + // FakeSecureTransport => (testing API) + // ~FakeSecureTransport(); @@ -380,28 +380,28 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPListener - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPListener + // // (duplicate) static ElementPtr toDebug(ForRTPReceiverPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual RTPListenerPtr getListener() const override; + RTPListenerPtr getListener() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); @@ -430,9 +430,9 @@ namespace ortc // (duplicate) virtual IICETransportPtr getICETransport() const = 0; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPReceiver - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPReceiver + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); @@ -445,25 +445,25 @@ namespace ortc // ForRTPSenderPtr &outRTCPSecureTransport // ); - virtual PUID getID() const override; + PUID getID() const noexcept override; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) override; + ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept override; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const override; + ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const noexcept override; - virtual bool sendPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual IICETransportPtr getICETransport() const override; + IICETransportPtr getICETransport() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => IICETransportDelegate + // virtual void onICETransportStateChange( IICETransportPtr transport, @@ -486,27 +486,27 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => friend FakeICETransport - #pragma mark + // + // FakeSecureTransport => friend FakeICETransport + // //--------------------------------------------------------------------- bool handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) override; + ) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // void setState(IDTLSTransportTypes::States state); @@ -516,16 +516,16 @@ namespace ortc void cancel(); - virtual States state() const override; + States state() const noexcept override; void notifySecureState(); ISecureTransportTypes::States getSecureState() const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (data) - #pragma mark + // + // FakeSecureTransport => (data) + // FakeSecureTransportWeakPtr mThisWeak; @@ -548,9 +548,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener - #pragma mark + // + // FakeListener + // //----------------------------------------------------------------------- class FakeListener : public ortc::internal::RTPListener, @@ -585,38 +585,38 @@ namespace ortc static FakeListenerPtr convert(RTPListenerPtr listener); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPReceiver - #pragma mark + // + // FakeListener => IRTPListenerForRTPReceiver + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (not needed) static ForRTPReceiverPtr getListener(IRTPTransportPtr rtpTransport); // (base hanlded) virtual PUID getID() const = 0; - virtual void registerReceiver( - Optional kind, - UseReceiverPtr inReceiver, - const Parameters &inParams, - RTCPPacketList *outPacketList = NULL - ) override; + void registerReceiver( + Optional kind, + UseReceiverPtr inReceiver, + const Parameters &inParams, + RTCPPacketList *outPacketList = NULL + ) noexcept override; - virtual void unregisterReceiver(UseReceiver &inReceiver) override; + void unregisterReceiver(UseReceiver &inReceiver) noexcept override; - virtual void getPackets(RTCPPacketList &outPacketList) override; + void getPackets(RTCPPacketList &outPacketList) noexcept override; - virtual void notifyUnhandled( - const String &muxID, - const String &rid, - IRTPTypes::SSRCType ssrc, - IRTPTypes::PayloadType payloadType - ) override; + void notifyUnhandled( + const String &muxID, + const String &rid, + IRTPTypes::SSRCType ssrc, + IRTPTypes::PayloadType payloadType + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPSender - #pragma mark + // + // FakeListener => IRTPListenerForRTPSender + // // (duplciate) static ElementPtr toDebug(ForRTPSenderPtr listener); @@ -624,18 +624,18 @@ namespace ortc // (base handled) virtual PUID getID() const = 0; - virtual void registerSender( - UseSenderPtr inSender, - const Parameters &inParams, - RTCPPacketList &outPacketList - ) override; + void registerSender( + UseSenderPtr inSender, + const Parameters &inParams, + RTCPPacketList &outPacketList + ) noexcept override; - virtual void unregisterSender(UseSender &inSender) override; + void unregisterSender(UseSender &inSender) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForSecureTransport - #pragma mark + // + // FakeListener => IRTPListenerForSecureTransport + // // (duplicate) virtual ElementPtr toDebug() override; @@ -643,41 +643,41 @@ namespace ortc // (base handles) virtual PUID getID() const = 0; - virtual bool handleRTPPacket( - IICETypes::Components viaComponent, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleRTPPacket( + IICETypes::Components viaComponent, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => Timer - #pragma mark + // + // FakeListener => Timer + // - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IFakeListenerAsyncDelegate - #pragma mark + // + // FakeListener => IFakeListenerAsyncDelegate + // - virtual void onForwardBufferedPacket(RTPPacketPtr packet) override; + void onForwardBufferedPacket(RTPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (friend RTPReceiverTester) - #pragma mark + // + // FakeListener => (friend RTPReceiverTester) + // void setTransport(RTPReceiverTesterPtr tester); - virtual IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr originalDelegate) override; + IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr originalDelegate) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (internal) - #pragma mark + // + // FakeListener => (internal) + // Log::Params log(const char *message) const; @@ -708,9 +708,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel - #pragma mark + // + // FakeReceiverChannel + // //----------------------------------------------------------------------- class FakeReceiverChannel : public ortc::internal::RTPReceiverChannel, @@ -740,11 +740,11 @@ namespace ortc ~FakeReceiverChannel(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IRTPReceiverChannelForRTPReceiver - #pragma mark + // + // FakeReceiverChannel => IRTPReceiverChannelForRTPReceiver + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; void create( RTPReceiverPtr receiver, @@ -755,22 +755,22 @@ namespace ortc // (base handles) virtual PUID getID() const = 0; - virtual void notifyTransportState(ISecureTransport::States state) override; + void notifyTransportState(ISecureTransport::States state) noexcept override; - virtual void notifyPacket(RTPPacketPtr packet) override; + void notifyPacket(RTPPacketPtr packet) noexcept override; - virtual void notifyPackets(RTCPPacketListPtr packets) override; + void notifyPackets(RTCPPacketListPtr packets) noexcept override; - virtual void notifyUpdate(const Parameters ¶ms) override; + void notifyUpdate(const Parameters ¶ms) noexcept override; - virtual bool handlePacket(RTPPacketPtr packet) override; + bool handlePacket(RTPPacketPtr packet) noexcept override; - virtual bool handlePacket(RTCPPacketPtr packet) override; + bool handlePacket(RTCPPacketPtr packet) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate - #pragma mark + // + // FakeReceiverChannel => IFakeReceiverChannelAsyncDelegate + // virtual void onState(ISecureTransportTypes::States state) override; virtual void onRTPPacket(RTPPacketPtr packet) override; @@ -779,9 +779,9 @@ namespace ortc virtual void onUpdate(ParametersPtr params) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPReceiverTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPReceiverTester) + // static FakeReceiverChannelPtr create( IMessageQueuePtr queue, @@ -791,7 +791,7 @@ namespace ortc void setTransport(RTPReceiverTesterPtr tester); - bool sendPacket(RTCPPacketPtr packet); + bool send_Packet(RTCPPacketPtr packet); void expectState(ISecureTransport::States state); @@ -803,9 +803,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // Log::Params log(const char *message) const; @@ -830,9 +830,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- class FakeMediaStreamTrack : public ortc::internal::MediaStreamTrack @@ -850,22 +850,28 @@ namespace ortc ~FakeMediaStreamTrack(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiver - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPReceiver + // - virtual ElementPtr toDebug() const override; +#pragma ZS_BUILD_NOTE("TODO","no more toDebug") +#if 0 + ElementPtr toDebug() const noexcept override; +#endif // 0 void create(IMediaStreamTrackTypes::Kinds kind); // (base handles) virtual PUID getID() const = 0; - virtual void notifyActiveReceiverChannel(RTPReceiverChannelPtr channel) override; +#pragma ZS_BUILD_NOTE("TODO","no more receiver channel") +#if 0 + void notifyActiveReceiverChannel(RTPReceiverChannelPtr channel) noexcept override; +#endif //0 //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (friend RTPReceiverTester) - #pragma mark + // + // FakeReceiverChannel => (friend RTPReceiverTester) + // static FakeMediaStreamTrackPtr create( IMessageQueuePtr queue, @@ -878,17 +884,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (internal) - #pragma mark + // + // FakeReceiverChannel => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiverChannel => (data) - #pragma mark + // + // FakeReceiverChannel => (data) + // FakeMediaStreamTrackWeakPtr mThisWeak; IMediaStreamTrackTypes::Kinds mKind {IMediaStreamTrackTypes::Kind_Audio}; @@ -904,9 +910,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender - #pragma mark + // + // FakeSender + // //----------------------------------------------------------------------- class FakeSender : public ortc::internal::RTPSender @@ -925,47 +931,47 @@ namespace ortc static FakeSenderPtr create(IMessageQueuePtr queue); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => IRTPSenderForRTPListener - #pragma mark + // + // FakeSender => IRTPSenderForRTPListener + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (duplicate) virtual PUID getID() const = 0; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTCPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTCPPacketPtr packet + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (friend RTPReceiverTester) - #pragma mark + // + // FakeSender => (friend RTPReceiverTester) + // - void setTransport(RTPReceiverTesterPtr tester); + void set_Transport(RTPReceiverTesterPtr tester); - virtual PromisePtr send(const Parameters ¶meters) override; - virtual void stop() override; + PromisePtr send(const Parameters ¶meters) noexcept override; + void stop() noexcept override; void expectData(SecureByteBlockPtr data); - void sendPacket(SecureByteBlockPtr buffer); + void send_Packet(SecureByteBlockPtr buffer); protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSender => (internal) - #pragma mark + // + // FakeSender => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSender => (data) - #pragma mark + // + // RTPSender => (data) + // FakeSenderWeakPtr mThisWeak; @@ -983,9 +989,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester - #pragma mark + // + // RTPReceiverTester + // //----------------------------------------------------------------------- class RTPReceiverTester : public SharedRecursiveLock, @@ -1035,9 +1041,9 @@ namespace ortc typedef std::list ReceiverIDList; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::UnhandledEventData - #pragma mark + // + // RTPReceiverTester::UnhandledEventData + // struct UnhandledEventData { @@ -1059,30 +1065,30 @@ namespace ortc typedef std::list UnhandledEventDataList; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::OverrideReceiverChannelFactory - #pragma mark + // + // RTPReceiverTester::OverrideReceiverChannelFactory + // class OverrideReceiverChannelFactory : public RTPReceiverChannelFactory { public: static OverrideReceiverChannelFactoryPtr create(RTPReceiverTesterPtr tester); - virtual RTPReceiverChannelPtr create( - RTPReceiverPtr receiver, - MediaStreamTrackPtr track, - const Parameters ¶ms, - const RTCPPacketList &packets - ) override; + RTPReceiverChannelPtr create( + RTPReceiverPtr receiver, + MediaStreamTrackPtr track, + const Parameters ¶ms, + const RTCPPacketList &packets + ) noexcept override; protected: RTPReceiverTesterWeakPtr mTester; }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::OverrideReceiverChannelFactory - #pragma mark + // + // RTPReceiverTester::OverrideReceiverChannelFactory + // class OverrideMediaStreamTrackFactory : public MediaStreamTrackFactory { @@ -1126,9 +1132,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester (api) - #pragma mark + // + // RTPReceiverTester (api) + // static RTPReceiverTesterPtr create( IMessageQueuePtr queue, @@ -1242,9 +1248,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::IRTPListenerDelegate - #pragma mark + // + // RTPReceiverTester::IRTPListenerDelegate + // virtual void onRTPListenerUnhandledRTP( IRTPListenerPtr listener, @@ -1255,14 +1261,14 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester::IRTPReceiverDelegate - #pragma mark + // + // RTPReceiverTester::IRTPReceiverDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester => (friend fake listener, sender, receiver channel) - #pragma mark + // + // RTPReceiverTester => (friend fake listener, sender, receiver channel) + // FakeSecureTransportPtr getFakeSecureTransport() const; @@ -1281,9 +1287,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester => (internal) - #pragma mark + // + // RTPReceiverTester => (internal) + // Log::Params log(const char *message) const; @@ -1303,9 +1309,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPReceiverTester => (data) - #pragma mark + // + // RTPReceiverTester => (data) + // AutoPUID mID; RTPReceiverTesterWeakPtr mThisWeak; diff --git a/ortc/test/TestRTPSender.cpp b/ortc/test/TestRTPSender.cpp index 30ea5328..e337ec49 100644 --- a/ortc/test/TestRTPSender.cpp +++ b/ortc/test/TestRTPSender.cpp @@ -32,8 +32,8 @@ #include "TestRTPSender.h" -#include -#include +#include +#include #include #include @@ -43,7 +43,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -81,9 +81,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark (helpers) - #pragma mark + // + // (helpers) + // //------------------------------------------------------------------------- static bool isRTCPPacketType(const BYTE *data, size_t len) @@ -99,9 +99,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //----------------------------------------------------------------------- FakeICETransport::FakeICETransport( @@ -175,12 +175,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeICETransport::toDebug() const + ElementPtr FakeICETransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -205,9 +205,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) @@ -257,9 +257,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onTimer(ITimerPtr timer) @@ -323,9 +323,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // //----------------------------------------------------------------------- void FakeICETransport::attachSecure(FakeSecureTransportPtr transport) @@ -349,7 +349,7 @@ namespace ortc bool FakeICETransport::sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { FakeICETransportPtr transport; @@ -396,13 +396,13 @@ namespace ortc } //----------------------------------------------------------------------- - IICETransportTypes::States FakeICETransport::state() const + IICETransportTypes::States FakeICETransport::state() const noexcept { return mCurrentState; } //------------------------------------------------------------------------- - IICETransportSubscriptionPtr FakeICETransport::subscribe(IICETransportDelegatePtr originalDelegate) + IICETransportSubscriptionPtr FakeICETransport::subscribe(IICETransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -428,9 +428,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // //----------------------------------------------------------------------- void FakeICETransport::setState(IICETransportTypes::States state) @@ -465,9 +465,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //----------------------------------------------------------------------- FakeSecureTransport::FakeSecureTransport( @@ -534,12 +534,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeSecureTransport::toDebug() const + ElementPtr FakeSecureTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -561,12 +561,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // //----------------------------------------------------------------------- - RTPListenerPtr FakeSecureTransport::getListener() const + RTPListenerPtr FakeSecureTransport::getListener() const noexcept { return RTPListener::convert(mListener); } @@ -575,26 +575,26 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // //----------------------------------------------------------------------- - PUID FakeSecureTransport::getID() const + PUID FakeSecureTransport::getID() const noexcept { return DTLSTransport::getID(); } //----------------------------------------------------------------------- - FakeSecureTransport::ISecureTransportSubscriptionPtr FakeSecureTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) + FakeSecureTransport::ISecureTransportSubscriptionPtr FakeSecureTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -617,7 +617,7 @@ namespace ortc } //----------------------------------------------------------------------- - ISecureTransportTypes::States FakeSecureTransport::state(ISecureTransportTypes::States ignored) const + ISecureTransportTypes::States FakeSecureTransport::state(ISecureTransportTypes::States ignored) const noexcept { return getSecureState(); } @@ -628,7 +628,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { FakeICETransportPtr iceTransport; @@ -646,7 +646,7 @@ namespace ortc } //----------------------------------------------------------------------- - IICETransportPtr FakeSecureTransport::getICETransport() const + IICETransportPtr FakeSecureTransport::getICETransport() const noexcept { return mICETransport; } @@ -655,9 +655,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => IICETransportDelegate + // //----------------------------------------------------------------------- void FakeSecureTransport::onICETransportStateChange( @@ -702,24 +702,24 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeICETransport - #pragma mark + // + // FakeICETransport => friend FakeICETransport + // //----------------------------------------------------------------------- bool FakeSecureTransport::handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { UseListenerPtr listener; @@ -746,9 +746,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // //----------------------------------------------------------------------- void FakeSecureTransport::setState(IDTLSTransportTypes::States state) @@ -789,7 +789,7 @@ namespace ortc } //----------------------------------------------------------------------- - IDTLSTransportTypes::States FakeSecureTransport::state() const + IDTLSTransportTypes::States FakeSecureTransport::state() const noexcept { return mCurrentState; } @@ -849,9 +849,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener - #pragma mark + // + // FakeListener + // //----------------------------------------------------------------------- FakeListener::FakeListener(IMessageQueuePtr queue) : @@ -893,12 +893,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPReceiverForRTPReceiver - #pragma mark + // + // FakeListener => IRTPReceiverForRTPReceiver + // //----------------------------------------------------------------------- - ElementPtr FakeListener::toDebug() const + ElementPtr FakeListener::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -928,7 +928,7 @@ namespace ortc UseReceiverPtr inReceiver, const Parameters &inParams, RTCPPacketList *outPacketList - ) + ) noexcept { ZS_LOG_BASIC(log("register receiver") + ZS_PARAM("receiver", inReceiver->getID()) + inParams.toDebug()) @@ -951,7 +951,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeListener::unregisterReceiver(UseReceiver &inReceiver) + void FakeListener::unregisterReceiver(UseReceiver &inReceiver) noexcept { ZS_LOG_BASIC(log("unregister receiver") + ZS_PARAM("receiver", inReceiver.getID())) @@ -969,7 +969,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeListener::getPackets(RTCPPacketList &outPacketList) + void FakeListener::getPackets(RTCPPacketList &outPacketList) noexcept { outPacketList.clear(); @@ -986,7 +986,7 @@ namespace ortc const String &rid, IRTPTypes::SSRCType ssrc, IRTPTypes::PayloadType payloadType - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -1019,16 +1019,16 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPSender - #pragma mark + // + // FakeListener => IRTPListenerForRTPSender + // //----------------------------------------------------------------------- void FakeListener::registerSender( UseSenderPtr inSender, const Parameters &inParams, RTCPPacketList &outPacketList - ) + ) noexcept { AutoRecursiveLock lock(*this); @@ -1046,7 +1046,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeListener::unregisterSender(UseSender &inSender) + void FakeListener::unregisterSender(UseSender &inSender) noexcept { AutoRecursiveLock lock(*this); @@ -1070,9 +1070,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForSecureTransport - #pragma mark + // + // FakeListener => IRTPListenerForSecureTransport + // //----------------------------------------------------------------------- bool FakeListener::handleRTPPacket( @@ -1080,7 +1080,7 @@ namespace ortc IICETypes::Components packetType, const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { RTPPacketPtr rtpPacket; RTCPPacketPtr rtcpPacket; @@ -1154,9 +1154,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => ITimerDelegate - #pragma mark + // + // FakeListener => ITimerDelegate + // //----------------------------------------------------------------------- void FakeListener::onTimer(ITimerPtr timer) @@ -1190,9 +1190,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IFakeListenerAsyncDelegate - #pragma mark + // + // FakeListener => IFakeListenerAsyncDelegate + // //----------------------------------------------------------------------- void FakeListener::onForwardBufferedPacket(RTPPacketPtr packet) @@ -1205,11 +1205,11 @@ namespace ortc } if (!receiver) { - ZS_LOG_WARNING(Basic, log("dropping packet as receiver is gone") + packet->toDebug()) + //ZS_LOG_WARNING(Basic, log("dropping packet as receiver is gone") + packet->toDebug()) return; } - ZS_LOG_DEBUG(log("forwarding packet to receiver") + ZS_PARAM("receiver", receiver->getID()) + packet->toDebug()) + //ZS_LOG_DEBUG(log("forwarding packet to receiver") + ZS_PARAM("receiver", receiver->getID()) + packet->toDebug()) receiver->handlePacket(IICETypes::Component_RTP, packet); } @@ -1218,9 +1218,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (friend RTPReceiverTester) - #pragma mark + // + // FakeListener => (friend RTPReceiverTester) + // //----------------------------------------------------------------------- void FakeListener::setTransport(RTPSenderTesterPtr tester) @@ -1231,7 +1231,7 @@ namespace ortc } //----------------------------------------------------------------------- - IRTPListenerSubscriptionPtr FakeListener::subscribe(IRTPListenerDelegatePtr originalDelegate) + IRTPListenerSubscriptionPtr FakeListener::subscribe(IRTPListenerDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to listener")) @@ -1259,9 +1259,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (internal) - #pragma mark + // + // FakeListener => (internal) + // //----------------------------------------------------------------------- Log::Params FakeListener::log(const char *message) const @@ -1294,9 +1294,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- FakeSenderChannel::FakeSenderChannel( @@ -1318,12 +1318,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSender - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSender + // //----------------------------------------------------------------------- - ElementPtr FakeSenderChannel::toDebug() const + ElementPtr FakeSenderChannel::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1364,27 +1364,27 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeSenderChannel::notifyTransportState(ISecureTransport::States state) + void FakeSenderChannel::notifyTransportState(ISecureTransport::States state) noexcept { IFakeSenderChannelAsyncDelegateProxy::create(mThisWeak.lock())->onState(state); } //----------------------------------------------------------------------- - void FakeSenderChannel::notifyPackets(RTCPPacketListPtr packets) + void FakeSenderChannel::notifyPackets(RTCPPacketListPtr packets) noexcept { IFakeSenderChannelAsyncDelegateProxy::create(mThisWeak.lock())->onRTCPPackets(packets); } //----------------------------------------------------------------------- - void FakeSenderChannel::notifyUpdate(const Parameters ¶ms) + void FakeSenderChannel::notifyUpdate(const Parameters ¶ms) noexcept { IFakeSenderChannelAsyncDelegateProxy::create(mThisWeak.lock())->onUpdate(make_shared(params)); } //----------------------------------------------------------------------- - bool FakeSenderChannel::handlePacket(RTCPPacketPtr packet) + bool FakeSenderChannel::handlePacket(RTCPPacketPtr packet) noexcept { - ZS_LOG_BASIC(log("handle packet") + packet->toDebug()) + //ZS_LOG_BASIC(log("handle packet") + packet->toDebug()) RTPSenderTesterPtr tester; @@ -1410,9 +1410,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IFakeSenderChannelAsyncDelegate - #pragma mark + // + // FakeSenderChannel => IFakeSenderChannelAsyncDelegate + // //----------------------------------------------------------------------- void FakeSenderChannel::onState(ISecureTransportTypes::States state) @@ -1474,9 +1474,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPSenderTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPSenderTester) + // //----------------------------------------------------------------------- FakeSenderChannelPtr FakeSenderChannel::create( @@ -1499,7 +1499,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool FakeSenderChannel::sendPacket(RTPPacketPtr packet) + bool FakeSenderChannel::send_Packet(RTPPacketPtr packet) { UseSenderPtr sender; @@ -1516,7 +1516,7 @@ namespace ortc } //----------------------------------------------------------------------- - bool FakeSenderChannel::sendPacket(RTCPPacketPtr packet) + bool FakeSenderChannel::send_Packet(RTCPPacketPtr packet) { UseSenderPtr sender; @@ -1565,9 +1565,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // //----------------------------------------------------------------------- Log::Params FakeSenderChannel::log(const char *message) const @@ -1583,9 +1583,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- FakeMediaStreamTrack::FakeMediaStreamTrack(IMessageQueuePtr queue) : @@ -1603,11 +1603,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSender - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSender + // //----------------------------------------------------------------------- +#if 0 ElementPtr FakeMediaStreamTrack::toDebug() const { AutoRecursiveLock lock(*this); @@ -1626,6 +1627,7 @@ namespace ortc return result; } +#endif //0 //----------------------------------------------------------------------- void FakeMediaStreamTrack::create(IMediaStreamTrackTypes::Kinds kind) @@ -1637,11 +1639,11 @@ namespace ortc } //----------------------------------------------------------------------- - IMediaStreamTrackTypes::Kinds FakeMediaStreamTrack::kind() const + IMediaStreamTrackTypes::Kinds FakeMediaStreamTrack::kind() const noexcept { return mKind; } - +#if 0 //----------------------------------------------------------------------- void FakeMediaStreamTrack::notifyAttachSenderChannel(RTPSenderChannelPtr inChannel) { @@ -1708,14 +1710,15 @@ namespace ortc tester->notifyDetachSenderChannel(); } +#endif //0 //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (friend RTPSenderTester) - #pragma mark + // + // FakeMediaStreamTrack => (friend RTPSenderTester) + // //----------------------------------------------------------------------- FakeMediaStreamTrackPtr FakeMediaStreamTrack::create( @@ -1757,9 +1760,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => (internal) - #pragma mark + // + // FakeMediaStreamTrack => (internal) + // //----------------------------------------------------------------------- Log::Params FakeMediaStreamTrack::log(const char *message) const @@ -1773,9 +1776,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- FakeReceiver::FakeReceiver( @@ -1808,12 +1811,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPSenderForRTPSender - #pragma mark + // + // FakeReceiver => IRTPSenderForRTPSender + // //----------------------------------------------------------------------- - ElementPtr FakeReceiver::toDebug() const + ElementPtr FakeReceiver::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -1832,9 +1835,9 @@ namespace ortc bool FakeReceiver::handlePacket( IICETypes::Components viaTransport, RTPPacketPtr packet - ) + ) noexcept { - ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) + //ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) AutoRecursiveLock lock(*this); @@ -1855,9 +1858,9 @@ namespace ortc bool FakeReceiver::handlePacket( IICETypes::Components viaTransport, RTCPPacketPtr packet - ) + ) noexcept { - ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) + //ZS_LOG_BASIC(log("received RTCP packet") + packet->toDebug()) AutoRecursiveLock lock(*this); @@ -1878,12 +1881,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (friend RTPSenderTester) - #pragma mark + // + // FakeReceiver => (friend RTPSenderTester) + // //----------------------------------------------------------------------- - void FakeReceiver::setTransport(RTPSenderTesterPtr tester) + void FakeReceiver::set_Transport(RTPSenderTesterPtr tester) { auto secureTransport = (((bool)tester) ? tester->getFakeSecureTransport() : FakeSecureTransportPtr()); TESTING_CHECK(secureTransport) @@ -1919,7 +1922,7 @@ namespace ortc } //----------------------------------------------------------------------- - PromisePtr FakeReceiver::receive(const Parameters ¶meters) + PromisePtr FakeReceiver::receive(const Parameters ¶meters) noexcept { AutoRecursiveLock lock(*this); @@ -1938,7 +1941,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeReceiver::stop() + void FakeReceiver::stop() noexcept { AutoRecursiveLock lock(*this); @@ -1960,7 +1963,7 @@ namespace ortc } //----------------------------------------------------------------------- - void FakeReceiver::sendPacket(SecureByteBlockPtr buffer) + void FakeReceiver::send_Packet(SecureByteBlockPtr buffer) { UseSecureTransportPtr transport; @@ -1981,9 +1984,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // //----------------------------------------------------------------------- Log::Params FakeReceiver::log(const char *message) const @@ -1998,17 +2001,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::UnhandledEventData - #pragma mark + // + // RTPSenderTester::UnhandledEventData + // //----------------------------------------------------------------------- RTPSenderTester::UnhandledEventData::UnhandledEventData( - DWORD ssrc, - BYTE pt, - const char *mid, - const char *rid - ) : + DWORD ssrc, + BYTE pt, + const char *mid, + const char *rid + ) : mSSRC(ssrc), mPT(pt), mMID(mid), @@ -2029,9 +2032,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::Expectations - #pragma mark + // + // RTPSenderTester::Expectations + // //----------------------------------------------------------------------- bool RTPSenderTester::Expectations::operator==(const Expectations &op2) const @@ -2055,9 +2058,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::OverrideSenderChannelFactory - #pragma mark + // + // RTPSenderTester::OverrideSenderChannelFactory + // //----------------------------------------------------------------------- RTPSenderTester::OverrideSenderChannelFactoryPtr RTPSenderTester::OverrideSenderChannelFactory::create(RTPSenderTesterPtr tester) @@ -2072,7 +2075,7 @@ namespace ortc RTPSenderPtr receiver, MediaStreamTrackPtr track, const Parameters ¶ms - ) + ) noexcept { auto tester = mTester.lock(); TESTING_CHECK(tester) @@ -2084,9 +2087,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::OverrideSenderChannelFactory - #pragma mark + // + // RTPSenderTester::OverrideSenderChannelFactory + // //----------------------------------------------------------------------- RTPSenderTester::OverrideMediaStreamTrackFactoryPtr RTPSenderTester::OverrideMediaStreamTrackFactory::create(RTPSenderTesterPtr tester) @@ -2120,9 +2123,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester - #pragma mark + // + // RTPSenderTester + // //----------------------------------------------------------------------- RTPSenderTesterPtr RTPSenderTester::create( @@ -2454,12 +2457,12 @@ namespace ortc } previousReceiver = receiver; - receiver->setTransport(mThisWeak.lock()); + receiver->set_Transport(mThisWeak.lock()); return; } mAttached[String(receiverID)] = FakeSenderChannelFakeReceiverPair(FakeSenderChannelPtr(), receiver); - receiver->setTransport(mThisWeak.lock()); + receiver->set_Transport(mThisWeak.lock()); } //----------------------------------------------------------------------- @@ -2516,7 +2519,7 @@ namespace ortc FakeReceiverPtr receiver = currentReceiver; if (receiver) { - receiver->setTransport(RTPSenderTesterPtr()); + receiver->set_Transport(RTPSenderTesterPtr()); } currentReceiver.reset(); @@ -2791,9 +2794,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::IRTPSenderDelegate - #pragma mark + // + // RTPSenderTester::IRTPSenderDelegate + // //----------------------------------------------------------------------- void RTPSenderTester::onRTPListenerUnhandledRTP( @@ -2822,9 +2825,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::IRTPSenderDelegate - #pragma mark + // + // RTPSenderTester::IRTPSenderDelegate + // //----------------------------------------------------------------------- void RTPSenderTester::onRTPSenderSSRCConflict( @@ -2842,9 +2845,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester => (friend fake sender/receiver) - #pragma mark + // + // RTPSenderTester => (friend fake sender/receiver) + // //----------------------------------------------------------------------- FakeSecureTransportPtr RTPSenderTester::getFakeSecureTransport() const @@ -2943,9 +2946,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester => (internal) - #pragma mark + // + // RTPSenderTester => (internal) + // //----------------------------------------------------------------------- Log::Params RTPSenderTester::log(const char *message) const @@ -3012,7 +3015,7 @@ namespace ortc FakeReceiverPtr receiver = getReceiver(receiverOrSenderChannelID); TESTING_CHECK(receiver) - receiver->sendPacket(secureBuffer); + receiver->send_Packet(secureBuffer); } } } @@ -3027,8 +3030,8 @@ ZS_DECLARE_USING_PTR(ortc, IDataChannel) ZS_DECLARE_USING_PTR(ortc, IRTPSender) ZS_DECLARE_USING_PTR(ortc, IRTPTypes) -ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) -ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) +ZS_DECLARE_USING_PTR(ortc, RTPPacket) +ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_TYPEDEF_PTR(ortc::internal::ISecureTransportTypes, ISecureTransportTypes) ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::Parameters, Parameters) diff --git a/ortc/test/TestRTPSender.h b/ortc/test/TestRTPSender.h index 52ac83af..d116ec23 100644 --- a/ortc/test/TestRTPSender.h +++ b/ortc/test/TestRTPSender.h @@ -69,9 +69,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeICETransportAsyncDelegate - #pragma mark + // + // IFakeICETransportAsyncDelegate + // interaction IFakeICETransportAsyncDelegate { @@ -82,9 +82,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSecureTransportAsyncDelegate - #pragma mark + // + // IFakeSecureTransportAsyncDelegate + // interaction IFakeSecureTransportAsyncDelegate { @@ -95,13 +95,13 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeListenerAsyncDelegate - #pragma mark + // + // IFakeListenerAsyncDelegate + // interaction IFakeListenerAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTPPacket, RTPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTPPacket, RTPPacket) virtual void onForwardBufferedPacket(RTPPacketPtr packet) = 0; }; @@ -110,14 +110,14 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSenderChannelAsyncDelegate - #pragma mark + // + // IFakeSenderChannelAsyncDelegate + // interaction IFakeSenderChannelAsyncDelegate { - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTPPacket, RTPPacket) - ZS_DECLARE_TYPEDEF_PTR(ortc::internal::RTCPPacket, RTCPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTPPacket, RTPPacket) + ZS_DECLARE_TYPEDEF_PTR(ortc::RTCPPacket, RTCPPacket) ZS_DECLARE_TYPEDEF_PTR(ortc::internal::ISecureTransportTypes, ISecureTransportTypes) ZS_DECLARE_TYPEDEF_PTR(ortc::IRTPTypes::Parameters, Parameters) ZS_DECLARE_TYPEDEF_PTR(std::list, RTCPPacketList) @@ -132,7 +132,7 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpsender::IFakeICETransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpsender::IFakeSecureTransportAsyncDelegate) @@ -141,18 +141,18 @@ ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpsender::IFakeSecureTransportAsyncDelegate) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpsender::IFakeListenerAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) -ZS_DECLARE_PROXY_METHOD_1(onForwardBufferedPacket, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_METHOD(onForwardBufferedPacket, RTPPacketPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::rtpsender::IFakeSenderChannelAsyncDelegate) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTPPacketPtr, RTPPacketPtr) -ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::RTCPPacketPtr, RTCPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTPPacketPtr, RTPPacketPtr) +ZS_DECLARE_PROXY_TYPEDEF(ortc::RTCPPacketPtr, RTCPPacketPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::internal::ISecureTransportTypes::States, States) ZS_DECLARE_PROXY_TYPEDEF(ortc::IRTPTypes::Parameters, Parameters) -ZS_DECLARE_PROXY_METHOD_1(onState, States) -ZS_DECLARE_PROXY_METHOD_1(onRTCPPackets, RTCPPacketListPtr) -ZS_DECLARE_PROXY_METHOD_1(onUpdate, ParametersPtr) +ZS_DECLARE_PROXY_METHOD(onState, States) +ZS_DECLARE_PROXY_METHOD(onRTCPPackets, RTCPPacketListPtr) +ZS_DECLARE_PROXY_METHOD(onUpdate, ParametersPtr) ZS_DECLARE_PROXY_END() namespace ortc @@ -166,8 +166,8 @@ namespace ortc using zsLib::Milliseconds; ZS_DECLARE_USING_PTR(zsLib, ITimer) - ZS_DECLARE_USING_PTR(ortc::internal, RTPPacket) - ZS_DECLARE_USING_PTR(ortc::internal, RTCPPacket) + ZS_DECLARE_USING_PTR(ortc, RTPPacket) + ZS_DECLARE_USING_PTR(ortc, RTCPPacket) ZS_DECLARE_USING_PTR(ortc::internal, RTPSender) ZS_DECLARE_USING_PTR(ortc::internal, MediaStreamTrack) @@ -183,9 +183,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //--------------------------------------------------------------------- class FakeICETransport : public ortc::internal::ICETransport, @@ -214,9 +214,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (test API) - #pragma mark + // + // FakeICETransport => (test API) + // ~FakeICETransport(); @@ -233,52 +233,52 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //--------------------------------------------------------------------- - virtual void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; + void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //--------------------------------------------------------------------- - virtual void onTimer(ITimerPtr timer) override; + void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // void attachSecure(FakeSecureTransportPtr transport); void detachSecure(FakeSecureTransport &transport); - virtual bool sendPacket( - const BYTE *buffer, - size_t bufferSizeInBytes - ) override; + bool sendPacket( + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept override; - virtual States state() const override; + States state() const noexcept override; - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) override; + IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // void setState(IICETransportTypes::States state); @@ -288,9 +288,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (data) - #pragma mark + // + // FakeICETransport => (data) + // FakeICETransportWeakPtr mThisWeak; @@ -318,9 +318,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //--------------------------------------------------------------------- class FakeSecureTransport : public ortc::internal::DTLSTransport, @@ -358,9 +358,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (testing API) - #pragma mark + // + // FakeSecureTransport => (testing API) + // ~FakeSecureTransport(); @@ -375,28 +375,28 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark DTLSTransport => ISecureTransportForRTPListener - #pragma mark + // + // DTLSTransport => ISecureTransportForRTPListener + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); // (duplicate) virtual PUID getID() const = 0; - virtual RTPListenerPtr getListener() const override; + RTPListenerPtr getListener() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); @@ -425,9 +425,9 @@ namespace ortc // (duplicate) virtual IICETransportPtr getICETransport() const = 0; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForRTPSender - #pragma mark + // + // FakeSecureTransport => ISecureTransportForRTPSender + // // (duplicate) static ElementPtr toDebug(ForRTPSenderPtr transport); @@ -440,25 +440,25 @@ namespace ortc // ForRTPSenderPtr &outRTCPSecureTransport // ); - virtual PUID getID() const override; + PUID getID() const noexcept override; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) override; + ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept override; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const override; + ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const noexcept override; - virtual bool sendPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; - virtual IICETransportPtr getICETransport() const override; + IICETransportPtr getICETransport() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => IICETransportDelegate + // virtual void onICETransportStateChange( IICETransportPtr transport, @@ -481,27 +481,27 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => friend FakeICETransport - #pragma mark + // + // FakeSecureTransport => friend FakeICETransport + // //--------------------------------------------------------------------- bool handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) override; + ) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // void setState(IDTLSTransportTypes::States state); @@ -511,16 +511,16 @@ namespace ortc void cancel(); - virtual States state() const override; + States state() const noexcept override; void notifySecureState(); ISecureTransportTypes::States getSecureState() const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (data) - #pragma mark + // + // FakeSecureTransport => (data) + // FakeSecureTransportWeakPtr mThisWeak; @@ -543,9 +543,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener - #pragma mark + // + // FakeListener + // //----------------------------------------------------------------------- class FakeListener : public ortc::internal::RTPListener, @@ -580,38 +580,38 @@ namespace ortc static FakeListenerPtr convert(RTPListenerPtr listener); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPReceiver - #pragma mark + // + // FakeListener => IRTPListenerForRTPReceiver + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (not needed) static ForRTPReceiverPtr getListener(IRTPTransportPtr rtpTransport); // (base hanlded) virtual PUID getID() const = 0; - virtual void registerReceiver( - Optional kind, - UseReceiverPtr inReceiver, - const Parameters &inParams, - RTCPPacketList *outPacketList = NULL - ) override; + void registerReceiver( + Optional kind, + UseReceiverPtr inReceiver, + const Parameters &inParams, + RTCPPacketList *outPacketList = NULL + ) noexcept override; - virtual void unregisterReceiver(UseReceiver &inReceiver) override; + void unregisterReceiver(UseReceiver &inReceiver) noexcept override; - virtual void getPackets(RTCPPacketList &outPacketList) override; + void getPackets(RTCPPacketList &outPacketList) noexcept override; - virtual void notifyUnhandled( - const String &muxID, - const String &rid, - IRTPTypes::SSRCType ssrc, - IRTPTypes::PayloadType payloadType - ) override; + void notifyUnhandled( + const String &muxID, + const String &rid, + IRTPTypes::SSRCType ssrc, + IRTPTypes::PayloadType payloadType + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForRTPSender - #pragma mark + // + // FakeListener => IRTPListenerForRTPSender + // // (duplciate) static ElementPtr toDebug(ForRTPSenderPtr listener); @@ -619,18 +619,18 @@ namespace ortc // (base handled) virtual PUID getID() const = 0; - virtual void registerSender( - UseSenderPtr inSender, - const Parameters &inParams, - RTCPPacketList &outPacketList - ) override; + void registerSender( + UseSenderPtr inSender, + const Parameters &inParams, + RTCPPacketList &outPacketList + ) noexcept override; - virtual void unregisterSender(UseSender &inSender) override; + void unregisterSender(UseSender &inSender) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IRTPListenerForSecureTransport - #pragma mark + // + // FakeListener => IRTPListenerForSecureTransport + // // (duplicate) virtual ElementPtr toDebug() override; @@ -638,41 +638,41 @@ namespace ortc // (base handles) virtual PUID getID() const = 0; - virtual bool handleRTPPacket( - IICETypes::Components viaComponent, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool handleRTPPacket( + IICETypes::Components viaComponent, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => Timer - #pragma mark + // + // FakeListener => Timer + // virtual void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => IFakeListenerAsyncDelegate - #pragma mark + // + // FakeListener => IFakeListenerAsyncDelegate + // virtual void onForwardBufferedPacket(RTPPacketPtr packet) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (friend RTPSenderTester) - #pragma mark + // + // FakeListener => (friend RTPSenderTester) + // void setTransport(RTPSenderTesterPtr tester); - virtual IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr originalDelegate) override; + IRTPListenerSubscriptionPtr subscribe(IRTPListenerDelegatePtr originalDelegate) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeListener => (internal) - #pragma mark + // + // FakeListener => (internal) + // Log::Params log(const char *message) const; @@ -703,9 +703,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel - #pragma mark + // + // FakeSenderChannel + // //----------------------------------------------------------------------- class FakeSenderChannel : public ortc::internal::RTPSenderChannel, @@ -735,11 +735,11 @@ namespace ortc ~FakeSenderChannel(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IRTPSenderChannelForRTPSender - #pragma mark + // + // FakeSenderChannel => IRTPSenderChannelForRTPSender + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (base handles) virtual PUID getID() const = 0; @@ -749,40 +749,40 @@ namespace ortc const Parameters ¶ms ); - virtual PUID getID() const override {return mID;} + PUID getID() const noexcept override {return mID;} - virtual void notifyTransportState(ISecureTransport::States state) override; + void notifyTransportState(ISecureTransport::States state) noexcept override; - virtual void notifyPackets(RTCPPacketListPtr packets) override; + void notifyPackets(RTCPPacketListPtr packets) noexcept override; - virtual void notifyUpdate(const Parameters ¶ms) override; + void notifyUpdate(const Parameters ¶ms) noexcept override; - virtual bool handlePacket(RTCPPacketPtr packet) override; + bool handlePacket(RTCPPacketPtr packet) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => IFakeSenderChannelAsyncDelegate - #pragma mark + // + // FakeSenderChannel => IFakeSenderChannelAsyncDelegate + // - virtual void onState(ISecureTransportTypes::States state) override; - virtual void onRTCPPackets(RTCPPacketListPtr packets) override; - virtual void onUpdate(ParametersPtr params) override; + void onState(ISecureTransportTypes::States state) override; + void onRTCPPackets(RTCPPacketListPtr packets) override; + void onUpdate(ParametersPtr params) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPSenderTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPSenderTester) + // static FakeSenderChannelPtr create( - IMessageQueuePtr queue, - const char *senderChannelID, - const Parameters &expectedParams - ); + IMessageQueuePtr queue, + const char *senderChannelID, + const Parameters &expectedParams + ); void setTransport(RTPSenderTesterPtr tester); - bool sendPacket(RTPPacketPtr packet); - bool sendPacket(RTCPPacketPtr packet); + bool send_Packet(RTPPacketPtr packet); + bool send_Packet(RTCPPacketPtr packet); void expectState(ISecureTransport::States state); @@ -794,9 +794,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // Log::Params log(const char *message) const; @@ -821,9 +821,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack - #pragma mark + // + // FakeMediaStreamTrack + // //----------------------------------------------------------------------- class FakeMediaStreamTrack : public ortc::internal::MediaStreamTrack @@ -841,25 +841,30 @@ namespace ortc ~FakeMediaStreamTrack(); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeMediaStreamTrack => IMediaStreamTrackForRTPSender - #pragma mark + // + // FakeMediaStreamTrack => IMediaStreamTrackForRTPSender + // - virtual ElementPtr toDebug() const override; +#pragma ZS_BUILD_NOTE("TODO","these methods are removed") +#if 0 + ElementPtr toDebug() const noexcept override; +#endif //0 void create(IMediaStreamTrackTypes::Kinds kind); // (base handles) virtual PUID getID() const = 0; - virtual Kinds kind() const override; + Kinds kind() const noexcept override; - virtual void notifyAttachSenderChannel(RTPSenderChannelPtr channel) override; - virtual void notifyDetachSenderChannel(RTPSenderChannelPtr channel) override; +#if 0 + void notifyAttachSenderChannel(RTPSenderChannelPtr channel) noexcept override; + void notifyDetachSenderChannel(RTPSenderChannelPtr channel) noexcept override; +#endif //0 //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (friend RTPSenderTester) - #pragma mark + // + // FakeSenderChannel => (friend RTPSenderTester) + // static FakeMediaStreamTrackPtr create( IMessageQueuePtr queue, @@ -873,17 +878,17 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (internal) - #pragma mark + // + // FakeSenderChannel => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSenderChannel => (data) - #pragma mark + // + // FakeSenderChannel => (data) + // FakeMediaStreamTrackWeakPtr mThisWeak; IMediaStreamTrackTypes::Kinds mKind {IMediaStreamTrackTypes::Kind_Audio}; @@ -900,9 +905,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver - #pragma mark + // + // FakeReceiver + // //----------------------------------------------------------------------- class FakeReceiver : public ortc::internal::RTPReceiver @@ -926,52 +931,52 @@ namespace ortc ); //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => IRTPReceiverForRTPListener - #pragma mark + // + // FakeReceiver => IRTPReceiverForRTPListener + // - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; // (duplicate) virtual PUID getID() const = 0; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTPPacketPtr packet + ) noexcept override; - virtual bool handlePacket( - IICETypes::Components viaTransport, - RTCPPacketPtr packet - ) override; + bool handlePacket( + IICETypes::Components viaTransport, + RTCPPacketPtr packet + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (friend RTPSenderTester) - #pragma mark + // + // FakeReceiver => (friend RTPSenderTester) + // - void setTransport(RTPSenderTesterPtr tester); + void set_Transport(RTPSenderTesterPtr tester); - virtual PromisePtr receive(const Parameters ¶meters) override; - virtual void stop() override; + PromisePtr receive(const Parameters ¶meters) noexcept override; + void stop() noexcept override; void expectData(SecureByteBlockPtr data); - void sendPacket(SecureByteBlockPtr buffer); + void send_Packet(SecureByteBlockPtr buffer); protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (internal) - #pragma mark + // + // FakeReceiver => (internal) + // Log::Params log(const char *message) const; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeReceiver => (data) - #pragma mark + // + // FakeReceiver => (data) + // FakeReceiverWeakPtr mThisWeak; @@ -991,9 +996,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester - #pragma mark + // + // RTPSenderTester + // //----------------------------------------------------------------------- class RTPSenderTester : public SharedRecursiveLock, @@ -1041,9 +1046,9 @@ namespace ortc typedef std::list SenderIDList; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::UnhandledEventData - #pragma mark + // + // RTPSenderTester::UnhandledEventData + // struct UnhandledEventData { @@ -1065,29 +1070,29 @@ namespace ortc typedef std::list UnhandledEventDataList; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::OverrideSenderChannelFactory - #pragma mark + // + // RTPSenderTester::OverrideSenderChannelFactory + // class OverrideSenderChannelFactory : public RTPSenderChannelFactory { public: static OverrideSenderChannelFactoryPtr create(RTPSenderTesterPtr tester); - virtual RTPSenderChannelPtr create( - RTPSenderPtr sender, - MediaStreamTrackPtr track, - const Parameters ¶ms - ) override; + RTPSenderChannelPtr create( + RTPSenderPtr sender, + MediaStreamTrackPtr track, + const Parameters ¶ms + ) noexcept override; protected: RTPSenderTesterWeakPtr mTester; }; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::OverrideSenderChannelFactory - #pragma mark + // + // RTPSenderTester::OverrideSenderChannelFactory + // class OverrideMediaStreamTrackFactory : public MediaStreamTrackFactory { @@ -1133,9 +1138,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester (api) - #pragma mark + // + // RTPSenderTester (api) + // static RTPSenderTesterPtr create( IMessageQueuePtr queue, @@ -1251,9 +1256,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::IRTPListenerDelegate - #pragma mark + // + // RTPSenderTester::IRTPListenerDelegate + // virtual void onRTPListenerUnhandledRTP( IRTPListenerPtr listener, @@ -1264,9 +1269,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester::IRTPSenderDelegate - #pragma mark + // + // RTPSenderTester::IRTPSenderDelegate + // virtual void onRTPSenderSSRCConflict( IRTPSenderPtr sender, @@ -1274,9 +1279,9 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester => (friend fake listener, sender, sender channel) - #pragma mark + // + // RTPSenderTester => (friend fake listener, sender, sender channel) + // FakeSecureTransportPtr getFakeSecureTransport() const; @@ -1295,9 +1300,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester => (internal) - #pragma mark + // + // RTPSenderTester => (internal) + // Log::Params log(const char *message) const; @@ -1317,9 +1322,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark RTPSenderTester => (data) - #pragma mark + // + // RTPSenderTester => (data) + // AutoPUID mID; RTPSenderTesterWeakPtr mThisWeak; diff --git a/ortc/test/TestSCTP.cpp b/ortc/test/TestSCTP.cpp index b6d5a72a..9aa00a94 100644 --- a/ortc/test/TestSCTP.cpp +++ b/ortc/test/TestSCTP.cpp @@ -42,7 +42,7 @@ #include "testing.h" #include -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::String; using zsLib::ULONG; @@ -73,9 +73,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //----------------------------------------------------------------------- FakeICETransport::FakeICETransport( @@ -149,12 +149,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeICETransport::toDebug() const + ElementPtr FakeICETransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -179,18 +179,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransportForDataTransport - #pragma mark + // + // FakeICETransport => IICETransportForDataTransport + // //----------------------------------------------------------------------- - PUID FakeICETransport::getID() const + PUID FakeICETransport::getID() const noexcept { return ICETransport::getID(); } //----------------------------------------------------------------------- - IICETransportSubscriptionPtr FakeICETransport::subscribe(IICETransportDelegatePtr originalDelegate) + IICETransportSubscriptionPtr FakeICETransport::subscribe(IICETransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -217,7 +217,7 @@ namespace ortc } //----------------------------------------------------------------------- - IICETransport::States FakeICETransport::state() const + IICETransport::States FakeICETransport::state() const noexcept { AutoRecursiveLock lock(*this); return mCurrentState; @@ -227,9 +227,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // //----------------------------------------------------------------------- void FakeICETransport::attachSecure(FakeSecureTransportPtr transport) @@ -253,7 +253,7 @@ namespace ortc bool FakeICETransport::sendPacket( const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { FakeICETransportPtr transport; @@ -303,9 +303,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) @@ -355,9 +355,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //----------------------------------------------------------------------- void FakeICETransport::onTimer(ITimerPtr timer) @@ -421,17 +421,17 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // //----------------------------------------------------------------------- void FakeICETransport::setState(IICETransportTypes::States state) @@ -466,9 +466,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //----------------------------------------------------------------------- FakeSecureTransport::FakeSecureTransport( @@ -532,12 +532,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //----------------------------------------------------------------------- - ElementPtr FakeSecureTransport::toDebug() const + ElementPtr FakeSecureTransport::toDebug() const noexcept { AutoRecursiveLock lock(*this); @@ -564,18 +564,18 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportForDataTransport - #pragma mark + // + // FakeSecureTransport => IICETransportForDataTransport + // //----------------------------------------------------------------------- - PUID FakeSecureTransport::getID() const + PUID FakeSecureTransport::getID() const noexcept { return DTLSTransport::getID(); } //----------------------------------------------------------------------- - IDTLSTransportSubscriptionPtr FakeSecureTransport::subscribe(IDTLSTransportDelegatePtr originalDelegate) + IDTLSTransportSubscriptionPtr FakeSecureTransport::subscribe(IDTLSTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to transport state")) @@ -602,7 +602,7 @@ namespace ortc } //----------------------------------------------------------------------- - IDTLSTransport::States FakeSecureTransport::state() const + IDTLSTransport::States FakeSecureTransport::state() const noexcept { AutoRecursiveLock lock(*this); return mCurrentState; @@ -612,12 +612,12 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForDataTransport - #pragma mark + // + // FakeSecureTransport => ISecureTransportForDataTransport + // //----------------------------------------------------------------------- - FakeSecureTransport::ISecureTransportSubscriptionPtr FakeSecureTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) + FakeSecureTransport::ISecureTransportSubscriptionPtr FakeSecureTransport::subscribe(ISecureTransportDelegatePtr originalDelegate) noexcept { ZS_LOG_DETAIL(log("subscribing to secure transport state")) @@ -643,26 +643,26 @@ namespace ortc } //----------------------------------------------------------------------- - ISecureTransportTypes::States FakeSecureTransport::state(ISecureTransportTypes::States ignored) const + ISecureTransportTypes::States FakeSecureTransport::state(ISecureTransportTypes::States ignored) const noexcept { return mSecureTransportState; } //----------------------------------------------------------------------- - bool FakeSecureTransport::isClientRole() const + bool FakeSecureTransport::isClientRole() const noexcept { AutoRecursiveLock lock(*this); return mClientRole; } //----------------------------------------------------------------------- - IICETransportPtr FakeSecureTransport::getICETransport() const + IICETransportPtr FakeSecureTransport::getICETransport() const noexcept { return mICETransport; } //----------------------------------------------------------------------- - FakeSecureTransport::UseDataTransportPtr FakeSecureTransport::getDataTransport() const + FakeSecureTransport::UseDataTransportPtr FakeSecureTransport::getDataTransport() const noexcept { return mDataTransport; } @@ -671,7 +671,7 @@ namespace ortc bool FakeSecureTransport::sendDataPacket( const BYTE *buffer, size_t bufferLengthInBytes - ) + ) noexcept { FakeICETransportPtr iceTransport; @@ -692,24 +692,24 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeICETransport - #pragma mark + // + // FakeICETransport => friend FakeICETransport + // //----------------------------------------------------------------------- bool FakeSecureTransport::handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) + ) noexcept { UseDataTransportPtr dataTransport; @@ -736,9 +736,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend IICETransportDelegate - #pragma mark + // + // FakeICETransport => friend IICETransportDelegate + // //----------------------------------------------------------------------- void FakeSecureTransport::onICETransportStateChange( @@ -788,9 +788,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // //----------------------------------------------------------------------- void FakeSecureTransport::setState(IDTLSTransportTypes::States state) @@ -903,9 +903,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester - #pragma mark + // + // SCTPTester + // //----------------------------------------------------------------------- bool SCTPTester::Expectations::operator==(const Expectations &op2) const @@ -1171,9 +1171,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester::ISCTPTransportDelegate - #pragma mark + // + // SCTPTester::ISCTPTransportDelegate + // //----------------------------------------------------------------------- void SCTPTester::onSCTPTransportDataChannel( @@ -1217,9 +1217,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester::ISCTPTransportListenerDelegate - #pragma mark + // + // SCTPTester::ISCTPTransportListenerDelegate + // //----------------------------------------------------------------------- void SCTPTester::onSCTPTransport(ISCTPTransportPtr transport) @@ -1242,9 +1242,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester::IDataChannelDelegate - #pragma mark + // + // SCTPTester::IDataChannelDelegate + // //----------------------------------------------------------------------- void SCTPTester::onDataChannelStateChange( @@ -1290,8 +1290,7 @@ namespace ortc void SCTPTester::onDataChannelBufferedAmountLow(IDataChannelPtr channel) { ZS_LOG_BASIC(log("data channel buffer low event") + ZS_PARAM("channel id", channel->getID())) -#define TODO_TEST_TO_VERIFY_BUFFER_LOW_EVENT 1 -#define TODO_TEST_TO_VERIFY_BUFFER_LOW_EVENT 2 +#pragma ZS_BUILD_NOTE("TODO","test to verify buffer low event") } //----------------------------------------------------------------------- @@ -1342,9 +1341,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester => (internal) - #pragma mark + // + // SCTPTester => (internal) + // //----------------------------------------------------------------------- Log::Params SCTPTester::log(const char *message) const diff --git a/ortc/test/TestSCTP.h b/ortc/test/TestSCTP.h index c9d997f2..553c0188 100644 --- a/ortc/test/TestSCTP.h +++ b/ortc/test/TestSCTP.h @@ -62,9 +62,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeICETransportAsyncDelegate - #pragma mark + // + // IFakeICETransportAsyncDelegate + // interaction IFakeICETransportAsyncDelegate { @@ -75,9 +75,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSecureTransportAsyncDelegate - #pragma mark + // + // IFakeSecureTransportAsyncDelegate + // interaction IFakeSecureTransportAsyncDelegate { @@ -89,7 +89,7 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::sctp::IFakeICETransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) -ZS_DECLARE_PROXY_METHOD_1(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() ZS_DECLARE_PROXY_BEGIN(ortc::test::sctp::IFakeSecureTransportAsyncDelegate) @@ -117,9 +117,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport - #pragma mark + // + // FakeICETransport + // //--------------------------------------------------------------------- class FakeICETransport : public ortc::internal::ICETransport, @@ -148,9 +148,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (test API) - #pragma mark + // + // FakeICETransport => (test API) + // ~FakeICETransport(); @@ -167,59 +167,59 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransport - #pragma mark + // + // FakeICETransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IICETransportForDataTransport - #pragma mark + // + // FakeICETransport => IICETransportForDataTransport + // - virtual PUID getID() const override; + PUID getID() const noexcept override; - virtual IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) override; + IICETransportSubscriptionPtr subscribe(IICETransportDelegatePtr originalDelegate) noexcept override; - virtual IICETransport::States state() const override; + IICETransport::States state() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => IFakeICETransportAsyncDelegate - #pragma mark + // + // FakeICETransport => IFakeICETransportAsyncDelegate + // //--------------------------------------------------------------------- virtual void onPacketFromLinkedFakedTransport(SecureByteBlockPtr buffer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => ITimerDelegate - #pragma mark + // + // FakeICETransport => ITimerDelegate + // //--------------------------------------------------------------------- virtual void onTimer(ITimerPtr timer) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => friend FakeSecureTransport - #pragma mark + // + // FakeICETransport => friend FakeSecureTransport + // void attachSecure(FakeSecureTransportPtr transport); void detachSecure(FakeSecureTransport &transport); - virtual bool sendPacket( - const BYTE *buffer, - size_t bufferSizeInBytes - ) override; + bool sendPacket( + const BYTE *buffer, + size_t bufferSizeInBytes + ) noexcept override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (internal) - #pragma mark + // + // FakeICETransport => (internal) + // void setState(IICETransportTypes::States state); @@ -230,9 +230,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeICETransport => (data) - #pragma mark + // + // FakeICETransport => (data) + // FakeICETransportWeakPtr mThisWeak; @@ -260,9 +260,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //--------------------------------------------------------------------- class FakeSecureTransport : public ortc::internal::DTLSTransport, @@ -299,9 +299,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (testing API) - #pragma mark + // + // FakeSecureTransport => (testing API) + // ~FakeSecureTransport(); @@ -316,66 +316,66 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override; + ElementPtr toDebug() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransportForDataTransport - #pragma mark + // + // FakeSecureTransport => IICETransportForDataTransport + // - virtual PUID getID() const override; + PUID getID() const noexcept override; - virtual IDTLSTransportSubscriptionPtr subscribe(IDTLSTransportDelegatePtr originalDelegate) override; + IDTLSTransportSubscriptionPtr subscribe(IDTLSTransportDelegatePtr originalDelegate) noexcept override; - virtual IDTLSTransport::States state() const override; + IDTLSTransport::States state() const noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForDataTransport - #pragma mark + // + // FakeSecureTransport => ISecureTransportForDataTransport + // // (duplicate) virtual PUID getID() const; - virtual ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) override; + ISecureTransportSubscriptionPtr subscribe(ISecureTransportDelegatePtr delegate) noexcept override; - virtual ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const override; + ISecureTransportTypes::States state(ISecureTransportTypes::States ignored) const noexcept override; - virtual bool isClientRole() const override; + bool isClientRole() const noexcept override; - virtual IICETransportPtr getICETransport() const override; + IICETransportPtr getICETransport() const noexcept override; - virtual UseDataTransportPtr getDataTransport() const override; + UseDataTransportPtr getDataTransport() const noexcept override; - virtual bool sendDataPacket( - const BYTE *buffer, - size_t bufferLengthInBytes - ) override; + bool sendDataPacket( + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => friend FakeICETransport - #pragma mark + // + // FakeSecureTransport => friend FakeICETransport + // bool handleReceivedPacket( IICETypes::Components component, const BYTE *buffer, size_t bufferSizeInBytes - ) override; + ) noexcept override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => friend IICETransportDelegate - #pragma mark + // + // FakeSecureTransport => friend IICETransportDelegate + // virtual void onICETransportStateChange( IICETransportPtr transport, @@ -397,9 +397,9 @@ namespace ortc ) override; protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // void setState(IDTLSTransportTypes::States state); void setState(ISecureTransportTypes::States state); @@ -413,9 +413,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (data) - #pragma mark + // + // FakeSecureTransport => (data) + // FakeSecureTransportWeakPtr mThisWeak; @@ -440,9 +440,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester - #pragma mark + // + // SCTPTester + // //--------------------------------------------------------------------- class SCTPTester : public SharedRecursiveLock, @@ -542,9 +542,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester::ISCTPTransportDelegate - #pragma mark + // + // SCTPTester::ISCTPTransportDelegate + // virtual void onSCTPTransportDataChannel( ISCTPTransportPtr transport, @@ -557,16 +557,16 @@ namespace ortc ) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester::ISCTPTransportListenerDelegate - #pragma mark + // + // SCTPTester::ISCTPTransportListenerDelegate + // virtual void onSCTPTransport(ISCTPTransportPtr transport) override; //--------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester::IDataChannelDelegate - #pragma mark + // + // SCTPTester::IDataChannelDelegate + // virtual void onDataChannelStateChange( IDataChannelPtr channel, @@ -587,9 +587,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester => (internal) - #pragma mark + // + // SCTPTester => (internal) + // Log::Params log(const char *message) const; @@ -606,9 +606,9 @@ namespace ortc public: //--------------------------------------------------------------------- - #pragma mark - #pragma mark SCTPTester => (data) - #pragma mark + // + // SCTPTester => (data) + // AutoPUID mID; SCTPTesterWeakPtr mThisWeak; diff --git a/ortc/test/TestSRTP.cpp b/ortc/test/TestSRTP.cpp index 0c25094c..df3155b7 100644 --- a/ortc/test/TestSRTP.cpp +++ b/ortc/test/TestSRTP.cpp @@ -48,7 +48,7 @@ #include "config.h" #include "testing.h" -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } using zsLib::BYTE; using zsLib::String; @@ -92,9 +92,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark IFakeSecureTransportAsyncDelegate - #pragma mark + // + // IFakeSecureTransportAsyncDelegate + // interaction IFakeSecureTransportAsyncDelegate { @@ -112,7 +112,7 @@ namespace ortc ZS_DECLARE_PROXY_BEGIN(ortc::test::srtp::IFakeSecureTransportAsyncDelegate) ZS_DECLARE_PROXY_TYPEDEF(ortc::services::SecureByteBlockPtr, SecureByteBlockPtr) ZS_DECLARE_PROXY_TYPEDEF(ortc::IICETypes::Components, Components) -ZS_DECLARE_PROXY_METHOD_3(onPacketFromLinkedFakedTransport, Components, Components, SecureByteBlockPtr) +ZS_DECLARE_PROXY_METHOD(onPacketFromLinkedFakedTransport, Components, Components, SecureByteBlockPtr) ZS_DECLARE_PROXY_END() namespace ortc @@ -129,9 +129,9 @@ namespace ortc //----------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTester - #pragma mark + // + // ISRTPTester + // interaction ISRTPTester { @@ -149,9 +149,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport - #pragma mark + // + // FakeSecureTransport + // //----------------------------------------------------------------------- class FakeSecureTransport : public ortc::internal::DTLSTransport, @@ -248,12 +248,12 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IICETransport - #pragma mark + // + // FakeSecureTransport => IICETransport + // //--------------------------------------------------------------------- - virtual ElementPtr toDebug() const override + virtual ElementPtr toDebug() const noexcept override { AutoRecursiveLock lock(*this); @@ -272,20 +272,20 @@ namespace ortc } //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISecureTransportForSRTPTransport - #pragma mark + // + // FakeSecureTransport => ISecureTransportForSRTPTransport + // //--------------------------------------------------------------------- - virtual PUID getID() const override {return DTLSTransport::getID();} + PUID getID() const noexcept override {return DTLSTransport::getID();} //--------------------------------------------------------------------- - virtual bool sendEncryptedPacket( - IICETypes::Components sendOverICETransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override + bool sendEncryptedPacket( + IICETypes::Components sendOverICETransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override { FakeSecureTransportPtr transport; @@ -308,12 +308,12 @@ namespace ortc } //--------------------------------------------------------------------- - virtual bool handleReceivedDecryptedPacket( - IICETypes::Components viaTransport, - IICETypes::Components packetType, - const BYTE *buffer, - size_t bufferLengthInBytes - ) override + bool handleReceivedDecryptedPacket( + IICETypes::Components viaTransport, + IICETypes::Components packetType, + const BYTE *buffer, + size_t bufferLengthInBytes + ) noexcept override { ZS_LOG_DEBUG(log("handling decrypted packet from SRTP") + ZS_PARAM("via", IICETypes::toString(viaTransport)) + ZS_PARAM("packet type", IICETypes::toString(packetType)) + ZS_PARAM("buffer", (PTRNUMBER)(buffer)) + ZS_PARAM("buffer size", bufferLengthInBytes)) @@ -335,9 +335,9 @@ namespace ortc //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => ISRTPTransportDelegate - #pragma mark + // + // FakeSecureTransport => ISRTPTransportDelegate + // virtual void onSRTPTransportLifetimeRemaining( ISRTPTransportPtr transport, @@ -349,9 +349,9 @@ namespace ortc } //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => IFakeSecureTransportAsyncDelegate - #pragma mark + // + // FakeSecureTransport => IFakeSecureTransportAsyncDelegate + // //--------------------------------------------------------------------- virtual void onPacketFromLinkedFakedTransport( @@ -381,9 +381,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (internal) - #pragma mark + // + // FakeSecureTransport => (internal) + // //--------------------------------------------------------------------- Log::Params log(const char *message) const @@ -395,9 +395,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark FakeSecureTransport => (data) - #pragma mark + // + // FakeSecureTransport => (data) + // FakeSecureTransportWeakPtr mThisWeak; @@ -412,9 +412,9 @@ namespace ortc //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTester - #pragma mark + // + // SRTPTester + // //----------------------------------------------------------------------- class SRTPTester : public SharedRecursiveLock, @@ -547,9 +547,9 @@ namespace ortc protected: //--------------------------------------------------------------------- - #pragma mark - #pragma mark ISRTPTester - #pragma mark + // + // ISRTPTester + // //--------------------------------------------------------------------- virtual PUID getID() const override {return mID;} @@ -587,9 +587,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTester => (internal) - #pragma mark + // + // SRTPTester => (internal) + // //--------------------------------------------------------------------- Log::Params log(const char *message) const @@ -611,9 +611,9 @@ namespace ortc //--------------------------------------------------------------------- //--------------------------------------------------------------------- //--------------------------------------------------------------------- - #pragma mark - #pragma mark SRTPTester => (data) - #pragma mark + // + // SRTPTester => (data) + // AutoPUID mID; SRTPTesterWeakPtr mThisWeak; @@ -1097,7 +1097,7 @@ void doTestSRTP() memcpy(rtp_packet, kPcmuFrame, rtp_len); // In order to be able to run this test function multiple times we can not // use the same sequence number twice. Increase the sequence number by one. - SetBE16(reinterpret_cast(rtp_packet)+2, i); + SetBE16(reinterpret_cast(rtp_packet)+2, static_cast(i)); //memcpy(original_rtp_packet, rtp_packet, rtp_len); SecureByteBlockPtr buffer(std::make_shared(172)); // allocate a buffer of 40 bytes diff --git a/ortc/test/TestSetup.cpp b/ortc/test/TestSetup.cpp index 21e9e968..04429fe9 100644 --- a/ortc/test/TestSetup.cpp +++ b/ortc/test/TestSetup.cpp @@ -58,23 +58,23 @@ #include #endif //HAVE_IPHLPAPI_H -#ifdef WINRT +#ifdef WINUWP using namespace Windows::Networking::Connectivity; -#endif //WINRT +#endif //WINUWP -#ifdef WINRT +#ifdef WINUWP #include -#endif //WINRT +#endif //WINUWP -#if defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#if defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) using Windows::Foundation::Collections::IVectorView; using namespace concurrency; using Windows::Networking::HostNameType; using namespace Windows::UI::Core; -#endif //defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#endif //defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) -namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_DECLARE_SUBSYSTEM(org_ortc_test) } } //using zsLib::String; //using zsLib::ULONG; @@ -109,9 +109,9 @@ namespace ortc { calculateInterfaces_ifaddr(); calculateInterfaces_Win32(); - calculateInterfaces_WinRT(); + calculateInterfaces_WinUWP(); - UseSettings::setUInt("tester/total-host-ips", mTotalHostIPs); + UseSettings::setUInt("tester/total-host-ips", static_cast(mTotalHostIPs)); } //--------------------------------------------------------------------- @@ -278,16 +278,16 @@ namespace ortc } //------------------------------------------------------------------------- - void calculateInterfaces_WinRT() + void calculateInterfaces_WinUWP() { -#if defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#if defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) typedef Windows::Networking::Sockets::DatagramSocket DatagramSocket; typedef Windows::Networking::HostName HostName; typedef Windows::Networking::EndpointPair EndpointPair; // http://stackoverflow.com/questions/10336521/query-local-ip-address - // Use WinRT GetHostNames to search for IP addresses + // Use WinUWP GetHostNames to search for IP addresses { typedef std::map HostNameMap; typedef std::list ConnectionProfileList; @@ -396,8 +396,8 @@ namespace ortc { AutoRecursiveLock lock(mLock); - auto found = mFoundIPs.find(ip.string()); - if (found == mFoundIPs.end()) { + auto found2 = mFoundIPs.find(ip.string()); + if (found2 == mFoundIPs.end()) { mFoundIPs[ip.string()] = true; } } @@ -424,7 +424,7 @@ namespace ortc ZS_LOG_WARNING(Detail, log("exception caught") + ZS_PARAM("error", String(ex->Message->Data()))) return; } - HostNameType debugtype = hostname2->Type; + //HostNameType debugtype = hostname2->Type; ++mExpecting; @@ -440,11 +440,11 @@ namespace ortc // Check if any previous task threw an exception. IVectorView ^response = previousTask.get(); - bool isSRV = false; + //bool isSRV = false; if (nullptr != response) { for (size_t index = 0; index != response->Size; ++index) { - EndpointPair ^pair = response->GetAt(index); + EndpointPair ^pair = response->GetAt(static_cast(index)); if (!pair) { ZS_LOG_WARNING(Detail, slog(id, "endpoint pair is null")) continue; @@ -474,9 +474,9 @@ namespace ortc service = String(pair->RemoteServiceName->Data()); } - HostNameType type = pair->RemoteHostName->Type; - bool isIPv4 = (HostNameType::Ipv4 == type); - bool isIPv6 = (HostNameType::Ipv6 == type); + //HostNameType type = pair->RemoteHostName->Type; + //bool isIPv4 = (HostNameType::Ipv4 == type); + //bool isIPv6 = (HostNameType::Ipv6 == type); IPAddress ip; @@ -533,7 +533,7 @@ namespace ortc mTotalHostIPs = mFoundIPs.size(); } -#endif //defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#endif //defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) } @@ -564,9 +564,9 @@ namespace ortc std::atomic mDone {}; std::atomic mTotalHostIPs {}; -#if defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#if defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) concurrency::cancellation_token_source mCancellationTokenSource; -#endif //defined(WINRT) && !defined(HAVE_GETADAPTERADDRESSES) +#endif //defined(WINUWP) && !defined(HAVE_GETADAPTERADDRESSES) }; } diff --git a/ortc/test/testing.cpp b/ortc/test/testing.cpp index c448fd8f..74887ece 100644 --- a/ortc/test/testing.cpp +++ b/ortc/test/testing.cpp @@ -39,7 +39,7 @@ #include -namespace ortc { namespace test { ZS_IMPLEMENT_SUBSYSTEM(ortc_test) } } +namespace ortc { namespace test { ZS_IMPLEMENT_SUBSYSTEM(org_ortc_test) } } #ifdef _WIN32 diff --git a/ortc/types.h b/ortc/types.h index 505bfb3a..321b0f1e 100644 --- a/ortc/types.h +++ b/ortc/types.h @@ -31,6 +31,10 @@ #pragma once +#ifdef _WIN32 +#pragma warning(disable:4290) +#endif + #include #include @@ -71,10 +75,10 @@ namespace ortc using zsLib::Optional; using zsLib::PromiseWith; - ZS_DECLARE_USING_PTR(zsLib, Any) - ZS_DECLARE_USING_PTR(zsLib, Promise) + ZS_DECLARE_USING_PTR(zsLib, Any); + ZS_DECLARE_USING_PTR(zsLib, Promise); - ZS_DECLARE_STRUCT_PTR(ErrorAny) + ZS_DECLARE_STRUCT_PTR(ErrorAny); struct ErrorAny : public Any { @@ -84,20 +88,20 @@ namespace ortc String mName; String mReason; - ErrorAny() {} + ErrorAny() noexcept {} - ErrorAny(WORD errorCode, const char *reason, const char *name = NULL) : + ErrorAny(WORD errorCode, const char *reason, const char *name = NULL) noexcept : mErrorCode(errorCode), - mReason(reason), - mName(name) {} + mName(name), + mReason(reason) {} - static ErrorAnyPtr create(WORD errorCode, const char *reason, const char *name = NULL) { return make_shared(errorCode, reason, name); } + static ErrorAnyPtr create(WORD errorCode, const char *reason, const char *name = NULL) noexcept { return make_shared(errorCode, reason, name); } }; using ortc::services::SharedRecursiveLock; using ortc::services::LockedValue; - ZS_DECLARE_USING_PTR(ortc::services, SecureByteBlock) + ZS_DECLARE_USING_PTR(ortc::services, SecureByteBlock); namespace JSON = zsLib::JSON; using JSON::Element; @@ -122,18 +126,21 @@ namespace ortc //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- - #pragma mark - #pragma mark (forwards) - #pragma mark + // + // (forwards) + // + + ZS_DECLARE_CLASS_PTR(RTPPacket); + ZS_DECLARE_CLASS_PTR(RTCPPacket); interaction IRTPTransport { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; interaction IRTCPTransport { - virtual PUID getID() const = 0; + virtual PUID getID() const noexcept = 0; }; ZS_DECLARE_INTERACTION_PTR(ICertificate); @@ -148,8 +155,9 @@ namespace ortc ZS_DECLARE_INTERACTION_PTR(IICETransport); ZS_DECLARE_INTERACTION_PTR(IICETransportController); ZS_DECLARE_INTERACTION_PTR(IMediaDevices); - ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackRenderCallback); + ZS_DECLARE_INTERACTION_PTR(IMediaElement); ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrack); + ZS_DECLARE_INTERACTION_PTR(IMediaStreamTrackSelector); ZS_DECLARE_INTERACTION_PTR(IRTPListener); ZS_DECLARE_INTERACTION_PTR(IRTPSender); ZS_DECLARE_INTERACTION_PTR(IRTPReceiver); @@ -168,7 +176,11 @@ namespace ortc ZS_DECLARE_INTERACTION_PROXY(IICETransportDelegate); ZS_DECLARE_INTERACTION_PROXY(IRTPListenerDelegate); ZS_DECLARE_INTERACTION_PROXY(IMediaDevicesDelegate); + ZS_DECLARE_INTERACTION_PROXY(IMediaElementDelegate); ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackDelegate); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackSyncMediaDelegate); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackAsyncMediaDelegate); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamTrackSelectorDelegate); ZS_DECLARE_INTERACTION_PROXY(IRTPSenderDelegate); ZS_DECLARE_INTERACTION_PROXY(IRTPReceiverDelegate); ZS_DECLARE_INTERACTION_PROXY(ISCTPTransportDelegate); @@ -182,6 +194,10 @@ namespace ortc ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IICETransportSubscription, IICETransportDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaDevicesSubscription, IMediaDevicesDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamTrackSubscription, IMediaStreamTrackDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamTrackMediaSubscription, IMediaStreamTrackSyncMediaDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamTrackMediaSubscription, IMediaStreamTrackAsyncMediaDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamTrackSelectorSubscription, IMediaStreamTrackSelectorDelegate); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaElementSubscription, IMediaElementDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IRTPListenerSubscription, IRTPListenerDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IRTPSenderSubscription, IRTPSenderDelegate); ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IRTPReceiverSubscription, IRTPReceiverDelegate); @@ -194,45 +210,7 @@ namespace ortc //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - #pragma mark - #pragma mark (mixed case versions of interfaces are available externally) - #pragma mark - -#ifndef ORTCLIB_INTERNAL -#if 0 - ZS_DECLARE_TYPEDEF_PTR(IDTLSTransport, IDtlsTransport); - ZS_DECLARE_TYPEDEF_PTR(IDTMFSender, IDtmfSender); - ZS_DECLARE_TYPEDEF_PTR(IORTC, IOrtc); - ZS_DECLARE_TYPEDEF_PTR(IICEGatherer, IIceGatherer); - ZS_DECLARE_TYPEDEF_PTR(IICETransport, IIceTransport); - ZS_DECLARE_TYPEDEF_PTR(IICETransportController, IIceTransportController); - ZS_DECLARE_TYPEDEF_PTR(IRTPListener, IRtpListener); - ZS_DECLARE_TYPEDEF_PTR(IRTPSender, IRtpSender); - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiver, IRtpReceiver); - ZS_DECLARE_TYPEDEF_PTR(IRTPTransport, IRtpTransport); - ZS_DECLARE_TYPEDEF_PTR(IRTCPTransport, IRtcpTransport); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransport, ISctpTransport); - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransport, ISrtpSdesTransport); - - ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportDelegate, IDtlsTransportDelegate); - ZS_DECLARE_TYPEDEF_PTR(IDTMFSenderDelegate, IDtmfSenderDelegate); - ZS_DECLARE_TYPEDEF_PTR(IICEGathererDelegate, IIceGathererDelegate); - ZS_DECLARE_TYPEDEF_PTR(IICETransportDelegate, IIceTransportDelegate); - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerDelegate, IRtpListenerDelegate); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderDelegate, IRtpSenderDelegate); - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverDelegate, IRtpReceiverDelegate); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportDelegate, ISctpTransportDelegate); - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransportDelegate, ISrtpSdesTransportDelegate); - - ZS_DECLARE_TYPEDEF_PTR(IDTLSTransportSubscription, IDtlsTransportSubscription); - ZS_DECLARE_TYPEDEF_PTR(IDTMFSenderSubscription, IDtmfSenderSubscription); - ZS_DECLARE_TYPEDEF_PTR(IICEGathererSubscription, IIceGathererSubscription); - ZS_DECLARE_TYPEDEF_PTR(IICETransportSubscription, IIceTransportSubscription); - ZS_DECLARE_TYPEDEF_PTR(IRTPListenerSubscription, IRtpListenerSubscription); - ZS_DECLARE_TYPEDEF_PTR(IRTPSenderSubscription, IRtpSenderSubscription); - ZS_DECLARE_TYPEDEF_PTR(IRTPReceiverSubscription, IRtpReceiverSubscription); - ZS_DECLARE_TYPEDEF_PTR(ISCTPTransportSubscription, ISctpTransportSubscription); - ZS_DECLARE_TYPEDEF_PTR(ISRTPSDESTransportSubscription, ISrtpSdesTransportSubscription); -#endif //0 -#endif //ORTCLIB_INTERNAL + // + // (mixed case versions of interfaces are available externally) + // } diff --git a/projects/msvs/Org.Ort.Universal/Org.Ortc.vcxproj b/projects/msvs/Org.Ort.Universal/Org.Ortc.vcxproj new file mode 100644 index 00000000..37f963e5 --- /dev/null +++ b/projects/msvs/Org.Ort.Universal/Org.Ortc.vcxproj @@ -0,0 +1,516 @@ + + + + true + $(RequiredBundles);Microsoft.Windows.CppWinRT + true + {896b38b9-bfdf-4f30-a211-cc840735b420} + Org.Ortc + Org_Ortc + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.17134.0 + 10.0.17134.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + DynamicLibrary + v141 + Unicode + false + + + true + true + + + false + true + false + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + true + %(AdditionalOptions) /permissive- /bigobj + 28204;4100 + NOMINMAX;WINUWP;_WINRT_DLL;%(PreprocessorDefinitions) + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + + + Console + true + Org_Ortc.def + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget) + + + + + NOMINMAX;WINUWP;NDEBUG;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + + + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget) + + + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget) + + + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + Create + + + + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl;%(AdditionalIncludeDirectories) + + + + + + + + false + + + + + {f370ffcf-6d70-40a3-853d-a272c4df2014} + + + + + + \ No newline at end of file diff --git a/projects/msvs/Org.Ort.Universal/Org.Ortc.vcxproj.filters b/projects/msvs/Org.Ort.Universal/Org.Ortc.vcxproj.filters new file mode 100644 index 00000000..58893c76 --- /dev/null +++ b/projects/msvs/Org.Ort.Universal/Org.Ortc.vcxproj.filters @@ -0,0 +1,1010 @@ + + + + + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + + + wrapper\generated\msidl + + + wrapper\override\msidl + + + wrapper\override\msidl + + + wrapper\override\msidl + + + + + + + + + + + {4c17a1e2-ab10-4d51-83c3-4d64b1d240ec} + + + {54eb32e0-b3db-4a3d-b539-8410f171dd6d} + + + {2e3192f1-bf34-4125-ad16-6bab8277c771} + + + {630f2eba-7806-42a9-baa7-ec4ae02c103f} + + + {5e7dec76-b4a6-487c-8119-40e688779875} + + + {9270fdcc-b9be-454f-b47f-4818658f8b83} + + + {8803d933-2796-44b6-a879-a7666a6e6355} + + + \ No newline at end of file diff --git a/projects/msvs/Org.Ort.Universal/Org.Ortc_TemporaryKey.pfx b/projects/msvs/Org.Ort.Universal/Org.Ortc_TemporaryKey.pfx new file mode 100644 index 00000000..c6704f80 Binary files /dev/null and b/projects/msvs/Org.Ort.Universal/Org.Ortc_TemporaryKey.pfx differ diff --git a/projects/msvs/Org.Ort.Universal/Org_Ortc.def b/projects/msvs/Org.Ort.Universal/Org_Ortc.def new file mode 100644 index 00000000..24e7c123 --- /dev/null +++ b/projects/msvs/Org.Ort.Universal/Org_Ortc.def @@ -0,0 +1,3 @@ +EXPORTS +DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE +DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE diff --git a/projects/msvs/Org.Ort.Universal/pch.cpp b/projects/msvs/Org.Ort.Universal/pch.cpp new file mode 100644 index 00000000..bcb5590b --- /dev/null +++ b/projects/msvs/Org.Ort.Universal/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/projects/msvs/Org.Ort.Universal/pch.h b/projects/msvs/Org.Ort.Universal/pch.h new file mode 100644 index 00000000..51b7d37b --- /dev/null +++ b/projects/msvs/Org.Ort.Universal/pch.h @@ -0,0 +1,8 @@ +// +// pch.h +// Header for platform projection include files +// + +#pragma once + +#include "winrt/Windows.Foundation.h" diff --git a/projects/msvs/Org.Ort.Universal/readme.txt b/projects/msvs/Org.Ort.Universal/readme.txt new file mode 100644 index 00000000..1df654b9 --- /dev/null +++ b/projects/msvs/Org.Ort.Universal/readme.txt @@ -0,0 +1,23 @@ +======================================================================== + C++/WinRT Org.Ortc Project Overview +======================================================================== + +This project demonstrates how to get started authoring Windows Runtime +classes directly with standard C++, using the C++/WinRT SDK component +to generate implementation headers from interface (IDL) files. The +generated Windows Runtime component binary and WinMD files should then +be bundled with the Universal Windows Platform (UWP) app consuming them. + +Steps: +1. Create an interface (IDL) file to define your Windows Runtime class, + its default interface, and any other interfaces it implements. +2. Build the project once to generate module.g.cpp, module.h.cpp, and + implementation templates under the "Generated Files" folder, as + well as skeleton class definitions under "Generated Files\sources". +3. Use the skeleton class definitions for reference to implement your + Windows Runtime classes. + +======================================================================== +Learn more about C++/WinRT here: +https://github.com/microsoft/cppwinrt/ +======================================================================== diff --git a/projects/msvs/Ortc.Universal/Class.cpp b/projects/msvs/Ortc.Universal/Class.cpp new file mode 100644 index 00000000..ff97498d --- /dev/null +++ b/projects/msvs/Ortc.Universal/Class.cpp @@ -0,0 +1,15 @@ +#include "pch.h" +#include "Class.h" + +namespace winrt::Ortc::implementation +{ + int32_t Class::Dummy() + { + throw hresult_not_implemented(); + } + + void Class::Dummy(int32_t /* value */) + { + throw hresult_not_implemented(); + } +} diff --git a/projects/msvs/Ortc.Universal/Class.h b/projects/msvs/Ortc.Universal/Class.h new file mode 100644 index 00000000..d0aed3c0 --- /dev/null +++ b/projects/msvs/Ortc.Universal/Class.h @@ -0,0 +1,21 @@ +#pragma once + +#include "Class.g.h" + +namespace winrt::Ortc::implementation +{ + struct Class : ClassT + { + Class() = default; + + int32_t Dummy(); + void Dummy(int32_t value); + }; +} + +namespace winrt::Ortc::factory_implementation +{ + struct Class : ClassT + { + }; +} diff --git a/projects/msvs/Ortc.Universal/Ortc.def b/projects/msvs/Ortc.Universal/Ortc.def new file mode 100644 index 00000000..24e7c123 --- /dev/null +++ b/projects/msvs/Ortc.Universal/Ortc.def @@ -0,0 +1,3 @@ +EXPORTS +DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE +DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE diff --git a/projects/msvs/Ortc.Universal/Ortc.vcxproj b/projects/msvs/Ortc.Universal/Ortc.vcxproj new file mode 100644 index 00000000..478df611 --- /dev/null +++ b/projects/msvs/Ortc.Universal/Ortc.vcxproj @@ -0,0 +1,586 @@ + + + + true + $(RequiredBundles);Microsoft.Windows.CppWinRT + true + {a1dbab83-90af-4531-a0af-50c21e8fdf30} + Ortc + Ortc + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.17134.0 + 10.0.17134.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + DynamicLibrary + v141 + Unicode + false + + + true + true + + + false + true + false + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + true + %(AdditionalOptions) /permissive- /bigobj /Zc:__cplusplus + 28204;4100 + WINUWP;NOMINMAX;_WINRT_DLL;%(PreprocessorDefinitions) + $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + + + Console + true + Ortc.def + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\winuwp_$(PlatformTarget) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\winuwp_$(PlatformTarget) + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\winuwp_$(PlatformTarget) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + + + + + + + /defaultlib:vccorlib /defaultlib:msvcrt %(AdditionalOptions) + /defaultlib:vccorlib /defaultlib:msvcrt %(AdditionalOptions) + /defaultlib:vccorlib /defaultlib:msvcrt %(AdditionalOptions) + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl + + + + + WINUWP;NOMINMAX;NDEBUG;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + $(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\ortc\idl\wrapper\generated\cppwinrt;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\cppwinrt;%(AdditionalIncludeDirectories) + + + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\winuwp_$(PlatformTarget) + webrtc.lib;WindowsApp.lib;;%(AdditionalDependencies) + + + /defaultlib:vccorlibd /defaultlib:msvcrtd %(AdditionalOptions) + + + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\winuwp_$(PlatformTarget) + webrtc.lib;WindowsApp.lib;;%(AdditionalDependencies) + + + /defaultlib:vccorlibd /defaultlib:msvcrtd %(AdditionalOptions) + + + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\winuwp_$(PlatformTarget) + webrtc.lib;WindowsApp.lib;;%(AdditionalDependencies) + + + /defaultlib:vccorlibd /defaultlib:msvcrtd %(AdditionalOptions) + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl + + + $(ProjectDir)..\..\..\ortc\idl\wrapper\generated\msidl;$(ProjectDir)..\..\..\ortc\idl\wrapper\override\msidl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + Create + + + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + + + + false + + + + + + + + + + + + {cc14ffe5-0018-4d8d-bc2c-c93477ce081c} + + + {b236bf5a-561d-4720-babf-f6119adf5793} + + + {cc03fba3-9028-47ad-b931-13b12db368f8} + + + {6c13dfe2-3aa7-40b9-919c-5e95e47fc321} + + + {55555c53-504f-4237-abc0-b2f59558a0e9} + + + {83e6cc72-ebc5-4c0c-b6a6-2d67a3c1e8a9} + + + {f370ffcf-6d70-40a3-853d-a272c4df2014} + + + + + + \ No newline at end of file diff --git a/projects/msvs/Ortc.Universal/Ortc.vcxproj.filters b/projects/msvs/Ortc.Universal/Ortc.vcxproj.filters new file mode 100644 index 00000000..718f637d --- /dev/null +++ b/projects/msvs/Ortc.Universal/Ortc.vcxproj.filters @@ -0,0 +1,1046 @@ + + + + + accd3aa8-1ba0-4223-9bbe-0c431709210b + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms + + + {926ab91d-31b4-48c3-b9a4-e681349f27f0} + + + {4ccbe0ae-6cb7-4fb2-ae7d-588be78ad35d} + + + {3779c05b-868e-4f43-83be-d831bb3e854d} + + + {812ae4ac-0c22-4a83-be60-1125d37c5eae} + + + {bb4e9c14-5cd3-466a-aa48-fd40795d792b} + + + {6bd5827d-9a3f-4f8a-8f4d-9f2d29ab4729} + + + {f2694fe9-67a8-4d77-848c-7a2c163c3be8} + + + {9de692b9-b253-4b3f-9c36-289773dd198c} + + + + + + Generated Files + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\generated\cppwinrt + + + + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\generated\cppwinrt + + + wrapper\override\cppwinrt + + + wrapper\generated\cppwinrt + + + + + + wrapper\generated\msidl + + + wrapper\generated\msidl + + + wrapper\generated\msidl + + + wrapper\generated\msidl + + + + + + + + wrapper\override\msidl + + + wrapper\override\msidl + + + wrapper\override\msidl + + + wrapper\generated\msidl + + + wrapper\override\msidl + + + \ No newline at end of file diff --git a/projects/msvs/Ortc.Universal/Ortc_TemporaryKey.pfx b/projects/msvs/Ortc.Universal/Ortc_TemporaryKey.pfx new file mode 100644 index 00000000..6ef98b98 Binary files /dev/null and b/projects/msvs/Ortc.Universal/Ortc_TemporaryKey.pfx differ diff --git a/projects/msvs/Ortc.Universal/pch.cpp b/projects/msvs/Ortc.Universal/pch.cpp new file mode 100644 index 00000000..bcb5590b --- /dev/null +++ b/projects/msvs/Ortc.Universal/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/projects/msvs/Ortc.Universal/pch.h b/projects/msvs/Ortc.Universal/pch.h new file mode 100644 index 00000000..51b7d37b --- /dev/null +++ b/projects/msvs/Ortc.Universal/pch.h @@ -0,0 +1,8 @@ +// +// pch.h +// Header for platform projection include files +// + +#pragma once + +#include "winrt/Windows.Foundation.h" diff --git a/projects/msvs/Ortc.Universal/readme.txt b/projects/msvs/Ortc.Universal/readme.txt new file mode 100644 index 00000000..3d06bfe0 --- /dev/null +++ b/projects/msvs/Ortc.Universal/readme.txt @@ -0,0 +1,23 @@ +======================================================================== + C++/WinRT Ortc Project Overview +======================================================================== + +This project demonstrates how to get started authoring Windows Runtime +classes directly with standard C++, using the C++/WinRT SDK component +to generate implementation headers from interface (IDL) files. The +generated Windows Runtime component binary and WinMD files should then +be bundled with the Universal Windows Platform (UWP) app consuming them. + +Steps: +1. Create an interface (IDL) file to define your Windows Runtime class, + its default interface, and any other interfaces it implements. +2. Build the project once to generate module.g.cpp, module.h.cpp, and + implementation templates under the "Generated Files" folder, as + well as skeleton class definitions under "Generated Files\sources". +3. Use the skeleton class definitions for reference to implement your + Windows Runtime classes. + +======================================================================== +Learn more about C++/WinRT here: +https://github.com/microsoft/cppwinrt/ +======================================================================== diff --git a/projects/msvs/ortclib-c.Universal/dllmain.cpp b/projects/msvs/ortclib-c.Universal/dllmain.cpp new file mode 100644 index 00000000..5ecb7122 --- /dev/null +++ b/projects/msvs/ortclib-c.Universal/dllmain.cpp @@ -0,0 +1,21 @@ + +#include "targetver.h" + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include + +BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, LPVOID /* lpReserved */) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} diff --git a/projects/msvs/ortclib-c.Universal/ortclib-c.vcxproj b/projects/msvs/ortclib-c.Universal/ortclib-c.vcxproj new file mode 100644 index 00000000..15c67adc --- /dev/null +++ b/projects/msvs/ortclib-c.Universal/ortclib-c.vcxproj @@ -0,0 +1,596 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {ff79354e-6381-405e-a16c-659b02e617e5} + DynamicLibrary + ortclib_c + en-US + 14.0 + true + Windows Store + 10.0.14393.0 + 10.0.10586.0 + 10.0 + + + + DynamicLibrary + true + v140 + + + DynamicLibrary + true + v140 + + + DynamicLibrary + true + v140 + + + DynamicLibrary + false + true + v140 + + + DynamicLibrary + false + true + v140 + + + DynamicLibrary + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + false + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + false + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + false + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + false + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + false + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + + NotUsing + false + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + 4068 + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;_WINDLL;%(PreprocessorDefinitions) + + + Console + false + false + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget);%(AdditionalLibraryDirectories) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + /defaultlib:vccorlibd.lib /defaultlib:msvcrtd.lib %(AdditionalOptions) + + + + + NotUsing + false + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + 4068 + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;_WINDLL;%(PreprocessorDefinitions) + + + Console + false + false + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget);%(AdditionalLibraryDirectories) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib %(AdditionalOptions) + + + + + NotUsing + false + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + 4068 + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;%(PreprocessorDefinitions) + + + Console + false + false + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget);%(AdditionalLibraryDirectories) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + /defaultlib:vccorlibd.lib /defaultlib:msvcrtd.lib %(AdditionalOptions) + + + + + NotUsing + false + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + 4068 + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;%(PreprocessorDefinitions) + + + Console + false + false + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget);%(AdditionalLibraryDirectories) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib %(AdditionalOptions) + + + + + NotUsing + false + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + 4068 + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;_WINDLL;%(PreprocessorDefinitions) + + + Console + false + false + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget);%(AdditionalLibraryDirectories) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + /defaultlib:vccorlibd.lib /defaultlib:msvcrtd.lib %(AdditionalOptions) + + + + + NotUsing + false + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + 4068 + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;_WINDLL;%(PreprocessorDefinitions) + + + Console + false + false + $(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\$(PlatformTarget);%(AdditionalLibraryDirectories) + webrtc.lib;WindowsApp.lib;%(AdditionalDependencies) + /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib %(AdditionalOptions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {cc14ffe5-0018-4d8d-bc2c-c93477ce081c} + + + {b236bf5a-561d-4720-babf-f6119adf5793} + + + {cc03fba3-9028-47ad-b931-13b12db368f8} + + + {6c13dfe2-3aa7-40b9-919c-5e95e47fc321} + + + {a19b7d13-a6ee-43bb-a913-aeb34f91bf98} + + + {55555c53-504f-4237-abc0-b2f59558a0e9} + + + {83e6cc72-ebc5-4c0c-b6a6-2d67a3c1e8a9} + + + {f370ffcf-6d70-40a3-853d-a272c4df2014} + + + + + + \ No newline at end of file diff --git a/projects/msvs/ortclib-c.Universal/ortclib-c.vcxproj.filters b/projects/msvs/ortclib-c.Universal/ortclib-c.vcxproj.filters new file mode 100644 index 00000000..5139fb72 --- /dev/null +++ b/projects/msvs/ortclib-c.Universal/ortclib-c.vcxproj.filters @@ -0,0 +1,969 @@ + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms + + + {6c756899-f026-418e-9288-8899d3d12eff} + + + + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + c + + + \ No newline at end of file diff --git a/projects/msvs/ortclib-c.Universal/targetver.h b/projects/msvs/ortclib-c.Universal/targetver.h new file mode 100644 index 00000000..a66ecb00 --- /dev/null +++ b/projects/msvs/ortclib-c.Universal/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/projects/msvs/ortclib-c.Win32/dllmain.cpp b/projects/msvs/ortclib-c.Win32/dllmain.cpp new file mode 100644 index 00000000..178311b5 --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/dllmain.cpp @@ -0,0 +1,21 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + ((void)hModule); + ((void)lpReserved); + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/projects/msvs/ortclib-c.Win32/ortclib-c.cpp b/projects/msvs/ortclib-c.Win32/ortclib-c.cpp new file mode 100644 index 00000000..f9f51276 --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/ortclib-c.cpp @@ -0,0 +1,6 @@ +// ortclib-c.cpp : Defines the exported functions for the DLL application. +// + +#include "stdafx.h" + + diff --git a/projects/msvs/ortclib-c.Win32/ortclib-c.vcxproj b/projects/msvs/ortclib-c.Win32/ortclib-c.vcxproj new file mode 100644 index 00000000..853a3674 --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/ortclib-c.vcxproj @@ -0,0 +1,588 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {2ACCF81D-4C88-4677-834A-CBE8488A66E7} + Win32Proj + ortclibc + 10.0.17134.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + libOrtc + + + + NotUsing + Level4 + Disabled + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;WIN32;_DEBUG;_WINDOWS;_USRDLL;ORTCLIBC_EXPORTS;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + false + false + + + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + true + + + Windows + true + webrtc.lib;Strmiids.lib;Userenv.lib;libcurl.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Dmoguids.lib;wmcodecdspuuid.lib;Msdmo.lib;Winmm.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\curl\$(PlatformTarget)-$(Configuration)-static\lib\;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\win32_$(PlatformTarget) + + + + + NotUsing + Level4 + Disabled + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;_DEBUG;_WINDOWS;_USRDLL;ORTCLIBC_EXPORTS;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + false + false + + + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + true + + + Windows + true + webrtc.lib;Strmiids.lib;Userenv.lib;libcurl.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Dmoguids.lib;wmcodecdspuuid.lib;Msdmo.lib;Winmm.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\curl\$(PlatformTarget)-$(Configuration)-static\lib\;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\win32_$(PlatformTarget) + + + + + Level4 + NotUsing + MaxSpeed + true + true + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;WIN32;NDEBUG;_WINDOWS;_USRDLL;ORTCLIBC_EXPORTS;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + false + + + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + true + + + Windows + true + true + true + webrtc.lib;Strmiids.lib;Userenv.lib;libcurl.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Dmoguids.lib;wmcodecdspuuid.lib;Msdmo.lib;Winmm.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\curl\$(PlatformTarget)-$(Configuration)-static\lib\;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\win32_$(PlatformTarget) + + + + + Level4 + NotUsing + MaxSpeed + true + true + ORTC_WRAPPER_C_GENERATED_IMPLEMENTATION;NDEBUG;_WINDOWS;_USRDLL;ORTCLIBC_EXPORTS;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..;%(AdditionalIncludeDirectories) + false + + + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + true + + + Windows + true + true + true + webrtc.lib;Strmiids.lib;Userenv.lib;libcurl.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Dmoguids.lib;wmcodecdspuuid.lib;Msdmo.lib;Winmm.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\..\curl\$(PlatformTarget)-$(Configuration)-static\lib\;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(Configuration)\win32_$(PlatformTarget) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + true + true + true + true + + + false + + + false + + + false + + + false + + + + + + + + {09a641ee-e209-4f71-9558-71a21720c800} + + + {83e1df0d-525a-4bee-8e22-09b77cfaad27} + + + {51152297-1963-433d-b1ac-3d77a99b5184} + + + {c61e43f2-c43c-4841-951b-e9de605d30b4} + + + {fff92483-103e-4c15-86c3-8865737273cf} + + + {0cad64d3-2e39-49af-961f-f57f6b1ae786} + + + {606afb99-807e-4306-9b3f-970e10744f0a} + + + + + + \ No newline at end of file diff --git a/projects/msvs/ortclib-c.Win32/ortclib-c.vcxproj.filters b/projects/msvs/ortclib-c.Win32/ortclib-c.vcxproj.filters new file mode 100644 index 00000000..c092d877 --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/ortclib-c.vcxproj.filters @@ -0,0 +1,1017 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {a9525863-dc46-49ea-bee9-f01ac8131deb} + + + {aae75a05-0cf1-46e4-a4c4-71dfda472a19} + + + {c4f20f37-5ff1-4116-b0d6-59346b649afe} + + + {04f981c7-f5b0-4a8c-a2b2-ea9c799d757e} + + + {b53d93e6-2545-4a8b-9839-8a7c8dbbcf84} + + + + + Header Files + + + Header Files + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\override\c + + + wrapper\override\c + + + wrapper\override\c + + + wrapper\override\c + + + wrapper\generated\c + + + + + Source Files + + + Source Files + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\generated\c + + + wrapper\override\c + + + wrapper\override\c + + + wrapper\override\c + + + wrapper\override\c + + + wrapper\generated\c + + + \ No newline at end of file diff --git a/projects/msvs/ortclib-c.Win32/stdafx.cpp b/projects/msvs/ortclib-c.Win32/stdafx.cpp new file mode 100644 index 00000000..2cc10635 --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// ortclib-c.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/projects/msvs/ortclib-c.Win32/stdafx.h b/projects/msvs/ortclib-c.Win32/stdafx.h new file mode 100644 index 00000000..f3a07375 --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/projects/msvs/ortclib-c.Win32/targetver.h b/projects/msvs/ortclib-c.Win32/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/projects/msvs/ortclib-c.Win32/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/projects/msvs/ortclib.Test.Universal/ortclib.Test.vcxproj b/projects/msvs/ortclib.Test.Universal/ortclib.Test.vcxproj index ef4bd0f8..0f7b8813 100644 --- a/projects/msvs/ortclib.Test.Universal/ortclib.Test.vcxproj +++ b/projects/msvs/ortclib.Test.Universal/ortclib.Test.vcxproj @@ -7,7 +7,7 @@ 14.0 true Windows Store - 10.0.14393.0 + 10.0.17134.0 10.0.10586.0 10.0 14.0 @@ -42,37 +42,37 @@ Application true - v140 + v141 Application true - v140 + v141 Application true - v140 + v141 Application false true - v140 + v141 true Application false true - v140 + v141 true Application false true - v140 + v141 true @@ -126,11 +126,13 @@ - /bigobj %(AdditionalOptions) - 4453;28204;4068;4290 - $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj /Zc:__cplusplus %(AdditionalOptions) + 4100;4238;4505 + $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) NotUsing - USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + WINUWP;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + Level4 + true $(VCInstallDir)UnitTest\lib\UWP;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(CONFIGURATION)\$(PlatformTarget);%(AdditionalLibraryDirectories) @@ -139,11 +141,13 @@ - /bigobj %(AdditionalOptions) - 4453;28204;4068;4290 - $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj /Zc:__cplusplus %(AdditionalOptions) + 4100;4238;4505 + $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) NotUsing - USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + WINUWP;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + Level4 + true $(VCInstallDir)UnitTest\lib\UWP;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(CONFIGURATION)\$(PlatformTarget);%(AdditionalLibraryDirectories) @@ -152,11 +156,13 @@ - /bigobj %(AdditionalOptions) - 4453;28204;4068;4290 - $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj /Zc:__cplusplus %(AdditionalOptions) + 4100;4238;4505 + $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) NotUsing - USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WINUWP;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + Level4 + true $(VCInstallDir)UnitTest\lib\UWP;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(CONFIGURATION)\$(PlatformTarget);%(AdditionalLibraryDirectories) @@ -165,11 +171,13 @@ - /bigobj %(AdditionalOptions) - 4453;28204;4068;4290 - $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj /Zc:__cplusplus %(AdditionalOptions) + 4100;4238;4505 + $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) NotUsing - USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WINUWP;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + Level4 + true $(VCInstallDir)UnitTest\lib\UWP;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(CONFIGURATION)\$(PlatformTarget);%(AdditionalLibraryDirectories) @@ -178,11 +186,13 @@ - /bigobj %(AdditionalOptions) - 4453;28204;4068;4290 - $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj /Zc:__cplusplus %(AdditionalOptions) + 4100;4238;4505 + $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) NotUsing - USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WINUWP;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + Level4 + true $(VCInstallDir)UnitTest\lib\UWP;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(CONFIGURATION)\$(PlatformTarget);%(AdditionalLibraryDirectories) @@ -191,11 +201,13 @@ - /bigobj %(AdditionalOptions) - 4453;28204;4068;4290 - $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj /Zc:__cplusplus %(AdditionalOptions) + 4100;4238;4505 + $(VCInstallDir)UnitTest\include\UWP;$(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(IntermediateOutputPath);%(AdditionalIncludeDirectories) NotUsing - USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + WINUWP;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + Level4 + true $(VCInstallDir)UnitTest\lib\UWP;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc\WEBRTC_BUILD\ortc\$(CONFIGURATION)\$(PlatformTarget);%(AdditionalLibraryDirectories) diff --git a/projects/msvs/ortclib.sln b/projects/msvs/ortclib.Universal.sln similarity index 82% rename from projects/msvs/ortclib.sln rename to projects/msvs/ortclib.Universal.sln index 7eba5924..82ca8696 100644 --- a/projects/msvs/ortclib.sln +++ b/projects/msvs/ortclib.Universal.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2026 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ortclib", "ortclib.Universal\ortclib.vcxproj", "{83E6CC72-EBC5-4C0C-B6A6-2D67A3C1E8A9}" EndProject @@ -34,6 +34,19 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idnkit", "..\..\..\idnkit\p EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zsLib.Eventing", "..\..\..\zsLib-eventing\projects\msvc\zsLib.Eventing.Universal\zsLib.Eventing.vcxproj", "{A19B7D13-A6EE-43BB-A913-AEB34F91BF98}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ortclib.wrapper", "ortclib.wrapper.Universal\ortclib.wrapper.vcxproj", "{F370FFCF-6D70-40A3-853D-A272C4DF2014}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ortc", "Ortc.Universal\Ortc.vcxproj", "{A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}" + ProjectSection(ProjectDependencies) = postProject + {55555C53-504F-4237-ABC0-B2F59558A0E9} = {55555C53-504F-4237-ABC0-B2F59558A0E9} + {B236BF5A-561D-4720-BABF-F6119ADF5793} = {B236BF5A-561D-4720-BABF-F6119ADF5793} + {83E6CC72-EBC5-4C0C-B6A6-2D67A3C1E8A9} = {83E6CC72-EBC5-4C0C-B6A6-2D67A3C1E8A9} + {CC03FBA3-9028-47AD-B931-13B12DB368F8} = {CC03FBA3-9028-47AD-B931-13B12DB368F8} + {F370FFCF-6D70-40A3-853D-A272C4DF2014} = {F370FFCF-6D70-40A3-853D-A272C4DF2014} + {6C13DFE2-3AA7-40B9-919C-5E95E47FC321} = {6C13DFE2-3AA7-40B9-919C-5E95E47FC321} + {CC14FFE5-0018-4D8D-BC2C-C93477CE081C} = {CC14FFE5-0018-4D8D-BC2C-C93477CE081C} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -182,8 +195,35 @@ Global {A19B7D13-A6EE-43BB-A913-AEB34F91BF98}.Release|x64.Build.0 = Release|x64 {A19B7D13-A6EE-43BB-A913-AEB34F91BF98}.Release|x86.ActiveCfg = Release|Win32 {A19B7D13-A6EE-43BB-A913-AEB34F91BF98}.Release|x86.Build.0 = Release|Win32 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Debug|ARM.ActiveCfg = Debug|ARM + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Debug|ARM.Build.0 = Debug|ARM + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Debug|x64.ActiveCfg = Debug|x64 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Debug|x64.Build.0 = Debug|x64 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Debug|x86.ActiveCfg = Debug|Win32 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Debug|x86.Build.0 = Debug|Win32 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Release|ARM.ActiveCfg = Release|ARM + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Release|ARM.Build.0 = Release|ARM + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Release|x64.ActiveCfg = Release|x64 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Release|x64.Build.0 = Release|x64 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Release|x86.ActiveCfg = Release|Win32 + {F370FFCF-6D70-40A3-853D-A272C4DF2014}.Release|x86.Build.0 = Release|Win32 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Debug|ARM.ActiveCfg = Debug|ARM + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Debug|ARM.Build.0 = Debug|ARM + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Debug|x64.ActiveCfg = Debug|x64 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Debug|x64.Build.0 = Debug|x64 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Debug|x86.ActiveCfg = Debug|Win32 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Debug|x86.Build.0 = Debug|Win32 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Release|ARM.ActiveCfg = Release|ARM + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Release|ARM.Build.0 = Release|ARM + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Release|x64.ActiveCfg = Release|x64 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Release|x64.Build.0 = Release|x64 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Release|x86.ActiveCfg = Release|Win32 + {A1DBAB83-90AF-4531-A0AF-50C21E8FDF30}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {23348DAC-CAD6-4A8E-97BA-F00BAD65040E} + EndGlobalSection EndGlobal diff --git a/projects/msvs/ortclib.Universal/compiler.resp b/projects/msvs/ortclib.Universal/compiler.resp new file mode 100644 index 00000000..fdb814d5 --- /dev/null +++ b/projects/msvs/ortclib.Universal/compiler.resp @@ -0,0 +1 @@ +/D "_LIB" /D "_UNICODE" /D "UNICODE" /D "WINUWP" /D "WIN32" /D "USE_ETW" /D "NOMINMAX" /D "WEBRTC_WIN" /D "USE_OPENSSL=1" /D "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" \ No newline at end of file diff --git a/projects/msvs/ortclib.Universal/ortclib.vcxproj b/projects/msvs/ortclib.Universal/ortclib.vcxproj index 91d68064..e931b789 100644 --- a/projects/msvs/ortclib.Universal/ortclib.vcxproj +++ b/projects/msvs/ortclib.Universal/ortclib.vcxproj @@ -46,6 +46,14 @@ + + true + true + true + true + true + true + @@ -55,17 +63,29 @@ + + + - + - + + + + + + + + + + @@ -74,25 +94,30 @@ + + + + + + + + + + - + + + + - - - - - - - - @@ -102,6 +127,8 @@ + + @@ -112,21 +139,43 @@ + + + + true + true + true + true + true + true + + + true + true + true + true + true + true + - - - - + + true + true + true + true + true + true + @@ -155,23 +204,29 @@ + + + + + + + + + + + + + - - - - - - - @@ -181,6 +236,232 @@ + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + + true + true + true + true + true + true + + {83e6cc72-ebc5-4c0c-b6a6-2d67a3c1e8a9} StaticLibrary @@ -189,7 +470,7 @@ 14.0 true Windows Store - 10.0.14393.0 + 10.0.17134.0 10.0.10586.0 10.0 @@ -197,35 +478,35 @@ StaticLibrary true - v140 + v141 StaticLibrary true - v140 + v141 StaticLibrary true - v140 + v141 StaticLibrary false true - v140 + v141 StaticLibrary false true - v140 + v141 StaticLibrary false true - v140 + v141 @@ -299,9 +580,12 @@ NotUsing true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - 4068;4290 - USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + 4505 + _DEBUG;%(PreprocessorDefinitions) + Level4 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) Console @@ -329,9 +613,12 @@ NotUsing true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - 4068;4290 - USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + 4505 + NDEBUG;%(PreprocessorDefinitions) + Level4 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) Console @@ -359,9 +646,12 @@ NotUsing true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - 4068;4290 - USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + 4505 + _DEBUG;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + Level4 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) Console @@ -389,9 +679,12 @@ NotUsing true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - 4068;4290 - USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + 4505 + NDEBUG;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + Level4 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) Console @@ -419,9 +712,12 @@ NotUsing true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - 4068;4290 - USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + 4505 + _DEBUG;%(PreprocessorDefinitions) + Level4 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) Console @@ -449,9 +745,12 @@ NotUsing true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - 4068;4290 - USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + 4505 + NDEBUG;%(PreprocessorDefinitions) + Level4 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) Console diff --git a/projects/msvs/ortclib.Universal/ortclib.vcxproj.filters b/projects/msvs/ortclib.Universal/ortclib.vcxproj.filters index 07100303..69c1947c 100644 --- a/projects/msvs/ortclib.Universal/ortclib.vcxproj.filters +++ b/projects/msvs/ortclib.Universal/ortclib.vcxproj.filters @@ -19,6 +19,12 @@ {a46272cc-d4bc-45f1-9353-82cc226e179e} + + {9ceab807-59c7-48a2-b3e6-101f52afbe9e} + + + {77c8ce93-8bbf-4b4a-92ba-49bf839a7dd9} + @@ -150,48 +156,21 @@ ortc\internal - - ortc\internal - ortc\internal - - ortc\internal - - - ortc\internal - ortc\internal ortc\internal - - ortc\internal - - - ortc\internal - - - ortc\internal - ortc\internal ortc\internal - - ortc\internal - - - ortc\internal - - - ortc\internal - ortc\internal @@ -273,26 +252,107 @@ ortc\internal - + + ortc\idl + + ortc\internal - + + ortc + + ortc\internal - - - + ortc\internal - - + + ortc\internal - - + + ortc\internal - - + + ortc\internal - + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc + + + ortc + + + ortc + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\cpp @@ -317,6 +377,13 @@ ortc\internal + + ortc\idl + + + ortc\idl + + @@ -379,9 +446,6 @@ ortc\cpp - - ortc\cpp - ortc\cpp @@ -391,30 +455,12 @@ ortc\cpp - - ortc\cpp - - - ortc\cpp - - - ortc\cpp - ortc\cpp ortc\cpp - - ortc\cpp - - - ortc\cpp - - - ortc\cpp - ortc\cpp @@ -472,5 +518,130 @@ ortc\adapter\cpp + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl + + + ortc\idl\adapter + + + ortc\idl\adapter + + + ortc\idl\adapter + + + ortc\idl\adapter + + + ortc\idl + \ No newline at end of file diff --git a/projects/msvs/ortclib.Win32.sln b/projects/msvs/ortclib.Win32.sln new file mode 100644 index 00000000..a97965e1 --- /dev/null +++ b/projects/msvs/ortclib.Win32.sln @@ -0,0 +1,144 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zsLib", "..\..\..\zsLib\projects\msvs\zsLib.Win32\zsLib.vcxproj", "{80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zsLib.Test", "..\..\..\zsLib\projects\msvs\zsLib.Test.Win32\zsLib.Test.vcxproj", "{FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptopp", "..\..\..\cryptopp\projects\msvs\cryptopp.Win32\cryptopp.vcxproj", "{09A641EE-E209-4F71-9558-71A21720C800}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zsLib.Eventing", "..\..\..\zsLib-eventing\projects\msvc\zsLib.Eventing.Win32\zsLib.Eventing.vcxproj", "{FFF92483-103E-4C15-86C3-8865737273CF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zsLib.Eventing.Tool.Compiler", "..\..\..\zsLib-eventing\projects\msvc\zsLib.Eventing.Tool.Compiler.Win32\zsLib.Eventing.Tool.Compiler.vcxproj", "{75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zsLib.Eventing.Tool", "..\..\..\zsLib-eventing\projects\msvc\zsLib.Eventing.Tool.Win32\zsLib.Eventing.Tool.vcxproj", "{E39B5144-3CFC-4431-ADA7-14C66DB794A4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udns", "..\..\..\udns\projects\msvs\udns.Win32\udns.vcxproj", "{C61E43F2-C43C-4841-951B-E9DE605D30B4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idnkit", "..\..\..\idnkit\projects\msvc\idnkit.Win32\idnkit.vcxproj", "{83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ortclib.services", "..\..\..\ortclib-services-cpp\projects\msvs\ortclib.services.Win32\ortclib.services.vcxproj", "{51152297-1963-433D-B1AC-3D77A99B5184}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ortclib", "ortclib.Win32\ortclib.vcxproj", "{0CAD64D3-2E39-49AF-961F-F57F6B1AE786}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ortclib.wrapper", "ortclib.wrapper.Win32\ortclib.wrapper.vcxproj", "{A7614AFA-6E2A-4037-96CA-B9F043333CA9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ortclib-c", "ortclib-c.Win32\ortclib-c.vcxproj", "{2ACCF81D-4C88-4677-834A-CBE8488A66E7}" + ProjectSection(ProjectDependencies) = postProject + {A7614AFA-6E2A-4037-96CA-B9F043333CA9} = {A7614AFA-6E2A-4037-96CA-B9F043333CA9} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Debug|x64.ActiveCfg = Debug|x64 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Debug|x64.Build.0 = Debug|x64 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Debug|x86.ActiveCfg = Debug|Win32 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Debug|x86.Build.0 = Debug|Win32 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Release|x64.ActiveCfg = Release|x64 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Release|x64.Build.0 = Release|x64 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Release|x86.ActiveCfg = Release|Win32 + {80306FBE-B1DF-4741-AE97-9BE65C8C4CAE}.Release|x86.Build.0 = Release|Win32 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Debug|x64.ActiveCfg = Debug|x64 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Debug|x64.Build.0 = Debug|x64 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Debug|x86.ActiveCfg = Debug|Win32 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Debug|x86.Build.0 = Debug|Win32 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Release|x64.ActiveCfg = Release|x64 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Release|x64.Build.0 = Release|x64 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Release|x86.ActiveCfg = Release|Win32 + {FE05FD1B-97E8-4F44-B18F-D1C4F414BC91}.Release|x86.Build.0 = Release|Win32 + {09A641EE-E209-4F71-9558-71A21720C800}.Debug|x64.ActiveCfg = Debug|x64 + {09A641EE-E209-4F71-9558-71A21720C800}.Debug|x64.Build.0 = Debug|x64 + {09A641EE-E209-4F71-9558-71A21720C800}.Debug|x86.ActiveCfg = Debug|Win32 + {09A641EE-E209-4F71-9558-71A21720C800}.Debug|x86.Build.0 = Debug|Win32 + {09A641EE-E209-4F71-9558-71A21720C800}.Release|x64.ActiveCfg = Release|x64 + {09A641EE-E209-4F71-9558-71A21720C800}.Release|x64.Build.0 = Release|x64 + {09A641EE-E209-4F71-9558-71A21720C800}.Release|x86.ActiveCfg = Release|Win32 + {09A641EE-E209-4F71-9558-71A21720C800}.Release|x86.Build.0 = Release|Win32 + {FFF92483-103E-4C15-86C3-8865737273CF}.Debug|x64.ActiveCfg = Debug|x64 + {FFF92483-103E-4C15-86C3-8865737273CF}.Debug|x64.Build.0 = Debug|x64 + {FFF92483-103E-4C15-86C3-8865737273CF}.Debug|x86.ActiveCfg = Debug|Win32 + {FFF92483-103E-4C15-86C3-8865737273CF}.Debug|x86.Build.0 = Debug|Win32 + {FFF92483-103E-4C15-86C3-8865737273CF}.Release|x64.ActiveCfg = Release|x64 + {FFF92483-103E-4C15-86C3-8865737273CF}.Release|x64.Build.0 = Release|x64 + {FFF92483-103E-4C15-86C3-8865737273CF}.Release|x86.ActiveCfg = Release|Win32 + {FFF92483-103E-4C15-86C3-8865737273CF}.Release|x86.Build.0 = Release|Win32 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Debug|x64.ActiveCfg = Debug|x64 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Debug|x64.Build.0 = Debug|x64 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Debug|x86.ActiveCfg = Debug|Win32 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Debug|x86.Build.0 = Debug|Win32 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Release|x64.ActiveCfg = Release|x64 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Release|x64.Build.0 = Release|x64 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Release|x86.ActiveCfg = Release|Win32 + {75CD59A3-CFC3-4F5E-AE2E-30E55157AA22}.Release|x86.Build.0 = Release|Win32 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Debug|x64.ActiveCfg = Debug|x64 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Debug|x64.Build.0 = Debug|x64 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Debug|x86.ActiveCfg = Debug|Win32 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Debug|x86.Build.0 = Debug|Win32 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Release|x64.ActiveCfg = Release|x64 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Release|x64.Build.0 = Release|x64 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Release|x86.ActiveCfg = Release|Win32 + {E39B5144-3CFC-4431-ADA7-14C66DB794A4}.Release|x86.Build.0 = Release|Win32 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Debug|x64.ActiveCfg = Debug|x64 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Debug|x64.Build.0 = Debug|x64 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Debug|x86.ActiveCfg = Debug|Win32 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Debug|x86.Build.0 = Debug|Win32 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Release|x64.ActiveCfg = Release|x64 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Release|x64.Build.0 = Release|x64 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Release|x86.ActiveCfg = Release|Win32 + {C61E43F2-C43C-4841-951B-E9DE605D30B4}.Release|x86.Build.0 = Release|Win32 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Debug|x64.ActiveCfg = Debug|x64 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Debug|x64.Build.0 = Debug|x64 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Debug|x86.ActiveCfg = Debug|Win32 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Debug|x86.Build.0 = Debug|Win32 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Release|x64.ActiveCfg = Release|x64 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Release|x64.Build.0 = Release|x64 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Release|x86.ActiveCfg = Release|Win32 + {83E1DF0D-525A-4BEE-8E22-09B77CFAAD27}.Release|x86.Build.0 = Release|Win32 + {51152297-1963-433D-B1AC-3D77A99B5184}.Debug|x64.ActiveCfg = Debug|x64 + {51152297-1963-433D-B1AC-3D77A99B5184}.Debug|x64.Build.0 = Debug|x64 + {51152297-1963-433D-B1AC-3D77A99B5184}.Debug|x86.ActiveCfg = Debug|Win32 + {51152297-1963-433D-B1AC-3D77A99B5184}.Debug|x86.Build.0 = Debug|Win32 + {51152297-1963-433D-B1AC-3D77A99B5184}.Release|x64.ActiveCfg = Release|x64 + {51152297-1963-433D-B1AC-3D77A99B5184}.Release|x64.Build.0 = Release|x64 + {51152297-1963-433D-B1AC-3D77A99B5184}.Release|x86.ActiveCfg = Release|Win32 + {51152297-1963-433D-B1AC-3D77A99B5184}.Release|x86.Build.0 = Release|Win32 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Debug|x64.ActiveCfg = Debug|x64 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Debug|x64.Build.0 = Debug|x64 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Debug|x86.ActiveCfg = Debug|Win32 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Debug|x86.Build.0 = Debug|Win32 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Release|x64.ActiveCfg = Release|x64 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Release|x64.Build.0 = Release|x64 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Release|x86.ActiveCfg = Release|Win32 + {0CAD64D3-2E39-49AF-961F-F57F6B1AE786}.Release|x86.Build.0 = Release|Win32 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Debug|x64.ActiveCfg = Debug|x64 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Debug|x64.Build.0 = Debug|x64 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Debug|x86.ActiveCfg = Debug|Win32 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Debug|x86.Build.0 = Debug|Win32 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Release|x64.ActiveCfg = Release|x64 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Release|x64.Build.0 = Release|x64 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Release|x86.ActiveCfg = Release|Win32 + {A7614AFA-6E2A-4037-96CA-B9F043333CA9}.Release|x86.Build.0 = Release|Win32 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Debug|x64.ActiveCfg = Debug|x64 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Debug|x64.Build.0 = Debug|x64 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Debug|x86.ActiveCfg = Debug|Win32 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Debug|x86.Build.0 = Debug|Win32 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Release|x64.ActiveCfg = Release|x64 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Release|x64.Build.0 = Release|x64 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Release|x86.ActiveCfg = Release|Win32 + {2ACCF81D-4C88-4677-834A-CBE8488A66E7}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7D063F70-9A7E-4A18-8016-6B4F83DDFA18} + EndGlobalSection +EndGlobal diff --git a/projects/msvs/ortclib.Win32/compiler.resp b/projects/msvs/ortclib.Win32/compiler.resp new file mode 100644 index 00000000..6dc766a1 --- /dev/null +++ b/projects/msvs/ortclib.Win32/compiler.resp @@ -0,0 +1 @@ +/D "_LIB" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "USE_ETW" /D "NOMINMAX" /D "WEBRTC_WIN" /D "USE_OPENSSL=1" /D "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" \ No newline at end of file diff --git a/projects/msvs/ortclib.Win32/ortclib.vcxproj b/projects/msvs/ortclib.Win32/ortclib.vcxproj index f9802e7a..539d04ad 100644 --- a/projects/msvs/ortclib.Win32/ortclib.vcxproj +++ b/projects/msvs/ortclib.Win32/ortclib.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -47,15 +47,19 @@ + + + - + + @@ -66,25 +70,39 @@ + + + + + + + + + + + + + + + + + + + - + + + + - - - - - - - - @@ -94,6 +112,8 @@ + + @@ -104,6 +124,8 @@ + + @@ -147,23 +169,29 @@ + + + + + + + + + + + + + - - - - - - - @@ -177,32 +205,32 @@ {0CAD64D3-2E39-49AF-961F-F57F6B1AE786} Win32Proj ortclib - 8.1 + 10.0.17134.0 StaticLibrary true - v140 + v141 Unicode StaticLibrary false - v140 + v141 true Unicode StaticLibrary true - v140 + v141 Unicode StaticLibrary false - v140 + v141 true Unicode @@ -245,12 +273,15 @@ - Level3 + Level4 Disabled true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - 4068;4290 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + 4505 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) + stdcpp17 Windows @@ -260,12 +291,15 @@ - Level3 + Level4 Disabled - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - _DEBUG;_LIB;USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - 4068;4290 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + 4505 true + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) + stdcpp17 Windows @@ -273,16 +307,19 @@ - Level3 + Level4 MaxSpeed true true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - 4068;4290 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + 4505 + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) + stdcpp17 Windows @@ -292,16 +329,19 @@ - Level3 + Level4 MaxSpeed true true - $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) - NDEBUG;_LIB;USE_ETW;USE_OPENSSL=1;NOMINMAX;WEBRTC_WIN;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;_UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - 4068;4290 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + 4505 true + true + /bigobj /Zc:__cplusplus @compiler.resp %(AdditionalOptions) + stdcpp17 Windows diff --git a/projects/msvs/ortclib.Win32/ortclib.vcxproj.filters b/projects/msvs/ortclib.Win32/ortclib.vcxproj.filters index 07100303..37fcdab3 100644 --- a/projects/msvs/ortclib.Win32/ortclib.vcxproj.filters +++ b/projects/msvs/ortclib.Win32/ortclib.vcxproj.filters @@ -150,48 +150,21 @@ ortc\internal - - ortc\internal - ortc\internal - - ortc\internal - - - ortc\internal - ortc\internal ortc\internal - - ortc\internal - - - ortc\internal - - - ortc\internal - ortc\internal ortc\internal - - ortc\internal - - - ortc\internal - - - ortc\internal - ortc\internal @@ -273,10 +246,103 @@ ortc\internal - + ortc\internal - + + ortc + + + ortc + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc\internal + + + ortc + + + ortc + + + ortc\internal + + ortc\internal @@ -379,9 +445,6 @@ ortc\cpp - - ortc\cpp - ortc\cpp @@ -391,30 +454,12 @@ ortc\cpp - - ortc\cpp - - - ortc\cpp - - - ortc\cpp - ortc\cpp ortc\cpp - - ortc\cpp - - - ortc\cpp - - - ortc\cpp - ortc\cpp @@ -472,5 +517,44 @@ ortc\adapter\cpp + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + + + ortc\cpp + \ No newline at end of file diff --git a/projects/msvs/ortclib.wrapper.Universal/ortclib.wrapper.vcxproj b/projects/msvs/ortclib.wrapper.Universal/ortclib.wrapper.vcxproj new file mode 100644 index 00000000..8c32ed4a --- /dev/null +++ b/projects/msvs/ortclib.wrapper.Universal/ortclib.wrapper.vcxproj @@ -0,0 +1,744 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f370ffcf-6d70-40a3-853d-a272c4df2014} + StaticLibrary + ortclib_wrapper + en-US + 14.0 + true + Windows Store + 10.0.17134.0 + 10.0.10586.0 + 10.0 + + + + StaticLibrary + true + v141 + + + StaticLibrary + true + v141 + + + StaticLibrary + true + v141 + + + StaticLibrary + false + true + v141 + + + StaticLibrary + false + true + v141 + + + StaticLibrary + false + true + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + false + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + + NotUsing + true + true + WINUWP;WEBRTC_WIN;USE_ETW;_UNICODE;UNICODE;%(PreprocessorDefinitions) + 4505 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + Level4 + true + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + NotUsing + true + true + WINUWP;WEBRTC_WIN;USE_ETW;_UNICODE;UNICODE;%(PreprocessorDefinitions) + 4505 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + Level4 + true + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + NotUsing + true + true + WINUWP;WEBRTC_WIN;USE_ETW;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + 4505 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + Level4 + true + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + NotUsing + true + true + WINUWP;WEBRTC_WIN;USE_ETW;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + 4505 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + Level4 + true + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + NotUsing + true + true + WINUWP;WEBRTC_WIN;USE_ETW;_UNICODE;UNICODE;%(PreprocessorDefinitions) + 4505 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + Level4 + true + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + NotUsing + true + true + WINUWP;WEBRTC_WIN;USE_ETW;_UNICODE;UNICODE;%(PreprocessorDefinitions) + 4505 + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + Level4 + true + + + Console + false + false + + + /IGNORE:4264 %(AdditionalOptions) + + + + + + \ No newline at end of file diff --git a/projects/msvs/ortclib.wrapper.Universal/ortclib.wrapper.vcxproj.filters b/projects/msvs/ortclib.wrapper.Universal/ortclib.wrapper.vcxproj.filters new file mode 100644 index 00000000..bfd41a47 --- /dev/null +++ b/projects/msvs/ortclib.wrapper.Universal/ortclib.wrapper.vcxproj.filters @@ -0,0 +1,1449 @@ + + + + + {b6baf693-b17a-4e11-8724-cfd637d309b6} + + + {152586c3-7ca8-4960-ab98-6cd775b89c72} + + + {2a06a640-30ed-4588-8934-f49d95168794} + + + {856ec7c4-23a4-4b0a-ae49-46a103ab4f34} + + + {a199672d-2b80-4c59-92cf-79f9330a959c} + + + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\override + + + ortc\idl\wrapper\override + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper + + + ortc\idl\wrapper\generated + + + ortc\idl\wrapper\override + + + ortc\idl\wrapper + + + \ No newline at end of file diff --git a/projects/msvs/ortclib.wrapper.Win32/ortclib.wrapper.vcxproj b/projects/msvs/ortclib.wrapper.Win32/ortclib.wrapper.vcxproj new file mode 100644 index 00000000..2dbf5aff --- /dev/null +++ b/projects/msvs/ortclib.wrapper.Win32/ortclib.wrapper.vcxproj @@ -0,0 +1,656 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {A7614AFA-6E2A-4037-96CA-B9F043333CA9} + Win32Proj + ortclibwrapper + 10.0.17134.0 + + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + StaticLibrary + true + v141 + Unicode + + + StaticLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + $(SolutionDir)Build\Output\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + $(SolutionDir)Build\Intermediate\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ + + + + NotUsing + Level4 + Disabled + WEBRTC_WIN;USE_ETW;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + 4505 + + + EditAndContinue + false + Sync + Default + true + /Zc:__cplusplus %(AdditionalOptions) + stdcpp17 + + + Windows + + + + + NotUsing + Level4 + Disabled + WEBRTC_WIN;USE_ETW;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + 4505 + None + true + /Zc:__cplusplus %(AdditionalOptions) + stdcpp17 + + + Windows + + + + + Level4 + NotUsing + MaxSpeed + true + true + WEBRTC_WIN;USE_ETW;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + 4505 + None + true + /Zc:__cplusplus %(AdditionalOptions) + stdcpp17 + + + Windows + true + true + + + + + Level4 + NotUsing + MaxSpeed + true + true + WEBRTC_WIN;USE_ETW;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + $(ProjectDir)..\..\..;$(ProjectDir)..\..\..\ortc\idl;$(ProjectDir)..\..\..\..\zsLib;$(ProjectDir)..\..\..\..\zsLib-eventing;$(ProjectDir)..\..\..\..\ortclib-services-cpp;$(ProjectDir)..\..\..\..;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\webrtc;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\boringssl\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\usrsctp\usrsctplib;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\srtp\crypto\include;$(ProjectDir)..\..\..\..\..\..\webrtc\xplatform\libsrtp\config;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + 4505 + None + true + /Zc:__cplusplus %(AdditionalOptions) + stdcpp17 + + + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/msvs/ortclib.wrapper.Win32/ortclib.wrapper.vcxproj.filters b/projects/msvs/ortclib.wrapper.Win32/ortclib.wrapper.vcxproj.filters new file mode 100644 index 00000000..ff5f3579 --- /dev/null +++ b/projects/msvs/ortclib.wrapper.Win32/ortclib.wrapper.vcxproj.filters @@ -0,0 +1,1450 @@ + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {08eb792d-904e-4e2f-aea7-43c9cbc457d8} + + + {348ab871-23f0-4b07-b7ad-d004b3eacbe3} + + + {f694e985-8d71-4785-a1eb-e0e210ed15e8} + + + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper\generated + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper + + + wrapper\override + + + wrapper\override + + + wrapper\override + + + wrapper + + + wrapper + + + \ No newline at end of file diff --git a/projects/xcode/ortclib-c-ios/ortclib-c-ios.xcodeproj/project.pbxproj b/projects/xcode/ortclib-c-ios/ortclib-c-ios.xcodeproj/project.pbxproj new file mode 100644 index 00000000..5ff99c5b --- /dev/null +++ b/projects/xcode/ortclib-c-ios/ortclib-c-ios.xcodeproj/project.pbxproj @@ -0,0 +1,1822 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 00216E151E96E97F008204EA /* c_helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CDC1E96E97F008204EA /* c_helpers.cpp */; }; + 00216E161E96E97F008204EA /* c_org_ortc_adapter_MediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CDE1E96E97F008204EA /* c_org_ortc_adapter_MediaStream.cpp */; }; + 00216E171E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE01E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */; }; + 00216E181E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE21E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */; }; + 00216E191E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE41E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */; }; + 00216E1A1E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE61E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */; }; + 00216E1B1E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE81E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */; }; + 00216E1C1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CEA1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */; }; + 00216E1D1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CEC1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */; }; + 00216E1E1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CEE1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */; }; + 00216E1F1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF01E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */; }; + 00216E201E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF21E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */; }; + 00216E211E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF41E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */; }; + 00216E221E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF61E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */; }; + 00216E231E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF81E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */; }; + 00216E241E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CFA1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */; }; + 00216E251E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CFC1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */; }; + 00216E261E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CFE1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */; }; + 00216E271E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D001E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */; }; + 00216E281E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D021E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */; }; + 00216E291E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D041E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */; }; + 00216E2A1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D061E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */; }; + 00216E2B1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D081E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */; }; + 00216E2C1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D0A1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */; }; + 00216E2D1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D0C1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */; }; + 00216E2E1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D0E1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */; }; + 00216E2F1E96E97F008204EA /* c_org_ortc_ConstrainBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D101E96E97F008204EA /* c_org_ortc_ConstrainBoolean.cpp */; }; + 00216E301E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D121E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */; }; + 00216E311E96E97F008204EA /* c_org_ortc_ConstrainDouble.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D141E96E97F008204EA /* c_org_ortc_ConstrainDouble.cpp */; }; + 00216E321E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D161E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */; }; + 00216E331E96E97F008204EA /* c_org_ortc_ConstrainLong.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D181E96E97F008204EA /* c_org_ortc_ConstrainLong.cpp */; }; + 00216E341E96E97F008204EA /* c_org_ortc_ConstrainLongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D1A1E96E97F008204EA /* c_org_ortc_ConstrainLongRange.cpp */; }; + 00216E351E96E97F008204EA /* c_org_ortc_ConstrainString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D1C1E96E97F008204EA /* c_org_ortc_ConstrainString.cpp */; }; + 00216E361E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D1E1E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.cpp */; }; + 00216E371E96E97F008204EA /* c_org_ortc_DoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D201E96E97F008204EA /* c_org_ortc_DoubleRange.cpp */; }; + 00216E381E96E97F008204EA /* c_org_ortc_Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D221E96E97F008204EA /* c_org_ortc_Error.cpp */; }; + 00216E391E96E97F008204EA /* c_org_ortc_ErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D241E96E97F008204EA /* c_org_ortc_ErrorEvent.cpp */; }; + 00216E3A1E96E97F008204EA /* c_org_ortc_Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D261E96E97F008204EA /* c_org_ortc_Json.cpp */; }; + 00216E3B1E96E97F008204EA /* c_org_ortc_Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D281E96E97F008204EA /* c_org_ortc_Logger.cpp */; }; + 00216E3C1E96E97F008204EA /* c_org_ortc_LongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D2A1E96E97F008204EA /* c_org_ortc_LongRange.cpp */; }; + 00216E3D1E96E97F008204EA /* c_org_ortc_MediaControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D2C1E96E97F008204EA /* c_org_ortc_MediaControl.cpp */; }; + 00216E3E1E96E980008204EA /* c_org_ortc_MediaDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D2E1E96E97F008204EA /* c_org_ortc_MediaDeviceInfo.cpp */; }; + 00216E3F1E96E980008204EA /* c_org_ortc_MediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D301E96E97F008204EA /* c_org_ortc_MediaDevices.cpp */; }; + 00216E401E96E980008204EA /* c_org_ortc_MediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D321E96E97F008204EA /* c_org_ortc_MediaSource.cpp */; }; + 00216E411E96E980008204EA /* c_org_ortc_MediaStreamConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D341E96E97F008204EA /* c_org_ortc_MediaStreamConstraints.cpp */; }; + 00216E421E96E980008204EA /* c_org_ortc_MediaStreamTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D361E96E97F008204EA /* c_org_ortc_MediaStreamTrack.cpp */; }; + 00216E431E96E980008204EA /* c_org_ortc_MediaTrackCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D381E96E97F008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */; }; + 00216E441E96E980008204EA /* c_org_ortc_MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D3A1E96E97F008204EA /* c_org_ortc_MediaTrackConstraints.cpp */; }; + 00216E451E96E980008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D3C1E96E97F008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */; }; + 00216E461E96E980008204EA /* c_org_ortc_MediaTrackSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D3E1E96E97F008204EA /* c_org_ortc_MediaTrackSettings.cpp */; }; + 00216E471E96E980008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D401E96E97F008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */; }; + 00216E481E96E980008204EA /* c_org_ortc_MessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D421E96E97F008204EA /* c_org_ortc_MessageQueue.cpp */; }; + 00216E491E96E980008204EA /* c_org_ortc_OrtcLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D441E96E97F008204EA /* c_org_ortc_OrtcLib.cpp */; }; + 00216E4A1E96E980008204EA /* c_org_ortc_OverconstrainedError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D461E96E97F008204EA /* c_org_ortc_OverconstrainedError.cpp */; }; + 00216E4B1E96E980008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D481E96E97F008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */; }; + 00216E4C1E96E980008204EA /* c_org_ortc_RTCCertificate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D4A1E96E97F008204EA /* c_org_ortc_RTCCertificate.cpp */; }; + 00216E4D1E96E980008204EA /* c_org_ortc_RTCCertificateStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D4C1E96E97F008204EA /* c_org_ortc_RTCCertificateStats.cpp */; }; + 00216E4E1E96E980008204EA /* c_org_ortc_RTCCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D4E1E96E97F008204EA /* c_org_ortc_RTCCodec.cpp */; }; + 00216E4F1E96E980008204EA /* c_org_ortc_RTCDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D501E96E97F008204EA /* c_org_ortc_RTCDataChannel.cpp */; }; + 00216E501E96E980008204EA /* c_org_ortc_RTCDataChannelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D521E96E97F008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */; }; + 00216E511E96E980008204EA /* c_org_ortc_RTCDataChannelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D541E96E97F008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */; }; + 00216E521E96E980008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D561E96E97F008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */; }; + 00216E531E96E980008204EA /* c_org_ortc_RTCDataChannelStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D581E96E97F008204EA /* c_org_ortc_RTCDataChannelStats.cpp */; }; + 00216E541E96E980008204EA /* c_org_ortc_RTCDataTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D5A1E96E97F008204EA /* c_org_ortc_RTCDataTransport.cpp */; }; + 00216E551E96E980008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D5C1E96E97F008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */; }; + 00216E561E96E980008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D5E1E96E97F008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */; }; + 00216E571E96E980008204EA /* c_org_ortc_RTCDtlsParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D601E96E97F008204EA /* c_org_ortc_RTCDtlsParameters.cpp */; }; + 00216E581E96E980008204EA /* c_org_ortc_RTCDtlsTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D621E96E97F008204EA /* c_org_ortc_RTCDtlsTransport.cpp */; }; + 00216E591E96E980008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D641E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */; }; + 00216E5A1E96E980008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D661E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */; }; + 00216E5B1E96E980008204EA /* c_org_ortc_RTCDtmfSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D681E96E97F008204EA /* c_org_ortc_RTCDtmfSender.cpp */; }; + 00216E5C1E96E980008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D6A1E96E97F008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */; }; + 00216E5D1E96E980008204EA /* c_org_ortc_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D6C1E96E97F008204EA /* c_org_ortc_RTCIceCandidate.cpp */; }; + 00216E5E1E96E980008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D6E1E96E97F008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */; }; + 00216E5F1E96E980008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D701E96E97F008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */; }; + 00216E601E96E980008204EA /* c_org_ortc_RTCIceCandidatePair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D721E96E97F008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */; }; + 00216E611E96E980008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D741E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */; }; + 00216E621E96E980008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D761E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */; }; + 00216E631E96E980008204EA /* c_org_ortc_RTCIceGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D781E96E97F008204EA /* c_org_ortc_RTCIceGatherer.cpp */; }; + 00216E641E96E980008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D7A1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */; }; + 00216E651E96E980008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D7C1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */; }; + 00216E661E96E980008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D7E1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */; }; + 00216E671E96E980008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D801E96E97F008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */; }; + 00216E681E96E980008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D821E96E97F008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */; }; + 00216E691E96E980008204EA /* c_org_ortc_RTCIceGathererStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D841E96E97F008204EA /* c_org_ortc_RTCIceGathererStats.cpp */; }; + 00216E6A1E96E980008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D861E96E97F008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */; }; + 00216E6B1E96E980008204EA /* c_org_ortc_RTCIceGatherOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D881E96E97F008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */; }; + 00216E6C1E96E980008204EA /* c_org_ortc_RTCIceParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D8A1E96E97F008204EA /* c_org_ortc_RTCIceParameters.cpp */; }; + 00216E6D1E96E980008204EA /* c_org_ortc_RTCIceServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D8C1E96E97F008204EA /* c_org_ortc_RTCIceServer.cpp */; }; + 00216E6E1E96E980008204EA /* c_org_ortc_RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D8E1E96E97F008204EA /* c_org_ortc_RTCIceTransport.cpp */; }; + 00216E6F1E96E980008204EA /* c_org_ortc_RTCIceTransportController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D901E96E97F008204EA /* c_org_ortc_RTCIceTransportController.cpp */; }; + 00216E701E96E980008204EA /* c_org_ortc_RTCIceTransportOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D921E96E97F008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */; }; + 00216E711E96E980008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D941E96E97F008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */; }; + 00216E721E96E980008204EA /* c_org_ortc_RTCIceTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D961E96E97F008204EA /* c_org_ortc_RTCIceTransportStats.cpp */; }; + 00216E731E96E980008204EA /* c_org_ortc_RTCIdentity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D981E96E97F008204EA /* c_org_ortc_RTCIdentity.cpp */; }; + 00216E741E96E980008204EA /* c_org_ortc_RTCIdentityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D9A1E96E97F008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */; }; + 00216E751E96E980008204EA /* c_org_ortc_RTCIdentityError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D9C1E96E97F008204EA /* c_org_ortc_RTCIdentityError.cpp */; }; + 00216E761E96E980008204EA /* c_org_ortc_RTCIdentityResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D9E1E96E97F008204EA /* c_org_ortc_RTCIdentityResult.cpp */; }; + 00216E771E96E980008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA01E96E97F008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */; }; + 00216E781E96E980008204EA /* c_org_ortc_RTCMediaStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA21E96E97F008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */; }; + 00216E791E96E980008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA41E96E97F008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */; }; + 00216E7A1E96E980008204EA /* c_org_ortc_RTCMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA61E96E97F008204EA /* c_org_ortc_RTCMessageEvent.cpp */; }; + 00216E7B1E96E980008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA81E96E97F008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */; }; + 00216E7C1E96E980008204EA /* c_org_ortc_RTCRtcpFeedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DAA1E96E97F008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */; }; + 00216E7D1E96E980008204EA /* c_org_ortc_RTCRtcpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DAC1E96E97F008204EA /* c_org_ortc_RTCRtcpParameters.cpp */; }; + 00216E7E1E96E980008204EA /* c_org_ortc_RTCRtcpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DAE1E96E97F008204EA /* c_org_ortc_RTCRtcpTransport.cpp */; }; + 00216E7F1E96E980008204EA /* c_org_ortc_RTCRtpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB01E96E97F008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */; }; + 00216E801E96E980008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB21E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */; }; + 00216E811E96E980008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB41E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */; }; + 00216E821E96E980008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB61E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */; }; + 00216E831E96E980008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB81E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */; }; + 00216E841E96E980008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DBA1E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */; }; + 00216E851E96E980008204EA /* c_org_ortc_RTCRtpContributingSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DBC1E96E97F008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */; }; + 00216E861E96E980008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DBE1E96E97F008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */; }; + 00216E871E96E980008204EA /* c_org_ortc_RTCRtpFecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC01E96E97F008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */; }; + 00216E881E96E980008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC21E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */; }; + 00216E891E96E980008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC41E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */; }; + 00216E8A1E96E980008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC61E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */; }; + 00216E8B1E96E980008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC81E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */; }; + 00216E8C1E96E980008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DCA1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */; }; + 00216E8D1E96E980008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DCC1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */; }; + 00216E8E1E96E980008204EA /* c_org_ortc_RTCRtpListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DCE1E96E97F008204EA /* c_org_ortc_RTCRtpListener.cpp */; }; + 00216E8F1E96E980008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD01E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */; }; + 00216E901E96E980008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD21E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */; }; + 00216E911E96E980008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD41E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */; }; + 00216E921E96E980008204EA /* c_org_ortc_RTCRtpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD61E96E97F008204EA /* c_org_ortc_RTCRtpParameters.cpp */; }; + 00216E931E96E980008204EA /* c_org_ortc_RTCRtpReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD81E96E97F008204EA /* c_org_ortc_RTCRtpReceiver.cpp */; }; + 00216E941E96E980008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DDA1E96E97F008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */; }; + 00216E951E96E980008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DDC1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */; }; + 00216E961E96E980008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DDE1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */; }; + 00216E971E96E980008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE01E96E97F008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */; }; + 00216E981E96E980008204EA /* c_org_ortc_RTCRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE21E96E97F008204EA /* c_org_ortc_RTCRtpSender.cpp */; }; + 00216E991E96E980008204EA /* c_org_ortc_RTCRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE41E96E97F008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */; }; + 00216E9A1E96E980008204EA /* c_org_ortc_RTCRtpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE61E96E97F008204EA /* c_org_ortc_RTCRtpTransport.cpp */; }; + 00216E9B1E96E980008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE81E96E97F008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */; }; + 00216E9C1E96E980008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DEA1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */; }; + 00216E9D1E96E980008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DEC1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */; }; + 00216E9E1E96E980008204EA /* c_org_ortc_RTCSctpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DEE1E96E97F008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */; }; + 00216E9F1E96E980008204EA /* c_org_ortc_RTCSctpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF01E96E97F008204EA /* c_org_ortc_RTCSctpTransport.cpp */; }; + 00216EA01E96E980008204EA /* c_org_ortc_RTCSctpTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF21E96E97F008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */; }; + 00216EA11E96E980008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF41E96E97F008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */; }; + 00216EA21E96E980008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF61E96E97F008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */; }; + 00216EA31E96E980008204EA /* c_org_ortc_RTCSctpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF81E96E97F008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */; }; + 00216EA41E96E980008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DFA1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */; }; + 00216EA51E96E980008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DFC1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */; }; + 00216EA61E96E980008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DFE1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */; }; + 00216EA71E96E980008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E001E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */; }; + 00216EA81E96E980008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E021E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */; }; + 00216EA91E96E980008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E041E96E97F008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */; }; + 00216EAA1E96E980008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E061E96E97F008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */; }; + 00216EAB1E96E980008204EA /* c_org_ortc_RTCStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E081E96E97F008204EA /* c_org_ortc_RTCStats.cpp */; }; + 00216EAC1E96E980008204EA /* c_org_ortc_RTCStatsProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E0A1E96E97F008204EA /* c_org_ortc_RTCStatsProvider.cpp */; }; + 00216EAD1E96E980008204EA /* c_org_ortc_RTCStatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E0C1E96E97F008204EA /* c_org_ortc_RTCStatsReport.cpp */; }; + 00216EAE1E96E980008204EA /* c_org_ortc_RTCStatsTypeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E0E1E96E97F008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */; }; + 00216EAF1E96E980008204EA /* c_org_ortc_Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E101E96E97F008204EA /* c_org_ortc_Settings.cpp */; }; + 00216EB01E96E980008204EA /* c_org_ortc_StringOrStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E121E96E97F008204EA /* c_org_ortc_StringOrStringList.cpp */; }; + 52BFF6211E9CFBEE00DF88A1 /* libcryptopp-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6191E9CFBEE00DF88A1 /* libcryptopp-ios.a */; }; + 52BFF6221E9CFBEE00DF88A1 /* libidnkit-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF61A1E9CFBEE00DF88A1 /* libidnkit-ios.a */; }; + 52BFF6231E9CFBEE00DF88A1 /* libortclib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF61B1E9CFBEE00DF88A1 /* libortclib-ios.a */; }; + 52BFF6241E9CFBEE00DF88A1 /* libortclib-wrapper-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF61C1E9CFBEE00DF88A1 /* libortclib-wrapper-ios.a */; }; + 52BFF6251E9CFBEE00DF88A1 /* libortclib.services-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF61D1E9CFBEE00DF88A1 /* libortclib.services-ios.a */; }; + 52BFF6261E9CFBEE00DF88A1 /* libudns-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF61E1E9CFBEE00DF88A1 /* libudns-ios.a */; }; + 52BFF6271E9CFBEE00DF88A1 /* libzsLib-eventing-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF61F1E9CFBEE00DF88A1 /* libzsLib-eventing-ios.a */; }; + 52BFF6281E9CFBEE00DF88A1 /* libzsLib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6201E9CFBEE00DF88A1 /* libzsLib-ios.a */; }; + 52BFF6331E9CFC5500DF88A1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6291E9CFC5500DF88A1 /* AudioToolbox.framework */; }; + 52BFF6341E9CFC5500DF88A1 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62A1E9CFC5500DF88A1 /* AVFoundation.framework */; }; + 52BFF6351E9CFC5500DF88A1 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62B1E9CFC5500DF88A1 /* CoreMedia.framework */; }; + 52BFF6361E9CFC5500DF88A1 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62C1E9CFC5500DF88A1 /* CoreVideo.framework */; }; + 52BFF6371E9CFC5500DF88A1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62D1E9CFC5500DF88A1 /* Foundation.framework */; }; + 52BFF6381E9CFC5500DF88A1 /* libresolv.9.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62E1E9CFC5500DF88A1 /* libresolv.9.tbd */; }; + 52BFF6391E9CFC5500DF88A1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62F1E9CFC5500DF88A1 /* libz.tbd */; }; + 52BFF63A1E9CFC5500DF88A1 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6301E9CFC5500DF88A1 /* Security.framework */; }; + 52BFF63B1E9CFC5500DF88A1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6311E9CFC5500DF88A1 /* UIKit.framework */; }; + 52BFF63C1E9CFC5500DF88A1 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6321E9CFC5500DF88A1 /* VideoToolbox.framework */; }; + 52BFF63E1E9D053900DF88A1 /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF63D1E9D053900DF88A1 /* libcurl.a */; }; + 52BFF6401E9D0A1800DF88A1 /* webrtc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF63F1E9D0A1800DF88A1 /* webrtc.a */; }; + 52BFF6491E9D0C2800DF88A1 /* c_helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CDC1E96E97F008204EA /* c_helpers.cpp */; }; + 52BFF64A1E9D0C2800DF88A1 /* c_org_ortc_adapter_MediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CDE1E96E97F008204EA /* c_org_ortc_adapter_MediaStream.cpp */; }; + 52BFF64B1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE01E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */; }; + 52BFF64C1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE21E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */; }; + 52BFF64D1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE41E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */; }; + 52BFF64E1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE61E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */; }; + 52BFF64F1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CE81E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */; }; + 52BFF6501E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CEA1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */; }; + 52BFF6511E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCOfferOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CEC1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */; }; + 52BFF6521E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCPeerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CEE1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */; }; + 52BFF6531E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF01E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */; }; + 52BFF6541E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF21E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */; }; + 52BFF6551E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF41E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */; }; + 52BFF6561E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF61E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */; }; + 52BFF6571E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CF81E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */; }; + 52BFF6581E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CFA1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */; }; + 52BFF6591E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CFC1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */; }; + 52BFF65A1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216CFE1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */; }; + 52BFF65B1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D001E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */; }; + 52BFF65C1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D021E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */; }; + 52BFF65D1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D041E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */; }; + 52BFF65E1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D061E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */; }; + 52BFF65F1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D081E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */; }; + 52BFF6601E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D0A1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */; }; + 52BFF6611E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D0C1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */; }; + 52BFF6621E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D0E1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */; }; + 52BFF6631E9D0C2800DF88A1 /* c_org_ortc_ConstrainBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D101E96E97F008204EA /* c_org_ortc_ConstrainBoolean.cpp */; }; + 52BFF6641E9D0C2800DF88A1 /* c_org_ortc_ConstrainBooleanParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D121E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */; }; + 52BFF6651E9D0C2800DF88A1 /* c_org_ortc_ConstrainDouble.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D141E96E97F008204EA /* c_org_ortc_ConstrainDouble.cpp */; }; + 52BFF6661E9D0C2800DF88A1 /* c_org_ortc_ConstrainDoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D161E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */; }; + 52BFF6671E9D0C2800DF88A1 /* c_org_ortc_ConstrainLong.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D181E96E97F008204EA /* c_org_ortc_ConstrainLong.cpp */; }; + 52BFF6681E9D0C2800DF88A1 /* c_org_ortc_ConstrainLongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D1A1E96E97F008204EA /* c_org_ortc_ConstrainLongRange.cpp */; }; + 52BFF6691E9D0C2800DF88A1 /* c_org_ortc_ConstrainString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D1C1E96E97F008204EA /* c_org_ortc_ConstrainString.cpp */; }; + 52BFF66A1E9D0C2800DF88A1 /* c_org_ortc_ConstrainStringParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D1E1E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.cpp */; }; + 52BFF66B1E9D0C2800DF88A1 /* c_org_ortc_DoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D201E96E97F008204EA /* c_org_ortc_DoubleRange.cpp */; }; + 52BFF66C1E9D0C2800DF88A1 /* c_org_ortc_Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D221E96E97F008204EA /* c_org_ortc_Error.cpp */; }; + 52BFF66D1E9D0C2800DF88A1 /* c_org_ortc_ErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D241E96E97F008204EA /* c_org_ortc_ErrorEvent.cpp */; }; + 52BFF66E1E9D0C2800DF88A1 /* c_org_ortc_Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D261E96E97F008204EA /* c_org_ortc_Json.cpp */; }; + 52BFF66F1E9D0C2800DF88A1 /* c_org_ortc_Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D281E96E97F008204EA /* c_org_ortc_Logger.cpp */; }; + 52BFF6701E9D0C2800DF88A1 /* c_org_ortc_LongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D2A1E96E97F008204EA /* c_org_ortc_LongRange.cpp */; }; + 52BFF6711E9D0C2800DF88A1 /* c_org_ortc_MediaControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D2C1E96E97F008204EA /* c_org_ortc_MediaControl.cpp */; }; + 52BFF6721E9D0C2800DF88A1 /* c_org_ortc_MediaDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D2E1E96E97F008204EA /* c_org_ortc_MediaDeviceInfo.cpp */; }; + 52BFF6731E9D0C2800DF88A1 /* c_org_ortc_MediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D301E96E97F008204EA /* c_org_ortc_MediaDevices.cpp */; }; + 52BFF6741E9D0C2800DF88A1 /* c_org_ortc_MediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D321E96E97F008204EA /* c_org_ortc_MediaSource.cpp */; }; + 52BFF6751E9D0C2800DF88A1 /* c_org_ortc_MediaStreamConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D341E96E97F008204EA /* c_org_ortc_MediaStreamConstraints.cpp */; }; + 52BFF6761E9D0C2800DF88A1 /* c_org_ortc_MediaStreamTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D361E96E97F008204EA /* c_org_ortc_MediaStreamTrack.cpp */; }; + 52BFF6771E9D0C2800DF88A1 /* c_org_ortc_MediaTrackCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D381E96E97F008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */; }; + 52BFF6781E9D0C2800DF88A1 /* c_org_ortc_MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D3A1E96E97F008204EA /* c_org_ortc_MediaTrackConstraints.cpp */; }; + 52BFF6791E9D0C2800DF88A1 /* c_org_ortc_MediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D3C1E96E97F008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */; }; + 52BFF67A1E9D0C2800DF88A1 /* c_org_ortc_MediaTrackSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D3E1E96E97F008204EA /* c_org_ortc_MediaTrackSettings.cpp */; }; + 52BFF67B1E9D0C2800DF88A1 /* c_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D401E96E97F008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */; }; + 52BFF67C1E9D0C2800DF88A1 /* c_org_ortc_MessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D421E96E97F008204EA /* c_org_ortc_MessageQueue.cpp */; }; + 52BFF67D1E9D0C2800DF88A1 /* c_org_ortc_OrtcLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D441E96E97F008204EA /* c_org_ortc_OrtcLib.cpp */; }; + 52BFF67E1E9D0C2800DF88A1 /* c_org_ortc_OverconstrainedError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D461E96E97F008204EA /* c_org_ortc_OverconstrainedError.cpp */; }; + 52BFF67F1E9D0C2800DF88A1 /* c_org_ortc_OverconstrainedErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D481E96E97F008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */; }; + 52BFF6801E9D0C2800DF88A1 /* c_org_ortc_RTCCertificate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D4A1E96E97F008204EA /* c_org_ortc_RTCCertificate.cpp */; }; + 52BFF6811E9D0C2800DF88A1 /* c_org_ortc_RTCCertificateStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D4C1E96E97F008204EA /* c_org_ortc_RTCCertificateStats.cpp */; }; + 52BFF6821E9D0C2800DF88A1 /* c_org_ortc_RTCCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D4E1E96E97F008204EA /* c_org_ortc_RTCCodec.cpp */; }; + 52BFF6831E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D501E96E97F008204EA /* c_org_ortc_RTCDataChannel.cpp */; }; + 52BFF6841E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D521E96E97F008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */; }; + 52BFF6851E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D541E96E97F008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */; }; + 52BFF6861E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D561E96E97F008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */; }; + 52BFF6871E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D581E96E97F008204EA /* c_org_ortc_RTCDataChannelStats.cpp */; }; + 52BFF6881E9D0C2800DF88A1 /* c_org_ortc_RTCDataTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D5A1E96E97F008204EA /* c_org_ortc_RTCDataTransport.cpp */; }; + 52BFF6891E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D5C1E96E97F008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */; }; + 52BFF68A1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsFingerprint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D5E1E96E97F008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */; }; + 52BFF68B1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D601E96E97F008204EA /* c_org_ortc_RTCDtlsParameters.cpp */; }; + 52BFF68C1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D621E96E97F008204EA /* c_org_ortc_RTCDtlsTransport.cpp */; }; + 52BFF68D1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D641E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */; }; + 52BFF68E1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D661E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */; }; + 52BFF68F1E9D0C2800DF88A1 /* c_org_ortc_RTCDtmfSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D681E96E97F008204EA /* c_org_ortc_RTCDtmfSender.cpp */; }; + 52BFF6901E9D0C2800DF88A1 /* c_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D6A1E96E97F008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */; }; + 52BFF6911E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D6C1E96E97F008204EA /* c_org_ortc_RTCIceCandidate.cpp */; }; + 52BFF6921E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidateAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D6E1E96E97F008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */; }; + 52BFF6931E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidateComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D701E96E97F008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */; }; + 52BFF6941E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidatePair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D721E96E97F008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */; }; + 52BFF6951E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D741E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */; }; + 52BFF6961E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidatePairStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D761E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */; }; + 52BFF6971E9D0C2800DF88A1 /* c_org_ortc_RTCIceGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D781E96E97F008204EA /* c_org_ortc_RTCIceGatherer.cpp */; }; + 52BFF6981E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D7A1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */; }; + 52BFF6991E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D7C1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */; }; + 52BFF69A1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D7E1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */; }; + 52BFF69B1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D801E96E97F008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */; }; + 52BFF69C1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D821E96E97F008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */; }; + 52BFF69D1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D841E96E97F008204EA /* c_org_ortc_RTCIceGathererStats.cpp */; }; + 52BFF69E1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D861E96E97F008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */; }; + 52BFF69F1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGatherOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D881E96E97F008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */; }; + 52BFF6A01E9D0C2800DF88A1 /* c_org_ortc_RTCIceParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D8A1E96E97F008204EA /* c_org_ortc_RTCIceParameters.cpp */; }; + 52BFF6A11E9D0C2800DF88A1 /* c_org_ortc_RTCIceServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D8C1E96E97F008204EA /* c_org_ortc_RTCIceServer.cpp */; }; + 52BFF6A21E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D8E1E96E97F008204EA /* c_org_ortc_RTCIceTransport.cpp */; }; + 52BFF6A31E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D901E96E97F008204EA /* c_org_ortc_RTCIceTransportController.cpp */; }; + 52BFF6A41E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D921E96E97F008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */; }; + 52BFF6A51E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D941E96E97F008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */; }; + 52BFF6A61E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D961E96E97F008204EA /* c_org_ortc_RTCIceTransportStats.cpp */; }; + 52BFF6A71E9D0C2800DF88A1 /* c_org_ortc_RTCIdentity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D981E96E97F008204EA /* c_org_ortc_RTCIdentity.cpp */; }; + 52BFF6A81E9D0C2800DF88A1 /* c_org_ortc_RTCIdentityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D9A1E96E97F008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */; }; + 52BFF6A91E9D0C2800DF88A1 /* c_org_ortc_RTCIdentityError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D9C1E96E97F008204EA /* c_org_ortc_RTCIdentityError.cpp */; }; + 52BFF6AA1E9D0C2800DF88A1 /* c_org_ortc_RTCIdentityResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216D9E1E96E97F008204EA /* c_org_ortc_RTCIdentityResult.cpp */; }; + 52BFF6AB1E9D0C2800DF88A1 /* c_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA01E96E97F008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */; }; + 52BFF6AC1E9D0C2800DF88A1 /* c_org_ortc_RTCMediaStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA21E96E97F008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */; }; + 52BFF6AD1E9D0C2800DF88A1 /* c_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA41E96E97F008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */; }; + 52BFF6AE1E9D0C2800DF88A1 /* c_org_ortc_RTCMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA61E96E97F008204EA /* c_org_ortc_RTCMessageEvent.cpp */; }; + 52BFF6AF1E9D0C2900DF88A1 /* c_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DA81E96E97F008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */; }; + 52BFF6B01E9D0C2900DF88A1 /* c_org_ortc_RTCRtcpFeedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DAA1E96E97F008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */; }; + 52BFF6B11E9D0C2900DF88A1 /* c_org_ortc_RTCRtcpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DAC1E96E97F008204EA /* c_org_ortc_RTCRtcpParameters.cpp */; }; + 52BFF6B21E9D0C2900DF88A1 /* c_org_ortc_RTCRtcpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DAE1E96E97F008204EA /* c_org_ortc_RTCRtcpTransport.cpp */; }; + 52BFF6B31E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB01E96E97F008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */; }; + 52BFF6B41E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecCapability.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB21E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */; }; + 52BFF6B51E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB41E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */; }; + 52BFF6B61E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB61E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */; }; + 52BFF6B71E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DB81E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */; }; + 52BFF6B81E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DBA1E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */; }; + 52BFF6B91E9D0C2900DF88A1 /* c_org_ortc_RTCRtpContributingSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DBC1E96E97F008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */; }; + 52BFF6BA1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpEncodingParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DBE1E96E97F008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */; }; + 52BFF6BB1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpFecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC01E96E97F008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */; }; + 52BFF6BC1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC21E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */; }; + 52BFF6BD1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC41E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */; }; + 52BFF6BE1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC61E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */; }; + 52BFF6BF1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DC81E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */; }; + 52BFF6C01E9D0C2900DF88A1 /* c_org_ortc_RTCRtpHeaderExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DCA1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */; }; + 52BFF6C11E9D0C2900DF88A1 /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DCC1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */; }; + 52BFF6C21E9D0C2900DF88A1 /* c_org_ortc_RTCRtpListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DCE1E96E97F008204EA /* c_org_ortc_RTCRtpListener.cpp */; }; + 52BFF6C31E9D0C2900DF88A1 /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD01E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */; }; + 52BFF6C41E9D0C2900DF88A1 /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD21E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */; }; + 52BFF6C51E9D0C2900DF88A1 /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD41E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */; }; + 52BFF6C61E9D0C2900DF88A1 /* c_org_ortc_RTCRtpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD61E96E97F008204EA /* c_org_ortc_RTCRtpParameters.cpp */; }; + 52BFF6C71E9D0C2900DF88A1 /* c_org_ortc_RTCRtpReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DD81E96E97F008204EA /* c_org_ortc_RTCRtpReceiver.cpp */; }; + 52BFF6C81E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DDA1E96E97F008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */; }; + 52BFF6C91E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DDC1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */; }; + 52BFF6CA1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DDE1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */; }; + 52BFF6CB1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRtxParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE01E96E97F008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */; }; + 52BFF6CC1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE21E96E97F008204EA /* c_org_ortc_RTCRtpSender.cpp */; }; + 52BFF6CD1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE41E96E97F008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */; }; + 52BFF6CE1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE61E96E97F008204EA /* c_org_ortc_RTCRtpTransport.cpp */; }; + 52BFF6CF1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DE81E96E97F008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */; }; + 52BFF6D01E9D0C2900DF88A1 /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DEA1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */; }; + 52BFF6D11E9D0C2900DF88A1 /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DEC1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */; }; + 52BFF6D21E9D0C2900DF88A1 /* c_org_ortc_RTCSctpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DEE1E96E97F008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */; }; + 52BFF6D31E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF01E96E97F008204EA /* c_org_ortc_RTCSctpTransport.cpp */; }; + 52BFF6D41E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF21E96E97F008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */; }; + 52BFF6D51E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF41E96E97F008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */; }; + 52BFF6D61E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF61E96E97F008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */; }; + 52BFF6D71E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DF81E96E97F008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */; }; + 52BFF6D81E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DFA1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */; }; + 52BFF6D91E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DFC1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */; }; + 52BFF6DA1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216DFE1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */; }; + 52BFF6DB1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E001E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */; }; + 52BFF6DC1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E021E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */; }; + 52BFF6DD1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E041E96E97F008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */; }; + 52BFF6DE1E9D0C2900DF88A1 /* c_org_ortc_RTCSsrcConflictEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E061E96E97F008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */; }; + 52BFF6DF1E9D0C2900DF88A1 /* c_org_ortc_RTCStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E081E96E97F008204EA /* c_org_ortc_RTCStats.cpp */; }; + 52BFF6E01E9D0C2900DF88A1 /* c_org_ortc_RTCStatsProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E0A1E96E97F008204EA /* c_org_ortc_RTCStatsProvider.cpp */; }; + 52BFF6E11E9D0C2900DF88A1 /* c_org_ortc_RTCStatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E0C1E96E97F008204EA /* c_org_ortc_RTCStatsReport.cpp */; }; + 52BFF6E21E9D0C2900DF88A1 /* c_org_ortc_RTCStatsTypeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E0E1E96E97F008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */; }; + 52BFF6E31E9D0C2900DF88A1 /* c_org_ortc_Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E101E96E97F008204EA /* c_org_ortc_Settings.cpp */; }; + 52BFF6E41E9D0C2900DF88A1 /* c_org_ortc_StringOrStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216E121E96E97F008204EA /* c_org_ortc_StringOrStringList.cpp */; }; + 52BFF6E51E9D0D6F00DF88A1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6291E9CFC5500DF88A1 /* AudioToolbox.framework */; }; + 52BFF6E61E9D0D6F00DF88A1 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62A1E9CFC5500DF88A1 /* AVFoundation.framework */; }; + 52BFF6E71E9D0D6F00DF88A1 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62B1E9CFC5500DF88A1 /* CoreMedia.framework */; }; + 52BFF6E81E9D0D6F00DF88A1 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62C1E9CFC5500DF88A1 /* CoreVideo.framework */; }; + 52BFF6E91E9D0D6F00DF88A1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62D1E9CFC5500DF88A1 /* Foundation.framework */; }; + 52BFF6EA1E9D0D6F00DF88A1 /* libresolv.9.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62E1E9CFC5500DF88A1 /* libresolv.9.tbd */; }; + 52BFF6EB1E9D0D6F00DF88A1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF62F1E9CFC5500DF88A1 /* libz.tbd */; }; + 52BFF6EC1E9D0D6F00DF88A1 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6301E9CFC5500DF88A1 /* Security.framework */; }; + 52BFF6ED1E9D0D6F00DF88A1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6311E9CFC5500DF88A1 /* UIKit.framework */; }; + 52BFF6EE1E9D0D6F00DF88A1 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6321E9CFC5500DF88A1 /* VideoToolbox.framework */; }; + 52BFF6F71E9D0D6F00DF88A1 /* libcryptopp-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6EF1E9D0D6F00DF88A1 /* libcryptopp-ios.a */; }; + 52BFF6F81E9D0D6F00DF88A1 /* libidnkit-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F01E9D0D6F00DF88A1 /* libidnkit-ios.a */; }; + 52BFF6F91E9D0D6F00DF88A1 /* libortclib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F11E9D0D6F00DF88A1 /* libortclib-ios.a */; }; + 52BFF6FA1E9D0D6F00DF88A1 /* libortclib-wrapper-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F21E9D0D6F00DF88A1 /* libortclib-wrapper-ios.a */; }; + 52BFF6FB1E9D0D6F00DF88A1 /* libortclib.services-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F31E9D0D6F00DF88A1 /* libortclib.services-ios.a */; }; + 52BFF6FC1E9D0D6F00DF88A1 /* libudns-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F41E9D0D6F00DF88A1 /* libudns-ios.a */; }; + 52BFF6FD1E9D0D6F00DF88A1 /* libzsLib-eventing-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F51E9D0D6F00DF88A1 /* libzsLib-eventing-ios.a */; }; + 52BFF6FE1E9D0D6F00DF88A1 /* libzsLib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF6F61E9D0D6F00DF88A1 /* libzsLib-ios.a */; }; + 52BFF6FF1E9D0D8300DF88A1 /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF63D1E9D053900DF88A1 /* libcurl.a */; }; + 52BFF7001E9D0D9400DF88A1 /* webrtc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BFF63F1E9D0A1800DF88A1 /* webrtc.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 529AA64F1E9F90B8007ACFD2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 529AA64B1E9F90B8007ACFD2 /* webrtcWrapper_ios.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 9451F25C1BC54F57008CB8D7; + remoteInfo = webrtcWrapper_ios; + }; + 529AA6511E9F90C0007ACFD2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 529AA64B1E9F90B8007ACFD2 /* webrtcWrapper_ios.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 9451F25B1BC54F57008CB8D7; + remoteInfo = webrtcWrapper_ios; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 00216CCD1E96E939008204EA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 00216CCF1E96E939008204EA /* libortclib-c-ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libortclib-c-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 00216CDC1E96E97F008204EA /* c_helpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_helpers.cpp; sourceTree = ""; }; + 00216CDD1E96E97F008204EA /* c_helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_helpers.h; sourceTree = ""; }; + 00216CDE1E96E97F008204EA /* c_org_ortc_adapter_MediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_MediaStream.cpp; sourceTree = ""; }; + 00216CDF1E96E97F008204EA /* c_org_ortc_adapter_MediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_MediaStream.h; sourceTree = ""; }; + 00216CE01E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCAnswerOptions.cpp; sourceTree = ""; }; + 00216CE11E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCAnswerOptions.h; sourceTree = ""; }; + 00216CE21E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCCapabilityOptions.cpp; sourceTree = ""; }; + 00216CE31E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCCapabilityOptions.h; sourceTree = ""; }; + 00216CE41E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCConfiguration.cpp; sourceTree = ""; }; + 00216CE51E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCConfiguration.h; sourceTree = ""; }; + 00216CE61E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCIceCandidate.cpp; sourceTree = ""; }; + 00216CE71E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCIceCandidate.h; sourceTree = ""; }; + 00216CE81E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp; sourceTree = ""; }; + 00216CE91E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h; sourceTree = ""; }; + 00216CEA1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCOfferAnswerOptions.cpp; sourceTree = ""; }; + 00216CEB1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCOfferAnswerOptions.h; sourceTree = ""; }; + 00216CEC1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCOfferOptions.cpp; sourceTree = ""; }; + 00216CED1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCOfferOptions.h; sourceTree = ""; }; + 00216CEE1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCPeerConnection.cpp; sourceTree = ""; }; + 00216CEF1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCPeerConnection.h; sourceTree = ""; }; + 00216CF01E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp; sourceTree = ""; }; + 00216CF11E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h; sourceTree = ""; }; + 00216CF21E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp; sourceTree = ""; }; + 00216CF31E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCPeerConnectionIceEvent.h; sourceTree = ""; }; + 00216CF41E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescription.cpp; sourceTree = ""; }; + 00216CF51E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescription.h; sourceTree = ""; }; + 00216CF61E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp; sourceTree = ""; }; + 00216CF71E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h; sourceTree = ""; }; + 00216CF81E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp; sourceTree = ""; }; + 00216CF91E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h; sourceTree = ""; }; + 00216CFA1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp; sourceTree = ""; }; + 00216CFB1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionDescription.h; sourceTree = ""; }; + 00216CFC1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp; sourceTree = ""; }; + 00216CFD1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h; sourceTree = ""; }; + 00216CFE1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp; sourceTree = ""; }; + 00216CFF1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h; sourceTree = ""; }; + 00216D001E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp; sourceTree = ""; }; + 00216D011E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h; sourceTree = ""; }; + 00216D021E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp; sourceTree = ""; }; + 00216D031E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h; sourceTree = ""; }; + 00216D041E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp; sourceTree = ""; }; + 00216D051E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h; sourceTree = ""; }; + 00216D061E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp; sourceTree = ""; }; + 00216D071E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h; sourceTree = ""; }; + 00216D081E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp; sourceTree = ""; }; + 00216D091E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h; sourceTree = ""; }; + 00216D0A1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp; sourceTree = ""; }; + 00216D0B1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionTransport.h; sourceTree = ""; }; + 00216D0C1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp; sourceTree = ""; }; + 00216D0D1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h; sourceTree = ""; }; + 00216D0E1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCTrackEvent.cpp; sourceTree = ""; }; + 00216D0F1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCTrackEvent.h; sourceTree = ""; }; + 00216D101E96E97F008204EA /* c_org_ortc_ConstrainBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainBoolean.cpp; sourceTree = ""; }; + 00216D111E96E97F008204EA /* c_org_ortc_ConstrainBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainBoolean.h; sourceTree = ""; }; + 00216D121E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainBooleanParameters.cpp; sourceTree = ""; }; + 00216D131E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainBooleanParameters.h; sourceTree = ""; }; + 00216D141E96E97F008204EA /* c_org_ortc_ConstrainDouble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainDouble.cpp; sourceTree = ""; }; + 00216D151E96E97F008204EA /* c_org_ortc_ConstrainDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainDouble.h; sourceTree = ""; }; + 00216D161E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainDoubleRange.cpp; sourceTree = ""; }; + 00216D171E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainDoubleRange.h; sourceTree = ""; }; + 00216D181E96E97F008204EA /* c_org_ortc_ConstrainLong.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainLong.cpp; sourceTree = ""; }; + 00216D191E96E97F008204EA /* c_org_ortc_ConstrainLong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainLong.h; sourceTree = ""; }; + 00216D1A1E96E97F008204EA /* c_org_ortc_ConstrainLongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainLongRange.cpp; sourceTree = ""; }; + 00216D1B1E96E97F008204EA /* c_org_ortc_ConstrainLongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainLongRange.h; sourceTree = ""; }; + 00216D1C1E96E97F008204EA /* c_org_ortc_ConstrainString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainString.cpp; sourceTree = ""; }; + 00216D1D1E96E97F008204EA /* c_org_ortc_ConstrainString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainString.h; sourceTree = ""; }; + 00216D1E1E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainStringParameters.cpp; sourceTree = ""; }; + 00216D1F1E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainStringParameters.h; sourceTree = ""; }; + 00216D201E96E97F008204EA /* c_org_ortc_DoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_DoubleRange.cpp; sourceTree = ""; }; + 00216D211E96E97F008204EA /* c_org_ortc_DoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_DoubleRange.h; sourceTree = ""; }; + 00216D221E96E97F008204EA /* c_org_ortc_Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Error.cpp; sourceTree = ""; }; + 00216D231E96E97F008204EA /* c_org_ortc_Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Error.h; sourceTree = ""; }; + 00216D241E96E97F008204EA /* c_org_ortc_ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ErrorEvent.cpp; sourceTree = ""; }; + 00216D251E96E97F008204EA /* c_org_ortc_ErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ErrorEvent.h; sourceTree = ""; }; + 00216D261E96E97F008204EA /* c_org_ortc_Json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Json.cpp; sourceTree = ""; }; + 00216D271E96E97F008204EA /* c_org_ortc_Json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Json.h; sourceTree = ""; }; + 00216D281E96E97F008204EA /* c_org_ortc_Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Logger.cpp; sourceTree = ""; }; + 00216D291E96E97F008204EA /* c_org_ortc_Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Logger.h; sourceTree = ""; }; + 00216D2A1E96E97F008204EA /* c_org_ortc_LongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_LongRange.cpp; sourceTree = ""; }; + 00216D2B1E96E97F008204EA /* c_org_ortc_LongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_LongRange.h; sourceTree = ""; }; + 00216D2C1E96E97F008204EA /* c_org_ortc_MediaControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaControl.cpp; sourceTree = ""; }; + 00216D2D1E96E97F008204EA /* c_org_ortc_MediaControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaControl.h; sourceTree = ""; }; + 00216D2E1E96E97F008204EA /* c_org_ortc_MediaDeviceInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaDeviceInfo.cpp; sourceTree = ""; }; + 00216D2F1E96E97F008204EA /* c_org_ortc_MediaDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaDeviceInfo.h; sourceTree = ""; }; + 00216D301E96E97F008204EA /* c_org_ortc_MediaDevices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaDevices.cpp; sourceTree = ""; }; + 00216D311E96E97F008204EA /* c_org_ortc_MediaDevices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaDevices.h; sourceTree = ""; }; + 00216D321E96E97F008204EA /* c_org_ortc_MediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaSource.cpp; sourceTree = ""; }; + 00216D331E96E97F008204EA /* c_org_ortc_MediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaSource.h; sourceTree = ""; }; + 00216D341E96E97F008204EA /* c_org_ortc_MediaStreamConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaStreamConstraints.cpp; sourceTree = ""; }; + 00216D351E96E97F008204EA /* c_org_ortc_MediaStreamConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaStreamConstraints.h; sourceTree = ""; }; + 00216D361E96E97F008204EA /* c_org_ortc_MediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaStreamTrack.cpp; sourceTree = ""; }; + 00216D371E96E97F008204EA /* c_org_ortc_MediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaStreamTrack.h; sourceTree = ""; }; + 00216D381E96E97F008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackCapabilities.cpp; sourceTree = ""; }; + 00216D391E96E97F008204EA /* c_org_ortc_MediaTrackCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackCapabilities.h; sourceTree = ""; }; + 00216D3A1E96E97F008204EA /* c_org_ortc_MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackConstraints.cpp; sourceTree = ""; }; + 00216D3B1E96E97F008204EA /* c_org_ortc_MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackConstraints.h; sourceTree = ""; }; + 00216D3C1E96E97F008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackConstraintSet.cpp; sourceTree = ""; }; + 00216D3D1E96E97F008204EA /* c_org_ortc_MediaTrackConstraintSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackConstraintSet.h; sourceTree = ""; }; + 00216D3E1E96E97F008204EA /* c_org_ortc_MediaTrackSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackSettings.cpp; sourceTree = ""; }; + 00216D3F1E96E97F008204EA /* c_org_ortc_MediaTrackSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackSettings.h; sourceTree = ""; }; + 00216D401E96E97F008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackSupportedConstraints.cpp; sourceTree = ""; }; + 00216D411E96E97F008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackSupportedConstraints.h; sourceTree = ""; }; + 00216D421E96E97F008204EA /* c_org_ortc_MessageQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MessageQueue.cpp; sourceTree = ""; }; + 00216D431E96E97F008204EA /* c_org_ortc_MessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MessageQueue.h; sourceTree = ""; }; + 00216D441E96E97F008204EA /* c_org_ortc_OrtcLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_OrtcLib.cpp; sourceTree = ""; }; + 00216D451E96E97F008204EA /* c_org_ortc_OrtcLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_OrtcLib.h; sourceTree = ""; }; + 00216D461E96E97F008204EA /* c_org_ortc_OverconstrainedError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_OverconstrainedError.cpp; sourceTree = ""; }; + 00216D471E96E97F008204EA /* c_org_ortc_OverconstrainedError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_OverconstrainedError.h; sourceTree = ""; }; + 00216D481E96E97F008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_OverconstrainedErrorEvent.cpp; sourceTree = ""; }; + 00216D491E96E97F008204EA /* c_org_ortc_OverconstrainedErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_OverconstrainedErrorEvent.h; sourceTree = ""; }; + 00216D4A1E96E97F008204EA /* c_org_ortc_RTCCertificate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCCertificate.cpp; sourceTree = ""; }; + 00216D4B1E96E97F008204EA /* c_org_ortc_RTCCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCCertificate.h; sourceTree = ""; }; + 00216D4C1E96E97F008204EA /* c_org_ortc_RTCCertificateStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCCertificateStats.cpp; sourceTree = ""; }; + 00216D4D1E96E97F008204EA /* c_org_ortc_RTCCertificateStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCCertificateStats.h; sourceTree = ""; }; + 00216D4E1E96E97F008204EA /* c_org_ortc_RTCCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCCodec.cpp; sourceTree = ""; }; + 00216D4F1E96E97F008204EA /* c_org_ortc_RTCCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCCodec.h; sourceTree = ""; }; + 00216D501E96E97F008204EA /* c_org_ortc_RTCDataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannel.cpp; sourceTree = ""; }; + 00216D511E96E97F008204EA /* c_org_ortc_RTCDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannel.h; sourceTree = ""; }; + 00216D521E96E97F008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelEvent.cpp; sourceTree = ""; }; + 00216D531E96E97F008204EA /* c_org_ortc_RTCDataChannelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelEvent.h; sourceTree = ""; }; + 00216D541E96E97F008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelParameters.cpp; sourceTree = ""; }; + 00216D551E96E97F008204EA /* c_org_ortc_RTCDataChannelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelParameters.h; sourceTree = ""; }; + 00216D561E96E97F008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelStateChangeEvent.cpp; sourceTree = ""; }; + 00216D571E96E97F008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelStateChangeEvent.h; sourceTree = ""; }; + 00216D581E96E97F008204EA /* c_org_ortc_RTCDataChannelStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelStats.cpp; sourceTree = ""; }; + 00216D591E96E97F008204EA /* c_org_ortc_RTCDataChannelStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelStats.h; sourceTree = ""; }; + 00216D5A1E96E97F008204EA /* c_org_ortc_RTCDataTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataTransport.cpp; sourceTree = ""; }; + 00216D5B1E96E97F008204EA /* c_org_ortc_RTCDataTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataTransport.h; sourceTree = ""; }; + 00216D5C1E96E97F008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsCertificateBinary.cpp; sourceTree = ""; }; + 00216D5D1E96E97F008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsCertificateBinary.h; sourceTree = ""; }; + 00216D5E1E96E97F008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsFingerprint.cpp; sourceTree = ""; }; + 00216D5F1E96E97F008204EA /* c_org_ortc_RTCDtlsFingerprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsFingerprint.h; sourceTree = ""; }; + 00216D601E96E97F008204EA /* c_org_ortc_RTCDtlsParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsParameters.cpp; sourceTree = ""; }; + 00216D611E96E97F008204EA /* c_org_ortc_RTCDtlsParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsParameters.h; sourceTree = ""; }; + 00216D621E96E97F008204EA /* c_org_ortc_RTCDtlsTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsTransport.cpp; sourceTree = ""; }; + 00216D631E96E97F008204EA /* c_org_ortc_RTCDtlsTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsTransport.h; sourceTree = ""; }; + 00216D641E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00216D651E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsTransportStateChangeEvent.h; sourceTree = ""; }; + 00216D661E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsTransportStats.cpp; sourceTree = ""; }; + 00216D671E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsTransportStats.h; sourceTree = ""; }; + 00216D681E96E97F008204EA /* c_org_ortc_RTCDtmfSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtmfSender.cpp; sourceTree = ""; }; + 00216D691E96E97F008204EA /* c_org_ortc_RTCDtmfSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtmfSender.h; sourceTree = ""; }; + 00216D6A1E96E97F008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtmfToneChangeEvent.cpp; sourceTree = ""; }; + 00216D6B1E96E97F008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtmfToneChangeEvent.h; sourceTree = ""; }; + 00216D6C1E96E97F008204EA /* c_org_ortc_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidate.cpp; sourceTree = ""; }; + 00216D6D1E96E97F008204EA /* c_org_ortc_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidate.h; sourceTree = ""; }; + 00216D6E1E96E97F008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidateAttributes.cpp; sourceTree = ""; }; + 00216D6F1E96E97F008204EA /* c_org_ortc_RTCIceCandidateAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidateAttributes.h; sourceTree = ""; }; + 00216D701E96E97F008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidateComplete.cpp; sourceTree = ""; }; + 00216D711E96E97F008204EA /* c_org_ortc_RTCIceCandidateComplete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidateComplete.h; sourceTree = ""; }; + 00216D721E96E97F008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidatePair.cpp; sourceTree = ""; }; + 00216D731E96E97F008204EA /* c_org_ortc_RTCIceCandidatePair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidatePair.h; sourceTree = ""; }; + 00216D741E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidatePairChangeEvent.cpp; sourceTree = ""; }; + 00216D751E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidatePairChangeEvent.h; sourceTree = ""; }; + 00216D761E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidatePairStats.cpp; sourceTree = ""; }; + 00216D771E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidatePairStats.h; sourceTree = ""; }; + 00216D781E96E97F008204EA /* c_org_ortc_RTCIceGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGatherer.cpp; sourceTree = ""; }; + 00216D791E96E97F008204EA /* c_org_ortc_RTCIceGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGatherer.h; sourceTree = ""; }; + 00216D7A1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererCandidate.cpp; sourceTree = ""; }; + 00216D7B1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererCandidate.h; sourceTree = ""; }; + 00216D7C1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp; sourceTree = ""; }; + 00216D7D1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererCandidateCompleteEvent.h; sourceTree = ""; }; + 00216D7E1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererCandidateEvent.cpp; sourceTree = ""; }; + 00216D7F1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererCandidateEvent.h; sourceTree = ""; }; + 00216D801E96E97F008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererIceErrorEvent.cpp; sourceTree = ""; }; + 00216D811E96E97F008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererIceErrorEvent.h; sourceTree = ""; }; + 00216D821E96E97F008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererStateChangeEvent.cpp; sourceTree = ""; }; + 00216D831E96E97F008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererStateChangeEvent.h; sourceTree = ""; }; + 00216D841E96E97F008204EA /* c_org_ortc_RTCIceGathererStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererStats.cpp; sourceTree = ""; }; + 00216D851E96E97F008204EA /* c_org_ortc_RTCIceGathererStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererStats.h; sourceTree = ""; }; + 00216D861E96E97F008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGatherInterfacePolicy.cpp; sourceTree = ""; }; + 00216D871E96E97F008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGatherInterfacePolicy.h; sourceTree = ""; }; + 00216D881E96E97F008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGatherOptions.cpp; sourceTree = ""; }; + 00216D891E96E97F008204EA /* c_org_ortc_RTCIceGatherOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGatherOptions.h; sourceTree = ""; }; + 00216D8A1E96E97F008204EA /* c_org_ortc_RTCIceParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceParameters.cpp; sourceTree = ""; }; + 00216D8B1E96E97F008204EA /* c_org_ortc_RTCIceParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceParameters.h; sourceTree = ""; }; + 00216D8C1E96E97F008204EA /* c_org_ortc_RTCIceServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceServer.cpp; sourceTree = ""; }; + 00216D8D1E96E97F008204EA /* c_org_ortc_RTCIceServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceServer.h; sourceTree = ""; }; + 00216D8E1E96E97F008204EA /* c_org_ortc_RTCIceTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransport.cpp; sourceTree = ""; }; + 00216D8F1E96E97F008204EA /* c_org_ortc_RTCIceTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransport.h; sourceTree = ""; }; + 00216D901E96E97F008204EA /* c_org_ortc_RTCIceTransportController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportController.cpp; sourceTree = ""; }; + 00216D911E96E97F008204EA /* c_org_ortc_RTCIceTransportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportController.h; sourceTree = ""; }; + 00216D921E96E97F008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportOptions.cpp; sourceTree = ""; }; + 00216D931E96E97F008204EA /* c_org_ortc_RTCIceTransportOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportOptions.h; sourceTree = ""; }; + 00216D941E96E97F008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00216D951E96E97F008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportStateChangeEvent.h; sourceTree = ""; }; + 00216D961E96E97F008204EA /* c_org_ortc_RTCIceTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportStats.cpp; sourceTree = ""; }; + 00216D971E96E97F008204EA /* c_org_ortc_RTCIceTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportStats.h; sourceTree = ""; }; + 00216D981E96E97F008204EA /* c_org_ortc_RTCIdentity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentity.cpp; sourceTree = ""; }; + 00216D991E96E97F008204EA /* c_org_ortc_RTCIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentity.h; sourceTree = ""; }; + 00216D9A1E96E97F008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentityAssertion.cpp; sourceTree = ""; }; + 00216D9B1E96E97F008204EA /* c_org_ortc_RTCIdentityAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentityAssertion.h; sourceTree = ""; }; + 00216D9C1E96E97F008204EA /* c_org_ortc_RTCIdentityError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentityError.cpp; sourceTree = ""; }; + 00216D9D1E96E97F008204EA /* c_org_ortc_RTCIdentityError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentityError.h; sourceTree = ""; }; + 00216D9E1E96E97F008204EA /* c_org_ortc_RTCIdentityResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentityResult.cpp; sourceTree = ""; }; + 00216D9F1E96E97F008204EA /* c_org_ortc_RTCIdentityResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentityResult.h; sourceTree = ""; }; + 00216DA01E96E97F008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCInboundRtpStreamStats.cpp; sourceTree = ""; }; + 00216DA11E96E97F008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCInboundRtpStreamStats.h; sourceTree = ""; }; + 00216DA21E96E97F008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCMediaStreamStats.cpp; sourceTree = ""; }; + 00216DA31E96E97F008204EA /* c_org_ortc_RTCMediaStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCMediaStreamStats.h; sourceTree = ""; }; + 00216DA41E96E97F008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCMediaStreamTrackStats.cpp; sourceTree = ""; }; + 00216DA51E96E97F008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCMediaStreamTrackStats.h; sourceTree = ""; }; + 00216DA61E96E97F008204EA /* c_org_ortc_RTCMessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCMessageEvent.cpp; sourceTree = ""; }; + 00216DA71E96E97F008204EA /* c_org_ortc_RTCMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCMessageEvent.h; sourceTree = ""; }; + 00216DA81E96E97F008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCOutboundRtpStreamStats.cpp; sourceTree = ""; }; + 00216DA91E96E97F008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCOutboundRtpStreamStats.h; sourceTree = ""; }; + 00216DAA1E96E97F008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtcpFeedback.cpp; sourceTree = ""; }; + 00216DAB1E96E97F008204EA /* c_org_ortc_RTCRtcpFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtcpFeedback.h; sourceTree = ""; }; + 00216DAC1E96E97F008204EA /* c_org_ortc_RTCRtcpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtcpParameters.cpp; sourceTree = ""; }; + 00216DAD1E96E97F008204EA /* c_org_ortc_RTCRtcpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtcpParameters.h; sourceTree = ""; }; + 00216DAE1E96E97F008204EA /* c_org_ortc_RTCRtcpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtcpTransport.cpp; sourceTree = ""; }; + 00216DAF1E96E97F008204EA /* c_org_ortc_RTCRtcpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtcpTransport.h; sourceTree = ""; }; + 00216DB01E96E97F008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCapabilities.cpp; sourceTree = ""; }; + 00216DB11E96E97F008204EA /* c_org_ortc_RTCRtpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCapabilities.h; sourceTree = ""; }; + 00216DB21E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecCapability.cpp; sourceTree = ""; }; + 00216DB31E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecCapability.h; sourceTree = ""; }; + 00216DB41E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecCapabilityOptions.cpp; sourceTree = ""; }; + 00216DB51E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecCapabilityOptions.h; sourceTree = ""; }; + 00216DB61E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216DB71E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecCapabilityParameters.h; sourceTree = ""; }; + 00216DB81E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecParameters.cpp; sourceTree = ""; }; + 00216DB91E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecParameters.h; sourceTree = ""; }; + 00216DBA1E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecParameterSettings.cpp; sourceTree = ""; }; + 00216DBB1E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecParameterSettings.h; sourceTree = ""; }; + 00216DBC1E96E97F008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpContributingSource.cpp; sourceTree = ""; }; + 00216DBD1E96E97F008204EA /* c_org_ortc_RTCRtpContributingSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpContributingSource.h; sourceTree = ""; }; + 00216DBE1E96E97F008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpEncodingParameters.cpp; sourceTree = ""; }; + 00216DBF1E96E97F008204EA /* c_org_ortc_RTCRtpEncodingParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpEncodingParameters.h; sourceTree = ""; }; + 00216DC01E96E97F008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpFecParameters.cpp; sourceTree = ""; }; + 00216DC11E96E97F008204EA /* c_org_ortc_RTCRtpFecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpFecParameters.h; sourceTree = ""; }; + 00216DC21E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216DC31E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h; sourceTree = ""; }; + 00216DC41E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp; sourceTree = ""; }; + 00216DC51E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h; sourceTree = ""; }; + 00216DC61E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216DC71E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpH264CodecCapabilityParameters.h; sourceTree = ""; }; + 00216DC81E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpH264CodecParameterSettings.cpp; sourceTree = ""; }; + 00216DC91E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpH264CodecParameterSettings.h; sourceTree = ""; }; + 00216DCA1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpHeaderExtension.cpp; sourceTree = ""; }; + 00216DCB1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpHeaderExtension.h; sourceTree = ""; }; + 00216DCC1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpHeaderExtensionParameters.cpp; sourceTree = ""; }; + 00216DCD1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpHeaderExtensionParameters.h; sourceTree = ""; }; + 00216DCE1E96E97F008204EA /* c_org_ortc_RTCRtpListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpListener.cpp; sourceTree = ""; }; + 00216DCF1E96E97F008204EA /* c_org_ortc_RTCRtpListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpListener.h; sourceTree = ""; }; + 00216DD01E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp; sourceTree = ""; }; + 00216DD11E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h; sourceTree = ""; }; + 00216DD21E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216DD31E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h; sourceTree = ""; }; + 00216DD41E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp; sourceTree = ""; }; + 00216DD51E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpOpusCodecParameterSettings.h; sourceTree = ""; }; + 00216DD61E96E97F008204EA /* c_org_ortc_RTCRtpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpParameters.cpp; sourceTree = ""; }; + 00216DD71E96E97F008204EA /* c_org_ortc_RTCRtpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpParameters.h; sourceTree = ""; }; + 00216DD81E96E97F008204EA /* c_org_ortc_RTCRtpReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpReceiver.cpp; sourceTree = ""; }; + 00216DD91E96E97F008204EA /* c_org_ortc_RTCRtpReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpReceiver.h; sourceTree = ""; }; + 00216DDA1E96E97F008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRedCodecParameterSettings.cpp; sourceTree = ""; }; + 00216DDB1E96E97F008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRedCodecParameterSettings.h; sourceTree = ""; }; + 00216DDC1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216DDD1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h; sourceTree = ""; }; + 00216DDE1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp; sourceTree = ""; }; + 00216DDF1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRtxCodecParameterSettings.h; sourceTree = ""; }; + 00216DE01E96E97F008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRtxParameters.cpp; sourceTree = ""; }; + 00216DE11E96E97F008204EA /* c_org_ortc_RTCRtpRtxParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRtxParameters.h; sourceTree = ""; }; + 00216DE21E96E97F008204EA /* c_org_ortc_RTCRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpSender.cpp; sourceTree = ""; }; + 00216DE31E96E97F008204EA /* c_org_ortc_RTCRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpSender.h; sourceTree = ""; }; + 00216DE41E96E97F008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpStreamStats.cpp; sourceTree = ""; }; + 00216DE51E96E97F008204EA /* c_org_ortc_RTCRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpStreamStats.h; sourceTree = ""; }; + 00216DE61E96E97F008204EA /* c_org_ortc_RTCRtpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpTransport.cpp; sourceTree = ""; }; + 00216DE71E96E97F008204EA /* c_org_ortc_RTCRtpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpTransport.h; sourceTree = ""; }; + 00216DE81E96E97F008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpUnhandledEvent.cpp; sourceTree = ""; }; + 00216DE91E96E97F008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpUnhandledEvent.h; sourceTree = ""; }; + 00216DEA1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216DEB1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h; sourceTree = ""; }; + 00216DEC1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp; sourceTree = ""; }; + 00216DED1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpVp8CodecParameterSettings.h; sourceTree = ""; }; + 00216DEE1E96E97F008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpCapabilities.cpp; sourceTree = ""; }; + 00216DEF1E96E97F008204EA /* c_org_ortc_RTCSctpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpCapabilities.h; sourceTree = ""; }; + 00216DF01E96E97F008204EA /* c_org_ortc_RTCSctpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransport.cpp; sourceTree = ""; }; + 00216DF11E96E97F008204EA /* c_org_ortc_RTCSctpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransport.h; sourceTree = ""; }; + 00216DF21E96E97F008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportListener.cpp; sourceTree = ""; }; + 00216DF31E96E97F008204EA /* c_org_ortc_RTCSctpTransportListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportListener.h; sourceTree = ""; }; + 00216DF41E96E97F008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportListenerEvent.cpp; sourceTree = ""; }; + 00216DF51E96E97F008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportListenerEvent.h; sourceTree = ""; }; + 00216DF61E96E97F008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00216DF71E96E97F008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportStateChangeEvent.h; sourceTree = ""; }; + 00216DF81E96E97F008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportStats.cpp; sourceTree = ""; }; + 00216DF91E96E97F008204EA /* c_org_ortc_RTCSctpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportStats.h; sourceTree = ""; }; + 00216DFA1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesCryptoParameters.cpp; sourceTree = ""; }; + 00216DFB1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesCryptoParameters.h; sourceTree = ""; }; + 00216DFC1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesKeyParameters.cpp; sourceTree = ""; }; + 00216DFD1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesKeyParameters.h; sourceTree = ""; }; + 00216DFE1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesParameters.cpp; sourceTree = ""; }; + 00216DFF1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesParameters.h; sourceTree = ""; }; + 00216E001E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesTransport.cpp; sourceTree = ""; }; + 00216E011E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesTransport.h; sourceTree = ""; }; + 00216E021E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp; sourceTree = ""; }; + 00216E031E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h; sourceTree = ""; }; + 00216E041E96E97F008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpTransportStats.cpp; sourceTree = ""; }; + 00216E051E96E97F008204EA /* c_org_ortc_RTCSrtpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpTransportStats.h; sourceTree = ""; }; + 00216E061E96E97F008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSsrcConflictEvent.cpp; sourceTree = ""; }; + 00216E071E96E97F008204EA /* c_org_ortc_RTCSsrcConflictEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSsrcConflictEvent.h; sourceTree = ""; }; + 00216E081E96E97F008204EA /* c_org_ortc_RTCStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStats.cpp; sourceTree = ""; }; + 00216E091E96E97F008204EA /* c_org_ortc_RTCStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStats.h; sourceTree = ""; }; + 00216E0A1E96E97F008204EA /* c_org_ortc_RTCStatsProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStatsProvider.cpp; sourceTree = ""; }; + 00216E0B1E96E97F008204EA /* c_org_ortc_RTCStatsProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStatsProvider.h; sourceTree = ""; }; + 00216E0C1E96E97F008204EA /* c_org_ortc_RTCStatsReport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStatsReport.cpp; sourceTree = ""; }; + 00216E0D1E96E97F008204EA /* c_org_ortc_RTCStatsReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStatsReport.h; sourceTree = ""; }; + 00216E0E1E96E97F008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStatsTypeSet.cpp; sourceTree = ""; }; + 00216E0F1E96E97F008204EA /* c_org_ortc_RTCStatsTypeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStatsTypeSet.h; sourceTree = ""; }; + 00216E101E96E97F008204EA /* c_org_ortc_Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Settings.cpp; sourceTree = ""; }; + 00216E111E96E97F008204EA /* c_org_ortc_Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Settings.h; sourceTree = ""; }; + 00216E121E96E97F008204EA /* c_org_ortc_StringOrStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_StringOrStringList.cpp; sourceTree = ""; }; + 00216E131E96E97F008204EA /* c_org_ortc_StringOrStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_StringOrStringList.h; sourceTree = ""; }; + 00216E141E96E97F008204EA /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; + 529AA64B1E9F90B8007ACFD2 /* webrtcWrapper_ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = webrtcWrapper_ios.xcodeproj; path = "/Users/sergejjovanovic/Work/Projects/opticaltone/dylib_test/ortclib-sdk/ortc/apple/workspaces/xcode/../../projects/xcode/webrtcWrappers/webrtcWrapper_ios/webrtcWrapper_ios.xcodeproj"; sourceTree = ""; }; + 52BFF6191E9CFBEE00DF88A1 /* libcryptopp-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libcryptopp-ios.a"; path = "../../../../cryptopp/projects/xcode/cryptopp-ios/build/Debug-iphoneos/libcryptopp-ios.a"; sourceTree = ""; }; + 52BFF61A1E9CFBEE00DF88A1 /* libidnkit-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libidnkit-ios.a"; path = "../../../../idnkit/projects/xcode/idnkit-ios/build/Debug-iphoneos/libidnkit-ios.a"; sourceTree = ""; }; + 52BFF61B1E9CFBEE00DF88A1 /* libortclib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib-ios.a"; path = "../ortclib-ios/build/Debug-iphoneos/libortclib-ios.a"; sourceTree = ""; }; + 52BFF61C1E9CFBEE00DF88A1 /* libortclib-wrapper-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib-wrapper-ios.a"; path = "../ortclib-wrapper-ios/build/Debug-iphoneos/libortclib-wrapper-ios.a"; sourceTree = ""; }; + 52BFF61D1E9CFBEE00DF88A1 /* libortclib.services-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib.services-ios.a"; path = "../../../../ortclib-services-cpp/projects/xcode/ortclib.services-ios/build/Debug-iphoneos/libortclib.services-ios.a"; sourceTree = ""; }; + 52BFF61E1E9CFBEE00DF88A1 /* libudns-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libudns-ios.a"; path = "../../../../udns/projects/xcode/udns-ios/build/Debug-iphoneos/libudns-ios.a"; sourceTree = ""; }; + 52BFF61F1E9CFBEE00DF88A1 /* libzsLib-eventing-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-eventing-ios.a"; path = "../../../../zsLib-eventing/projects/xcode/zsLib-eventing-ios/build/Debug-iphoneos/libzsLib-eventing-ios.a"; sourceTree = ""; }; + 52BFF6201E9CFBEE00DF88A1 /* libzsLib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-ios.a"; path = "../../../../zsLib/projects/xcode/zsLib-ios/build/Debug-iphoneos/libzsLib-ios.a"; sourceTree = ""; }; + 52BFF6291E9CFC5500DF88A1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 52BFF62A1E9CFC5500DF88A1 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 52BFF62B1E9CFC5500DF88A1 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 52BFF62C1E9CFC5500DF88A1 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + 52BFF62D1E9CFC5500DF88A1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 52BFF62E1E9CFC5500DF88A1 /* libresolv.9.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.9.tbd; path = usr/lib/libresolv.9.tbd; sourceTree = SDKROOT; }; + 52BFF62F1E9CFC5500DF88A1 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 52BFF6301E9CFC5500DF88A1 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 52BFF6311E9CFC5500DF88A1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 52BFF6321E9CFC5500DF88A1 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; + 52BFF63D1E9D053900DF88A1 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = "../../../../curl/curl/ios-appstore/lib/libcurl.a"; sourceTree = ""; }; + 52BFF63F1E9D0A1800DF88A1 /* webrtc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = webrtc.a; path = ../../../../../../webrtc/xplatform/webrtc/out_ios/webrtc.a; sourceTree = ""; }; + 52BFF6451E9D0B9200DF88A1 /* libOrtc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libOrtc.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 52BFF6EF1E9D0D6F00DF88A1 /* libcryptopp-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libcryptopp-ios.a"; path = "../../../../cryptopp/projects/xcode/cryptopp-ios/build/Debug-iphoneos/libcryptopp-ios.a"; sourceTree = ""; }; + 52BFF6F01E9D0D6F00DF88A1 /* libidnkit-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libidnkit-ios.a"; path = "../../../../idnkit/projects/xcode/idnkit-ios/build/Debug-iphoneos/libidnkit-ios.a"; sourceTree = ""; }; + 52BFF6F11E9D0D6F00DF88A1 /* libortclib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib-ios.a"; path = "../ortclib-ios/build/Debug-iphoneos/libortclib-ios.a"; sourceTree = ""; }; + 52BFF6F21E9D0D6F00DF88A1 /* libortclib-wrapper-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib-wrapper-ios.a"; path = "../ortclib-wrapper-ios/build/Debug-iphoneos/libortclib-wrapper-ios.a"; sourceTree = ""; }; + 52BFF6F31E9D0D6F00DF88A1 /* libortclib.services-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib.services-ios.a"; path = "../../../../ortclib-services-cpp/projects/xcode/ortclib.services-ios/build/Debug-iphoneos/libortclib.services-ios.a"; sourceTree = ""; }; + 52BFF6F41E9D0D6F00DF88A1 /* libudns-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libudns-ios.a"; path = "../../../../udns/projects/xcode/udns-ios/build/Debug-iphoneos/libudns-ios.a"; sourceTree = ""; }; + 52BFF6F51E9D0D6F00DF88A1 /* libzsLib-eventing-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-eventing-ios.a"; path = "../../../../zsLib-eventing/projects/xcode/zsLib-eventing-ios/build/Debug-iphoneos/libzsLib-eventing-ios.a"; sourceTree = ""; }; + 52BFF6F61E9D0D6F00DF88A1 /* libzsLib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-ios.a"; path = "../../../../zsLib/projects/xcode/zsLib-ios/build/Debug-iphoneos/libzsLib-ios.a"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 00216CCC1E96E939008204EA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 52BFF6401E9D0A1800DF88A1 /* webrtc.a in Frameworks */, + 52BFF63E1E9D053900DF88A1 /* libcurl.a in Frameworks */, + 52BFF6331E9CFC5500DF88A1 /* AudioToolbox.framework in Frameworks */, + 52BFF6341E9CFC5500DF88A1 /* AVFoundation.framework in Frameworks */, + 52BFF6351E9CFC5500DF88A1 /* CoreMedia.framework in Frameworks */, + 52BFF6361E9CFC5500DF88A1 /* CoreVideo.framework in Frameworks */, + 52BFF6371E9CFC5500DF88A1 /* Foundation.framework in Frameworks */, + 52BFF6381E9CFC5500DF88A1 /* libresolv.9.tbd in Frameworks */, + 52BFF6391E9CFC5500DF88A1 /* libz.tbd in Frameworks */, + 52BFF63A1E9CFC5500DF88A1 /* Security.framework in Frameworks */, + 52BFF63B1E9CFC5500DF88A1 /* UIKit.framework in Frameworks */, + 52BFF63C1E9CFC5500DF88A1 /* VideoToolbox.framework in Frameworks */, + 52BFF6211E9CFBEE00DF88A1 /* libcryptopp-ios.a in Frameworks */, + 52BFF6221E9CFBEE00DF88A1 /* libidnkit-ios.a in Frameworks */, + 52BFF6231E9CFBEE00DF88A1 /* libortclib-ios.a in Frameworks */, + 52BFF6241E9CFBEE00DF88A1 /* libortclib-wrapper-ios.a in Frameworks */, + 52BFF6251E9CFBEE00DF88A1 /* libortclib.services-ios.a in Frameworks */, + 52BFF6261E9CFBEE00DF88A1 /* libudns-ios.a in Frameworks */, + 52BFF6271E9CFBEE00DF88A1 /* libzsLib-eventing-ios.a in Frameworks */, + 52BFF6281E9CFBEE00DF88A1 /* libzsLib-ios.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 52BFF6421E9D0B9200DF88A1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 52BFF7001E9D0D9400DF88A1 /* webrtc.a in Frameworks */, + 52BFF6FF1E9D0D8300DF88A1 /* libcurl.a in Frameworks */, + 52BFF6F71E9D0D6F00DF88A1 /* libcryptopp-ios.a in Frameworks */, + 52BFF6F81E9D0D6F00DF88A1 /* libidnkit-ios.a in Frameworks */, + 52BFF6F91E9D0D6F00DF88A1 /* libortclib-ios.a in Frameworks */, + 52BFF6FA1E9D0D6F00DF88A1 /* libortclib-wrapper-ios.a in Frameworks */, + 52BFF6FB1E9D0D6F00DF88A1 /* libortclib.services-ios.a in Frameworks */, + 52BFF6FC1E9D0D6F00DF88A1 /* libudns-ios.a in Frameworks */, + 52BFF6FD1E9D0D6F00DF88A1 /* libzsLib-eventing-ios.a in Frameworks */, + 52BFF6FE1E9D0D6F00DF88A1 /* libzsLib-ios.a in Frameworks */, + 52BFF6E51E9D0D6F00DF88A1 /* AudioToolbox.framework in Frameworks */, + 52BFF6E61E9D0D6F00DF88A1 /* AVFoundation.framework in Frameworks */, + 52BFF6E71E9D0D6F00DF88A1 /* CoreMedia.framework in Frameworks */, + 52BFF6E81E9D0D6F00DF88A1 /* CoreVideo.framework in Frameworks */, + 52BFF6E91E9D0D6F00DF88A1 /* Foundation.framework in Frameworks */, + 52BFF6EA1E9D0D6F00DF88A1 /* libresolv.9.tbd in Frameworks */, + 52BFF6EB1E9D0D6F00DF88A1 /* libz.tbd in Frameworks */, + 52BFF6EC1E9D0D6F00DF88A1 /* Security.framework in Frameworks */, + 52BFF6ED1E9D0D6F00DF88A1 /* UIKit.framework in Frameworks */, + 52BFF6EE1E9D0D6F00DF88A1 /* VideoToolbox.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00216CC61E96E939008204EA = { + isa = PBXGroup; + children = ( + 529AA64B1E9F90B8007ACFD2 /* webrtcWrapper_ios.xcodeproj */, + 00216CDB1E96E97F008204EA /* c */, + 00216CD01E96E939008204EA /* Products */, + 52BFF6181E9CFBEC00DF88A1 /* Frameworks */, + ); + sourceTree = ""; + }; + 00216CD01E96E939008204EA /* Products */ = { + isa = PBXGroup; + children = ( + 00216CCF1E96E939008204EA /* libortclib-c-ios.a */, + 52BFF6451E9D0B9200DF88A1 /* libOrtc.dylib */, + ); + name = Products; + sourceTree = ""; + }; + 00216CDB1E96E97F008204EA /* c */ = { + isa = PBXGroup; + children = ( + 00216CDC1E96E97F008204EA /* c_helpers.cpp */, + 00216CDD1E96E97F008204EA /* c_helpers.h */, + 00216CDE1E96E97F008204EA /* c_org_ortc_adapter_MediaStream.cpp */, + 00216CDF1E96E97F008204EA /* c_org_ortc_adapter_MediaStream.h */, + 00216CE01E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */, + 00216CE11E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h */, + 00216CE21E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */, + 00216CE31E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h */, + 00216CE41E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */, + 00216CE51E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.h */, + 00216CE61E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */, + 00216CE71E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.h */, + 00216CE81E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */, + 00216CE91E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */, + 00216CEA1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */, + 00216CEB1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h */, + 00216CEC1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */, + 00216CED1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.h */, + 00216CEE1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */, + 00216CEF1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.h */, + 00216CF01E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */, + 00216CF11E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */, + 00216CF21E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */, + 00216CF31E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h */, + 00216CF41E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */, + 00216CF51E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.h */, + 00216CF61E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */, + 00216CF71E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */, + 00216CF81E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */, + 00216CF91E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */, + 00216CFA1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */, + 00216CFB1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h */, + 00216CFC1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */, + 00216CFD1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */, + 00216CFE1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */, + 00216CFF1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */, + 00216D001E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */, + 00216D011E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */, + 00216D021E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */, + 00216D031E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */, + 00216D041E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */, + 00216D051E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */, + 00216D061E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */, + 00216D071E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */, + 00216D081E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */, + 00216D091E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */, + 00216D0A1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */, + 00216D0B1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h */, + 00216D0C1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */, + 00216D0D1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */, + 00216D0E1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */, + 00216D0F1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.h */, + 00216D101E96E97F008204EA /* c_org_ortc_ConstrainBoolean.cpp */, + 00216D111E96E97F008204EA /* c_org_ortc_ConstrainBoolean.h */, + 00216D121E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */, + 00216D131E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.h */, + 00216D141E96E97F008204EA /* c_org_ortc_ConstrainDouble.cpp */, + 00216D151E96E97F008204EA /* c_org_ortc_ConstrainDouble.h */, + 00216D161E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */, + 00216D171E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.h */, + 00216D181E96E97F008204EA /* c_org_ortc_ConstrainLong.cpp */, + 00216D191E96E97F008204EA /* c_org_ortc_ConstrainLong.h */, + 00216D1A1E96E97F008204EA /* c_org_ortc_ConstrainLongRange.cpp */, + 00216D1B1E96E97F008204EA /* c_org_ortc_ConstrainLongRange.h */, + 00216D1C1E96E97F008204EA /* c_org_ortc_ConstrainString.cpp */, + 00216D1D1E96E97F008204EA /* c_org_ortc_ConstrainString.h */, + 00216D1E1E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.cpp */, + 00216D1F1E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.h */, + 00216D201E96E97F008204EA /* c_org_ortc_DoubleRange.cpp */, + 00216D211E96E97F008204EA /* c_org_ortc_DoubleRange.h */, + 00216D221E96E97F008204EA /* c_org_ortc_Error.cpp */, + 00216D231E96E97F008204EA /* c_org_ortc_Error.h */, + 00216D241E96E97F008204EA /* c_org_ortc_ErrorEvent.cpp */, + 00216D251E96E97F008204EA /* c_org_ortc_ErrorEvent.h */, + 00216D261E96E97F008204EA /* c_org_ortc_Json.cpp */, + 00216D271E96E97F008204EA /* c_org_ortc_Json.h */, + 00216D281E96E97F008204EA /* c_org_ortc_Logger.cpp */, + 00216D291E96E97F008204EA /* c_org_ortc_Logger.h */, + 00216D2A1E96E97F008204EA /* c_org_ortc_LongRange.cpp */, + 00216D2B1E96E97F008204EA /* c_org_ortc_LongRange.h */, + 00216D2C1E96E97F008204EA /* c_org_ortc_MediaControl.cpp */, + 00216D2D1E96E97F008204EA /* c_org_ortc_MediaControl.h */, + 00216D2E1E96E97F008204EA /* c_org_ortc_MediaDeviceInfo.cpp */, + 00216D2F1E96E97F008204EA /* c_org_ortc_MediaDeviceInfo.h */, + 00216D301E96E97F008204EA /* c_org_ortc_MediaDevices.cpp */, + 00216D311E96E97F008204EA /* c_org_ortc_MediaDevices.h */, + 00216D321E96E97F008204EA /* c_org_ortc_MediaSource.cpp */, + 00216D331E96E97F008204EA /* c_org_ortc_MediaSource.h */, + 00216D341E96E97F008204EA /* c_org_ortc_MediaStreamConstraints.cpp */, + 00216D351E96E97F008204EA /* c_org_ortc_MediaStreamConstraints.h */, + 00216D361E96E97F008204EA /* c_org_ortc_MediaStreamTrack.cpp */, + 00216D371E96E97F008204EA /* c_org_ortc_MediaStreamTrack.h */, + 00216D381E96E97F008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */, + 00216D391E96E97F008204EA /* c_org_ortc_MediaTrackCapabilities.h */, + 00216D3A1E96E97F008204EA /* c_org_ortc_MediaTrackConstraints.cpp */, + 00216D3B1E96E97F008204EA /* c_org_ortc_MediaTrackConstraints.h */, + 00216D3C1E96E97F008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */, + 00216D3D1E96E97F008204EA /* c_org_ortc_MediaTrackConstraintSet.h */, + 00216D3E1E96E97F008204EA /* c_org_ortc_MediaTrackSettings.cpp */, + 00216D3F1E96E97F008204EA /* c_org_ortc_MediaTrackSettings.h */, + 00216D401E96E97F008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */, + 00216D411E96E97F008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h */, + 00216D421E96E97F008204EA /* c_org_ortc_MessageQueue.cpp */, + 00216D431E96E97F008204EA /* c_org_ortc_MessageQueue.h */, + 00216D441E96E97F008204EA /* c_org_ortc_OrtcLib.cpp */, + 00216D451E96E97F008204EA /* c_org_ortc_OrtcLib.h */, + 00216D461E96E97F008204EA /* c_org_ortc_OverconstrainedError.cpp */, + 00216D471E96E97F008204EA /* c_org_ortc_OverconstrainedError.h */, + 00216D481E96E97F008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */, + 00216D491E96E97F008204EA /* c_org_ortc_OverconstrainedErrorEvent.h */, + 00216D4A1E96E97F008204EA /* c_org_ortc_RTCCertificate.cpp */, + 00216D4B1E96E97F008204EA /* c_org_ortc_RTCCertificate.h */, + 00216D4C1E96E97F008204EA /* c_org_ortc_RTCCertificateStats.cpp */, + 00216D4D1E96E97F008204EA /* c_org_ortc_RTCCertificateStats.h */, + 00216D4E1E96E97F008204EA /* c_org_ortc_RTCCodec.cpp */, + 00216D4F1E96E97F008204EA /* c_org_ortc_RTCCodec.h */, + 00216D501E96E97F008204EA /* c_org_ortc_RTCDataChannel.cpp */, + 00216D511E96E97F008204EA /* c_org_ortc_RTCDataChannel.h */, + 00216D521E96E97F008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */, + 00216D531E96E97F008204EA /* c_org_ortc_RTCDataChannelEvent.h */, + 00216D541E96E97F008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */, + 00216D551E96E97F008204EA /* c_org_ortc_RTCDataChannelParameters.h */, + 00216D561E96E97F008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */, + 00216D571E96E97F008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h */, + 00216D581E96E97F008204EA /* c_org_ortc_RTCDataChannelStats.cpp */, + 00216D591E96E97F008204EA /* c_org_ortc_RTCDataChannelStats.h */, + 00216D5A1E96E97F008204EA /* c_org_ortc_RTCDataTransport.cpp */, + 00216D5B1E96E97F008204EA /* c_org_ortc_RTCDataTransport.h */, + 00216D5C1E96E97F008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */, + 00216D5D1E96E97F008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h */, + 00216D5E1E96E97F008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */, + 00216D5F1E96E97F008204EA /* c_org_ortc_RTCDtlsFingerprint.h */, + 00216D601E96E97F008204EA /* c_org_ortc_RTCDtlsParameters.cpp */, + 00216D611E96E97F008204EA /* c_org_ortc_RTCDtlsParameters.h */, + 00216D621E96E97F008204EA /* c_org_ortc_RTCDtlsTransport.cpp */, + 00216D631E96E97F008204EA /* c_org_ortc_RTCDtlsTransport.h */, + 00216D641E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */, + 00216D651E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h */, + 00216D661E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */, + 00216D671E96E97F008204EA /* c_org_ortc_RTCDtlsTransportStats.h */, + 00216D681E96E97F008204EA /* c_org_ortc_RTCDtmfSender.cpp */, + 00216D691E96E97F008204EA /* c_org_ortc_RTCDtmfSender.h */, + 00216D6A1E96E97F008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */, + 00216D6B1E96E97F008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h */, + 00216D6C1E96E97F008204EA /* c_org_ortc_RTCIceCandidate.cpp */, + 00216D6D1E96E97F008204EA /* c_org_ortc_RTCIceCandidate.h */, + 00216D6E1E96E97F008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */, + 00216D6F1E96E97F008204EA /* c_org_ortc_RTCIceCandidateAttributes.h */, + 00216D701E96E97F008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */, + 00216D711E96E97F008204EA /* c_org_ortc_RTCIceCandidateComplete.h */, + 00216D721E96E97F008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */, + 00216D731E96E97F008204EA /* c_org_ortc_RTCIceCandidatePair.h */, + 00216D741E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */, + 00216D751E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h */, + 00216D761E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */, + 00216D771E96E97F008204EA /* c_org_ortc_RTCIceCandidatePairStats.h */, + 00216D781E96E97F008204EA /* c_org_ortc_RTCIceGatherer.cpp */, + 00216D791E96E97F008204EA /* c_org_ortc_RTCIceGatherer.h */, + 00216D7A1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */, + 00216D7B1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidate.h */, + 00216D7C1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */, + 00216D7D1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h */, + 00216D7E1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */, + 00216D7F1E96E97F008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h */, + 00216D801E96E97F008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */, + 00216D811E96E97F008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h */, + 00216D821E96E97F008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */, + 00216D831E96E97F008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h */, + 00216D841E96E97F008204EA /* c_org_ortc_RTCIceGathererStats.cpp */, + 00216D851E96E97F008204EA /* c_org_ortc_RTCIceGathererStats.h */, + 00216D861E96E97F008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */, + 00216D871E96E97F008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h */, + 00216D881E96E97F008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */, + 00216D891E96E97F008204EA /* c_org_ortc_RTCIceGatherOptions.h */, + 00216D8A1E96E97F008204EA /* c_org_ortc_RTCIceParameters.cpp */, + 00216D8B1E96E97F008204EA /* c_org_ortc_RTCIceParameters.h */, + 00216D8C1E96E97F008204EA /* c_org_ortc_RTCIceServer.cpp */, + 00216D8D1E96E97F008204EA /* c_org_ortc_RTCIceServer.h */, + 00216D8E1E96E97F008204EA /* c_org_ortc_RTCIceTransport.cpp */, + 00216D8F1E96E97F008204EA /* c_org_ortc_RTCIceTransport.h */, + 00216D901E96E97F008204EA /* c_org_ortc_RTCIceTransportController.cpp */, + 00216D911E96E97F008204EA /* c_org_ortc_RTCIceTransportController.h */, + 00216D921E96E97F008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */, + 00216D931E96E97F008204EA /* c_org_ortc_RTCIceTransportOptions.h */, + 00216D941E96E97F008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */, + 00216D951E96E97F008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h */, + 00216D961E96E97F008204EA /* c_org_ortc_RTCIceTransportStats.cpp */, + 00216D971E96E97F008204EA /* c_org_ortc_RTCIceTransportStats.h */, + 00216D981E96E97F008204EA /* c_org_ortc_RTCIdentity.cpp */, + 00216D991E96E97F008204EA /* c_org_ortc_RTCIdentity.h */, + 00216D9A1E96E97F008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */, + 00216D9B1E96E97F008204EA /* c_org_ortc_RTCIdentityAssertion.h */, + 00216D9C1E96E97F008204EA /* c_org_ortc_RTCIdentityError.cpp */, + 00216D9D1E96E97F008204EA /* c_org_ortc_RTCIdentityError.h */, + 00216D9E1E96E97F008204EA /* c_org_ortc_RTCIdentityResult.cpp */, + 00216D9F1E96E97F008204EA /* c_org_ortc_RTCIdentityResult.h */, + 00216DA01E96E97F008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */, + 00216DA11E96E97F008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h */, + 00216DA21E96E97F008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */, + 00216DA31E96E97F008204EA /* c_org_ortc_RTCMediaStreamStats.h */, + 00216DA41E96E97F008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */, + 00216DA51E96E97F008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h */, + 00216DA61E96E97F008204EA /* c_org_ortc_RTCMessageEvent.cpp */, + 00216DA71E96E97F008204EA /* c_org_ortc_RTCMessageEvent.h */, + 00216DA81E96E97F008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */, + 00216DA91E96E97F008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h */, + 00216DAA1E96E97F008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */, + 00216DAB1E96E97F008204EA /* c_org_ortc_RTCRtcpFeedback.h */, + 00216DAC1E96E97F008204EA /* c_org_ortc_RTCRtcpParameters.cpp */, + 00216DAD1E96E97F008204EA /* c_org_ortc_RTCRtcpParameters.h */, + 00216DAE1E96E97F008204EA /* c_org_ortc_RTCRtcpTransport.cpp */, + 00216DAF1E96E97F008204EA /* c_org_ortc_RTCRtcpTransport.h */, + 00216DB01E96E97F008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */, + 00216DB11E96E97F008204EA /* c_org_ortc_RTCRtpCapabilities.h */, + 00216DB21E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */, + 00216DB31E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapability.h */, + 00216DB41E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */, + 00216DB51E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h */, + 00216DB61E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */, + 00216DB71E96E97F008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h */, + 00216DB81E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */, + 00216DB91E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameters.h */, + 00216DBA1E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */, + 00216DBB1E96E97F008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h */, + 00216DBC1E96E97F008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */, + 00216DBD1E96E97F008204EA /* c_org_ortc_RTCRtpContributingSource.h */, + 00216DBE1E96E97F008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */, + 00216DBF1E96E97F008204EA /* c_org_ortc_RTCRtpEncodingParameters.h */, + 00216DC01E96E97F008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */, + 00216DC11E96E97F008204EA /* c_org_ortc_RTCRtpFecParameters.h */, + 00216DC21E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */, + 00216DC31E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */, + 00216DC41E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */, + 00216DC51E96E97F008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */, + 00216DC61E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */, + 00216DC71E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h */, + 00216DC81E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */, + 00216DC91E96E97F008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h */, + 00216DCA1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */, + 00216DCB1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtension.h */, + 00216DCC1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */, + 00216DCD1E96E97F008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h */, + 00216DCE1E96E97F008204EA /* c_org_ortc_RTCRtpListener.cpp */, + 00216DCF1E96E97F008204EA /* c_org_ortc_RTCRtpListener.h */, + 00216DD01E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */, + 00216DD11E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */, + 00216DD21E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */, + 00216DD31E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */, + 00216DD41E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */, + 00216DD51E96E97F008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h */, + 00216DD61E96E97F008204EA /* c_org_ortc_RTCRtpParameters.cpp */, + 00216DD71E96E97F008204EA /* c_org_ortc_RTCRtpParameters.h */, + 00216DD81E96E97F008204EA /* c_org_ortc_RTCRtpReceiver.cpp */, + 00216DD91E96E97F008204EA /* c_org_ortc_RTCRtpReceiver.h */, + 00216DDA1E96E97F008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */, + 00216DDB1E96E97F008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h */, + 00216DDC1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */, + 00216DDD1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */, + 00216DDE1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */, + 00216DDF1E96E97F008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h */, + 00216DE01E96E97F008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */, + 00216DE11E96E97F008204EA /* c_org_ortc_RTCRtpRtxParameters.h */, + 00216DE21E96E97F008204EA /* c_org_ortc_RTCRtpSender.cpp */, + 00216DE31E96E97F008204EA /* c_org_ortc_RTCRtpSender.h */, + 00216DE41E96E97F008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */, + 00216DE51E96E97F008204EA /* c_org_ortc_RTCRtpStreamStats.h */, + 00216DE61E96E97F008204EA /* c_org_ortc_RTCRtpTransport.cpp */, + 00216DE71E96E97F008204EA /* c_org_ortc_RTCRtpTransport.h */, + 00216DE81E96E97F008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */, + 00216DE91E96E97F008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h */, + 00216DEA1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */, + 00216DEB1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */, + 00216DEC1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */, + 00216DED1E96E97F008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h */, + 00216DEE1E96E97F008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */, + 00216DEF1E96E97F008204EA /* c_org_ortc_RTCSctpCapabilities.h */, + 00216DF01E96E97F008204EA /* c_org_ortc_RTCSctpTransport.cpp */, + 00216DF11E96E97F008204EA /* c_org_ortc_RTCSctpTransport.h */, + 00216DF21E96E97F008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */, + 00216DF31E96E97F008204EA /* c_org_ortc_RTCSctpTransportListener.h */, + 00216DF41E96E97F008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */, + 00216DF51E96E97F008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h */, + 00216DF61E96E97F008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */, + 00216DF71E96E97F008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h */, + 00216DF81E96E97F008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */, + 00216DF91E96E97F008204EA /* c_org_ortc_RTCSctpTransportStats.h */, + 00216DFA1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */, + 00216DFB1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h */, + 00216DFC1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */, + 00216DFD1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h */, + 00216DFE1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */, + 00216DFF1E96E97F008204EA /* c_org_ortc_RTCSrtpSdesParameters.h */, + 00216E001E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */, + 00216E011E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransport.h */, + 00216E021E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */, + 00216E031E96E97F008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */, + 00216E041E96E97F008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */, + 00216E051E96E97F008204EA /* c_org_ortc_RTCSrtpTransportStats.h */, + 00216E061E96E97F008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */, + 00216E071E96E97F008204EA /* c_org_ortc_RTCSsrcConflictEvent.h */, + 00216E081E96E97F008204EA /* c_org_ortc_RTCStats.cpp */, + 00216E091E96E97F008204EA /* c_org_ortc_RTCStats.h */, + 00216E0A1E96E97F008204EA /* c_org_ortc_RTCStatsProvider.cpp */, + 00216E0B1E96E97F008204EA /* c_org_ortc_RTCStatsProvider.h */, + 00216E0C1E96E97F008204EA /* c_org_ortc_RTCStatsReport.cpp */, + 00216E0D1E96E97F008204EA /* c_org_ortc_RTCStatsReport.h */, + 00216E0E1E96E97F008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */, + 00216E0F1E96E97F008204EA /* c_org_ortc_RTCStatsTypeSet.h */, + 00216E101E96E97F008204EA /* c_org_ortc_Settings.cpp */, + 00216E111E96E97F008204EA /* c_org_ortc_Settings.h */, + 00216E121E96E97F008204EA /* c_org_ortc_StringOrStringList.cpp */, + 00216E131E96E97F008204EA /* c_org_ortc_StringOrStringList.h */, + 00216E141E96E97F008204EA /* types.h */, + ); + name = c; + path = ../../../ortc/idl/wrapper/generated/c; + sourceTree = ""; + }; + 529AA64C1E9F90B8007ACFD2 /* Products */ = { + isa = PBXGroup; + children = ( + 529AA6501E9F90B8007ACFD2 /* libwebrtcWrapper_ios.a */, + ); + name = Products; + sourceTree = ""; + }; + 52BFF6181E9CFBEC00DF88A1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 52BFF6EF1E9D0D6F00DF88A1 /* libcryptopp-ios.a */, + 52BFF6F01E9D0D6F00DF88A1 /* libidnkit-ios.a */, + 52BFF6F11E9D0D6F00DF88A1 /* libortclib-ios.a */, + 52BFF6F21E9D0D6F00DF88A1 /* libortclib-wrapper-ios.a */, + 52BFF6F31E9D0D6F00DF88A1 /* libortclib.services-ios.a */, + 52BFF6F41E9D0D6F00DF88A1 /* libudns-ios.a */, + 52BFF6F51E9D0D6F00DF88A1 /* libzsLib-eventing-ios.a */, + 52BFF6F61E9D0D6F00DF88A1 /* libzsLib-ios.a */, + 52BFF63F1E9D0A1800DF88A1 /* webrtc.a */, + 52BFF63D1E9D053900DF88A1 /* libcurl.a */, + 52BFF6291E9CFC5500DF88A1 /* AudioToolbox.framework */, + 52BFF62A1E9CFC5500DF88A1 /* AVFoundation.framework */, + 52BFF62B1E9CFC5500DF88A1 /* CoreMedia.framework */, + 52BFF62C1E9CFC5500DF88A1 /* CoreVideo.framework */, + 52BFF62D1E9CFC5500DF88A1 /* Foundation.framework */, + 52BFF62E1E9CFC5500DF88A1 /* libresolv.9.tbd */, + 52BFF62F1E9CFC5500DF88A1 /* libz.tbd */, + 52BFF6301E9CFC5500DF88A1 /* Security.framework */, + 52BFF6311E9CFC5500DF88A1 /* UIKit.framework */, + 52BFF6321E9CFC5500DF88A1 /* VideoToolbox.framework */, + 52BFF6191E9CFBEE00DF88A1 /* libcryptopp-ios.a */, + 52BFF61A1E9CFBEE00DF88A1 /* libidnkit-ios.a */, + 52BFF61B1E9CFBEE00DF88A1 /* libortclib-ios.a */, + 52BFF61C1E9CFBEE00DF88A1 /* libortclib-wrapper-ios.a */, + 52BFF61D1E9CFBEE00DF88A1 /* libortclib.services-ios.a */, + 52BFF61E1E9CFBEE00DF88A1 /* libudns-ios.a */, + 52BFF61F1E9CFBEE00DF88A1 /* libzsLib-eventing-ios.a */, + 52BFF6201E9CFBEE00DF88A1 /* libzsLib-ios.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 52BFF6431E9D0B9200DF88A1 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 00216CCE1E96E939008204EA /* ortclib-c-ios */ = { + isa = PBXNativeTarget; + buildConfigurationList = 00216CD81E96E939008204EA /* Build configuration list for PBXNativeTarget "ortclib-c-ios" */; + buildPhases = ( + 00216CCB1E96E939008204EA /* Sources */, + 00216CCC1E96E939008204EA /* Frameworks */, + 00216CCD1E96E939008204EA /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ortclib-c-ios"; + productName = "ortclib-c-ios"; + productReference = 00216CCF1E96E939008204EA /* libortclib-c-ios.a */; + productType = "com.apple.product-type.library.static"; + }; + 52BFF6441E9D0B9200DF88A1 /* Ortc */ = { + isa = PBXNativeTarget; + buildConfigurationList = 52BFF6461E9D0B9200DF88A1 /* Build configuration list for PBXNativeTarget "Ortc" */; + buildPhases = ( + 52BFF6411E9D0B9200DF88A1 /* Sources */, + 52BFF6421E9D0B9200DF88A1 /* Frameworks */, + 52BFF6431E9D0B9200DF88A1 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + 529AA6521E9F90C0007ACFD2 /* PBXTargetDependency */, + ); + name = Ortc; + productName = "ortclib-c-ios-wrapper"; + productReference = 52BFF6451E9D0B9200DF88A1 /* libOrtc.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 00216CC71E96E939008204EA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = "Open Peer Foundation"; + TargetAttributes = { + 00216CCE1E96E939008204EA = { + CreatedOnToolsVersion = 8.3; + ProvisioningStyle = Automatic; + }; + 52BFF6441E9D0B9200DF88A1 = { + CreatedOnToolsVersion = 8.3.1; + DevelopmentTeam = QE9E5R8GUP; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 00216CCA1E96E939008204EA /* Build configuration list for PBXProject "ortclib-c-ios" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 00216CC61E96E939008204EA; + productRefGroup = 00216CD01E96E939008204EA /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 529AA64C1E9F90B8007ACFD2 /* Products */; + ProjectRef = 529AA64B1E9F90B8007ACFD2 /* webrtcWrapper_ios.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 00216CCE1E96E939008204EA /* ortclib-c-ios */, + 52BFF6441E9D0B9200DF88A1 /* Ortc */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 529AA6501E9F90B8007ACFD2 /* libwebrtcWrapper_ios.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtcWrapper_ios.a; + remoteRef = 529AA64F1E9F90B8007ACFD2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXSourcesBuildPhase section */ + 00216CCB1E96E939008204EA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 00216E741E96E980008204EA /* c_org_ortc_RTCIdentityAssertion.cpp in Sources */, + 00216E2E1E96E97F008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp in Sources */, + 00216E6D1E96E980008204EA /* c_org_ortc_RTCIceServer.cpp in Sources */, + 00216E481E96E980008204EA /* c_org_ortc_MessageQueue.cpp in Sources */, + 00216E7A1E96E980008204EA /* c_org_ortc_RTCMessageEvent.cpp in Sources */, + 00216E5B1E96E980008204EA /* c_org_ortc_RTCDtmfSender.cpp in Sources */, + 00216EB01E96E980008204EA /* c_org_ortc_StringOrStringList.cpp in Sources */, + 00216E3D1E96E97F008204EA /* c_org_ortc_MediaControl.cpp in Sources */, + 00216EA01E96E980008204EA /* c_org_ortc_RTCSctpTransportListener.cpp in Sources */, + 00216E581E96E980008204EA /* c_org_ortc_RTCDtlsTransport.cpp in Sources */, + 00216E641E96E980008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp in Sources */, + 00216E591E96E980008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */, + 00216E411E96E980008204EA /* c_org_ortc_MediaStreamConstraints.cpp in Sources */, + 00216E811E96E980008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */, + 00216E871E96E980008204EA /* c_org_ortc_RTCRtpFecParameters.cpp in Sources */, + 00216E7B1E96E980008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */, + 00216E9C1E96E980008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */, + 00216E5F1E96E980008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp in Sources */, + 00216E281E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */, + 00216E3F1E96E980008204EA /* c_org_ortc_MediaDevices.cpp in Sources */, + 00216EA11E96E980008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */, + 00216E221E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */, + 00216E4A1E96E980008204EA /* c_org_ortc_OverconstrainedError.cpp in Sources */, + 00216E511E96E980008204EA /* c_org_ortc_RTCDataChannelParameters.cpp in Sources */, + 00216E7C1E96E980008204EA /* c_org_ortc_RTCRtcpFeedback.cpp in Sources */, + 00216EAB1E96E980008204EA /* c_org_ortc_RTCStats.cpp in Sources */, + 00216E2D1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */, + 00216E771E96E980008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */, + 00216E401E96E980008204EA /* c_org_ortc_MediaSource.cpp in Sources */, + 00216E711E96E980008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */, + 00216E891E96E980008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */, + 00216E3E1E96E980008204EA /* c_org_ortc_MediaDeviceInfo.cpp in Sources */, + 00216E5E1E96E980008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp in Sources */, + 00216E541E96E980008204EA /* c_org_ortc_RTCDataTransport.cpp in Sources */, + 00216E8E1E96E980008204EA /* c_org_ortc_RTCRtpListener.cpp in Sources */, + 00216E421E96E980008204EA /* c_org_ortc_MediaStreamTrack.cpp in Sources */, + 00216EA71E96E980008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp in Sources */, + 00216E501E96E980008204EA /* c_org_ortc_RTCDataChannelEvent.cpp in Sources */, + 00216E661E96E980008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */, + 00216E951E96E980008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */, + 00216E521E96E980008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */, + 00216E9F1E96E980008204EA /* c_org_ortc_RTCSctpTransport.cpp in Sources */, + 00216E7D1E96E980008204EA /* c_org_ortc_RTCRtcpParameters.cpp in Sources */, + 00216EA61E96E980008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp in Sources */, + 00216E971E96E980008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp in Sources */, + 00216E391E96E97F008204EA /* c_org_ortc_ErrorEvent.cpp in Sources */, + 00216E1D1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp in Sources */, + 00216E251E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */, + 00216E621E96E980008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp in Sources */, + 00216E1A1E96E97F008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp in Sources */, + 00216E6B1E96E980008204EA /* c_org_ortc_RTCIceGatherOptions.cpp in Sources */, + 00216EA41E96E980008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */, + 00216EAE1E96E980008204EA /* c_org_ortc_RTCStatsTypeSet.cpp in Sources */, + 00216E631E96E980008204EA /* c_org_ortc_RTCIceGatherer.cpp in Sources */, + 00216E161E96E97F008204EA /* c_org_ortc_adapter_MediaStream.cpp in Sources */, + 00216E1B1E96E97F008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */, + 00216E311E96E97F008204EA /* c_org_ortc_ConstrainDouble.cpp in Sources */, + 00216E301E96E97F008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp in Sources */, + 00216E371E96E97F008204EA /* c_org_ortc_DoubleRange.cpp in Sources */, + 00216E2F1E96E97F008204EA /* c_org_ortc_ConstrainBoolean.cpp in Sources */, + 00216E961E96E980008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */, + 00216E441E96E980008204EA /* c_org_ortc_MediaTrackConstraints.cpp in Sources */, + 00216E471E96E980008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */, + 00216E3B1E96E97F008204EA /* c_org_ortc_Logger.cpp in Sources */, + 00216E861E96E980008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp in Sources */, + 00216E431E96E980008204EA /* c_org_ortc_MediaTrackCapabilities.cpp in Sources */, + 00216E8D1E96E980008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */, + 00216E4F1E96E980008204EA /* c_org_ortc_RTCDataChannel.cpp in Sources */, + 00216E881E96E980008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */, + 00216E461E96E980008204EA /* c_org_ortc_MediaTrackSettings.cpp in Sources */, + 00216E4B1E96E980008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp in Sources */, + 00216E6A1E96E980008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */, + 00216E921E96E980008204EA /* c_org_ortc_RTCRtpParameters.cpp in Sources */, + 00216E8C1E96E980008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp in Sources */, + 00216E9B1E96E980008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */, + 00216E491E96E980008204EA /* c_org_ortc_OrtcLib.cpp in Sources */, + 00216E181E96E97F008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */, + 00216E8B1E96E980008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */, + 00216E6E1E96E980008204EA /* c_org_ortc_RTCIceTransport.cpp in Sources */, + 00216E4D1E96E980008204EA /* c_org_ortc_RTCCertificateStats.cpp in Sources */, + 00216E291E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */, + 00216E8A1E96E980008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */, + 00216E691E96E980008204EA /* c_org_ortc_RTCIceGathererStats.cpp in Sources */, + 00216E9D1E96E980008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */, + 00216E331E96E97F008204EA /* c_org_ortc_ConstrainLong.cpp in Sources */, + 00216E651E96E980008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */, + 00216E381E96E97F008204EA /* c_org_ortc_Error.cpp in Sources */, + 00216E3A1E96E97F008204EA /* c_org_ortc_Json.cpp in Sources */, + 00216E681E96E980008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */, + 00216E171E96E97F008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */, + 00216E8F1E96E980008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */, + 00216E201E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */, + 00216E801E96E980008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp in Sources */, + 00216E7F1E96E980008204EA /* c_org_ortc_RTCRtpCapabilities.cpp in Sources */, + 00216E751E96E980008204EA /* c_org_ortc_RTCIdentityError.cpp in Sources */, + 00216E831E96E980008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp in Sources */, + 00216E231E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */, + 00216EA91E96E980008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp in Sources */, + 00216E851E96E980008204EA /* c_org_ortc_RTCRtpContributingSource.cpp in Sources */, + 00216E7E1E96E980008204EA /* c_org_ortc_RTCRtcpTransport.cpp in Sources */, + 00216E9A1E96E980008204EA /* c_org_ortc_RTCRtpTransport.cpp in Sources */, + 00216E341E96E97F008204EA /* c_org_ortc_ConstrainLongRange.cpp in Sources */, + 00216E781E96E980008204EA /* c_org_ortc_RTCMediaStreamStats.cpp in Sources */, + 00216E2B1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */, + 00216EAC1E96E980008204EA /* c_org_ortc_RTCStatsProvider.cpp in Sources */, + 00216EAF1E96E980008204EA /* c_org_ortc_Settings.cpp in Sources */, + 00216EAD1E96E980008204EA /* c_org_ortc_RTCStatsReport.cpp in Sources */, + 00216EAA1E96E980008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp in Sources */, + 00216E551E96E980008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */, + 00216E821E96E980008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */, + 00216E941E96E980008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */, + 00216E351E96E97F008204EA /* c_org_ortc_ConstrainString.cpp in Sources */, + 00216E561E96E980008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp in Sources */, + 00216E2A1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */, + 00216E1C1E96E97F008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */, + 00216E4E1E96E980008204EA /* c_org_ortc_RTCCodec.cpp in Sources */, + 00216E9E1E96E980008204EA /* c_org_ortc_RTCSctpCapabilities.cpp in Sources */, + 00216E4C1E96E980008204EA /* c_org_ortc_RTCCertificate.cpp in Sources */, + 00216E5A1E96E980008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp in Sources */, + 00216E911E96E980008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */, + 00216E931E96E980008204EA /* c_org_ortc_RTCRtpReceiver.cpp in Sources */, + 00216E701E96E980008204EA /* c_org_ortc_RTCIceTransportOptions.cpp in Sources */, + 00216E611E96E980008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */, + 00216EA51E96E980008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */, + 00216EA21E96E980008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */, + 00216E321E96E97F008204EA /* c_org_ortc_ConstrainDoubleRange.cpp in Sources */, + 00216E5D1E96E980008204EA /* c_org_ortc_RTCIceCandidate.cpp in Sources */, + 00216EA31E96E980008204EA /* c_org_ortc_RTCSctpTransportStats.cpp in Sources */, + 00216E791E96E980008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */, + 00216E1F1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */, + 00216E151E96E97F008204EA /* c_helpers.cpp in Sources */, + 00216E761E96E980008204EA /* c_org_ortc_RTCIdentityResult.cpp in Sources */, + 00216E841E96E980008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */, + 00216E191E96E97F008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp in Sources */, + 00216E531E96E980008204EA /* c_org_ortc_RTCDataChannelStats.cpp in Sources */, + 00216EA81E96E980008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */, + 00216E721E96E980008204EA /* c_org_ortc_RTCIceTransportStats.cpp in Sources */, + 00216E6C1E96E980008204EA /* c_org_ortc_RTCIceParameters.cpp in Sources */, + 00216E2C1E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */, + 00216E241E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */, + 00216E451E96E980008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp in Sources */, + 00216E901E96E980008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */, + 00216E991E96E980008204EA /* c_org_ortc_RTCRtpStreamStats.cpp in Sources */, + 00216E981E96E980008204EA /* c_org_ortc_RTCRtpSender.cpp in Sources */, + 00216E271E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */, + 00216E571E96E980008204EA /* c_org_ortc_RTCDtlsParameters.cpp in Sources */, + 00216E671E96E980008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */, + 00216E261E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */, + 00216E5C1E96E980008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */, + 00216E3C1E96E97F008204EA /* c_org_ortc_LongRange.cpp in Sources */, + 00216E601E96E980008204EA /* c_org_ortc_RTCIceCandidatePair.cpp in Sources */, + 00216E6F1E96E980008204EA /* c_org_ortc_RTCIceTransportController.cpp in Sources */, + 00216E361E96E97F008204EA /* c_org_ortc_ConstrainStringParameters.cpp in Sources */, + 00216E211E96E97F008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp in Sources */, + 00216E731E96E980008204EA /* c_org_ortc_RTCIdentity.cpp in Sources */, + 00216E1E1E96E97F008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 52BFF6411E9D0B9200DF88A1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 52BFF6491E9D0C2800DF88A1 /* c_helpers.cpp in Sources */, + 52BFF64A1E9D0C2800DF88A1 /* c_org_ortc_adapter_MediaStream.cpp in Sources */, + 52BFF64B1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */, + 52BFF64C1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */, + 52BFF64D1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCConfiguration.cpp in Sources */, + 52BFF64E1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCIceCandidate.cpp in Sources */, + 52BFF64F1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */, + 52BFF6501E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */, + 52BFF6511E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCOfferOptions.cpp in Sources */, + 52BFF6521E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCPeerConnection.cpp in Sources */, + 52BFF6531E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */, + 52BFF6541E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */, + 52BFF6551E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescription.cpp in Sources */, + 52BFF6561E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */, + 52BFF6571E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */, + 52BFF6581E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */, + 52BFF6591E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */, + 52BFF65A1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */, + 52BFF65B1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */, + 52BFF65C1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */, + 52BFF65D1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */, + 52BFF65E1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */, + 52BFF65F1E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */, + 52BFF6601E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */, + 52BFF6611E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */, + 52BFF6621E9D0C2800DF88A1 /* c_org_ortc_adapter_RTCTrackEvent.cpp in Sources */, + 52BFF6631E9D0C2800DF88A1 /* c_org_ortc_ConstrainBoolean.cpp in Sources */, + 52BFF6641E9D0C2800DF88A1 /* c_org_ortc_ConstrainBooleanParameters.cpp in Sources */, + 52BFF6651E9D0C2800DF88A1 /* c_org_ortc_ConstrainDouble.cpp in Sources */, + 52BFF6661E9D0C2800DF88A1 /* c_org_ortc_ConstrainDoubleRange.cpp in Sources */, + 52BFF6671E9D0C2800DF88A1 /* c_org_ortc_ConstrainLong.cpp in Sources */, + 52BFF6681E9D0C2800DF88A1 /* c_org_ortc_ConstrainLongRange.cpp in Sources */, + 52BFF6691E9D0C2800DF88A1 /* c_org_ortc_ConstrainString.cpp in Sources */, + 52BFF66A1E9D0C2800DF88A1 /* c_org_ortc_ConstrainStringParameters.cpp in Sources */, + 52BFF66B1E9D0C2800DF88A1 /* c_org_ortc_DoubleRange.cpp in Sources */, + 52BFF66C1E9D0C2800DF88A1 /* c_org_ortc_Error.cpp in Sources */, + 52BFF66D1E9D0C2800DF88A1 /* c_org_ortc_ErrorEvent.cpp in Sources */, + 52BFF66E1E9D0C2800DF88A1 /* c_org_ortc_Json.cpp in Sources */, + 52BFF66F1E9D0C2800DF88A1 /* c_org_ortc_Logger.cpp in Sources */, + 52BFF6701E9D0C2800DF88A1 /* c_org_ortc_LongRange.cpp in Sources */, + 52BFF6711E9D0C2800DF88A1 /* c_org_ortc_MediaControl.cpp in Sources */, + 52BFF6721E9D0C2800DF88A1 /* c_org_ortc_MediaDeviceInfo.cpp in Sources */, + 52BFF6731E9D0C2800DF88A1 /* c_org_ortc_MediaDevices.cpp in Sources */, + 52BFF6741E9D0C2800DF88A1 /* c_org_ortc_MediaSource.cpp in Sources */, + 52BFF6751E9D0C2800DF88A1 /* c_org_ortc_MediaStreamConstraints.cpp in Sources */, + 52BFF6761E9D0C2800DF88A1 /* c_org_ortc_MediaStreamTrack.cpp in Sources */, + 52BFF6771E9D0C2800DF88A1 /* c_org_ortc_MediaTrackCapabilities.cpp in Sources */, + 52BFF6781E9D0C2800DF88A1 /* c_org_ortc_MediaTrackConstraints.cpp in Sources */, + 52BFF6791E9D0C2800DF88A1 /* c_org_ortc_MediaTrackConstraintSet.cpp in Sources */, + 52BFF67A1E9D0C2800DF88A1 /* c_org_ortc_MediaTrackSettings.cpp in Sources */, + 52BFF67B1E9D0C2800DF88A1 /* c_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */, + 52BFF67C1E9D0C2800DF88A1 /* c_org_ortc_MessageQueue.cpp in Sources */, + 52BFF67D1E9D0C2800DF88A1 /* c_org_ortc_OrtcLib.cpp in Sources */, + 52BFF67E1E9D0C2800DF88A1 /* c_org_ortc_OverconstrainedError.cpp in Sources */, + 52BFF67F1E9D0C2800DF88A1 /* c_org_ortc_OverconstrainedErrorEvent.cpp in Sources */, + 52BFF6801E9D0C2800DF88A1 /* c_org_ortc_RTCCertificate.cpp in Sources */, + 52BFF6811E9D0C2800DF88A1 /* c_org_ortc_RTCCertificateStats.cpp in Sources */, + 52BFF6821E9D0C2800DF88A1 /* c_org_ortc_RTCCodec.cpp in Sources */, + 52BFF6831E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannel.cpp in Sources */, + 52BFF6841E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelEvent.cpp in Sources */, + 52BFF6851E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelParameters.cpp in Sources */, + 52BFF6861E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */, + 52BFF6871E9D0C2800DF88A1 /* c_org_ortc_RTCDataChannelStats.cpp in Sources */, + 52BFF6881E9D0C2800DF88A1 /* c_org_ortc_RTCDataTransport.cpp in Sources */, + 52BFF6891E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */, + 52BFF68A1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsFingerprint.cpp in Sources */, + 52BFF68B1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsParameters.cpp in Sources */, + 52BFF68C1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsTransport.cpp in Sources */, + 52BFF68D1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */, + 52BFF68E1E9D0C2800DF88A1 /* c_org_ortc_RTCDtlsTransportStats.cpp in Sources */, + 52BFF68F1E9D0C2800DF88A1 /* c_org_ortc_RTCDtmfSender.cpp in Sources */, + 52BFF6901E9D0C2800DF88A1 /* c_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */, + 52BFF6911E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidate.cpp in Sources */, + 52BFF6921E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidateAttributes.cpp in Sources */, + 52BFF6931E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidateComplete.cpp in Sources */, + 52BFF6941E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidatePair.cpp in Sources */, + 52BFF6951E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */, + 52BFF6961E9D0C2800DF88A1 /* c_org_ortc_RTCIceCandidatePairStats.cpp in Sources */, + 52BFF6971E9D0C2800DF88A1 /* c_org_ortc_RTCIceGatherer.cpp in Sources */, + 52BFF6981E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererCandidate.cpp in Sources */, + 52BFF6991E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */, + 52BFF69A1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */, + 52BFF69B1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */, + 52BFF69C1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */, + 52BFF69D1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGathererStats.cpp in Sources */, + 52BFF69E1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */, + 52BFF69F1E9D0C2800DF88A1 /* c_org_ortc_RTCIceGatherOptions.cpp in Sources */, + 52BFF6A01E9D0C2800DF88A1 /* c_org_ortc_RTCIceParameters.cpp in Sources */, + 52BFF6A11E9D0C2800DF88A1 /* c_org_ortc_RTCIceServer.cpp in Sources */, + 52BFF6A21E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransport.cpp in Sources */, + 52BFF6A31E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportController.cpp in Sources */, + 52BFF6A41E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportOptions.cpp in Sources */, + 52BFF6A51E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */, + 52BFF6A61E9D0C2800DF88A1 /* c_org_ortc_RTCIceTransportStats.cpp in Sources */, + 52BFF6A71E9D0C2800DF88A1 /* c_org_ortc_RTCIdentity.cpp in Sources */, + 52BFF6A81E9D0C2800DF88A1 /* c_org_ortc_RTCIdentityAssertion.cpp in Sources */, + 52BFF6A91E9D0C2800DF88A1 /* c_org_ortc_RTCIdentityError.cpp in Sources */, + 52BFF6AA1E9D0C2800DF88A1 /* c_org_ortc_RTCIdentityResult.cpp in Sources */, + 52BFF6AB1E9D0C2800DF88A1 /* c_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */, + 52BFF6AC1E9D0C2800DF88A1 /* c_org_ortc_RTCMediaStreamStats.cpp in Sources */, + 52BFF6AD1E9D0C2800DF88A1 /* c_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */, + 52BFF6AE1E9D0C2800DF88A1 /* c_org_ortc_RTCMessageEvent.cpp in Sources */, + 52BFF6AF1E9D0C2900DF88A1 /* c_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */, + 52BFF6B01E9D0C2900DF88A1 /* c_org_ortc_RTCRtcpFeedback.cpp in Sources */, + 52BFF6B11E9D0C2900DF88A1 /* c_org_ortc_RTCRtcpParameters.cpp in Sources */, + 52BFF6B21E9D0C2900DF88A1 /* c_org_ortc_RTCRtcpTransport.cpp in Sources */, + 52BFF6B31E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCapabilities.cpp in Sources */, + 52BFF6B41E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecCapability.cpp in Sources */, + 52BFF6B51E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */, + 52BFF6B61E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */, + 52BFF6B71E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecParameters.cpp in Sources */, + 52BFF6B81E9D0C2900DF88A1 /* c_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */, + 52BFF6B91E9D0C2900DF88A1 /* c_org_ortc_RTCRtpContributingSource.cpp in Sources */, + 52BFF6BA1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpEncodingParameters.cpp in Sources */, + 52BFF6BB1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpFecParameters.cpp in Sources */, + 52BFF6BC1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */, + 52BFF6BD1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */, + 52BFF6BE1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */, + 52BFF6BF1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */, + 52BFF6C01E9D0C2900DF88A1 /* c_org_ortc_RTCRtpHeaderExtension.cpp in Sources */, + 52BFF6C11E9D0C2900DF88A1 /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */, + 52BFF6C21E9D0C2900DF88A1 /* c_org_ortc_RTCRtpListener.cpp in Sources */, + 52BFF6C31E9D0C2900DF88A1 /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */, + 52BFF6C41E9D0C2900DF88A1 /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */, + 52BFF6C51E9D0C2900DF88A1 /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */, + 52BFF6C61E9D0C2900DF88A1 /* c_org_ortc_RTCRtpParameters.cpp in Sources */, + 52BFF6C71E9D0C2900DF88A1 /* c_org_ortc_RTCRtpReceiver.cpp in Sources */, + 52BFF6C81E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */, + 52BFF6C91E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */, + 52BFF6CA1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */, + 52BFF6CB1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpRtxParameters.cpp in Sources */, + 52BFF6CC1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpSender.cpp in Sources */, + 52BFF6CD1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpStreamStats.cpp in Sources */, + 52BFF6CE1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpTransport.cpp in Sources */, + 52BFF6CF1E9D0C2900DF88A1 /* c_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */, + 52BFF6D01E9D0C2900DF88A1 /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */, + 52BFF6D11E9D0C2900DF88A1 /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */, + 52BFF6D21E9D0C2900DF88A1 /* c_org_ortc_RTCSctpCapabilities.cpp in Sources */, + 52BFF6D31E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransport.cpp in Sources */, + 52BFF6D41E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportListener.cpp in Sources */, + 52BFF6D51E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */, + 52BFF6D61E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */, + 52BFF6D71E9D0C2900DF88A1 /* c_org_ortc_RTCSctpTransportStats.cpp in Sources */, + 52BFF6D81E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */, + 52BFF6D91E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */, + 52BFF6DA1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesParameters.cpp in Sources */, + 52BFF6DB1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesTransport.cpp in Sources */, + 52BFF6DC1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */, + 52BFF6DD1E9D0C2900DF88A1 /* c_org_ortc_RTCSrtpTransportStats.cpp in Sources */, + 52BFF6DE1E9D0C2900DF88A1 /* c_org_ortc_RTCSsrcConflictEvent.cpp in Sources */, + 52BFF6DF1E9D0C2900DF88A1 /* c_org_ortc_RTCStats.cpp in Sources */, + 52BFF6E01E9D0C2900DF88A1 /* c_org_ortc_RTCStatsProvider.cpp in Sources */, + 52BFF6E11E9D0C2900DF88A1 /* c_org_ortc_RTCStatsReport.cpp in Sources */, + 52BFF6E21E9D0C2900DF88A1 /* c_org_ortc_RTCStatsTypeSet.cpp in Sources */, + 52BFF6E31E9D0C2900DF88A1 /* c_org_ortc_Settings.cpp in Sources */, + 52BFF6E41E9D0C2900DF88A1 /* c_org_ortc_StringOrStringList.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 529AA6521E9F90C0007ACFD2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtcWrapper_ios; + targetProxy = 529AA6511E9F90C0007ACFD2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 00216CD61E96E939008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 00216CD71E96E939008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 00216CD91E96E939008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_BITCODE = NO; + LIBRARY_SEARCH_PATHS = "../../../../curl/curl/ios-appstore/lib"; + MACH_O_TYPE = mh_dylib; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 00216CDA1E96E939008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_BITCODE = NO; + LIBRARY_SEARCH_PATHS = "../../../../curl/curl/ios-appstore/lib"; + MACH_O_TYPE = mh_dylib; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 52BFF6471E9D0B9200DF88A1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = QE9E5R8GUP; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + ENABLE_BITCODE = NO; + EXECUTABLE_PREFIX = lib; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + LIBRARY_SEARCH_PATHS = "../../../../curl/curl/ios-appstore/lib"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = iphoneos; + VALID_ARCHS = "arm64 armv7s armv7"; + }; + name = Debug; + }; + 52BFF6481E9D0B9200DF88A1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Distribution"; + DEVELOPMENT_TEAM = QE9E5R8GUP; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + ENABLE_BITCODE = NO; + EXECUTABLE_PREFIX = lib; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + LIBRARY_SEARCH_PATHS = "../../../../curl/curl/ios-appstore/lib"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = iphoneos; + VALID_ARCHS = "arm64 armv7s armv7"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 00216CCA1E96E939008204EA /* Build configuration list for PBXProject "ortclib-c-ios" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00216CD61E96E939008204EA /* Debug */, + 00216CD71E96E939008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 00216CD81E96E939008204EA /* Build configuration list for PBXNativeTarget "ortclib-c-ios" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00216CD91E96E939008204EA /* Debug */, + 00216CDA1E96E939008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 52BFF6461E9D0B9200DF88A1 /* Build configuration list for PBXNativeTarget "Ortc" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 52BFF6471E9D0B9200DF88A1 /* Debug */, + 52BFF6481E9D0B9200DF88A1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 00216CC71E96E939008204EA /* Project object */; +} diff --git a/projects/xcode/ortclib-c-osx/ortclib-c-osx.xcodeproj/project.pbxproj b/projects/xcode/ortclib-c-osx/ortclib-c-osx.xcodeproj/project.pbxproj new file mode 100644 index 00000000..1e7ba39a --- /dev/null +++ b/projects/xcode/ortclib-c-osx/ortclib-c-osx.xcodeproj/project.pbxproj @@ -0,0 +1,1524 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 00216FFB1E970056008204EA /* c_helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EC21E970056008204EA /* c_helpers.cpp */; }; + 00216FFC1E970056008204EA /* c_helpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EC31E970056008204EA /* c_helpers.h */; }; + 00216FFD1E970056008204EA /* c_org_ortc_adapter_MediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EC41E970056008204EA /* c_org_ortc_adapter_MediaStream.cpp */; }; + 00216FFE1E970056008204EA /* c_org_ortc_adapter_MediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EC51E970056008204EA /* c_org_ortc_adapter_MediaStream.h */; }; + 00216FFF1E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EC61E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */; }; + 002170001E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EC71E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h */; }; + 002170011E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EC81E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */; }; + 002170021E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EC91E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h */; }; + 002170031E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ECA1E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */; }; + 002170041E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ECB1E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.h */; }; + 002170051E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ECC1E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */; }; + 002170061E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ECD1E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.h */; }; + 002170071E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ECE1E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */; }; + 002170081E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ECF1E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */; }; + 002170091E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ED01E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */; }; + 0021700A1E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ED11E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h */; }; + 0021700B1E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ED21E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */; }; + 0021700C1E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ED31E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.h */; }; + 0021700D1E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ED41E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */; }; + 0021700E1E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ED51E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.h */; }; + 0021700F1E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ED61E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */; }; + 002170101E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ED71E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */; }; + 002170111E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216ED81E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */; }; + 002170121E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216ED91E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h */; }; + 002170131E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EDA1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */; }; + 002170141E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EDB1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.h */; }; + 002170151E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EDC1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */; }; + 002170161E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EDD1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */; }; + 002170171E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EDE1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */; }; + 002170181E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EDF1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */; }; + 002170191E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EE01E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */; }; + 0021701A1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EE11E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h */; }; + 0021701B1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EE21E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */; }; + 0021701C1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EE31E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */; }; + 0021701D1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EE41E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */; }; + 0021701E1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EE51E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */; }; + 0021701F1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EE61E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */; }; + 002170201E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EE71E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */; }; + 002170211E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EE81E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */; }; + 002170221E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EE91E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */; }; + 002170231E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EEA1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */; }; + 002170241E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EEB1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */; }; + 002170251E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EEC1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */; }; + 002170261E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EED1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */; }; + 002170271E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EEE1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */; }; + 002170281E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EEF1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */; }; + 002170291E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EF01E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */; }; + 0021702A1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EF11E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h */; }; + 0021702B1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EF21E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */; }; + 0021702C1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EF31E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */; }; + 0021702D1E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EF41E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */; }; + 0021702E1E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EF51E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.h */; }; + 0021702F1E970056008204EA /* c_org_ortc_ConstrainBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EF61E970056008204EA /* c_org_ortc_ConstrainBoolean.cpp */; }; + 002170301E970056008204EA /* c_org_ortc_ConstrainBoolean.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EF71E970056008204EA /* c_org_ortc_ConstrainBoolean.h */; }; + 002170311E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EF81E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */; }; + 002170321E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EF91E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.h */; }; + 002170331E970056008204EA /* c_org_ortc_ConstrainDouble.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EFA1E970056008204EA /* c_org_ortc_ConstrainDouble.cpp */; }; + 002170341E970056008204EA /* c_org_ortc_ConstrainDouble.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EFB1E970056008204EA /* c_org_ortc_ConstrainDouble.h */; }; + 002170351E970056008204EA /* c_org_ortc_ConstrainDoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EFC1E970056008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */; }; + 002170361E970056008204EA /* c_org_ortc_ConstrainDoubleRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EFD1E970056008204EA /* c_org_ortc_ConstrainDoubleRange.h */; }; + 002170371E970056008204EA /* c_org_ortc_ConstrainLong.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216EFE1E970056008204EA /* c_org_ortc_ConstrainLong.cpp */; }; + 002170381E970056008204EA /* c_org_ortc_ConstrainLong.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216EFF1E970056008204EA /* c_org_ortc_ConstrainLong.h */; }; + 002170391E970056008204EA /* c_org_ortc_ConstrainLongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F001E970056008204EA /* c_org_ortc_ConstrainLongRange.cpp */; }; + 0021703A1E970056008204EA /* c_org_ortc_ConstrainLongRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F011E970056008204EA /* c_org_ortc_ConstrainLongRange.h */; }; + 0021703B1E970056008204EA /* c_org_ortc_ConstrainString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F021E970056008204EA /* c_org_ortc_ConstrainString.cpp */; }; + 0021703C1E970056008204EA /* c_org_ortc_ConstrainString.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F031E970056008204EA /* c_org_ortc_ConstrainString.h */; }; + 0021703D1E970056008204EA /* c_org_ortc_ConstrainStringParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F041E970056008204EA /* c_org_ortc_ConstrainStringParameters.cpp */; }; + 0021703E1E970056008204EA /* c_org_ortc_ConstrainStringParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F051E970056008204EA /* c_org_ortc_ConstrainStringParameters.h */; }; + 0021703F1E970056008204EA /* c_org_ortc_DoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F061E970056008204EA /* c_org_ortc_DoubleRange.cpp */; }; + 002170401E970056008204EA /* c_org_ortc_DoubleRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F071E970056008204EA /* c_org_ortc_DoubleRange.h */; }; + 002170411E970056008204EA /* c_org_ortc_Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F081E970056008204EA /* c_org_ortc_Error.cpp */; }; + 002170421E970056008204EA /* c_org_ortc_Error.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F091E970056008204EA /* c_org_ortc_Error.h */; }; + 002170431E970056008204EA /* c_org_ortc_ErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F0A1E970056008204EA /* c_org_ortc_ErrorEvent.cpp */; }; + 002170441E970056008204EA /* c_org_ortc_ErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F0B1E970056008204EA /* c_org_ortc_ErrorEvent.h */; }; + 002170451E970056008204EA /* c_org_ortc_Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F0C1E970056008204EA /* c_org_ortc_Json.cpp */; }; + 002170461E970056008204EA /* c_org_ortc_Json.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F0D1E970056008204EA /* c_org_ortc_Json.h */; }; + 002170471E970056008204EA /* c_org_ortc_Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F0E1E970056008204EA /* c_org_ortc_Logger.cpp */; }; + 002170481E970056008204EA /* c_org_ortc_Logger.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F0F1E970056008204EA /* c_org_ortc_Logger.h */; }; + 002170491E970056008204EA /* c_org_ortc_LongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F101E970056008204EA /* c_org_ortc_LongRange.cpp */; }; + 0021704A1E970056008204EA /* c_org_ortc_LongRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F111E970056008204EA /* c_org_ortc_LongRange.h */; }; + 0021704B1E970056008204EA /* c_org_ortc_MediaControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F121E970056008204EA /* c_org_ortc_MediaControl.cpp */; }; + 0021704C1E970056008204EA /* c_org_ortc_MediaControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F131E970056008204EA /* c_org_ortc_MediaControl.h */; }; + 0021704D1E970056008204EA /* c_org_ortc_MediaDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F141E970056008204EA /* c_org_ortc_MediaDeviceInfo.cpp */; }; + 0021704E1E970056008204EA /* c_org_ortc_MediaDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F151E970056008204EA /* c_org_ortc_MediaDeviceInfo.h */; }; + 0021704F1E970056008204EA /* c_org_ortc_MediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F161E970056008204EA /* c_org_ortc_MediaDevices.cpp */; }; + 002170501E970056008204EA /* c_org_ortc_MediaDevices.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F171E970056008204EA /* c_org_ortc_MediaDevices.h */; }; + 002170511E970056008204EA /* c_org_ortc_MediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F181E970056008204EA /* c_org_ortc_MediaSource.cpp */; }; + 002170521E970056008204EA /* c_org_ortc_MediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F191E970056008204EA /* c_org_ortc_MediaSource.h */; }; + 002170531E970056008204EA /* c_org_ortc_MediaStreamConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F1A1E970056008204EA /* c_org_ortc_MediaStreamConstraints.cpp */; }; + 002170541E970056008204EA /* c_org_ortc_MediaStreamConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F1B1E970056008204EA /* c_org_ortc_MediaStreamConstraints.h */; }; + 002170551E970056008204EA /* c_org_ortc_MediaStreamTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F1C1E970056008204EA /* c_org_ortc_MediaStreamTrack.cpp */; }; + 002170561E970056008204EA /* c_org_ortc_MediaStreamTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F1D1E970056008204EA /* c_org_ortc_MediaStreamTrack.h */; }; + 002170571E970056008204EA /* c_org_ortc_MediaTrackCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F1E1E970056008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */; }; + 002170581E970056008204EA /* c_org_ortc_MediaTrackCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F1F1E970056008204EA /* c_org_ortc_MediaTrackCapabilities.h */; }; + 002170591E970056008204EA /* c_org_ortc_MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F201E970056008204EA /* c_org_ortc_MediaTrackConstraints.cpp */; }; + 0021705A1E970056008204EA /* c_org_ortc_MediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F211E970056008204EA /* c_org_ortc_MediaTrackConstraints.h */; }; + 0021705B1E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F221E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */; }; + 0021705C1E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F231E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.h */; }; + 0021705D1E970056008204EA /* c_org_ortc_MediaTrackSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F241E970056008204EA /* c_org_ortc_MediaTrackSettings.cpp */; }; + 0021705E1E970056008204EA /* c_org_ortc_MediaTrackSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F251E970056008204EA /* c_org_ortc_MediaTrackSettings.h */; }; + 0021705F1E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F261E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */; }; + 002170601E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F271E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h */; }; + 002170611E970056008204EA /* c_org_ortc_MessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F281E970056008204EA /* c_org_ortc_MessageQueue.cpp */; }; + 002170621E970056008204EA /* c_org_ortc_MessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F291E970056008204EA /* c_org_ortc_MessageQueue.h */; }; + 002170631E970056008204EA /* c_org_ortc_OrtcLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F2A1E970056008204EA /* c_org_ortc_OrtcLib.cpp */; }; + 002170641E970056008204EA /* c_org_ortc_OrtcLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F2B1E970056008204EA /* c_org_ortc_OrtcLib.h */; }; + 002170651E970056008204EA /* c_org_ortc_OverconstrainedError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F2C1E970056008204EA /* c_org_ortc_OverconstrainedError.cpp */; }; + 002170661E970056008204EA /* c_org_ortc_OverconstrainedError.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F2D1E970056008204EA /* c_org_ortc_OverconstrainedError.h */; }; + 002170671E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F2E1E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */; }; + 002170681E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F2F1E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.h */; }; + 002170691E970056008204EA /* c_org_ortc_RTCCertificate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F301E970056008204EA /* c_org_ortc_RTCCertificate.cpp */; }; + 0021706A1E970056008204EA /* c_org_ortc_RTCCertificate.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F311E970056008204EA /* c_org_ortc_RTCCertificate.h */; }; + 0021706B1E970056008204EA /* c_org_ortc_RTCCertificateStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F321E970056008204EA /* c_org_ortc_RTCCertificateStats.cpp */; }; + 0021706C1E970056008204EA /* c_org_ortc_RTCCertificateStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F331E970056008204EA /* c_org_ortc_RTCCertificateStats.h */; }; + 0021706D1E970056008204EA /* c_org_ortc_RTCCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F341E970056008204EA /* c_org_ortc_RTCCodec.cpp */; }; + 0021706E1E970056008204EA /* c_org_ortc_RTCCodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F351E970056008204EA /* c_org_ortc_RTCCodec.h */; }; + 0021706F1E970056008204EA /* c_org_ortc_RTCDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F361E970056008204EA /* c_org_ortc_RTCDataChannel.cpp */; }; + 002170701E970056008204EA /* c_org_ortc_RTCDataChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F371E970056008204EA /* c_org_ortc_RTCDataChannel.h */; }; + 002170711E970056008204EA /* c_org_ortc_RTCDataChannelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F381E970056008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */; }; + 002170721E970056008204EA /* c_org_ortc_RTCDataChannelEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F391E970056008204EA /* c_org_ortc_RTCDataChannelEvent.h */; }; + 002170731E970056008204EA /* c_org_ortc_RTCDataChannelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F3A1E970056008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */; }; + 002170741E970056008204EA /* c_org_ortc_RTCDataChannelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F3B1E970056008204EA /* c_org_ortc_RTCDataChannelParameters.h */; }; + 002170751E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F3C1E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */; }; + 002170761E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F3D1E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h */; }; + 002170771E970056008204EA /* c_org_ortc_RTCDataChannelStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F3E1E970056008204EA /* c_org_ortc_RTCDataChannelStats.cpp */; }; + 002170781E970056008204EA /* c_org_ortc_RTCDataChannelStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F3F1E970056008204EA /* c_org_ortc_RTCDataChannelStats.h */; }; + 002170791E970056008204EA /* c_org_ortc_RTCDataTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F401E970056008204EA /* c_org_ortc_RTCDataTransport.cpp */; }; + 0021707A1E970056008204EA /* c_org_ortc_RTCDataTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F411E970056008204EA /* c_org_ortc_RTCDataTransport.h */; }; + 0021707B1E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F421E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */; }; + 0021707C1E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F431E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h */; }; + 0021707D1E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F441E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */; }; + 0021707E1E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F451E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.h */; }; + 0021707F1E970056008204EA /* c_org_ortc_RTCDtlsParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F461E970056008204EA /* c_org_ortc_RTCDtlsParameters.cpp */; }; + 002170801E970056008204EA /* c_org_ortc_RTCDtlsParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F471E970056008204EA /* c_org_ortc_RTCDtlsParameters.h */; }; + 002170811E970056008204EA /* c_org_ortc_RTCDtlsTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F481E970056008204EA /* c_org_ortc_RTCDtlsTransport.cpp */; }; + 002170821E970056008204EA /* c_org_ortc_RTCDtlsTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F491E970056008204EA /* c_org_ortc_RTCDtlsTransport.h */; }; + 002170831E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F4A1E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */; }; + 002170841E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F4B1E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h */; }; + 002170851E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F4C1E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */; }; + 002170861E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F4D1E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.h */; }; + 002170871E970056008204EA /* c_org_ortc_RTCDtmfSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F4E1E970056008204EA /* c_org_ortc_RTCDtmfSender.cpp */; }; + 002170881E970056008204EA /* c_org_ortc_RTCDtmfSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F4F1E970056008204EA /* c_org_ortc_RTCDtmfSender.h */; }; + 002170891E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F501E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */; }; + 0021708A1E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F511E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h */; }; + 0021708B1E970056008204EA /* c_org_ortc_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F521E970056008204EA /* c_org_ortc_RTCIceCandidate.cpp */; }; + 0021708C1E970056008204EA /* c_org_ortc_RTCIceCandidate.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F531E970056008204EA /* c_org_ortc_RTCIceCandidate.h */; }; + 0021708D1E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F541E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */; }; + 0021708E1E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F551E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.h */; }; + 0021708F1E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F561E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */; }; + 002170901E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F571E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.h */; }; + 002170911E970056008204EA /* c_org_ortc_RTCIceCandidatePair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F581E970056008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */; }; + 002170921E970056008204EA /* c_org_ortc_RTCIceCandidatePair.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F591E970056008204EA /* c_org_ortc_RTCIceCandidatePair.h */; }; + 002170931E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F5A1E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */; }; + 002170941E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F5B1E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h */; }; + 002170951E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F5C1E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */; }; + 002170961E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F5D1E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.h */; }; + 002170971E970056008204EA /* c_org_ortc_RTCIceGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F5E1E970056008204EA /* c_org_ortc_RTCIceGatherer.cpp */; }; + 002170981E970056008204EA /* c_org_ortc_RTCIceGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F5F1E970056008204EA /* c_org_ortc_RTCIceGatherer.h */; }; + 002170991E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F601E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */; }; + 0021709A1E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F611E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.h */; }; + 0021709B1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F621E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */; }; + 0021709C1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F631E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h */; }; + 0021709D1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F641E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */; }; + 0021709E1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F651E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h */; }; + 0021709F1E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F661E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */; }; + 002170A01E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F671E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h */; }; + 002170A11E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F681E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */; }; + 002170A21E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F691E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h */; }; + 002170A31E970056008204EA /* c_org_ortc_RTCIceGathererStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F6A1E970056008204EA /* c_org_ortc_RTCIceGathererStats.cpp */; }; + 002170A41E970056008204EA /* c_org_ortc_RTCIceGathererStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F6B1E970056008204EA /* c_org_ortc_RTCIceGathererStats.h */; }; + 002170A51E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F6C1E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */; }; + 002170A61E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F6D1E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h */; }; + 002170A71E970056008204EA /* c_org_ortc_RTCIceGatherOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F6E1E970056008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */; }; + 002170A81E970056008204EA /* c_org_ortc_RTCIceGatherOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F6F1E970056008204EA /* c_org_ortc_RTCIceGatherOptions.h */; }; + 002170A91E970056008204EA /* c_org_ortc_RTCIceParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F701E970056008204EA /* c_org_ortc_RTCIceParameters.cpp */; }; + 002170AA1E970056008204EA /* c_org_ortc_RTCIceParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F711E970056008204EA /* c_org_ortc_RTCIceParameters.h */; }; + 002170AB1E970056008204EA /* c_org_ortc_RTCIceServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F721E970056008204EA /* c_org_ortc_RTCIceServer.cpp */; }; + 002170AC1E970056008204EA /* c_org_ortc_RTCIceServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F731E970056008204EA /* c_org_ortc_RTCIceServer.h */; }; + 002170AD1E970056008204EA /* c_org_ortc_RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F741E970056008204EA /* c_org_ortc_RTCIceTransport.cpp */; }; + 002170AE1E970056008204EA /* c_org_ortc_RTCIceTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F751E970056008204EA /* c_org_ortc_RTCIceTransport.h */; }; + 002170AF1E970056008204EA /* c_org_ortc_RTCIceTransportController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F761E970056008204EA /* c_org_ortc_RTCIceTransportController.cpp */; }; + 002170B01E970056008204EA /* c_org_ortc_RTCIceTransportController.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F771E970056008204EA /* c_org_ortc_RTCIceTransportController.h */; }; + 002170B11E970056008204EA /* c_org_ortc_RTCIceTransportOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F781E970056008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */; }; + 002170B21E970056008204EA /* c_org_ortc_RTCIceTransportOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F791E970056008204EA /* c_org_ortc_RTCIceTransportOptions.h */; }; + 002170B31E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F7A1E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */; }; + 002170B41E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F7B1E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h */; }; + 002170B51E970056008204EA /* c_org_ortc_RTCIceTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F7C1E970056008204EA /* c_org_ortc_RTCIceTransportStats.cpp */; }; + 002170B61E970056008204EA /* c_org_ortc_RTCIceTransportStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F7D1E970056008204EA /* c_org_ortc_RTCIceTransportStats.h */; }; + 002170B71E970056008204EA /* c_org_ortc_RTCIdentity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F7E1E970056008204EA /* c_org_ortc_RTCIdentity.cpp */; }; + 002170B81E970056008204EA /* c_org_ortc_RTCIdentity.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F7F1E970056008204EA /* c_org_ortc_RTCIdentity.h */; }; + 002170B91E970056008204EA /* c_org_ortc_RTCIdentityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F801E970056008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */; }; + 002170BA1E970056008204EA /* c_org_ortc_RTCIdentityAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F811E970056008204EA /* c_org_ortc_RTCIdentityAssertion.h */; }; + 002170BB1E970056008204EA /* c_org_ortc_RTCIdentityError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F821E970056008204EA /* c_org_ortc_RTCIdentityError.cpp */; }; + 002170BC1E970056008204EA /* c_org_ortc_RTCIdentityError.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F831E970056008204EA /* c_org_ortc_RTCIdentityError.h */; }; + 002170BD1E970056008204EA /* c_org_ortc_RTCIdentityResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F841E970056008204EA /* c_org_ortc_RTCIdentityResult.cpp */; }; + 002170BE1E970056008204EA /* c_org_ortc_RTCIdentityResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F851E970056008204EA /* c_org_ortc_RTCIdentityResult.h */; }; + 002170BF1E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F861E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */; }; + 002170C01E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F871E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h */; }; + 002170C11E970056008204EA /* c_org_ortc_RTCMediaStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F881E970056008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */; }; + 002170C21E970056008204EA /* c_org_ortc_RTCMediaStreamStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F891E970056008204EA /* c_org_ortc_RTCMediaStreamStats.h */; }; + 002170C31E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F8A1E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */; }; + 002170C41E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F8B1E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h */; }; + 002170C51E970056008204EA /* c_org_ortc_RTCMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F8C1E970056008204EA /* c_org_ortc_RTCMessageEvent.cpp */; }; + 002170C61E970056008204EA /* c_org_ortc_RTCMessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F8D1E970056008204EA /* c_org_ortc_RTCMessageEvent.h */; }; + 002170C71E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F8E1E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */; }; + 002170C81E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F8F1E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h */; }; + 002170C91E970056008204EA /* c_org_ortc_RTCRtcpFeedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F901E970056008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */; }; + 002170CA1E970056008204EA /* c_org_ortc_RTCRtcpFeedback.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F911E970056008204EA /* c_org_ortc_RTCRtcpFeedback.h */; }; + 002170CB1E970056008204EA /* c_org_ortc_RTCRtcpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F921E970056008204EA /* c_org_ortc_RTCRtcpParameters.cpp */; }; + 002170CC1E970056008204EA /* c_org_ortc_RTCRtcpParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F931E970056008204EA /* c_org_ortc_RTCRtcpParameters.h */; }; + 002170CD1E970056008204EA /* c_org_ortc_RTCRtcpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F941E970056008204EA /* c_org_ortc_RTCRtcpTransport.cpp */; }; + 002170CE1E970056008204EA /* c_org_ortc_RTCRtcpTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F951E970056008204EA /* c_org_ortc_RTCRtcpTransport.h */; }; + 002170CF1E970056008204EA /* c_org_ortc_RTCRtpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F961E970056008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */; }; + 002170D01E970056008204EA /* c_org_ortc_RTCRtpCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F971E970056008204EA /* c_org_ortc_RTCRtpCapabilities.h */; }; + 002170D11E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F981E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */; }; + 002170D21E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F991E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.h */; }; + 002170D31E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F9A1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */; }; + 002170D41E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F9B1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h */; }; + 002170D51E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F9C1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */; }; + 002170D61E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F9D1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h */; }; + 002170D71E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216F9E1E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */; }; + 002170D81E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216F9F1E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.h */; }; + 002170D91E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FA01E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */; }; + 002170DA1E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FA11E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h */; }; + 002170DB1E970056008204EA /* c_org_ortc_RTCRtpContributingSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FA21E970056008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */; }; + 002170DC1E970056008204EA /* c_org_ortc_RTCRtpContributingSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FA31E970056008204EA /* c_org_ortc_RTCRtpContributingSource.h */; }; + 002170DD1E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FA41E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */; }; + 002170DE1E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FA51E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.h */; }; + 002170DF1E970056008204EA /* c_org_ortc_RTCRtpFecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FA61E970056008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */; }; + 002170E01E970056008204EA /* c_org_ortc_RTCRtpFecParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FA71E970056008204EA /* c_org_ortc_RTCRtpFecParameters.h */; }; + 002170E11E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FA81E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */; }; + 002170E21E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FA91E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */; }; + 002170E31E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FAA1E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */; }; + 002170E41E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FAB1E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */; }; + 002170E51E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FAC1E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */; }; + 002170E61E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FAD1E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h */; }; + 002170E71E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FAE1E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */; }; + 002170E81E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FAF1E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h */; }; + 002170E91E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FB01E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */; }; + 002170EA1E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FB11E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.h */; }; + 002170EB1E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FB21E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */; }; + 002170EC1E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FB31E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h */; }; + 002170ED1E970056008204EA /* c_org_ortc_RTCRtpListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FB41E970056008204EA /* c_org_ortc_RTCRtpListener.cpp */; }; + 002170EE1E970056008204EA /* c_org_ortc_RTCRtpListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FB51E970056008204EA /* c_org_ortc_RTCRtpListener.h */; }; + 002170EF1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FB61E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */; }; + 002170F01E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FB71E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */; }; + 002170F11E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FB81E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */; }; + 002170F21E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FB91E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */; }; + 002170F31E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FBA1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */; }; + 002170F41E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FBB1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h */; }; + 002170F51E970056008204EA /* c_org_ortc_RTCRtpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FBC1E970056008204EA /* c_org_ortc_RTCRtpParameters.cpp */; }; + 002170F61E970056008204EA /* c_org_ortc_RTCRtpParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FBD1E970056008204EA /* c_org_ortc_RTCRtpParameters.h */; }; + 002170F71E970056008204EA /* c_org_ortc_RTCRtpReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FBE1E970056008204EA /* c_org_ortc_RTCRtpReceiver.cpp */; }; + 002170F81E970056008204EA /* c_org_ortc_RTCRtpReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FBF1E970056008204EA /* c_org_ortc_RTCRtpReceiver.h */; }; + 002170F91E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FC01E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */; }; + 002170FA1E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FC11E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h */; }; + 002170FB1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FC21E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */; }; + 002170FC1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FC31E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */; }; + 002170FD1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FC41E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */; }; + 002170FE1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FC51E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h */; }; + 002170FF1E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FC61E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */; }; + 002171001E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FC71E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.h */; }; + 002171011E970056008204EA /* c_org_ortc_RTCRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FC81E970056008204EA /* c_org_ortc_RTCRtpSender.cpp */; }; + 002171021E970056008204EA /* c_org_ortc_RTCRtpSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FC91E970056008204EA /* c_org_ortc_RTCRtpSender.h */; }; + 002171031E970056008204EA /* c_org_ortc_RTCRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FCA1E970056008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */; }; + 002171041E970056008204EA /* c_org_ortc_RTCRtpStreamStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FCB1E970056008204EA /* c_org_ortc_RTCRtpStreamStats.h */; }; + 002171051E970056008204EA /* c_org_ortc_RTCRtpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FCC1E970056008204EA /* c_org_ortc_RTCRtpTransport.cpp */; }; + 002171061E970056008204EA /* c_org_ortc_RTCRtpTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FCD1E970056008204EA /* c_org_ortc_RTCRtpTransport.h */; }; + 002171071E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FCE1E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */; }; + 002171081E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FCF1E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h */; }; + 002171091E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FD01E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */; }; + 0021710A1E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FD11E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */; }; + 0021710B1E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FD21E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */; }; + 0021710C1E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FD31E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h */; }; + 0021710D1E970056008204EA /* c_org_ortc_RTCSctpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FD41E970056008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */; }; + 0021710E1E970056008204EA /* c_org_ortc_RTCSctpCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FD51E970056008204EA /* c_org_ortc_RTCSctpCapabilities.h */; }; + 0021710F1E970056008204EA /* c_org_ortc_RTCSctpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FD61E970056008204EA /* c_org_ortc_RTCSctpTransport.cpp */; }; + 002171101E970056008204EA /* c_org_ortc_RTCSctpTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FD71E970056008204EA /* c_org_ortc_RTCSctpTransport.h */; }; + 002171111E970056008204EA /* c_org_ortc_RTCSctpTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FD81E970056008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */; }; + 002171121E970056008204EA /* c_org_ortc_RTCSctpTransportListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FD91E970056008204EA /* c_org_ortc_RTCSctpTransportListener.h */; }; + 002171131E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FDA1E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */; }; + 002171141E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FDB1E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h */; }; + 002171151E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FDC1E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */; }; + 002171161E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FDD1E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h */; }; + 002171171E970056008204EA /* c_org_ortc_RTCSctpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FDE1E970056008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */; }; + 002171181E970056008204EA /* c_org_ortc_RTCSctpTransportStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FDF1E970056008204EA /* c_org_ortc_RTCSctpTransportStats.h */; }; + 002171191E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FE01E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */; }; + 0021711A1E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FE11E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h */; }; + 0021711B1E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FE21E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */; }; + 0021711C1E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FE31E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h */; }; + 0021711D1E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FE41E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */; }; + 0021711E1E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FE51E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.h */; }; + 0021711F1E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FE61E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */; }; + 002171201E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FE71E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.h */; }; + 002171211E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FE81E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */; }; + 002171221E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FE91E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */; }; + 002171231E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FEA1E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */; }; + 002171241E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FEB1E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.h */; }; + 002171251E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FEC1E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */; }; + 002171261E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FED1E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.h */; }; + 002171271E970056008204EA /* c_org_ortc_RTCStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FEE1E970056008204EA /* c_org_ortc_RTCStats.cpp */; }; + 002171281E970056008204EA /* c_org_ortc_RTCStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FEF1E970056008204EA /* c_org_ortc_RTCStats.h */; }; + 002171291E970056008204EA /* c_org_ortc_RTCStatsProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FF01E970056008204EA /* c_org_ortc_RTCStatsProvider.cpp */; }; + 0021712A1E970056008204EA /* c_org_ortc_RTCStatsProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FF11E970056008204EA /* c_org_ortc_RTCStatsProvider.h */; }; + 0021712B1E970056008204EA /* c_org_ortc_RTCStatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FF21E970056008204EA /* c_org_ortc_RTCStatsReport.cpp */; }; + 0021712C1E970056008204EA /* c_org_ortc_RTCStatsReport.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FF31E970056008204EA /* c_org_ortc_RTCStatsReport.h */; }; + 0021712D1E970056008204EA /* c_org_ortc_RTCStatsTypeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FF41E970056008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */; }; + 0021712E1E970056008204EA /* c_org_ortc_RTCStatsTypeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FF51E970056008204EA /* c_org_ortc_RTCStatsTypeSet.h */; }; + 0021712F1E970056008204EA /* c_org_ortc_Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FF61E970056008204EA /* c_org_ortc_Settings.cpp */; }; + 002171301E970056008204EA /* c_org_ortc_Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FF71E970056008204EA /* c_org_ortc_Settings.h */; }; + 002171311E970056008204EA /* c_org_ortc_StringOrStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00216FF81E970056008204EA /* c_org_ortc_StringOrStringList.cpp */; }; + 002171321E970056008204EA /* c_org_ortc_StringOrStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FF91E970056008204EA /* c_org_ortc_StringOrStringList.h */; }; + 002171331E970056008204EA /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 00216FFA1E970056008204EA /* types.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 00216EBA1E970020008204EA /* libortclib-c-osx.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libortclib-c-osx.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + 00216EC21E970056008204EA /* c_helpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_helpers.cpp; sourceTree = ""; }; + 00216EC31E970056008204EA /* c_helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_helpers.h; sourceTree = ""; }; + 00216EC41E970056008204EA /* c_org_ortc_adapter_MediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_MediaStream.cpp; sourceTree = ""; }; + 00216EC51E970056008204EA /* c_org_ortc_adapter_MediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_MediaStream.h; sourceTree = ""; }; + 00216EC61E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCAnswerOptions.cpp; sourceTree = ""; }; + 00216EC71E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCAnswerOptions.h; sourceTree = ""; }; + 00216EC81E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCCapabilityOptions.cpp; sourceTree = ""; }; + 00216EC91E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCCapabilityOptions.h; sourceTree = ""; }; + 00216ECA1E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCConfiguration.cpp; sourceTree = ""; }; + 00216ECB1E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCConfiguration.h; sourceTree = ""; }; + 00216ECC1E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCIceCandidate.cpp; sourceTree = ""; }; + 00216ECD1E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCIceCandidate.h; sourceTree = ""; }; + 00216ECE1E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp; sourceTree = ""; }; + 00216ECF1E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h; sourceTree = ""; }; + 00216ED01E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCOfferAnswerOptions.cpp; sourceTree = ""; }; + 00216ED11E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCOfferAnswerOptions.h; sourceTree = ""; }; + 00216ED21E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCOfferOptions.cpp; sourceTree = ""; }; + 00216ED31E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCOfferOptions.h; sourceTree = ""; }; + 00216ED41E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCPeerConnection.cpp; sourceTree = ""; }; + 00216ED51E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCPeerConnection.h; sourceTree = ""; }; + 00216ED61E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp; sourceTree = ""; }; + 00216ED71E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h; sourceTree = ""; }; + 00216ED81E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp; sourceTree = ""; }; + 00216ED91E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCPeerConnectionIceEvent.h; sourceTree = ""; }; + 00216EDA1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescription.cpp; sourceTree = ""; }; + 00216EDB1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescription.h; sourceTree = ""; }; + 00216EDC1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp; sourceTree = ""; }; + 00216EDD1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h; sourceTree = ""; }; + 00216EDE1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp; sourceTree = ""; }; + 00216EDF1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h; sourceTree = ""; }; + 00216EE01E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp; sourceTree = ""; }; + 00216EE11E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionDescription.h; sourceTree = ""; }; + 00216EE21E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp; sourceTree = ""; }; + 00216EE31E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h; sourceTree = ""; }; + 00216EE41E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp; sourceTree = ""; }; + 00216EE51E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h; sourceTree = ""; }; + 00216EE61E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp; sourceTree = ""; }; + 00216EE71E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h; sourceTree = ""; }; + 00216EE81E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp; sourceTree = ""; }; + 00216EE91E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h; sourceTree = ""; }; + 00216EEA1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp; sourceTree = ""; }; + 00216EEB1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h; sourceTree = ""; }; + 00216EEC1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp; sourceTree = ""; }; + 00216EED1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h; sourceTree = ""; }; + 00216EEE1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp; sourceTree = ""; }; + 00216EEF1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h; sourceTree = ""; }; + 00216EF01E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp; sourceTree = ""; }; + 00216EF11E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionTransport.h; sourceTree = ""; }; + 00216EF21E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp; sourceTree = ""; }; + 00216EF31E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h; sourceTree = ""; }; + 00216EF41E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_adapter_RTCTrackEvent.cpp; sourceTree = ""; }; + 00216EF51E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_adapter_RTCTrackEvent.h; sourceTree = ""; }; + 00216EF61E970056008204EA /* c_org_ortc_ConstrainBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainBoolean.cpp; sourceTree = ""; }; + 00216EF71E970056008204EA /* c_org_ortc_ConstrainBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainBoolean.h; sourceTree = ""; }; + 00216EF81E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainBooleanParameters.cpp; sourceTree = ""; }; + 00216EF91E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainBooleanParameters.h; sourceTree = ""; }; + 00216EFA1E970056008204EA /* c_org_ortc_ConstrainDouble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainDouble.cpp; sourceTree = ""; }; + 00216EFB1E970056008204EA /* c_org_ortc_ConstrainDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainDouble.h; sourceTree = ""; }; + 00216EFC1E970056008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainDoubleRange.cpp; sourceTree = ""; }; + 00216EFD1E970056008204EA /* c_org_ortc_ConstrainDoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainDoubleRange.h; sourceTree = ""; }; + 00216EFE1E970056008204EA /* c_org_ortc_ConstrainLong.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainLong.cpp; sourceTree = ""; }; + 00216EFF1E970056008204EA /* c_org_ortc_ConstrainLong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainLong.h; sourceTree = ""; }; + 00216F001E970056008204EA /* c_org_ortc_ConstrainLongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainLongRange.cpp; sourceTree = ""; }; + 00216F011E970056008204EA /* c_org_ortc_ConstrainLongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainLongRange.h; sourceTree = ""; }; + 00216F021E970056008204EA /* c_org_ortc_ConstrainString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainString.cpp; sourceTree = ""; }; + 00216F031E970056008204EA /* c_org_ortc_ConstrainString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainString.h; sourceTree = ""; }; + 00216F041E970056008204EA /* c_org_ortc_ConstrainStringParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ConstrainStringParameters.cpp; sourceTree = ""; }; + 00216F051E970056008204EA /* c_org_ortc_ConstrainStringParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ConstrainStringParameters.h; sourceTree = ""; }; + 00216F061E970056008204EA /* c_org_ortc_DoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_DoubleRange.cpp; sourceTree = ""; }; + 00216F071E970056008204EA /* c_org_ortc_DoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_DoubleRange.h; sourceTree = ""; }; + 00216F081E970056008204EA /* c_org_ortc_Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Error.cpp; sourceTree = ""; }; + 00216F091E970056008204EA /* c_org_ortc_Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Error.h; sourceTree = ""; }; + 00216F0A1E970056008204EA /* c_org_ortc_ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_ErrorEvent.cpp; sourceTree = ""; }; + 00216F0B1E970056008204EA /* c_org_ortc_ErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_ErrorEvent.h; sourceTree = ""; }; + 00216F0C1E970056008204EA /* c_org_ortc_Json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Json.cpp; sourceTree = ""; }; + 00216F0D1E970056008204EA /* c_org_ortc_Json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Json.h; sourceTree = ""; }; + 00216F0E1E970056008204EA /* c_org_ortc_Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Logger.cpp; sourceTree = ""; }; + 00216F0F1E970056008204EA /* c_org_ortc_Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Logger.h; sourceTree = ""; }; + 00216F101E970056008204EA /* c_org_ortc_LongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_LongRange.cpp; sourceTree = ""; }; + 00216F111E970056008204EA /* c_org_ortc_LongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_LongRange.h; sourceTree = ""; }; + 00216F121E970056008204EA /* c_org_ortc_MediaControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaControl.cpp; sourceTree = ""; }; + 00216F131E970056008204EA /* c_org_ortc_MediaControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaControl.h; sourceTree = ""; }; + 00216F141E970056008204EA /* c_org_ortc_MediaDeviceInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaDeviceInfo.cpp; sourceTree = ""; }; + 00216F151E970056008204EA /* c_org_ortc_MediaDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaDeviceInfo.h; sourceTree = ""; }; + 00216F161E970056008204EA /* c_org_ortc_MediaDevices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaDevices.cpp; sourceTree = ""; }; + 00216F171E970056008204EA /* c_org_ortc_MediaDevices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaDevices.h; sourceTree = ""; }; + 00216F181E970056008204EA /* c_org_ortc_MediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaSource.cpp; sourceTree = ""; }; + 00216F191E970056008204EA /* c_org_ortc_MediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaSource.h; sourceTree = ""; }; + 00216F1A1E970056008204EA /* c_org_ortc_MediaStreamConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaStreamConstraints.cpp; sourceTree = ""; }; + 00216F1B1E970056008204EA /* c_org_ortc_MediaStreamConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaStreamConstraints.h; sourceTree = ""; }; + 00216F1C1E970056008204EA /* c_org_ortc_MediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaStreamTrack.cpp; sourceTree = ""; }; + 00216F1D1E970056008204EA /* c_org_ortc_MediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaStreamTrack.h; sourceTree = ""; }; + 00216F1E1E970056008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackCapabilities.cpp; sourceTree = ""; }; + 00216F1F1E970056008204EA /* c_org_ortc_MediaTrackCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackCapabilities.h; sourceTree = ""; }; + 00216F201E970056008204EA /* c_org_ortc_MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackConstraints.cpp; sourceTree = ""; }; + 00216F211E970056008204EA /* c_org_ortc_MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackConstraints.h; sourceTree = ""; }; + 00216F221E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackConstraintSet.cpp; sourceTree = ""; }; + 00216F231E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackConstraintSet.h; sourceTree = ""; }; + 00216F241E970056008204EA /* c_org_ortc_MediaTrackSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackSettings.cpp; sourceTree = ""; }; + 00216F251E970056008204EA /* c_org_ortc_MediaTrackSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackSettings.h; sourceTree = ""; }; + 00216F261E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MediaTrackSupportedConstraints.cpp; sourceTree = ""; }; + 00216F271E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MediaTrackSupportedConstraints.h; sourceTree = ""; }; + 00216F281E970056008204EA /* c_org_ortc_MessageQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_MessageQueue.cpp; sourceTree = ""; }; + 00216F291E970056008204EA /* c_org_ortc_MessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_MessageQueue.h; sourceTree = ""; }; + 00216F2A1E970056008204EA /* c_org_ortc_OrtcLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_OrtcLib.cpp; sourceTree = ""; }; + 00216F2B1E970056008204EA /* c_org_ortc_OrtcLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_OrtcLib.h; sourceTree = ""; }; + 00216F2C1E970056008204EA /* c_org_ortc_OverconstrainedError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_OverconstrainedError.cpp; sourceTree = ""; }; + 00216F2D1E970056008204EA /* c_org_ortc_OverconstrainedError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_OverconstrainedError.h; sourceTree = ""; }; + 00216F2E1E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_OverconstrainedErrorEvent.cpp; sourceTree = ""; }; + 00216F2F1E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_OverconstrainedErrorEvent.h; sourceTree = ""; }; + 00216F301E970056008204EA /* c_org_ortc_RTCCertificate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCCertificate.cpp; sourceTree = ""; }; + 00216F311E970056008204EA /* c_org_ortc_RTCCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCCertificate.h; sourceTree = ""; }; + 00216F321E970056008204EA /* c_org_ortc_RTCCertificateStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCCertificateStats.cpp; sourceTree = ""; }; + 00216F331E970056008204EA /* c_org_ortc_RTCCertificateStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCCertificateStats.h; sourceTree = ""; }; + 00216F341E970056008204EA /* c_org_ortc_RTCCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCCodec.cpp; sourceTree = ""; }; + 00216F351E970056008204EA /* c_org_ortc_RTCCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCCodec.h; sourceTree = ""; }; + 00216F361E970056008204EA /* c_org_ortc_RTCDataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannel.cpp; sourceTree = ""; }; + 00216F371E970056008204EA /* c_org_ortc_RTCDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannel.h; sourceTree = ""; }; + 00216F381E970056008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelEvent.cpp; sourceTree = ""; }; + 00216F391E970056008204EA /* c_org_ortc_RTCDataChannelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelEvent.h; sourceTree = ""; }; + 00216F3A1E970056008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelParameters.cpp; sourceTree = ""; }; + 00216F3B1E970056008204EA /* c_org_ortc_RTCDataChannelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelParameters.h; sourceTree = ""; }; + 00216F3C1E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelStateChangeEvent.cpp; sourceTree = ""; }; + 00216F3D1E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelStateChangeEvent.h; sourceTree = ""; }; + 00216F3E1E970056008204EA /* c_org_ortc_RTCDataChannelStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataChannelStats.cpp; sourceTree = ""; }; + 00216F3F1E970056008204EA /* c_org_ortc_RTCDataChannelStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataChannelStats.h; sourceTree = ""; }; + 00216F401E970056008204EA /* c_org_ortc_RTCDataTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDataTransport.cpp; sourceTree = ""; }; + 00216F411E970056008204EA /* c_org_ortc_RTCDataTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDataTransport.h; sourceTree = ""; }; + 00216F421E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsCertificateBinary.cpp; sourceTree = ""; }; + 00216F431E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsCertificateBinary.h; sourceTree = ""; }; + 00216F441E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsFingerprint.cpp; sourceTree = ""; }; + 00216F451E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsFingerprint.h; sourceTree = ""; }; + 00216F461E970056008204EA /* c_org_ortc_RTCDtlsParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsParameters.cpp; sourceTree = ""; }; + 00216F471E970056008204EA /* c_org_ortc_RTCDtlsParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsParameters.h; sourceTree = ""; }; + 00216F481E970056008204EA /* c_org_ortc_RTCDtlsTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsTransport.cpp; sourceTree = ""; }; + 00216F491E970056008204EA /* c_org_ortc_RTCDtlsTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsTransport.h; sourceTree = ""; }; + 00216F4A1E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00216F4B1E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsTransportStateChangeEvent.h; sourceTree = ""; }; + 00216F4C1E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtlsTransportStats.cpp; sourceTree = ""; }; + 00216F4D1E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtlsTransportStats.h; sourceTree = ""; }; + 00216F4E1E970056008204EA /* c_org_ortc_RTCDtmfSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtmfSender.cpp; sourceTree = ""; }; + 00216F4F1E970056008204EA /* c_org_ortc_RTCDtmfSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtmfSender.h; sourceTree = ""; }; + 00216F501E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCDtmfToneChangeEvent.cpp; sourceTree = ""; }; + 00216F511E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCDtmfToneChangeEvent.h; sourceTree = ""; }; + 00216F521E970056008204EA /* c_org_ortc_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidate.cpp; sourceTree = ""; }; + 00216F531E970056008204EA /* c_org_ortc_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidate.h; sourceTree = ""; }; + 00216F541E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidateAttributes.cpp; sourceTree = ""; }; + 00216F551E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidateAttributes.h; sourceTree = ""; }; + 00216F561E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidateComplete.cpp; sourceTree = ""; }; + 00216F571E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidateComplete.h; sourceTree = ""; }; + 00216F581E970056008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidatePair.cpp; sourceTree = ""; }; + 00216F591E970056008204EA /* c_org_ortc_RTCIceCandidatePair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidatePair.h; sourceTree = ""; }; + 00216F5A1E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidatePairChangeEvent.cpp; sourceTree = ""; }; + 00216F5B1E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidatePairChangeEvent.h; sourceTree = ""; }; + 00216F5C1E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceCandidatePairStats.cpp; sourceTree = ""; }; + 00216F5D1E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceCandidatePairStats.h; sourceTree = ""; }; + 00216F5E1E970056008204EA /* c_org_ortc_RTCIceGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGatherer.cpp; sourceTree = ""; }; + 00216F5F1E970056008204EA /* c_org_ortc_RTCIceGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGatherer.h; sourceTree = ""; }; + 00216F601E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererCandidate.cpp; sourceTree = ""; }; + 00216F611E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererCandidate.h; sourceTree = ""; }; + 00216F621E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp; sourceTree = ""; }; + 00216F631E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererCandidateCompleteEvent.h; sourceTree = ""; }; + 00216F641E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererCandidateEvent.cpp; sourceTree = ""; }; + 00216F651E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererCandidateEvent.h; sourceTree = ""; }; + 00216F661E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererIceErrorEvent.cpp; sourceTree = ""; }; + 00216F671E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererIceErrorEvent.h; sourceTree = ""; }; + 00216F681E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererStateChangeEvent.cpp; sourceTree = ""; }; + 00216F691E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererStateChangeEvent.h; sourceTree = ""; }; + 00216F6A1E970056008204EA /* c_org_ortc_RTCIceGathererStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGathererStats.cpp; sourceTree = ""; }; + 00216F6B1E970056008204EA /* c_org_ortc_RTCIceGathererStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGathererStats.h; sourceTree = ""; }; + 00216F6C1E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGatherInterfacePolicy.cpp; sourceTree = ""; }; + 00216F6D1E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGatherInterfacePolicy.h; sourceTree = ""; }; + 00216F6E1E970056008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceGatherOptions.cpp; sourceTree = ""; }; + 00216F6F1E970056008204EA /* c_org_ortc_RTCIceGatherOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceGatherOptions.h; sourceTree = ""; }; + 00216F701E970056008204EA /* c_org_ortc_RTCIceParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceParameters.cpp; sourceTree = ""; }; + 00216F711E970056008204EA /* c_org_ortc_RTCIceParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceParameters.h; sourceTree = ""; }; + 00216F721E970056008204EA /* c_org_ortc_RTCIceServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceServer.cpp; sourceTree = ""; }; + 00216F731E970056008204EA /* c_org_ortc_RTCIceServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceServer.h; sourceTree = ""; }; + 00216F741E970056008204EA /* c_org_ortc_RTCIceTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransport.cpp; sourceTree = ""; }; + 00216F751E970056008204EA /* c_org_ortc_RTCIceTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransport.h; sourceTree = ""; }; + 00216F761E970056008204EA /* c_org_ortc_RTCIceTransportController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportController.cpp; sourceTree = ""; }; + 00216F771E970056008204EA /* c_org_ortc_RTCIceTransportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportController.h; sourceTree = ""; }; + 00216F781E970056008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportOptions.cpp; sourceTree = ""; }; + 00216F791E970056008204EA /* c_org_ortc_RTCIceTransportOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportOptions.h; sourceTree = ""; }; + 00216F7A1E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00216F7B1E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportStateChangeEvent.h; sourceTree = ""; }; + 00216F7C1E970056008204EA /* c_org_ortc_RTCIceTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIceTransportStats.cpp; sourceTree = ""; }; + 00216F7D1E970056008204EA /* c_org_ortc_RTCIceTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIceTransportStats.h; sourceTree = ""; }; + 00216F7E1E970056008204EA /* c_org_ortc_RTCIdentity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentity.cpp; sourceTree = ""; }; + 00216F7F1E970056008204EA /* c_org_ortc_RTCIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentity.h; sourceTree = ""; }; + 00216F801E970056008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentityAssertion.cpp; sourceTree = ""; }; + 00216F811E970056008204EA /* c_org_ortc_RTCIdentityAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentityAssertion.h; sourceTree = ""; }; + 00216F821E970056008204EA /* c_org_ortc_RTCIdentityError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentityError.cpp; sourceTree = ""; }; + 00216F831E970056008204EA /* c_org_ortc_RTCIdentityError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentityError.h; sourceTree = ""; }; + 00216F841E970056008204EA /* c_org_ortc_RTCIdentityResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCIdentityResult.cpp; sourceTree = ""; }; + 00216F851E970056008204EA /* c_org_ortc_RTCIdentityResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCIdentityResult.h; sourceTree = ""; }; + 00216F861E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCInboundRtpStreamStats.cpp; sourceTree = ""; }; + 00216F871E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCInboundRtpStreamStats.h; sourceTree = ""; }; + 00216F881E970056008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCMediaStreamStats.cpp; sourceTree = ""; }; + 00216F891E970056008204EA /* c_org_ortc_RTCMediaStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCMediaStreamStats.h; sourceTree = ""; }; + 00216F8A1E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCMediaStreamTrackStats.cpp; sourceTree = ""; }; + 00216F8B1E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCMediaStreamTrackStats.h; sourceTree = ""; }; + 00216F8C1E970056008204EA /* c_org_ortc_RTCMessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCMessageEvent.cpp; sourceTree = ""; }; + 00216F8D1E970056008204EA /* c_org_ortc_RTCMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCMessageEvent.h; sourceTree = ""; }; + 00216F8E1E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCOutboundRtpStreamStats.cpp; sourceTree = ""; }; + 00216F8F1E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCOutboundRtpStreamStats.h; sourceTree = ""; }; + 00216F901E970056008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtcpFeedback.cpp; sourceTree = ""; }; + 00216F911E970056008204EA /* c_org_ortc_RTCRtcpFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtcpFeedback.h; sourceTree = ""; }; + 00216F921E970056008204EA /* c_org_ortc_RTCRtcpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtcpParameters.cpp; sourceTree = ""; }; + 00216F931E970056008204EA /* c_org_ortc_RTCRtcpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtcpParameters.h; sourceTree = ""; }; + 00216F941E970056008204EA /* c_org_ortc_RTCRtcpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtcpTransport.cpp; sourceTree = ""; }; + 00216F951E970056008204EA /* c_org_ortc_RTCRtcpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtcpTransport.h; sourceTree = ""; }; + 00216F961E970056008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCapabilities.cpp; sourceTree = ""; }; + 00216F971E970056008204EA /* c_org_ortc_RTCRtpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCapabilities.h; sourceTree = ""; }; + 00216F981E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecCapability.cpp; sourceTree = ""; }; + 00216F991E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecCapability.h; sourceTree = ""; }; + 00216F9A1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecCapabilityOptions.cpp; sourceTree = ""; }; + 00216F9B1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecCapabilityOptions.h; sourceTree = ""; }; + 00216F9C1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216F9D1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecCapabilityParameters.h; sourceTree = ""; }; + 00216F9E1E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecParameters.cpp; sourceTree = ""; }; + 00216F9F1E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecParameters.h; sourceTree = ""; }; + 00216FA01E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpCodecParameterSettings.cpp; sourceTree = ""; }; + 00216FA11E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpCodecParameterSettings.h; sourceTree = ""; }; + 00216FA21E970056008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpContributingSource.cpp; sourceTree = ""; }; + 00216FA31E970056008204EA /* c_org_ortc_RTCRtpContributingSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpContributingSource.h; sourceTree = ""; }; + 00216FA41E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpEncodingParameters.cpp; sourceTree = ""; }; + 00216FA51E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpEncodingParameters.h; sourceTree = ""; }; + 00216FA61E970056008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpFecParameters.cpp; sourceTree = ""; }; + 00216FA71E970056008204EA /* c_org_ortc_RTCRtpFecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpFecParameters.h; sourceTree = ""; }; + 00216FA81E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216FA91E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h; sourceTree = ""; }; + 00216FAA1E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp; sourceTree = ""; }; + 00216FAB1E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h; sourceTree = ""; }; + 00216FAC1E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216FAD1E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpH264CodecCapabilityParameters.h; sourceTree = ""; }; + 00216FAE1E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpH264CodecParameterSettings.cpp; sourceTree = ""; }; + 00216FAF1E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpH264CodecParameterSettings.h; sourceTree = ""; }; + 00216FB01E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpHeaderExtension.cpp; sourceTree = ""; }; + 00216FB11E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpHeaderExtension.h; sourceTree = ""; }; + 00216FB21E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpHeaderExtensionParameters.cpp; sourceTree = ""; }; + 00216FB31E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpHeaderExtensionParameters.h; sourceTree = ""; }; + 00216FB41E970056008204EA /* c_org_ortc_RTCRtpListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpListener.cpp; sourceTree = ""; }; + 00216FB51E970056008204EA /* c_org_ortc_RTCRtpListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpListener.h; sourceTree = ""; }; + 00216FB61E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp; sourceTree = ""; }; + 00216FB71E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h; sourceTree = ""; }; + 00216FB81E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216FB91E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h; sourceTree = ""; }; + 00216FBA1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp; sourceTree = ""; }; + 00216FBB1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpOpusCodecParameterSettings.h; sourceTree = ""; }; + 00216FBC1E970056008204EA /* c_org_ortc_RTCRtpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpParameters.cpp; sourceTree = ""; }; + 00216FBD1E970056008204EA /* c_org_ortc_RTCRtpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpParameters.h; sourceTree = ""; }; + 00216FBE1E970056008204EA /* c_org_ortc_RTCRtpReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpReceiver.cpp; sourceTree = ""; }; + 00216FBF1E970056008204EA /* c_org_ortc_RTCRtpReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpReceiver.h; sourceTree = ""; }; + 00216FC01E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRedCodecParameterSettings.cpp; sourceTree = ""; }; + 00216FC11E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRedCodecParameterSettings.h; sourceTree = ""; }; + 00216FC21E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216FC31E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h; sourceTree = ""; }; + 00216FC41E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp; sourceTree = ""; }; + 00216FC51E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRtxCodecParameterSettings.h; sourceTree = ""; }; + 00216FC61E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpRtxParameters.cpp; sourceTree = ""; }; + 00216FC71E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpRtxParameters.h; sourceTree = ""; }; + 00216FC81E970056008204EA /* c_org_ortc_RTCRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpSender.cpp; sourceTree = ""; }; + 00216FC91E970056008204EA /* c_org_ortc_RTCRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpSender.h; sourceTree = ""; }; + 00216FCA1E970056008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpStreamStats.cpp; sourceTree = ""; }; + 00216FCB1E970056008204EA /* c_org_ortc_RTCRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpStreamStats.h; sourceTree = ""; }; + 00216FCC1E970056008204EA /* c_org_ortc_RTCRtpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpTransport.cpp; sourceTree = ""; }; + 00216FCD1E970056008204EA /* c_org_ortc_RTCRtpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpTransport.h; sourceTree = ""; }; + 00216FCE1E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpUnhandledEvent.cpp; sourceTree = ""; }; + 00216FCF1E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpUnhandledEvent.h; sourceTree = ""; }; + 00216FD01E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp; sourceTree = ""; }; + 00216FD11E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h; sourceTree = ""; }; + 00216FD21E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp; sourceTree = ""; }; + 00216FD31E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCRtpVp8CodecParameterSettings.h; sourceTree = ""; }; + 00216FD41E970056008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpCapabilities.cpp; sourceTree = ""; }; + 00216FD51E970056008204EA /* c_org_ortc_RTCSctpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpCapabilities.h; sourceTree = ""; }; + 00216FD61E970056008204EA /* c_org_ortc_RTCSctpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransport.cpp; sourceTree = ""; }; + 00216FD71E970056008204EA /* c_org_ortc_RTCSctpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransport.h; sourceTree = ""; }; + 00216FD81E970056008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportListener.cpp; sourceTree = ""; }; + 00216FD91E970056008204EA /* c_org_ortc_RTCSctpTransportListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportListener.h; sourceTree = ""; }; + 00216FDA1E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportListenerEvent.cpp; sourceTree = ""; }; + 00216FDB1E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportListenerEvent.h; sourceTree = ""; }; + 00216FDC1E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00216FDD1E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportStateChangeEvent.h; sourceTree = ""; }; + 00216FDE1E970056008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSctpTransportStats.cpp; sourceTree = ""; }; + 00216FDF1E970056008204EA /* c_org_ortc_RTCSctpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSctpTransportStats.h; sourceTree = ""; }; + 00216FE01E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesCryptoParameters.cpp; sourceTree = ""; }; + 00216FE11E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesCryptoParameters.h; sourceTree = ""; }; + 00216FE21E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesKeyParameters.cpp; sourceTree = ""; }; + 00216FE31E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesKeyParameters.h; sourceTree = ""; }; + 00216FE41E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesParameters.cpp; sourceTree = ""; }; + 00216FE51E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesParameters.h; sourceTree = ""; }; + 00216FE61E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesTransport.cpp; sourceTree = ""; }; + 00216FE71E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesTransport.h; sourceTree = ""; }; + 00216FE81E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp; sourceTree = ""; }; + 00216FE91E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h; sourceTree = ""; }; + 00216FEA1E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSrtpTransportStats.cpp; sourceTree = ""; }; + 00216FEB1E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSrtpTransportStats.h; sourceTree = ""; }; + 00216FEC1E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCSsrcConflictEvent.cpp; sourceTree = ""; }; + 00216FED1E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCSsrcConflictEvent.h; sourceTree = ""; }; + 00216FEE1E970056008204EA /* c_org_ortc_RTCStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStats.cpp; sourceTree = ""; }; + 00216FEF1E970056008204EA /* c_org_ortc_RTCStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStats.h; sourceTree = ""; }; + 00216FF01E970056008204EA /* c_org_ortc_RTCStatsProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStatsProvider.cpp; sourceTree = ""; }; + 00216FF11E970056008204EA /* c_org_ortc_RTCStatsProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStatsProvider.h; sourceTree = ""; }; + 00216FF21E970056008204EA /* c_org_ortc_RTCStatsReport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStatsReport.cpp; sourceTree = ""; }; + 00216FF31E970056008204EA /* c_org_ortc_RTCStatsReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStatsReport.h; sourceTree = ""; }; + 00216FF41E970056008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_RTCStatsTypeSet.cpp; sourceTree = ""; }; + 00216FF51E970056008204EA /* c_org_ortc_RTCStatsTypeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_RTCStatsTypeSet.h; sourceTree = ""; }; + 00216FF61E970056008204EA /* c_org_ortc_Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_Settings.cpp; sourceTree = ""; }; + 00216FF71E970056008204EA /* c_org_ortc_Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_Settings.h; sourceTree = ""; }; + 00216FF81E970056008204EA /* c_org_ortc_StringOrStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = c_org_ortc_StringOrStringList.cpp; sourceTree = ""; }; + 00216FF91E970056008204EA /* c_org_ortc_StringOrStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_org_ortc_StringOrStringList.h; sourceTree = ""; }; + 00216FFA1E970056008204EA /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 00216EB71E970020008204EA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00216EB11E970020008204EA = { + isa = PBXGroup; + children = ( + 00216EC11E970056008204EA /* c */, + 00216EBB1E970020008204EA /* Products */, + ); + sourceTree = ""; + }; + 00216EBB1E970020008204EA /* Products */ = { + isa = PBXGroup; + children = ( + 00216EBA1E970020008204EA /* libortclib-c-osx.dylib */, + ); + name = Products; + sourceTree = ""; + }; + 00216EC11E970056008204EA /* c */ = { + isa = PBXGroup; + children = ( + 00216EC21E970056008204EA /* c_helpers.cpp */, + 00216EC31E970056008204EA /* c_helpers.h */, + 00216EC41E970056008204EA /* c_org_ortc_adapter_MediaStream.cpp */, + 00216EC51E970056008204EA /* c_org_ortc_adapter_MediaStream.h */, + 00216EC61E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp */, + 00216EC71E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h */, + 00216EC81E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp */, + 00216EC91E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h */, + 00216ECA1E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp */, + 00216ECB1E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.h */, + 00216ECC1E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp */, + 00216ECD1E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.h */, + 00216ECE1E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */, + 00216ECF1E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */, + 00216ED01E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp */, + 00216ED11E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h */, + 00216ED21E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp */, + 00216ED31E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.h */, + 00216ED41E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp */, + 00216ED51E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.h */, + 00216ED61E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */, + 00216ED71E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */, + 00216ED81E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */, + 00216ED91E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h */, + 00216EDA1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp */, + 00216EDB1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.h */, + 00216EDC1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */, + 00216EDD1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */, + 00216EDE1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */, + 00216EDF1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */, + 00216EE01E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */, + 00216EE11E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h */, + 00216EE21E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */, + 00216EE31E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */, + 00216EE41E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */, + 00216EE51E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */, + 00216EE61E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */, + 00216EE71E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */, + 00216EE81E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */, + 00216EE91E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */, + 00216EEA1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */, + 00216EEB1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */, + 00216EEC1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */, + 00216EED1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */, + 00216EEE1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */, + 00216EEF1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */, + 00216EF01E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */, + 00216EF11E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h */, + 00216EF21E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */, + 00216EF31E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */, + 00216EF41E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp */, + 00216EF51E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.h */, + 00216EF61E970056008204EA /* c_org_ortc_ConstrainBoolean.cpp */, + 00216EF71E970056008204EA /* c_org_ortc_ConstrainBoolean.h */, + 00216EF81E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp */, + 00216EF91E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.h */, + 00216EFA1E970056008204EA /* c_org_ortc_ConstrainDouble.cpp */, + 00216EFB1E970056008204EA /* c_org_ortc_ConstrainDouble.h */, + 00216EFC1E970056008204EA /* c_org_ortc_ConstrainDoubleRange.cpp */, + 00216EFD1E970056008204EA /* c_org_ortc_ConstrainDoubleRange.h */, + 00216EFE1E970056008204EA /* c_org_ortc_ConstrainLong.cpp */, + 00216EFF1E970056008204EA /* c_org_ortc_ConstrainLong.h */, + 00216F001E970056008204EA /* c_org_ortc_ConstrainLongRange.cpp */, + 00216F011E970056008204EA /* c_org_ortc_ConstrainLongRange.h */, + 00216F021E970056008204EA /* c_org_ortc_ConstrainString.cpp */, + 00216F031E970056008204EA /* c_org_ortc_ConstrainString.h */, + 00216F041E970056008204EA /* c_org_ortc_ConstrainStringParameters.cpp */, + 00216F051E970056008204EA /* c_org_ortc_ConstrainStringParameters.h */, + 00216F061E970056008204EA /* c_org_ortc_DoubleRange.cpp */, + 00216F071E970056008204EA /* c_org_ortc_DoubleRange.h */, + 00216F081E970056008204EA /* c_org_ortc_Error.cpp */, + 00216F091E970056008204EA /* c_org_ortc_Error.h */, + 00216F0A1E970056008204EA /* c_org_ortc_ErrorEvent.cpp */, + 00216F0B1E970056008204EA /* c_org_ortc_ErrorEvent.h */, + 00216F0C1E970056008204EA /* c_org_ortc_Json.cpp */, + 00216F0D1E970056008204EA /* c_org_ortc_Json.h */, + 00216F0E1E970056008204EA /* c_org_ortc_Logger.cpp */, + 00216F0F1E970056008204EA /* c_org_ortc_Logger.h */, + 00216F101E970056008204EA /* c_org_ortc_LongRange.cpp */, + 00216F111E970056008204EA /* c_org_ortc_LongRange.h */, + 00216F121E970056008204EA /* c_org_ortc_MediaControl.cpp */, + 00216F131E970056008204EA /* c_org_ortc_MediaControl.h */, + 00216F141E970056008204EA /* c_org_ortc_MediaDeviceInfo.cpp */, + 00216F151E970056008204EA /* c_org_ortc_MediaDeviceInfo.h */, + 00216F161E970056008204EA /* c_org_ortc_MediaDevices.cpp */, + 00216F171E970056008204EA /* c_org_ortc_MediaDevices.h */, + 00216F181E970056008204EA /* c_org_ortc_MediaSource.cpp */, + 00216F191E970056008204EA /* c_org_ortc_MediaSource.h */, + 00216F1A1E970056008204EA /* c_org_ortc_MediaStreamConstraints.cpp */, + 00216F1B1E970056008204EA /* c_org_ortc_MediaStreamConstraints.h */, + 00216F1C1E970056008204EA /* c_org_ortc_MediaStreamTrack.cpp */, + 00216F1D1E970056008204EA /* c_org_ortc_MediaStreamTrack.h */, + 00216F1E1E970056008204EA /* c_org_ortc_MediaTrackCapabilities.cpp */, + 00216F1F1E970056008204EA /* c_org_ortc_MediaTrackCapabilities.h */, + 00216F201E970056008204EA /* c_org_ortc_MediaTrackConstraints.cpp */, + 00216F211E970056008204EA /* c_org_ortc_MediaTrackConstraints.h */, + 00216F221E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp */, + 00216F231E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.h */, + 00216F241E970056008204EA /* c_org_ortc_MediaTrackSettings.cpp */, + 00216F251E970056008204EA /* c_org_ortc_MediaTrackSettings.h */, + 00216F261E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp */, + 00216F271E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h */, + 00216F281E970056008204EA /* c_org_ortc_MessageQueue.cpp */, + 00216F291E970056008204EA /* c_org_ortc_MessageQueue.h */, + 00216F2A1E970056008204EA /* c_org_ortc_OrtcLib.cpp */, + 00216F2B1E970056008204EA /* c_org_ortc_OrtcLib.h */, + 00216F2C1E970056008204EA /* c_org_ortc_OverconstrainedError.cpp */, + 00216F2D1E970056008204EA /* c_org_ortc_OverconstrainedError.h */, + 00216F2E1E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp */, + 00216F2F1E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.h */, + 00216F301E970056008204EA /* c_org_ortc_RTCCertificate.cpp */, + 00216F311E970056008204EA /* c_org_ortc_RTCCertificate.h */, + 00216F321E970056008204EA /* c_org_ortc_RTCCertificateStats.cpp */, + 00216F331E970056008204EA /* c_org_ortc_RTCCertificateStats.h */, + 00216F341E970056008204EA /* c_org_ortc_RTCCodec.cpp */, + 00216F351E970056008204EA /* c_org_ortc_RTCCodec.h */, + 00216F361E970056008204EA /* c_org_ortc_RTCDataChannel.cpp */, + 00216F371E970056008204EA /* c_org_ortc_RTCDataChannel.h */, + 00216F381E970056008204EA /* c_org_ortc_RTCDataChannelEvent.cpp */, + 00216F391E970056008204EA /* c_org_ortc_RTCDataChannelEvent.h */, + 00216F3A1E970056008204EA /* c_org_ortc_RTCDataChannelParameters.cpp */, + 00216F3B1E970056008204EA /* c_org_ortc_RTCDataChannelParameters.h */, + 00216F3C1E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp */, + 00216F3D1E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h */, + 00216F3E1E970056008204EA /* c_org_ortc_RTCDataChannelStats.cpp */, + 00216F3F1E970056008204EA /* c_org_ortc_RTCDataChannelStats.h */, + 00216F401E970056008204EA /* c_org_ortc_RTCDataTransport.cpp */, + 00216F411E970056008204EA /* c_org_ortc_RTCDataTransport.h */, + 00216F421E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp */, + 00216F431E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h */, + 00216F441E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp */, + 00216F451E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.h */, + 00216F461E970056008204EA /* c_org_ortc_RTCDtlsParameters.cpp */, + 00216F471E970056008204EA /* c_org_ortc_RTCDtlsParameters.h */, + 00216F481E970056008204EA /* c_org_ortc_RTCDtlsTransport.cpp */, + 00216F491E970056008204EA /* c_org_ortc_RTCDtlsTransport.h */, + 00216F4A1E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */, + 00216F4B1E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h */, + 00216F4C1E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp */, + 00216F4D1E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.h */, + 00216F4E1E970056008204EA /* c_org_ortc_RTCDtmfSender.cpp */, + 00216F4F1E970056008204EA /* c_org_ortc_RTCDtmfSender.h */, + 00216F501E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp */, + 00216F511E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h */, + 00216F521E970056008204EA /* c_org_ortc_RTCIceCandidate.cpp */, + 00216F531E970056008204EA /* c_org_ortc_RTCIceCandidate.h */, + 00216F541E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp */, + 00216F551E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.h */, + 00216F561E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp */, + 00216F571E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.h */, + 00216F581E970056008204EA /* c_org_ortc_RTCIceCandidatePair.cpp */, + 00216F591E970056008204EA /* c_org_ortc_RTCIceCandidatePair.h */, + 00216F5A1E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp */, + 00216F5B1E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h */, + 00216F5C1E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp */, + 00216F5D1E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.h */, + 00216F5E1E970056008204EA /* c_org_ortc_RTCIceGatherer.cpp */, + 00216F5F1E970056008204EA /* c_org_ortc_RTCIceGatherer.h */, + 00216F601E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp */, + 00216F611E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.h */, + 00216F621E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */, + 00216F631E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h */, + 00216F641E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp */, + 00216F651E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h */, + 00216F661E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp */, + 00216F671E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h */, + 00216F681E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp */, + 00216F691E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h */, + 00216F6A1E970056008204EA /* c_org_ortc_RTCIceGathererStats.cpp */, + 00216F6B1E970056008204EA /* c_org_ortc_RTCIceGathererStats.h */, + 00216F6C1E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp */, + 00216F6D1E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h */, + 00216F6E1E970056008204EA /* c_org_ortc_RTCIceGatherOptions.cpp */, + 00216F6F1E970056008204EA /* c_org_ortc_RTCIceGatherOptions.h */, + 00216F701E970056008204EA /* c_org_ortc_RTCIceParameters.cpp */, + 00216F711E970056008204EA /* c_org_ortc_RTCIceParameters.h */, + 00216F721E970056008204EA /* c_org_ortc_RTCIceServer.cpp */, + 00216F731E970056008204EA /* c_org_ortc_RTCIceServer.h */, + 00216F741E970056008204EA /* c_org_ortc_RTCIceTransport.cpp */, + 00216F751E970056008204EA /* c_org_ortc_RTCIceTransport.h */, + 00216F761E970056008204EA /* c_org_ortc_RTCIceTransportController.cpp */, + 00216F771E970056008204EA /* c_org_ortc_RTCIceTransportController.h */, + 00216F781E970056008204EA /* c_org_ortc_RTCIceTransportOptions.cpp */, + 00216F791E970056008204EA /* c_org_ortc_RTCIceTransportOptions.h */, + 00216F7A1E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp */, + 00216F7B1E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h */, + 00216F7C1E970056008204EA /* c_org_ortc_RTCIceTransportStats.cpp */, + 00216F7D1E970056008204EA /* c_org_ortc_RTCIceTransportStats.h */, + 00216F7E1E970056008204EA /* c_org_ortc_RTCIdentity.cpp */, + 00216F7F1E970056008204EA /* c_org_ortc_RTCIdentity.h */, + 00216F801E970056008204EA /* c_org_ortc_RTCIdentityAssertion.cpp */, + 00216F811E970056008204EA /* c_org_ortc_RTCIdentityAssertion.h */, + 00216F821E970056008204EA /* c_org_ortc_RTCIdentityError.cpp */, + 00216F831E970056008204EA /* c_org_ortc_RTCIdentityError.h */, + 00216F841E970056008204EA /* c_org_ortc_RTCIdentityResult.cpp */, + 00216F851E970056008204EA /* c_org_ortc_RTCIdentityResult.h */, + 00216F861E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp */, + 00216F871E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h */, + 00216F881E970056008204EA /* c_org_ortc_RTCMediaStreamStats.cpp */, + 00216F891E970056008204EA /* c_org_ortc_RTCMediaStreamStats.h */, + 00216F8A1E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp */, + 00216F8B1E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h */, + 00216F8C1E970056008204EA /* c_org_ortc_RTCMessageEvent.cpp */, + 00216F8D1E970056008204EA /* c_org_ortc_RTCMessageEvent.h */, + 00216F8E1E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp */, + 00216F8F1E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h */, + 00216F901E970056008204EA /* c_org_ortc_RTCRtcpFeedback.cpp */, + 00216F911E970056008204EA /* c_org_ortc_RTCRtcpFeedback.h */, + 00216F921E970056008204EA /* c_org_ortc_RTCRtcpParameters.cpp */, + 00216F931E970056008204EA /* c_org_ortc_RTCRtcpParameters.h */, + 00216F941E970056008204EA /* c_org_ortc_RTCRtcpTransport.cpp */, + 00216F951E970056008204EA /* c_org_ortc_RTCRtcpTransport.h */, + 00216F961E970056008204EA /* c_org_ortc_RTCRtpCapabilities.cpp */, + 00216F971E970056008204EA /* c_org_ortc_RTCRtpCapabilities.h */, + 00216F981E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp */, + 00216F991E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.h */, + 00216F9A1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp */, + 00216F9B1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h */, + 00216F9C1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp */, + 00216F9D1E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h */, + 00216F9E1E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp */, + 00216F9F1E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.h */, + 00216FA01E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp */, + 00216FA11E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h */, + 00216FA21E970056008204EA /* c_org_ortc_RTCRtpContributingSource.cpp */, + 00216FA31E970056008204EA /* c_org_ortc_RTCRtpContributingSource.h */, + 00216FA41E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp */, + 00216FA51E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.h */, + 00216FA61E970056008204EA /* c_org_ortc_RTCRtpFecParameters.cpp */, + 00216FA71E970056008204EA /* c_org_ortc_RTCRtpFecParameters.h */, + 00216FA81E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */, + 00216FA91E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */, + 00216FAA1E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */, + 00216FAB1E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */, + 00216FAC1E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */, + 00216FAD1E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h */, + 00216FAE1E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp */, + 00216FAF1E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h */, + 00216FB01E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp */, + 00216FB11E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.h */, + 00216FB21E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp */, + 00216FB31E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h */, + 00216FB41E970056008204EA /* c_org_ortc_RTCRtpListener.cpp */, + 00216FB51E970056008204EA /* c_org_ortc_RTCRtpListener.h */, + 00216FB61E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */, + 00216FB71E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */, + 00216FB81E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */, + 00216FB91E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */, + 00216FBA1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */, + 00216FBB1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h */, + 00216FBC1E970056008204EA /* c_org_ortc_RTCRtpParameters.cpp */, + 00216FBD1E970056008204EA /* c_org_ortc_RTCRtpParameters.h */, + 00216FBE1E970056008204EA /* c_org_ortc_RTCRtpReceiver.cpp */, + 00216FBF1E970056008204EA /* c_org_ortc_RTCRtpReceiver.h */, + 00216FC01E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp */, + 00216FC11E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h */, + 00216FC21E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */, + 00216FC31E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */, + 00216FC41E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */, + 00216FC51E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h */, + 00216FC61E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp */, + 00216FC71E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.h */, + 00216FC81E970056008204EA /* c_org_ortc_RTCRtpSender.cpp */, + 00216FC91E970056008204EA /* c_org_ortc_RTCRtpSender.h */, + 00216FCA1E970056008204EA /* c_org_ortc_RTCRtpStreamStats.cpp */, + 00216FCB1E970056008204EA /* c_org_ortc_RTCRtpStreamStats.h */, + 00216FCC1E970056008204EA /* c_org_ortc_RTCRtpTransport.cpp */, + 00216FCD1E970056008204EA /* c_org_ortc_RTCRtpTransport.h */, + 00216FCE1E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp */, + 00216FCF1E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h */, + 00216FD01E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */, + 00216FD11E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */, + 00216FD21E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */, + 00216FD31E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h */, + 00216FD41E970056008204EA /* c_org_ortc_RTCSctpCapabilities.cpp */, + 00216FD51E970056008204EA /* c_org_ortc_RTCSctpCapabilities.h */, + 00216FD61E970056008204EA /* c_org_ortc_RTCSctpTransport.cpp */, + 00216FD71E970056008204EA /* c_org_ortc_RTCSctpTransport.h */, + 00216FD81E970056008204EA /* c_org_ortc_RTCSctpTransportListener.cpp */, + 00216FD91E970056008204EA /* c_org_ortc_RTCSctpTransportListener.h */, + 00216FDA1E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp */, + 00216FDB1E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h */, + 00216FDC1E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp */, + 00216FDD1E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h */, + 00216FDE1E970056008204EA /* c_org_ortc_RTCSctpTransportStats.cpp */, + 00216FDF1E970056008204EA /* c_org_ortc_RTCSctpTransportStats.h */, + 00216FE01E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp */, + 00216FE11E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h */, + 00216FE21E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp */, + 00216FE31E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h */, + 00216FE41E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp */, + 00216FE51E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.h */, + 00216FE61E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp */, + 00216FE71E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.h */, + 00216FE81E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */, + 00216FE91E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */, + 00216FEA1E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp */, + 00216FEB1E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.h */, + 00216FEC1E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp */, + 00216FED1E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.h */, + 00216FEE1E970056008204EA /* c_org_ortc_RTCStats.cpp */, + 00216FEF1E970056008204EA /* c_org_ortc_RTCStats.h */, + 00216FF01E970056008204EA /* c_org_ortc_RTCStatsProvider.cpp */, + 00216FF11E970056008204EA /* c_org_ortc_RTCStatsProvider.h */, + 00216FF21E970056008204EA /* c_org_ortc_RTCStatsReport.cpp */, + 00216FF31E970056008204EA /* c_org_ortc_RTCStatsReport.h */, + 00216FF41E970056008204EA /* c_org_ortc_RTCStatsTypeSet.cpp */, + 00216FF51E970056008204EA /* c_org_ortc_RTCStatsTypeSet.h */, + 00216FF61E970056008204EA /* c_org_ortc_Settings.cpp */, + 00216FF71E970056008204EA /* c_org_ortc_Settings.h */, + 00216FF81E970056008204EA /* c_org_ortc_StringOrStringList.cpp */, + 00216FF91E970056008204EA /* c_org_ortc_StringOrStringList.h */, + 00216FFA1E970056008204EA /* types.h */, + ); + name = c; + path = ../../../ortc/idl/wrapper/generated/c; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 00216EB81E970020008204EA /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 002170F21E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.h in Headers */, + 002170BE1E970056008204EA /* c_org_ortc_RTCIdentityResult.h in Headers */, + 002171141E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.h in Headers */, + 002170E61E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.h in Headers */, + 002170821E970056008204EA /* c_org_ortc_RTCDtlsTransport.h in Headers */, + 002170261E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h in Headers */, + 0021701A1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.h in Headers */, + 0021709A1E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.h in Headers */, + 002170181E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h in Headers */, + 002170E41E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.h in Headers */, + 0021704C1E970056008204EA /* c_org_ortc_MediaControl.h in Headers */, + 002171081E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.h in Headers */, + 0021703A1E970056008204EA /* c_org_ortc_ConstrainLongRange.h in Headers */, + 002171021E970056008204EA /* c_org_ortc_RTCRtpSender.h in Headers */, + 002171331E970056008204EA /* types.h in Headers */, + 002170861E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.h in Headers */, + 0021710A1E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.h in Headers */, + 002170A81E970056008204EA /* c_org_ortc_RTCIceGatherOptions.h in Headers */, + 002170E01E970056008204EA /* c_org_ortc_RTCRtpFecParameters.h in Headers */, + 002170641E970056008204EA /* c_org_ortc_OrtcLib.h in Headers */, + 002170581E970056008204EA /* c_org_ortc_MediaTrackCapabilities.h in Headers */, + 002171041E970056008204EA /* c_org_ortc_RTCRtpStreamStats.h in Headers */, + 002170661E970056008204EA /* c_org_ortc_OverconstrainedError.h in Headers */, + 002170B21E970056008204EA /* c_org_ortc_RTCIceTransportOptions.h in Headers */, + 00216FFE1E970056008204EA /* c_org_ortc_adapter_MediaStream.h in Headers */, + 002170061E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.h in Headers */, + 0021703E1E970056008204EA /* c_org_ortc_ConstrainStringParameters.h in Headers */, + 002170881E970056008204EA /* c_org_ortc_RTCDtmfSender.h in Headers */, + 002171101E970056008204EA /* c_org_ortc_RTCSctpTransport.h in Headers */, + 0021710E1E970056008204EA /* c_org_ortc_RTCSctpCapabilities.h in Headers */, + 002171001E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.h in Headers */, + 0021705A1E970056008204EA /* c_org_ortc_MediaTrackConstraints.h in Headers */, + 0021709E1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.h in Headers */, + 002170C21E970056008204EA /* c_org_ortc_RTCMediaStreamStats.h in Headers */, + 002170141E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.h in Headers */, + 00216FFC1E970056008204EA /* c_helpers.h in Headers */, + 002170301E970056008204EA /* c_org_ortc_ConstrainBoolean.h in Headers */, + 0021712E1E970056008204EA /* c_org_ortc_RTCStatsTypeSet.h in Headers */, + 002170741E970056008204EA /* c_org_ortc_RTCDataChannelParameters.h in Headers */, + 002170CA1E970056008204EA /* c_org_ortc_RTCRtcpFeedback.h in Headers */, + 002170761E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.h in Headers */, + 002170701E970056008204EA /* c_org_ortc_RTCDataChannel.h in Headers */, + 002170E21E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h in Headers */, + 0021700C1E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.h in Headers */, + 002170AA1E970056008204EA /* c_org_ortc_RTCIceParameters.h in Headers */, + 0021705C1E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.h in Headers */, + 002170F81E970056008204EA /* c_org_ortc_RTCRtpReceiver.h in Headers */, + 002170961E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.h in Headers */, + 002171121E970056008204EA /* c_org_ortc_RTCSctpTransportListener.h in Headers */, + 002170441E970056008204EA /* c_org_ortc_ErrorEvent.h in Headers */, + 002170021E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.h in Headers */, + 002170EE1E970056008204EA /* c_org_ortc_RTCRtpListener.h in Headers */, + 002170D81E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.h in Headers */, + 002170101E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h in Headers */, + 002170521E970056008204EA /* c_org_ortc_MediaSource.h in Headers */, + 0021700E1E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.h in Headers */, + 002170FE1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.h in Headers */, + 002170F61E970056008204EA /* c_org_ortc_RTCRtpParameters.h in Headers */, + 0021704E1E970056008204EA /* c_org_ortc_MediaDeviceInfo.h in Headers */, + 0021701C1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h in Headers */, + 0021708E1E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.h in Headers */, + 002171301E970056008204EA /* c_org_ortc_Settings.h in Headers */, + 002170DE1E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.h in Headers */, + 002170CC1E970056008204EA /* c_org_ortc_RTCRtcpParameters.h in Headers */, + 002171241E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.h in Headers */, + 002170041E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.h in Headers */, + 002171281E970056008204EA /* c_org_ortc_RTCStats.h in Headers */, + 0021702C1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h in Headers */, + 0021701E1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.h in Headers */, + 002171161E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.h in Headers */, + 002170561E970056008204EA /* c_org_ortc_MediaStreamTrack.h in Headers */, + 002170DA1E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.h in Headers */, + 002170461E970056008204EA /* c_org_ortc_Json.h in Headers */, + 002170EC1E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.h in Headers */, + 002170421E970056008204EA /* c_org_ortc_Error.h in Headers */, + 002171221E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h in Headers */, + 0021707C1E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.h in Headers */, + 0021708C1E970056008204EA /* c_org_ortc_RTCIceCandidate.h in Headers */, + 002170901E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.h in Headers */, + 002170BC1E970056008204EA /* c_org_ortc_RTCIdentityError.h in Headers */, + 002170201E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h in Headers */, + 002170481E970056008204EA /* c_org_ortc_Logger.h in Headers */, + 0021707A1E970056008204EA /* c_org_ortc_RTCDataTransport.h in Headers */, + 002171061E970056008204EA /* c_org_ortc_RTCRtpTransport.h in Headers */, + 002170F01E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.h in Headers */, + 002170681E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.h in Headers */, + 002170781E970056008204EA /* c_org_ortc_RTCDataChannelStats.h in Headers */, + 002170DC1E970056008204EA /* c_org_ortc_RTCRtpContributingSource.h in Headers */, + 0021706C1E970056008204EA /* c_org_ortc_RTCCertificateStats.h in Headers */, + 002171201E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.h in Headers */, + 002170E81E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.h in Headers */, + 002170121E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.h in Headers */, + 002170B61E970056008204EA /* c_org_ortc_RTCIceTransportStats.h in Headers */, + 002170321E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.h in Headers */, + 0021704A1E970056008204EA /* c_org_ortc_LongRange.h in Headers */, + 002170FA1E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.h in Headers */, + 002170C01E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.h in Headers */, + 002170981E970056008204EA /* c_org_ortc_RTCIceGatherer.h in Headers */, + 002170841E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.h in Headers */, + 0021712C1E970056008204EA /* c_org_ortc_RTCStatsReport.h in Headers */, + 002170B01E970056008204EA /* c_org_ortc_RTCIceTransportController.h in Headers */, + 002170A41E970056008204EA /* c_org_ortc_RTCIceGathererStats.h in Headers */, + 002170081E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h in Headers */, + 002170381E970056008204EA /* c_org_ortc_ConstrainLong.h in Headers */, + 002171181E970056008204EA /* c_org_ortc_RTCSctpTransportStats.h in Headers */, + 0021702E1E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.h in Headers */, + 0021712A1E970056008204EA /* c_org_ortc_RTCStatsProvider.h in Headers */, + 002171261E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.h in Headers */, + 002170F41E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.h in Headers */, + 002171321E970056008204EA /* c_org_ortc_StringOrStringList.h in Headers */, + 002170241E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.h in Headers */, + 002170D41E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.h in Headers */, + 002170921E970056008204EA /* c_org_ortc_RTCIceCandidatePair.h in Headers */, + 002170341E970056008204EA /* c_org_ortc_ConstrainDouble.h in Headers */, + 002170001E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.h in Headers */, + 0021700A1E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.h in Headers */, + 0021710C1E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.h in Headers */, + 0021706E1E970056008204EA /* c_org_ortc_RTCCodec.h in Headers */, + 002170401E970056008204EA /* c_org_ortc_DoubleRange.h in Headers */, + 002170BA1E970056008204EA /* c_org_ortc_RTCIdentityAssertion.h in Headers */, + 002170FC1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.h in Headers */, + 002170621E970056008204EA /* c_org_ortc_MessageQueue.h in Headers */, + 002170541E970056008204EA /* c_org_ortc_MediaStreamConstraints.h in Headers */, + 002170D21E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.h in Headers */, + 0021711C1E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.h in Headers */, + 002170A21E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.h in Headers */, + 002170D01E970056008204EA /* c_org_ortc_RTCRtpCapabilities.h in Headers */, + 002170AC1E970056008204EA /* c_org_ortc_RTCIceServer.h in Headers */, + 0021711A1E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.h in Headers */, + 002170601E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.h in Headers */, + 002170501E970056008204EA /* c_org_ortc_MediaDevices.h in Headers */, + 0021705E1E970056008204EA /* c_org_ortc_MediaTrackSettings.h in Headers */, + 002170161E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.h in Headers */, + 002170EA1E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.h in Headers */, + 002170281E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h in Headers */, + 0021709C1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.h in Headers */, + 002170C81E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.h in Headers */, + 002170801E970056008204EA /* c_org_ortc_RTCDtlsParameters.h in Headers */, + 002170C61E970056008204EA /* c_org_ortc_RTCMessageEvent.h in Headers */, + 002170941E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.h in Headers */, + 0021711E1E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.h in Headers */, + 002170221E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h in Headers */, + 0021703C1E970056008204EA /* c_org_ortc_ConstrainString.h in Headers */, + 002170A01E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.h in Headers */, + 002170CE1E970056008204EA /* c_org_ortc_RTCRtcpTransport.h in Headers */, + 002170721E970056008204EA /* c_org_ortc_RTCDataChannelEvent.h in Headers */, + 002170AE1E970056008204EA /* c_org_ortc_RTCIceTransport.h in Headers */, + 0021708A1E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.h in Headers */, + 002170C41E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.h in Headers */, + 0021706A1E970056008204EA /* c_org_ortc_RTCCertificate.h in Headers */, + 002170A61E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.h in Headers */, + 002170361E970056008204EA /* c_org_ortc_ConstrainDoubleRange.h in Headers */, + 0021702A1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.h in Headers */, + 002170B41E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.h in Headers */, + 002170D61E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.h in Headers */, + 002170B81E970056008204EA /* c_org_ortc_RTCIdentity.h in Headers */, + 0021707E1E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 00216EB91E970020008204EA /* ortclib-c-osx */ = { + isa = PBXNativeTarget; + buildConfigurationList = 00216EBE1E970020008204EA /* Build configuration list for PBXNativeTarget "ortclib-c-osx" */; + buildPhases = ( + 00216EB61E970020008204EA /* Sources */, + 00216EB71E970020008204EA /* Frameworks */, + 00216EB81E970020008204EA /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ortclib-c-osx"; + productName = "ortclib-c-osx"; + productReference = 00216EBA1E970020008204EA /* libortclib-c-osx.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 00216EB21E970020008204EA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = "Open Peer Foundation"; + TargetAttributes = { + 00216EB91E970020008204EA = { + CreatedOnToolsVersion = 8.3; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 00216EB51E970020008204EA /* Build configuration list for PBXProject "ortclib-c-osx" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 00216EB11E970020008204EA; + productRefGroup = 00216EBB1E970020008204EA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 00216EB91E970020008204EA /* ortclib-c-osx */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 00216EB61E970020008204EA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 002170791E970056008204EA /* c_org_ortc_RTCDataTransport.cpp in Sources */, + 002170671E970056008204EA /* c_org_ortc_OverconstrainedErrorEvent.cpp in Sources */, + 002170391E970056008204EA /* c_org_ortc_ConstrainLongRange.cpp in Sources */, + 0021712B1E970056008204EA /* c_org_ortc_RTCStatsReport.cpp in Sources */, + 0021707B1E970056008204EA /* c_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */, + 002170AD1E970056008204EA /* c_org_ortc_RTCIceTransport.cpp in Sources */, + 002170171E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */, + 0021705F1E970056008204EA /* c_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */, + 002170571E970056008204EA /* c_org_ortc_MediaTrackCapabilities.cpp in Sources */, + 002170D11E970056008204EA /* c_org_ortc_RTCRtpCodecCapability.cpp in Sources */, + 002170AF1E970056008204EA /* c_org_ortc_RTCIceTransportController.cpp in Sources */, + 002170851E970056008204EA /* c_org_ortc_RTCDtlsTransportStats.cpp in Sources */, + 0021708F1E970056008204EA /* c_org_ortc_RTCIceCandidateComplete.cpp in Sources */, + 002170E71E970056008204EA /* c_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */, + 002170751E970056008204EA /* c_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */, + 002171311E970056008204EA /* c_org_ortc_StringOrStringList.cpp in Sources */, + 0021708D1E970056008204EA /* c_org_ortc_RTCIceCandidateAttributes.cpp in Sources */, + 002170C51E970056008204EA /* c_org_ortc_RTCMessageEvent.cpp in Sources */, + 002170231E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */, + 002171051E970056008204EA /* c_org_ortc_RTCRtpTransport.cpp in Sources */, + 002170EF1E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */, + 002170831E970056008204EA /* c_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */, + 002170BF1E970056008204EA /* c_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */, + 00216FFF1E970056008204EA /* c_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */, + 0021702D1E970056008204EA /* c_org_ortc_adapter_RTCTrackEvent.cpp in Sources */, + 0021704F1E970056008204EA /* c_org_ortc_MediaDevices.cpp in Sources */, + 0021710D1E970056008204EA /* c_org_ortc_RTCSctpCapabilities.cpp in Sources */, + 00216FFB1E970056008204EA /* c_helpers.cpp in Sources */, + 002170631E970056008204EA /* c_org_ortc_OrtcLib.cpp in Sources */, + 002170431E970056008204EA /* c_org_ortc_ErrorEvent.cpp in Sources */, + 0021711D1E970056008204EA /* c_org_ortc_RTCSrtpSdesParameters.cpp in Sources */, + 0021710F1E970056008204EA /* c_org_ortc_RTCSctpTransport.cpp in Sources */, + 0021705B1E970056008204EA /* c_org_ortc_MediaTrackConstraintSet.cpp in Sources */, + 002171271E970056008204EA /* c_org_ortc_RTCStats.cpp in Sources */, + 002170351E970056008204EA /* c_org_ortc_ConstrainDoubleRange.cpp in Sources */, + 002170FD1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */, + 002170ED1E970056008204EA /* c_org_ortc_RTCRtpListener.cpp in Sources */, + 002170551E970056008204EA /* c_org_ortc_MediaStreamTrack.cpp in Sources */, + 002170411E970056008204EA /* c_org_ortc_Error.cpp in Sources */, + 002170DB1E970056008204EA /* c_org_ortc_RTCRtpContributingSource.cpp in Sources */, + 002170531E970056008204EA /* c_org_ortc_MediaStreamConstraints.cpp in Sources */, + 002171231E970056008204EA /* c_org_ortc_RTCSrtpTransportStats.cpp in Sources */, + 0021705D1E970056008204EA /* c_org_ortc_MediaTrackSettings.cpp in Sources */, + 002170051E970056008204EA /* c_org_ortc_adapter_RTCIceCandidate.cpp in Sources */, + 002170CB1E970056008204EA /* c_org_ortc_RTCRtcpParameters.cpp in Sources */, + 0021710B1E970056008204EA /* c_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */, + 0021704B1E970056008204EA /* c_org_ortc_MediaControl.cpp in Sources */, + 002171211E970056008204EA /* c_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */, + 002170211E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */, + 0021700F1E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */, + 002170A51E970056008204EA /* c_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */, + 002170D51E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */, + 002170F91E970056008204EA /* c_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */, + 002170FF1E970056008204EA /* c_org_ortc_RTCRtpRtxParameters.cpp in Sources */, + 002170771E970056008204EA /* c_org_ortc_RTCDataChannelStats.cpp in Sources */, + 0021708B1E970056008204EA /* c_org_ortc_RTCIceCandidate.cpp in Sources */, + 002170331E970056008204EA /* c_org_ortc_ConstrainDouble.cpp in Sources */, + 002170E31E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */, + 002170591E970056008204EA /* c_org_ortc_MediaTrackConstraints.cpp in Sources */, + 002170C91E970056008204EA /* c_org_ortc_RTCRtcpFeedback.cpp in Sources */, + 0021701F1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */, + 002170A71E970056008204EA /* c_org_ortc_RTCIceGatherOptions.cpp in Sources */, + 002171011E970056008204EA /* c_org_ortc_RTCRtpSender.cpp in Sources */, + 0021702F1E970056008204EA /* c_org_ortc_ConstrainBoolean.cpp in Sources */, + 002170031E970056008204EA /* c_org_ortc_adapter_RTCConfiguration.cpp in Sources */, + 0021703F1E970056008204EA /* c_org_ortc_DoubleRange.cpp in Sources */, + 002170BB1E970056008204EA /* c_org_ortc_RTCIdentityError.cpp in Sources */, + 002170111E970056008204EA /* c_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */, + 002170E11E970056008204EA /* c_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */, + 002170811E970056008204EA /* c_org_ortc_RTCDtlsTransport.cpp in Sources */, + 002170C31E970056008204EA /* c_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */, + 002170711E970056008204EA /* c_org_ortc_RTCDataChannelEvent.cpp in Sources */, + 0021711F1E970056008204EA /* c_org_ortc_RTCSrtpSdesTransport.cpp in Sources */, + 0021707D1E970056008204EA /* c_org_ortc_RTCDtlsFingerprint.cpp in Sources */, + 0021701D1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */, + 0021706B1E970056008204EA /* c_org_ortc_RTCCertificateStats.cpp in Sources */, + 002170091E970056008204EA /* c_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */, + 002170971E970056008204EA /* c_org_ortc_RTCIceGatherer.cpp in Sources */, + 0021709D1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */, + 002170451E970056008204EA /* c_org_ortc_Json.cpp in Sources */, + 0021712D1E970056008204EA /* c_org_ortc_RTCStatsTypeSet.cpp in Sources */, + 002170F11E970056008204EA /* c_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */, + 002170291E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */, + 002170911E970056008204EA /* c_org_ortc_RTCIceCandidatePair.cpp in Sources */, + 002170E51E970056008204EA /* c_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */, + 002170CF1E970056008204EA /* c_org_ortc_RTCRtpCapabilities.cpp in Sources */, + 002170BD1E970056008204EA /* c_org_ortc_RTCIdentityResult.cpp in Sources */, + 002170491E970056008204EA /* c_org_ortc_LongRange.cpp in Sources */, + 002171071E970056008204EA /* c_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */, + 002170B51E970056008204EA /* c_org_ortc_RTCIceTransportStats.cpp in Sources */, + 002170B91E970056008204EA /* c_org_ortc_RTCIdentityAssertion.cpp in Sources */, + 002170CD1E970056008204EA /* c_org_ortc_RTCRtcpTransport.cpp in Sources */, + 002171251E970056008204EA /* c_org_ortc_RTCSsrcConflictEvent.cpp in Sources */, + 002170DD1E970056008204EA /* c_org_ortc_RTCRtpEncodingParameters.cpp in Sources */, + 0021709B1E970056008204EA /* c_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */, + 002170EB1E970056008204EA /* c_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */, + 002170311E970056008204EA /* c_org_ortc_ConstrainBooleanParameters.cpp in Sources */, + 002170871E970056008204EA /* c_org_ortc_RTCDtmfSender.cpp in Sources */, + 00216FFD1E970056008204EA /* c_org_ortc_adapter_MediaStream.cpp in Sources */, + 002170C11E970056008204EA /* c_org_ortc_RTCMediaStreamStats.cpp in Sources */, + 0021700D1E970056008204EA /* c_org_ortc_adapter_RTCPeerConnection.cpp in Sources */, + 002170931E970056008204EA /* c_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */, + 002170891E970056008204EA /* c_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */, + 002170B31E970056008204EA /* c_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */, + 002170F31E970056008204EA /* c_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */, + 002170D31E970056008204EA /* c_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */, + 002171191E970056008204EA /* c_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */, + 002170271E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */, + 002170131E970056008204EA /* c_org_ortc_adapter_RTCSessionDescription.cpp in Sources */, + 002170951E970056008204EA /* c_org_ortc_RTCIceCandidatePairStats.cpp in Sources */, + 002170F71E970056008204EA /* c_org_ortc_RTCRtpReceiver.cpp in Sources */, + 002170151E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */, + 002170471E970056008204EA /* c_org_ortc_Logger.cpp in Sources */, + 002171151E970056008204EA /* c_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */, + 0021711B1E970056008204EA /* c_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */, + 0021700B1E970056008204EA /* c_org_ortc_adapter_RTCOfferOptions.cpp in Sources */, + 002170AB1E970056008204EA /* c_org_ortc_RTCIceServer.cpp in Sources */, + 002170F51E970056008204EA /* c_org_ortc_RTCRtpParameters.cpp in Sources */, + 002170E91E970056008204EA /* c_org_ortc_RTCRtpHeaderExtension.cpp in Sources */, + 0021703D1E970056008204EA /* c_org_ortc_ConstrainStringParameters.cpp in Sources */, + 002170651E970056008204EA /* c_org_ortc_OverconstrainedError.cpp in Sources */, + 0021701B1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */, + 002170991E970056008204EA /* c_org_ortc_RTCIceGathererCandidate.cpp in Sources */, + 0021702B1E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */, + 002170B11E970056008204EA /* c_org_ortc_RTCIceTransportOptions.cpp in Sources */, + 002170A91E970056008204EA /* c_org_ortc_RTCIceParameters.cpp in Sources */, + 0021709F1E970056008204EA /* c_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */, + 0021706D1E970056008204EA /* c_org_ortc_RTCCodec.cpp in Sources */, + 002170A31E970056008204EA /* c_org_ortc_RTCIceGathererStats.cpp in Sources */, + 002170511E970056008204EA /* c_org_ortc_MediaSource.cpp in Sources */, + 002170731E970056008204EA /* c_org_ortc_RTCDataChannelParameters.cpp in Sources */, + 0021703B1E970056008204EA /* c_org_ortc_ConstrainString.cpp in Sources */, + 002170191E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */, + 002171031E970056008204EA /* c_org_ortc_RTCRtpStreamStats.cpp in Sources */, + 002171291E970056008204EA /* c_org_ortc_RTCStatsProvider.cpp in Sources */, + 002171111E970056008204EA /* c_org_ortc_RTCSctpTransportListener.cpp in Sources */, + 002170251E970056008204EA /* c_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */, + 002171171E970056008204EA /* c_org_ortc_RTCSctpTransportStats.cpp in Sources */, + 002170A11E970056008204EA /* c_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */, + 0021706F1E970056008204EA /* c_org_ortc_RTCDataChannel.cpp in Sources */, + 0021707F1E970056008204EA /* c_org_ortc_RTCDtlsParameters.cpp in Sources */, + 002171091E970056008204EA /* c_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */, + 002170B71E970056008204EA /* c_org_ortc_RTCIdentity.cpp in Sources */, + 002170691E970056008204EA /* c_org_ortc_RTCCertificate.cpp in Sources */, + 002170D71E970056008204EA /* c_org_ortc_RTCRtpCodecParameters.cpp in Sources */, + 002170371E970056008204EA /* c_org_ortc_ConstrainLong.cpp in Sources */, + 0021704D1E970056008204EA /* c_org_ortc_MediaDeviceInfo.cpp in Sources */, + 0021712F1E970056008204EA /* c_org_ortc_Settings.cpp in Sources */, + 002170D91E970056008204EA /* c_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */, + 002170C71E970056008204EA /* c_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */, + 002170071E970056008204EA /* c_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */, + 002170DF1E970056008204EA /* c_org_ortc_RTCRtpFecParameters.cpp in Sources */, + 002170611E970056008204EA /* c_org_ortc_MessageQueue.cpp in Sources */, + 002171131E970056008204EA /* c_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */, + 002170FB1E970056008204EA /* c_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */, + 002170011E970056008204EA /* c_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 00216EBC1E970020008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 00216EBD1E970020008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 00216EBF1E970020008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXECUTABLE_PREFIX = lib; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 00216EC01E970020008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + EXECUTABLE_PREFIX = lib; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 00216EB51E970020008204EA /* Build configuration list for PBXProject "ortclib-c-osx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00216EBC1E970020008204EA /* Debug */, + 00216EBD1E970020008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 00216EBE1E970020008204EA /* Build configuration list for PBXNativeTarget "ortclib-c-osx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00216EBF1E970020008204EA /* Debug */, + 00216EC01E970020008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 00216EB21E970020008204EA /* Project object */; +} diff --git a/projects/xcode/ortclib-ios/ortclib-ios.xcodeproj/project.pbxproj b/projects/xcode/ortclib-ios/ortclib-ios.xcodeproj/project.pbxproj index 49bc2311..16a02134 100644 --- a/projects/xcode/ortclib-ios/ortclib-ios.xcodeproj/project.pbxproj +++ b/projects/xcode/ortclib-ios/ortclib-ios.xcodeproj/project.pbxproj @@ -55,7 +55,7 @@ 009D16611DE5210300D139FF /* ortc_SCTPTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C11DE5210200D139FF /* ortc_SCTPTransport.cpp */; }; 009D16621DE5210300D139FF /* ortc_SCTPTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C21DE5210200D139FF /* ortc_SCTPTransportListener.cpp */; }; 009D16641DE5210300D139FF /* ortc_SRTPSDESTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C41DE5210200D139FF /* ortc_SRTPSDESTransport.cpp */; }; - 009D16651DE5210300D139FF /* ortc_SRTPTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C51DE5210200D139FF /* ortc_SRTPTransport.cpp */; }; + 009D16651DE5210300D139FF /* ortc_SRTPTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C51DE5210200D139FF /* ortc_SRTPTransport.cpp */; settings = {COMPILER_FLAGS = "-Wno-documentation"; }; }; 009D16661DE5210300D139FF /* ortc_StatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C61DE5210200D139FF /* ortc_StatsReport.cpp */; }; 009D16671DE5210300D139FF /* ortc_webrtc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D15C71DE5210200D139FF /* ortc_webrtc.cpp */; }; /* End PBXBuildFile section */ @@ -219,6 +219,7 @@ 009D16151DE5210200D139FF /* IStatsReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IStatsReport.h; sourceTree = ""; }; 009D16161DE5210200D139FF /* ortc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ortc.h; sourceTree = ""; }; 009D16331DE5210300D139FF /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; + 5206B1B01E5CDB3600029C2C /* ortcEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ortcEvents.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -387,6 +388,7 @@ 009D15D81DE5210200D139FF /* internal */ = { isa = PBXGroup; children = ( + 5206B1B01E5CDB3600029C2C /* ortcEvents.h */, 009D15D91DE5210200D139FF /* ifaddrs-android.h */, 009D15DA1DE5210200D139FF /* ortc.events.h */, 009D15DB1DE5210200D139FF /* ortc.events.jman */, @@ -583,14 +585,17 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; @@ -642,13 +647,16 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "NDEBUG=1", "$(inherited)", ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; @@ -676,18 +684,60 @@ 0064F80D1DE51EB900EE8962 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "DEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + "$(inherited)", + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + VALID_ARCHS = "arm64 armv7 armv7s"; }; name = Debug; }; 0064F80E1DE51EB900EE8962 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "NDEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + "$(inherited)", + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + VALID_ARCHS = "arm64 armv7 armv7s"; }; name = Release; }; diff --git a/projects/xcode/ortclib-osx/ortclib-osx.xcodeproj/project.pbxproj b/projects/xcode/ortclib-osx/ortclib-osx.xcodeproj/project.pbxproj index 146f2c28..fc3e0b8c 100644 --- a/projects/xcode/ortclib-osx/ortclib-osx.xcodeproj/project.pbxproj +++ b/projects/xcode/ortclib-osx/ortclib-osx.xcodeproj/project.pbxproj @@ -55,7 +55,7 @@ 009D180D1DE5285800D139FF /* ortc_SCTPTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17601DE5285700D139FF /* ortc_SCTPTransport.cpp */; }; 009D180E1DE5285800D139FF /* ortc_SCTPTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17611DE5285700D139FF /* ortc_SCTPTransportListener.cpp */; }; 009D18101DE5285800D139FF /* ortc_SRTPSDESTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17631DE5285700D139FF /* ortc_SRTPSDESTransport.cpp */; }; - 009D18111DE5285800D139FF /* ortc_SRTPTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17641DE5285700D139FF /* ortc_SRTPTransport.cpp */; }; + 009D18111DE5285800D139FF /* ortc_SRTPTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17641DE5285700D139FF /* ortc_SRTPTransport.cpp */; settings = {COMPILER_FLAGS = "-Wno-documentation"; }; }; 009D18121DE5285800D139FF /* ortc_StatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17651DE5285700D139FF /* ortc_StatsReport.cpp */; }; 009D18131DE5285800D139FF /* ortc_webrtc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D17661DE5285700D139FF /* ortc_webrtc.cpp */; }; /* End PBXBuildFile section */ @@ -577,14 +577,17 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; @@ -636,9 +639,12 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; GCC_NO_COMMON_BLOCKS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; @@ -666,6 +672,26 @@ isa = XCBuildConfiguration; buildSettings = { EXECUTABLE_PREFIX = lib; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "DEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + "$(inherited)", + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -674,6 +700,24 @@ isa = XCBuildConfiguration; buildSettings = { EXECUTABLE_PREFIX = lib; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + "$(inherited)", + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/projects/xcode/ortclib-wrapper-ios/ortclib-wrapper-ios.xcodeproj/project.pbxproj b/projects/xcode/ortclib-wrapper-ios/ortclib-wrapper-ios.xcodeproj/project.pbxproj new file mode 100644 index 00000000..1c3aaaa3 --- /dev/null +++ b/projects/xcode/ortclib-wrapper-ios/ortclib-wrapper-ios.xcodeproj/project.pbxproj @@ -0,0 +1,1229 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 002177701E9701C6008204EA /* impl_org_ortc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002174FA1E9701C3008204EA /* impl_org_ortc.cpp */; }; + 002177711E9701C6008204EA /* impl_org_ortc_adapter_MediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002174FB1E9701C3008204EA /* impl_org_ortc_adapter_MediaStream.cpp */; }; + 002177721E9701C6008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002174FD1E9701C3008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp */; }; + 002177731E9701C6008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002174FF1E9701C3008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp */; }; + 002177741E9701C6008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175011E9701C3008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp */; }; + 002177751E9701C6008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175031E9701C3008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp */; }; + 002177761E9701C6008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175051E9701C3008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */; }; + 002177771E9701C6008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175071E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp */; }; + 002177781E9701C6008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175091E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp */; }; + 002177791E9701C6008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021750B1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp */; }; + 0021777A1E9701C6008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021750D1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */; }; + 0021777B1E9701C6008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021750F1E9701C4008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */; }; + 0021777C1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175111E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp */; }; + 0021777D1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175131E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */; }; + 0021777E1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175151E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */; }; + 0021777F1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175171E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */; }; + 002177801E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175191E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */; }; + 002177811E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021751B1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */; }; + 002177821E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021751D1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */; }; + 002177831E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021751F1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */; }; + 002177841E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175211E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */; }; + 002177851E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175231E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */; }; + 002177861E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175251E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */; }; + 002177871E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175271E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */; }; + 002177881E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175291E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */; }; + 002177891E9701C6008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021752B1E9701C4008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp */; }; + 0021778A1E9701C6008204EA /* impl_org_ortc_ConstrainBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021752D1E9701C4008204EA /* impl_org_ortc_ConstrainBoolean.cpp */; }; + 0021778B1E9701C6008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021752F1E9701C4008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp */; }; + 0021778C1E9701C6008204EA /* impl_org_ortc_ConstrainDouble.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175311E9701C4008204EA /* impl_org_ortc_ConstrainDouble.cpp */; }; + 0021778D1E9701C6008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175331E9701C4008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp */; }; + 0021778E1E9701C6008204EA /* impl_org_ortc_ConstrainLong.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175351E9701C4008204EA /* impl_org_ortc_ConstrainLong.cpp */; }; + 0021778F1E9701C6008204EA /* impl_org_ortc_ConstrainLongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175371E9701C4008204EA /* impl_org_ortc_ConstrainLongRange.cpp */; }; + 002177901E9701C6008204EA /* impl_org_ortc_ConstrainString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175391E9701C4008204EA /* impl_org_ortc_ConstrainString.cpp */; }; + 002177911E9701C6008204EA /* impl_org_ortc_ConstrainStringParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021753B1E9701C4008204EA /* impl_org_ortc_ConstrainStringParameters.cpp */; }; + 002177931E9701C6008204EA /* impl_org_ortc_DoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021753F1E9701C4008204EA /* impl_org_ortc_DoubleRange.cpp */; }; + 002177941E9701C6008204EA /* impl_org_ortc_Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175411E9701C4008204EA /* impl_org_ortc_Error.cpp */; }; + 002177951E9701C6008204EA /* impl_org_ortc_ErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175431E9701C4008204EA /* impl_org_ortc_ErrorEvent.cpp */; }; + 002177961E9701C6008204EA /* impl_org_ortc_Helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175451E9701C4008204EA /* impl_org_ortc_Helper.cpp */; }; + 002177971E9701C6008204EA /* impl_org_ortc_Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175471E9701C4008204EA /* impl_org_ortc_Json.cpp */; }; + 002177981E9701C6008204EA /* impl_org_ortc_Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175491E9701C4008204EA /* impl_org_ortc_Logger.cpp */; }; + 002177991E9701C6008204EA /* impl_org_ortc_LongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021754B1E9701C4008204EA /* impl_org_ortc_LongRange.cpp */; }; + 0021779A1E9701C6008204EA /* impl_org_ortc_MediaControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021754D1E9701C4008204EA /* impl_org_ortc_MediaControl.cpp */; }; + 0021779B1E9701C6008204EA /* impl_org_ortc_MediaDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021754F1E9701C4008204EA /* impl_org_ortc_MediaDeviceInfo.cpp */; }; + 0021779C1E9701C6008204EA /* impl_org_ortc_MediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175511E9701C4008204EA /* impl_org_ortc_MediaDevices.cpp */; }; + 0021779D1E9701C6008204EA /* impl_org_ortc_MediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175531E9701C4008204EA /* impl_org_ortc_MediaSource.cpp */; }; + 0021779E1E9701C6008204EA /* impl_org_ortc_MediaStreamConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175551E9701C4008204EA /* impl_org_ortc_MediaStreamConstraints.cpp */; }; + 0021779F1E9701C6008204EA /* impl_org_ortc_MediaStreamTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175571E9701C4008204EA /* impl_org_ortc_MediaStreamTrack.cpp */; }; + 002177A01E9701C6008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175591E9701C4008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp */; }; + 002177A11E9701C6008204EA /* impl_org_ortc_MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021755B1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraints.cpp */; }; + 002177A21E9701C6008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021755D1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp */; }; + 002177A31E9701C6008204EA /* impl_org_ortc_MediaTrackSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021755F1E9701C4008204EA /* impl_org_ortc_MediaTrackSettings.cpp */; }; + 002177A41E9701C6008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175611E9701C4008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp */; }; + 002177A51E9701C6008204EA /* impl_org_ortc_MessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175631E9701C4008204EA /* impl_org_ortc_MessageQueue.cpp */; }; + 002177A61E9701C6008204EA /* impl_org_ortc_OrtcLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175651E9701C4008204EA /* impl_org_ortc_OrtcLib.cpp */; }; + 002177A81E9701C6008204EA /* impl_org_ortc_OverconstrainedError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175691E9701C4008204EA /* impl_org_ortc_OverconstrainedError.cpp */; }; + 002177A91E9701C6008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021756B1E9701C4008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp */; }; + 002177AA1E9701C6008204EA /* impl_org_ortc_RTCCertificate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021756D1E9701C4008204EA /* impl_org_ortc_RTCCertificate.cpp */; }; + 002177AB1E9701C6008204EA /* impl_org_ortc_RTCCertificateStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021756F1E9701C4008204EA /* impl_org_ortc_RTCCertificateStats.cpp */; }; + 002177AC1E9701C6008204EA /* impl_org_ortc_RTCCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175711E9701C4008204EA /* impl_org_ortc_RTCCodec.cpp */; }; + 002177AD1E9701C6008204EA /* impl_org_ortc_RTCDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175731E9701C4008204EA /* impl_org_ortc_RTCDataChannel.cpp */; }; + 002177AE1E9701C6008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175751E9701C4008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp */; }; + 002177AF1E9701C6008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175771E9701C4008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp */; }; + 002177B01E9701C6008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175791E9701C4008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp */; }; + 002177B11E9701C6008204EA /* impl_org_ortc_RTCDataChannelStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021757B1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStats.cpp */; }; + 002177B21E9701C6008204EA /* impl_org_ortc_RTCDataTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021757D1E9701C4008204EA /* impl_org_ortc_RTCDataTransport.cpp */; }; + 002177B31E9701C6008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021757F1E9701C4008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp */; }; + 002177B41E9701C6008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175811E9701C4008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp */; }; + 002177B51E9701C6008204EA /* impl_org_ortc_RTCDtlsParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175831E9701C4008204EA /* impl_org_ortc_RTCDtlsParameters.cpp */; }; + 002177B61E9701C6008204EA /* impl_org_ortc_RTCDtlsTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175851E9701C4008204EA /* impl_org_ortc_RTCDtlsTransport.cpp */; }; + 002177B71E9701C6008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175871E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */; }; + 002177B81E9701C6008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175891E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp */; }; + 002177B91E9701C6008204EA /* impl_org_ortc_RTCDtmfSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021758B1E9701C4008204EA /* impl_org_ortc_RTCDtmfSender.cpp */; }; + 002177BA1E9701C6008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021758D1E9701C4008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp */; }; + 002177BB1E9701C6008204EA /* impl_org_ortc_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021758F1E9701C4008204EA /* impl_org_ortc_RTCIceCandidate.cpp */; }; + 002177BC1E9701C6008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175911E9701C4008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp */; }; + 002177BD1E9701C6008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175931E9701C5008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp */; }; + 002177BE1E9701C6008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175951E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp */; }; + 002177BF1E9701C6008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175971E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp */; }; + 002177C01E9701C6008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175991E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp */; }; + 002177C11E9701C6008204EA /* impl_org_ortc_RTCIceGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021759B1E9701C5008204EA /* impl_org_ortc_RTCIceGatherer.cpp */; }; + 002177C21E9701C6008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021759D1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp */; }; + 002177C31E9701C6008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021759F1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */; }; + 002177C41E9701C6008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175A11E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp */; }; + 002177C51E9701C6008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175A31E9701C5008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp */; }; + 002177C61E9701C6008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175A51E9701C5008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp */; }; + 002177C71E9701C6008204EA /* impl_org_ortc_RTCIceGathererStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175A71E9701C5008204EA /* impl_org_ortc_RTCIceGathererStats.cpp */; }; + 002177C81E9701C6008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175A91E9701C5008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp */; }; + 002177C91E9701C6008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175AB1E9701C5008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp */; }; + 002177CA1E9701C6008204EA /* impl_org_ortc_RTCIceParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175AD1E9701C5008204EA /* impl_org_ortc_RTCIceParameters.cpp */; }; + 002177CB1E9701C6008204EA /* impl_org_ortc_RTCIceServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175AF1E9701C5008204EA /* impl_org_ortc_RTCIceServer.cpp */; }; + 002177CC1E9701C6008204EA /* impl_org_ortc_RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175B11E9701C5008204EA /* impl_org_ortc_RTCIceTransport.cpp */; }; + 002177CD1E9701C6008204EA /* impl_org_ortc_RTCIceTransportController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175B31E9701C5008204EA /* impl_org_ortc_RTCIceTransportController.cpp */; }; + 002177CE1E9701C6008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175B51E9701C5008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp */; }; + 002177CF1E9701C6008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175B71E9701C5008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp */; }; + 002177D01E9701C6008204EA /* impl_org_ortc_RTCIceTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175B91E9701C5008204EA /* impl_org_ortc_RTCIceTransportStats.cpp */; }; + 002177D11E9701C6008204EA /* impl_org_ortc_RTCIdentity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175BB1E9701C5008204EA /* impl_org_ortc_RTCIdentity.cpp */; }; + 002177D21E9701C6008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175BD1E9701C5008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp */; }; + 002177D31E9701C6008204EA /* impl_org_ortc_RTCIdentityError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175BF1E9701C5008204EA /* impl_org_ortc_RTCIdentityError.cpp */; }; + 002177D41E9701C6008204EA /* impl_org_ortc_RTCIdentityResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175C11E9701C5008204EA /* impl_org_ortc_RTCIdentityResult.cpp */; }; + 002177D51E9701C6008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175C31E9701C5008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp */; }; + 002177D61E9701C6008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175C51E9701C5008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp */; }; + 002177D71E9701C6008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175C71E9701C5008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp */; }; + 002177D81E9701C6008204EA /* impl_org_ortc_RTCMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175C91E9701C5008204EA /* impl_org_ortc_RTCMessageEvent.cpp */; }; + 002177D91E9701C6008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175CB1E9701C5008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp */; }; + 002177DA1E9701C6008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175CD1E9701C5008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp */; }; + 002177DB1E9701C6008204EA /* impl_org_ortc_RTCRtcpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175CF1E9701C5008204EA /* impl_org_ortc_RTCRtcpParameters.cpp */; }; + 002177DC1E9701C6008204EA /* impl_org_ortc_RTCRtcpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175D11E9701C5008204EA /* impl_org_ortc_RTCRtcpTransport.cpp */; }; + 002177DD1E9701C6008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175D31E9701C5008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp */; }; + 002177DE1E9701C6008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175D51E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp */; }; + 002177DF1E9701C6008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175D71E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp */; }; + 002177E01E9701C6008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175D91E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp */; }; + 002177E11E9701C6008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175DB1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp */; }; + 002177E21E9701C7008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175DD1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp */; }; + 002177E31E9701C7008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175DF1E9701C5008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp */; }; + 002177E41E9701C7008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175E11E9701C5008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp */; }; + 002177E51E9701C7008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175E31E9701C5008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp */; }; + 002177E61E9701C7008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175E51E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */; }; + 002177E71E9701C7008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175E71E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */; }; + 002177E81E9701C7008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175E91E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */; }; + 002177E91E9701C7008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175EB1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp */; }; + 002177EA1E9701C7008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175ED1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp */; }; + 002177EB1E9701C7008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175EF1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp */; }; + 002177EC1E9701C7008204EA /* impl_org_ortc_RTCRtpListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175F11E9701C5008204EA /* impl_org_ortc_RTCRtpListener.cpp */; }; + 002177ED1E9701C7008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175F31E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */; }; + 002177EE1E9701C7008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175F51E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */; }; + 002177EF1E9701C7008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175F71E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */; }; + 002177F01E9701C7008204EA /* impl_org_ortc_RTCRtpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175F91E9701C5008204EA /* impl_org_ortc_RTCRtpParameters.cpp */; }; + 002177F11E9701C7008204EA /* impl_org_ortc_RTCRtpReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175FB1E9701C5008204EA /* impl_org_ortc_RTCRtpReceiver.cpp */; }; + 002177F21E9701C7008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175FD1E9701C5008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp */; }; + 002177F31E9701C7008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002175FF1E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */; }; + 002177F41E9701C7008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176011E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */; }; + 002177F51E9701C7008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176031E9701C5008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp */; }; + 002177F61E9701C7008204EA /* impl_org_ortc_RTCRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176051E9701C5008204EA /* impl_org_ortc_RTCRtpSender.cpp */; }; + 002177F71E9701C7008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176071E9701C5008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp */; }; + 002177F81E9701C7008204EA /* impl_org_ortc_RTCRtpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176091E9701C6008204EA /* impl_org_ortc_RTCRtpTransport.cpp */; }; + 002177F91E9701C7008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021760B1E9701C6008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp */; }; + 002177FA1E9701C7008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021760D1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */; }; + 002177FB1E9701C7008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021760F1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */; }; + 002177FC1E9701C7008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176111E9701C6008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp */; }; + 002177FD1E9701C7008204EA /* impl_org_ortc_RTCSctpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176131E9701C6008204EA /* impl_org_ortc_RTCSctpTransport.cpp */; }; + 002177FE1E9701C7008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176151E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp */; }; + 002177FF1E9701C7008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176171E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp */; }; + 002178001E9701C7008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176191E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp */; }; + 002178011E9701C7008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021761B1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp */; }; + 002178021E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021761D1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp */; }; + 002178031E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021761F1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp */; }; + 002178041E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176211E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp */; }; + 002178051E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176231E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp */; }; + 002178061E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176251E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */; }; + 002178071E9701C7008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176271E9701C6008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp */; }; + 002178081E9701C7008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176291E9701C6008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp */; }; + 002178091E9701C7008204EA /* impl_org_ortc_RTCStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021762B1E9701C6008204EA /* impl_org_ortc_RTCStats.cpp */; }; + 0021780A1E9701C7008204EA /* impl_org_ortc_RTCStatsProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021762D1E9701C6008204EA /* impl_org_ortc_RTCStatsProvider.cpp */; }; + 0021780B1E9701C7008204EA /* impl_org_ortc_RTCStatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0021762F1E9701C6008204EA /* impl_org_ortc_RTCStatsReport.cpp */; }; + 0021780C1E9701C7008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176311E9701C6008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp */; }; + 0021780D1E9701C7008204EA /* impl_org_ortc_Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176331E9701C6008204EA /* impl_org_ortc_Settings.cpp */; }; + 0021780E1E9701C7008204EA /* impl_org_ortc_StringOrStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 002176351E9701C6008204EA /* impl_org_ortc_StringOrStringList.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 0021713B1E97017D008204EA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0021713D1E97017D008204EA /* libortclib-wrapper-ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libortclib-wrapper-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 002174FA1E9701C3008204EA /* impl_org_ortc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc.cpp; sourceTree = ""; }; + 002174FB1E9701C3008204EA /* impl_org_ortc_adapter_MediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_MediaStream.cpp; sourceTree = ""; }; + 002174FC1E9701C3008204EA /* impl_org_ortc_adapter_MediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_MediaStream.h; sourceTree = ""; }; + 002174FD1E9701C3008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCAnswerOptions.cpp; sourceTree = ""; }; + 002174FE1E9701C3008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCAnswerOptions.h; sourceTree = ""; }; + 002174FF1E9701C3008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCCapabilityOptions.cpp; sourceTree = ""; }; + 002175001E9701C3008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCCapabilityOptions.h; sourceTree = ""; }; + 002175011E9701C3008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCConfiguration.cpp; sourceTree = ""; }; + 002175021E9701C3008204EA /* impl_org_ortc_adapter_RTCConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCConfiguration.h; sourceTree = ""; }; + 002175031E9701C3008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCIceCandidate.cpp; sourceTree = ""; }; + 002175041E9701C3008204EA /* impl_org_ortc_adapter_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCIceCandidate.h; sourceTree = ""; }; + 002175051E9701C3008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp; sourceTree = ""; }; + 002175061E9701C3008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h; sourceTree = ""; }; + 002175071E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp; sourceTree = ""; }; + 002175081E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCOfferAnswerOptions.h; sourceTree = ""; }; + 002175091E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCOfferOptions.cpp; sourceTree = ""; }; + 0021750A1E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCOfferOptions.h; sourceTree = ""; }; + 0021750B1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCPeerConnection.cpp; sourceTree = ""; }; + 0021750C1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCPeerConnection.h; sourceTree = ""; }; + 0021750D1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp; sourceTree = ""; }; + 0021750E1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h; sourceTree = ""; }; + 0021750F1E9701C4008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp; sourceTree = ""; }; + 002175101E9701C4008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h; sourceTree = ""; }; + 002175111E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescription.cpp; sourceTree = ""; }; + 002175121E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescription.h; sourceTree = ""; }; + 002175131E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp; sourceTree = ""; }; + 002175141E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h; sourceTree = ""; }; + 002175151E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp; sourceTree = ""; }; + 002175161E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h; sourceTree = ""; }; + 002175171E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp; sourceTree = ""; }; + 002175181E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionDescription.h; sourceTree = ""; }; + 002175191E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp; sourceTree = ""; }; + 0021751A1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h; sourceTree = ""; }; + 0021751B1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp; sourceTree = ""; }; + 0021751C1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h; sourceTree = ""; }; + 0021751D1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp; sourceTree = ""; }; + 0021751E1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h; sourceTree = ""; }; + 0021751F1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp; sourceTree = ""; }; + 002175201E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h; sourceTree = ""; }; + 002175211E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp; sourceTree = ""; }; + 002175221E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h; sourceTree = ""; }; + 002175231E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp; sourceTree = ""; }; + 002175241E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h; sourceTree = ""; }; + 002175251E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp; sourceTree = ""; }; + 002175261E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h; sourceTree = ""; }; + 002175271E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp; sourceTree = ""; }; + 002175281E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionTransport.h; sourceTree = ""; }; + 002175291E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp; sourceTree = ""; }; + 0021752A1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h; sourceTree = ""; }; + 0021752B1E9701C4008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCTrackEvent.cpp; sourceTree = ""; }; + 0021752C1E9701C4008204EA /* impl_org_ortc_adapter_RTCTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCTrackEvent.h; sourceTree = ""; }; + 0021752D1E9701C4008204EA /* impl_org_ortc_ConstrainBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainBoolean.cpp; sourceTree = ""; }; + 0021752E1E9701C4008204EA /* impl_org_ortc_ConstrainBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainBoolean.h; sourceTree = ""; }; + 0021752F1E9701C4008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainBooleanParameters.cpp; sourceTree = ""; }; + 002175301E9701C4008204EA /* impl_org_ortc_ConstrainBooleanParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainBooleanParameters.h; sourceTree = ""; }; + 002175311E9701C4008204EA /* impl_org_ortc_ConstrainDouble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainDouble.cpp; sourceTree = ""; }; + 002175321E9701C4008204EA /* impl_org_ortc_ConstrainDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainDouble.h; sourceTree = ""; }; + 002175331E9701C4008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainDoubleRange.cpp; sourceTree = ""; }; + 002175341E9701C4008204EA /* impl_org_ortc_ConstrainDoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainDoubleRange.h; sourceTree = ""; }; + 002175351E9701C4008204EA /* impl_org_ortc_ConstrainLong.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainLong.cpp; sourceTree = ""; }; + 002175361E9701C4008204EA /* impl_org_ortc_ConstrainLong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainLong.h; sourceTree = ""; }; + 002175371E9701C4008204EA /* impl_org_ortc_ConstrainLongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainLongRange.cpp; sourceTree = ""; }; + 002175381E9701C4008204EA /* impl_org_ortc_ConstrainLongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainLongRange.h; sourceTree = ""; }; + 002175391E9701C4008204EA /* impl_org_ortc_ConstrainString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainString.cpp; sourceTree = ""; }; + 0021753A1E9701C4008204EA /* impl_org_ortc_ConstrainString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainString.h; sourceTree = ""; }; + 0021753B1E9701C4008204EA /* impl_org_ortc_ConstrainStringParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainStringParameters.cpp; sourceTree = ""; }; + 0021753C1E9701C4008204EA /* impl_org_ortc_ConstrainStringParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainStringParameters.h; sourceTree = ""; }; + 0021753D1E9701C4008204EA /* impl_org_ortc_Dispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Dispatcher.cpp; sourceTree = ""; }; + 0021753E1E9701C4008204EA /* impl_org_ortc_Dispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Dispatcher.h; sourceTree = ""; }; + 0021753F1E9701C4008204EA /* impl_org_ortc_DoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_DoubleRange.cpp; sourceTree = ""; }; + 002175401E9701C4008204EA /* impl_org_ortc_DoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_DoubleRange.h; sourceTree = ""; }; + 002175411E9701C4008204EA /* impl_org_ortc_Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Error.cpp; sourceTree = ""; }; + 002175421E9701C4008204EA /* impl_org_ortc_Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Error.h; sourceTree = ""; }; + 002175431E9701C4008204EA /* impl_org_ortc_ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ErrorEvent.cpp; sourceTree = ""; }; + 002175441E9701C4008204EA /* impl_org_ortc_ErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ErrorEvent.h; sourceTree = ""; }; + 002175451E9701C4008204EA /* impl_org_ortc_Helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Helper.cpp; sourceTree = ""; }; + 002175461E9701C4008204EA /* impl_org_ortc_Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Helper.h; sourceTree = ""; }; + 002175471E9701C4008204EA /* impl_org_ortc_Json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Json.cpp; sourceTree = ""; }; + 002175481E9701C4008204EA /* impl_org_ortc_Json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Json.h; sourceTree = ""; }; + 002175491E9701C4008204EA /* impl_org_ortc_Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Logger.cpp; sourceTree = ""; }; + 0021754A1E9701C4008204EA /* impl_org_ortc_Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Logger.h; sourceTree = ""; }; + 0021754B1E9701C4008204EA /* impl_org_ortc_LongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_LongRange.cpp; sourceTree = ""; }; + 0021754C1E9701C4008204EA /* impl_org_ortc_LongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_LongRange.h; sourceTree = ""; }; + 0021754D1E9701C4008204EA /* impl_org_ortc_MediaControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaControl.cpp; sourceTree = ""; }; + 0021754E1E9701C4008204EA /* impl_org_ortc_MediaControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaControl.h; sourceTree = ""; }; + 0021754F1E9701C4008204EA /* impl_org_ortc_MediaDeviceInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaDeviceInfo.cpp; sourceTree = ""; }; + 002175501E9701C4008204EA /* impl_org_ortc_MediaDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaDeviceInfo.h; sourceTree = ""; }; + 002175511E9701C4008204EA /* impl_org_ortc_MediaDevices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaDevices.cpp; sourceTree = ""; }; + 002175521E9701C4008204EA /* impl_org_ortc_MediaDevices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaDevices.h; sourceTree = ""; }; + 002175531E9701C4008204EA /* impl_org_ortc_MediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaSource.cpp; sourceTree = ""; }; + 002175541E9701C4008204EA /* impl_org_ortc_MediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaSource.h; sourceTree = ""; }; + 002175551E9701C4008204EA /* impl_org_ortc_MediaStreamConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaStreamConstraints.cpp; sourceTree = ""; }; + 002175561E9701C4008204EA /* impl_org_ortc_MediaStreamConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaStreamConstraints.h; sourceTree = ""; }; + 002175571E9701C4008204EA /* impl_org_ortc_MediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaStreamTrack.cpp; sourceTree = ""; }; + 002175581E9701C4008204EA /* impl_org_ortc_MediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaStreamTrack.h; sourceTree = ""; }; + 002175591E9701C4008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackCapabilities.cpp; sourceTree = ""; }; + 0021755A1E9701C4008204EA /* impl_org_ortc_MediaTrackCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackCapabilities.h; sourceTree = ""; }; + 0021755B1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackConstraints.cpp; sourceTree = ""; }; + 0021755C1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackConstraints.h; sourceTree = ""; }; + 0021755D1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackConstraintSet.cpp; sourceTree = ""; }; + 0021755E1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraintSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackConstraintSet.h; sourceTree = ""; }; + 0021755F1E9701C4008204EA /* impl_org_ortc_MediaTrackSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackSettings.cpp; sourceTree = ""; }; + 002175601E9701C4008204EA /* impl_org_ortc_MediaTrackSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackSettings.h; sourceTree = ""; }; + 002175611E9701C4008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackSupportedConstraints.cpp; sourceTree = ""; }; + 002175621E9701C4008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackSupportedConstraints.h; sourceTree = ""; }; + 002175631E9701C4008204EA /* impl_org_ortc_MessageQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MessageQueue.cpp; sourceTree = ""; }; + 002175641E9701C4008204EA /* impl_org_ortc_MessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MessageQueue.h; sourceTree = ""; }; + 002175651E9701C4008204EA /* impl_org_ortc_OrtcLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OrtcLib.cpp; sourceTree = ""; }; + 002175661E9701C4008204EA /* impl_org_ortc_OrtcLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OrtcLib.h; sourceTree = ""; }; + 002175671E9701C4008204EA /* impl_org_ortc_OrtcLibWithDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OrtcLibWithDispatcher.cpp; sourceTree = ""; }; + 002175681E9701C4008204EA /* impl_org_ortc_OrtcLibWithDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OrtcLibWithDispatcher.h; sourceTree = ""; }; + 002175691E9701C4008204EA /* impl_org_ortc_OverconstrainedError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OverconstrainedError.cpp; sourceTree = ""; }; + 0021756A1E9701C4008204EA /* impl_org_ortc_OverconstrainedError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OverconstrainedError.h; sourceTree = ""; }; + 0021756B1E9701C4008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OverconstrainedErrorEvent.cpp; sourceTree = ""; }; + 0021756C1E9701C4008204EA /* impl_org_ortc_OverconstrainedErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OverconstrainedErrorEvent.h; sourceTree = ""; }; + 0021756D1E9701C4008204EA /* impl_org_ortc_RTCCertificate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCCertificate.cpp; sourceTree = ""; }; + 0021756E1E9701C4008204EA /* impl_org_ortc_RTCCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCCertificate.h; sourceTree = ""; }; + 0021756F1E9701C4008204EA /* impl_org_ortc_RTCCertificateStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCCertificateStats.cpp; sourceTree = ""; }; + 002175701E9701C4008204EA /* impl_org_ortc_RTCCertificateStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCCertificateStats.h; sourceTree = ""; }; + 002175711E9701C4008204EA /* impl_org_ortc_RTCCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCCodec.cpp; sourceTree = ""; }; + 002175721E9701C4008204EA /* impl_org_ortc_RTCCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCCodec.h; sourceTree = ""; }; + 002175731E9701C4008204EA /* impl_org_ortc_RTCDataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannel.cpp; sourceTree = ""; }; + 002175741E9701C4008204EA /* impl_org_ortc_RTCDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannel.h; sourceTree = ""; }; + 002175751E9701C4008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelEvent.cpp; sourceTree = ""; }; + 002175761E9701C4008204EA /* impl_org_ortc_RTCDataChannelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelEvent.h; sourceTree = ""; }; + 002175771E9701C4008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelParameters.cpp; sourceTree = ""; }; + 002175781E9701C4008204EA /* impl_org_ortc_RTCDataChannelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelParameters.h; sourceTree = ""; }; + 002175791E9701C4008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelStateChangeEvent.cpp; sourceTree = ""; }; + 0021757A1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelStateChangeEvent.h; sourceTree = ""; }; + 0021757B1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelStats.cpp; sourceTree = ""; }; + 0021757C1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelStats.h; sourceTree = ""; }; + 0021757D1E9701C4008204EA /* impl_org_ortc_RTCDataTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataTransport.cpp; sourceTree = ""; }; + 0021757E1E9701C4008204EA /* impl_org_ortc_RTCDataTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataTransport.h; sourceTree = ""; }; + 0021757F1E9701C4008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsCertificateBinary.cpp; sourceTree = ""; }; + 002175801E9701C4008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsCertificateBinary.h; sourceTree = ""; }; + 002175811E9701C4008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsFingerprint.cpp; sourceTree = ""; }; + 002175821E9701C4008204EA /* impl_org_ortc_RTCDtlsFingerprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsFingerprint.h; sourceTree = ""; }; + 002175831E9701C4008204EA /* impl_org_ortc_RTCDtlsParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsParameters.cpp; sourceTree = ""; }; + 002175841E9701C4008204EA /* impl_org_ortc_RTCDtlsParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsParameters.h; sourceTree = ""; }; + 002175851E9701C4008204EA /* impl_org_ortc_RTCDtlsTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsTransport.cpp; sourceTree = ""; }; + 002175861E9701C4008204EA /* impl_org_ortc_RTCDtlsTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsTransport.h; sourceTree = ""; }; + 002175871E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp; sourceTree = ""; }; + 002175881E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsTransportStateChangeEvent.h; sourceTree = ""; }; + 002175891E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsTransportStats.cpp; sourceTree = ""; }; + 0021758A1E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsTransportStats.h; sourceTree = ""; }; + 0021758B1E9701C4008204EA /* impl_org_ortc_RTCDtmfSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtmfSender.cpp; sourceTree = ""; }; + 0021758C1E9701C4008204EA /* impl_org_ortc_RTCDtmfSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtmfSender.h; sourceTree = ""; }; + 0021758D1E9701C4008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtmfToneChangeEvent.cpp; sourceTree = ""; }; + 0021758E1E9701C4008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtmfToneChangeEvent.h; sourceTree = ""; }; + 0021758F1E9701C4008204EA /* impl_org_ortc_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidate.cpp; sourceTree = ""; }; + 002175901E9701C4008204EA /* impl_org_ortc_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidate.h; sourceTree = ""; }; + 002175911E9701C4008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidateAttributes.cpp; sourceTree = ""; }; + 002175921E9701C4008204EA /* impl_org_ortc_RTCIceCandidateAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidateAttributes.h; sourceTree = ""; }; + 002175931E9701C5008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidateComplete.cpp; sourceTree = ""; }; + 002175941E9701C5008204EA /* impl_org_ortc_RTCIceCandidateComplete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidateComplete.h; sourceTree = ""; }; + 002175951E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidatePair.cpp; sourceTree = ""; }; + 002175961E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidatePair.h; sourceTree = ""; }; + 002175971E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp; sourceTree = ""; }; + 002175981E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidatePairChangeEvent.h; sourceTree = ""; }; + 002175991E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidatePairStats.cpp; sourceTree = ""; }; + 0021759A1E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidatePairStats.h; sourceTree = ""; }; + 0021759B1E9701C5008204EA /* impl_org_ortc_RTCIceGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGatherer.cpp; sourceTree = ""; }; + 0021759C1E9701C5008204EA /* impl_org_ortc_RTCIceGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGatherer.h; sourceTree = ""; }; + 0021759D1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererCandidate.cpp; sourceTree = ""; }; + 0021759E1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererCandidate.h; sourceTree = ""; }; + 0021759F1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp; sourceTree = ""; }; + 002175A01E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h; sourceTree = ""; }; + 002175A11E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererCandidateEvent.cpp; sourceTree = ""; }; + 002175A21E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererCandidateEvent.h; sourceTree = ""; }; + 002175A31E9701C5008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererIceErrorEvent.cpp; sourceTree = ""; }; + 002175A41E9701C5008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererIceErrorEvent.h; sourceTree = ""; }; + 002175A51E9701C5008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererStateChangeEvent.cpp; sourceTree = ""; }; + 002175A61E9701C5008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererStateChangeEvent.h; sourceTree = ""; }; + 002175A71E9701C5008204EA /* impl_org_ortc_RTCIceGathererStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererStats.cpp; sourceTree = ""; }; + 002175A81E9701C5008204EA /* impl_org_ortc_RTCIceGathererStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererStats.h; sourceTree = ""; }; + 002175A91E9701C5008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGatherInterfacePolicy.cpp; sourceTree = ""; }; + 002175AA1E9701C5008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGatherInterfacePolicy.h; sourceTree = ""; }; + 002175AB1E9701C5008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGatherOptions.cpp; sourceTree = ""; }; + 002175AC1E9701C5008204EA /* impl_org_ortc_RTCIceGatherOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGatherOptions.h; sourceTree = ""; }; + 002175AD1E9701C5008204EA /* impl_org_ortc_RTCIceParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceParameters.cpp; sourceTree = ""; }; + 002175AE1E9701C5008204EA /* impl_org_ortc_RTCIceParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceParameters.h; sourceTree = ""; }; + 002175AF1E9701C5008204EA /* impl_org_ortc_RTCIceServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceServer.cpp; sourceTree = ""; }; + 002175B01E9701C5008204EA /* impl_org_ortc_RTCIceServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceServer.h; sourceTree = ""; }; + 002175B11E9701C5008204EA /* impl_org_ortc_RTCIceTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransport.cpp; sourceTree = ""; }; + 002175B21E9701C5008204EA /* impl_org_ortc_RTCIceTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransport.h; sourceTree = ""; }; + 002175B31E9701C5008204EA /* impl_org_ortc_RTCIceTransportController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportController.cpp; sourceTree = ""; }; + 002175B41E9701C5008204EA /* impl_org_ortc_RTCIceTransportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportController.h; sourceTree = ""; }; + 002175B51E9701C5008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportOptions.cpp; sourceTree = ""; }; + 002175B61E9701C5008204EA /* impl_org_ortc_RTCIceTransportOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportOptions.h; sourceTree = ""; }; + 002175B71E9701C5008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportStateChangeEvent.cpp; sourceTree = ""; }; + 002175B81E9701C5008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportStateChangeEvent.h; sourceTree = ""; }; + 002175B91E9701C5008204EA /* impl_org_ortc_RTCIceTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportStats.cpp; sourceTree = ""; }; + 002175BA1E9701C5008204EA /* impl_org_ortc_RTCIceTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportStats.h; sourceTree = ""; }; + 002175BB1E9701C5008204EA /* impl_org_ortc_RTCIdentity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentity.cpp; sourceTree = ""; }; + 002175BC1E9701C5008204EA /* impl_org_ortc_RTCIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentity.h; sourceTree = ""; }; + 002175BD1E9701C5008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentityAssertion.cpp; sourceTree = ""; }; + 002175BE1E9701C5008204EA /* impl_org_ortc_RTCIdentityAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentityAssertion.h; sourceTree = ""; }; + 002175BF1E9701C5008204EA /* impl_org_ortc_RTCIdentityError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentityError.cpp; sourceTree = ""; }; + 002175C01E9701C5008204EA /* impl_org_ortc_RTCIdentityError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentityError.h; sourceTree = ""; }; + 002175C11E9701C5008204EA /* impl_org_ortc_RTCIdentityResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentityResult.cpp; sourceTree = ""; }; + 002175C21E9701C5008204EA /* impl_org_ortc_RTCIdentityResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentityResult.h; sourceTree = ""; }; + 002175C31E9701C5008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCInboundRtpStreamStats.cpp; sourceTree = ""; }; + 002175C41E9701C5008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCInboundRtpStreamStats.h; sourceTree = ""; }; + 002175C51E9701C5008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCMediaStreamStats.cpp; sourceTree = ""; }; + 002175C61E9701C5008204EA /* impl_org_ortc_RTCMediaStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCMediaStreamStats.h; sourceTree = ""; }; + 002175C71E9701C5008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCMediaStreamTrackStats.cpp; sourceTree = ""; }; + 002175C81E9701C5008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCMediaStreamTrackStats.h; sourceTree = ""; }; + 002175C91E9701C5008204EA /* impl_org_ortc_RTCMessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCMessageEvent.cpp; sourceTree = ""; }; + 002175CA1E9701C5008204EA /* impl_org_ortc_RTCMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCMessageEvent.h; sourceTree = ""; }; + 002175CB1E9701C5008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCOutboundRtpStreamStats.cpp; sourceTree = ""; }; + 002175CC1E9701C5008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCOutboundRtpStreamStats.h; sourceTree = ""; }; + 002175CD1E9701C5008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtcpFeedback.cpp; sourceTree = ""; }; + 002175CE1E9701C5008204EA /* impl_org_ortc_RTCRtcpFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtcpFeedback.h; sourceTree = ""; }; + 002175CF1E9701C5008204EA /* impl_org_ortc_RTCRtcpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtcpParameters.cpp; sourceTree = ""; }; + 002175D01E9701C5008204EA /* impl_org_ortc_RTCRtcpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtcpParameters.h; sourceTree = ""; }; + 002175D11E9701C5008204EA /* impl_org_ortc_RTCRtcpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtcpTransport.cpp; sourceTree = ""; }; + 002175D21E9701C5008204EA /* impl_org_ortc_RTCRtcpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtcpTransport.h; sourceTree = ""; }; + 002175D31E9701C5008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCapabilities.cpp; sourceTree = ""; }; + 002175D41E9701C5008204EA /* impl_org_ortc_RTCRtpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCapabilities.h; sourceTree = ""; }; + 002175D51E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecCapability.cpp; sourceTree = ""; }; + 002175D61E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecCapability.h; sourceTree = ""; }; + 002175D71E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp; sourceTree = ""; }; + 002175D81E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecCapabilityOptions.h; sourceTree = ""; }; + 002175D91E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp; sourceTree = ""; }; + 002175DA1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecCapabilityParameters.h; sourceTree = ""; }; + 002175DB1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecParameters.cpp; sourceTree = ""; }; + 002175DC1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecParameters.h; sourceTree = ""; }; + 002175DD1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecParameterSettings.cpp; sourceTree = ""; }; + 002175DE1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecParameterSettings.h; sourceTree = ""; }; + 002175DF1E9701C5008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpContributingSource.cpp; sourceTree = ""; }; + 002175E01E9701C5008204EA /* impl_org_ortc_RTCRtpContributingSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpContributingSource.h; sourceTree = ""; }; + 002175E11E9701C5008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpEncodingParameters.cpp; sourceTree = ""; }; + 002175E21E9701C5008204EA /* impl_org_ortc_RTCRtpEncodingParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpEncodingParameters.h; sourceTree = ""; }; + 002175E31E9701C5008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpFecParameters.cpp; sourceTree = ""; }; + 002175E41E9701C5008204EA /* impl_org_ortc_RTCRtpFecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpFecParameters.h; sourceTree = ""; }; + 002175E51E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp; sourceTree = ""; }; + 002175E61E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h; sourceTree = ""; }; + 002175E71E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp; sourceTree = ""; }; + 002175E81E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h; sourceTree = ""; }; + 002175E91E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp; sourceTree = ""; }; + 002175EA1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h; sourceTree = ""; }; + 002175EB1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp; sourceTree = ""; }; + 002175EC1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpH264CodecParameterSettings.h; sourceTree = ""; }; + 002175ED1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpHeaderExtension.cpp; sourceTree = ""; }; + 002175EE1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpHeaderExtension.h; sourceTree = ""; }; + 002175EF1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp; sourceTree = ""; }; + 002175F01E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpHeaderExtensionParameters.h; sourceTree = ""; }; + 002175F11E9701C5008204EA /* impl_org_ortc_RTCRtpListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpListener.cpp; sourceTree = ""; }; + 002175F21E9701C5008204EA /* impl_org_ortc_RTCRtpListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpListener.h; sourceTree = ""; }; + 002175F31E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp; sourceTree = ""; }; + 002175F41E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h; sourceTree = ""; }; + 002175F51E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp; sourceTree = ""; }; + 002175F61E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h; sourceTree = ""; }; + 002175F71E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp; sourceTree = ""; }; + 002175F81E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpOpusCodecParameterSettings.h; sourceTree = ""; }; + 002175F91E9701C5008204EA /* impl_org_ortc_RTCRtpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpParameters.cpp; sourceTree = ""; }; + 002175FA1E9701C5008204EA /* impl_org_ortc_RTCRtpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpParameters.h; sourceTree = ""; }; + 002175FB1E9701C5008204EA /* impl_org_ortc_RTCRtpReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpReceiver.cpp; sourceTree = ""; }; + 002175FC1E9701C5008204EA /* impl_org_ortc_RTCRtpReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpReceiver.h; sourceTree = ""; }; + 002175FD1E9701C5008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp; sourceTree = ""; }; + 002175FE1E9701C5008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRedCodecParameterSettings.h; sourceTree = ""; }; + 002175FF1E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp; sourceTree = ""; }; + 002176001E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h; sourceTree = ""; }; + 002176011E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp; sourceTree = ""; }; + 002176021E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRtxCodecParameterSettings.h; sourceTree = ""; }; + 002176031E9701C5008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRtxParameters.cpp; sourceTree = ""; }; + 002176041E9701C5008204EA /* impl_org_ortc_RTCRtpRtxParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRtxParameters.h; sourceTree = ""; }; + 002176051E9701C5008204EA /* impl_org_ortc_RTCRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpSender.cpp; sourceTree = ""; }; + 002176061E9701C5008204EA /* impl_org_ortc_RTCRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpSender.h; sourceTree = ""; }; + 002176071E9701C5008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpStreamStats.cpp; sourceTree = ""; }; + 002176081E9701C6008204EA /* impl_org_ortc_RTCRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpStreamStats.h; sourceTree = ""; }; + 002176091E9701C6008204EA /* impl_org_ortc_RTCRtpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpTransport.cpp; sourceTree = ""; }; + 0021760A1E9701C6008204EA /* impl_org_ortc_RTCRtpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpTransport.h; sourceTree = ""; }; + 0021760B1E9701C6008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpUnhandledEvent.cpp; sourceTree = ""; }; + 0021760C1E9701C6008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpUnhandledEvent.h; sourceTree = ""; }; + 0021760D1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp; sourceTree = ""; }; + 0021760E1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h; sourceTree = ""; }; + 0021760F1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp; sourceTree = ""; }; + 002176101E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpVp8CodecParameterSettings.h; sourceTree = ""; }; + 002176111E9701C6008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpCapabilities.cpp; sourceTree = ""; }; + 002176121E9701C6008204EA /* impl_org_ortc_RTCSctpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpCapabilities.h; sourceTree = ""; }; + 002176131E9701C6008204EA /* impl_org_ortc_RTCSctpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransport.cpp; sourceTree = ""; }; + 002176141E9701C6008204EA /* impl_org_ortc_RTCSctpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransport.h; sourceTree = ""; }; + 002176151E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportListener.cpp; sourceTree = ""; }; + 002176161E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportListener.h; sourceTree = ""; }; + 002176171E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportListenerEvent.cpp; sourceTree = ""; }; + 002176181E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportListenerEvent.h; sourceTree = ""; }; + 002176191E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp; sourceTree = ""; }; + 0021761A1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportStateChangeEvent.h; sourceTree = ""; }; + 0021761B1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportStats.cpp; sourceTree = ""; }; + 0021761C1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportStats.h; sourceTree = ""; }; + 0021761D1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp; sourceTree = ""; }; + 0021761E1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesCryptoParameters.h; sourceTree = ""; }; + 0021761F1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesKeyParameters.cpp; sourceTree = ""; }; + 002176201E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesKeyParameters.h; sourceTree = ""; }; + 002176211E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesParameters.cpp; sourceTree = ""; }; + 002176221E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesParameters.h; sourceTree = ""; }; + 002176231E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesTransport.cpp; sourceTree = ""; }; + 002176241E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesTransport.h; sourceTree = ""; }; + 002176251E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp; sourceTree = ""; }; + 002176261E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h; sourceTree = ""; }; + 002176271E9701C6008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpTransportStats.cpp; sourceTree = ""; }; + 002176281E9701C6008204EA /* impl_org_ortc_RTCSrtpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpTransportStats.h; sourceTree = ""; }; + 002176291E9701C6008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSsrcConflictEvent.cpp; sourceTree = ""; }; + 0021762A1E9701C6008204EA /* impl_org_ortc_RTCSsrcConflictEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSsrcConflictEvent.h; sourceTree = ""; }; + 0021762B1E9701C6008204EA /* impl_org_ortc_RTCStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStats.cpp; sourceTree = ""; }; + 0021762C1E9701C6008204EA /* impl_org_ortc_RTCStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStats.h; sourceTree = ""; }; + 0021762D1E9701C6008204EA /* impl_org_ortc_RTCStatsProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStatsProvider.cpp; sourceTree = ""; }; + 0021762E1E9701C6008204EA /* impl_org_ortc_RTCStatsProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStatsProvider.h; sourceTree = ""; }; + 0021762F1E9701C6008204EA /* impl_org_ortc_RTCStatsReport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStatsReport.cpp; sourceTree = ""; }; + 002176301E9701C6008204EA /* impl_org_ortc_RTCStatsReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStatsReport.h; sourceTree = ""; }; + 002176311E9701C6008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStatsTypeSet.cpp; sourceTree = ""; }; + 002176321E9701C6008204EA /* impl_org_ortc_RTCStatsTypeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStatsTypeSet.h; sourceTree = ""; }; + 002176331E9701C6008204EA /* impl_org_ortc_Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Settings.cpp; sourceTree = ""; }; + 002176341E9701C6008204EA /* impl_org_ortc_Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Settings.h; sourceTree = ""; }; + 002176351E9701C6008204EA /* impl_org_ortc_StringOrStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_StringOrStringList.cpp; sourceTree = ""; }; + 002176361E9701C6008204EA /* impl_org_ortc_StringOrStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_StringOrStringList.h; sourceTree = ""; }; + 002176371E9701C6008204EA /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0021713A1E97017D008204EA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 002171341E97017D008204EA = { + isa = PBXGroup; + children = ( + 002171491E9701C1008204EA /* wrapper */, + 0021713E1E97017D008204EA /* Products */, + ); + sourceTree = ""; + }; + 0021713E1E97017D008204EA /* Products */ = { + isa = PBXGroup; + children = ( + 0021713D1E97017D008204EA /* libortclib-wrapper-ios.a */, + ); + name = Products; + sourceTree = ""; + }; + 002171491E9701C1008204EA /* wrapper */ = { + isa = PBXGroup; + children = ( + 002174FA1E9701C3008204EA /* impl_org_ortc.cpp */, + 002174FB1E9701C3008204EA /* impl_org_ortc_adapter_MediaStream.cpp */, + 002174FC1E9701C3008204EA /* impl_org_ortc_adapter_MediaStream.h */, + 002174FD1E9701C3008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp */, + 002174FE1E9701C3008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.h */, + 002174FF1E9701C3008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp */, + 002175001E9701C3008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.h */, + 002175011E9701C3008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp */, + 002175021E9701C3008204EA /* impl_org_ortc_adapter_RTCConfiguration.h */, + 002175031E9701C3008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp */, + 002175041E9701C3008204EA /* impl_org_ortc_adapter_RTCIceCandidate.h */, + 002175051E9701C3008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */, + 002175061E9701C3008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */, + 002175071E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp */, + 002175081E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.h */, + 002175091E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp */, + 0021750A1E9701C3008204EA /* impl_org_ortc_adapter_RTCOfferOptions.h */, + 0021750B1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp */, + 0021750C1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnection.h */, + 0021750D1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */, + 0021750E1E9701C3008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */, + 0021750F1E9701C4008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */, + 002175101E9701C4008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h */, + 002175111E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp */, + 002175121E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescription.h */, + 002175131E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */, + 002175141E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */, + 002175151E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */, + 002175161E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */, + 002175171E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */, + 002175181E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.h */, + 002175191E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */, + 0021751A1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */, + 0021751B1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */, + 0021751C1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */, + 0021751D1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */, + 0021751E1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */, + 0021751F1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */, + 002175201E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */, + 002175211E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */, + 002175221E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */, + 002175231E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */, + 002175241E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */, + 002175251E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */, + 002175261E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */, + 002175271E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */, + 002175281E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.h */, + 002175291E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */, + 0021752A1E9701C4008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */, + 0021752B1E9701C4008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp */, + 0021752C1E9701C4008204EA /* impl_org_ortc_adapter_RTCTrackEvent.h */, + 0021752D1E9701C4008204EA /* impl_org_ortc_ConstrainBoolean.cpp */, + 0021752E1E9701C4008204EA /* impl_org_ortc_ConstrainBoolean.h */, + 0021752F1E9701C4008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp */, + 002175301E9701C4008204EA /* impl_org_ortc_ConstrainBooleanParameters.h */, + 002175311E9701C4008204EA /* impl_org_ortc_ConstrainDouble.cpp */, + 002175321E9701C4008204EA /* impl_org_ortc_ConstrainDouble.h */, + 002175331E9701C4008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp */, + 002175341E9701C4008204EA /* impl_org_ortc_ConstrainDoubleRange.h */, + 002175351E9701C4008204EA /* impl_org_ortc_ConstrainLong.cpp */, + 002175361E9701C4008204EA /* impl_org_ortc_ConstrainLong.h */, + 002175371E9701C4008204EA /* impl_org_ortc_ConstrainLongRange.cpp */, + 002175381E9701C4008204EA /* impl_org_ortc_ConstrainLongRange.h */, + 002175391E9701C4008204EA /* impl_org_ortc_ConstrainString.cpp */, + 0021753A1E9701C4008204EA /* impl_org_ortc_ConstrainString.h */, + 0021753B1E9701C4008204EA /* impl_org_ortc_ConstrainStringParameters.cpp */, + 0021753C1E9701C4008204EA /* impl_org_ortc_ConstrainStringParameters.h */, + 0021753D1E9701C4008204EA /* impl_org_ortc_Dispatcher.cpp */, + 0021753E1E9701C4008204EA /* impl_org_ortc_Dispatcher.h */, + 0021753F1E9701C4008204EA /* impl_org_ortc_DoubleRange.cpp */, + 002175401E9701C4008204EA /* impl_org_ortc_DoubleRange.h */, + 002175411E9701C4008204EA /* impl_org_ortc_Error.cpp */, + 002175421E9701C4008204EA /* impl_org_ortc_Error.h */, + 002175431E9701C4008204EA /* impl_org_ortc_ErrorEvent.cpp */, + 002175441E9701C4008204EA /* impl_org_ortc_ErrorEvent.h */, + 002175451E9701C4008204EA /* impl_org_ortc_Helper.cpp */, + 002175461E9701C4008204EA /* impl_org_ortc_Helper.h */, + 002175471E9701C4008204EA /* impl_org_ortc_Json.cpp */, + 002175481E9701C4008204EA /* impl_org_ortc_Json.h */, + 002175491E9701C4008204EA /* impl_org_ortc_Logger.cpp */, + 0021754A1E9701C4008204EA /* impl_org_ortc_Logger.h */, + 0021754B1E9701C4008204EA /* impl_org_ortc_LongRange.cpp */, + 0021754C1E9701C4008204EA /* impl_org_ortc_LongRange.h */, + 0021754D1E9701C4008204EA /* impl_org_ortc_MediaControl.cpp */, + 0021754E1E9701C4008204EA /* impl_org_ortc_MediaControl.h */, + 0021754F1E9701C4008204EA /* impl_org_ortc_MediaDeviceInfo.cpp */, + 002175501E9701C4008204EA /* impl_org_ortc_MediaDeviceInfo.h */, + 002175511E9701C4008204EA /* impl_org_ortc_MediaDevices.cpp */, + 002175521E9701C4008204EA /* impl_org_ortc_MediaDevices.h */, + 002175531E9701C4008204EA /* impl_org_ortc_MediaSource.cpp */, + 002175541E9701C4008204EA /* impl_org_ortc_MediaSource.h */, + 002175551E9701C4008204EA /* impl_org_ortc_MediaStreamConstraints.cpp */, + 002175561E9701C4008204EA /* impl_org_ortc_MediaStreamConstraints.h */, + 002175571E9701C4008204EA /* impl_org_ortc_MediaStreamTrack.cpp */, + 002175581E9701C4008204EA /* impl_org_ortc_MediaStreamTrack.h */, + 002175591E9701C4008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp */, + 0021755A1E9701C4008204EA /* impl_org_ortc_MediaTrackCapabilities.h */, + 0021755B1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraints.cpp */, + 0021755C1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraints.h */, + 0021755D1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp */, + 0021755E1E9701C4008204EA /* impl_org_ortc_MediaTrackConstraintSet.h */, + 0021755F1E9701C4008204EA /* impl_org_ortc_MediaTrackSettings.cpp */, + 002175601E9701C4008204EA /* impl_org_ortc_MediaTrackSettings.h */, + 002175611E9701C4008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp */, + 002175621E9701C4008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.h */, + 002175631E9701C4008204EA /* impl_org_ortc_MessageQueue.cpp */, + 002175641E9701C4008204EA /* impl_org_ortc_MessageQueue.h */, + 002175651E9701C4008204EA /* impl_org_ortc_OrtcLib.cpp */, + 002175661E9701C4008204EA /* impl_org_ortc_OrtcLib.h */, + 002175671E9701C4008204EA /* impl_org_ortc_OrtcLibWithDispatcher.cpp */, + 002175681E9701C4008204EA /* impl_org_ortc_OrtcLibWithDispatcher.h */, + 002175691E9701C4008204EA /* impl_org_ortc_OverconstrainedError.cpp */, + 0021756A1E9701C4008204EA /* impl_org_ortc_OverconstrainedError.h */, + 0021756B1E9701C4008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp */, + 0021756C1E9701C4008204EA /* impl_org_ortc_OverconstrainedErrorEvent.h */, + 0021756D1E9701C4008204EA /* impl_org_ortc_RTCCertificate.cpp */, + 0021756E1E9701C4008204EA /* impl_org_ortc_RTCCertificate.h */, + 0021756F1E9701C4008204EA /* impl_org_ortc_RTCCertificateStats.cpp */, + 002175701E9701C4008204EA /* impl_org_ortc_RTCCertificateStats.h */, + 002175711E9701C4008204EA /* impl_org_ortc_RTCCodec.cpp */, + 002175721E9701C4008204EA /* impl_org_ortc_RTCCodec.h */, + 002175731E9701C4008204EA /* impl_org_ortc_RTCDataChannel.cpp */, + 002175741E9701C4008204EA /* impl_org_ortc_RTCDataChannel.h */, + 002175751E9701C4008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp */, + 002175761E9701C4008204EA /* impl_org_ortc_RTCDataChannelEvent.h */, + 002175771E9701C4008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp */, + 002175781E9701C4008204EA /* impl_org_ortc_RTCDataChannelParameters.h */, + 002175791E9701C4008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp */, + 0021757A1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.h */, + 0021757B1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStats.cpp */, + 0021757C1E9701C4008204EA /* impl_org_ortc_RTCDataChannelStats.h */, + 0021757D1E9701C4008204EA /* impl_org_ortc_RTCDataTransport.cpp */, + 0021757E1E9701C4008204EA /* impl_org_ortc_RTCDataTransport.h */, + 0021757F1E9701C4008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp */, + 002175801E9701C4008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.h */, + 002175811E9701C4008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp */, + 002175821E9701C4008204EA /* impl_org_ortc_RTCDtlsFingerprint.h */, + 002175831E9701C4008204EA /* impl_org_ortc_RTCDtlsParameters.cpp */, + 002175841E9701C4008204EA /* impl_org_ortc_RTCDtlsParameters.h */, + 002175851E9701C4008204EA /* impl_org_ortc_RTCDtlsTransport.cpp */, + 002175861E9701C4008204EA /* impl_org_ortc_RTCDtlsTransport.h */, + 002175871E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */, + 002175881E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.h */, + 002175891E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp */, + 0021758A1E9701C4008204EA /* impl_org_ortc_RTCDtlsTransportStats.h */, + 0021758B1E9701C4008204EA /* impl_org_ortc_RTCDtmfSender.cpp */, + 0021758C1E9701C4008204EA /* impl_org_ortc_RTCDtmfSender.h */, + 0021758D1E9701C4008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp */, + 0021758E1E9701C4008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.h */, + 0021758F1E9701C4008204EA /* impl_org_ortc_RTCIceCandidate.cpp */, + 002175901E9701C4008204EA /* impl_org_ortc_RTCIceCandidate.h */, + 002175911E9701C4008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp */, + 002175921E9701C4008204EA /* impl_org_ortc_RTCIceCandidateAttributes.h */, + 002175931E9701C5008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp */, + 002175941E9701C5008204EA /* impl_org_ortc_RTCIceCandidateComplete.h */, + 002175951E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp */, + 002175961E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePair.h */, + 002175971E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp */, + 002175981E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.h */, + 002175991E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp */, + 0021759A1E9701C5008204EA /* impl_org_ortc_RTCIceCandidatePairStats.h */, + 0021759B1E9701C5008204EA /* impl_org_ortc_RTCIceGatherer.cpp */, + 0021759C1E9701C5008204EA /* impl_org_ortc_RTCIceGatherer.h */, + 0021759D1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp */, + 0021759E1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidate.h */, + 0021759F1E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */, + 002175A01E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h */, + 002175A11E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp */, + 002175A21E9701C5008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.h */, + 002175A31E9701C5008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp */, + 002175A41E9701C5008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.h */, + 002175A51E9701C5008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp */, + 002175A61E9701C5008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.h */, + 002175A71E9701C5008204EA /* impl_org_ortc_RTCIceGathererStats.cpp */, + 002175A81E9701C5008204EA /* impl_org_ortc_RTCIceGathererStats.h */, + 002175A91E9701C5008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp */, + 002175AA1E9701C5008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.h */, + 002175AB1E9701C5008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp */, + 002175AC1E9701C5008204EA /* impl_org_ortc_RTCIceGatherOptions.h */, + 002175AD1E9701C5008204EA /* impl_org_ortc_RTCIceParameters.cpp */, + 002175AE1E9701C5008204EA /* impl_org_ortc_RTCIceParameters.h */, + 002175AF1E9701C5008204EA /* impl_org_ortc_RTCIceServer.cpp */, + 002175B01E9701C5008204EA /* impl_org_ortc_RTCIceServer.h */, + 002175B11E9701C5008204EA /* impl_org_ortc_RTCIceTransport.cpp */, + 002175B21E9701C5008204EA /* impl_org_ortc_RTCIceTransport.h */, + 002175B31E9701C5008204EA /* impl_org_ortc_RTCIceTransportController.cpp */, + 002175B41E9701C5008204EA /* impl_org_ortc_RTCIceTransportController.h */, + 002175B51E9701C5008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp */, + 002175B61E9701C5008204EA /* impl_org_ortc_RTCIceTransportOptions.h */, + 002175B71E9701C5008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp */, + 002175B81E9701C5008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.h */, + 002175B91E9701C5008204EA /* impl_org_ortc_RTCIceTransportStats.cpp */, + 002175BA1E9701C5008204EA /* impl_org_ortc_RTCIceTransportStats.h */, + 002175BB1E9701C5008204EA /* impl_org_ortc_RTCIdentity.cpp */, + 002175BC1E9701C5008204EA /* impl_org_ortc_RTCIdentity.h */, + 002175BD1E9701C5008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp */, + 002175BE1E9701C5008204EA /* impl_org_ortc_RTCIdentityAssertion.h */, + 002175BF1E9701C5008204EA /* impl_org_ortc_RTCIdentityError.cpp */, + 002175C01E9701C5008204EA /* impl_org_ortc_RTCIdentityError.h */, + 002175C11E9701C5008204EA /* impl_org_ortc_RTCIdentityResult.cpp */, + 002175C21E9701C5008204EA /* impl_org_ortc_RTCIdentityResult.h */, + 002175C31E9701C5008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp */, + 002175C41E9701C5008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.h */, + 002175C51E9701C5008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp */, + 002175C61E9701C5008204EA /* impl_org_ortc_RTCMediaStreamStats.h */, + 002175C71E9701C5008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp */, + 002175C81E9701C5008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.h */, + 002175C91E9701C5008204EA /* impl_org_ortc_RTCMessageEvent.cpp */, + 002175CA1E9701C5008204EA /* impl_org_ortc_RTCMessageEvent.h */, + 002175CB1E9701C5008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp */, + 002175CC1E9701C5008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.h */, + 002175CD1E9701C5008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp */, + 002175CE1E9701C5008204EA /* impl_org_ortc_RTCRtcpFeedback.h */, + 002175CF1E9701C5008204EA /* impl_org_ortc_RTCRtcpParameters.cpp */, + 002175D01E9701C5008204EA /* impl_org_ortc_RTCRtcpParameters.h */, + 002175D11E9701C5008204EA /* impl_org_ortc_RTCRtcpTransport.cpp */, + 002175D21E9701C5008204EA /* impl_org_ortc_RTCRtcpTransport.h */, + 002175D31E9701C5008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp */, + 002175D41E9701C5008204EA /* impl_org_ortc_RTCRtpCapabilities.h */, + 002175D51E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp */, + 002175D61E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapability.h */, + 002175D71E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp */, + 002175D81E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.h */, + 002175D91E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp */, + 002175DA1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.h */, + 002175DB1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp */, + 002175DC1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameters.h */, + 002175DD1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp */, + 002175DE1E9701C5008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.h */, + 002175DF1E9701C5008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp */, + 002175E01E9701C5008204EA /* impl_org_ortc_RTCRtpContributingSource.h */, + 002175E11E9701C5008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp */, + 002175E21E9701C5008204EA /* impl_org_ortc_RTCRtpEncodingParameters.h */, + 002175E31E9701C5008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp */, + 002175E41E9701C5008204EA /* impl_org_ortc_RTCRtpFecParameters.h */, + 002175E51E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */, + 002175E61E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */, + 002175E71E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */, + 002175E81E9701C5008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */, + 002175E91E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */, + 002175EA1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h */, + 002175EB1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp */, + 002175EC1E9701C5008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.h */, + 002175ED1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp */, + 002175EE1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtension.h */, + 002175EF1E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp */, + 002175F01E9701C5008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.h */, + 002175F11E9701C5008204EA /* impl_org_ortc_RTCRtpListener.cpp */, + 002175F21E9701C5008204EA /* impl_org_ortc_RTCRtpListener.h */, + 002175F31E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */, + 002175F41E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */, + 002175F51E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */, + 002175F61E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */, + 002175F71E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */, + 002175F81E9701C5008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.h */, + 002175F91E9701C5008204EA /* impl_org_ortc_RTCRtpParameters.cpp */, + 002175FA1E9701C5008204EA /* impl_org_ortc_RTCRtpParameters.h */, + 002175FB1E9701C5008204EA /* impl_org_ortc_RTCRtpReceiver.cpp */, + 002175FC1E9701C5008204EA /* impl_org_ortc_RTCRtpReceiver.h */, + 002175FD1E9701C5008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp */, + 002175FE1E9701C5008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.h */, + 002175FF1E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */, + 002176001E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */, + 002176011E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */, + 002176021E9701C5008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.h */, + 002176031E9701C5008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp */, + 002176041E9701C5008204EA /* impl_org_ortc_RTCRtpRtxParameters.h */, + 002176051E9701C5008204EA /* impl_org_ortc_RTCRtpSender.cpp */, + 002176061E9701C5008204EA /* impl_org_ortc_RTCRtpSender.h */, + 002176071E9701C5008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp */, + 002176081E9701C6008204EA /* impl_org_ortc_RTCRtpStreamStats.h */, + 002176091E9701C6008204EA /* impl_org_ortc_RTCRtpTransport.cpp */, + 0021760A1E9701C6008204EA /* impl_org_ortc_RTCRtpTransport.h */, + 0021760B1E9701C6008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp */, + 0021760C1E9701C6008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.h */, + 0021760D1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */, + 0021760E1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */, + 0021760F1E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */, + 002176101E9701C6008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.h */, + 002176111E9701C6008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp */, + 002176121E9701C6008204EA /* impl_org_ortc_RTCSctpCapabilities.h */, + 002176131E9701C6008204EA /* impl_org_ortc_RTCSctpTransport.cpp */, + 002176141E9701C6008204EA /* impl_org_ortc_RTCSctpTransport.h */, + 002176151E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp */, + 002176161E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListener.h */, + 002176171E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp */, + 002176181E9701C6008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.h */, + 002176191E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp */, + 0021761A1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.h */, + 0021761B1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp */, + 0021761C1E9701C6008204EA /* impl_org_ortc_RTCSctpTransportStats.h */, + 0021761D1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp */, + 0021761E1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.h */, + 0021761F1E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp */, + 002176201E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.h */, + 002176211E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp */, + 002176221E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesParameters.h */, + 002176231E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp */, + 002176241E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransport.h */, + 002176251E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */, + 002176261E9701C6008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */, + 002176271E9701C6008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp */, + 002176281E9701C6008204EA /* impl_org_ortc_RTCSrtpTransportStats.h */, + 002176291E9701C6008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp */, + 0021762A1E9701C6008204EA /* impl_org_ortc_RTCSsrcConflictEvent.h */, + 0021762B1E9701C6008204EA /* impl_org_ortc_RTCStats.cpp */, + 0021762C1E9701C6008204EA /* impl_org_ortc_RTCStats.h */, + 0021762D1E9701C6008204EA /* impl_org_ortc_RTCStatsProvider.cpp */, + 0021762E1E9701C6008204EA /* impl_org_ortc_RTCStatsProvider.h */, + 0021762F1E9701C6008204EA /* impl_org_ortc_RTCStatsReport.cpp */, + 002176301E9701C6008204EA /* impl_org_ortc_RTCStatsReport.h */, + 002176311E9701C6008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp */, + 002176321E9701C6008204EA /* impl_org_ortc_RTCStatsTypeSet.h */, + 002176331E9701C6008204EA /* impl_org_ortc_Settings.cpp */, + 002176341E9701C6008204EA /* impl_org_ortc_Settings.h */, + 002176351E9701C6008204EA /* impl_org_ortc_StringOrStringList.cpp */, + 002176361E9701C6008204EA /* impl_org_ortc_StringOrStringList.h */, + 002176371E9701C6008204EA /* types.h */, + ); + name = wrapper; + path = ../../../ortc/idl/wrapper; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0021713C1E97017D008204EA /* ortclib-wrapper-ios */ = { + isa = PBXNativeTarget; + buildConfigurationList = 002171461E97017D008204EA /* Build configuration list for PBXNativeTarget "ortclib-wrapper-ios" */; + buildPhases = ( + 002171391E97017D008204EA /* Sources */, + 0021713A1E97017D008204EA /* Frameworks */, + 0021713B1E97017D008204EA /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ortclib-wrapper-ios"; + productName = "ortclib-wrapper-ios"; + productReference = 0021713D1E97017D008204EA /* libortclib-wrapper-ios.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 002171351E97017D008204EA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = "Open Peer Foundation"; + TargetAttributes = { + 0021713C1E97017D008204EA = { + CreatedOnToolsVersion = 8.3; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 002171381E97017D008204EA /* Build configuration list for PBXProject "ortclib-wrapper-ios" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 002171341E97017D008204EA; + productRefGroup = 0021713E1E97017D008204EA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0021713C1E97017D008204EA /* ortclib-wrapper-ios */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 002171391E97017D008204EA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 002178071E9701C7008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp in Sources */, + 002177CA1E9701C6008204EA /* impl_org_ortc_RTCIceParameters.cpp in Sources */, + 002177CD1E9701C6008204EA /* impl_org_ortc_RTCIceTransportController.cpp in Sources */, + 002177CF1E9701C6008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */, + 002177BC1E9701C6008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp in Sources */, + 002177C81E9701C6008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */, + 002177E91E9701C7008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */, + 002177B61E9701C6008204EA /* impl_org_ortc_RTCDtlsTransport.cpp in Sources */, + 002177F61E9701C7008204EA /* impl_org_ortc_RTCRtpSender.cpp in Sources */, + 002177DB1E9701C6008204EA /* impl_org_ortc_RTCRtcpParameters.cpp in Sources */, + 0021780E1E9701C7008204EA /* impl_org_ortc_StringOrStringList.cpp in Sources */, + 002177A41E9701C6008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */, + 002177FB1E9701C7008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */, + 002177EA1E9701C7008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp in Sources */, + 002177751E9701C6008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp in Sources */, + 002177D81E9701C6008204EA /* impl_org_ortc_RTCMessageEvent.cpp in Sources */, + 002177D31E9701C6008204EA /* impl_org_ortc_RTCIdentityError.cpp in Sources */, + 002177741E9701C6008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp in Sources */, + 002178051E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp in Sources */, + 002177851E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */, + 002178011E9701C7008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp in Sources */, + 0021779E1E9701C6008204EA /* impl_org_ortc_MediaStreamConstraints.cpp in Sources */, + 002177E01E9701C6008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */, + 002177BA1E9701C6008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */, + 002177A21E9701C6008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp in Sources */, + 002177C61E9701C6008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */, + 002177E31E9701C7008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp in Sources */, + 002177CB1E9701C6008204EA /* impl_org_ortc_RTCIceServer.cpp in Sources */, + 0021778F1E9701C6008204EA /* impl_org_ortc_ConstrainLongRange.cpp in Sources */, + 002177781E9701C6008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp in Sources */, + 002177831E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */, + 002177DC1E9701C6008204EA /* impl_org_ortc_RTCRtcpTransport.cpp in Sources */, + 0021780C1E9701C7008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp in Sources */, + 002177EC1E9701C7008204EA /* impl_org_ortc_RTCRtpListener.cpp in Sources */, + 0021777C1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp in Sources */, + 002177CC1E9701C6008204EA /* impl_org_ortc_RTCIceTransport.cpp in Sources */, + 002177F71E9701C7008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp in Sources */, + 0021778D1E9701C6008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp in Sources */, + 002177D21E9701C6008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp in Sources */, + 0021779A1E9701C6008204EA /* impl_org_ortc_MediaControl.cpp in Sources */, + 0021779D1E9701C6008204EA /* impl_org_ortc_MediaSource.cpp in Sources */, + 002177FA1E9701C7008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */, + 002177EF1E9701C7008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */, + 002177D11E9701C6008204EA /* impl_org_ortc_RTCIdentity.cpp in Sources */, + 002177C71E9701C6008204EA /* impl_org_ortc_RTCIceGathererStats.cpp in Sources */, + 002178021E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */, + 002177AC1E9701C6008204EA /* impl_org_ortc_RTCCodec.cpp in Sources */, + 002177F11E9701C7008204EA /* impl_org_ortc_RTCRtpReceiver.cpp in Sources */, + 002177A31E9701C6008204EA /* impl_org_ortc_MediaTrackSettings.cpp in Sources */, + 002177A91E9701C6008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp in Sources */, + 002177B51E9701C6008204EA /* impl_org_ortc_RTCDtlsParameters.cpp in Sources */, + 002177981E9701C6008204EA /* impl_org_ortc_Logger.cpp in Sources */, + 0021778A1E9701C6008204EA /* impl_org_ortc_ConstrainBoolean.cpp in Sources */, + 002177C91E9701C6008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp in Sources */, + 002178081E9701C7008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp in Sources */, + 002177891E9701C6008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp in Sources */, + 002177B71E9701C6008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */, + 002177AB1E9701C6008204EA /* impl_org_ortc_RTCCertificateStats.cpp in Sources */, + 002177761E9701C6008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */, + 002177801E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */, + 002177FF1E9701C7008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */, + 002177EE1E9701C7008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */, + 0021780B1E9701C7008204EA /* impl_org_ortc_RTCStatsReport.cpp in Sources */, + 002177DA1E9701C6008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp in Sources */, + 002177701E9701C6008204EA /* impl_org_ortc.cpp in Sources */, + 002178061E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */, + 0021777D1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */, + 002177A81E9701C6008204EA /* impl_org_ortc_OverconstrainedError.cpp in Sources */, + 002177DF1E9701C6008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */, + 002177C31E9701C6008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */, + 002177A61E9701C6008204EA /* impl_org_ortc_OrtcLib.cpp in Sources */, + 002177A01E9701C6008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp in Sources */, + 002177711E9701C6008204EA /* impl_org_ortc_adapter_MediaStream.cpp in Sources */, + 002177BD1E9701C6008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp in Sources */, + 002177C01E9701C6008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp in Sources */, + 002177B31E9701C6008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */, + 002177D71E9701C6008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */, + 0021778C1E9701C6008204EA /* impl_org_ortc_ConstrainDouble.cpp in Sources */, + 002177BB1E9701C6008204EA /* impl_org_ortc_RTCIceCandidate.cpp in Sources */, + 002177AA1E9701C6008204EA /* impl_org_ortc_RTCCertificate.cpp in Sources */, + 002178001E9701C7008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */, + 002177F41E9701C7008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */, + 002177771E9701C6008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */, + 002177E71E9701C7008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */, + 002177941E9701C6008204EA /* impl_org_ortc_Error.cpp in Sources */, + 002177991E9701C6008204EA /* impl_org_ortc_LongRange.cpp in Sources */, + 002177ED1E9701C7008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */, + 002177EB1E9701C7008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */, + 002177E21E9701C7008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */, + 002177B21E9701C6008204EA /* impl_org_ortc_RTCDataTransport.cpp in Sources */, + 002177FE1E9701C7008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp in Sources */, + 002177BE1E9701C6008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp in Sources */, + 002177F81E9701C7008204EA /* impl_org_ortc_RTCRtpTransport.cpp in Sources */, + 002177D41E9701C6008204EA /* impl_org_ortc_RTCIdentityResult.cpp in Sources */, + 0021780D1E9701C7008204EA /* impl_org_ortc_Settings.cpp in Sources */, + 002177B01E9701C6008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */, + 002177F21E9701C7008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */, + 002177961E9701C6008204EA /* impl_org_ortc_Helper.cpp in Sources */, + 002177721E9701C6008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */, + 002177E41E9701C7008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp in Sources */, + 002177B11E9701C6008204EA /* impl_org_ortc_RTCDataChannelStats.cpp in Sources */, + 002177911E9701C6008204EA /* impl_org_ortc_ConstrainStringParameters.cpp in Sources */, + 002177881E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */, + 002177931E9701C6008204EA /* impl_org_ortc_DoubleRange.cpp in Sources */, + 0021778B1E9701C6008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp in Sources */, + 0021778E1E9701C6008204EA /* impl_org_ortc_ConstrainLong.cpp in Sources */, + 002177D91E9701C6008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */, + 0021777B1E9701C6008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */, + 002177C51E9701C6008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */, + 002177D51E9701C6008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */, + 002177E11E9701C6008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp in Sources */, + 002177E61E9701C7008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */, + 0021777E1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */, + 0021777A1E9701C6008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */, + 002177F51E9701C7008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp in Sources */, + 002177A51E9701C6008204EA /* impl_org_ortc_MessageQueue.cpp in Sources */, + 002177951E9701C6008204EA /* impl_org_ortc_ErrorEvent.cpp in Sources */, + 002177D61E9701C6008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp in Sources */, + 002177E51E9701C7008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp in Sources */, + 002177E81E9701C7008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */, + 002177FC1E9701C7008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp in Sources */, + 002177AD1E9701C6008204EA /* impl_org_ortc_RTCDataChannel.cpp in Sources */, + 002177901E9701C6008204EA /* impl_org_ortc_ConstrainString.cpp in Sources */, + 002177821E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */, + 002177C41E9701C6008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */, + 002177DD1E9701C6008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp in Sources */, + 002177B91E9701C6008204EA /* impl_org_ortc_RTCDtmfSender.cpp in Sources */, + 002177B81E9701C6008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp in Sources */, + 002177DE1E9701C6008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp in Sources */, + 002177AE1E9701C6008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp in Sources */, + 002177F31E9701C7008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */, + 002177C11E9701C6008204EA /* impl_org_ortc_RTCIceGatherer.cpp in Sources */, + 002177871E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */, + 002177791E9701C6008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp in Sources */, + 002177FD1E9701C7008204EA /* impl_org_ortc_RTCSctpTransport.cpp in Sources */, + 0021780A1E9701C7008204EA /* impl_org_ortc_RTCStatsProvider.cpp in Sources */, + 002178031E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */, + 0021779C1E9701C6008204EA /* impl_org_ortc_MediaDevices.cpp in Sources */, + 002177F01E9701C7008204EA /* impl_org_ortc_RTCRtpParameters.cpp in Sources */, + 002177B41E9701C6008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp in Sources */, + 002177861E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */, + 002177811E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */, + 002177C21E9701C6008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp in Sources */, + 002177A11E9701C6008204EA /* impl_org_ortc_MediaTrackConstraints.cpp in Sources */, + 002177CE1E9701C6008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp in Sources */, + 002177AF1E9701C6008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp in Sources */, + 002177D01E9701C6008204EA /* impl_org_ortc_RTCIceTransportStats.cpp in Sources */, + 0021779B1E9701C6008204EA /* impl_org_ortc_MediaDeviceInfo.cpp in Sources */, + 002177971E9701C6008204EA /* impl_org_ortc_Json.cpp in Sources */, + 002178091E9701C7008204EA /* impl_org_ortc_RTCStats.cpp in Sources */, + 002177F91E9701C7008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */, + 002178041E9701C7008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp in Sources */, + 002177BF1E9701C6008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */, + 0021777F1E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */, + 0021779F1E9701C6008204EA /* impl_org_ortc_MediaStreamTrack.cpp in Sources */, + 002177731E9701C6008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */, + 002177841E9701C6008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 002171441E97017D008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "../../../../ortclib-cpp", + "../../../../ortclib-services-cpp", + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ../../../../../../webrtc/xplatform/webrtc, + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 002171451E97017D008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "../../../../ortclib-cpp", + "../../../../ortclib-services-cpp", + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ../../../../../../webrtc/xplatform/webrtc, + ); + IPHONEOS_DEPLOYMENT_TARGET = 10.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 002171471E97017D008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 002171481E97017D008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 002171381E97017D008204EA /* Build configuration list for PBXProject "ortclib-wrapper-ios" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 002171441E97017D008204EA /* Debug */, + 002171451E97017D008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 002171461E97017D008204EA /* Build configuration list for PBXNativeTarget "ortclib-wrapper-ios" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 002171471E97017D008204EA /* Debug */, + 002171481E97017D008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 002171351E97017D008204EA /* Project object */; +} diff --git a/projects/xcode/ortclib-wrapper-osx/ortclib-wrapper-osx.xcodeproj/project.pbxproj b/projects/xcode/ortclib-wrapper-osx/ortclib-wrapper-osx.xcodeproj/project.pbxproj new file mode 100644 index 00000000..8095aaa7 --- /dev/null +++ b/projects/xcode/ortclib-wrapper-osx/ortclib-wrapper-osx.xcodeproj/project.pbxproj @@ -0,0 +1,1228 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 002180231E970520008204EA /* impl_org_ortc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BD71E97051D008204EA /* impl_org_ortc.cpp */; }; + 002180241E970520008204EA /* impl_org_ortc_adapter_MediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BD81E97051D008204EA /* impl_org_ortc_adapter_MediaStream.cpp */; }; + 002180261E970520008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BDA1E97051D008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp */; }; + 002180281E970520008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BDC1E97051D008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp */; }; + 0021802A1E970520008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BDE1E97051D008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp */; }; + 0021802C1E970520008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BE01E97051D008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp */; }; + 0021802E1E970520008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BE21E97051D008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */; }; + 002180301E970520008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BE41E97051D008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp */; }; + 002180321E970520008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BE61E97051D008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp */; }; + 002180341E970520008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BE81E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp */; }; + 002180361E970520008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BEA1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */; }; + 002180381E970520008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BEC1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */; }; + 0021803A1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BEE1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp */; }; + 0021803C1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BF01E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */; }; + 0021803E1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BF21E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */; }; + 002180401E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BF41E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */; }; + 002180421E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BF61E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */; }; + 002180441E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BF81E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */; }; + 002180461E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BFA1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */; }; + 002180481E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BFC1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */; }; + 0021804A1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217BFE1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */; }; + 0021804C1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C001E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */; }; + 0021804E1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C021E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */; }; + 002180501E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C041E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */; }; + 002180521E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C061E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */; }; + 002180541E970520008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C081E97051D008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp */; }; + 002180561E970520008204EA /* impl_org_ortc_ConstrainBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C0A1E97051D008204EA /* impl_org_ortc_ConstrainBoolean.cpp */; }; + 002180581E970520008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C0C1E97051D008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp */; }; + 0021805A1E970520008204EA /* impl_org_ortc_ConstrainDouble.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C0E1E97051D008204EA /* impl_org_ortc_ConstrainDouble.cpp */; }; + 0021805C1E970520008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C101E97051D008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp */; }; + 0021805E1E970520008204EA /* impl_org_ortc_ConstrainLong.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C121E97051D008204EA /* impl_org_ortc_ConstrainLong.cpp */; }; + 002180601E970520008204EA /* impl_org_ortc_ConstrainLongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C141E97051D008204EA /* impl_org_ortc_ConstrainLongRange.cpp */; }; + 002180621E970520008204EA /* impl_org_ortc_ConstrainString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C161E97051D008204EA /* impl_org_ortc_ConstrainString.cpp */; }; + 002180641E970520008204EA /* impl_org_ortc_ConstrainStringParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C181E97051D008204EA /* impl_org_ortc_ConstrainStringParameters.cpp */; }; + 002180681E970520008204EA /* impl_org_ortc_DoubleRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C1C1E97051D008204EA /* impl_org_ortc_DoubleRange.cpp */; }; + 0021806A1E970520008204EA /* impl_org_ortc_Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C1E1E97051D008204EA /* impl_org_ortc_Error.cpp */; }; + 0021806C1E970520008204EA /* impl_org_ortc_ErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C201E97051D008204EA /* impl_org_ortc_ErrorEvent.cpp */; }; + 0021806E1E970520008204EA /* impl_org_ortc_Helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C221E97051D008204EA /* impl_org_ortc_Helper.cpp */; }; + 002180701E970520008204EA /* impl_org_ortc_Json.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C241E97051D008204EA /* impl_org_ortc_Json.cpp */; }; + 002180721E970520008204EA /* impl_org_ortc_Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C261E97051D008204EA /* impl_org_ortc_Logger.cpp */; }; + 002180741E970520008204EA /* impl_org_ortc_LongRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C281E97051D008204EA /* impl_org_ortc_LongRange.cpp */; }; + 002180761E970520008204EA /* impl_org_ortc_MediaControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C2A1E97051D008204EA /* impl_org_ortc_MediaControl.cpp */; }; + 002180781E970520008204EA /* impl_org_ortc_MediaDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C2C1E97051D008204EA /* impl_org_ortc_MediaDeviceInfo.cpp */; }; + 0021807A1E970520008204EA /* impl_org_ortc_MediaDevices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C2E1E97051D008204EA /* impl_org_ortc_MediaDevices.cpp */; }; + 0021807C1E970520008204EA /* impl_org_ortc_MediaSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C301E97051D008204EA /* impl_org_ortc_MediaSource.cpp */; }; + 0021807E1E970520008204EA /* impl_org_ortc_MediaStreamConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C321E97051D008204EA /* impl_org_ortc_MediaStreamConstraints.cpp */; }; + 002180801E970520008204EA /* impl_org_ortc_MediaStreamTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C341E97051D008204EA /* impl_org_ortc_MediaStreamTrack.cpp */; }; + 002180821E970520008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C361E97051D008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp */; }; + 002180841E970520008204EA /* impl_org_ortc_MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C381E97051D008204EA /* impl_org_ortc_MediaTrackConstraints.cpp */; }; + 002180861E970520008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C3A1E97051D008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp */; }; + 002180881E970520008204EA /* impl_org_ortc_MediaTrackSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C3C1E97051D008204EA /* impl_org_ortc_MediaTrackSettings.cpp */; }; + 0021808A1E970520008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C3E1E97051D008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp */; }; + 0021808C1E970520008204EA /* impl_org_ortc_MessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C401E97051D008204EA /* impl_org_ortc_MessageQueue.cpp */; }; + 0021808E1E970520008204EA /* impl_org_ortc_OrtcLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C421E97051D008204EA /* impl_org_ortc_OrtcLib.cpp */; }; + 002180921E970520008204EA /* impl_org_ortc_OverconstrainedError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C461E97051D008204EA /* impl_org_ortc_OverconstrainedError.cpp */; }; + 002180941E970520008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C481E97051D008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp */; }; + 002180961E970520008204EA /* impl_org_ortc_RTCCertificate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C4A1E97051D008204EA /* impl_org_ortc_RTCCertificate.cpp */; }; + 002180981E970520008204EA /* impl_org_ortc_RTCCertificateStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C4C1E97051D008204EA /* impl_org_ortc_RTCCertificateStats.cpp */; }; + 0021809A1E970520008204EA /* impl_org_ortc_RTCCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C4E1E97051D008204EA /* impl_org_ortc_RTCCodec.cpp */; }; + 0021809C1E970520008204EA /* impl_org_ortc_RTCDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C501E97051D008204EA /* impl_org_ortc_RTCDataChannel.cpp */; }; + 0021809E1E970520008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C521E97051D008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp */; }; + 002180A01E970520008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C541E97051D008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp */; }; + 002180A21E970520008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C561E97051E008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp */; }; + 002180A41E970520008204EA /* impl_org_ortc_RTCDataChannelStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C581E97051E008204EA /* impl_org_ortc_RTCDataChannelStats.cpp */; }; + 002180A61E970520008204EA /* impl_org_ortc_RTCDataTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C5A1E97051E008204EA /* impl_org_ortc_RTCDataTransport.cpp */; }; + 002180A81E970520008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C5C1E97051E008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp */; }; + 002180AA1E970520008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C5E1E97051E008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp */; }; + 002180AC1E970520008204EA /* impl_org_ortc_RTCDtlsParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C601E97051E008204EA /* impl_org_ortc_RTCDtlsParameters.cpp */; }; + 002180AE1E970520008204EA /* impl_org_ortc_RTCDtlsTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C621E97051E008204EA /* impl_org_ortc_RTCDtlsTransport.cpp */; }; + 002180B01E970520008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C641E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */; }; + 002180B21E970520008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C661E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp */; }; + 002180B41E970520008204EA /* impl_org_ortc_RTCDtmfSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C681E97051E008204EA /* impl_org_ortc_RTCDtmfSender.cpp */; }; + 002180B61E970520008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C6A1E97051E008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp */; }; + 002180B81E970520008204EA /* impl_org_ortc_RTCIceCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C6C1E97051E008204EA /* impl_org_ortc_RTCIceCandidate.cpp */; }; + 002180BA1E970520008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C6E1E97051E008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp */; }; + 002180BC1E970520008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C701E97051E008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp */; }; + 002180BE1E970520008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C721E97051E008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp */; }; + 002180C01E970520008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C741E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp */; }; + 002180C21E970520008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C761E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp */; }; + 002180C41E970520008204EA /* impl_org_ortc_RTCIceGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C781E97051E008204EA /* impl_org_ortc_RTCIceGatherer.cpp */; }; + 002180C61E970520008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C7A1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp */; }; + 002180C81E970520008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C7C1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */; }; + 002180CA1E970520008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C7E1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp */; }; + 002180CC1E970520008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C801E97051E008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp */; }; + 002180CE1E970520008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C821E97051E008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp */; }; + 002180D01E970520008204EA /* impl_org_ortc_RTCIceGathererStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C841E97051E008204EA /* impl_org_ortc_RTCIceGathererStats.cpp */; }; + 002180D21E970520008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C861E97051E008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp */; }; + 002180D41E970520008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C881E97051E008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp */; }; + 002180D61E970520008204EA /* impl_org_ortc_RTCIceParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C8A1E97051E008204EA /* impl_org_ortc_RTCIceParameters.cpp */; }; + 002180D81E970520008204EA /* impl_org_ortc_RTCIceServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C8C1E97051E008204EA /* impl_org_ortc_RTCIceServer.cpp */; }; + 002180DA1E970520008204EA /* impl_org_ortc_RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C8E1E97051E008204EA /* impl_org_ortc_RTCIceTransport.cpp */; }; + 002180DC1E970520008204EA /* impl_org_ortc_RTCIceTransportController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C901E97051E008204EA /* impl_org_ortc_RTCIceTransportController.cpp */; }; + 002180DE1E970520008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C921E97051E008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp */; }; + 002180E01E970520008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C941E97051E008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp */; }; + 002180E21E970520008204EA /* impl_org_ortc_RTCIceTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C961E97051E008204EA /* impl_org_ortc_RTCIceTransportStats.cpp */; }; + 002180E41E970520008204EA /* impl_org_ortc_RTCIdentity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C981E97051E008204EA /* impl_org_ortc_RTCIdentity.cpp */; }; + 002180E61E970520008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C9A1E97051E008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp */; }; + 002180E81E970520008204EA /* impl_org_ortc_RTCIdentityError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C9C1E97051E008204EA /* impl_org_ortc_RTCIdentityError.cpp */; }; + 002180EA1E970520008204EA /* impl_org_ortc_RTCIdentityResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217C9E1E97051E008204EA /* impl_org_ortc_RTCIdentityResult.cpp */; }; + 002180EC1E970520008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CA01E97051E008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp */; }; + 002180EE1E970520008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CA21E97051E008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp */; }; + 002180F01E970520008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CA41E97051E008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp */; }; + 002180F21E970520008204EA /* impl_org_ortc_RTCMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CA61E97051E008204EA /* impl_org_ortc_RTCMessageEvent.cpp */; }; + 002180F41E970520008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CA81E97051E008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp */; }; + 002180F61E970520008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CAA1E97051E008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp */; }; + 002180F81E970520008204EA /* impl_org_ortc_RTCRtcpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CAC1E97051E008204EA /* impl_org_ortc_RTCRtcpParameters.cpp */; }; + 002180FA1E970520008204EA /* impl_org_ortc_RTCRtcpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CAE1E97051E008204EA /* impl_org_ortc_RTCRtcpTransport.cpp */; }; + 002180FC1E970520008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CB01E97051E008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp */; }; + 002180FE1E970520008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CB21E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp */; }; + 002181001E970520008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CB41E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp */; }; + 002181021E970520008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CB61E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp */; }; + 002181041E970520008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CB81E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp */; }; + 002181061E970520008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CBA1E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp */; }; + 002181081E970520008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CBC1E97051E008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp */; }; + 0021810A1E970520008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CBE1E97051E008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp */; }; + 0021810C1E970520008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CC01E97051E008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp */; }; + 0021810E1E970520008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CC21E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */; }; + 002181101E970520008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CC41E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */; }; + 002181121E970520008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CC61E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */; }; + 002181141E970520008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CC81E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp */; }; + 002181161E970520008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CCA1E97051E008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp */; }; + 002181181E970520008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CCC1E97051F008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp */; }; + 0021811A1E970520008204EA /* impl_org_ortc_RTCRtpListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CCE1E97051F008204EA /* impl_org_ortc_RTCRtpListener.cpp */; }; + 0021811C1E970520008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CD01E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */; }; + 0021811E1E970520008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CD21E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */; }; + 002181201E970520008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CD41E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */; }; + 002181221E970520008204EA /* impl_org_ortc_RTCRtpParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CD61E97051F008204EA /* impl_org_ortc_RTCRtpParameters.cpp */; }; + 002181241E970520008204EA /* impl_org_ortc_RTCRtpReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CD81E97051F008204EA /* impl_org_ortc_RTCRtpReceiver.cpp */; }; + 002181261E970520008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CDA1E97051F008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp */; }; + 002181281E970520008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CDC1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */; }; + 0021812A1E970520008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CDE1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */; }; + 0021812C1E970520008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CE01E97051F008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp */; }; + 0021812E1E970520008204EA /* impl_org_ortc_RTCRtpSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CE21E97051F008204EA /* impl_org_ortc_RTCRtpSender.cpp */; }; + 002181301E970520008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CE41E97051F008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp */; }; + 002181321E970520008204EA /* impl_org_ortc_RTCRtpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CE61E97051F008204EA /* impl_org_ortc_RTCRtpTransport.cpp */; }; + 002181341E970520008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CE81E97051F008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp */; }; + 002181361E970520008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CEA1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */; }; + 002181381E970520008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CEC1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */; }; + 0021813A1E970520008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CEE1E97051F008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp */; }; + 0021813C1E970520008204EA /* impl_org_ortc_RTCSctpTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CF01E97051F008204EA /* impl_org_ortc_RTCSctpTransport.cpp */; }; + 0021813E1E970520008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CF21E97051F008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp */; }; + 002181401E970520008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CF41E97051F008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp */; }; + 002181421E970520008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CF61E97051F008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp */; }; + 002181441E970520008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CF81E97051F008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp */; }; + 002181461E970520008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CFA1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp */; }; + 002181481E970520008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CFC1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp */; }; + 0021814A1E970520008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217CFE1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp */; }; + 0021814C1E970520008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D001E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp */; }; + 0021814E1E970520008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D021E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */; }; + 002181501E970520008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D041E97051F008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp */; }; + 002181521E970520008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D061E97051F008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp */; }; + 002181541E970520008204EA /* impl_org_ortc_RTCStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D081E97051F008204EA /* impl_org_ortc_RTCStats.cpp */; }; + 002181561E970520008204EA /* impl_org_ortc_RTCStatsProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D0A1E97051F008204EA /* impl_org_ortc_RTCStatsProvider.cpp */; }; + 002181581E970520008204EA /* impl_org_ortc_RTCStatsReport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D0C1E97051F008204EA /* impl_org_ortc_RTCStatsReport.cpp */; }; + 0021815A1E970521008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D0E1E97051F008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp */; }; + 0021815C1E970521008204EA /* impl_org_ortc_Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D101E97051F008204EA /* impl_org_ortc_Settings.cpp */; }; + 0021815E1E970521008204EA /* impl_org_ortc_StringOrStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00217D121E97051F008204EA /* impl_org_ortc_StringOrStringList.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 002178181E9704E2008204EA /* libortclib-wrapper-osx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libortclib-wrapper-osx.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 00217BD71E97051D008204EA /* impl_org_ortc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc.cpp; sourceTree = ""; }; + 00217BD81E97051D008204EA /* impl_org_ortc_adapter_MediaStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_MediaStream.cpp; sourceTree = ""; }; + 00217BD91E97051D008204EA /* impl_org_ortc_adapter_MediaStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_MediaStream.h; sourceTree = ""; }; + 00217BDA1E97051D008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCAnswerOptions.cpp; sourceTree = ""; }; + 00217BDB1E97051D008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCAnswerOptions.h; sourceTree = ""; }; + 00217BDC1E97051D008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCCapabilityOptions.cpp; sourceTree = ""; }; + 00217BDD1E97051D008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCCapabilityOptions.h; sourceTree = ""; }; + 00217BDE1E97051D008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCConfiguration.cpp; sourceTree = ""; }; + 00217BDF1E97051D008204EA /* impl_org_ortc_adapter_RTCConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCConfiguration.h; sourceTree = ""; }; + 00217BE01E97051D008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCIceCandidate.cpp; sourceTree = ""; }; + 00217BE11E97051D008204EA /* impl_org_ortc_adapter_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCIceCandidate.h; sourceTree = ""; }; + 00217BE21E97051D008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp; sourceTree = ""; }; + 00217BE31E97051D008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h; sourceTree = ""; }; + 00217BE41E97051D008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp; sourceTree = ""; }; + 00217BE51E97051D008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCOfferAnswerOptions.h; sourceTree = ""; }; + 00217BE61E97051D008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCOfferOptions.cpp; sourceTree = ""; }; + 00217BE71E97051D008204EA /* impl_org_ortc_adapter_RTCOfferOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCOfferOptions.h; sourceTree = ""; }; + 00217BE81E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCPeerConnection.cpp; sourceTree = ""; }; + 00217BE91E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCPeerConnection.h; sourceTree = ""; }; + 00217BEA1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp; sourceTree = ""; }; + 00217BEB1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h; sourceTree = ""; }; + 00217BEC1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp; sourceTree = ""; }; + 00217BED1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h; sourceTree = ""; }; + 00217BEE1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescription.cpp; sourceTree = ""; }; + 00217BEF1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescription.h; sourceTree = ""; }; + 00217BF01E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp; sourceTree = ""; }; + 00217BF11E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h; sourceTree = ""; }; + 00217BF21E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp; sourceTree = ""; }; + 00217BF31E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h; sourceTree = ""; }; + 00217BF41E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp; sourceTree = ""; }; + 00217BF51E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionDescription.h; sourceTree = ""; }; + 00217BF61E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp; sourceTree = ""; }; + 00217BF71E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h; sourceTree = ""; }; + 00217BF81E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp; sourceTree = ""; }; + 00217BF91E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h; sourceTree = ""; }; + 00217BFA1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp; sourceTree = ""; }; + 00217BFB1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h; sourceTree = ""; }; + 00217BFC1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp; sourceTree = ""; }; + 00217BFD1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h; sourceTree = ""; }; + 00217BFE1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp; sourceTree = ""; }; + 00217BFF1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h; sourceTree = ""; }; + 00217C001E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp; sourceTree = ""; }; + 00217C011E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h; sourceTree = ""; }; + 00217C021E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp; sourceTree = ""; }; + 00217C031E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h; sourceTree = ""; }; + 00217C041E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp; sourceTree = ""; }; + 00217C051E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionTransport.h; sourceTree = ""; }; + 00217C061E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp; sourceTree = ""; }; + 00217C071E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h; sourceTree = ""; }; + 00217C081E97051D008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_adapter_RTCTrackEvent.cpp; sourceTree = ""; }; + 00217C091E97051D008204EA /* impl_org_ortc_adapter_RTCTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_adapter_RTCTrackEvent.h; sourceTree = ""; }; + 00217C0A1E97051D008204EA /* impl_org_ortc_ConstrainBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainBoolean.cpp; sourceTree = ""; }; + 00217C0B1E97051D008204EA /* impl_org_ortc_ConstrainBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainBoolean.h; sourceTree = ""; }; + 00217C0C1E97051D008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainBooleanParameters.cpp; sourceTree = ""; }; + 00217C0D1E97051D008204EA /* impl_org_ortc_ConstrainBooleanParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainBooleanParameters.h; sourceTree = ""; }; + 00217C0E1E97051D008204EA /* impl_org_ortc_ConstrainDouble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainDouble.cpp; sourceTree = ""; }; + 00217C0F1E97051D008204EA /* impl_org_ortc_ConstrainDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainDouble.h; sourceTree = ""; }; + 00217C101E97051D008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainDoubleRange.cpp; sourceTree = ""; }; + 00217C111E97051D008204EA /* impl_org_ortc_ConstrainDoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainDoubleRange.h; sourceTree = ""; }; + 00217C121E97051D008204EA /* impl_org_ortc_ConstrainLong.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainLong.cpp; sourceTree = ""; }; + 00217C131E97051D008204EA /* impl_org_ortc_ConstrainLong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainLong.h; sourceTree = ""; }; + 00217C141E97051D008204EA /* impl_org_ortc_ConstrainLongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainLongRange.cpp; sourceTree = ""; }; + 00217C151E97051D008204EA /* impl_org_ortc_ConstrainLongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainLongRange.h; sourceTree = ""; }; + 00217C161E97051D008204EA /* impl_org_ortc_ConstrainString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainString.cpp; sourceTree = ""; }; + 00217C171E97051D008204EA /* impl_org_ortc_ConstrainString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainString.h; sourceTree = ""; }; + 00217C181E97051D008204EA /* impl_org_ortc_ConstrainStringParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ConstrainStringParameters.cpp; sourceTree = ""; }; + 00217C191E97051D008204EA /* impl_org_ortc_ConstrainStringParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ConstrainStringParameters.h; sourceTree = ""; }; + 00217C1A1E97051D008204EA /* impl_org_ortc_Dispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Dispatcher.cpp; sourceTree = ""; }; + 00217C1B1E97051D008204EA /* impl_org_ortc_Dispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Dispatcher.h; sourceTree = ""; }; + 00217C1C1E97051D008204EA /* impl_org_ortc_DoubleRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_DoubleRange.cpp; sourceTree = ""; }; + 00217C1D1E97051D008204EA /* impl_org_ortc_DoubleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_DoubleRange.h; sourceTree = ""; }; + 00217C1E1E97051D008204EA /* impl_org_ortc_Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Error.cpp; sourceTree = ""; }; + 00217C1F1E97051D008204EA /* impl_org_ortc_Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Error.h; sourceTree = ""; }; + 00217C201E97051D008204EA /* impl_org_ortc_ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_ErrorEvent.cpp; sourceTree = ""; }; + 00217C211E97051D008204EA /* impl_org_ortc_ErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_ErrorEvent.h; sourceTree = ""; }; + 00217C221E97051D008204EA /* impl_org_ortc_Helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Helper.cpp; sourceTree = ""; }; + 00217C231E97051D008204EA /* impl_org_ortc_Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Helper.h; sourceTree = ""; }; + 00217C241E97051D008204EA /* impl_org_ortc_Json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Json.cpp; sourceTree = ""; }; + 00217C251E97051D008204EA /* impl_org_ortc_Json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Json.h; sourceTree = ""; }; + 00217C261E97051D008204EA /* impl_org_ortc_Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Logger.cpp; sourceTree = ""; }; + 00217C271E97051D008204EA /* impl_org_ortc_Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Logger.h; sourceTree = ""; }; + 00217C281E97051D008204EA /* impl_org_ortc_LongRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_LongRange.cpp; sourceTree = ""; }; + 00217C291E97051D008204EA /* impl_org_ortc_LongRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_LongRange.h; sourceTree = ""; }; + 00217C2A1E97051D008204EA /* impl_org_ortc_MediaControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaControl.cpp; sourceTree = ""; }; + 00217C2B1E97051D008204EA /* impl_org_ortc_MediaControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaControl.h; sourceTree = ""; }; + 00217C2C1E97051D008204EA /* impl_org_ortc_MediaDeviceInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaDeviceInfo.cpp; sourceTree = ""; }; + 00217C2D1E97051D008204EA /* impl_org_ortc_MediaDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaDeviceInfo.h; sourceTree = ""; }; + 00217C2E1E97051D008204EA /* impl_org_ortc_MediaDevices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaDevices.cpp; sourceTree = ""; }; + 00217C2F1E97051D008204EA /* impl_org_ortc_MediaDevices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaDevices.h; sourceTree = ""; }; + 00217C301E97051D008204EA /* impl_org_ortc_MediaSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaSource.cpp; sourceTree = ""; }; + 00217C311E97051D008204EA /* impl_org_ortc_MediaSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaSource.h; sourceTree = ""; }; + 00217C321E97051D008204EA /* impl_org_ortc_MediaStreamConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaStreamConstraints.cpp; sourceTree = ""; }; + 00217C331E97051D008204EA /* impl_org_ortc_MediaStreamConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaStreamConstraints.h; sourceTree = ""; }; + 00217C341E97051D008204EA /* impl_org_ortc_MediaStreamTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaStreamTrack.cpp; sourceTree = ""; }; + 00217C351E97051D008204EA /* impl_org_ortc_MediaStreamTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaStreamTrack.h; sourceTree = ""; }; + 00217C361E97051D008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackCapabilities.cpp; sourceTree = ""; }; + 00217C371E97051D008204EA /* impl_org_ortc_MediaTrackCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackCapabilities.h; sourceTree = ""; }; + 00217C381E97051D008204EA /* impl_org_ortc_MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackConstraints.cpp; sourceTree = ""; }; + 00217C391E97051D008204EA /* impl_org_ortc_MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackConstraints.h; sourceTree = ""; }; + 00217C3A1E97051D008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackConstraintSet.cpp; sourceTree = ""; }; + 00217C3B1E97051D008204EA /* impl_org_ortc_MediaTrackConstraintSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackConstraintSet.h; sourceTree = ""; }; + 00217C3C1E97051D008204EA /* impl_org_ortc_MediaTrackSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackSettings.cpp; sourceTree = ""; }; + 00217C3D1E97051D008204EA /* impl_org_ortc_MediaTrackSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackSettings.h; sourceTree = ""; }; + 00217C3E1E97051D008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MediaTrackSupportedConstraints.cpp; sourceTree = ""; }; + 00217C3F1E97051D008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MediaTrackSupportedConstraints.h; sourceTree = ""; }; + 00217C401E97051D008204EA /* impl_org_ortc_MessageQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_MessageQueue.cpp; sourceTree = ""; }; + 00217C411E97051D008204EA /* impl_org_ortc_MessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_MessageQueue.h; sourceTree = ""; }; + 00217C421E97051D008204EA /* impl_org_ortc_OrtcLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OrtcLib.cpp; sourceTree = ""; }; + 00217C431E97051D008204EA /* impl_org_ortc_OrtcLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OrtcLib.h; sourceTree = ""; }; + 00217C441E97051D008204EA /* impl_org_ortc_OrtcLibWithDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OrtcLibWithDispatcher.cpp; sourceTree = ""; }; + 00217C451E97051D008204EA /* impl_org_ortc_OrtcLibWithDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OrtcLibWithDispatcher.h; sourceTree = ""; }; + 00217C461E97051D008204EA /* impl_org_ortc_OverconstrainedError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OverconstrainedError.cpp; sourceTree = ""; }; + 00217C471E97051D008204EA /* impl_org_ortc_OverconstrainedError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OverconstrainedError.h; sourceTree = ""; }; + 00217C481E97051D008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_OverconstrainedErrorEvent.cpp; sourceTree = ""; }; + 00217C491E97051D008204EA /* impl_org_ortc_OverconstrainedErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_OverconstrainedErrorEvent.h; sourceTree = ""; }; + 00217C4A1E97051D008204EA /* impl_org_ortc_RTCCertificate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCCertificate.cpp; sourceTree = ""; }; + 00217C4B1E97051D008204EA /* impl_org_ortc_RTCCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCCertificate.h; sourceTree = ""; }; + 00217C4C1E97051D008204EA /* impl_org_ortc_RTCCertificateStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCCertificateStats.cpp; sourceTree = ""; }; + 00217C4D1E97051D008204EA /* impl_org_ortc_RTCCertificateStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCCertificateStats.h; sourceTree = ""; }; + 00217C4E1E97051D008204EA /* impl_org_ortc_RTCCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCCodec.cpp; sourceTree = ""; }; + 00217C4F1E97051D008204EA /* impl_org_ortc_RTCCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCCodec.h; sourceTree = ""; }; + 00217C501E97051D008204EA /* impl_org_ortc_RTCDataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannel.cpp; sourceTree = ""; }; + 00217C511E97051D008204EA /* impl_org_ortc_RTCDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannel.h; sourceTree = ""; }; + 00217C521E97051D008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelEvent.cpp; sourceTree = ""; }; + 00217C531E97051D008204EA /* impl_org_ortc_RTCDataChannelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelEvent.h; sourceTree = ""; }; + 00217C541E97051D008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelParameters.cpp; sourceTree = ""; }; + 00217C551E97051D008204EA /* impl_org_ortc_RTCDataChannelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelParameters.h; sourceTree = ""; }; + 00217C561E97051E008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelStateChangeEvent.cpp; sourceTree = ""; }; + 00217C571E97051E008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelStateChangeEvent.h; sourceTree = ""; }; + 00217C581E97051E008204EA /* impl_org_ortc_RTCDataChannelStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataChannelStats.cpp; sourceTree = ""; }; + 00217C591E97051E008204EA /* impl_org_ortc_RTCDataChannelStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataChannelStats.h; sourceTree = ""; }; + 00217C5A1E97051E008204EA /* impl_org_ortc_RTCDataTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDataTransport.cpp; sourceTree = ""; }; + 00217C5B1E97051E008204EA /* impl_org_ortc_RTCDataTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDataTransport.h; sourceTree = ""; }; + 00217C5C1E97051E008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsCertificateBinary.cpp; sourceTree = ""; }; + 00217C5D1E97051E008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsCertificateBinary.h; sourceTree = ""; }; + 00217C5E1E97051E008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsFingerprint.cpp; sourceTree = ""; }; + 00217C5F1E97051E008204EA /* impl_org_ortc_RTCDtlsFingerprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsFingerprint.h; sourceTree = ""; }; + 00217C601E97051E008204EA /* impl_org_ortc_RTCDtlsParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsParameters.cpp; sourceTree = ""; }; + 00217C611E97051E008204EA /* impl_org_ortc_RTCDtlsParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsParameters.h; sourceTree = ""; }; + 00217C621E97051E008204EA /* impl_org_ortc_RTCDtlsTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsTransport.cpp; sourceTree = ""; }; + 00217C631E97051E008204EA /* impl_org_ortc_RTCDtlsTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsTransport.h; sourceTree = ""; }; + 00217C641E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00217C651E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsTransportStateChangeEvent.h; sourceTree = ""; }; + 00217C661E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtlsTransportStats.cpp; sourceTree = ""; }; + 00217C671E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtlsTransportStats.h; sourceTree = ""; }; + 00217C681E97051E008204EA /* impl_org_ortc_RTCDtmfSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtmfSender.cpp; sourceTree = ""; }; + 00217C691E97051E008204EA /* impl_org_ortc_RTCDtmfSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtmfSender.h; sourceTree = ""; }; + 00217C6A1E97051E008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCDtmfToneChangeEvent.cpp; sourceTree = ""; }; + 00217C6B1E97051E008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCDtmfToneChangeEvent.h; sourceTree = ""; }; + 00217C6C1E97051E008204EA /* impl_org_ortc_RTCIceCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidate.cpp; sourceTree = ""; }; + 00217C6D1E97051E008204EA /* impl_org_ortc_RTCIceCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidate.h; sourceTree = ""; }; + 00217C6E1E97051E008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidateAttributes.cpp; sourceTree = ""; }; + 00217C6F1E97051E008204EA /* impl_org_ortc_RTCIceCandidateAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidateAttributes.h; sourceTree = ""; }; + 00217C701E97051E008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidateComplete.cpp; sourceTree = ""; }; + 00217C711E97051E008204EA /* impl_org_ortc_RTCIceCandidateComplete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidateComplete.h; sourceTree = ""; }; + 00217C721E97051E008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidatePair.cpp; sourceTree = ""; }; + 00217C731E97051E008204EA /* impl_org_ortc_RTCIceCandidatePair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidatePair.h; sourceTree = ""; }; + 00217C741E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp; sourceTree = ""; }; + 00217C751E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidatePairChangeEvent.h; sourceTree = ""; }; + 00217C761E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceCandidatePairStats.cpp; sourceTree = ""; }; + 00217C771E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceCandidatePairStats.h; sourceTree = ""; }; + 00217C781E97051E008204EA /* impl_org_ortc_RTCIceGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGatherer.cpp; sourceTree = ""; }; + 00217C791E97051E008204EA /* impl_org_ortc_RTCIceGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGatherer.h; sourceTree = ""; }; + 00217C7A1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererCandidate.cpp; sourceTree = ""; }; + 00217C7B1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererCandidate.h; sourceTree = ""; }; + 00217C7C1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp; sourceTree = ""; }; + 00217C7D1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h; sourceTree = ""; }; + 00217C7E1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererCandidateEvent.cpp; sourceTree = ""; }; + 00217C7F1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererCandidateEvent.h; sourceTree = ""; }; + 00217C801E97051E008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererIceErrorEvent.cpp; sourceTree = ""; }; + 00217C811E97051E008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererIceErrorEvent.h; sourceTree = ""; }; + 00217C821E97051E008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererStateChangeEvent.cpp; sourceTree = ""; }; + 00217C831E97051E008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererStateChangeEvent.h; sourceTree = ""; }; + 00217C841E97051E008204EA /* impl_org_ortc_RTCIceGathererStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGathererStats.cpp; sourceTree = ""; }; + 00217C851E97051E008204EA /* impl_org_ortc_RTCIceGathererStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGathererStats.h; sourceTree = ""; }; + 00217C861E97051E008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGatherInterfacePolicy.cpp; sourceTree = ""; }; + 00217C871E97051E008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGatherInterfacePolicy.h; sourceTree = ""; }; + 00217C881E97051E008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceGatherOptions.cpp; sourceTree = ""; }; + 00217C891E97051E008204EA /* impl_org_ortc_RTCIceGatherOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceGatherOptions.h; sourceTree = ""; }; + 00217C8A1E97051E008204EA /* impl_org_ortc_RTCIceParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceParameters.cpp; sourceTree = ""; }; + 00217C8B1E97051E008204EA /* impl_org_ortc_RTCIceParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceParameters.h; sourceTree = ""; }; + 00217C8C1E97051E008204EA /* impl_org_ortc_RTCIceServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceServer.cpp; sourceTree = ""; }; + 00217C8D1E97051E008204EA /* impl_org_ortc_RTCIceServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceServer.h; sourceTree = ""; }; + 00217C8E1E97051E008204EA /* impl_org_ortc_RTCIceTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransport.cpp; sourceTree = ""; }; + 00217C8F1E97051E008204EA /* impl_org_ortc_RTCIceTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransport.h; sourceTree = ""; }; + 00217C901E97051E008204EA /* impl_org_ortc_RTCIceTransportController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportController.cpp; sourceTree = ""; }; + 00217C911E97051E008204EA /* impl_org_ortc_RTCIceTransportController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportController.h; sourceTree = ""; }; + 00217C921E97051E008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportOptions.cpp; sourceTree = ""; }; + 00217C931E97051E008204EA /* impl_org_ortc_RTCIceTransportOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportOptions.h; sourceTree = ""; }; + 00217C941E97051E008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00217C951E97051E008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportStateChangeEvent.h; sourceTree = ""; }; + 00217C961E97051E008204EA /* impl_org_ortc_RTCIceTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIceTransportStats.cpp; sourceTree = ""; }; + 00217C971E97051E008204EA /* impl_org_ortc_RTCIceTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIceTransportStats.h; sourceTree = ""; }; + 00217C981E97051E008204EA /* impl_org_ortc_RTCIdentity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentity.cpp; sourceTree = ""; }; + 00217C991E97051E008204EA /* impl_org_ortc_RTCIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentity.h; sourceTree = ""; }; + 00217C9A1E97051E008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentityAssertion.cpp; sourceTree = ""; }; + 00217C9B1E97051E008204EA /* impl_org_ortc_RTCIdentityAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentityAssertion.h; sourceTree = ""; }; + 00217C9C1E97051E008204EA /* impl_org_ortc_RTCIdentityError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentityError.cpp; sourceTree = ""; }; + 00217C9D1E97051E008204EA /* impl_org_ortc_RTCIdentityError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentityError.h; sourceTree = ""; }; + 00217C9E1E97051E008204EA /* impl_org_ortc_RTCIdentityResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCIdentityResult.cpp; sourceTree = ""; }; + 00217C9F1E97051E008204EA /* impl_org_ortc_RTCIdentityResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCIdentityResult.h; sourceTree = ""; }; + 00217CA01E97051E008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCInboundRtpStreamStats.cpp; sourceTree = ""; }; + 00217CA11E97051E008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCInboundRtpStreamStats.h; sourceTree = ""; }; + 00217CA21E97051E008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCMediaStreamStats.cpp; sourceTree = ""; }; + 00217CA31E97051E008204EA /* impl_org_ortc_RTCMediaStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCMediaStreamStats.h; sourceTree = ""; }; + 00217CA41E97051E008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCMediaStreamTrackStats.cpp; sourceTree = ""; }; + 00217CA51E97051E008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCMediaStreamTrackStats.h; sourceTree = ""; }; + 00217CA61E97051E008204EA /* impl_org_ortc_RTCMessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCMessageEvent.cpp; sourceTree = ""; }; + 00217CA71E97051E008204EA /* impl_org_ortc_RTCMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCMessageEvent.h; sourceTree = ""; }; + 00217CA81E97051E008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCOutboundRtpStreamStats.cpp; sourceTree = ""; }; + 00217CA91E97051E008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCOutboundRtpStreamStats.h; sourceTree = ""; }; + 00217CAA1E97051E008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtcpFeedback.cpp; sourceTree = ""; }; + 00217CAB1E97051E008204EA /* impl_org_ortc_RTCRtcpFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtcpFeedback.h; sourceTree = ""; }; + 00217CAC1E97051E008204EA /* impl_org_ortc_RTCRtcpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtcpParameters.cpp; sourceTree = ""; }; + 00217CAD1E97051E008204EA /* impl_org_ortc_RTCRtcpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtcpParameters.h; sourceTree = ""; }; + 00217CAE1E97051E008204EA /* impl_org_ortc_RTCRtcpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtcpTransport.cpp; sourceTree = ""; }; + 00217CAF1E97051E008204EA /* impl_org_ortc_RTCRtcpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtcpTransport.h; sourceTree = ""; }; + 00217CB01E97051E008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCapabilities.cpp; sourceTree = ""; }; + 00217CB11E97051E008204EA /* impl_org_ortc_RTCRtpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCapabilities.h; sourceTree = ""; }; + 00217CB21E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecCapability.cpp; sourceTree = ""; }; + 00217CB31E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecCapability.h; sourceTree = ""; }; + 00217CB41E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp; sourceTree = ""; }; + 00217CB51E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecCapabilityOptions.h; sourceTree = ""; }; + 00217CB61E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00217CB71E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecCapabilityParameters.h; sourceTree = ""; }; + 00217CB81E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecParameters.cpp; sourceTree = ""; }; + 00217CB91E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecParameters.h; sourceTree = ""; }; + 00217CBA1E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpCodecParameterSettings.cpp; sourceTree = ""; }; + 00217CBB1E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpCodecParameterSettings.h; sourceTree = ""; }; + 00217CBC1E97051E008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpContributingSource.cpp; sourceTree = ""; }; + 00217CBD1E97051E008204EA /* impl_org_ortc_RTCRtpContributingSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpContributingSource.h; sourceTree = ""; }; + 00217CBE1E97051E008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpEncodingParameters.cpp; sourceTree = ""; }; + 00217CBF1E97051E008204EA /* impl_org_ortc_RTCRtpEncodingParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpEncodingParameters.h; sourceTree = ""; }; + 00217CC01E97051E008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpFecParameters.cpp; sourceTree = ""; }; + 00217CC11E97051E008204EA /* impl_org_ortc_RTCRtpFecParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpFecParameters.h; sourceTree = ""; }; + 00217CC21E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00217CC31E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h; sourceTree = ""; }; + 00217CC41E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp; sourceTree = ""; }; + 00217CC51E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h; sourceTree = ""; }; + 00217CC61E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp; sourceTree = ""; }; + 00217CC71E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h; sourceTree = ""; }; + 00217CC81E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp; sourceTree = ""; }; + 00217CC91E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpH264CodecParameterSettings.h; sourceTree = ""; }; + 00217CCA1E97051E008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpHeaderExtension.cpp; sourceTree = ""; }; + 00217CCB1E97051E008204EA /* impl_org_ortc_RTCRtpHeaderExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpHeaderExtension.h; sourceTree = ""; }; + 00217CCC1E97051F008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp; sourceTree = ""; }; + 00217CCD1E97051F008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpHeaderExtensionParameters.h; sourceTree = ""; }; + 00217CCE1E97051F008204EA /* impl_org_ortc_RTCRtpListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpListener.cpp; sourceTree = ""; }; + 00217CCF1E97051F008204EA /* impl_org_ortc_RTCRtpListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpListener.h; sourceTree = ""; }; + 00217CD01E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp; sourceTree = ""; }; + 00217CD11E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h; sourceTree = ""; }; + 00217CD21E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00217CD31E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h; sourceTree = ""; }; + 00217CD41E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp; sourceTree = ""; }; + 00217CD51E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpOpusCodecParameterSettings.h; sourceTree = ""; }; + 00217CD61E97051F008204EA /* impl_org_ortc_RTCRtpParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpParameters.cpp; sourceTree = ""; }; + 00217CD71E97051F008204EA /* impl_org_ortc_RTCRtpParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpParameters.h; sourceTree = ""; }; + 00217CD81E97051F008204EA /* impl_org_ortc_RTCRtpReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpReceiver.cpp; sourceTree = ""; }; + 00217CD91E97051F008204EA /* impl_org_ortc_RTCRtpReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpReceiver.h; sourceTree = ""; }; + 00217CDA1E97051F008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp; sourceTree = ""; }; + 00217CDB1E97051F008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRedCodecParameterSettings.h; sourceTree = ""; }; + 00217CDC1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp; sourceTree = ""; }; + 00217CDD1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h; sourceTree = ""; }; + 00217CDE1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp; sourceTree = ""; }; + 00217CDF1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRtxCodecParameterSettings.h; sourceTree = ""; }; + 00217CE01E97051F008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpRtxParameters.cpp; sourceTree = ""; }; + 00217CE11E97051F008204EA /* impl_org_ortc_RTCRtpRtxParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpRtxParameters.h; sourceTree = ""; }; + 00217CE21E97051F008204EA /* impl_org_ortc_RTCRtpSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpSender.cpp; sourceTree = ""; }; + 00217CE31E97051F008204EA /* impl_org_ortc_RTCRtpSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpSender.h; sourceTree = ""; }; + 00217CE41E97051F008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpStreamStats.cpp; sourceTree = ""; }; + 00217CE51E97051F008204EA /* impl_org_ortc_RTCRtpStreamStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpStreamStats.h; sourceTree = ""; }; + 00217CE61E97051F008204EA /* impl_org_ortc_RTCRtpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpTransport.cpp; sourceTree = ""; }; + 00217CE71E97051F008204EA /* impl_org_ortc_RTCRtpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpTransport.h; sourceTree = ""; }; + 00217CE81E97051F008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpUnhandledEvent.cpp; sourceTree = ""; }; + 00217CE91E97051F008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpUnhandledEvent.h; sourceTree = ""; }; + 00217CEA1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp; sourceTree = ""; }; + 00217CEB1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h; sourceTree = ""; }; + 00217CEC1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp; sourceTree = ""; }; + 00217CED1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCRtpVp8CodecParameterSettings.h; sourceTree = ""; }; + 00217CEE1E97051F008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpCapabilities.cpp; sourceTree = ""; }; + 00217CEF1E97051F008204EA /* impl_org_ortc_RTCSctpCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpCapabilities.h; sourceTree = ""; }; + 00217CF01E97051F008204EA /* impl_org_ortc_RTCSctpTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransport.cpp; sourceTree = ""; }; + 00217CF11E97051F008204EA /* impl_org_ortc_RTCSctpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransport.h; sourceTree = ""; }; + 00217CF21E97051F008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportListener.cpp; sourceTree = ""; }; + 00217CF31E97051F008204EA /* impl_org_ortc_RTCSctpTransportListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportListener.h; sourceTree = ""; }; + 00217CF41E97051F008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportListenerEvent.cpp; sourceTree = ""; }; + 00217CF51E97051F008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportListenerEvent.h; sourceTree = ""; }; + 00217CF61E97051F008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp; sourceTree = ""; }; + 00217CF71E97051F008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportStateChangeEvent.h; sourceTree = ""; }; + 00217CF81E97051F008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSctpTransportStats.cpp; sourceTree = ""; }; + 00217CF91E97051F008204EA /* impl_org_ortc_RTCSctpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSctpTransportStats.h; sourceTree = ""; }; + 00217CFA1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp; sourceTree = ""; }; + 00217CFB1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesCryptoParameters.h; sourceTree = ""; }; + 00217CFC1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesKeyParameters.cpp; sourceTree = ""; }; + 00217CFD1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesKeyParameters.h; sourceTree = ""; }; + 00217CFE1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesParameters.cpp; sourceTree = ""; }; + 00217CFF1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesParameters.h; sourceTree = ""; }; + 00217D001E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesTransport.cpp; sourceTree = ""; }; + 00217D011E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesTransport.h; sourceTree = ""; }; + 00217D021E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp; sourceTree = ""; }; + 00217D031E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h; sourceTree = ""; }; + 00217D041E97051F008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSrtpTransportStats.cpp; sourceTree = ""; }; + 00217D051E97051F008204EA /* impl_org_ortc_RTCSrtpTransportStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSrtpTransportStats.h; sourceTree = ""; }; + 00217D061E97051F008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCSsrcConflictEvent.cpp; sourceTree = ""; }; + 00217D071E97051F008204EA /* impl_org_ortc_RTCSsrcConflictEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCSsrcConflictEvent.h; sourceTree = ""; }; + 00217D081E97051F008204EA /* impl_org_ortc_RTCStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStats.cpp; sourceTree = ""; }; + 00217D091E97051F008204EA /* impl_org_ortc_RTCStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStats.h; sourceTree = ""; }; + 00217D0A1E97051F008204EA /* impl_org_ortc_RTCStatsProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStatsProvider.cpp; sourceTree = ""; }; + 00217D0B1E97051F008204EA /* impl_org_ortc_RTCStatsProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStatsProvider.h; sourceTree = ""; }; + 00217D0C1E97051F008204EA /* impl_org_ortc_RTCStatsReport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStatsReport.cpp; sourceTree = ""; }; + 00217D0D1E97051F008204EA /* impl_org_ortc_RTCStatsReport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStatsReport.h; sourceTree = ""; }; + 00217D0E1E97051F008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_RTCStatsTypeSet.cpp; sourceTree = ""; }; + 00217D0F1E97051F008204EA /* impl_org_ortc_RTCStatsTypeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_RTCStatsTypeSet.h; sourceTree = ""; }; + 00217D101E97051F008204EA /* impl_org_ortc_Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_Settings.cpp; sourceTree = ""; }; + 00217D111E97051F008204EA /* impl_org_ortc_Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_Settings.h; sourceTree = ""; }; + 00217D121E97051F008204EA /* impl_org_ortc_StringOrStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = impl_org_ortc_StringOrStringList.cpp; sourceTree = ""; }; + 00217D131E97051F008204EA /* impl_org_ortc_StringOrStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_org_ortc_StringOrStringList.h; sourceTree = ""; }; + 00217D141E97051F008204EA /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 002178151E9704E2008204EA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0021780F1E9704E2008204EA = { + isa = PBXGroup; + children = ( + 002178261E97051A008204EA /* wrapper */, + 002178191E9704E2008204EA /* Products */, + ); + sourceTree = ""; + }; + 002178191E9704E2008204EA /* Products */ = { + isa = PBXGroup; + children = ( + 002178181E9704E2008204EA /* libortclib-wrapper-osx.a */, + ); + name = Products; + sourceTree = ""; + }; + 002178261E97051A008204EA /* wrapper */ = { + isa = PBXGroup; + children = ( + 00217BD71E97051D008204EA /* impl_org_ortc.cpp */, + 00217BD81E97051D008204EA /* impl_org_ortc_adapter_MediaStream.cpp */, + 00217BD91E97051D008204EA /* impl_org_ortc_adapter_MediaStream.h */, + 00217BDA1E97051D008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp */, + 00217BDB1E97051D008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.h */, + 00217BDC1E97051D008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp */, + 00217BDD1E97051D008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.h */, + 00217BDE1E97051D008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp */, + 00217BDF1E97051D008204EA /* impl_org_ortc_adapter_RTCConfiguration.h */, + 00217BE01E97051D008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp */, + 00217BE11E97051D008204EA /* impl_org_ortc_adapter_RTCIceCandidate.h */, + 00217BE21E97051D008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp */, + 00217BE31E97051D008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.h */, + 00217BE41E97051D008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp */, + 00217BE51E97051D008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.h */, + 00217BE61E97051D008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp */, + 00217BE71E97051D008204EA /* impl_org_ortc_adapter_RTCOfferOptions.h */, + 00217BE81E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp */, + 00217BE91E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnection.h */, + 00217BEA1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp */, + 00217BEB1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.h */, + 00217BEC1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp */, + 00217BED1E97051D008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.h */, + 00217BEE1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp */, + 00217BEF1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescription.h */, + 00217BF01E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp */, + 00217BF11E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.h */, + 00217BF21E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp */, + 00217BF31E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.h */, + 00217BF41E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp */, + 00217BF51E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.h */, + 00217BF61E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp */, + 00217BF71E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.h */, + 00217BF81E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp */, + 00217BF91E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.h */, + 00217BFA1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp */, + 00217BFB1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.h */, + 00217BFC1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp */, + 00217BFD1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.h */, + 00217BFE1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp */, + 00217BFF1E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.h */, + 00217C001E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp */, + 00217C011E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.h */, + 00217C021E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp */, + 00217C031E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.h */, + 00217C041E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp */, + 00217C051E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.h */, + 00217C061E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp */, + 00217C071E97051D008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.h */, + 00217C081E97051D008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp */, + 00217C091E97051D008204EA /* impl_org_ortc_adapter_RTCTrackEvent.h */, + 00217C0A1E97051D008204EA /* impl_org_ortc_ConstrainBoolean.cpp */, + 00217C0B1E97051D008204EA /* impl_org_ortc_ConstrainBoolean.h */, + 00217C0C1E97051D008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp */, + 00217C0D1E97051D008204EA /* impl_org_ortc_ConstrainBooleanParameters.h */, + 00217C0E1E97051D008204EA /* impl_org_ortc_ConstrainDouble.cpp */, + 00217C0F1E97051D008204EA /* impl_org_ortc_ConstrainDouble.h */, + 00217C101E97051D008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp */, + 00217C111E97051D008204EA /* impl_org_ortc_ConstrainDoubleRange.h */, + 00217C121E97051D008204EA /* impl_org_ortc_ConstrainLong.cpp */, + 00217C131E97051D008204EA /* impl_org_ortc_ConstrainLong.h */, + 00217C141E97051D008204EA /* impl_org_ortc_ConstrainLongRange.cpp */, + 00217C151E97051D008204EA /* impl_org_ortc_ConstrainLongRange.h */, + 00217C161E97051D008204EA /* impl_org_ortc_ConstrainString.cpp */, + 00217C171E97051D008204EA /* impl_org_ortc_ConstrainString.h */, + 00217C181E97051D008204EA /* impl_org_ortc_ConstrainStringParameters.cpp */, + 00217C191E97051D008204EA /* impl_org_ortc_ConstrainStringParameters.h */, + 00217C1A1E97051D008204EA /* impl_org_ortc_Dispatcher.cpp */, + 00217C1B1E97051D008204EA /* impl_org_ortc_Dispatcher.h */, + 00217C1C1E97051D008204EA /* impl_org_ortc_DoubleRange.cpp */, + 00217C1D1E97051D008204EA /* impl_org_ortc_DoubleRange.h */, + 00217C1E1E97051D008204EA /* impl_org_ortc_Error.cpp */, + 00217C1F1E97051D008204EA /* impl_org_ortc_Error.h */, + 00217C201E97051D008204EA /* impl_org_ortc_ErrorEvent.cpp */, + 00217C211E97051D008204EA /* impl_org_ortc_ErrorEvent.h */, + 00217C221E97051D008204EA /* impl_org_ortc_Helper.cpp */, + 00217C231E97051D008204EA /* impl_org_ortc_Helper.h */, + 00217C241E97051D008204EA /* impl_org_ortc_Json.cpp */, + 00217C251E97051D008204EA /* impl_org_ortc_Json.h */, + 00217C261E97051D008204EA /* impl_org_ortc_Logger.cpp */, + 00217C271E97051D008204EA /* impl_org_ortc_Logger.h */, + 00217C281E97051D008204EA /* impl_org_ortc_LongRange.cpp */, + 00217C291E97051D008204EA /* impl_org_ortc_LongRange.h */, + 00217C2A1E97051D008204EA /* impl_org_ortc_MediaControl.cpp */, + 00217C2B1E97051D008204EA /* impl_org_ortc_MediaControl.h */, + 00217C2C1E97051D008204EA /* impl_org_ortc_MediaDeviceInfo.cpp */, + 00217C2D1E97051D008204EA /* impl_org_ortc_MediaDeviceInfo.h */, + 00217C2E1E97051D008204EA /* impl_org_ortc_MediaDevices.cpp */, + 00217C2F1E97051D008204EA /* impl_org_ortc_MediaDevices.h */, + 00217C301E97051D008204EA /* impl_org_ortc_MediaSource.cpp */, + 00217C311E97051D008204EA /* impl_org_ortc_MediaSource.h */, + 00217C321E97051D008204EA /* impl_org_ortc_MediaStreamConstraints.cpp */, + 00217C331E97051D008204EA /* impl_org_ortc_MediaStreamConstraints.h */, + 00217C341E97051D008204EA /* impl_org_ortc_MediaStreamTrack.cpp */, + 00217C351E97051D008204EA /* impl_org_ortc_MediaStreamTrack.h */, + 00217C361E97051D008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp */, + 00217C371E97051D008204EA /* impl_org_ortc_MediaTrackCapabilities.h */, + 00217C381E97051D008204EA /* impl_org_ortc_MediaTrackConstraints.cpp */, + 00217C391E97051D008204EA /* impl_org_ortc_MediaTrackConstraints.h */, + 00217C3A1E97051D008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp */, + 00217C3B1E97051D008204EA /* impl_org_ortc_MediaTrackConstraintSet.h */, + 00217C3C1E97051D008204EA /* impl_org_ortc_MediaTrackSettings.cpp */, + 00217C3D1E97051D008204EA /* impl_org_ortc_MediaTrackSettings.h */, + 00217C3E1E97051D008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp */, + 00217C3F1E97051D008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.h */, + 00217C401E97051D008204EA /* impl_org_ortc_MessageQueue.cpp */, + 00217C411E97051D008204EA /* impl_org_ortc_MessageQueue.h */, + 00217C421E97051D008204EA /* impl_org_ortc_OrtcLib.cpp */, + 00217C431E97051D008204EA /* impl_org_ortc_OrtcLib.h */, + 00217C441E97051D008204EA /* impl_org_ortc_OrtcLibWithDispatcher.cpp */, + 00217C451E97051D008204EA /* impl_org_ortc_OrtcLibWithDispatcher.h */, + 00217C461E97051D008204EA /* impl_org_ortc_OverconstrainedError.cpp */, + 00217C471E97051D008204EA /* impl_org_ortc_OverconstrainedError.h */, + 00217C481E97051D008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp */, + 00217C491E97051D008204EA /* impl_org_ortc_OverconstrainedErrorEvent.h */, + 00217C4A1E97051D008204EA /* impl_org_ortc_RTCCertificate.cpp */, + 00217C4B1E97051D008204EA /* impl_org_ortc_RTCCertificate.h */, + 00217C4C1E97051D008204EA /* impl_org_ortc_RTCCertificateStats.cpp */, + 00217C4D1E97051D008204EA /* impl_org_ortc_RTCCertificateStats.h */, + 00217C4E1E97051D008204EA /* impl_org_ortc_RTCCodec.cpp */, + 00217C4F1E97051D008204EA /* impl_org_ortc_RTCCodec.h */, + 00217C501E97051D008204EA /* impl_org_ortc_RTCDataChannel.cpp */, + 00217C511E97051D008204EA /* impl_org_ortc_RTCDataChannel.h */, + 00217C521E97051D008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp */, + 00217C531E97051D008204EA /* impl_org_ortc_RTCDataChannelEvent.h */, + 00217C541E97051D008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp */, + 00217C551E97051D008204EA /* impl_org_ortc_RTCDataChannelParameters.h */, + 00217C561E97051E008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp */, + 00217C571E97051E008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.h */, + 00217C581E97051E008204EA /* impl_org_ortc_RTCDataChannelStats.cpp */, + 00217C591E97051E008204EA /* impl_org_ortc_RTCDataChannelStats.h */, + 00217C5A1E97051E008204EA /* impl_org_ortc_RTCDataTransport.cpp */, + 00217C5B1E97051E008204EA /* impl_org_ortc_RTCDataTransport.h */, + 00217C5C1E97051E008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp */, + 00217C5D1E97051E008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.h */, + 00217C5E1E97051E008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp */, + 00217C5F1E97051E008204EA /* impl_org_ortc_RTCDtlsFingerprint.h */, + 00217C601E97051E008204EA /* impl_org_ortc_RTCDtlsParameters.cpp */, + 00217C611E97051E008204EA /* impl_org_ortc_RTCDtlsParameters.h */, + 00217C621E97051E008204EA /* impl_org_ortc_RTCDtlsTransport.cpp */, + 00217C631E97051E008204EA /* impl_org_ortc_RTCDtlsTransport.h */, + 00217C641E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp */, + 00217C651E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.h */, + 00217C661E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp */, + 00217C671E97051E008204EA /* impl_org_ortc_RTCDtlsTransportStats.h */, + 00217C681E97051E008204EA /* impl_org_ortc_RTCDtmfSender.cpp */, + 00217C691E97051E008204EA /* impl_org_ortc_RTCDtmfSender.h */, + 00217C6A1E97051E008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp */, + 00217C6B1E97051E008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.h */, + 00217C6C1E97051E008204EA /* impl_org_ortc_RTCIceCandidate.cpp */, + 00217C6D1E97051E008204EA /* impl_org_ortc_RTCIceCandidate.h */, + 00217C6E1E97051E008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp */, + 00217C6F1E97051E008204EA /* impl_org_ortc_RTCIceCandidateAttributes.h */, + 00217C701E97051E008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp */, + 00217C711E97051E008204EA /* impl_org_ortc_RTCIceCandidateComplete.h */, + 00217C721E97051E008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp */, + 00217C731E97051E008204EA /* impl_org_ortc_RTCIceCandidatePair.h */, + 00217C741E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp */, + 00217C751E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.h */, + 00217C761E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp */, + 00217C771E97051E008204EA /* impl_org_ortc_RTCIceCandidatePairStats.h */, + 00217C781E97051E008204EA /* impl_org_ortc_RTCIceGatherer.cpp */, + 00217C791E97051E008204EA /* impl_org_ortc_RTCIceGatherer.h */, + 00217C7A1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp */, + 00217C7B1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidate.h */, + 00217C7C1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp */, + 00217C7D1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.h */, + 00217C7E1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp */, + 00217C7F1E97051E008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.h */, + 00217C801E97051E008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp */, + 00217C811E97051E008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.h */, + 00217C821E97051E008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp */, + 00217C831E97051E008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.h */, + 00217C841E97051E008204EA /* impl_org_ortc_RTCIceGathererStats.cpp */, + 00217C851E97051E008204EA /* impl_org_ortc_RTCIceGathererStats.h */, + 00217C861E97051E008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp */, + 00217C871E97051E008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.h */, + 00217C881E97051E008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp */, + 00217C891E97051E008204EA /* impl_org_ortc_RTCIceGatherOptions.h */, + 00217C8A1E97051E008204EA /* impl_org_ortc_RTCIceParameters.cpp */, + 00217C8B1E97051E008204EA /* impl_org_ortc_RTCIceParameters.h */, + 00217C8C1E97051E008204EA /* impl_org_ortc_RTCIceServer.cpp */, + 00217C8D1E97051E008204EA /* impl_org_ortc_RTCIceServer.h */, + 00217C8E1E97051E008204EA /* impl_org_ortc_RTCIceTransport.cpp */, + 00217C8F1E97051E008204EA /* impl_org_ortc_RTCIceTransport.h */, + 00217C901E97051E008204EA /* impl_org_ortc_RTCIceTransportController.cpp */, + 00217C911E97051E008204EA /* impl_org_ortc_RTCIceTransportController.h */, + 00217C921E97051E008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp */, + 00217C931E97051E008204EA /* impl_org_ortc_RTCIceTransportOptions.h */, + 00217C941E97051E008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp */, + 00217C951E97051E008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.h */, + 00217C961E97051E008204EA /* impl_org_ortc_RTCIceTransportStats.cpp */, + 00217C971E97051E008204EA /* impl_org_ortc_RTCIceTransportStats.h */, + 00217C981E97051E008204EA /* impl_org_ortc_RTCIdentity.cpp */, + 00217C991E97051E008204EA /* impl_org_ortc_RTCIdentity.h */, + 00217C9A1E97051E008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp */, + 00217C9B1E97051E008204EA /* impl_org_ortc_RTCIdentityAssertion.h */, + 00217C9C1E97051E008204EA /* impl_org_ortc_RTCIdentityError.cpp */, + 00217C9D1E97051E008204EA /* impl_org_ortc_RTCIdentityError.h */, + 00217C9E1E97051E008204EA /* impl_org_ortc_RTCIdentityResult.cpp */, + 00217C9F1E97051E008204EA /* impl_org_ortc_RTCIdentityResult.h */, + 00217CA01E97051E008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp */, + 00217CA11E97051E008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.h */, + 00217CA21E97051E008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp */, + 00217CA31E97051E008204EA /* impl_org_ortc_RTCMediaStreamStats.h */, + 00217CA41E97051E008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp */, + 00217CA51E97051E008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.h */, + 00217CA61E97051E008204EA /* impl_org_ortc_RTCMessageEvent.cpp */, + 00217CA71E97051E008204EA /* impl_org_ortc_RTCMessageEvent.h */, + 00217CA81E97051E008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp */, + 00217CA91E97051E008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.h */, + 00217CAA1E97051E008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp */, + 00217CAB1E97051E008204EA /* impl_org_ortc_RTCRtcpFeedback.h */, + 00217CAC1E97051E008204EA /* impl_org_ortc_RTCRtcpParameters.cpp */, + 00217CAD1E97051E008204EA /* impl_org_ortc_RTCRtcpParameters.h */, + 00217CAE1E97051E008204EA /* impl_org_ortc_RTCRtcpTransport.cpp */, + 00217CAF1E97051E008204EA /* impl_org_ortc_RTCRtcpTransport.h */, + 00217CB01E97051E008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp */, + 00217CB11E97051E008204EA /* impl_org_ortc_RTCRtpCapabilities.h */, + 00217CB21E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp */, + 00217CB31E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapability.h */, + 00217CB41E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp */, + 00217CB51E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.h */, + 00217CB61E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp */, + 00217CB71E97051E008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.h */, + 00217CB81E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp */, + 00217CB91E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameters.h */, + 00217CBA1E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp */, + 00217CBB1E97051E008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.h */, + 00217CBC1E97051E008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp */, + 00217CBD1E97051E008204EA /* impl_org_ortc_RTCRtpContributingSource.h */, + 00217CBE1E97051E008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp */, + 00217CBF1E97051E008204EA /* impl_org_ortc_RTCRtpEncodingParameters.h */, + 00217CC01E97051E008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp */, + 00217CC11E97051E008204EA /* impl_org_ortc_RTCRtpFecParameters.h */, + 00217CC21E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp */, + 00217CC31E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.h */, + 00217CC41E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp */, + 00217CC51E97051E008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.h */, + 00217CC61E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp */, + 00217CC71E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.h */, + 00217CC81E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp */, + 00217CC91E97051E008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.h */, + 00217CCA1E97051E008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp */, + 00217CCB1E97051E008204EA /* impl_org_ortc_RTCRtpHeaderExtension.h */, + 00217CCC1E97051F008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp */, + 00217CCD1E97051F008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.h */, + 00217CCE1E97051F008204EA /* impl_org_ortc_RTCRtpListener.cpp */, + 00217CCF1E97051F008204EA /* impl_org_ortc_RTCRtpListener.h */, + 00217CD01E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp */, + 00217CD11E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.h */, + 00217CD21E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp */, + 00217CD31E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.h */, + 00217CD41E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp */, + 00217CD51E97051F008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.h */, + 00217CD61E97051F008204EA /* impl_org_ortc_RTCRtpParameters.cpp */, + 00217CD71E97051F008204EA /* impl_org_ortc_RTCRtpParameters.h */, + 00217CD81E97051F008204EA /* impl_org_ortc_RTCRtpReceiver.cpp */, + 00217CD91E97051F008204EA /* impl_org_ortc_RTCRtpReceiver.h */, + 00217CDA1E97051F008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp */, + 00217CDB1E97051F008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.h */, + 00217CDC1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp */, + 00217CDD1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.h */, + 00217CDE1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp */, + 00217CDF1E97051F008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.h */, + 00217CE01E97051F008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp */, + 00217CE11E97051F008204EA /* impl_org_ortc_RTCRtpRtxParameters.h */, + 00217CE21E97051F008204EA /* impl_org_ortc_RTCRtpSender.cpp */, + 00217CE31E97051F008204EA /* impl_org_ortc_RTCRtpSender.h */, + 00217CE41E97051F008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp */, + 00217CE51E97051F008204EA /* impl_org_ortc_RTCRtpStreamStats.h */, + 00217CE61E97051F008204EA /* impl_org_ortc_RTCRtpTransport.cpp */, + 00217CE71E97051F008204EA /* impl_org_ortc_RTCRtpTransport.h */, + 00217CE81E97051F008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp */, + 00217CE91E97051F008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.h */, + 00217CEA1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp */, + 00217CEB1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.h */, + 00217CEC1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp */, + 00217CED1E97051F008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.h */, + 00217CEE1E97051F008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp */, + 00217CEF1E97051F008204EA /* impl_org_ortc_RTCSctpCapabilities.h */, + 00217CF01E97051F008204EA /* impl_org_ortc_RTCSctpTransport.cpp */, + 00217CF11E97051F008204EA /* impl_org_ortc_RTCSctpTransport.h */, + 00217CF21E97051F008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp */, + 00217CF31E97051F008204EA /* impl_org_ortc_RTCSctpTransportListener.h */, + 00217CF41E97051F008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp */, + 00217CF51E97051F008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.h */, + 00217CF61E97051F008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp */, + 00217CF71E97051F008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.h */, + 00217CF81E97051F008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp */, + 00217CF91E97051F008204EA /* impl_org_ortc_RTCSctpTransportStats.h */, + 00217CFA1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp */, + 00217CFB1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.h */, + 00217CFC1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp */, + 00217CFD1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.h */, + 00217CFE1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp */, + 00217CFF1E97051F008204EA /* impl_org_ortc_RTCSrtpSdesParameters.h */, + 00217D001E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp */, + 00217D011E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransport.h */, + 00217D021E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp */, + 00217D031E97051F008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.h */, + 00217D041E97051F008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp */, + 00217D051E97051F008204EA /* impl_org_ortc_RTCSrtpTransportStats.h */, + 00217D061E97051F008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp */, + 00217D071E97051F008204EA /* impl_org_ortc_RTCSsrcConflictEvent.h */, + 00217D081E97051F008204EA /* impl_org_ortc_RTCStats.cpp */, + 00217D091E97051F008204EA /* impl_org_ortc_RTCStats.h */, + 00217D0A1E97051F008204EA /* impl_org_ortc_RTCStatsProvider.cpp */, + 00217D0B1E97051F008204EA /* impl_org_ortc_RTCStatsProvider.h */, + 00217D0C1E97051F008204EA /* impl_org_ortc_RTCStatsReport.cpp */, + 00217D0D1E97051F008204EA /* impl_org_ortc_RTCStatsReport.h */, + 00217D0E1E97051F008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp */, + 00217D0F1E97051F008204EA /* impl_org_ortc_RTCStatsTypeSet.h */, + 00217D101E97051F008204EA /* impl_org_ortc_Settings.cpp */, + 00217D111E97051F008204EA /* impl_org_ortc_Settings.h */, + 00217D121E97051F008204EA /* impl_org_ortc_StringOrStringList.cpp */, + 00217D131E97051F008204EA /* impl_org_ortc_StringOrStringList.h */, + 00217D141E97051F008204EA /* types.h */, + ); + name = wrapper; + path = ../../../ortc/idl/wrapper; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 002178161E9704E2008204EA /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 002178171E9704E2008204EA /* ortclib-wrapper-osx */ = { + isa = PBXNativeTarget; + buildConfigurationList = 002178231E9704E2008204EA /* Build configuration list for PBXNativeTarget "ortclib-wrapper-osx" */; + buildPhases = ( + 002178141E9704E2008204EA /* Sources */, + 002178151E9704E2008204EA /* Frameworks */, + 002178161E9704E2008204EA /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "ortclib-wrapper-osx"; + productName = "ortclib-wrapper-osx"; + productReference = 002178181E9704E2008204EA /* libortclib-wrapper-osx.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 002178101E9704E2008204EA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = "Open Peer Foundation"; + TargetAttributes = { + 002178171E9704E2008204EA = { + CreatedOnToolsVersion = 8.3; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 002178131E9704E2008204EA /* Build configuration list for PBXProject "ortclib-wrapper-osx" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 0021780F1E9704E2008204EA; + productRefGroup = 002178191E9704E2008204EA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 002178171E9704E2008204EA /* ortclib-wrapper-osx */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 002178141E9704E2008204EA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0021809E1E970520008204EA /* impl_org_ortc_RTCDataChannelEvent.cpp in Sources */, + 0021803E1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionDataDetails.cpp in Sources */, + 002180F41E970520008204EA /* impl_org_ortc_RTCOutboundRtpStreamStats.cpp in Sources */, + 002180EE1E970520008204EA /* impl_org_ortc_RTCMediaStreamStats.cpp in Sources */, + 002180B81E970520008204EA /* impl_org_ortc_RTCIceCandidate.cpp in Sources */, + 0021802A1E970520008204EA /* impl_org_ortc_adapter_RTCConfiguration.cpp in Sources */, + 002180801E970520008204EA /* impl_org_ortc_MediaStreamTrack.cpp in Sources */, + 002181241E970520008204EA /* impl_org_ortc_RTCRtpReceiver.cpp in Sources */, + 0021813E1E970520008204EA /* impl_org_ortc_RTCSctpTransportListener.cpp in Sources */, + 002181581E970520008204EA /* impl_org_ortc_RTCStatsReport.cpp in Sources */, + 002180341E970520008204EA /* impl_org_ortc_adapter_RTCPeerConnection.cpp in Sources */, + 002181401E970520008204EA /* impl_org_ortc_RTCSctpTransportListenerEvent.cpp in Sources */, + 0021815C1E970521008204EA /* impl_org_ortc_Settings.cpp in Sources */, + 002180601E970520008204EA /* impl_org_ortc_ConstrainLongRange.cpp in Sources */, + 002180DE1E970520008204EA /* impl_org_ortc_RTCIceTransportOptions.cpp in Sources */, + 002180E61E970520008204EA /* impl_org_ortc_RTCIdentityAssertion.cpp in Sources */, + 002180481E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpMediaLine.cpp in Sources */, + 0021805A1E970520008204EA /* impl_org_ortc_ConstrainDouble.cpp in Sources */, + 002180CA1E970520008204EA /* impl_org_ortc_RTCIceGathererCandidateEvent.cpp in Sources */, + 002180921E970520008204EA /* impl_org_ortc_OverconstrainedError.cpp in Sources */, + 002180BC1E970520008204EA /* impl_org_ortc_RTCIceCandidateComplete.cpp in Sources */, + 002180D01E970520008204EA /* impl_org_ortc_RTCIceGathererStats.cpp in Sources */, + 0021814C1E970520008204EA /* impl_org_ortc_RTCSrtpSdesTransport.cpp in Sources */, + 0021807C1E970520008204EA /* impl_org_ortc_MediaSource.cpp in Sources */, + 002180231E970520008204EA /* impl_org_ortc.cpp in Sources */, + 0021811A1E970520008204EA /* impl_org_ortc_RTCRtpListener.cpp in Sources */, + 002181561E970520008204EA /* impl_org_ortc_RTCStatsProvider.cpp in Sources */, + 0021809A1E970520008204EA /* impl_org_ortc_RTCCodec.cpp in Sources */, + 0021813C1E970520008204EA /* impl_org_ortc_RTCSctpTransport.cpp in Sources */, + 0021804A1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSender.cpp in Sources */, + 0021805E1E970520008204EA /* impl_org_ortc_ConstrainLong.cpp in Sources */, + 0021806A1E970520008204EA /* impl_org_ortc_Error.cpp in Sources */, + 0021806C1E970520008204EA /* impl_org_ortc_ErrorEvent.cpp in Sources */, + 002180561E970520008204EA /* impl_org_ortc_ConstrainBoolean.cpp in Sources */, + 002180521E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransportParameters.cpp in Sources */, + 002180361E970520008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceErrorEvent.cpp in Sources */, + 0021814A1E970520008204EA /* impl_org_ortc_RTCSrtpSdesParameters.cpp in Sources */, + 002180841E970520008204EA /* impl_org_ortc_MediaTrackConstraints.cpp in Sources */, + 0021814E1E970520008204EA /* impl_org_ortc_RTCSrtpSdesTransportLifetimeRemainingEvent.cpp in Sources */, + 002180FE1E970520008204EA /* impl_org_ortc_RTCRtpCodecCapability.cpp in Sources */, + 002180F61E970520008204EA /* impl_org_ortc_RTCRtcpFeedback.cpp in Sources */, + 002180DC1E970520008204EA /* impl_org_ortc_RTCIceTransportController.cpp in Sources */, + 002181281E970520008204EA /* impl_org_ortc_RTCRtpRtxCodecCapabilityParameters.cpp in Sources */, + 002180BA1E970520008204EA /* impl_org_ortc_RTCIceCandidateAttributes.cpp in Sources */, + 002181321E970520008204EA /* impl_org_ortc_RTCRtpTransport.cpp in Sources */, + 0021810C1E970520008204EA /* impl_org_ortc_RTCRtpFecParameters.cpp in Sources */, + 0021813A1E970520008204EA /* impl_org_ortc_RTCSctpCapabilities.cpp in Sources */, + 002181501E970520008204EA /* impl_org_ortc_RTCSrtpTransportStats.cpp in Sources */, + 0021804E1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionSctpMediaLine.cpp in Sources */, + 002180441E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLine.cpp in Sources */, + 0021807E1E970520008204EA /* impl_org_ortc_MediaStreamConstraints.cpp in Sources */, + 002180501E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionTransport.cpp in Sources */, + 002180D21E970520008204EA /* impl_org_ortc_RTCIceGatherInterfacePolicy.cpp in Sources */, + 002180CC1E970520008204EA /* impl_org_ortc_RTCIceGathererIceErrorEvent.cpp in Sources */, + 002181421E970520008204EA /* impl_org_ortc_RTCSctpTransportStateChangeEvent.cpp in Sources */, + 002181521E970520008204EA /* impl_org_ortc_RTCSsrcConflictEvent.cpp in Sources */, + 002181201E970520008204EA /* impl_org_ortc_RTCRtpOpusCodecParameterSettings.cpp in Sources */, + 002181081E970520008204EA /* impl_org_ortc_RTCRtpContributingSource.cpp in Sources */, + 002180881E970520008204EA /* impl_org_ortc_MediaTrackSettings.cpp in Sources */, + 002180741E970520008204EA /* impl_org_ortc_LongRange.cpp in Sources */, + 002180C41E970520008204EA /* impl_org_ortc_RTCIceGatherer.cpp in Sources */, + 002180621E970520008204EA /* impl_org_ortc_ConstrainString.cpp in Sources */, + 0021804C1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionRtpSenderDetails.cpp in Sources */, + 0021812E1E970520008204EA /* impl_org_ortc_RTCRtpSender.cpp in Sources */, + 002180981E970520008204EA /* impl_org_ortc_RTCCertificateStats.cpp in Sources */, + 0021812C1E970520008204EA /* impl_org_ortc_RTCRtpRtxParameters.cpp in Sources */, + 002180EC1E970520008204EA /* impl_org_ortc_RTCInboundRtpStreamStats.cpp in Sources */, + 002181101E970520008204EA /* impl_org_ortc_RTCRtpFlexFecCodecParameterSettings.cpp in Sources */, + 002180961E970520008204EA /* impl_org_ortc_RTCCertificate.cpp in Sources */, + 002180D61E970520008204EA /* impl_org_ortc_RTCIceParameters.cpp in Sources */, + 002180C21E970520008204EA /* impl_org_ortc_RTCIceCandidatePairStats.cpp in Sources */, + 002181041E970520008204EA /* impl_org_ortc_RTCRtpCodecParameters.cpp in Sources */, + 0021808A1E970520008204EA /* impl_org_ortc_MediaTrackSupportedConstraints.cpp in Sources */, + 0021803C1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionConnectionData.cpp in Sources */, + 0021803A1E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescription.cpp in Sources */, + 002180261E970520008204EA /* impl_org_ortc_adapter_RTCAnswerOptions.cpp in Sources */, + 002180D41E970520008204EA /* impl_org_ortc_RTCIceGatherOptions.cpp in Sources */, + 002181061E970520008204EA /* impl_org_ortc_RTCRtpCodecParameterSettings.cpp in Sources */, + 0021802C1E970520008204EA /* impl_org_ortc_adapter_RTCIceCandidate.cpp in Sources */, + 002181481E970520008204EA /* impl_org_ortc_RTCSrtpSdesKeyParameters.cpp in Sources */, + 002180FA1E970520008204EA /* impl_org_ortc_RTCRtcpTransport.cpp in Sources */, + 002181381E970520008204EA /* impl_org_ortc_RTCRtpVp8CodecParameterSettings.cpp in Sources */, + 002180301E970520008204EA /* impl_org_ortc_adapter_RTCOfferAnswerOptions.cpp in Sources */, + 0021810E1E970520008204EA /* impl_org_ortc_RTCRtpFlexFecCodecCapabilityParameters.cpp in Sources */, + 002180B21E970520008204EA /* impl_org_ortc_RTCDtlsTransportStats.cpp in Sources */, + 002181301E970520008204EA /* impl_org_ortc_RTCRtpStreamStats.cpp in Sources */, + 002180401E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescription.cpp in Sources */, + 002180D81E970520008204EA /* impl_org_ortc_RTCIceServer.cpp in Sources */, + 002180281E970520008204EA /* impl_org_ortc_adapter_RTCCapabilityOptions.cpp in Sources */, + 0021805C1E970520008204EA /* impl_org_ortc_ConstrainDoubleRange.cpp in Sources */, + 0021806E1E970520008204EA /* impl_org_ortc_Helper.cpp in Sources */, + 002180B01E970520008204EA /* impl_org_ortc_RTCDtlsTransportStateChangeEvent.cpp in Sources */, + 002180AC1E970520008204EA /* impl_org_ortc_RTCDtlsParameters.cpp in Sources */, + 002180E41E970520008204EA /* impl_org_ortc_RTCIdentity.cpp in Sources */, + 002180641E970520008204EA /* impl_org_ortc_ConstrainStringParameters.cpp in Sources */, + 002180C01E970520008204EA /* impl_org_ortc_RTCIceCandidatePairChangeEvent.cpp in Sources */, + 002180CE1E970520008204EA /* impl_org_ortc_RTCIceGathererStateChangeEvent.cpp in Sources */, + 002180C61E970520008204EA /* impl_org_ortc_RTCIceGathererCandidate.cpp in Sources */, + 002180FC1E970520008204EA /* impl_org_ortc_RTCRtpCapabilities.cpp in Sources */, + 002180A01E970520008204EA /* impl_org_ortc_RTCDataChannelParameters.cpp in Sources */, + 002180AA1E970520008204EA /* impl_org_ortc_RTCDtlsFingerprint.cpp in Sources */, + 002180861E970520008204EA /* impl_org_ortc_MediaTrackConstraintSet.cpp in Sources */, + 002180DA1E970520008204EA /* impl_org_ortc_RTCIceTransport.cpp in Sources */, + 002181121E970520008204EA /* impl_org_ortc_RTCRtpH264CodecCapabilityParameters.cpp in Sources */, + 002180EA1E970520008204EA /* impl_org_ortc_RTCIdentityResult.cpp in Sources */, + 002181021E970520008204EA /* impl_org_ortc_RTCRtpCodecCapabilityParameters.cpp in Sources */, + 002180BE1E970520008204EA /* impl_org_ortc_RTCIceCandidatePair.cpp in Sources */, + 002180AE1E970520008204EA /* impl_org_ortc_RTCDtlsTransport.cpp in Sources */, + 002180B41E970520008204EA /* impl_org_ortc_RTCDtmfSender.cpp in Sources */, + 002180941E970520008204EA /* impl_org_ortc_OverconstrainedErrorEvent.cpp in Sources */, + 0021811E1E970520008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityParameters.cpp in Sources */, + 002180A81E970520008204EA /* impl_org_ortc_RTCDtlsCertificateBinary.cpp in Sources */, + 002180B61E970520008204EA /* impl_org_ortc_RTCDtmfToneChangeEvent.cpp in Sources */, + 002180F21E970520008204EA /* impl_org_ortc_RTCMessageEvent.cpp in Sources */, + 0021808C1E970520008204EA /* impl_org_ortc_MessageQueue.cpp in Sources */, + 002181341E970520008204EA /* impl_org_ortc_RTCRtpUnhandledEvent.cpp in Sources */, + 002180461E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionMediaLineDetails.cpp in Sources */, + 002180681E970520008204EA /* impl_org_ortc_DoubleRange.cpp in Sources */, + 002181261E970520008204EA /* impl_org_ortc_RTCRtpRedCodecParameterSettings.cpp in Sources */, + 002180381E970520008204EA /* impl_org_ortc_adapter_RTCPeerConnectionIceEvent.cpp in Sources */, + 002181441E970520008204EA /* impl_org_ortc_RTCSctpTransportStats.cpp in Sources */, + 0021809C1E970520008204EA /* impl_org_ortc_RTCDataChannel.cpp in Sources */, + 002180E01E970520008204EA /* impl_org_ortc_RTCIceTransportStateChangeEvent.cpp in Sources */, + 002180241E970520008204EA /* impl_org_ortc_adapter_MediaStream.cpp in Sources */, + 0021802E1E970520008204EA /* impl_org_ortc_adapter_RTCMediaStreamTrackConfiguration.cpp in Sources */, + 002181221E970520008204EA /* impl_org_ortc_RTCRtpParameters.cpp in Sources */, + 002180A21E970520008204EA /* impl_org_ortc_RTCDataChannelStateChangeEvent.cpp in Sources */, + 002180721E970520008204EA /* impl_org_ortc_Logger.cpp in Sources */, + 002180E81E970520008204EA /* impl_org_ortc_RTCIdentityError.cpp in Sources */, + 002180761E970520008204EA /* impl_org_ortc_MediaControl.cpp in Sources */, + 002181361E970520008204EA /* impl_org_ortc_RTCRtpVp8CodecCapabilityParameters.cpp in Sources */, + 0021811C1E970520008204EA /* impl_org_ortc_RTCRtpOpusCodecCapabilityOptions.cpp in Sources */, + 002180581E970520008204EA /* impl_org_ortc_ConstrainBooleanParameters.cpp in Sources */, + 002180541E970520008204EA /* impl_org_ortc_adapter_RTCTrackEvent.cpp in Sources */, + 002180E21E970520008204EA /* impl_org_ortc_RTCIceTransportStats.cpp in Sources */, + 002180421E970520008204EA /* impl_org_ortc_adapter_RTCSessionDescriptionDescriptionDetails.cpp in Sources */, + 0021812A1E970520008204EA /* impl_org_ortc_RTCRtpRtxCodecParameterSettings.cpp in Sources */, + 002180F01E970520008204EA /* impl_org_ortc_RTCMediaStreamTrackStats.cpp in Sources */, + 002180A61E970520008204EA /* impl_org_ortc_RTCDataTransport.cpp in Sources */, + 002180821E970520008204EA /* impl_org_ortc_MediaTrackCapabilities.cpp in Sources */, + 002181181E970520008204EA /* impl_org_ortc_RTCRtpHeaderExtensionParameters.cpp in Sources */, + 002181161E970520008204EA /* impl_org_ortc_RTCRtpHeaderExtension.cpp in Sources */, + 0021808E1E970520008204EA /* impl_org_ortc_OrtcLib.cpp in Sources */, + 002181001E970520008204EA /* impl_org_ortc_RTCRtpCodecCapabilityOptions.cpp in Sources */, + 002181141E970520008204EA /* impl_org_ortc_RTCRtpH264CodecParameterSettings.cpp in Sources */, + 0021810A1E970520008204EA /* impl_org_ortc_RTCRtpEncodingParameters.cpp in Sources */, + 002180701E970520008204EA /* impl_org_ortc_Json.cpp in Sources */, + 002180C81E970520008204EA /* impl_org_ortc_RTCIceGathererCandidateCompleteEvent.cpp in Sources */, + 002180A41E970520008204EA /* impl_org_ortc_RTCDataChannelStats.cpp in Sources */, + 0021807A1E970520008204EA /* impl_org_ortc_MediaDevices.cpp in Sources */, + 002180781E970520008204EA /* impl_org_ortc_MediaDeviceInfo.cpp in Sources */, + 002181461E970520008204EA /* impl_org_ortc_RTCSrtpSdesCryptoParameters.cpp in Sources */, + 002180321E970520008204EA /* impl_org_ortc_adapter_RTCOfferOptions.cpp in Sources */, + 0021815E1E970521008204EA /* impl_org_ortc_StringOrStringList.cpp in Sources */, + 002181541E970520008204EA /* impl_org_ortc_RTCStats.cpp in Sources */, + 002180F81E970520008204EA /* impl_org_ortc_RTCRtcpParameters.cpp in Sources */, + 0021815A1E970521008204EA /* impl_org_ortc_RTCStatsTypeSet.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 002178211E9704E2008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "../../../../ortclib-cpp", + "../../../../ortclib-services-cpp", + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ../../../../../../webrtc/xplatform/webrtc, + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 002178221E9704E2008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "../../../../ortclib-cpp", + "../../../../ortclib-services-cpp", + ../../../../zsLib, + "../../../../zsLib-eventing", + ../../../.., + ../../../../../../webrtc/xplatform/webrtc, + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 002178241E9704E2008204EA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_CPP_EXCEPTIONS = YES; + GCC_ENABLE_CPP_RTTI = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 002178251E9704E2008204EA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_CPP_EXCEPTIONS = YES; + GCC_ENABLE_CPP_RTTI = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 002178131E9704E2008204EA /* Build configuration list for PBXProject "ortclib-wrapper-osx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 002178211E9704E2008204EA /* Debug */, + 002178221E9704E2008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 002178231E9704E2008204EA /* Build configuration list for PBXNativeTarget "ortclib-wrapper-osx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 002178241E9704E2008204EA /* Debug */, + 002178251E9704E2008204EA /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 002178101E9704E2008204EA /* Project object */; +} diff --git a/projects/xcode/ortclib.Test-ios/ortclib.Test-ios.xcodeproj/project.pbxproj b/projects/xcode/ortclib.Test-ios/ortclib.Test-ios.xcodeproj/project.pbxproj index 79fa105c..e75dc63b 100644 --- a/projects/xcode/ortclib.Test-ios/ortclib.Test-ios.xcodeproj/project.pbxproj +++ b/projects/xcode/ortclib.Test-ios/ortclib.Test-ios.xcodeproj/project.pbxproj @@ -15,27 +15,6 @@ 009D19A11DE52DEA00D139FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 009D199F1DE52DEA00D139FF /* LaunchScreen.storyboard */; }; 009D19AC1DE52DEA00D139FF /* ortclib_Test_iosTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 009D19AB1DE52DEA00D139FF /* ortclib_Test_iosTests.m */; }; 009D19B71DE52DEA00D139FF /* ortclib_Test_iosUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 009D19B61DE52DEA00D139FF /* ortclib_Test_iosUITests.m */; }; - 009D1A681DE52F7400D139FF /* libcryptopp-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19DB1DE52E8200D139FF /* libcryptopp-ios.a */; }; - 009D1A691DE52F7400D139FF /* libidnkit-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19DE1DE52E8200D139FF /* libidnkit-ios.a */; }; - 009D1A6A1DE52F7400D139FF /* libortclib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E11DE52E8200D139FF /* libortclib-ios.a */; }; - 009D1A6B1DE52F7400D139FF /* libortclib.services-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E41DE52E8200D139FF /* libortclib.services-ios.a */; }; - 009D1A6C1DE52F7400D139FF /* libudns-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E71DE52E8200D139FF /* libudns-ios.a */; }; - 009D1A6D1DE52F7400D139FF /* libzsLib-eventing-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19EA1DE52E8200D139FF /* libzsLib-eventing-ios.a */; }; - 009D1A6E1DE52F7400D139FF /* libzsLib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19ED1DE52E8200D139FF /* libzsLib-ios.a */; }; - 009D1A6F1DE52F9200D139FF /* libcryptopp-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19DB1DE52E8200D139FF /* libcryptopp-ios.a */; }; - 009D1A701DE52F9200D139FF /* libidnkit-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19DE1DE52E8200D139FF /* libidnkit-ios.a */; }; - 009D1A711DE52F9200D139FF /* libortclib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E11DE52E8200D139FF /* libortclib-ios.a */; }; - 009D1A721DE52F9200D139FF /* libortclib.services-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E41DE52E8200D139FF /* libortclib.services-ios.a */; }; - 009D1A731DE52F9200D139FF /* libudns-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E71DE52E8200D139FF /* libudns-ios.a */; }; - 009D1A741DE52F9200D139FF /* libzsLib-eventing-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19EA1DE52E8200D139FF /* libzsLib-eventing-ios.a */; }; - 009D1A751DE52F9200D139FF /* libzsLib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19ED1DE52E8200D139FF /* libzsLib-ios.a */; }; - 009D1A761DE52FA000D139FF /* libcryptopp-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19DB1DE52E8200D139FF /* libcryptopp-ios.a */; }; - 009D1A771DE52FA000D139FF /* libidnkit-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19DE1DE52E8200D139FF /* libidnkit-ios.a */; }; - 009D1A781DE52FA000D139FF /* libortclib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E11DE52E8200D139FF /* libortclib-ios.a */; }; - 009D1A791DE52FA000D139FF /* libortclib.services-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E41DE52E8200D139FF /* libortclib.services-ios.a */; }; - 009D1A7A1DE52FA000D139FF /* libudns-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19E71DE52E8200D139FF /* libudns-ios.a */; }; - 009D1A7B1DE52FA000D139FF /* libzsLib-eventing-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19EA1DE52E8200D139FF /* libzsLib-eventing-ios.a */; }; - 009D1A7C1DE52FA000D139FF /* libzsLib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 009D19ED1DE52E8200D139FF /* libzsLib-ios.a */; }; 009D1A9C1DE52FBF00D139FF /* TestDTLS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D1A801DE52FBF00D139FF /* TestDTLS.cpp */; }; 009D1A9D1DE52FBF00D139FF /* TestDTLS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D1A801DE52FBF00D139FF /* TestDTLS.cpp */; }; 009D1A9E1DE52FBF00D139FF /* TestDTLS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D1A801DE52FBF00D139FF /* TestDTLS.cpp */; }; @@ -84,6 +63,21 @@ 009D1AC91DE52FC000D139FF /* TestSRTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D1A981DE52FBF00D139FF /* TestSRTP.cpp */; }; 009D1ACA1DE52FC000D139FF /* TestSRTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D1A981DE52FBF00D139FF /* TestSRTP.cpp */; }; 009D1ACB1DE52FC000D139FF /* TestSRTP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 009D1A981DE52FBF00D139FF /* TestSRTP.cpp */; }; + 52AD843F1E5DF2DD00DCD81D /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52AD843E1E5DF2DD00DCD81D /* libcurl.a */; }; + 52BA73931E647BAD00CAF5AE /* webrtc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73921E647BAD00CAF5AE /* webrtc.a */; }; + 52BA73951E647BB600CAF5AE /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73941E647BB600CAF5AE /* CoreMedia.framework */; }; + 52BA73971E647C1400CAF5AE /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73961E647C1400CAF5AE /* AVFoundation.framework */; }; + 52BA73991E647C9C00CAF5AE /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73981E647C9C00CAF5AE /* VideoToolbox.framework */; }; + 52BA739B1E647CCC00CAF5AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA739A1E647CCC00CAF5AE /* AudioToolbox.framework */; }; + 52BA73C41E64DD1900CAF5AE /* libcryptopp-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73BD1E64DD1900CAF5AE /* libcryptopp-ios.a */; }; + 52BA73C51E64DD1900CAF5AE /* libidnkit-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73BE1E64DD1900CAF5AE /* libidnkit-ios.a */; }; + 52BA73C71E64DD1900CAF5AE /* libortclib.services-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73C01E64DD1900CAF5AE /* libortclib.services-ios.a */; }; + 52BA73C81E64DD1900CAF5AE /* libudns-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73C11E64DD1900CAF5AE /* libudns-ios.a */; }; + 52BA73CD1E64DECB00CAF5AE /* libortclib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73CB1E64DECB00CAF5AE /* libortclib-ios.a */; }; + 52BA73CE1E64DECB00CAF5AE /* libzsLib-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73CC1E64DECB00CAF5AE /* libzsLib-ios.a */; }; + 52BA73FC1E64E28D00CAF5AE /* libzsLib-eventing-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73FB1E64E28D00CAF5AE /* libzsLib-eventing-ios.a */; }; + 52BA73FE1E64E2C200CAF5AE /* libresolv.9.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73FD1E64E2C200CAF5AE /* libresolv.9.tbd */; }; + 52BA74001E64E2E700CAF5AE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BA73FF1E64E2E700CAF5AE /* libz.tbd */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -101,103 +95,68 @@ remoteGlobalIDString = 009D198D1DE52DEA00D139FF; remoteInfo = "ortclib.Test-ios"; }; - 009D19DA1DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F3361E65B1D70005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19D31DE52E8200D139FF /* cryptopp-ios.xcodeproj */; + containerPortal = 52BA739C1E64DB4200CAF5AE /* zsLib-ios.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 009BBA0A1D974F4400B6B633; - remoteInfo = "cryptopp-ios"; + remoteGlobalIDString = 0067EE151D9C5B4E003BE1AC; + remoteInfo = "zsLib-ios"; }; - 009D19DD1DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F3401E65B1D70005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19CA1DE52E8200D139FF /* idnkit-ios.xcodeproj */; + containerPortal = 52BA73F51E64E28000CAF5AE /* zsLib-eventing-ios.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 008698371DE3F458009D669C; + remoteInfo = "zsLib-eventing-ios"; + }; + 5285F3481E65B1D70005D02E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 52BA73A51E64DC0300CAF5AE /* idnkit-ios.xcodeproj */; proxyType = 2; remoteGlobalIDString = 0001A45F1DA1DD5F00D807DA; remoteInfo = "idnkit-ios"; }; - 009D19E01DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F34D1E65B1D70005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 009D19C41DE52E8200D139FF /* ortclib-ios.xcodeproj */; proxyType = 2; remoteGlobalIDString = 0064F8031DE51EB900EE8962; remoteInfo = "ortclib-ios"; }; - 009D19E31DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F36D1E65B3470005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19C71DE52E8200D139FF /* ortclib.services-ios.xcodeproj */; + containerPortal = 52BA73B71E64DC2C00CAF5AE /* ortclib.services-ios.xcodeproj */; proxyType = 2; remoteGlobalIDString = 008A13851DA1A13600D1664A; remoteInfo = "ortclib.services-ios"; }; - 009D19E61DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F3741E65B3470005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19CD1DE52E8200D139FF /* udns-ios.xcodeproj */; + containerPortal = 52BA73AB1E64DC1000CAF5AE /* udns-ios.xcodeproj */; proxyType = 2; remoteGlobalIDString = 0022EA3D1D989A1F002FCECF; remoteInfo = "udns-ios"; }; - 009D19E91DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F3791E65B3470005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19D01DE52E8200D139FF /* zsLib-eventing-ios.xcodeproj */; + containerPortal = 52BA73B11E64DC1B00CAF5AE /* cryptopp-ios.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 008698371DE3F458009D669C; - remoteInfo = "zsLib-eventing-ios"; + remoteGlobalIDString = 009BBA0A1D974F4400B6B633; + remoteInfo = "cryptopp-ios"; }; - 009D19EC1DE52E8200D139FF /* PBXContainerItemProxy */ = { + 5285F37E1E65B3470005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19D61DE52E8200D139FF /* zsLib-ios.xcodeproj */; + containerPortal = 526A20B31E6093A800BA0F07 /* webrtcWrapper_ios.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 0067EE151D9C5B4E003BE1AC; - remoteInfo = "zsLib-ios"; - }; - 009D1A5A1DE52F5900D139FF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 009D19C41DE52E8200D139FF /* ortclib-ios.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 0064F8021DE51EB900EE8962; - remoteInfo = "ortclib-ios"; - }; - 009D1A5C1DE52F5900D139FF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 009D19C71DE52E8200D139FF /* ortclib.services-ios.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 008A13841DA1A13600D1664A; - remoteInfo = "ortclib.services-ios"; + remoteGlobalIDString = 9451F25C1BC54F57008CB8D7; + remoteInfo = webrtcWrapper_ios; }; - 009D1A5E1DE52F5900D139FF /* PBXContainerItemProxy */ = { + 5285F3801E65CAE40005D02E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 009D19CA1DE52E8200D139FF /* idnkit-ios.xcodeproj */; + containerPortal = 526A20B31E6093A800BA0F07 /* webrtcWrapper_ios.xcodeproj */; proxyType = 1; - remoteGlobalIDString = 0001A45E1DA1DD5F00D807DA; - remoteInfo = "idnkit-ios"; - }; - 009D1A601DE52F5900D139FF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 009D19CD1DE52E8200D139FF /* udns-ios.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 0022EA3C1D989A1F002FCECF; - remoteInfo = "udns-ios"; - }; - 009D1A621DE52F5900D139FF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 009D19D01DE52E8200D139FF /* zsLib-eventing-ios.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 008698361DE3F458009D669C; - remoteInfo = "zsLib-eventing-ios"; - }; - 009D1A641DE52F5900D139FF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 009D19D31DE52E8200D139FF /* cryptopp-ios.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 009BBA091D974F4400B6B633; - remoteInfo = "cryptopp-ios"; - }; - 009D1A661DE52F5900D139FF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 009D19D61DE52E8200D139FF /* zsLib-ios.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 0067EE141D9C5B4E003BE1AC; - remoteInfo = "zsLib-ios"; + remoteGlobalIDString = 9451F25B1BC54F57008CB8D7; + remoteInfo = webrtcWrapper_ios; }; /* End PBXContainerItemProxy section */ @@ -218,13 +177,7 @@ 009D19B21DE52DEA00D139FF /* ortclib.Test-iosUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ortclib.Test-iosUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 009D19B61DE52DEA00D139FF /* ortclib_Test_iosUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ortclib_Test_iosUITests.m; sourceTree = ""; }; 009D19B81DE52DEA00D139FF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 009D19C41DE52E8200D139FF /* ortclib-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "ortclib-ios.xcodeproj"; path = "../ortclib-ios/ortclib-ios.xcodeproj"; sourceTree = ""; }; - 009D19C71DE52E8200D139FF /* ortclib.services-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "ortclib.services-ios.xcodeproj"; path = "/Users/robin/Repos/ortclib/ortclib-sdk/ortc/xplatform/ortclib-cpp/projects/xcode/../../../ortclib-services-cpp/projects/xcode/ortclib.services-ios/ortclib.services-ios.xcodeproj"; sourceTree = ""; }; - 009D19CA1DE52E8200D139FF /* idnkit-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "idnkit-ios.xcodeproj"; path = "/Users/robin/Repos/ortclib/ortclib-sdk/ortc/xplatform/ortclib-cpp/projects/xcode/../../../idnkit/projects/xcode/idnkit-ios/idnkit-ios.xcodeproj"; sourceTree = ""; }; - 009D19CD1DE52E8200D139FF /* udns-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "udns-ios.xcodeproj"; path = "/Users/robin/Repos/ortclib/ortclib-sdk/ortc/xplatform/ortclib-cpp/projects/xcode/../../../udns/projects/xcode/udns-ios/udns-ios.xcodeproj"; sourceTree = ""; }; - 009D19D01DE52E8200D139FF /* zsLib-eventing-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "zsLib-eventing-ios.xcodeproj"; path = "/Users/robin/Repos/ortclib/ortclib-sdk/ortc/xplatform/ortclib-cpp/projects/xcode/../../../zsLib-eventing/projects/xcode/zsLib-eventing-ios/zsLib-eventing-ios.xcodeproj"; sourceTree = ""; }; - 009D19D31DE52E8200D139FF /* cryptopp-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "cryptopp-ios.xcodeproj"; path = "/Users/robin/Repos/ortclib/ortclib-sdk/ortc/xplatform/ortclib-cpp/projects/xcode/../../../cryptopp/projects/xcode/cryptopp-ios/cryptopp-ios.xcodeproj"; sourceTree = ""; }; - 009D19D61DE52E8200D139FF /* zsLib-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "zsLib-ios.xcodeproj"; path = "/Users/robin/Repos/ortclib/ortclib-sdk/ortc/xplatform/ortclib-cpp/projects/xcode/../../../zsLib/projects/xcode/zsLib-ios/zsLib-ios.xcodeproj"; sourceTree = ""; }; + 009D19C41DE52E8200D139FF /* ortclib-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "ortclib-ios.xcodeproj"; path = "../ortclib-ios/ortclib-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; 009D1A7E1DE52FBF00D139FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; 009D1A7F1DE52FBF00D139FF /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 009D1A801DE52FBF00D139FF /* TestDTLS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestDTLS.cpp; sourceTree = ""; }; @@ -252,6 +205,89 @@ 009D1A961DE52FBF00D139FF /* TestSCTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSCTP.h; sourceTree = ""; }; 009D1A971DE52FBF00D139FF /* TestSetup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSetup.cpp; sourceTree = ""; }; 009D1A981DE52FBF00D139FF /* TestSRTP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestSRTP.cpp; sourceTree = ""; }; + 52656CBC1E5F02A1009DAE87 /* libaudio_decoder_factory_interface.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_decoder_factory_interface.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios64/Debug-iphoneos/libaudio_decoder_factory_interface.a"; sourceTree = ""; }; + 52656CBE1E5F040E009DAE87 /* libaudio_processing_neon.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_processing_neon.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios64/Debug-iphoneos/libaudio_processing_neon.a"; sourceTree = ""; }; + 526A20B31E6093A800BA0F07 /* webrtcWrapper_ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = webrtcWrapper_ios.xcodeproj; path = ../../../../../apple/projects/xcode/webrtcWrappers/webrtcWrapper_ios/webrtcWrapper_ios.xcodeproj; sourceTree = SOURCE_ROOT; }; + 52AD84301E5DE9C200DCD81D /* libzsLib-eventing-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-eventing-ios.a"; path = "../../../../zsLib-eventing/projects/xcode/zsLib-eventing-ios/build/Debug-iphoneos/libzsLib-eventing-ios.a"; sourceTree = ""; }; + 52AD84321E5DE9D500DCD81D /* libwebrtcWrapper_ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtcWrapper_ios.a; path = "../../../../../apple/projects/xcode/webrtcWrappers/webrtcWrapper_ios/build/Debug-iphoneos/libwebrtcWrapper_ios.a"; sourceTree = ""; }; + 52AD843E1E5DF2DD00DCD81D /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = "../../../../curl/curl/ios-appstore/lib/libcurl.a"; sourceTree = ""; }; + 52AD84401E5DF35B00DCD81D /* libwebrtc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc.a"; sourceTree = ""; }; + 52AD84421E5DF48B00DCD81D /* librtp_rtcp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librtp_rtcp.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/librtp_rtcp.a"; sourceTree = ""; }; + 52AD84431E5DF48B00DCD81D /* libaudio_processing.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_processing.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudio_processing.a"; sourceTree = ""; }; + 52AD84441E5DF48B00DCD81D /* libvoice_engine.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvoice_engine.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libvoice_engine.a"; sourceTree = ""; }; + 52AD84451E5DF48B00DCD81D /* libneteq.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libneteq.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libneteq.a"; sourceTree = ""; }; + 52AD84461E5DF48B00DCD81D /* libwebrtc_video_coding.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_video_coding.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_video_coding.a"; sourceTree = ""; }; + 52AD84471E5DF48B00DCD81D /* libvpx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvpx.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libvpx.a"; sourceTree = ""; }; + 52AD84481E5DF48B00DCD81D /* libboringssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libboringssl.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libboringssl.a"; sourceTree = ""; }; + 52AD84491E5DF48B00DCD81D /* librtc_base_approved.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librtc_base_approved.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/librtc_base_approved.a"; sourceTree = ""; }; + 52AD844A1E5DF48B00DCD81D /* libaudio_device.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_device.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudio_device.a"; sourceTree = ""; }; + 52AD844B1E5DF48B00DCD81D /* libremote_bitrate_estimator.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libremote_bitrate_estimator.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libremote_bitrate_estimator.a"; sourceTree = ""; }; + 52AD844C1E5DF48B00DCD81D /* libcommon_audio.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcommon_audio.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libcommon_audio.a"; sourceTree = ""; }; + 52AD844D1E5DF48B00DCD81D /* libsystem_wrappers.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsystem_wrappers.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libsystem_wrappers.a"; sourceTree = ""; }; + 52AD844E1E5DF48B00DCD81D /* libusrsctplib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libusrsctplib.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libusrsctplib.a"; sourceTree = ""; }; + 52AD844F1E5DF48B00DCD81D /* libcommon_video.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcommon_video.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libcommon_video.a"; sourceTree = ""; }; + 52AD84501E5DF48B00DCD81D /* libaudio_coding_module.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_coding_module.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudio_coding_module.a"; sourceTree = ""; }; + 52AD84511E5DF48B00DCD81D /* libwebrtc_utility.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_utility.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_utility.a"; sourceTree = ""; }; + 52AD84521E5DF48B00DCD81D /* libopus.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libopus.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libopus.a"; sourceTree = ""; }; + 52AD84531E5DF48B00DCD81D /* libwebrtc_vp8.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_vp8.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_vp8.a"; sourceTree = ""; }; + 52AD84541E5DF48B00DCD81D /* libpaced_sender.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpaced_sender.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libpaced_sender.a"; sourceTree = ""; }; + 52AD84551E5DF48B00DCD81D /* librtc_event_log.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librtc_event_log.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/librtc_event_log.a"; sourceTree = ""; }; + 52AD84561E5DF48B00DCD81D /* libbitrate_controller.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbitrate_controller.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libbitrate_controller.a"; sourceTree = ""; }; + 52AD84571E5DF48B00DCD81D /* librtc_event_log_proto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librtc_event_log_proto.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/librtc_event_log_proto.a"; sourceTree = ""; }; + 52AD84581E5DF48B00DCD81D /* libisac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libisac.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libisac.a"; sourceTree = ""; }; + 52AD84591E5DF48B00DCD81D /* libisac_fix.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libisac_fix.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libisac_fix.a"; sourceTree = ""; }; + 52AD845A1E5DF48B00DCD81D /* libwebrtc_h264_video_toolbox.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_h264_video_toolbox.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_h264_video_toolbox.a"; sourceTree = ""; }; + 52AD845B1E5DF48B00DCD81D /* libwebrtc_vp9.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_vp9.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_vp9.a"; sourceTree = ""; }; + 52AD845C1E5DF48B00DCD81D /* libaudio_conference_mixer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_conference_mixer.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudio_conference_mixer.a"; sourceTree = ""; }; + 52AD845D1E5DF48B00DCD81D /* libvideo_coding_utility.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvideo_coding_utility.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libvideo_coding_utility.a"; sourceTree = ""; }; + 52AD845E1E5DF48B00DCD81D /* librent_a_codec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librent_a_codec.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/librent_a_codec.a"; sourceTree = ""; }; + 52AD845F1E5DF48B00DCD81D /* libyuv.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libyuv.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libyuv.a"; sourceTree = ""; }; + 52AD84601E5DF48B00DCD81D /* libilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libilbc.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libilbc.a"; sourceTree = ""; }; + 52AD84611E5DF48B00DCD81D /* libmetrics_default.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmetrics_default.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libmetrics_default.a"; sourceTree = ""; }; + 52AD84621E5DF48B00DCD81D /* libvideo_processing.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvideo_processing.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libvideo_processing.a"; sourceTree = ""; }; + 52AD84631E5DF48B00DCD81D /* libvideo_capture_module_internal_impl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvideo_capture_module_internal_impl.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libvideo_capture_module_internal_impl.a"; sourceTree = ""; }; + 52AD84641E5DF48B00DCD81D /* libcng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcng.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libcng.a"; sourceTree = ""; }; + 52AD84651E5DF48B00DCD81D /* libaudioproc_debug_proto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudioproc_debug_proto.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudioproc_debug_proto.a"; sourceTree = ""; }; + 52AD84661E5DF48B00DCD81D /* libwebrtc_opus.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_opus.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_opus.a"; sourceTree = ""; }; + 52AD84671E5DF48B00DCD81D /* libg711.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libg711.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libg711.a"; sourceTree = ""; }; + 52AD84681E5DF48B00DCD81D /* libg722.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libg722.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libg722.a"; sourceTree = ""; }; + 52AD84691E5DF48B00DCD81D /* libwebrtc_common.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_common.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_common.a"; sourceTree = ""; }; + 52AD846A1E5DF48B00DCD81D /* libvideo_capture_module.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvideo_capture_module.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libvideo_capture_module.a"; sourceTree = ""; }; + 52AD846B1E5DF48B00DCD81D /* libsrtp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsrtp.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libsrtp.a"; sourceTree = ""; }; + 52AD846C1E5DF48B00DCD81D /* libred.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libred.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libred.a"; sourceTree = ""; }; + 52AD846D1E5DF48B00DCD81D /* libpcm16b.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpcm16b.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libpcm16b.a"; sourceTree = ""; }; + 52AD846E1E5DF48B00DCD81D /* libaudio_encoder_interface.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_encoder_interface.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudio_encoder_interface.a"; sourceTree = ""; }; + 52AD846F1E5DF48B00DCD81D /* libaudio_decoder_interface.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libaudio_decoder_interface.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libaudio_decoder_interface.a"; sourceTree = ""; }; + 52AD84701E5DF48B00DCD81D /* libmedia_file.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmedia_file.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libmedia_file.a"; sourceTree = ""; }; + 52AD84711E5DF48B00DCD81D /* libwebrtc_h264.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_h264.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_h264.a"; sourceTree = ""; }; + 52AD84721E5DF48B00DCD81D /* libcommon_audio_neon.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcommon_audio_neon.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libcommon_audio_neon.a"; sourceTree = ""; }; + 52AD84731E5DF48B00DCD81D /* libisac_neon.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libisac_neon.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libisac_neon.a"; sourceTree = ""; }; + 52AD84741E5DF48B00DCD81D /* libfield_trial_default.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfield_trial_default.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libfield_trial_default.a"; sourceTree = ""; }; + 52AD84751E5DF48B00DCD81D /* libwebrtc_i420.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtc_i420.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libwebrtc_i420.a"; sourceTree = ""; }; + 52AD84761E5DF48B00DCD81D /* libisac_common.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libisac_common.a; path = "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos/libisac_common.a"; sourceTree = ""; }; + 52BA73921E647BAD00CAF5AE /* webrtc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = webrtc.a; path = ../../../../../../webrtc/xplatform/webrtc/out_ios/webrtc.a; sourceTree = ""; }; + 52BA73941E647BB600CAF5AE /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 52BA73961E647C1400CAF5AE /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 52BA73981E647C9C00CAF5AE /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; + 52BA739A1E647CCC00CAF5AE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 52BA739C1E64DB4200CAF5AE /* zsLib-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "zsLib-ios.xcodeproj"; path = "../../../../zsLib/projects/xcode/zsLib-ios/zsLib-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 52BA73A51E64DC0300CAF5AE /* idnkit-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "idnkit-ios.xcodeproj"; path = "../../../../idnkit/projects/xcode/idnkit-ios/idnkit-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 52BA73AB1E64DC1000CAF5AE /* udns-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "udns-ios.xcodeproj"; path = "../../../../udns/projects/xcode/udns-ios/udns-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 52BA73B11E64DC1B00CAF5AE /* cryptopp-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "cryptopp-ios.xcodeproj"; path = "../../../../cryptopp/projects/xcode/cryptopp-ios/cryptopp-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 52BA73B71E64DC2C00CAF5AE /* ortclib.services-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "ortclib.services-ios.xcodeproj"; path = "../../../../ortclib-services-cpp/projects/xcode/ortclib.services-ios/ortclib.services-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 52BA73BD1E64DD1900CAF5AE /* libcryptopp-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libcryptopp-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libcryptopp-ios.a"; sourceTree = ""; }; + 52BA73BE1E64DD1900CAF5AE /* libidnkit-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libidnkit-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libidnkit-ios.a"; sourceTree = ""; }; + 52BA73BF1E64DD1900CAF5AE /* libortclib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib-ios.a"; path = "../ortclib-ios/build/Release-iphoneos/libortclib-ios.a"; sourceTree = ""; }; + 52BA73C01E64DD1900CAF5AE /* libortclib.services-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib.services-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libortclib.services-ios.a"; sourceTree = ""; }; + 52BA73C11E64DD1900CAF5AE /* libudns-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libudns-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libudns-ios.a"; sourceTree = ""; }; + 52BA73C21E64DD1900CAF5AE /* libwebrtcWrapper_ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebrtcWrapper_ios.a; path = "../../../../../apple/projects/xcode/webrtcWrappers/webrtcWrapper_ios/build/Debug-iphoneos/libwebrtcWrapper_ios.a"; sourceTree = ""; }; + 52BA73C31E64DD1900CAF5AE /* libzsLib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-ios.a"; path = "../../../../zsLib/projects/xcode/zsLib-ios/build/Release-iphoneos/libzsLib-ios.a"; sourceTree = ""; }; + 52BA73CB1E64DECB00CAF5AE /* libortclib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libortclib-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libortclib-ios.a"; sourceTree = ""; }; + 52BA73CC1E64DECB00CAF5AE /* libzsLib-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libzsLib-ios.a"; sourceTree = ""; }; + 52BA73F51E64E28000CAF5AE /* zsLib-eventing-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "zsLib-eventing-ios.xcodeproj"; path = "../../../../zsLib-eventing/projects/xcode/zsLib-eventing-ios/zsLib-eventing-ios.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 52BA73FB1E64E28D00CAF5AE /* libzsLib-eventing-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libzsLib-eventing-ios.a"; path = "../../../../../../../../../../../Library/Developer/Xcode/DerivedData/ortc-lib-sdk-dohryvixdwyhymduswwkpidonjup/Build/Products/Debug-iphoneos/libzsLib-eventing-ios.a"; sourceTree = ""; }; + 52BA73FD1E64E2C200CAF5AE /* libresolv.9.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.9.tbd; path = usr/lib/libresolv.9.tbd; sourceTree = SDKROOT; }; + 52BA73FF1E64E2E700CAF5AE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -259,13 +295,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 009D1A681DE52F7400D139FF /* libcryptopp-ios.a in Frameworks */, - 009D1A691DE52F7400D139FF /* libidnkit-ios.a in Frameworks */, - 009D1A6A1DE52F7400D139FF /* libortclib-ios.a in Frameworks */, - 009D1A6B1DE52F7400D139FF /* libortclib.services-ios.a in Frameworks */, - 009D1A6C1DE52F7400D139FF /* libudns-ios.a in Frameworks */, - 009D1A6D1DE52F7400D139FF /* libzsLib-eventing-ios.a in Frameworks */, - 009D1A6E1DE52F7400D139FF /* libzsLib-ios.a in Frameworks */, + 52BA74001E64E2E700CAF5AE /* libz.tbd in Frameworks */, + 52BA73FE1E64E2C200CAF5AE /* libresolv.9.tbd in Frameworks */, + 52BA73FC1E64E28D00CAF5AE /* libzsLib-eventing-ios.a in Frameworks */, + 52BA73C41E64DD1900CAF5AE /* libcryptopp-ios.a in Frameworks */, + 52BA73C51E64DD1900CAF5AE /* libidnkit-ios.a in Frameworks */, + 52BA73CD1E64DECB00CAF5AE /* libortclib-ios.a in Frameworks */, + 52BA73CE1E64DECB00CAF5AE /* libzsLib-ios.a in Frameworks */, + 52BA73C71E64DD1900CAF5AE /* libortclib.services-ios.a in Frameworks */, + 52BA73C81E64DD1900CAF5AE /* libudns-ios.a in Frameworks */, + 52BA739B1E647CCC00CAF5AE /* AudioToolbox.framework in Frameworks */, + 52BA73991E647C9C00CAF5AE /* VideoToolbox.framework in Frameworks */, + 52BA73971E647C1400CAF5AE /* AVFoundation.framework in Frameworks */, + 52BA73951E647BB600CAF5AE /* CoreMedia.framework in Frameworks */, + 52BA73931E647BAD00CAF5AE /* webrtc.a in Frameworks */, + 52AD843F1E5DF2DD00DCD81D /* libcurl.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -273,13 +317,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 009D1A6F1DE52F9200D139FF /* libcryptopp-ios.a in Frameworks */, - 009D1A701DE52F9200D139FF /* libidnkit-ios.a in Frameworks */, - 009D1A711DE52F9200D139FF /* libortclib-ios.a in Frameworks */, - 009D1A721DE52F9200D139FF /* libortclib.services-ios.a in Frameworks */, - 009D1A731DE52F9200D139FF /* libudns-ios.a in Frameworks */, - 009D1A741DE52F9200D139FF /* libzsLib-eventing-ios.a in Frameworks */, - 009D1A751DE52F9200D139FF /* libzsLib-ios.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -287,13 +324,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 009D1A761DE52FA000D139FF /* libcryptopp-ios.a in Frameworks */, - 009D1A771DE52FA000D139FF /* libidnkit-ios.a in Frameworks */, - 009D1A781DE52FA000D139FF /* libortclib-ios.a in Frameworks */, - 009D1A791DE52FA000D139FF /* libortclib.services-ios.a in Frameworks */, - 009D1A7A1DE52FA000D139FF /* libudns-ios.a in Frameworks */, - 009D1A7B1DE52FA000D139FF /* libzsLib-eventing-ios.a in Frameworks */, - 009D1A7C1DE52FA000D139FF /* libzsLib-ios.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -303,18 +333,20 @@ 009D19851DE52DEA00D139FF = { isa = PBXGroup; children = ( + 52BA73F51E64E28000CAF5AE /* zsLib-eventing-ios.xcodeproj */, + 52BA73B71E64DC2C00CAF5AE /* ortclib.services-ios.xcodeproj */, + 52BA73B11E64DC1B00CAF5AE /* cryptopp-ios.xcodeproj */, + 52BA73AB1E64DC1000CAF5AE /* udns-ios.xcodeproj */, + 52BA73A51E64DC0300CAF5AE /* idnkit-ios.xcodeproj */, + 52BA739C1E64DB4200CAF5AE /* zsLib-ios.xcodeproj */, + 526A20B31E6093A800BA0F07 /* webrtcWrapper_ios.xcodeproj */, 009D19C41DE52E8200D139FF /* ortclib-ios.xcodeproj */, - 009D19C71DE52E8200D139FF /* ortclib.services-ios.xcodeproj */, - 009D19CA1DE52E8200D139FF /* idnkit-ios.xcodeproj */, - 009D19CD1DE52E8200D139FF /* udns-ios.xcodeproj */, - 009D19D01DE52E8200D139FF /* zsLib-eventing-ios.xcodeproj */, - 009D19D31DE52E8200D139FF /* cryptopp-ios.xcodeproj */, - 009D19D61DE52E8200D139FF /* zsLib-ios.xcodeproj */, 009D1A7D1DE52FBF00D139FF /* test */, 009D19901DE52DEA00D139FF /* ortclib.Test-ios */, 009D19AA1DE52DEA00D139FF /* ortclib.Test-iosTests */, 009D19B51DE52DEA00D139FF /* ortclib.Test-iosUITests */, 009D198F1DE52DEA00D139FF /* Products */, + 52AD842F1E5DE9C200DCD81D /* Frameworks */, ); sourceTree = ""; }; @@ -370,95 +402,186 @@ path = "ortclib.Test-iosUITests"; sourceTree = ""; }; - 009D19C51DE52E8200D139FF /* Products */ = { + 009D1A7D1DE52FBF00D139FF /* test */ = { isa = PBXGroup; children = ( - 009D19E11DE52E8200D139FF /* libortclib-ios.a */, + 009D1A7E1DE52FBF00D139FF /* config.h */, + 009D1A7F1DE52FBF00D139FF /* main.cpp */, + 009D1A801DE52FBF00D139FF /* TestDTLS.cpp */, + 009D1A811DE52FBF00D139FF /* TestICEGatherer.cpp */, + 009D1A821DE52FBF00D139FF /* TestICETransport.cpp */, + 009D1A831DE52FBF00D139FF /* testing.cpp */, + 009D1A841DE52FBF00D139FF /* testing.h */, + 009D1A851DE52FBF00D139FF /* TestMediaStreamTrack.cpp */, + 009D1A861DE52FBF00D139FF /* TestMediaStreamTrack.h */, + 009D1A871DE52FBF00D139FF /* TestRTCPPacket.cpp */, + 009D1A881DE52FBF00D139FF /* TestRTPChannel.cpp */, + 009D1A891DE52FBF00D139FF /* TestRTPChannel.h */, + 009D1A8A1DE52FBF00D139FF /* TestRTPChannelAudio.cpp */, + 009D1A8B1DE52FBF00D139FF /* TestRTPChannelAudio.h */, + 009D1A8C1DE52FBF00D139FF /* TestRTPChannelVideo.cpp */, + 009D1A8D1DE52FBF00D139FF /* TestRTPChannelVideo.h */, + 009D1A8E1DE52FBF00D139FF /* TestRTPListener.cpp */, + 009D1A8F1DE52FBF00D139FF /* TestRTPListener.h */, + 009D1A901DE52FBF00D139FF /* TestRTPPacket.cpp */, + 009D1A911DE52FBF00D139FF /* TestRTPReceiver.cpp */, + 009D1A921DE52FBF00D139FF /* TestRTPReceiver.h */, + 009D1A931DE52FBF00D139FF /* TestRTPSender.cpp */, + 009D1A941DE52FBF00D139FF /* TestRTPSender.h */, + 009D1A951DE52FBF00D139FF /* TestSCTP.cpp */, + 009D1A961DE52FBF00D139FF /* TestSCTP.h */, + 009D1A971DE52FBF00D139FF /* TestSetup.cpp */, + 009D1A981DE52FBF00D139FF /* TestSRTP.cpp */, + ); + name = test; + path = ../../../ortc/test; + sourceTree = ""; + }; + 5285F3311E65B1D70005D02E /* Products */ = { + isa = PBXGroup; + children = ( + 5285F3371E65B1D70005D02E /* libzsLib-ios.a */, ); name = Products; sourceTree = ""; }; - 009D19C81DE52E8200D139FF /* Products */ = { + 5285F33B1E65B1D70005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D19E41DE52E8200D139FF /* libortclib.services-ios.a */, + 5285F3411E65B1D70005D02E /* libzsLib-eventing-ios.a */, ); name = Products; sourceTree = ""; }; - 009D19CB1DE52E8200D139FF /* Products */ = { + 5285F3451E65B1D70005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D19DE1DE52E8200D139FF /* libidnkit-ios.a */, + 5285F3491E65B1D70005D02E /* libidnkit-ios.a */, ); name = Products; sourceTree = ""; }; - 009D19CE1DE52E8200D139FF /* Products */ = { + 5285F34A1E65B1D70005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D19E71DE52E8200D139FF /* libudns-ios.a */, + 5285F34E1E65B1D70005D02E /* libortclib-ios.a */, ); name = Products; sourceTree = ""; }; - 009D19D11DE52E8200D139FF /* Products */ = { + 5285F3681E65B3470005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D19EA1DE52E8200D139FF /* libzsLib-eventing-ios.a */, + 5285F36E1E65B3470005D02E /* libortclib.services-ios.a */, ); name = Products; sourceTree = ""; }; - 009D19D41DE52E8200D139FF /* Products */ = { + 5285F3711E65B3470005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D19DB1DE52E8200D139FF /* libcryptopp-ios.a */, + 5285F3751E65B3470005D02E /* libudns-ios.a */, ); name = Products; sourceTree = ""; }; - 009D19D71DE52E8200D139FF /* Products */ = { + 5285F3761E65B3470005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D19ED1DE52E8200D139FF /* libzsLib-ios.a */, + 5285F37A1E65B3470005D02E /* libcryptopp-ios.a */, ); name = Products; sourceTree = ""; }; - 009D1A7D1DE52FBF00D139FF /* test */ = { + 5285F37B1E65B3470005D02E /* Products */ = { isa = PBXGroup; children = ( - 009D1A7E1DE52FBF00D139FF /* config.h */, - 009D1A7F1DE52FBF00D139FF /* main.cpp */, - 009D1A801DE52FBF00D139FF /* TestDTLS.cpp */, - 009D1A811DE52FBF00D139FF /* TestICEGatherer.cpp */, - 009D1A821DE52FBF00D139FF /* TestICETransport.cpp */, - 009D1A831DE52FBF00D139FF /* testing.cpp */, - 009D1A841DE52FBF00D139FF /* testing.h */, - 009D1A851DE52FBF00D139FF /* TestMediaStreamTrack.cpp */, - 009D1A861DE52FBF00D139FF /* TestMediaStreamTrack.h */, - 009D1A871DE52FBF00D139FF /* TestRTCPPacket.cpp */, - 009D1A881DE52FBF00D139FF /* TestRTPChannel.cpp */, - 009D1A891DE52FBF00D139FF /* TestRTPChannel.h */, - 009D1A8A1DE52FBF00D139FF /* TestRTPChannelAudio.cpp */, - 009D1A8B1DE52FBF00D139FF /* TestRTPChannelAudio.h */, - 009D1A8C1DE52FBF00D139FF /* TestRTPChannelVideo.cpp */, - 009D1A8D1DE52FBF00D139FF /* TestRTPChannelVideo.h */, - 009D1A8E1DE52FBF00D139FF /* TestRTPListener.cpp */, - 009D1A8F1DE52FBF00D139FF /* TestRTPListener.h */, - 009D1A901DE52FBF00D139FF /* TestRTPPacket.cpp */, - 009D1A911DE52FBF00D139FF /* TestRTPReceiver.cpp */, - 009D1A921DE52FBF00D139FF /* TestRTPReceiver.h */, - 009D1A931DE52FBF00D139FF /* TestRTPSender.cpp */, - 009D1A941DE52FBF00D139FF /* TestRTPSender.h */, - 009D1A951DE52FBF00D139FF /* TestSCTP.cpp */, - 009D1A961DE52FBF00D139FF /* TestSCTP.h */, - 009D1A971DE52FBF00D139FF /* TestSetup.cpp */, - 009D1A981DE52FBF00D139FF /* TestSRTP.cpp */, + 5285F37F1E65B3470005D02E /* libwebrtcWrapper_ios.a */, ); - name = test; - path = ../../../ortc/test; + name = Products; + sourceTree = ""; + }; + 52AD842F1E5DE9C200DCD81D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 52BA73FF1E64E2E700CAF5AE /* libz.tbd */, + 52BA73FD1E64E2C200CAF5AE /* libresolv.9.tbd */, + 52BA73FB1E64E28D00CAF5AE /* libzsLib-eventing-ios.a */, + 52BA73CB1E64DECB00CAF5AE /* libortclib-ios.a */, + 52BA73CC1E64DECB00CAF5AE /* libzsLib-ios.a */, + 52BA73BD1E64DD1900CAF5AE /* libcryptopp-ios.a */, + 52BA73BE1E64DD1900CAF5AE /* libidnkit-ios.a */, + 52BA73BF1E64DD1900CAF5AE /* libortclib-ios.a */, + 52BA73C01E64DD1900CAF5AE /* libortclib.services-ios.a */, + 52BA73C11E64DD1900CAF5AE /* libudns-ios.a */, + 52BA73C21E64DD1900CAF5AE /* libwebrtcWrapper_ios.a */, + 52BA73C31E64DD1900CAF5AE /* libzsLib-ios.a */, + 52BA739A1E647CCC00CAF5AE /* AudioToolbox.framework */, + 52BA73981E647C9C00CAF5AE /* VideoToolbox.framework */, + 52BA73961E647C1400CAF5AE /* AVFoundation.framework */, + 52BA73941E647BB600CAF5AE /* CoreMedia.framework */, + 52BA73921E647BAD00CAF5AE /* webrtc.a */, + 52656CBE1E5F040E009DAE87 /* libaudio_processing_neon.a */, + 52656CBC1E5F02A1009DAE87 /* libaudio_decoder_factory_interface.a */, + 52AD84421E5DF48B00DCD81D /* librtp_rtcp.a */, + 52AD84431E5DF48B00DCD81D /* libaudio_processing.a */, + 52AD84441E5DF48B00DCD81D /* libvoice_engine.a */, + 52AD84451E5DF48B00DCD81D /* libneteq.a */, + 52AD84461E5DF48B00DCD81D /* libwebrtc_video_coding.a */, + 52AD84471E5DF48B00DCD81D /* libvpx.a */, + 52AD84481E5DF48B00DCD81D /* libboringssl.a */, + 52AD84491E5DF48B00DCD81D /* librtc_base_approved.a */, + 52AD844A1E5DF48B00DCD81D /* libaudio_device.a */, + 52AD844B1E5DF48B00DCD81D /* libremote_bitrate_estimator.a */, + 52AD844C1E5DF48B00DCD81D /* libcommon_audio.a */, + 52AD844D1E5DF48B00DCD81D /* libsystem_wrappers.a */, + 52AD844E1E5DF48B00DCD81D /* libusrsctplib.a */, + 52AD844F1E5DF48B00DCD81D /* libcommon_video.a */, + 52AD84501E5DF48B00DCD81D /* libaudio_coding_module.a */, + 52AD84511E5DF48B00DCD81D /* libwebrtc_utility.a */, + 52AD84521E5DF48B00DCD81D /* libopus.a */, + 52AD84531E5DF48B00DCD81D /* libwebrtc_vp8.a */, + 52AD84541E5DF48B00DCD81D /* libpaced_sender.a */, + 52AD84551E5DF48B00DCD81D /* librtc_event_log.a */, + 52AD84561E5DF48B00DCD81D /* libbitrate_controller.a */, + 52AD84571E5DF48B00DCD81D /* librtc_event_log_proto.a */, + 52AD84581E5DF48B00DCD81D /* libisac.a */, + 52AD84591E5DF48B00DCD81D /* libisac_fix.a */, + 52AD845A1E5DF48B00DCD81D /* libwebrtc_h264_video_toolbox.a */, + 52AD845B1E5DF48B00DCD81D /* libwebrtc_vp9.a */, + 52AD845C1E5DF48B00DCD81D /* libaudio_conference_mixer.a */, + 52AD845D1E5DF48B00DCD81D /* libvideo_coding_utility.a */, + 52AD845E1E5DF48B00DCD81D /* librent_a_codec.a */, + 52AD845F1E5DF48B00DCD81D /* libyuv.a */, + 52AD84601E5DF48B00DCD81D /* libilbc.a */, + 52AD84611E5DF48B00DCD81D /* libmetrics_default.a */, + 52AD84621E5DF48B00DCD81D /* libvideo_processing.a */, + 52AD84631E5DF48B00DCD81D /* libvideo_capture_module_internal_impl.a */, + 52AD84641E5DF48B00DCD81D /* libcng.a */, + 52AD84651E5DF48B00DCD81D /* libaudioproc_debug_proto.a */, + 52AD84661E5DF48B00DCD81D /* libwebrtc_opus.a */, + 52AD84671E5DF48B00DCD81D /* libg711.a */, + 52AD84681E5DF48B00DCD81D /* libg722.a */, + 52AD84691E5DF48B00DCD81D /* libwebrtc_common.a */, + 52AD846A1E5DF48B00DCD81D /* libvideo_capture_module.a */, + 52AD846B1E5DF48B00DCD81D /* libsrtp.a */, + 52AD846C1E5DF48B00DCD81D /* libred.a */, + 52AD846D1E5DF48B00DCD81D /* libpcm16b.a */, + 52AD846E1E5DF48B00DCD81D /* libaudio_encoder_interface.a */, + 52AD846F1E5DF48B00DCD81D /* libaudio_decoder_interface.a */, + 52AD84701E5DF48B00DCD81D /* libmedia_file.a */, + 52AD84711E5DF48B00DCD81D /* libwebrtc_h264.a */, + 52AD84721E5DF48B00DCD81D /* libcommon_audio_neon.a */, + 52AD84731E5DF48B00DCD81D /* libisac_neon.a */, + 52AD84741E5DF48B00DCD81D /* libfield_trial_default.a */, + 52AD84751E5DF48B00DCD81D /* libwebrtc_i420.a */, + 52AD84761E5DF48B00DCD81D /* libisac_common.a */, + 52AD84401E5DF35B00DCD81D /* libwebrtc.a */, + 52AD843E1E5DF2DD00DCD81D /* libcurl.a */, + 52AD84321E5DE9D500DCD81D /* libwebrtcWrapper_ios.a */, + 52AD84301E5DE9C200DCD81D /* libzsLib-eventing-ios.a */, + ); + name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ @@ -475,13 +598,7 @@ buildRules = ( ); dependencies = ( - 009D1A5B1DE52F5900D139FF /* PBXTargetDependency */, - 009D1A5D1DE52F5900D139FF /* PBXTargetDependency */, - 009D1A5F1DE52F5900D139FF /* PBXTargetDependency */, - 009D1A611DE52F5900D139FF /* PBXTargetDependency */, - 009D1A631DE52F5900D139FF /* PBXTargetDependency */, - 009D1A651DE52F5900D139FF /* PBXTargetDependency */, - 009D1A671DE52F5900D139FF /* PBXTargetDependency */, + 5285F3811E65CAE40005D02E /* PBXTargetDependency */, ); name = "ortclib.Test-ios"; productName = "ortclib.Test-ios"; @@ -535,6 +652,7 @@ TargetAttributes = { 009D198D1DE52DEA00D139FF = { CreatedOnToolsVersion = 8.1; + DevelopmentTeam = QE9E5R8GUP; ProvisioningStyle = Automatic; }; 009D19A61DE52DEA00D139FF = { @@ -562,32 +680,36 @@ projectDirPath = ""; projectReferences = ( { - ProductGroup = 009D19D41DE52E8200D139FF /* Products */; - ProjectRef = 009D19D31DE52E8200D139FF /* cryptopp-ios.xcodeproj */; + ProductGroup = 5285F3761E65B3470005D02E /* Products */; + ProjectRef = 52BA73B11E64DC1B00CAF5AE /* cryptopp-ios.xcodeproj */; }, { - ProductGroup = 009D19CB1DE52E8200D139FF /* Products */; - ProjectRef = 009D19CA1DE52E8200D139FF /* idnkit-ios.xcodeproj */; + ProductGroup = 5285F3451E65B1D70005D02E /* Products */; + ProjectRef = 52BA73A51E64DC0300CAF5AE /* idnkit-ios.xcodeproj */; }, { - ProductGroup = 009D19C51DE52E8200D139FF /* Products */; + ProductGroup = 5285F34A1E65B1D70005D02E /* Products */; ProjectRef = 009D19C41DE52E8200D139FF /* ortclib-ios.xcodeproj */; }, { - ProductGroup = 009D19C81DE52E8200D139FF /* Products */; - ProjectRef = 009D19C71DE52E8200D139FF /* ortclib.services-ios.xcodeproj */; + ProductGroup = 5285F3681E65B3470005D02E /* Products */; + ProjectRef = 52BA73B71E64DC2C00CAF5AE /* ortclib.services-ios.xcodeproj */; }, { - ProductGroup = 009D19CE1DE52E8200D139FF /* Products */; - ProjectRef = 009D19CD1DE52E8200D139FF /* udns-ios.xcodeproj */; + ProductGroup = 5285F3711E65B3470005D02E /* Products */; + ProjectRef = 52BA73AB1E64DC1000CAF5AE /* udns-ios.xcodeproj */; }, { - ProductGroup = 009D19D11DE52E8200D139FF /* Products */; - ProjectRef = 009D19D01DE52E8200D139FF /* zsLib-eventing-ios.xcodeproj */; + ProductGroup = 5285F37B1E65B3470005D02E /* Products */; + ProjectRef = 526A20B31E6093A800BA0F07 /* webrtcWrapper_ios.xcodeproj */; }, { - ProductGroup = 009D19D71DE52E8200D139FF /* Products */; - ProjectRef = 009D19D61DE52E8200D139FF /* zsLib-ios.xcodeproj */; + ProductGroup = 5285F33B1E65B1D70005D02E /* Products */; + ProjectRef = 52BA73F51E64E28000CAF5AE /* zsLib-eventing-ios.xcodeproj */; + }, + { + ProductGroup = 5285F3311E65B1D70005D02E /* Products */; + ProjectRef = 52BA739C1E64DB4200CAF5AE /* zsLib-ios.xcodeproj */; }, ); projectRoot = ""; @@ -600,53 +722,60 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 009D19DB1DE52E8200D139FF /* libcryptopp-ios.a */ = { + 5285F3371E65B1D70005D02E /* libzsLib-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libcryptopp-ios.a"; - remoteRef = 009D19DA1DE52E8200D139FF /* PBXContainerItemProxy */; + path = "libzsLib-ios.a"; + remoteRef = 5285F3361E65B1D70005D02E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5285F3411E65B1D70005D02E /* libzsLib-eventing-ios.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libzsLib-eventing-ios.a"; + remoteRef = 5285F3401E65B1D70005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 009D19DE1DE52E8200D139FF /* libidnkit-ios.a */ = { + 5285F3491E65B1D70005D02E /* libidnkit-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libidnkit-ios.a"; - remoteRef = 009D19DD1DE52E8200D139FF /* PBXContainerItemProxy */; + remoteRef = 5285F3481E65B1D70005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 009D19E11DE52E8200D139FF /* libortclib-ios.a */ = { + 5285F34E1E65B1D70005D02E /* libortclib-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libortclib-ios.a"; - remoteRef = 009D19E01DE52E8200D139FF /* PBXContainerItemProxy */; + remoteRef = 5285F34D1E65B1D70005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 009D19E41DE52E8200D139FF /* libortclib.services-ios.a */ = { + 5285F36E1E65B3470005D02E /* libortclib.services-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libortclib.services-ios.a"; - remoteRef = 009D19E31DE52E8200D139FF /* PBXContainerItemProxy */; + remoteRef = 5285F36D1E65B3470005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 009D19E71DE52E8200D139FF /* libudns-ios.a */ = { + 5285F3751E65B3470005D02E /* libudns-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libudns-ios.a"; - remoteRef = 009D19E61DE52E8200D139FF /* PBXContainerItemProxy */; + remoteRef = 5285F3741E65B3470005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 009D19EA1DE52E8200D139FF /* libzsLib-eventing-ios.a */ = { + 5285F37A1E65B3470005D02E /* libcryptopp-ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libzsLib-eventing-ios.a"; - remoteRef = 009D19E91DE52E8200D139FF /* PBXContainerItemProxy */; + path = "libcryptopp-ios.a"; + remoteRef = 5285F3791E65B3470005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 009D19ED1DE52E8200D139FF /* libzsLib-ios.a */ = { + 5285F37F1E65B3470005D02E /* libwebrtcWrapper_ios.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libzsLib-ios.a"; - remoteRef = 009D19EC1DE52E8200D139FF /* PBXContainerItemProxy */; + path = libwebrtcWrapper_ios.a; + remoteRef = 5285F37E1E65B3470005D02E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -766,40 +895,10 @@ target = 009D198D1DE52DEA00D139FF /* ortclib.Test-ios */; targetProxy = 009D19B31DE52DEA00D139FF /* PBXContainerItemProxy */; }; - 009D1A5B1DE52F5900D139FF /* PBXTargetDependency */ = { + 5285F3811E65CAE40005D02E /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = "ortclib-ios"; - targetProxy = 009D1A5A1DE52F5900D139FF /* PBXContainerItemProxy */; - }; - 009D1A5D1DE52F5900D139FF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "ortclib.services-ios"; - targetProxy = 009D1A5C1DE52F5900D139FF /* PBXContainerItemProxy */; - }; - 009D1A5F1DE52F5900D139FF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "idnkit-ios"; - targetProxy = 009D1A5E1DE52F5900D139FF /* PBXContainerItemProxy */; - }; - 009D1A611DE52F5900D139FF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "udns-ios"; - targetProxy = 009D1A601DE52F5900D139FF /* PBXContainerItemProxy */; - }; - 009D1A631DE52F5900D139FF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "zsLib-eventing-ios"; - targetProxy = 009D1A621DE52F5900D139FF /* PBXContainerItemProxy */; - }; - 009D1A651DE52F5900D139FF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "cryptopp-ios"; - targetProxy = 009D1A641DE52F5900D139FF /* PBXContainerItemProxy */; - }; - 009D1A671DE52F5900D139FF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "zsLib-ios"; - targetProxy = 009D1A661DE52F5900D139FF /* PBXContainerItemProxy */; + name = webrtcWrapper_ios; + targetProxy = 5285F3801E65CAE40005D02E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -921,12 +1020,38 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = QE9E5R8GUP; + ENABLE_BITCODE = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "$(inherited)", + ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + "../../../../zsLib-eventing", + ); INFOPLIST_FILE = "ortclib.Test-ios/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "../../../../curl/curl/ios-dev/lib", + "../../../../../../webrtc/xplatform/webrtc/out_ios/Debug-iphoneos", + ); PRODUCT_BUNDLE_IDENTIFIER = "org.ortc.ortclib-Test-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; + VALID_ARCHS = "arm64 armv7s"; }; name = Debug; }; @@ -934,12 +1059,38 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = QE9E5R8GUP; + ENABLE_BITCODE = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "$(inherited)", + ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + "../../../../zsLib-eventing", + ); INFOPLIST_FILE = "ortclib.Test-ios/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "../../../../curl/curl/ios-appstore/lib", + "../../../../../../webrtc/xplatform/webrtc/out_ios/Release-iphoneos", + ); PRODUCT_BUNDLE_IDENTIFIER = "org.ortc.ortclib-Test-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; + VALID_ARCHS = "arm64 armv7s"; }; name = Release; }; @@ -948,6 +1099,25 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "DEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); INFOPLIST_FILE = "ortclib.Test-iosTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.ortc.ortclib-Test-iosTests"; @@ -961,6 +1131,25 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "NDEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); INFOPLIST_FILE = "ortclib.Test-iosTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.ortc.ortclib-Test-iosTests"; @@ -973,6 +1162,25 @@ isa = XCBuildConfiguration; buildSettings = { GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "DEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); INFOPLIST_FILE = "ortclib.Test-iosUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.ortc.ortclib-Test-iosUITests"; @@ -985,6 +1193,25 @@ isa = XCBuildConfiguration; buildSettings = { GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE, + WEBRTC_BUILD_LIBEVENT, + WEBRTC_POSIX, + "NDEBUG=1", + "$(inherited)", + ); + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../.., + "../../../../ortclib-services-cpp", + ../../../../zsLib, + ../../../../../../webrtc/xplatform/boringssl/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/include, + ../../../../../../webrtc/xplatform/libsrtp/srtp/crypto/include, + ../../../../../../webrtc/xplatform/libsrtp/config, + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/usrsctp/usrsctplib, + ); INFOPLIST_FILE = "ortclib.Test-iosUITests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.ortc.ortclib-Test-iosUITests"; diff --git a/projects/xcode/ortclib.Test-osx/ortclib.Test-osx.xcodeproj/project.pbxproj b/projects/xcode/ortclib.Test-osx/ortclib.Test-osx.xcodeproj/project.pbxproj index 6625858a..9c013e3c 100644 --- a/projects/xcode/ortclib.Test-osx/ortclib.Test-osx.xcodeproj/project.pbxproj +++ b/projects/xcode/ortclib.Test-osx/ortclib.Test-osx.xcodeproj/project.pbxproj @@ -563,6 +563,15 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../../zsLib, + "../../../../ortclib-services-cpp", + "../../../../zsLib-eventing", + ../../../.., + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/boringssl/include, + ); MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -604,6 +613,15 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + ../../.., + ../../../../zsLib, + "../../../../ortclib-services-cpp", + "../../../../zsLib-eventing", + ../../../.., + ../../../../../../webrtc/xplatform/webrtc, + ../../../../../../webrtc/xplatform/boringssl/include, + ); MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; diff --git a/webrtc/idl/AudioOptions.idl b/webrtc/idl/AudioOptions.idl new file mode 100644 index 00000000..59b652ef --- /dev/null +++ b/webrtc/idl/AudioOptions.idl @@ -0,0 +1,162 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + + [dictionary] + struct AudioOptions + { + /// + /// Audio processing that attempts to filter away the output signal from + /// later inbound pickup. + /// + [optional] + bool echoCancellation; + + /// + /// Forces software echo cancellation on iOS. This is a temporary workaround + /// (until Apple fixes the bug) for a device with non-functioning AEC. May + /// improve performance on that particular device, but will cause unpredictable + /// behavior in all other cases. See http://bugs.webrtc.org/8682. + /// + [optional, obsolete("This method will be deprecated")] + bool iosForceSoftwareAec_HACK; + + /// + /// Audio processing to adjust the sensitivity of the local mic dynamically. + /// + [optional] + bool autoGainControl; + + /// + /// Audio processing to filter out background noise. + /// + [optional] + bool noiseSuppression; + + /// + /// Audio processing to remove background noise of lower frequencies. + /// + [optional] + bool highpassFilter; + + /// + /// Audio processing to swap the left and right channels. + /// + [optional] + bool stereoSwapping; + + /// + /// Audio receiver jitter buffer (NetEq) max capacity in number of packets. + /// + [optional] + int audioJitterBufferMaxPackets; + + /// + /// Audio receiver jitter buffer (NetEq) fast accelerate mode. + /// + [optional] + bool audioJitterBufferFastAccelerate; + + /// + /// Audio processing to detect typing. + /// + [optional] + bool typingDetection; + + [optional] + bool aecmGenerateComfortNoise; + + [optional] + bool experimentalAgc; + + [optional] + bool extendedFilterAec; + + [optional] + bool delayAgnosticAec; + + [optional] + bool experimentalNs; + + [optional] + bool intelligibilityEnhancer; + + [optional] + bool levelControl; + + [optional] + /// + /// Specifies an optional initialization value for the level controller. + /// + float levelControlInitialPeakLevelDbfs; + + /// + /// Note that tx_agc_* only applies to non-experimental AGC. + /// + [optional] + bool residualEchoDetector; + + [optional] + uint16 txAgcTargetDbov; + + [optional] + uint16 txAgcDigitalCompressionGain; + + [optional] + bool txAgcLimiter; + + /// + /// Enable combined audio+bandwidth BWE. + /// TODO(pthatcher): This flag is set from the + /// "googCombinedAudioVideoBwe", but not used anywhere. So delete it, + /// and check if any other AudioOptions members are unused. + /// + [optional] + bool combinedAudioVideoBwe; + + /// + /// Enable audio network adaptor. + /// + [optional] + bool audioNetworkAdaptor; + + /// + /// Config string for audio network adaptor. + /// + string audioNetworkAdaptorConfig; + }; + } +} diff --git a/webrtc/idl/AudioTrackSource.idl b/webrtc/idl/AudioTrackSource.idl new file mode 100644 index 00000000..cba67c1a --- /dev/null +++ b/webrtc/idl/AudioTrackSource.idl @@ -0,0 +1,86 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + /// + /// Base class for sources. A MediaStreamTrack has an underlying source that + /// provides media. A source can be shared by multiple tracks. + /// + [disposable] + interface MediaTrackSource + { + [constructor,delete] + void MediaTrackSource(); + + [getter] + MediaSourceState state; + + [getter] + bool remote; + }; + + /// + /// AudioSourceInterface is a source used for AudioTracks. + /// The same source can be used by multiple AudioTracks. + /// + [disposable] + interface AudioTrackSource : MediaTrackSource + { + [constructor,delete] + void AudioTrackSource(); + + /// + /// Creates an AudioTrackSource for use with an MediaStreamTrack. + /// + [static, default] + AudioTrackSource create(AudioOptions options); + + /// + /// Creates an AudioTrackSource for use with an MediaStreamTrack. + /// + [static, altname(CreateWithConstraints)] + AudioTrackSource create(MediaConstraints constraints); + + /// + /// Sets the volume of the source. |volume| is in the range of [0, 10]. + /// + [getter,setter] + double volume; + + [event] + void onSetVolume(double volume); + }; + } +} diff --git a/webrtc/idl/Certificate.idl b/webrtc/idl/Certificate.idl new file mode 100644 index 00000000..d9973d4f --- /dev/null +++ b/webrtc/idl/Certificate.idl @@ -0,0 +1,170 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + [dictionary] + struct RTCRSAParams + { + [optional] + unsigned int modSize; + [optional] + unsigned int publicExponent; + }; + + interface RTCKeyParams + { + /// + /// Constructs a KeyParams object using a default type and default params. + /// + [constructor, default] + void RTCKeyParams(); + /// + /// Constructs a KeyParams object from a simple KeyType, using default params. + /// + [constructor,default,altname(RTCKeyParamsWithKeyType)] + void RTCKeyParams(RTCKeyType key_type); + + /// + /// Generate a a KeyParams for RSA with default parameters. + /// + [static] + RTCKeyParams createRsa(); + + /// + /// Generate a a KeyParams for RSA with parameters. + /// + [static] + RTCKeyParams createRsaWithParams(RTCRSAParams params); + + /// + /// Generate a a KeyParams for ECDSA using the default curve. + /// + [static] + RTCKeyParams createEcdsa(); + + /// + /// Generate a a KeyParams for ECDSA specifying the curve. + /// + [static] + RTCKeyParams createEcdsaWithCurve(RTCECCurve curve); + + /// + /// Check validity of a KeyParams object. Since the factory functions have + /// no way of returning errors, this function can be called after creation + /// to make sure the parameters are OK. + /// + [getter] + bool valid; + + /// + /// Gets the RSA parameters. + /// + [getter] + RTCRSAParams rsa; + + /// + /// Gets the elipitcal curve used. + /// + [getter] + RTCECCurve ec; + + /// + /// Gets the key type. + /// + [getter] + RTCKeyType type; + }; + + /// + /// The RTCDtlsFingerprint object includes the hash function algorithm and + /// certificate fingerprint as described in [RFC4572]. + /// + [dictionary] + struct RTCDtlsFingerprint + { + /// + /// Gets or sets one of the the hash function algorithms defined in the + /// 'Hash function Textual Names' registry, initially specified in + /// [RFC4572] Section 8. As noted in [draft-ietf-rtcweb-jsep] Section + /// 5.2.1, the digest algorithm used for the fingerprint matches that + /// used in the certificate signature. + /// + string algorithm; + /// + /// The value of the certificate fingerprint in lowercase hex string as + /// expressed utilizing the syntax of 'fingerprint' in [RFC4572] Section + /// 5. + /// + string value; + + /// + /// Construct a new empty fingerprint instance. + /// + [constructor] + void RTCDtlsFingerprint(); + + /// + /// Construct a new fingerprint instance by cloning existing fingerprint. + /// + [constructor, altname(RTCDtlsFingerprintClone)] + void RTCDtlsFingerprint(RTCDtlsFingerprint source); + }; + + /// + /// The RTCCertificate interface enables the certificates used by an + /// RTCDtlsTransport in its constructor. + /// + interface RTCCertificate + { + [constructor, delete] + void RTCCertificate(); + + /// + /// Gets the expiry after which the certificate will be considered + /// invalid by the browser. After this time, attempts to construct an + /// RTCDtlsTransport object using this certificate will fail. + /// + [getter] + Time expires; + + /// + ///Returns the list of certificate fingerprints, one of + /// which is computed with the digest algorithm used in the + /// certificate signature. + /// + [getter] + RTCDtlsFingerprints fingerprints; + }; + } +} diff --git a/webrtc/idl/Configuration.idl b/webrtc/idl/Configuration.idl new file mode 100644 index 00000000..2902f6b1 --- /dev/null +++ b/webrtc/idl/Configuration.idl @@ -0,0 +1,317 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// The RTCConfiguration defines a set of parameters to configure how the + /// peer-to-peer communication established via RTCPeerConnection is established + /// or re-established. + /// + [dictionary] + struct RTCConfiguration + { + [getter, setter] + bool dscp; + + [getter, setter] + bool cpuAdaptation; + + [getter, setter] + bool suspendBelowMinBitrate; + + [getter, setter] + bool prerendererSmoothing; + + [getter, setter] + bool experimentCpuLoadEstimator; + + /// + /// Gets or sets an array of objects describing servers + /// available to be used by ICE, such as STUN and TURN servers. + /// + RTCIceServers iceServers; + + /// + /// Gets or sets which candidates the ICE Agent is allowed to use. + /// + RTCIceTransportPolicy iceTransportPolicy = all; + + /// + /// Gets or sets which media-bundling policy to use when gathering ICE candidates. + /// + RTCBundlePolicy bundlePolicy = balanced; + + /// + /// Gets or sets which which rtcp-mux policy to use when gathering ICE candidates. + /// + RTCRtcpMuxPolicy rtcpMuxPolicy = require; + + /// + /// Gets or sets a set of certificates that the RTCPeerConnection uses to authenticate. + /// + RTCCertificates certificates; + + /// + /// Gets or sets the target peer identity for the RTCPeerConnection. + /// + string peerIdentity; + + /// + /// Gets or sets the size of the prefetched ICE pool as defined in + /// [JSEP] (section 3.5.4. and section 4.1.1.). + /// + uint8 iceCandidatePoolSize; + + /// + /// Gets or sets if should not gather IPv6 candidates. + /// If set to true, don't gather IPv6 ICE candidates. + /// + bool disableIpv6 = false; + + /// + /// Gets or sets if IPv6 should be gathered on WiFi. + /// If set to true, don't gather IPv6 ICE candidates on Wi-Fi. + /// Only intended to be used on specific devices. Certain phones disable IPv6 + /// when the screen is turned off and it would be better to just disable the + /// IPv6 ICE candidates on Wi-Fi in those cases. + /// + bool disableIpv6OnWifi = false; + + /// + /// Gets or sets a limited number of IPv6 network interfaces the + /// PeerConnection will use, in order to avoid too many ICE candidate + /// pairs being created and delaying ICE completion. + /// + [optional] + int maxIpv6Networks = 5; + + /// + /// Gets or sets a flag to exclude link-local network interfaces + /// from considertaion for gathering ICE candidates. + /// + bool disableLinkLocalNetworks = false; + + /// + /// Gets or sets a flag to use RTP data channels instead of SCTP. + /// + bool enableRtpDataChannel = false; + + /// + /// Gets or sets the minimum bitrate at which screencast video + /// tracks will be encoded at. This means adding padding bits up + /// to this bitrate, which can help when switching from a static + /// scene to one with motion. + /// + [optional] + int screencastMinBitrate; + + /// + /// Gets or sets a flag to use new combined audio/video + /// bandwidth estimation. + /// + [optional] + bool combinedAudioVideoBwe; + + /// + /// Gets or sets a flag to disable DTLS-SRTP. This should never be + /// done, but can be useful for testing purposes, for example in + /// setting up a loopback call with a single PeerConnection. + /// + [optional] + bool enableDtlsSrtp; + + /// + /// Gets or sets a policy to enable or disable TCP candidate generation. + /// + RTCTcpCandidatePolicy tcpCandidatePolicy = enabled; + + /// + /// Gets or sets a policy which can be used to avoid gathering candidates + /// for a "higher cost" network, if a lower cost one exists. For example, + /// if both Wi-Fi and cellular interfaces are available, this could be + /// used to avoid using the cellular interface. + /// + RTCCandidateNetworkPolicy candidateNetworkPolicy = all; + + /// + /// Gets or sets the maximum number of packets that can be stored + /// in the NetEq audio jitter buffer. Can be reduced to lower + /// tolerated audio latency. + /// + int audioJitterBufferMaxPackets = 50; + + /// + /// Gets or sets whether to use the NetEq "fast mode" which will + /// accelerate audio quicker if it falls behind. + /// + bool audioJitterBufferFastAccelerate = false; + + /// + /// Gets or sets the timeout in milliseconds before an ICE candidate + /// pair is considered to be "not receiving", after which a lower + /// priority candidate pair may be selected. + /// + Milliseconds iceConnectionReceivingTimeout; + + /// + /// Gets or sets the interval in milliseconds at which an ICE + /// "backup" candidate pair will be pinged. This is a candidate pair + /// which is not actively in use, but may be switched to if the active + /// candidate pair becomes unusable. + /// + /// This is relevant mainly to Wi-Fi/cell handoff; the application may not + /// want this backup cellular candidate pair pinged frequently, since it + /// consumes data/battery. + /// + Milliseconds iceBackupCandidatePairPingInterval; + + /// + /// Gets or sets a flag that can be used to enable continual gathering, + /// which means new candidates will be gathered as network interfaces + /// change. Note that if continual gathering is used, the candidate + /// removal API should also be used, to avoid an ever-growing list of + /// candidates. + /// + RTCContinualGatheringPolicy continualGatheringPolicy = once; + + /// + /// Gets or sets a flag that if set to true, candidate pairs will + /// be pinged in order of most likely to work (which means using a + /// TURN server, generally), rather than in standard priority order. + /// + bool prioritizeMostLikelyIceCandidatePairs = false; + + /// + /// Gets or sets a flag that if set to true, this means the ICE transport + /// should presume TURN-to-TURN candidate pairs will succeed, even before + /// a binding response is received. This can be used to optimize the initial + /// connection time, since the DTLS handshake can begin immediately. + /// + bool pruneTurnPorts = false; + + /// + /// Gets or sets a flag that if true, "renomination" will be added + /// to the ice options in the transport description. + /// See: https://tools.ietf.org/html/draft-thatcher-ice-renomination-00 + /// + bool enableIceRenomination = false; + + /// + /// Gets or sets a flag that if true, the ICE role is re-determined + /// when the PeerConnection sets a local transport description that + /// indicates an ICE restart. + /// + /// This is standard RFC5245 ICE behavior, but causes unnecessary role + /// thrashing, so an application may wish to avoid it. This role + /// re-determining was removed in ICEbis (ICE v2). + /// + bool redetermineRoleOnIceRestart = true; + + /// + /// Gets or sets the min interval (max rate) at which we will send ICE checks + /// (STUN pings), in milliseconds. + /// + Milliseconds iceCheckMinInterval; + + /// + /// Gets or sets the interval in milliseconds at which STUN candidates will + /// resend STUN binding requests to keep NAT bindings open. + /// + Milliseconds stunCandidateKeepaliveInterval; + + /// + /// Gets or sets if WebRTC will periodically create and propose candidates without + /// starting a new ICE generation. The regathering happens continuously with + /// interval specified in milliseconds by the uniform distribution [a, b]. + /// + [optional] + MillisecondIntervalRange iceRegatherIntervalRange; + + /// + /// Gets or sets the preferred network interface. A candidate pair on a + /// preferred network has a higher precedence in ICE than one on an + /// un-preferred network, regardless of priority or network cost. + /// + [optional] + RTCNetworkType networkPreference; + + /// + /// Gets or sets the SDP semantics used by this PeerConnection. + /// Note that the WebRTC 1.0 specification requires kUnifiedPlan semantics. + /// The RtpTransceiver API is only available with kUnifiedPlan semantics. + /// + /// kPlanB will cause PeerConnection to create offers and answers with at + /// most one audio and one video m= section with multiple RtpSenders and + /// RtpReceivers specified as multiple a=ssrc lines within the section. This + /// will also cause PeerConnection to ignore all but the first m= section of + /// the same media type. + /// + /// kUnifiedPlan will cause PeerConnection to create offers and answers with + /// multiple m= sections where each m= section maps to one RtpSender and one + /// RtpReceiver (an RtpTransceiver), either both audio or both video. This + /// will also cause PeerConnection to ignore all but the first a=ssrc lines + /// that form a Plan B stream. + /// + /// For users who only send at most one audio and one video track, this + /// choice does not matter and should be left as kDefault. + /// + /// For users who wish to send multiple audio/video streams and need to stay + /// interoperable with legacy WebRTC implementations, specify kPlanB. + /// + /// For users who wish to send multiple audio/video streams and/or wish to + /// use the new RtpTransceiver API, specify kUnifiedPlan. + /// + RTCSdpSemantics sdpSemantics = default; + + /// + /// Constructs an empty instance of an RTCConfiguration object. + /// + [constructor, default] + void RTCConfiguration(); + + [constructor, altname(RTCConfigurationCreateWithType)] + void RTCConfiguration(RTCConfigurationType type); + + /// + /// Constructs an instance of an RTCConfiguration object by cloning the data from an existing object. + /// + [constructor, default, altname(RTCConfigurationClone)] + void RTCConfiguration(RTCConfiguration source); + + }; + + } +} diff --git a/webrtc/idl/DTMFSender.idl b/webrtc/idl/DTMFSender.idl new file mode 100644 index 00000000..db1cfd91 --- /dev/null +++ b/webrtc/idl/DTMFSender.idl @@ -0,0 +1,140 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + /// + /// The RTCDTMFToneChangeEvent dictionary provides information on the DTMF tone causing a tonechange event. + /// + struct RTCDtmfToneChangeEvent + { + [constructor, delete] + void RTCDtmfToneChangeEvent(); + + /// + /// Gets the character for the tone that has just begun playout (see insertDtmf()). If the + /// value is the empty string, it indicates that the toneBuffer is an empty string and that + /// the previous tones have completed playback. + /// + [getter] + string tone; + }; + + /// + /// An RTCDtmfSender instance allows sending DTMF tones to/from the remote + /// peer, as per [RFC4733]. + /// + [disposable] + interface RTCDtmfSender + { + [constructor, delete] + void RTCDtmfSender(); + + /// + /// Gets whether the RTCDtmfSender is capable of sending DTMF. + /// + bool canInsertDtmf(); + + /// + /// The InsertDTMF() method is used to send DTMF tones. Since DTMF tones + /// cannot be sent without configuring the DTMF codec, if InsertDTMF() + /// is called prior to sender.Send(parameters), or if + /// sender.Send(parameters) was called but parameters did not include + /// the DTMF codec, throw an InvalidStateError exception. + /// + [default] + void insertDtmf(string tones) throws(RTCError); + + /// + /// The InsertDTMF() method is used to send DTMF tones. Since DTMF tones + /// cannot be sent without configuring the DTMF codec, if InsertDTMF() + /// is called prior to sender.Send(parameters), or if + /// sender.Send(parameters) was called but parameters did not include + /// the DTMF codec, throw an InvalidStateError exception. + /// + [altname(insertDtmfWithDuration)] + void insertDtmf( + string tones, + Milliseconds duration + ) throws (RTCError); + + /// + /// The InsertDTMF() method is used to send DTMF tones. Since DTMF tones + /// cannot be sent without configuring the DTMF codec, if InsertDTMF() + /// is called prior to sender.Send(parameters), or if + /// sender.Send(parameters) was called but parameters did not include + /// the DTMF codec, throw an InvalidStateError exception. + /// + [altname(insertDtmfWithDurationAndGap)] + void insertDtmf( + string tones, + Milliseconds duration, + Milliseconds interToneGap + ) throws (RTCError); + + /// + /// Gets the toneBuffer attribute returns a list of the tones remaining + /// to be played out. + /// + [getter] + string toneBuffer; + + /// + /// Get the duration attribute returns the current tone duration value + /// in milliseconds. This value will be the value last set via the + /// InsertDTMF() method, or the default value of 100 ms if + /// InsertDTMF() was called without specifying the duration. + /// + [getter] + Milliseconds duration; + + /// + /// Gets the interToneGap attribute returns the current value of the + /// between-tone gap. This value will be the value last set via the + /// InsertDTMF() method, or the default value of 70 ms if InsertDTMF() + /// was called without specifying the interToneGap. + /// + [getter] + Milliseconds interToneGap; + + /// + /// The OnToneChange event handler uses the RTCDTMFToneChangeEvent + /// interface to return the character for each tone as it is played out. + /// + [event] + void onToneChange(RTCDtmfToneChangeEvent event); + }; + + } +} diff --git a/webrtc/idl/DataChannel.idl b/webrtc/idl/DataChannel.idl new file mode 100644 index 00000000..741af078 --- /dev/null +++ b/webrtc/idl/DataChannel.idl @@ -0,0 +1,306 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + /// + /// An RTCDataChannel can be configured to operate in different + /// reliability modes. A reliable channel ensures that the data is + /// delivered at the other peer through retransmissions. An unreliable + /// channel is configured to either limit the number of retransmissions + /// (maxRetransmits ) or set a time during which transmissions (including + /// retransmissions) are allowed (maxPacketLifeTime). These properties + /// can not be used simultaneously and an attempt to do so will result in + /// an error. Not setting any of these properties results in a reliable + /// channel. + /// + [dictionary] + struct RTCDataChannelInit + { + /// + /// Gets or sets the if the RTCDataChannel is ordered, and false if out + /// of order delivery is allowed. + /// + bool ordered = true; + /// + /// Gets or sets the maxPacketLifetime attribute represents the length + /// of the time window (in milliseconds) during which retransmissions + /// may occur in unreliable mode. A value of 0 means not used. + /// + [optional] + Milliseconds maxPacketLifetime; + /// + /// Gets or sets the maxRetransmits attribute returns the maximum number + /// of retransmissions that are attempted in unreliable mode if set. + /// + [optional] + uint32 maxRetransmits; + /// + /// Custom definition of the protocol being carried over the data channel. + /// + string protocol; + /// + /// Gets or sets an indicator if the this RTCDataChannel was negotiated + /// by the application. If true, the application negotiated the + /// RTCDataChannel, otherwise the value is false. + /// + bool negotiated; + /// + /// The id attribute returns the id for this RTCDataChannel if set. + /// + [optional] + uint16 id; + + /// + /// Constructs an instance of an RTCDataChannelInit instance. + /// + [constructor, default] + void RTCDataChannelInit(); + /// + /// Constructs an instance of an RTCDataChannelInit instance cloning from an existing instance. + /// + [constructor, altname(RTCDataChannelInitClone)] + void RTCDataChannelInit(RTCDataChannelInit source); + }; + + /// + /// The datachannel event uses the RTCDataChannelEvent interface. + /// + interface RTCDataChannelEvent { + [constructor, delete, default] + void RTCDataChannelEvent(); + + /// + /// Gets the channel attribute representing the RTCDataChannel object associated with the event. + /// + [getter] + RTCDataChannel channel; + }; + + /// + /// MessageEvent represents the event data when a message from the + /// RTCDataChannel is fired. + /// + struct MessageEvent + { + [constructor, delete] + void MessageEvent(); + + /// + /// Gets the binary message being sent. Only set if the data was binary. + /// + [getter] + binary binary; + + /// + /// Gets the binary message being sent. Only set if the data was text. + /// + [getter] + string text; + }; + + /// + /// An RTCDataChannel class instance allows sending data messages to/from + /// the remote peer. + /// + [disposable] + interface RTCDataChannel : RTCStatsProvider + { + [constructor, delete, default] + void RTCDataChannel(); + + /// + /// Gets the attribute representing the ID for this RTCDataChannel. + /// The value is initally null, which is what will be returned if + /// the ID was not provided at channel creation time, and the DTLS + /// role of the SCTP transport has not yet been negotiated. + /// Otherwise, it will return the ID that was either selected by + /// the script or generated by the user agent according to + /// [RTCWEB-DATA-PROTOCOL]. After the ID is set to a non-null + /// value, it will not change. On getting, the attribute MUST + /// return the value of the [[DataChannelId]] slot. + /// + [getter] + unsigned short id; + + /// + /// Gets the attribute representing a label that can be used to + /// distinguish this RTCDataChannel object from other RTCDataChannel + /// objects. Scripts are allowed to create multiple RTCDataChannel + /// objects with the same label. On getting, the attribute MUST + /// return the value of the [[DataChannelLabel]] slot. + /// + [getter] + string label; + + /// + /// Gets the attribute where true means the RTCDataChannel is ordered, and + /// false means other of order delivery is allowed. On getting, + /// the attribute MUST return the value of the [[Ordered]] slot. + /// + [getter] + bool ordered; + + /// + /// Gets the attribute representing the length of the time window + /// (in milliseconds) during which transmissions and retransmissions + /// may occur in unreliable mode. On getting, the attribute MUST + /// return the value of the [[MaxPacketLifeTime]] slot. + /// + [getter, optional] + Milliseconds maxPacketLifeTime; + + /// + /// Gets the attribute representing the maximum number of retransmissions + /// that are attempted in unreliable mode. On getting, the attribute MUST + /// return the value of the [[MaxRetransmits]] slot. + /// + [getter, optional] + unsigned short maxRetransmits; + + /// + /// Gets thel attribute representing the name of the sub-protocol used + /// with this RTCDataChannel. On getting, the attribute MUST return + /// the value of the [[DataChannelProtocol]] slot. + /// + [getter] + string protocol; + + /// + /// Gets the attribute returning true if this RTCDataChannel was negotiated + /// by the application, or false otherwise. On getting, the attribute MUST + /// return the value of the [[Negotiated]] slot. + /// + [getter] + bool negotiated; + + /// + /// Gets the attribute representing the priority for this RTCDataChannel. + /// The priority is assigned by the user agent at channel creation time. + /// On getting, the attribute MUST return the value of the + /// [[DataChannelPriority]] slot. + /// + [getter] + RTCPriorityType priority; + + /// + /// Gets the readyState representing the state of the RTCDataChannel + /// object. On getting, the attribute MUST return the value of the + /// [[ReadyState]] slot. + /// + [getter] + RTCDataChannelState readyState; + + /// + /// Gets the number of bytes of application data (UTF-8 text and binary + /// data) that have been queued using send() but that, as of the last + /// time the event loop started executing a task, had not yet been + /// transmitted to the network. + /// + [getter] + size_t bufferedAmount; + + /// + /// Gets or sets the threshold at which the BufferedAmount is considered + /// to be low. When the bufferedAmount decreases from above this + /// threshold to equal or below it, the bufferedamountlow event fires. + /// The bufferedAmountLowThreshold is initially zero on each new + /// RTCDataChannel, but the application may change its value at any + /// time. + /// + [getter, setter] + size_t bufferedAmountLowThreshold; + + /// + /// Gets or sets the binaryType attribute. On getting, return the value + /// to which it was last set. On setting, the user agent must set the + /// IDL attribute to the new value. When an RTCDataChannel object is + /// constructed, the binaryType attribute must be initialized to the + /// string 'blob'. This attribute controls how binary data is exposed to + /// scripts. + /// + [getter, setter] + string binaryType; + + /// + /// Closes the RTCDataChannel. + /// + void close(); + + /// + /// The Send() method is overloaded to handle different data argument + /// types. This Send() method transmits a string to the remote peer. + /// + [default, altname(sendWithString)] + void send(string text) throws (RTCError); + /// + /// The Send() method is overloaded to handle different data argument + /// types. This Send() method transmits a binary blob to the remote + /// peer. + /// + [altname(sendWithBinary)] + void send(binary data) throws (RTCError); + + /// + /// The event handler when the state of the RTCDataChannel is open. + /// + [event] + void onOpen(); + + /// + /// The event handler when the state of the RTCDataChannel is closed. + /// + [event] + void onClose(); + + /// + /// The error event handler for the RTCDataChannel. + /// + [event] + void onError(RTCError event); + + /// + /// The event handler when the BufferedAmount falls below the + /// BufferedAmountLowThreshold. + /// + [event] + void onBufferedAmountLow(); + + /// + /// The event handler when data from the remote peer arrives. + /// + [event] + void onMessage(MessageEvent event); + }; + } +} diff --git a/webrtc/idl/Error.idl b/webrtc/idl/Error.idl new file mode 100644 index 00000000..3ef9331c --- /dev/null +++ b/webrtc/idl/Error.idl @@ -0,0 +1,65 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// The RTCConfiguration defines a set of parameters to configure how the + /// peer-to-peer communication established via RTCPeerConnection is established + /// or re-established. + /// + interface RTCError + { + /// + /// Gets the error type; + /// + [getter] + RTCErrorType type; + + /// + /// Gets the error message; + /// + [getter] + string message; + + /// + /// Gets true if the error is not an error. + /// + [getter] + bool ok; + }; + + } +} diff --git a/webrtc/idl/IceCandidate.idl b/webrtc/idl/IceCandidate.idl new file mode 100644 index 00000000..cee06d5e --- /dev/null +++ b/webrtc/idl/IceCandidate.idl @@ -0,0 +1,178 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + [dictionary] + struct RTCIceCandidateInit { + /// + /// This carries the candidate-attribute as defined in section 15.1 of [ICE]. + /// If this represents an end-of-candidates indication, candidate is an empty string. + /// + string candidate; + string sdpMid; + [optional] + unsigned short sdpMLineIndex; + string usernameFragment; + }; + + /// + /// This interface describes an ICE candidate, described in [ICE] + /// Section 2. Other than candidate, sdpMid, sdpMLineIndex, and + /// usernameFragment, the remaining attributes are derived from + /// parsing the candidate member in candidateInitDict, if it is + /// well formed. + /// + interface RTCIceCandidate + { + /// + /// Gets the candidate-attribute as defined in section 15.1 of + /// [ICE]. If this RTCIceCandidate represents an end-of-candidates + /// indication, candidate is an empty string. + /// + [getter] + string candidate; + + /// + /// Gets the media stream "identification-tag" defined in [RFC5888] + /// for the media component this candidate is associated with if set. + /// + [getter] + string sdpMid; + + /// + /// Gets the index (starting at zero) of the media description in the + /// SDP this candidate is associated with if set. + /// + [optional, getter] + unsigned short sdpMLineIndex; + + /// + /// Gets a unique identifier that allows ICE to correlate candidates + /// that appear on multiple RTCIceTransports. + /// + [getter] + string foundation; + + /// + /// Gets the assigned network component of the candidate (rtp or rtcp). + /// This corresponds to the component-id field in candidate-attribute, + /// decoded to the string representation as defined in RTCIceComponent. + /// + [optional, getter] + RTCIceComponent component; + + /// + /// Gets the assigned priority of the candidate. + /// + [optional, getter] + unsigned long priority; + + /// + /// Gets the IP address of the candidate. This corresponds to the + /// connection-address field in candidate-attribute. + /// + [getter] + string ip; + + /// + /// Gets the protocol of the candidate (udp/tcp). This corresponds + /// to the transport field in candidate-attribute. + /// + [optional,getter] + RTCIceProtocol protocol; + + /// + /// Gets the port of the candidate. + /// + [optional,getter] + uint16 port; + + /// + /// Gets the type of the candidate. This corresponds to the + /// candidate-types field in candidate-attribute. + /// + [optional,getter] + RTCIceCandidateType type; + + /// + /// Gets the representation of TCP type candidate. Otherwise, tcpType is not set. + /// This corresponds to the tcp-type field in candidate-attribute. + /// + [optional,getter] + RTCIceTcpCandidateType tcpType; + + /// + /// Gets a related address for candidate that is derived from another, such + /// as a relay or reflexive candidate, the relatedAddress is the IP address of + /// the candidate that it is derived from. For host candidates, the + /// relatedAddress is empty. This corresponds to the rel-address field in + /// candidate-attribute. + /// + [getter] + string relatedAddress; + + /// + /// Gets a related port for a candidate that is derived from another, such + /// as a relay or reflexive candidate, the relatedPort is the port of the + /// candidate that it is derived from. For host candidates, the relatedPort + /// is empty. This corresponds to the rel-port field in candidate-attribute. + /// + [getter,optional] + uint16 relatedPort; + + /// + /// Gets the ufrag as defined in section 15.4 of [ICE]. + /// + [getter] + string usernameFragment; + + /// + /// Constructs an empty instance of an RTCIceCandidate object. + /// + [constructor, default] + void RTCIceCandidate(); + /// + /// Constructs an instance of an RTCIceCandidate object by extracting object data from a JSON object. + /// + [constructor, default, altname(RTCIceCandidateWithInit)] + void RTCIceCandidate(RTCIceCandidateInit init) throws (RTCError); + + /// + /// To invoke the toJSON() operation of the RTCIceCandidate interface. + /// + RTCIceCandidateInit toJson(); + }; + } +} diff --git a/webrtc/idl/IceServer.idl b/webrtc/idl/IceServer.idl new file mode 100644 index 00000000..8e29d18c --- /dev/null +++ b/webrtc/idl/IceServer.idl @@ -0,0 +1,112 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// ICE server information. + /// + [dictionary] + struct RTCIceServer + { + string uri; + /// + /// Gets or sets the STUN or TURN URI(s) as defined in [RFC7064] + /// and [RFC7065] or other URI types. + /// + StringList urls; + /// + /// Gets or sets the username to use with that TURN server, if this + /// RTCIceServer object represents a TURN Server. + /// + string username; + /// + /// Gets or sets the TURN server credential, if this RTCIceServer object + /// represents a TURN Server. + /// + string credential; + + /// + /// Gets or sets the contains the OAuth access token and MAC key. + /// + RTCOAuthCredential oauthCredential; + + /// + /// Gets or sets how credential should be used when that TURN server + /// requests authorization, if this RTCIceServer object represents a + /// TURN Server. + /// + RTCIceCredentialType credentialType = password; + + /// + /// Gets or sets the TLS certificate policy. + /// + RTCTlsCertPolicy tlsCertPolicy = tlsCertPolicySecure + + /// + /// Gets or sets the hostname. If the URIs in |urls| only contain IP addresses, + /// this field can be used to indicate the hostname, which may be necessary + /// for TLS (using the SNI extension). If |urls| itself contains the hostname, + /// this isn't necessary. + /// + string hostname; + + /// + /// Gets or sets a ist of protocols to be used in the TLS ALPN extension. + /// + StringList tlsAlpnProtocols; + + /// + /// Gets or sets a list of elliptic curves to be used in the TLS elliptic + /// curves extension. + /// + StringList tlsEllipticCurves; + + /// + /// Constructs an empty instance of an RTCIceServer object. + /// + [constructor, default] + void RTCIceServer(); + + /// + /// Constructs an instance of an RTCIceServer object by cloning the data from an existing object. + /// + [constructor, altname(RTCIceServerClone)] + void RTCIceServer(RTCIceServer source); + + }; + + } +} diff --git a/webrtc/idl/MediaConstraints.idl b/webrtc/idl/MediaConstraints.idl new file mode 100644 index 00000000..0f45b51f --- /dev/null +++ b/webrtc/idl/MediaConstraints.idl @@ -0,0 +1,69 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + struct Constraint + { + string key; + string value; + + [constructor, default] + void Constraint(); + + [constructor, default, altname(ConstraintClone)] + void Constraint(Constraint source); + + [constructor, default, altname(ConstraintWithKeyValue)] + void Constraint(string key, string value); + }; + + interface MediaConstraints + { + [getter,setter] + Constraints mandatory; + [getter,setter] + Constraints optional; + + [constructor, default] + void MediaConstraints(); + + [constructor, default, altname(MediaConstraintsClone)] + void MediaConstraints(MediaConstraints source); + + [constructor, altname(MediaConstraintsWithConstraints)] + void MediaConstraints(Constraints mandatory, Constraints optional); + }; + } +} diff --git a/webrtc/idl/MediaElement.idl b/webrtc/idl/MediaElement.idl new file mode 100644 index 00000000..fc5f7861 --- /dev/null +++ b/webrtc/idl/MediaElement.idl @@ -0,0 +1,80 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// MediaSource represents an object holder for a platform specific media element. + /// + [special] + struct MediaElement + { + /// + /// Constructs a media element object. + /// + [constructor, delete] + void MediaElement(); + + /// + /// Constructs a media element object from a native media element type. + /// + [constructor, default, altname(MediaElementWithNativeQueue)] + void MediaElement(Any element); + + /// + /// Gets the platform specific media element. + /// + [getter] + Any element; + }; + + + [special, static, platform(webhidden)] + interface MediaElementMaker + { + /// + /// Creates an media element object from a media element type. + /// + [static] + MediaElement bind(Any element); + /// + /// Extracts a native media element from an media element object. + /// + [static] + Any extract(MediaElement element); + }; + + } +} diff --git a/webrtc/idl/MediaSource.idl b/webrtc/idl/MediaSource.idl new file mode 100644 index 00000000..00b268c8 --- /dev/null +++ b/webrtc/idl/MediaSource.idl @@ -0,0 +1,64 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// MediaSource represents an object holder for a platform specific media source. + /// + [special] + struct MediaSource + { + /// + /// Constructs a media source object. + /// + [constructor, delete] + void MediaSource(); + + /// + /// Constructs a media source object from a native media source type. + /// + [constructor, default, altname(MediaSourceWithNativeSource)] + void MediaSource(Any source); + + /// + /// Gets the platform specific media source. + /// + [getter] + zs::Any source; + }; + + } +} diff --git a/webrtc/idl/MediaStreamTrack.idl b/webrtc/idl/MediaStreamTrack.idl new file mode 100644 index 00000000..beceee85 --- /dev/null +++ b/webrtc/idl/MediaStreamTrack.idl @@ -0,0 +1,134 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + /// + /// A MediaStreamTrack object represents a media source in the User Agent. + /// An example source is a device connected to the User Agent. Other + /// specifications may define sources for MediaStreamTrack that override + /// the behavior specified here. Several MediaStreamTrack objects can + /// represent the same media source, e.g., when the user chooses the + /// same camera in the UI shown by two consecutive calls to getUserMedia(). + /// + [disposable] + interface MediaStreamTrack + { + [constructor,delete] + void MediaStreamTrack(); + + /// + /// Creates an audio MediaStreamTrack for use with an RtpSender. + /// + [static] + MediaStreamTrack createAudioTrack(string label, AudioTrackSource source); + + /// + /// Creates a video MediaStreamTrack for use with an RtpSender. + /// + [static] + MediaStreamTrack createVideoTrack(string label, VideoTrackSource source); + + /// + /// Gets the kind attribute. MUST return the string "audio" if + /// this object represents an audio track or "video" if this + /// object represents a video track. + /// + [getter] + string kind; + + /// + /// Gets the User Agent generated identifier string, and MUST initialize + /// the object's id attribute to that string, unless the object is + /// created as part of a special purpose algorithm that specifies + /// how the stream id must be initialized. See MediaStream's id + /// attribute for guidelines on how to generate such an identifier. + /// + [getter] + string id; + + /// + /// Gets or sets the enabled state for the object. + /// + [getter,setter] + bool enabled; + + /// + /// Gets the state of the track. It MUST return the value as most + /// recently set by the User Agent. + /// + [getter] + MediaStreamTrackState state; + + /// + /// Gets the media source to attach to a renderer like a MediaElement. + /// + [getter] + MediaSource source; + + /// + /// Gets or sets the media element which will auto-attach any media sources as they change. + /// + [getter, setter] + MediaElement element; + + /// + /// Event indicates when the MediaSource changes and needs to be reattached to a rendering MediaElement. + /// + [event] + void onMediaSourceChanged(); + + /// + /// Event indicates the source resolution has changed. + /// + [event] + void onResolutionChanged(uint32 width, uint32 height); + + /// + /// Event indicates the source rotation has changed. + /// Rotation value represents degrees. + /// + [event] + void onRotationChanged(int rotation); + + /// + /// Event indicates the source frame rate has changed + /// (in frames per second). + /// + [event] + void onFrameRateChanged(float frameRate); + + }; + } +} diff --git a/webrtc/idl/OAuthCredential.idl b/webrtc/idl/OAuthCredential.idl new file mode 100644 index 00000000..6eb79a60 --- /dev/null +++ b/webrtc/idl/OAuthCredential.idl @@ -0,0 +1,72 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// ICE server information. + /// + [dictionary] + struct RTCOAuthCredential + { + /// + /// Gets or sets the "mac_key", as described in [RFC7635], Section 6.2, + /// in a base64-url encoded format. + /// + string macKey; + + /// + /// Gets or sets the "access_token", as described in [RFC7635], + /// Section 6.2, in a base64-encoded format. + /// + string accessToken; + + + /// + /// Constructs an empty instance of an RTCOAuthCredential object. + /// + [constructor, default] + void RTCOAuthCredential(); + + /// + /// Constructs an instance of an RTCOAuthCredential object by + /// cloning the data from an existing object. + /// + [constructor, altname(RTCOAuthCredentialClone)] + void RTCOAuthCredential(RTCOAuthCredential source); + }; + + } +} diff --git a/webrtc/idl/OfferAnswerOptions.idl b/webrtc/idl/OfferAnswerOptions.idl new file mode 100644 index 00000000..87a26e24 --- /dev/null +++ b/webrtc/idl/OfferAnswerOptions.idl @@ -0,0 +1,119 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + + /// + /// The RTCOfferAnswerOptions describe the options that can be used to control the offer/answer creation process. + /// + [dictionary, notconstructable] + struct RTCOfferAnswerOptions + { + /// + /// Gets or sets voice activity detection. Many codecs and systems are capable of + /// detecting "silence" and changing their behavior in this case by doing things + /// such as not transmitting any media. In many cases, such as when dealing with + /// emergency calling or sounds other than spoken voice, it is desirable to be able + /// to turn off this behavior. This option allows the application to provide + /// information about whether it wishes this type of processing enabled or disabled. + /// + bool voiceActivityDetection = true; + }; + + [dictionary] + struct RTCOfferOptions : RTCOfferAnswerOptions { + + /// + /// Gets or sets a flag if true, the generated description + /// will have ICE credentials that are different from the current + /// credentials (as visible in the localDescription attribute's SDP). + /// Applying the generated description will restart ICE, as described + /// in section 9.1.1.1 of [ICE]. + /// + bool iceRestart = false; + + /// + /// This setting provides additional control over the directionality of video. + /// For example, it can be used to ensure that video can be received, + /// regardless if video is sent or not. + /// + [optional] + bool offerToReceiveVideo; + + /// + /// This setting provides additional control over the directionality of audio. + /// For example, it can be used to ensure that audio can be received, + /// regardless if audio is sent or not. + /// + [optional] + bool offerToReceiveAudio; + + /// + /// Gets or sets a flag if true, will offer to BUNDLE audio/video/data together. Not to be + /// confused with RTCP mux (multiplexing RTP and RTCP together). + /// + bool useRtpMux = true; + + /// + /// Constructs an empty instance of an RTCOfferOptions object. + /// + [constructor, default] + void RTCOfferOptions(); + + /// + /// Constructs an instance of an RTCOfferOptions object by cloning the data from an existing object. + /// + [constructor, default, altname(RTCOfferOptionsClone)] + void RTCOfferOptions(RTCOfferOptions source); + + }; + + [dictionary] + struct RTCAnswerOptions : RTCOfferAnswerOptions { + /// + /// Constructs an empty instance of an RTCAnswerOptions object. + /// + [constructor, default] + void RTCAnswerOptions(); + + /// + /// Constructs an instance of an RTCAnswerOptions object by cloning the data from an existing object. + /// + [constructor, default, altname(RTCAnswerOptionsClone)] + void RTCAnswerOptions(RTCAnswerOptions source); + }; + + } +} diff --git a/webrtc/idl/PeerConnection.idl b/webrtc/idl/PeerConnection.idl new file mode 100644 index 00000000..736f53e8 --- /dev/null +++ b/webrtc/idl/PeerConnection.idl @@ -0,0 +1,510 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + [dictionary] + struct RTCBitrateParameters { + [optional] + int minBitrateBps; + [optional] + int currentBitrateBps; + [optional] + int maxBitrateBps; + }; + + /// + /// The icecandidate event of the RTCPeerConnection uses the + /// RTCPeerConnectionIceEvent interface. + /// + interface RTCPeerConnectionIceEvent { + [constructor, delete, default] + void RTCPeerConnectionIceEvent(); + + /// + /// Gets the attribute for the RTCIceCandidate object with + /// the new ICE candidate that caused the event. + /// + [getter] + RTCIceCandidate candidate; + /// + /// Gets the url attribute for to the STUN or TURN URL that + /// identifies the STUN or TURN server used to gather this + /// candidate. If the candidate was not gathered from a STUN or + /// TURN server, this parameter will be set to empty. + /// + [getter] + string url; + }; + + /// + /// The track event uses the RTCTrackEvent interface. + /// + interface RTCTrackEvent { + [constructor, delete, default] + void RTCTrackEvent(); + + /// + /// Gets the attribute representing the RTCRtpReceiver object associated with the event. + /// + [getter] + RTCRtpReceiver receiver; + /// + /// Gets the attribute representing the MediaStreamTrack object that + /// is associated with the RTCRtpReceiver identified by receiver. + /// + [getter] + MediaStreamTrack track; + /// + /// Gets the attribute representing the RTCRtpTransceiver + /// object associated with the event. + /// + [getter] + RTCRtpTransceiver transceiver; + }; + + interface RTCPeerConnectionIceErrorEvent { + [constructor, delete, default] + void RTCPeerConnectionIceErrorEvent(); + + /// + /// Gets the attribute for the local IP address and port used to + /// communicate with the STUN or TURN server. + /// + [getter] + string hostCandidate; + /// + /// Gets the url for the STUN or TURN URL that identifies the + /// STUN or TURN server for which the failure occurred. + /// + [getter] + string url; + /// + /// Gets the attribute for the numeric STUN error code returned + /// by the STUN or TURN server [STUN-PARAMETERS]. + /// + [getter] + unsigned short errorCode; + /// + /// Gets the errorText attribute is the STUN reason text + /// returned by the STUN or TURN server [STUN-PARAMETERS]. + /// + [getter] + string errorText; + }; + + [dictionary] + struct RTCRtpTransceiverInit { + RTCRtpTransceiverDirection direction = sendrecv; + std::list sendEncodings; + }; + + /// + /// The [JSEP] specification, as a whole, describes the details of how + /// the RTCPeerConnection operates. References to specific subsections of + /// [JSEP] are provided as appropriate. + /// + [disposable] + interface RTCPeerConnection : RTCStatsProvider + { + /// + /// The generateCertificate function causes the user agent to create + /// and store an X.509 certificate [X509V3] and corresponding private + /// key. A handle to information is provided in the form of the + /// RTCCertificate interface. The returned RTCCertificate can be used + /// to control the certificate that is offered in the DTLS sessions + /// established by RTCPeerConnection. + /// + [static] + PromiseWithRTCCertificate generateCertificate(RTCKeyParams keygenAlgorithm); + + /// + /// Constructs an RTCPeerConnection with an RTCConfiguration. + /// + [constructor,default] + void RTCPeerConnection(RTCConfiguration config); + + /// + /// The createOffer method generates a blob of SDP that contains an RFC 3264 + /// offer with the supported configurations for the session, including + /// descriptions of the local MediaStreamTracks attached to this + /// RTCPeerConnection, the codec/RTP/RTCP capabilities supported by this + /// implementation, and parameters of the ICE agent and the DTLS connection. + /// The options parameter may be supplied to provide additional control over + /// the offer generated. + /// + [default] + PromiseWithDescription createOffer(RTCOfferOptions options); + /// + /// The createOffer method generates a blob of SDP that contains an RFC 3264 + /// offer with the supported configurations for the session, including + /// descriptions of the local MediaStreamTracks attached to this + /// RTCPeerConnection, the codec/RTP/RTCP capabilities supported by this + /// implementation, and parameters of the ICE agent and the DTLS connection. + /// The options parameter may be supplied to provide additional control over + /// the offer generated. + /// + [altname(createOfferWithConstraints)] + PromiseWithDescription createOffer(MediaConstraints constraints); + /// + /// The createAnswer method generates an [SDP] answer with the supported + /// configuration for the session that is compatible with the parameters in + /// the remote configuration. Like createOffer, the returned blob of SDP contains + /// descriptions of the local MediaStreamTracks attached to this RTCPeerConnection, + /// the codec/RTP/RTCP options negotiated for this session, and any candidates + /// that have been gathered by the ICE Agent. The options parameter may be + /// supplied to provide additional control over the generated answer. + /// + [default] + PromiseWithDescription createAnswer(RTCAnswerOptions options); + /// + /// The createAnswer method generates an [SDP] answer with the supported + /// configuration for the session that is compatible with the parameters in + /// the remote configuration. Like createOffer, the returned blob of SDP contains + /// descriptions of the local MediaStreamTracks attached to this RTCPeerConnection, + /// the codec/RTP/RTCP options negotiated for this session, and any candidates + /// that have been gathered by the ICE Agent. The options parameter may be + /// supplied to provide additional control over the generated answer. + /// + [altname(createAnswerWithConstraints)] + PromiseWithDescription createAnswer(MediaConstraints constraints); + + /// + /// The setLocalDescription method instructs the RTCPeerConnection to + /// apply the supplied RTCSessionDescriptionInit as the local description. + /// + Promise setLocalDescription(RTCSessionDescription constraints); + /// + /// The setRemoteDescription method instructs the RTCPeerConnection + /// to apply the supplied RTCSessionDescriptionInit as the remote offer + /// or answer. This API changes the local media state. + /// + Promise setRemoteDescription(RTCSessionDescription constraints); + + /// + /// Returns an RTCConfiguration object representing the current + /// configuration of this RTCPeerConnection object. + /// + RTCConfiguration getConfiguration(); + + /// + /// The setConfiguration method updates the configuration of this + /// RTCPeerConnection object. This includes changing the configuration + /// of the ICE Agent. As noted in [JSEP] (section 3.5.1.), when the + /// ICE configuration changes in a way that requires a new gathering + /// phase, an ICE restart is required. + /// + void setConfiguration(RTCConfiguration config) throws (RTCError); + + /// + /// The addIceCandidate method provides a remote candidate to the ICE + /// Agent. This method can also be used to indicate the end of remote + /// candidates when called with an empty string for the candidate + /// member. The only members of the argument used by this method are + /// candidate, sdpMid, sdpMLineIndex, and usernameFragment; the rest + /// are ignored. + /// + Promise addIceCandidate(RTCIceCandidate candidate); + + /// + /// Removes a group of remote candidates from the ICE agent. Needed mainly for + /// continual gathering, to avoid an ever-growing list of candidates as + /// networks come and go. + /// + void removeIceCandidates(RTCIceCandidates candidates); + + /// + /// SetBitrate limits the bandwidth allocated for all RTP streams sent by + /// this PeerConnection. Other limitations might affect these limits and + /// are respected (for example "b=AS" in SDP). + /// + /// Setting |current_bitrate_bps| will reset the current bitrate estimate + /// to the provided value. + /// + void setBitrate(RTCBitrateParameters params) throws (RTCError); + + /// + /// Gets the attribute returning the RTCPeerConnection object's signaling state. + /// + [getter] + RTCSignalingState signalingState; + /// + /// Gets the attribute returning the ICE gathering state of the RTCPeerConnection instance. + /// + [getter] + RTCIceGatheringState iceGatheringState; + /// + /// Gets the attribute returning the ICE connection state of the RTCPeerConnection instance. + /// + [getter] + RTCIceConnectionState iceConnectionState; + /// + /// Gets the attribute returning the connection state of the RTCPeerConnection instance. + /// + [getter, optional] + RTCPeerConnectionState connectionState_NotAvailable; + + /// + /// The canTrickleIceCandidates attribute indicates whether the remote peer is + /// able to accept trickled ICE candidates [TRICKLE-ICE]. The value is determined + /// based on whether a remote description indicates support for trickle ICE, as + /// defined in [JSEP] (section 4.1.15.). Prior to the completion of + /// setRemoteDescription, this value is not set. + /// + [getter,optional] + bool canTrickleIceCandidates_NotAvailable; + + /// + /// Closes the RTCPeerConnection object. + /// + void close(); + + /// + /// Adds a new track to the RTCPeerConnection, and indicates that it is + /// contained in the specified MediaStreams. + /// + RTCRtpSender addTrack(MediaStreamTrack track) throws (RTCError); + + /// + /// Stops sending media from sender. The RTCRtpSender will still + /// appear in getSenders. Doing so will cause future calls to + /// createOffer to mark the media description for the corresponding + /// transceiver as recvonly or inactive, as defined in [JSEP] (section 5.2.2.). + /// + bool removeTrack(RTCRtpSender sender); + + /// + /// The RTCRtpTransceiver interface represents a combination of an + /// RTCRtpSender and an RTCRtpReceiver that share a common mid. As + /// defined in [JSEP] (section 3.4.1.), an RTCRtpTransceiver is said + /// to be associated with a media description if its mid property is + /// non-null; otherwise it is said to be disassociated. Conceptually, + /// an associated transceiver is one that's represented in the last + /// applied session description. + /// + [default] + RTCRtpTransceiver addTransceiver(MediaStreamTrack track) throws (RTCError); + + /// + /// The RTCRtpTransceiver interface represents a combination of an + /// RTCRtpSender and an RTCRtpReceiver that share a common mid. As + /// defined in [JSEP] (section 3.4.1.), an RTCRtpTransceiver is said + /// to be associated with a media description if its mid property is + /// non-null; otherwise it is said to be disassociated. Conceptually, + /// an associated transceiver is one that's represented in the last + /// applied session description. + /// + [default, altname(addTransceiverWithInit)] + RTCRtpTransceiver addTransceiver(MediaStreamTrack track, RTCRtpTransceiverInit init) throws (RTCError); + + + /// + /// The RTCRtpTransceiver interface represents a combination of an + /// RTCRtpSender and an RTCRtpReceiver that share a common mid. As + /// defined in [JSEP] (section 3.4.1.), an RTCRtpTransceiver is said + /// to be associated with a media description if its mid property is + /// non-null; otherwise it is said to be disassociated. Conceptually, + /// an associated transceiver is one that's represented in the last + /// applied session description. + /// + [altName(addTransceiverWithKind)] + RTCRtpTransceiver addTransceiver(string kind) throws (RTCError); + + RTCRtpSender addSender(string kind, string trackId); + + /// + /// Returns a sequence of RTCRtpSender objects representing the RTP + /// senders that are currently attached to this RTCPeerConnection object. + /// + RTCRtpSenders getSenders(); + + /// + /// Returns a sequence of RTCRtpReceiver objects representing the RTP + /// receivers that are currently attached to this RTCPeerConnection object. + /// + RTCRtpReceivers getReceivers(); + + + /// + /// Returns a sequence of RTCRtpTransceiver objects representing the RTP + /// transceivers that are currently attached to this RTCPeerConnection object. + /// + RTCRtpTransceivers getTransceivers(); + + /// + /// Creates a new RTCDataChannel object with the given label. The + /// RTCDataChannelInit dictionary can be used to configure properties + /// of the underlying channel such as data reliability. + /// + RTCDataChannel createDataChannel(string label, RTCDataChannelInit init); + + /// + /// Gets the attribute returning [[PendingLocalDescription]] if it is not + /// null and otherwise it MUST return [[CurrentLocalDescription]]. + /// + /// Note that [[CurrentLocalDescription]].sdp and + /// [[PendingLocalDescription]].sdp need not be string-wise identical + /// to the SDP value passed to the corresponding setLocalDescription call + /// (i.e. SDP may be parsed and reformatted, and ICE candidates may be added). + /// + [getter] + RTCSessionDescription localDescription; + + /// + /// Gets the attribute returning [[CurrentLocalDescription]]. + /// It represents the local description that was successfully negotiated the + /// last time the RTCPeerConnection transitioned into the stable state plus + /// any local candidates that have been generated by the ICE Agent since the offer or answer was created. + /// + [getter] + RTCSessionDescription currentLocalDescription; + + /// + /// Gets the pendingLocalDescription attribute MUST return [[PendingLocalDescription]]. + /// + /// It represents a local description that is in the process of being negotiated + /// plus any local candidates that have been generated by the ICE Agent since the + /// offer or answer was created. If the RTCPeerConnection is in the stable state, the + /// value is null. + /// + [getter] + RTCSessionDescription pendingLocalDescription; + + /// + /// Gets the remoteDescription attribute MUST return [[PendingRemoteDescription]] if + /// it is not null and otherwise it MUST return [[CurrentRemoteDescription]]. + /// + /// Note that [[CurrentRemoteDescription]].sdp and [[PendingRemoteDescription]].sdp need + /// not be string-wise identical to the SDP value passed to the corresponding + /// setRemoteDescription call (i.e. SDP may be parsed and reformatted, and ICE + /// candidates may be added). + /// + [getter] + RTCSessionDescription remoteDescription; + + /// + /// Gets the currentRemoteDescription attribute MUST return [[CurrentRemoteDescription]]. + /// + /// It represents the last remote description that was successfully negotiated the last + /// time the RTCPeerConnection transitioned into the stable state plus any remote candidates + /// that have been supplied via addIceCandidate() since the offer or answer was created. + /// + [getter] + RTCSessionDescription currentRemoteDescription; + + /// + /// Gets the pendingRemoteDescription attribute MUST return [[PendingRemoteDescription]]. + /// + /// It represents a remote description that is in the process of being negotiated, complete + /// with any remote candidates that have been supplied via addIceCandidate() since the + /// offer or answer was created. If the RTCPeerConnection is in the stable state, the + /// value is null. + /// + [getter] + RTCSessionDescription pendingRemoteDescription; + + /// + /// A new RTCDataChannel is dispatched to the script in response to the other peer creating a channel. + /// + [event] + void onDataChannel(RTCDataChannelEvent event); + + /// + /// The browser wishes to inform the application that session negotiation needs to be done (i.e. a createOffer call followed by setLocalDescription). + /// + [event] + void onNegotiationNeeded(); + + /// + /// A new RTCIceCandidate is made available to the script. + /// + [event] + void onIceCandidate(RTCPeerConnectionIceEvent event); + + /// + /// An RTCIceCandidate is no longer available to the script. + /// + [event] + void onIceCandidateRemoved(RTCPeerConnectionIceEvent event); + + /// + /// A failure occured when gathering ICE candidates. + /// + [event] + void onIceCandidateError(); + + /// + /// The signaling state has changed. This state change is the result of either setLocalDescription or setRemoteDescription being invoked. + /// + [event] + void onSignalingStateChange(); + + /// + /// The RTCPeerConnection's ICE connection state has changed. + /// + [event] + void onIceConnectionStateChange(); + + /// + /// The RTCPeerConnection's ICE gathering state has changed. + /// + [event] + void onIceGatheringStateChange(); + + /// + /// The RTCPeerConnection connectionState has changed. + /// + [event] + void onConnectionStateChange(); + + /// + /// New incoming media has been negotiated for a specific RTCRtpReceiver, and that + /// receiver's track has been added to any associated remote MediaStreams. + /// + [event] + void onTrack(RTCTrackEvent event); + + /// + /// Called when a receiver is completely removed. This is current (Plan B SDP) + /// behavior that occurs when processing the removal of a remote track, and is + /// called when the receiver is removed and the track is muted. When Unified + /// Plan SDP is supported, transceivers can change direction (and receivers + /// stopped) but receivers are never removed, so this is never called. + /// https://w3c.github.io/webrtc-pc/#process-remote-track-removal + /// + [event] + void onRemoveTrack(RTCTrackEvent event); + }; + } +} diff --git a/webrtc/idl/RtpParameters.idl b/webrtc/idl/RtpParameters.idl new file mode 100644 index 00000000..1582c825 --- /dev/null +++ b/webrtc/idl/RtpParameters.idl @@ -0,0 +1,541 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + + [dictionary] + struct RTCRtpFecParameters { + /// + /// Gets or sets the SSRC to use for FEC. If unset in an RTCRtpSender object, the browser will choose. + /// + [optional] + uint32 ssrc; + + /// + /// Gets or sets the Forward Error Correction (FEC) mechanism to use: "red", "red+ulpfec" or "flexfec". + /// + string mechanism; + }; + + /// + /// The RTCRtpRtxParameters dictionary contains information relating to retransmission (RTX) settings. + /// + [dictionary] + struct RTCRtpRtxParameters { + /// + /// Gets or sets the SSRC to use for retransmission, as specified in [RFC4588]. If unset + /// when passed to RTCRtpSender.send(), the browser will choose. + /// + [optional] + uint32 ssrc; + }; + + [dictionary] + struct RTCRtpCodingParameters { + /// + /// Gets or sets the RID header extension as defined by + /// [JSEP] (section 5.2.1.). The RID is not modifiable + /// via setParameters. It can only be set or modified + /// in addTransceiver on the sending side. Read-only + /// parameter. + /// + string rid; + + /// + /// Gets or sets the SSRC for this encoding. + /// + [optional] + uint32 ssrc; + + /// + /// Gets or sets a codec to be sent. Must reference a + /// payload type from the codecs member of RTCRtpParameters. + /// If left unset, the implementation will select a codec + /// according to its default policy. + /// + [optional] + uint8 codecPayloadType; + + /// + /// Specifies the FEC mechanism if set. + /// + [optional] + RTCRtpFecParameters fec; + + /// + /// Specifies the RTX [RFC4588] parameters if set. + /// + [optional] + RTCRtpRtxParameters rtx; + + /// + /// Gets or sets a flag that this encoding is actively being + /// sent. Setting it to false causes this encoding to no + /// longer be sent. Setting it to true causes this encoding + /// to be sent. + /// + bool active = true; + }; + + [dictionary] + struct RTCRtpDecodingParameters : RTCRtpCodingParameters { + }; + + [dictionary] + struct RTCRtpEncodingParameters : RTCRtpCodingParameters { + /// + /// Gets or sets the discontinuous transmission mode. This + /// member is only used if the sender's kind is "audio". + /// It indicates whether discontinuous transmission will + /// be used. Setting it to disabled causes discontinuous + /// transmission to be turned off. Setting it to enabled + /// causes discontinuous transmission to be turned on if + /// it was negotiated (either via a codec-specific parameter + /// or via negotiation of the CN codec); if it was not + /// negotiated (such as when setting voiceActivityDetection + /// to false), then discontinuous operation will be turned + /// off regardless of the value of dtx, and media will be + /// sent even when silence is detected. + /// + [optional] + RTCDtxStatus dtx; + /// + /// Gets or sets the priority of this encoding. It is + /// specified in [RTCWEB-TRANSPORT], Section 4. + /// + RTCPriorityType priority = low; + /// + /// Gets or sets the preferred duration of media + /// represented by a packet in milliseconds for this + /// encoding. Typically, this is only relevant for audio + /// encoding. The user agent MUST use this duration if + /// possible, and otherwise use the closest available + /// duration. This value MUST take precedence over any + /// "ptime" attribute in the remote description, whose + /// processing is described in [JSEP] (section 5.10.). + /// Note that the user agent MUST still respect the limit + /// imposed by any "maxptime" attribute, as defined in + /// [RFC4566], Section 6. + /// + Milliseconds ptime; + /// + /// Gets or sets the maximum bitrate that can be used + /// to send this encoding. The encoding may also be + /// further constrained by other limits (such as + /// maxFramerate or per-transport or per-session + /// bandwidth limits) below the maximum specified + /// here. maxBitrate is computed the same way as + /// the Transport Independent Application Specific + /// Maximum (TIAS) bandwidth defined in [RFC3890] + /// Section 6.2.2, which is the maximum bandwidth + /// needed without counting IP or other transport + /// layers like TCP or UDP. + /// + [optional] + unsigned long maxBitrate; + /// + /// Gets or sets the maximum framerate that can be + /// used to send this encoding, in frames per second. + /// + [optional] + double maxFramerate; + + /// + /// Gets or sets the resolution scale. This member is only + /// present if the sender's kind is "video". The video's + /// resolution will be scaled down in each dimension by + /// the given value before sending. For example, if the + /// value is 2.0, the video will be scaled down by a factor + /// of 2 in each dimension, resulting in sending a video of + /// one quarter the size. If the value is 1.0, the video + /// will not be affected. The value must be greater than + /// or equal to 1.0. By default, the sender will not apply + /// any scaling, (i.e., scaleResolutionDownBy will be 1.0). + /// + double scaleResolutionDownBy = 1.0; + double scaleFramerateDownBy = 1.0; + + /// + /// The encodingIds on which this layer depends. Within this specification + /// encodingIds are permitted only within the same RTCRtpCodingParameters + /// sequence. In the future if MST were to be supported, then if searching + /// within an encodings[] sequence did not produce a match, then a global + /// search would be carried out. In order to send scalable video coding (SVC), + /// both the encodingId and dependencyEncodingIds are required. + /// + StringList dependencyEncodingIds; + }; + + /// The RTCRtpCodecCapability dictionary provides information on the capabilities of a codec. + /// Exactly one RTCRtpCodecCapability will be present for each supported combination of + /// parameters that requires a distinct value of preferredPayloadType. + [dictionary] + struct RTCRtpCodecCapability { + /// + /// The preferred RTP payload type for the codec denoted by RTCRtpCodecCapability.name. + /// This attribute was added to make it possible for the sender and receiver to pick a + /// matching payload type when creating sender and receiver parameters. When returned + /// by RTCRtpSender.getCapabilities(), RTCRtpCapabilities.codecs.preferredPayloadtype + /// represents the preferred RTP payload type for sending. When returned by + /// RTCRtpReceiver.getCapabilities(), RTCRtpCapabilities.codecs.preferredPayloadtype + /// represents the preferred RTP payload type for receiving. To avoid payload type + /// conflicts, each value of preferredPayloadType MUST be unique. + /// + [optional] + uint8 preferredPayloadType; + + /// + /// The MIME media subtype. Valid subtypes are listed in [IANA-RTP-2]. + /// + string name; + + /// + /// The codec MIME media type/subtype. Valid media types and subtypes are listed in [IANA-RTP-2]. + /// + string mimeType; + + /// + /// Codec clock rate expressed in Hertz. If unset, the codec is applicable to any clock rate. + /// + [optional] + unsigned long clockRate; + + /// + /// The number of channels supported (e.g. two for stereo). For video, this attribute is unset. + /// + [optional] + unsigned short channels; + + /// + /// The "format specific parameters" field from the "a=fmtp" line in the SDP + /// corresponding to the codec, if one exists. + /// + string sdpFmtpLine; + + /// + /// The maximum packetization time supported by the RTCRtpReceiver. + /// + Milliseconds maxPtime; + + /// + /// The preferred duration of media represented by a packet in milliseconds for the RTCRtpSender or RTCRtpReceiver. + /// + Milliseconds ptime; + + /// + /// Transport layer and codec-specific feedback messages for this codec. + /// + RTCRtcpFeedbackList rtcpFeedback; + + /// + /// Codec-specific parameters that must be signaled to the remote party. + /// + StringList parameters; + + /// + /// Codec-specific parameters that may be optionally signalled and are available + /// as additional supported information or settings about the codec. + /// + StringList options; + + /// + /// Maximum number of temporal layer extensions supported by this codec (e.g. a + /// value of 1 indicates support for up to 2 temporal layers). A value of 0 + /// indicates no support for temporal scalability. + /// + unsigned short maxTemporalLayers = 0; + + /// + /// Maximum number of spatial layer extensions supported by this codec + /// (e.g. a value of 1 indicates support for up to 2 spatial layers). A + /// value of 0 indicates no support for spatial scalability. + /// + unsigned short maxSpatialLayers = 0; + + /// + /// Whether the implementation can send/receive SVC layers utilizing + /// distinct SSRCs. Unset for audio codecs. For video codecs, only set + /// if the codec supports scalable video coding with MRST. + /// + bool svcMultiStreamSupport = false; + }; + + + /// + /// The RTCRtpHeaderExtensionCapability dictionary provides information relating to supported header extensions. + /// + [dictionary] + struct RTCRtpHeaderExtensionCapability { + /// + /// The URI of the RTP header extension, as defined in [RFC5285]. + /// + string uri; + + /// + /// The preferred ID value that goes in the packet. + /// + [optional] + unsigned short preferredId; + + /// + /// If true, it is preferred that the value in the header be encrypted as per [RFC6904]. Default is to prefer unencrypted. + /// + bool preferredEncrypt = false; + }; + + /// + /// The RTCRtpCapabilities object expresses the capabilities of RTCRtpSender and RTCRtpReceiver + /// objects. Features which are mandatory to implement in [RTP-USAGE], such as RTP/RTCP multiplexing + /// [RFC5761], audio/video multiplexing [RTP-MULTI-STREAM] and reduced size RTCP [RFC5506] are + /// assumed to be available and are therefore not included in RTCRtpCapabilities, + /// although these parameters may be set. + /// + [dictionary] + struct RTCRtpCapabilities { + /// + /// Supported media codecs as well as entries for RTX, RED and FEC mechanisms. There will + /// only be a single entry in codecs[] for retransmission via RTX, with sdpFmtpLine not present. + /// + RTCRtpCodecCapabilityList codecs; + + /// + /// Supported RTP header extensions. + /// + RTCRtpHeaderExtensionCapabilityList headerExtensions; + + /// + /// Supported Forward Error Correction (FEC) mechanisms and combinations. Supported values + /// are "red" [RFC2198], "red+ulpfec" [RFC5109] and "flexfec" [FLEXFEC]. + /// Note that supported mechanisms also need to be included within + /// RTCRtpCapabilities.codecs[]. [FEC] summarizes requirements relating to FEC mechanisms. + /// + StringList fecMechanisms; + }; + + /// + /// RTCRtpParameters contains the RTP stack settings used by both senders and receivers. + /// + [dictionary] + struct RTCRtpHeaderExtensionParameters { + /// + /// Gets or sets the URI of the RTP header extension, as defined in [RFC5285]. + /// + string uri; + /// + /// Gets or sets the value put in the RTP packet to identify the header extension. + /// + unsigned short id; + /// + /// Gets or sets whether the header extension is encrypted or not. + /// + bool encrypted = false; + }; + + /// + /// RTCRtcpParameters provides information on RTCP settings. + /// + [dictionary] + struct RTCRtcpParameters { + /// + /// Gets or sets the Canonical Name (CNAME) used by RTCP (e.g. in SDES messages). + /// + string cname; + /// + /// Gets or sets whether reduced size RTCP [RFC5506] is configured (if true) + /// or compound RTCP as specified in [RFC3550] (if false). Read-only parameter. + /// + bool reducedSize; + }; + + /// + /// RTCRtcpFeedback provides information on RTCP feedback messages. + /// + [dictionary] + struct RTCRtcpFeedback + { + /// + /// Valid values for type are the "RTCP Feedback" Attribute Values enumerated + /// in [IANA-SDP-14] ("ack", "ccm", "nack", etc.), as well as "goog-remb" + /// [REMB] and "transport-cc" [TRANSPORT-CC]. + /// + string type; + /// + /// For a type value of "ack" or "nack", valid values for parameter are the + /// "ack" and "nack" Attribute Values enumerated in [IANA-SDP-15] ("sli", + /// "rpsi", etc.). For the Generic NACK feedback message defined in + /// [RFC4585] Section 6.2.1, the type attribute is set to "nack" and + /// the parameter attribute is unset. For a type value of "ccm", valid + /// values for parameter are the "Codec Control Messages" enumerated in + /// [IANA-SDP-19] ("fir", "tmmbr" (includes "tmmbn"), etc.). + /// + string parameter; + }; + + /// RTCRtpCodecParameters provides information on codec settings. + [dictionary] + struct RTCRtpCodecParameters { + /// + /// The value that goes in the RTP Payload Type Field [RFC3550]. + /// The payloadType MUST always be provided, and MUST be unique. + /// + uint8 payloadType; + + /// + /// The codec MIME subtype. Valid subtypes are listed in [IANA-RTP-2]. + /// + string name; + + /// + /// The codec MIME media type/subtype. Valid media types and subtypes are listed in [IANA-RTP-2]. + /// + string mimeType; + + /// + /// Codec clock rate expressed in Hertz. + /// + [optional] + unsigned long clockRate; + + /// + /// The number of channels supported (e.g. two for stereo). If unset for + /// audio, use the codec default. For video, this can be left unset. + /// + [optional] + unsigned short channels; + + /// + /// The "format specific parameters" field from the "a=fmtp" line in the SDP corresponding + /// to the codec, if one exists, as defined by [JSEP] (section 5.8.). For an RTCRtpSender, + /// these parameters come from the remote description, and for an RTCRtpReceiver, + /// they come from the local description. Read-only parameter. + /// + string sdpFmtpLine; + + /// + /// The duration of media represented by a packet in milliseconds for + /// the RTCRtpSender. If unset, the RTCRtpSender may select any + /// value up to maxptime. + /// + Milliseconds ptime; + + /// + /// The maximum packetization time set on the RTCRtpSender. Not specified if + /// unset. If ptime is also set, maxptime is ignored. + /// + Milliseconds maxPtime; + + /// + /// Transport layer and codec-specific feedback messages for this codec. + /// + RTCRtcpFeedbackList rtcpFeedback; + + + }; + + [dictionary] + struct RTCRtpParameters + { + /// + /// Gets or sets a sequence containing parameters for RTP header extensions. + /// + RTCRtpHeaderExtensionParametersList headerExtensions; + + /// + /// Gets or sets parameters used for RTCP. + /// + RTCRtcpParameters rtcp; + + /// + /// Gets or sets a sequence containing the media codecs that an + /// RTCRtpSender will choose from, as well as entries for RTX, + /// RED and FEC mechanisms. Corresponding to each media codec + /// where retransmission via RTX is enabled, there will be an + /// entry in codecs[] with a mimeType attribute indicating + /// retransmission via "audio/rtx" or "video/rtx", and an + /// sdpFmtpLine attribute (providing the "apt" and "rtx-time" + /// parameters). + /// + RTCRtpCodecParametersList codecs; + + /// + /// The muxId assigned to the RTP stream, if any. In an RTCRtpReceiver + /// or RTCRtpSender, this corresponds to MID RTP header extension defined + /// in [BUNDLE]. This is a stable identifier that permits the track + /// corresponding to an RTP stream to be identified, rather than relying + /// on an SSRC. An SSRC is randomly generated and can change arbitrarily + /// due to conflicts with other SSRCs, whereas the muxId has a value whose + /// meaning can be defined in advance between RTP sender and receiver, + /// assisting in RTP demultiplexing. Since muxId is included in + /// RTCRtpParameters, if it is desired to send simulcast streams with + /// different muxId values for each stream, then multiple RTCRtpSender + /// objects are needed. + /// + string muxId; + }; + + [dictionary] + struct RTCRtpSendParameters : RTCRtpParameters { + /// + /// Gets or sets a unique identifier for the last set + /// of parameters applied. Ensures that setParameters + /// can only be called based on a previous getParameters, + /// and that there are no intervening changes. + /// + string transactionId; + /// + /// Gets or sets a sequence containing parameters for RTP + /// encodings of media. + /// + RTCRtpEncodingParametersList encodings; + /// + /// Gets or sets the degradation preference when bandwidth is + /// constrained and the RtpSender needs to choose between + /// degrading resolution or degrading framerate, + /// degradationPreference indicates which is preferred. + /// + RTCDegradationPreference degradationPreference = balanced; + }; + + [dictionary] + struct RTCRtpReceiveParameters : RTCRtpParameters { + /// + /// Gets or sets a sequence containing information + /// about incoming RTP encodings of media. + /// + RTCRtpDecodingParametersList encodings; + }; + + } +} diff --git a/webrtc/idl/RtpReceiver.idl b/webrtc/idl/RtpReceiver.idl new file mode 100644 index 00000000..09337153 --- /dev/null +++ b/webrtc/idl/RtpReceiver.idl @@ -0,0 +1,165 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + /// + /// The RTCRtpContributingSource and RTCRtpSynchronizationSource + /// dictionaries contain information about a given contributing + /// source (CSRC) or synchronization source (SSRC) respectively, + /// including the most recent time a packet that the source + /// contributed to was played out. + /// + [dictionary] + struct RTCRtpContributingSource { + [constructor, default, delete] + void RTCRtpContributingSource(); + + /// + /// Get or sets the timestamp indicating the most recent time + /// of playout of media that arrived in an RTP packet + /// originating from this source. The timestamp is + // defined as performance.timeOrigin + performance.now() + /// at the time of playout. + /// + Milliseconds timestamp; + /// + /// Gets or sets the CSRC or SSRC identifier of the + /// contributing or synchronization source. + /// + uint32 source; + /// + /// Gets or sets the audio level. This is a value between 0..1 + /// (linear), where 1.0 represents 0 dBov, 0 represents silence, + /// and 0.5 represents approximately 6 dBSPL change in the sound pressure level from 0 dBov. + /// + /// For CSRCs, this MUST be converted from the level value defined in + /// [RFC6465] if the RFC 6465 header extension is present, otherwise this + /// member MUST be absent. + /// + /// For SSRCs, this MUST be converted from the level value defined + /// in [RFC6464] if the RFC 6464 header extension is present, + /// otherwise the user agent must compute the value from the + /// audio data (the member must never be absent). + /// + /// Both RFCs define the level as an integral value from 0 to + /// 127 representing the audio level in negative decibels + /// relative to the loudest signal that the system could + /// possibly encode. Thus, 0 represents the loudest signal the + /// system could possibly encode, and 127 represents silence. + /// + /// To convert these values to the linear 0..1 range, a value + /// of 127 is converted to 0, and all other values are converted + /// using the equation: 10^(-rfc_level/20). + /// + double audioLevel; + }; + + /// + /// The RTCRtpContributingSource and RTCRtpSynchronizationSource + /// dictionaries contain information about a given contributing + /// source (CSRC) or synchronization source (SSRC) respectively, + /// including the most recent time a packet that the source + /// contributed to was played out. + /// + [dictionary] + struct RTCRtpSynchronizationSource : RTCRtpContributingSource { + [constructor, default, delete] + void RTCRtpSynchronizationSource(); + + /// + /// Gets or sets whether the last RTP packet played from + /// this source contains voice activity (true) or not + /// (false). If the RFC 6464 extension header was not + /// present, or if the peer has signaled that it is not + /// using the V bit by setting the "vad" extension attribute + /// to "off", as described in [RFC6464], Section 4, + /// voiceActivityFlag will be absent. + /// + [optional] + bool voiceActivityFlag; + }; + + /// + /// The RTCRtpReceiver interface allows an application to + /// inspect the receipt of a MediaStreamTrack. + /// + [disposable] + interface RTCRtpReceiver + { + [constructor, delete] + void RTCRtpReceiver(); + + /// + /// The getCapabilities() method returns the most optimistic view of the + /// capabilities of the system for receiving media of the given kind. It does + /// not reserve any resources, ports, or other state but is meant to provide + /// a way to discover the types of capabilities of the browser including + /// which codecs may be supported. User agents MUST support kind values + /// of "audio" and "video". If the system has no capabilities corresponding + /// to the value of the kind argument, getCapabilities returns null. + /// + [static] + RTCRtpCapabilities getCapabilities(string kind); + + /// + /// Gets the attribute for the track that is associated with + /// this RTCRtpReceiver object receiver. + /// + /// Note that track.stop() is final, although clones are not + /// affected. Since receiver.track.stop() does not implicitly + /// stop receiver, Receiver Reports continue to be sent. On + /// getting, the attribute MUST return the value of the + /// [[ReceiverTrack]] slot. + /// + [getter] + MediaStreamTrack track; + /// + /// The getParameters() method returns the RTCRtpReceiver + /// object's current parameters for how track is decoded. + /// + RTCRtpReceiveParameters getParameters(); + /// + /// Returns an RTCRtpContributingSource for each unique + /// CSRC identifier received by this RTCRtpReceiver in the last 10 seconds. + /// + RTCRtpContributingSources getContributingSources(); + /// + /// Returns an RTCRtpSynchronizationSource for each unique + /// SSRC identifier received by this RTCRtpReceiver in the last 10 seconds. + /// + RTCRtpSynchronizationSources getSynchronizationSources(); + }; + } +} diff --git a/webrtc/idl/RtpSender.idl b/webrtc/idl/RtpSender.idl new file mode 100644 index 00000000..49b99491 --- /dev/null +++ b/webrtc/idl/RtpSender.idl @@ -0,0 +1,107 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + /// + /// The RTCRtpSender interface allows an application to control how + /// a given MediaStreamTrack is encoded and transmitted to a remote + /// peer. When setParameters is called on an RTCRtpSender object, + /// the encoding is changed appropriately. + /// + [disposable] + interface RTCRtpSender + { + [constructor, delete] + void RTCRtpSender(); + + /// + /// The getCapabilities() method returns the most optimistic view of + /// the capabilities of the system for sending media of the given kind. + /// It does not reserve any resources, ports, or other state but is + /// meant to provide a way to discover the types of capabilities of + /// the browser including which codecs may be supported. User agents + /// MUST support kind values of "audio" and "video". If the system + /// has no capabilities corresponding to the value of the kind + /// argument, getCapabilities returns null. + /// + [static] + RTCRtpCapabilities getCapabilities(string kind); + + /// + /// Gets the attribute for the track that is associated with + /// this RTCRtpSender object. If track is ended, or if the + /// track's output is disabled, i.e. the track is disabled + /// and/or muted, the RTCRtpSender MUST send silence (audio), + /// black frames (video) or a zero-information-content + /// equivalent. In the case of video, the RTCRtpSender + /// SHOULD send one black frame per second. If track is + /// null then the RTCRtpSender does not send. On getting, + /// the attribute MUST return the value of the + /// [[SenderTrack]] slot. + /// + [getter] + MediaStreamTrack track; + + /// + /// Gets attribute returning the value of the [[Dtmf]]internal slot, + /// which represents a RTCDtmfSender which can be used to send DTMF, + /// or null if unset. The [[Dtmf]]internal slot is set when the kind + /// of an RTCRtpSender's [[SenderTrack]] is "audio". + /// + [getter] + RTCDtmfSender dtmf; + + /// + /// The getParameters() method returns the RTCRtpSender object's + /// current parameters for how track is encoded and transmitted + /// to a remote RTCRtpReceiver. + /// + RTCRtpSendParameters getParameters(); + + /// + /// The setParameters method updates how track is encoded and + /// transmitted to a remote peer. + /// + Promise setParameters(RTCRtpSendParameters parameters) throws (RTCError); + + /// + /// Attempts to replace the RTCRtpSender's current track with + /// another track provided (or with a null track), without + /// renegotiation. + /// + Promise replaceTrack(MediaStreamTrack withTrack); + }; + } +} diff --git a/webrtc/idl/RtpTransceiver.idl b/webrtc/idl/RtpTransceiver.idl new file mode 100644 index 00000000..25487edc --- /dev/null +++ b/webrtc/idl/RtpTransceiver.idl @@ -0,0 +1,147 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + /// + /// The RTCRtpTransceiver interface represents a combination + /// of an RTCRtpSender and an RTCRtpReceiver that share a + /// common mid. As defined in [JSEP] (section 3.4.1.), an + /// RTCRtpTransceiver is said to be associated with a media + /// description if its mid property is non-null; otherwise + /// it is said to be disassociated. Conceptually, an + /// associated transceiver is one that's represented in the + /// last applied session description. + /// + [disposable] + interface RTCRtpTransceiver + { + [constructor, delete] + void RTCRtpTransceiver(); + + /// + /// Gets the mid attribute is the mid negotatiated and present + /// in the local and remote descriptions as defined in + /// [JSEP] (section 5.2.1. and section 5.3.1.). Before + /// negotiation is complete, the mid value may be null. + /// After rollbacks, the value may change from a non-null + /// value to null. + /// + [getter] + string mid; + + /// + /// Gets the the sender attribute exposes the RTCRtpSender corresponding + /// to the RTP media that may be sent with mid = mid. On getting, the + /// attribute MUST return the value of the [[Sender]] slot. + /// + [getter] + RTCRtpSender sender; + + /// + /// Gets the the receiver attribute is the RTCRtpReceiver corresponding + /// to the RTP media that may be received with mid = mid. On getting the + // attribute MUST return the value of the [[Receiver]] slot. + /// + [getter] + RTCRtpReceiver receiver; + + /// + /// Gets the the stopped attribute indicates that the sender of this + /// transceiver will no longer send, and that the receiver will no longer + /// receive. It is true if either stop has been called or if setting the + /// local or remote description has caused the RTCRtpTransceiver to be + /// stopped. On getting, this attribute MUST return the value of the + /// [[Stopped]] slot. + /// + [getter] + bool stopped; + + /// + /// Gets or sets the direction attribute as defined in [JSEP] (section 4.2.4.), + /// the direction attribute indicates the preferred direction of this transceiver, + /// which will be used in calls to createOffer and createAnswer. An update of + /// directionality does not take effect immediately. Instead, future calls to + /// createOffer and createAnswer mark the corresponding media description as + /// sendrecv, sendonly, recvonly or inactive as defined in [JSEP] (section 5.2.2. + /// and section 5.3.2.) + /// + [getter, setter] + RTCRtpTransceiverDirection direction; + + /// + /// Gets the the current direction as defined in [JSEP] (section 4.2.5.), the + /// currentDirection attribute indicates the current direction negotiated for + /// this transceiver. The value of currentDirection is independent of the value + /// of RTCRtpEncodingParameters.active since one cannot be deduced from the + /// other. If this transceiver has never been represented in an offer/answer + /// exchange, or if the transceiver is stopped, the value is null. On getting, + /// this attribute MUST return the value of the [[CurrentDirection]] slot. + /// + [getter, optional] + RTCRtpTransceiverDirection currentDirection; + + /// + /// The stop method irreversibly stops the RTCRtpTransceiver. The sender of this + /// transceiver will no longer send, the receiver will no longer receive. Calling + /// stop() updates the negotiation-needed flag for the RTCRtpTransceiver's + /// associated RTCPeerConnection. + /// + void stop(); + + /// + /// The setCodecPreferences method overrides the default codec preferences used by + /// the user agent. When generating a session description using either createOffer or + /// createAnswer, the user agent MUST use the indicated codecs, in the order + /// specified in the codecs argument, for the media section corresponding to this RTCRtpTransceiver. + /// + /// This method allows applications to disable the negotiation of specific codecs. + /// It also allows an application to cause a remote peer to prefer the codec that appears + /// first in the list for sending. + /// + /// Codec preferences remain in effect for all calls to createOffer and createAnswer that + /// include this RTCRtpTransceiver until this method is called again. Setting codecs + /// to an empty sequence resets codec preferences to any default value. + /// + /// The codecs sequence passed into setCodecPreferences can only contain codecs + /// that are returned by RTCRtpSender.getCapabilities(kind) or + /// RTCRtpReceiver.getCapabilities(kind), where kind is the kind of the + /// RTCRtpTransceiver on which the method is called. Additionally, the + /// RTCRtpCodecCapability dictionary members cannot be modified. If codecs + /// does not fulfill these requirements, the user agent MUST throw an InvalidAccessError. + /// + void setCodecPreferences(RTCRtpCodecCapabilityList codecs) throws (RTCError); + }; + } +} diff --git a/webrtc/idl/SessionDescription.idl b/webrtc/idl/SessionDescription.idl new file mode 100644 index 00000000..fa1faeb0 --- /dev/null +++ b/webrtc/idl/SessionDescription.idl @@ -0,0 +1,75 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + [dictionary] + struct RTCSessionDescriptionInit { + /// + /// Gets or sets the sdp type. + /// + RTCSdpType type; + /// + /// Gets or sets the string representation of the SDP [SDP]; if type is "rollback", this member is unused. + /// + string sdp; + }; + + /// + /// The RTCSessionDescription class is used by RTCPeerConnection to + /// expose local and remote session descriptions. + /// + interface RTCSessionDescription + { + /// + /// Constructs an instance of an RTCSessionDescription from a string + /// representation of the session description. + /// + [constructor, default] + void RTCSessionDescription(RTCSessionDescriptionInit init) throws (RTCError); + + /// + /// Gets the SDP type of this RTCSessionDescription. This property + /// may only be obtained if the signaling type is SDP. + /// + [getter] + RTCSdpType sdpType; + + /// + /// Gets the string representation of the SDP [RFC3264] or JSON. + /// + [getter] + string sdp; + }; + } +} diff --git a/webrtc/idl/StatsProvider.idl b/webrtc/idl/StatsProvider.idl new file mode 100644 index 00000000..c5501106 --- /dev/null +++ b/webrtc/idl/StatsProvider.idl @@ -0,0 +1,55 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + /// + /// The RTCStatsProvider interface enables the retrieval of statistics. + /// + [notconstructable] + interface RTCStatsProvider + { + typedef zs::PromiseWith PromiseWithStatsReport; + + /// + /// Gets an awaitable RTCStatsReport object that will contain a set of + /// statistics objects for the inspected object. A null RTCStatsReport + /// return is possible if the object declined the request to inspect + /// statistics at this time. An RTCStatsReport containing no statistics + /// objects indicates that no inspectable statistics are available at + /// this time. + /// + PromiseWithStatsReport getStats(RTCStatsTypeSet statTypes) throws (RTCError); + }; + } +} diff --git a/webrtc/idl/StatsReport.idl b/webrtc/idl/StatsReport.idl new file mode 100644 index 00000000..486502e8 --- /dev/null +++ b/webrtc/idl/StatsReport.idl @@ -0,0 +1,1810 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + typedef uint32 SsrcType; + typedef uint8 PayloadType; + typedef std::list SsrcTypeList; + + /// + /// The RTCStatsTypeSet contains a list of stats types to be collected. + /// + struct RTCStatsTypeSet + { + typedef std::set EnumSet; + + /// + /// Constructs an empty instance of an RTCStatsTypeSet object. + /// + [constructor, default] + void RTCStatsTypeSet(); + /// + /// Constructs an instance of an RTCStatsTypeSet object given a set of types types to collect. + /// + [constructor, altname(RTCStatsTypeSetWithValues)] + void RTCStatsTypeSet(EnumSet values); + + bool hasStatType(RTCStatsType type); + }; + + /// + /// An RTCStats dictionary represents the stats object constructed + /// by inspecting a specific monitored object. The RTCStats dictionary + /// is a base type that specifies as set of default attributes, such + /// as timestamp and type. Specific stats are added by extending the + /// RTCStats dictionary. + /// + struct RTCStats + { + /// + /// Gets the timestamp, of type DOMHighResTimeStamp [HIGHRES-TIME], + /// associated with this object. The time is relative to the UNIX epoch + /// (Jan 1, 1970, UTC). For statistics that came from a remote source + /// (e.g., from received RTCP packets), timestamp represents the time at + /// which the information arrived at the local endpoint. The remote + /// timestamp can be found in an additional field in an RTCStats-derived + /// dictionary, if applicable. + /// + [getter] + Time timestamp; + + /// + /// Gets the type of this object. + /// + /// The type attribute MUST be initialized to the name of the most specific + /// type this RTCStats dictionary represents. + /// + [optional, getter] + RTCStatsType statsType; + + /// + /// Gets the type of statistics object when the type is not a + /// pre-known type. + /// + [getter] + string statsTypeOther; + + /// + /// A unique id that is associated with the object that was inspected + /// to produce this RTCStats object. Two RTCStats objects, extracted + /// from two different RTCStatsReport objects, MUST have the same id + /// if they were produced by inspecting the same underlying object. + /// User agents are free to pick any format for the id as long as it + /// meets the requirements above. + /// + [getter] + string id; + + [constructor, default, delete] + void RTCStats(); + }; + + /// + /// Stats that apply to any end of any RTP stream. + /// + struct RTCRtpStreamStats : RTCStats + { + /// + /// Gets the 32-bit unsigned integer value per [RFC3550] used to identify the + //// source of the stream of RTP packets that this stats object concerns. + /// + [optional, getter] + SsrcType ssrc; + + /// + /// Gets either "audio" or "video". This must match the media type part of + /// the information in the corresponding codec member of RTCCodecStats, + /// and must match the "kind" attribute of the related MediaStreamTrack. + /// + [getter] + string kind; + + /// + /// Gets a unique identifier that is associated to the object that + /// was inspected to produce the RTCTransportStats associated with this RTP stream. + /// + [getter] + string transportId; + + /// + /// Gets a unique identifier that is associated to the object that was + /// inspected to produce the RTCCodecStats associated with this RTP stream. + /// + [getter] + string codecId; + + /// + /// Gets the count of the total number of Full Intra Request (FIR) packets received by the sender. + /// This metric is only valid for video and is sent by receiver. Calculated as + /// defined in [RFC5104] section 4.3.1. and does not use the metric indicated + /// in [RFC2032], because it was deprecated by [RFC4587]. + /// + [getter] + unsigned long firCount; + + /// + /// Gets the count of the total number of Picture Loss Indication (PLI) packets received + /// by the sender. This metric is only valid for video and is sent by receiver. + /// Calculated as defined in [RFC4585] section 6.3.1. + /// + [getter] + unsigned long pliCount; + + /// + /// Gets the count of the total number of Negative ACKnowledgement (NACK) packets received + /// by the sender and is sent by receiver. Calculated as defined in [RFC4585] + /// section 6.2.1. + /// + [getter] + unsigned long nackCount; + + /// + /// Gets the count of the total number of Slice Loss Indication (SLI) packets received by + /// the sender. This metric is only valid for video and is sent by receiver. + /// Calculated as defined in [RFC4585] section 6.3.2. + /// + [getter] + unsigned long sliCount; + + /// + /// Gets the sum of the QP values of frames passed. The count of frames is in + /// framesDecoded for inbound stream stats, and in framesEncoded for + /// outbound stream stats. + /// + /// The definition of QP value depends on the codec; for VP8, the QP value + /// is the value carried in the frame header as the syntax element + /// "y_ac_qi", and defined in [RFC6386] section 19.2. Its range is + /// 0..127. + /// + /// Note that the QP value is only an indication of quantizer values used; + /// many formats have ways to vary the quantizer value within the frame. + /// + /// Only valid for video. + /// + [getter] + unsigned long long qpSum; + + [constructor, default, delete] + void RTCRtpStreamStats(); + }; + + /// + /// The RTCCodecStats object contains information about the codec associated + /// with an RTP stream. + /// + struct RTCCodecStats : RTCStats + { + /// + /// Gets the payload type as used in RTP encoding or decoding. + /// + [optional, getter] + PayloadType payloadType; + + /// + /// Gets "encode" or "decode", depending on whether this object represents + /// a media format that the implementation is prepared to encode or decode. + /// + [getter, optional] + RTCCodecType codecType; + + /// + /// Gets the unique identifier of the transport on which this codec is being used, which can be used to look up the corresponding RTCTransportStats object. + /// + string transportId; + + /// + /// Gets the codec MIME media type/subtype. e.g., video/vp8 or equivalent. + /// + [getter] + string mimeType; + + /// + /// Gets the media sampling rate. + /// + [getter] + unsigned long clockRate; + + /// + /// Gets the number of channels. Use 2 for stereo, missing for most other cases. + /// + [optional, getter] + unsigned long channels; + + /// + /// Gets the a=fmtp line in the SDP corresponding to the codec, i.e., after the + /// colon following the PT. This defined by [JSEP] in Section 5.7. + /// + [getter] + string sdpFmtpLine; + + /// + /// Gets the identifier for the implementation used. This is useful for + /// diagnosing interoperability issues. + /// + [getter] + string implementation; + + [constructor, default, delete] + void RTCCodecStats(); + }; + + /// + /// The RTCReceivedRtpStreamStats object represents the measurement metrics + /// for the incoming RTP media stream. + /// + struct RTCReceivedRtpStreamStats : RTCRtpStreamStats + { + /// + /// Gets the total number of RTP packets received for this SSRC. At the + /// receiving endpoint, this is calculated as defined in [RFC3550] section + /// 6.4.1. At the sending endpoint the packetsReceived can be calculated + /// by subtracting the packets lost from the expected Highest Sequence + /// Number reported in the RTCP Sender Report as discussed in Appendix + /// A.3. in [RFC3550]. + /// + [getter] + unsigned long packetsReceived; + + /// + /// Gets the total number of RTP packets lost for this SSRC. Calculated as + /// defined in [RFC3550] section 6.4.1. Note that because of how this is + /// estimated, it can be negative if more packets are received than sent. + /// + [getter] + unsigned long packetsLost; + + /// + /// Gets the packet Jitter measured in seconds for this SSRC. + /// Calculated as defined in section 6.4.1. of [RFC3550]. + /// + [getter] + double jitter; + + [getter] + /// + /// Gets the cumulative number of RTP packets discarded by the jitter buffer + /// due to late or early-arrival, i.e., these packets are not played out. + /// RTP packets discarded due to packet duplication are not reported in + /// this metric [XRBLOCK-STATS]. Calculated as defined in [RFC7002] + /// section 3.2 and Appendix A.a. + /// + unsigned long packetsDiscarded; + + [getter] + /// + /// Gets the cumulative number of lost RTP packets repaired after applying + /// an error-resilience mechanism [XRBLOCK-STATS]. It is measured for + /// the primary source RTP packets and only counted for RTP packets that + /// have no further chance of repair. To clarify, the value is upper-bound + /// to the cumulative number of lost packets. Calculated as defined in + /// [RFC7509] section 3.1 and Appendix A.b. + /// + unsigned long packetsRepaired; + + [getter] + /// + /// Gets the cumulative number of RTP packets lost during loss bursts, + /// Appendix A (c) of [RFC6958]. + /// + unsigned long burstPacketsLost; + + [getter] + /// + /// Gets the cumulative number of RTP packets discarded during discard + /// bursts, Appendix A (b) of [RFC7003]. + /// + unsigned long burstPacketsDiscarded; + + [getter] + /// + /// Gets the cumulative number of bursts of lost RTP packets, Appendix A (e) of [RFC6958]. + /// + /// [RFC3611] recommends a Gmin (threshold) value of 16 for classifying a sequence + /// of packet losses or discards as a burst. + /// + unsigned long burstLossCount; + + [getter] + /// + /// Gets the cumulative number of bursts of discarded RTP packets, Appendix A (e) of [RFC8015]. + /// + unsigned long burstDiscardCount; + + [getter] + /// + /// Gets the fraction of RTP packets lost during bursts to the total number of RTP packets + /// expected in the bursts. As defined in Appendix A (a) of [RFC7004], however, the + /// actual value is reported without multiplying by 32768. + /// + double burstLossRate; + + [getter] + /// + /// Gets the fraction of RTP packets discarded during bursts to the total number of RTP + /// packets expected in bursts. As defined in Appendix A (e) of [RFC7004], however, + /// the actual value is reported without multiplying by 32768. + /// + double burstDiscardRate; + + [getter] + /// + /// Gets the fraction of RTP packets lost during the gap periods. Appendix A (b) of + /// [RFC7004], however, the actual value is reported without multiplying by 32768. + /// + double gapLossRate; + + [getter] + /// + /// Gets the fraction of RTP packets discarded during the gap periods. Appendix A (f) + /// of [RFC7004], however, the actual value is reported without multiplying by 32768. + /// + double gapDiscardRate; + + [constructor, default, delete] + void RTCReceivedRtpStreamStats(); + }; + + /// + /// The RTCInboundRtpStreamStats dictionary represents the measurement metrics + /// for the incoming RTP media stream. The timestamp reported in the statistics + /// object is the time at which the data was sampled. + /// + struct RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats { + /// + /// Gets the identifier of the stats object representing the receiving track, + /// an RTCReceiverAudioTrackAttachmentStats or RTCReceiverVideoTrackAttachmentStats. + /// + [getter] + string trackId; + + /// + /// Gets the stats ID used to look up the RTCAudioReceiverStats or + /// RTCVideoReceiverStats object receiving this stream. + /// + [getter] + string receiverId; + + /// + /// Gets the remoteId is used for looking up the remote + /// RTCRemoteOutboundRtpStreamStats object for the same SSRC. + /// + [getter] + string remoteId; + + /// + /// Gets the total number of frames correctly decoded for this SSRC, i.e., + /// frames that would be displayed if no frames are dropped. Only valid for video. + /// + [getter, optional] + unsigned long framesDecoded; + + /// + /// Gets the timestamp at which the last packet was received for + /// this SSRC. This differs from timestamp, which represents the time at + /// which the statistics were generated by the local endpoint. + /// + [getter] + Time lastPacketReceivedTimestamp; + + /// + /// Gets the average RTCP interval between two consecutive compound RTCP + /// packets. This is calculated by the sending endpoint when sending + /// compound RTCP reports. Compound packets must contain at least a RTCP + /// RR or SR packet and an SDES packet with the CNAME item. + /// + [getter] + double averageRtcpInterval; + + /// + /// Gets the total number of RTP FEC packets received for this SSRC. + /// This counter can also be incremented when receiving FEC packets + /// in-band with media packets (e.g., with Opus). + /// + [getter] + unsigned long fecPacketsReceived; + + /// + /// Gets the total number of bytes received for this SSRC. Calculated as + /// defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long long bytesReceived; + + /// + /// Gets the cumulative number of RTP packets that failed to be + /// decrypted according to the procedures in [RFC3711]. These packets + /// are not counted by packetsDiscarded. + /// + [getter] + unsigned long packetsFailedDecryption; + + /// + /// Gets the cumulative number of packets discarded because they are + /// duplicated. Duplicate packets are not counted in packetsDiscarded. + /// + /// Duplicated packets have the same RTP sequence number and content as + /// a previously received packet. If multiple duplicates of a packet are + /// received, all of them are counted. + /// + /// An improved estimate of lost packets can be calculated by adding + /// packetsDuplicated to packetsLost; this will always result in a + /// positive number, but not the same number as RFC 3550 would calculate. + /// + [getter] + unsigned long packetsDuplicated; + + /// + /// Total number of packets received for this SSRC, per Differentiated + /// Services code point (DSCP) [RFC2474]. DSCPs are identified as decimal + /// integers in string form. Note that due to network remapping and bleaching, + /// these numbers are not expected to match the numbers seen on sending. + /// Not all OSes make this information available. + /// + [getter] + std::map perDscpPacketsReceived; + + [constructor, default, delete] + void RTCInboundRtpStreamStats(); + }; + + /// + /// The RTCRemoteInboundRtpStreamStats dictionary represents the remote endpoint's + /// measurement metrics for a particular incoming RTP stream (corresponding to an + /// outgoing RTP stream at the sending endpoint). The timestamp reported in the + /// statistics object is the time at which the corresponding RTCP RR was received. + /// + struct RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats { + /// + /// Gets the localId is used for looking up the local RTCOutboundRtpStreamStats object for the same SSRC. + /// + [getter] + string localId; + + /// + /// Gets the estimated round trip time for this SSRC based on the RTCP timestamps in the + /// RTCP Receiver Report (RR) and measured in seconds. Calculated as defined in section + /// 6.4.1. of [RFC3550]. If no RTCP Receiver Report is received with a DLSR value other than + /// 0, the round trip time is left undefined. + /// + [getter] + double roundTripTime; + + /// + /// Gets the fraction packet loss reported for this SSRC. Calculated as defined in [RFC3550] + /// section 6.4.1 and Appendix A.3. + /// + [getter] + double fractionLost; + + [constructor, default, delete] + void RTCRemoteInboundRtpStreamStats(); + }; + + /// + /// Stats measured at the sending end of an RTP stream, known either because they're + /// measured locally or because they're received via RTCP, usually in an RTCP Sender Report (SR). + /// + struct RTCSentRtpStreamStats : RTCRtpStreamStats { + /// + /// Gets the total number of RTP packets sent for this SSRC. Calculated as + /// defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long packetsSent; + + /// + /// Gets the total number of RTP packets for this SSRC that have been discarded + /// due to socket errors, i.e. a socket error occured when handing the packets + /// to the socket. This might happen due to various reasons, including full + /// buffer or no available memory. + /// + [getter] + unsigned long packetsDiscardedOnSend; + + /// + /// Gets the total number of RTP FEC packets sent for this SSRC. This counter can + /// also be incremented when sending FEC packets in-band with media packets + /// (e.g., with Opus). + /// + [getter] + unsigned long fecPacketsSent; + + /// + /// Gets the total number of bytes sent for this SSRC. Calculated as defined in + /// [RFC3550] section 6.4.1. + /// + [getter] + unsigned long long bytesSent; + + /// + /// Gets the total number of bytes for this SSRC that have been discarded due to + /// socket errors, i.e. a socket error occured when handing the packets containing + /// the bytes to the socket. This might happen due to various reasons, including full + /// buffer or no available memory. Calculated as defined in [RFC3550] section 6.4.1. + /// + [getter] + unsigned long long bytesDiscardedOnSend; + + /// + /// Constructs an empty instance of an RTCSentRtpStreamStats object. + /// + [constructor, default] + void RTCSentRtpStreamStats(); + }; + + /// + /// The RTCOutboundRtpStreamStats dictionary represents the measurement + /// metrics for the outgoing RTP stream. The timestamp reported in the statistics + /// object is the time at which the data was sampled. + /// + struct RTCOutboundRtpStreamStats : RTCSentRtpStreamStats + { + + /// + /// Gets the identifier of the stats object representing the current track + /// attachment to the sender of this stream, an RTCSenderAudioTrackAttachmentStats + /// or RTCSenderVideoTrackAttachmentStats. + /// + [getter] + string trackId; + + /// + /// Gets the stats ID used to look up the RTCAudioSenderStats or RTCVideoSenderStats + /// object sending this stream. + /// + [getter] + string senderId; + + /// + /// Gets the remoteId is used for looking up the remote RTCRemoteInboundRtpStreamStats + /// object for the same SSRC. + /// + [getter] + string remoteId; + + /// + /// Gets the timestamp at which the last packet was sent for this SSRC. + /// This differs from timestamp, which represents the time at which the statistics + /// were generated by the local endpoint. + /// + [getter] + Time lastPacketSentTimestamp; + + /// + /// Gets the current target bitrate configured for this particular SSRC and is + /// the Transport Independent Application Specific (TIAS) bitrate [RFC3890]. + /// Typically, the target bitrate is a configuration parameter provided to the + /// codec's encoder and does not count the size of the IP or other transport layers + /// like TCP or UDP. It is measured in bits per second and the bitrate is calculated + /// over a 1 second window. + /// + [getter] + double targetBitrate; + + /// + /// Gets the total number of frames successfully + /// encoded for this RTP media stream. Only valid for video. + /// + [getter, optional] + unsigned long framesEncoded; + + /// + /// Gets the total number of milliseconds that has been spent encoding the framesEncoded frames + /// of this stream. The average encode time can be calculated by dividing this value + /// with framesEncoded. The time it takes to encode one frame is the time passed between + /// feeding the encoder a frame and the encoder returning encoded data for that frame. + /// This does not include any additional time it may take to packetize the resulting data. + /// + [getter] + Milliseconds totalEncodeTime; + + /// + /// Gets the average RTCP interval between two consecutive compound RTCP packets. + /// This is calculated by the sending endpoint when sending compound RTCP reports. + /// Compound packets must contain at least a RTCP RR or SR packet and an SDES packet + /// with the CNAME item. + /// + [getter] + double averageRtcpInterval; + + /// + /// Gets the current reason for limiting the resolution and/or + /// framerate, or "none" if not limited. Only valid for video. + /// + [getter, optional] + RTCQualityLimitationReason qualityLimitationReason; + + /// + /// Gets a record of the total time, in milliseconds, that this + /// stream has spent in each quality limitation state. The record includes a + /// mapping for all RTCQualityLimitationReason types, including "none". Only + /// valid for video. + /// + /// The sum of all entries minus qualityLimidationDurations["none"] gives the + /// total time that the stream has been limited. + /// + [getter] + std::map qualityLimitationDurations; + + /// + /// Gets the total number of packets sent for this SSRC, per DSCP. DSCPs are identified + /// as decimal integers in string form. + /// + [getter] + std::map perDscpPacketsSent; + + [constructor, default, delete] + void RTCOutboundRtpStreamStats(); + }; + + /// + /// The RTCRemoteOutboundRtpStreamStats dictionary represents the remote + /// endpoint's measurement metrics for its outgoing RTP stream (corresponding + /// to an outgoing RTP stream at the sending endpoint). The timestamp reported + /// in the statistics object is the time at which the corresponding RTCP SR was received. + /// + struct RTCRemoteOutboundRtpStreamStats : RTCSentRtpStreamStats { + /// + /// Gets the localId is used for looking up the local + /// RTCInboundRtpStreamStats object for the same SSRC. + /// + [getter] + string localId; + + /// + /// Gets remoteTimestamp, of type DOMHighResTimeStamp [HIGHRES-TIME], + /// representing the remote timestamp at which these statistics were + /// sent by the remote endpoint. This differs from timestamp, which + /// represents the time at which the statistics were generated or + /// received by the local endpoint. The remoteTimestamp, if present, + /// is derived from the NTP timestamp in an RTCP Sender Report (SR) + /// packet, which reflects the remote endpoint's clock. That clock + /// may not be synchronized with the local clock. + /// + [getter] + Time remoteTimestamp; + + [constructor, default, delete] + void RTCRemoteOutboundRtpStreamStats(); + }; + + /// + /// The RTCRtpContributingSourceStats dictionary represents the measurement + /// metrics for a contributing source (CSRC) that is contributing to an + /// incoming RTP stream. Each contributing source produces a stream of + /// RTP packets, which are combined by a mixer into a single stream of + /// RTP packets that is ultimately received by the WebRTC endpoint. + /// Information about the sources that contributed to this combined + /// stream may be provided in the CSRC list or [RFC6465] header + /// extension of received RTP packets. The timestamp of this stats + /// object is the most recent time an RTP packet the source contributed + /// to was received and counted by packetsContributedTo. + /// + struct RTCRtpContributingSourceStats : RTCStats { + /// + /// Gets the SSRC identifier of the contributing source represented by this + /// stats object, as defined by [RFC3550]. It is a 32-bit unsigned integer + /// that appears in the CSRC list of any packets the relevant source contributed to. + /// + [getter] + unsigned long contributorSsrc; + + /// + /// Gets the ID of the RTCInboundRtpStreamStats object representing the + /// inbound RTP stream that this contributing source is contributing to. + /// + [getter] + string inboundRtpStreamId; + + /// + /// Gets the total number of RTP packets that this contributing source contributed + /// to. This value is incremented each time a packet is counted by + /// RTCInboundRtpStreamStats.packetsReceived, and the packet's CSRC list + /// (as defined by [RFC3550] section 5.1) contains the SSRC identifier + /// of this contributing source, contributorSsrc. + /// + [getter] + unsigned long packetsContributedTo; + + /// + /// Gets the value of audioLevel is between 0..1 (linear), where 1.0 represents 0 + /// dBov, 0 represents silence, and 0.5 represents approximately 6 dBSPL + /// change in the sound pressure level from 0 dBov. Present if the last received + /// RTP packet that this source contributed to contained an [RFC6465] + /// mixer-to-client audio level header extension. + /// + /// The [RFC6465] header extension contains values in the range 0..127, in + /// units of -dBov, where 127 represents silence. To convert these values + /// to the linear 0..1 range of audioLevel, a value of 127 is converted to + /// 0, and all other values are converted using the equation: + /// f(rfc6465_level) = 10^(-rfc6465_level/20). + /// + [getter, optional] + double audioLevel; + + [constructor, default, delete] + void RTCRtpContributingSourceStats(); + }; + + /// + /// Statistics related to the RTCPeerConnection object. + /// + struct RTCPeerConnectionStats : RTCStats { + + /// + /// Gets the number of unique DataChannels that have + /// entered the "open" state during their lifetime. + /// + [getter] + unsigned long dataChannelsOpened; + + /// + /// Gets the number of unique DataChannels that have + /// left the "open" state during their lifetime (due to being + /// closed by either end or the underlying transport being closed). + /// DataChannels that transition from "connecting" to "closing" or + /// "closed" without ever being "open" are not counted in this number. + /// + [getter] + unsigned long dataChannelsClosed; + + /// + /// Gets the number of unique DataChannels returned from a successful + /// createDataChannel() call on the RTCPeerConnection. If the underlying + /// data transport is not established, these may be in the "connecting" state. + /// + [getter] + unsigned long dataChannelsRequested; + + /// + /// Gets the number of unique DataChannels signaled in a "datachannel" + /// event on the RTCPeerConnection. + /// + [getter] + unsigned long dataChannelsAccepted; + + [constructor, default, delete] + void RTCPeerConnectionStats(); + }; + + /// + /// The RTCMediaStreamStats object contains the statistics for the + /// RTCMediaStream object. + /// + struct RTCMediaStreamStats : RTCStats + { + /// + /// Gets the stream.id property. + /// + [getter] + string streamIdentifier; + + /// + /// Gets the id of the stats object, not the track.id. + /// + [getter] + StringList trackIds; + + [constructor, default, delete] + void RTCMediaStreamStats(); + }; + + /// + /// Contains statistics related to a specific MediaStreamTrack's attachment to an + /// RTCRtpSender and the corresponding media-level metrics. + /// + struct RTCMediaHandlerStats : RTCStats { + + /// + /// Gets the id property of the track. + /// + [getter] + string trackIdentifier; + + /// + /// Gets true if the source is remote, for instance if it is sourced from + /// another host via an RTCPeerConnection. False otherwise. Only applicable + /// for 'track' stats. + /// + [getter, optional] + bool remoteSource; + + /// + /// Gets the "ended" state of the track. + /// + [getter] + bool ended; + + /// + /// Gets either "audio" or "video". This reflects the "kind" + /// attribute of the MediaStreamTrack, see [GETUSERMEDIA]. + /// + [getter] + string kind; + + /// + /// Gets the priority set for the track. It is specified + /// in [RTCWEB-TRANSPORT], Section 4. + /// + [getter] + RTCPriorityType priority; + + [constructor, default, delete] + void RTCMediaHandlerStats(); + }; + + /// + /// Contains statistics related to a specific MediaStreamTrack's attachment to + /// an RTCRtpSender and the corresponding media-level metrics. It is accessed + /// by either RTCSenderVideoTrackAttachmentStats or + /// RTCSenderAudioTrackAttachmentStats, both inherited from RTCMediaHandlerStats. + /// + struct RTCVideoHandlerStats : RTCMediaHandlerStats { + + /// + /// Gets the width of the last processed frame for this track. + /// Before the first frame is processed this attribute is missing. + /// + [getter] + unsigned long frameWidth; + + /// + /// Gets the height of the last processed frame for this track. + /// Before the first frame is processed this attribute is missing. + /// + [getter] + unsigned long frameHeight; + + /// + /// Gets the nominal FPS value before the degradation preference + /// is applied. It is the number of complete frames in the last + /// second. For sending tracks it is the current captured FPS + /// and for the receiving tracks it is the current decoding framerate. + /// + [getter] + double framesPerSecond; + }; + + /// + /// An RTCVideoSenderStats object represents the stats about one + /// video sender of a RTCPeerConnection object for which one calls + /// getStats. + /// + /// It appears in the stats as soon as the sender is added by either + /// addTrack or addTransceiver, or by media negotiation. + /// + struct RTCVideoSenderStats : RTCVideoHandlerStats { + + /// + /// Gets the total number of frames captured, before encoding, + /// for this RTCRtpSender (or for this MediaStreamTrack, if type is + /// "track"). For example, if type is "sender" and this sender's track + /// represents a camera, then this is the number of frames produced by the + /// camera for this track while being sent by this sender, combined with + /// the number of frames produced by all tracks previously attached to this + /// sender while being sent by this sender. Framerates can vary due to + /// hardware limitations or environmental factors such as lighting conditions. + /// + [getter] + unsigned long framesCaptured; + + /// + /// Gets the total number of frames sent by this RTCRtpSender (or for + /// this MediaStreamTrack, if type is "track"). + /// + [getter] + unsigned long framesSent; + + /// + /// Gets the total number of huge frames sent by this RTCRtpSender + /// (or for this MediaStreamTrack, if type is "track"). Huge frames, + /// by definition, are frames that have an encoded size at least 2.5 times + /// the average size of the frames. The average size of the frames is defined + /// as the target bitrate per second divided by the target fps at the time the + /// frame was encoded. These are usually complex to encode frames with a lot + /// of changes in the picture. This can be used to estimate, e.g slide + /// changes in the streamed presentation. If a huge frame is also a key + /// frame, then both counters hugeFramesSent and keyFramesSent are incremented. + /// + /// The multiplier of 2.5 is choosen from analyzing encoded frame sizes for a + /// sample presentation using webrtc standalone implementation. 2.5 is a + /// reasonably large multiplier which still caused all slide change events to be + /// identified as a huge frames. It, however, produced 1.4% of false positive + /// slide change detections which is deemed reasonable. + /// + [getter] + unsigned long hugeFramesSent; + + /// + /// Gets the total number of key frames sent by this RTCRtpSender (or for + /// this MediaStreamTrack, if type is "track"), such as Infra-frames in VP8 + /// [RFC6386] or I-frames in H.264 [RFC6184]. This is a subset of framesSent. + /// framesSent - keyFramesSent gives you the number of delta frames sent. + /// + [getter] + unsigned long keyFramesSent; + + [constructor, default, delete] + void RTCVideoSenderStats(); + }; + + /// + /// An RTCSenderVideoTrackAttachmentStats object represents the stats about one attachment of a + /// video MediaStreamTrack to the RTCPeerConnection object for which one calls getStats. + /// + /// It appears in the stats as soon as it is attached (via addTrack, via addTransceiver, via + /// replaceTrack on an RTCRtpSender object). + /// + /// If a video track is attached twice (via addTransceiver or replaceTrack), there will be + /// two RTCSenderVideoTrackAttachmentStats objects, one for each attachment. They will have + /// the same "trackIdentifier" attribute, but different "id" attributes. + /// + /// If the track is detached from the RTCPeerConnection (via removeTrack or via replaceTrack), + /// it continues to appear, but with the "objectDeleted" member set to true. + /// + struct RTCSenderVideoTrackAttachmentStats : RTCVideoSenderStats { + + [constructor, default, delete] + void RTCSenderVideoTrackAttachmentStats(); + }; + + /// + /// An RTCVideoReceiverStats object represents the stats about one video receiver + /// of a RTCPeerConnection object for which one calls getStats. + /// + /// It appears in the stats as soon as the RTCRtpReceiver is added by either + /// addTrack or addTransceiver, or by media negotiation. + /// + struct RTCVideoReceiverStats : RTCVideoHandlerStats { + + /// + /// Gets the estimated playout time of this receiver's track. The playout time + /// is the NTP timestamp of the last playable video frame that has a known timestamp + /// (from an RTCP SR packet mapping RTP timestamps to NTP timestamps), extrapolated + /// with the time elapsed since it was ready to be played out. This is the "current + /// time" of the track in NTP clock time of the sender and can be present even if + /// there is no video currently playing. + /// + /// This can be useful for estimating how much audio and video is out of sync for + /// two tracks from the same remote source, audioTrackStats.estimatedPlayoutTimestamp - + /// videoTrackStats.estimatedPlayoutTimestamp. + /// + [getter] + Time estimatedPlayoutTimestamp; + + /// + /// Gets the sum of the time, in milliseconds, each frame takes from the time it is + /// received and to the time it exits the jitter buffer. This increases upon frames + /// exiting, having completed their time in the buffer + /// (incrementing jitterBufferEmittedCount). The average jitter buffer delay can + /// be calculated by dividing the jitterBufferDelay with the jitterBufferEmittedCount. + /// + [getter] + Milliseconds jitterBufferDelay; + + /// + /// Gets the total number of frames that have come out of the jitter buffer + /// (increasing jitterBufferDelay). + /// + [getter] + unsigned long long jitterBufferEmittedCount; + + /// + /// Gets + /// + [getter] + unsigned long framesReceived; + + /// + /// Gets the total number of complete frames received for this receiver. This metric + /// is incremented when the complete frame is received. + /// + [getter] + unsigned long keyFramesReceived; + + /// + /// Gets the total number of complete key frames received for this MediaStreamTrack, + /// such as Infra-frames in VP8 [RFC6386] or I-frames in H.264 [RFC6184]. This is a + /// subset of framesReceived. framesReceived - keyFramesReceived gives you the number + /// of delta frames received. This metric is incremented when the complete key frame + /// is received. It is not incremented if a partial key frames is received and sent + /// for decoding, i.e., the frame could not be recovered via retransmission or FEC. + /// + [getter] + unsigned long framesDecoded; + + /// + /// Gets the total number of frames correctly decoded for this SSRC, i.e., frames + /// that would be displayed if no frames are dropped. Only valid for video. + /// + [getter] + unsigned long framesDropped; + + /// + /// Gets the total number of frames dropped predecode or dropped because + /// the frame missed its display deadline for this receiver's track. As defined in Appendix A (g) of [RFC7004]. + /// + [getter] + unsigned long partialFramesLost; + + /// + /// Gets the cumulative number of full frames lost, as defined in Appendix A (i) of [RFC7004]. + /// + [getter] + unsigned long fullFramesLost; + + [constructor, default, delete] + void RTCVideoReceiverStats(); + }; + + /// + /// Contains statistics related to a specific MediaStreamTrack's attachment to + /// an RTCRtpSender and the corresponding media-level metrics. It is accessed + /// by either RTCSenderVideoTrackAttachmentStats or + /// RTCSenderAudioTrackAttachmentStats, both inherited from RTCMediaHandlerStats. + /// + struct RTCAudioHandlerStats : RTCMediaHandlerStats { + + /// + /// Gets the value is between 0..1 (linear), where 1.0 represents 0 dBov, + /// 0 represents silence, and 0.5 represents approximately 6 dBSPL change + /// in the sound pressure level from 0 dBov. + /// + /// The "audio level" value defined in [RFC6464] (as 0..127, where 0 represents + /// 0 dBov, 126 represents -126 dBov and 127 represents silence) is obtained by + /// the calculation given in appendix A of [RFC6465]: informally, + /// level = -round(log10(audioLevel) * 20), with audioLevel 0.0 and values + /// above 127 mapped to 127. + /// + /// The audioLevel represents the output audio level of the track; thus, if + /// the track is sourced from an RTCReceiver, does no audio processing, has a + /// constant level, and has a volume setting of 1.0, the audio level is expected + /// to be the same as the audio level of the source SSRC, while if the volume + /// setting is 0.5, the audioLevel is expected to be half that value. + /// + /// For outgoing audio tracks, the audioLevel is the level of the audio being sent. + /// + /// The audioLevel is averaged over some small interval, using the algorithm + /// described under totalAudioEnergy. The interval used is implementation dependent. + /// + [getter] + double audioLevel; + + /// + /// Gets the value computed as follows: for each audio sample sent/received + /// for this object (and counted by totalSamplesSent or totalSamplesReceived), + /// add the sample's value divided by the highest-intensity encodable value, + /// squared and then multiplied by the duration of the sample in seconds. In + /// other words, duration * Math.pow(energy/maxEnergy, 2). + /// + /// This can be used to obtain a root mean square (RMS) value that uses the same + /// units as audioLevel, as defined in [RFC6464]. It can be converted to these + /// units using the formula Math.sqrt(totalAudioEnergy/totalSamplesDuration). + /// This calculation can also be performed using the differences between the + /// values of two different getStats() calls, in order to compute the average + /// audio level over any desired time interval. In other words, do + /// Math.sqrt((energy2 - energy1)/(duration2 - duration1)). + /// + /// For example, if a 10ms packet of audio is received with an RMS of 0.5 (out + /// of 1.0), this should add 0.5 * 0.5 * 0.01 = 0.0025 to totalAudioEnergy. If + /// another 10ms packet with an RMS of 0.1 is received, this should similarly + /// add 0.0001 to totalAudioEnergy. Then, + /// Math.sqrt(totalAudioEnergy/totalSamplesDuration) becomes + /// Math.sqrt(0.0026/0.02) = 0.36, which is the same value that would be obtained + /// by doing an RMS calculation over the contiguous 20ms segment of audio. + /// + [getter] + double totalAudioEnergy; + + /// + /// Gets whether the last RTP packet sent or played out by this track + /// contained voice activity or not based on the presence of the V bit in the + /// extension header, as defined in [RFC6464]. + /// + /// This value indicates the voice activity in the latest RTP packet played + /// out from a given SSRC, and is defined in the + /// RTCRtpSynchronizationSource.voiceActivityFlag of [[WEBRTC]. + /// + [getter] + bool voiceActivityFlag; + + /// + /// Gets the total duration in seconds of all samples that have sent or received + /// (and thus counted by totalSamplesSent or totalSamplesReceived). Can be used + /// with totalAudioEnergy to compute an average audio level over different intervals. + /// + [getter] + double totalSamplesDuration; + + [constructor, default, delete] + void RTCAudioHandlerStats(); + }; + + + /// + /// An RTCAudioSenderStats object represents the stats about one audio sender + /// of a RTCPeerConnection object for which one calls getStats. + /// + /// + /// It appears in the stats as soon as the RTCRtpSender is added by either addTrack + /// or addTransceiver, or by media negotiation. + /// + struct RTCAudioSenderStats : RTCAudioHandlerStats { + + /// + /// Gets the value calculated in decibels, as defined in [ECHO] (2012) section 3.14. + /// Only present while the sender is sending a track sourced from a microphone where + /// echo cancellation is applied. + /// + [getter, optional] + double echoReturnLoss; + + /// + /// Gets the value calculated in decibels, as defined in [ECHO] (2012) section 3.15. + /// Only present while the sender is sending a track sourced from a microphone where echo cancellation is applied. + /// + [getter, optional] + double echoReturnLossEnhancement; + + /// + /// Gets the total number of samples that have been sent by this sender. + /// + [getter] + unsigned long long totalSamplesSent; + + [constructor, default, delete] + void RTCAudioSenderStats(); + }; + + /// + /// An RTCSenderAudioTrackAttachmentStats object represents the stats about one + /// attachment of an audio MediaStreamTrack to the RTCPeerConnection object for + /// which one calls getStats. + /// + /// It appears in the stats as soon as it is attached (via addTrack, via + /// addTransceiver, via replaceTrack on an RTCRtpSender object). + /// + /// If an audio track is attached twice (via addTransceiver or replaceTrack), + /// there will be two RTCSenderAudioTrackAttachmentStats objects, one for each + /// attachment. They will have the same "trackIdentifier" attribute, but + /// different "id" attributes. + /// + /// If the track is detached from the RTCPeerConnection (via removeTrack or + /// via replaceTrack), it continues to appear, but with the "objectDeleted" member set to true. + /// + struct RTCSenderAudioTrackAttachmentStats : RTCAudioSenderStats { + + [constructor, default, delete] + void RTCSenderAudioTrackAttachmentStats(); + }; + + /// + /// An RTCAudioReceiverStats object represents the stats about one audio receiver + /// of a RTCPeerConnection object for which one calls getStats. + /// + /// It appears in the stats as soon as the RTCRtpReceiver is added by either addTrack + /// or addTransceiver, or by media negotiation. + /// + struct RTCAudioReceiverStats : RTCAudioHandlerStats { + + /// + /// Gets the estimated playout time of this receiver's track. The + /// playout time is the NTP timestamp of the last playable sample that + /// has a known timestamp (from an RTCP SR packet mapping RTP timestamps + /// to NTP timestamps), extrapolated with the time elapsed since it was + /// ready to be played out. This is the "current time" of the track in NTP + /// clock time of the sender and can be present even if there is no audio currently playing. + /// + /// This can be useful for estimating how much audio and video is out of sync for + /// two tracks from the same source, + /// audioTrackStats.estimatedPlayoutTimestamp - videoTrackStats.estimatedPlayoutTimestamp. + /// + [getter] + Time estimatedPlayoutTimestamp; + + /// + /// Gets the sum of the time, in seconds, each sample takes from the time it is + /// received and to the time it exits the jitter buffer. This increases upon samples + /// exiting, having completed their time in the buffer (incrementing + /// jitterBufferEmittedCount). The average jitter buffer delay can be calculated by + /// dividing the jitterBufferDelay with the jitterBufferEmittedCount. + /// + [getter] + Milliseconds jitterBufferDelay; + + /// + /// Gets the total number of samples that have come out of the jitter buffer (increasing jitterBufferDelay). + /// + [getter] + unsigned long long jitterBufferEmittedCount; + + /// + /// Gets the total number of samples that have been received by this receiver. This includes concealedSamples. + /// + [getter] + unsigned long long totalSamplesReceived; + + /// + /// Gets the total number of samples that are concealed samples. A concealed sample is a sample + /// that is based on data that was synthesized to conceal packet loss and does not represent incoming data. + /// + [getter] + unsigned long long concealedSamples; + + /// + /// Gets the number of concealment events. This counter increases every time a concealed sample + /// is synthesized after a non-concealed sample. That is, multiple consecutive concealed samples + /// will increase the concealedSamples count multiple times but is a single concealment event. + /// + [getter] + unsigned long long concealmentEvents; + + [constructor, default, delete] + void RTCAudioReceiverStats(); + }; + + /// + /// Statistics related to each RTCDataChannel id. It is accessed by the RTCDataChannelStats. + /// + struct RTCDataChannelStats : RTCStats { + + /// + /// Gets the "label" value of the RTCDataChannel object. + /// + [getter] + string label; + + /// + /// Gets the "protocol" value of the RTCDataChannel object. + /// + [getter] + string protocol; + + /// + /// Gets the "id" attribute of the RTCDataChannel object. + /// + [getter] + long dataChannelIdentifier; + + /// + /// Gets a stats object reference for the transport used to carry this datachannel. + /// + [getter] + string transportId; + + /// + /// Gets the "readyState" value of the RTCDataChannel object. + /// + [getter] + RTCDataChannelState state; + + /// + /// Gets the total number of API "message" events sent. + /// + [getter] + unsigned long messagesSent; + + /// + /// Gets the total number of payload bytes sent on this RTCDatachannel, + /// i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + + /// + /// Gets the total number of API "message" events received. + /// + [getter] + unsigned long messagesReceived; + + /// + /// Gets the total number of bytes received on this RTCDatachannel, + /// i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + }; + + /// + /// An RTCTransportStats object represents the stats corresponding to + /// an RTCDtlsTransport and its underlying RTCIceTransport. When RTCP + /// multiplexing is used, one transport is used for both RTP and RTCP. + /// + /// Otherwise, RTP and RTCP will be sent on separate transports, and + /// rtcpTransportStatsId can be used to pair the resulting RTCTransportStats + /// objects. Additionally, when bundling is used, a single transport will + /// be used for all MediaStreamTracks in the bundle group. If bundling is + /// not used, different MediaStreamTrack will use different transports. + /// RTCP multiplexing and bundling are described in [WEBRTC]. + /// + struct RTCTransportStats : RTCStats { + + /// + /// Gets the total number of packets sent over this transport. + /// + [getter] + unsigned long packetsSent; + + /// + /// Gets the total number of packets received on this transport. + /// + [getter] + unsigned long packetsReceived; + + /// + /// Gets the total number of payload bytes sent on this PeerConnection, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + + /// + /// Gets the total number of bytes received on this PeerConnection, i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + + /// + /// Gets the id of the transport that gives stats for the RTCP component, and this record has only + /// the RTP component stats, if RTP and RTCP are not multiplexed + /// + [getter] + string rtcpTransportStatsId; + + /// + /// Gets the current value of the "role" attribute of the underlying RTCDtlsTransport's "transport". + /// + [getter, optional] + RTCIceRole iceRole; + + /// + /// Gets the current value of the "state" attribute of the underlying RTCDtlsTransport. + /// + [getter] + RTCDtlsTransportState dtlsState; + + /// + /// Gets a unique identifier that is associated to the object that was inspected + /// to produce the RTCIceCandidatePairStats associated with this transport. + /// + [getter] + string selectedCandidatePairId; + + /// + /// Gets the local certificate for components where DTLS is negotiated. + /// + [getter] + string localCertificateId; + + /// + /// Gets the remote certificate for components where DTLS is negotiated. + /// + [getter] + string remoteCertificateId; + + /// + /// Gets the descriptive name of the cipher suite used for the DTLS + /// transport, as defined in the "Description" column of the IANA cipher + /// suite registry [IANA-TLS-CIPHERS]. + /// + [getter] + string dtlsCipher; + + /// + /// Gets the descriptive name of the protection profile used for the + /// SRTP transport, as defined in the "Profile" column of the IANA DTLS-SRTP + /// protection profile registry [IANA-DTLS-SRTP] and described further in [RFC5764]. + /// + [getter] + string srtpCipher; + + [constructor, default, delete] + void RTCTransportStats(); + }; + + /// + /// RTCIceCandidateStats reflects the properties of a candidate in Section + /// 15.1 of [RFC5245]. It corresponds to a RTCIceCandidate object. + /// + struct RTCIceCandidateStats : RTCStats { + + /// + /// Gets a unique identifier that is associated to the object that was + /// inspected to produce the RTCTransportStats associated with this candidate. + /// + [getter] + string transportId; + + /// + /// Gets the type of network interface used by the base of a local candidate + /// (the address the ICE agent sends from). Only present for local candidates; + /// it's not possible to know what type of network interface a remote candidate + /// is using. + /// + [getter] + RTCNetworkType networkType; + + /// + /// Gets the IP address of the candidate, allowing for IPv4 addresses and + /// IPv6 addresses, but fully qualified domain names (FQDNs) are not allowed. + /// See [RFC5245] section 15.1 for details. + /// + [getter] + string ip; + + /// + /// Gets the port number of the candidate. + /// + [getter] + long port; + + /// + /// Gets the value based on the "transport" defined in [RFC5245] section 15.1. + /// Valid values for transport is one of udp and tcp. + /// + [getter] + string protocol; + + /// + /// Gets the enumeration as defined in [WEBRTC]. + /// + [getter] + RTCIceCandidateType candidateType; + + /// + /// Gets the value calculated as defined in [RFC5245] section 15.1. + /// + [getter] + long priority; + + /// + /// Gets the URL of the TURN or STUN server indicated in the that + /// translated this IP address. It is the URL address surfaced in + /// an RTCPeerConnectionIceEvent. + /// + [getter] + string url; + + /// + /// Gets the protocol used by the endpoint to communicate with the TURN server. + /// This is only present for local candidates. Valid values for the TURN URL + /// protocol is one of udp, tcp, or tls. + /// + [getter] + string relayProtocol; + + /// + /// Gets true if the candidate has been deleted/freed as described by [RFC5245]. + /// For host candidates, this means that any network resources (typically a socket) + /// associated with the candidate have been released. For TURN candidates, this + /// means the TURN allocation is no longer active. + /// + /// For remote candidates, this property is not applicable. + /// + [getter, optional] + bool deleted = false; + + [constructor, default, delete] + void RTCIceCandidateStats(); + }; + + /// + /// ICE candidate pair statistics related to the RTCIceTransport objects. + /// It is accessed by the RTCIceCandidatePairStats. + /// + struct RTCIceCandidatePairStats : RTCStats { + + /// + /// Gets a unique identifier that is associated to the object that + /// was inspected to produce the RTCTransportStats associated with + /// this candidate pair. + /// + [getter] + string transportId; + + /// + /// Gets a unique identifier that is associated to the object that + /// was inspected to produce the RTCIceCandidateStats for the local + /// candidate associated with this candidate pair. + /// + [getter] + string localCandidateId; + + /// + /// Gets a unique identifier that is associated to the object that was + /// inspected to produce the RTCIceCandidateStats for the remote candidate + /// associated with this candidate pair. + /// + [getter] + string remoteCandidateId; + + /// + /// Gets the state of the checklist for the local and remote candidates in a pair. + /// + [getter] + RTCStatsIceCandidatePairState state; + + /// + /// Gets the nominated flag described in Section 7.1.3.2.4 of [RFC5245]. + /// + [getter] + bool nominated; + + /// + /// Gets the total number of packets sent on this candidate pair. + /// + [getter] + unsigned long packetsSent; + + /// + /// Gets the total number of packets received on this candidate pair. + /// + [getter] + unsigned long packetsReceived; + + /// + /// Gets the total number of payload bytes sent on this candidate pair, i.e., + /// not including headers or padding. + /// + [getter] + unsigned long long bytesSent; + + /// + /// Gets the total number of payload bytes received on this candidate pair, + /// i.e., not including headers or padding. + /// + [getter] + unsigned long long bytesReceived; + + /// + /// Gets the timestamp at which the last packet was sent on this + /// particular candidate pair, excluding STUN packets. + /// + [getter] + Time lastPacketSentTimestamp; + + /// + /// Gets the timestamp at which the last packet was received on this + /// particular candidate pair, excluding STUN packets. + /// + [getter] + Time lastPacketReceivedTimestamp; + + /// + /// Gets the timestamp at which the first STUN request was sent on this particular candidate pair. + /// + [getter] + Time firstRequestTimestamp; + + /// + /// Gets the timestamp at which the last STUN request was sent on this particular candidate pair. + /// The average interval between two consecutive connectivity checks sent can be calculated with + /// (lastRequestTimestamp - firstRequestTimestamp) / requestsSent. + /// + [getter] + Time lastRequestTimestamp; + + /// + /// Gets the timestamp at which the last STUN response was received on this particular candidate pair. + /// + [getter] + Time lastResponseTimestamp; + + /// + /// Gets the sum of all round trip time measurements in milliseconds since the beginning of the session, + /// based on STUN connectivity check [STUN-PATH-CHAR] responses (responsesReceived), including those + /// that reply to requests that are sent in order to verify consent [RFC7675]. The average round + /// trip time can be computed from totalRoundTripTime by dividing it by responsesReceived. + /// + [getter] + Milliseconds totalRoundTripTime; + + /// + /// Gets the latest round trip time measured in milliseconds, computed from both STUN connectivity + /// checks [STUN-PATH-CHAR], including those that are sent for consent verification [RFC7675]. + /// + [getter] + Milliseconds currentRoundTripTime; + + /// + /// Gets the value calculated by the underlying congestion control by combining the + /// available bitrate for all the outgoing RTP streams using this candidate pair. The + /// bitrate measurement does not count the size of the IP or other transport layers + /// like TCP or UDP. It is similar to the TIAS defined in [RFC3890], i.e., it is + /// measured in bits per second and the bitrate is calculated over a 1 second window. + /// + /// Implementations that do not calculate a sender-side estimate must leave this + /// undefined. Additionally, the value must be undefined for candidate pairs that + /// were never used. For pairs in use, the estimate is normally no lower than the bitrate for + /// the packets sent at lastPacketSentTimestamp, but might be higher. For candidate pairs + // that are not currently in use but were used before, implementations must return undefined. + /// + [getter, optional] + double availableOutgoingBitrate; + + /// + /// Gets the value calculated by the underlying congestion control by combining the + /// available bitrate for all the incoming RTP streams using this candidate pair. The + /// bitrate measurement does not count the size of the IP or other transport layers + /// like TCP or UDP. It is similar to the TIAS defined in [RFC3890], i.e., it is + /// measured in bits per second and the bitrate is calculated over a 1 second window. + /// + /// Implementations that do not calculate a receiver-side estimate must leave this + /// undefined. Additionally, the value should be undefined for candidate pairs that + /// were never used. For pairs in use, the estimate is normally no lower than the + /// bitrate for the packets received at lastPacketReceivedTimestamp, but might be + /// higher. For candidate pairs that are not currently in use but were used before, + /// implementations must return undefined. + /// + [getter, optional] + double availableIncomingBitrate; + + /// + /// Gets the number of times the circuit breaker is triggered for this particular + /// 5-tuple. Ceasing transmission when a circuit breaker is triggered is defined + /// in Section 4.5 of [RFC8083]. The field must return undefined for user-agents + /// that do not implement the circuit-breaker algorithm. + /// + [getter] + unsigned long circuitBreakerTriggerCount; + + /// + /// Gets the total number of connectivity check requests received (including + /// retransmissions). It is impossible for the receiver to tell whether the + /// request was sent in order to check connectivity or check consent, so all + /// connectivity checks requests are counted here. + /// + [getter] + unsigned long long requestsReceived; + + /// + /// Gets the total number of connectivity check requests sent (not including retransmissions). + /// + [getter] + unsigned long long requestsSent; + + /// + /// Gets the total number of connectivity check responses received. + /// + [getter] + unsigned long long responsesReceived; + + /// + /// Gets the total number of connectivity check responses sent. Since we cannot distinguish + /// connectivity check requests and consent requests, all responses are counted. + /// + [getter] + unsigned long long responsesSent; + + /// + /// Gets the total number of connectivity check request retransmissions received. + /// Retransmissions are defined as connectivity check requests with a + /// TRANSACTION_TRANSMIT_COUNTER attribute where the "req" field is larger + /// than 1, as defined in [RFC7982]. + /// + [getter] + unsigned long long retransmissionsReceived; + + /// + /// Gets the total number of connectivity check request retransmissions sent. + /// + [getter] + unsigned long long retransmissionsSent; + + /// + /// Gets the total number of consent requests sent. + /// + [getter] + unsigned long long consentRequestsSent; + + /// + /// Gets the timestamp at which the latest valid STUN binding response expired, + /// as defined in [RFC7675] section 5.1. If a valid STUN binding response has not + /// been made (responsesReceived is zero) or the latest one has not expired this + /// value must be undefined. + /// + [getter] + Time consentExpiredTimestamp; + + [constructor, default, delete] + void RTCIceCandidatePairStats(); + }; + + /// + /// Information about a certificate used by an RTCIceTransport. It is accessed by the RTCCertificateStats. + /// + struct RTCCertificateStats : RTCStats { + + /// + /// Gets the fingerprint of the certificate. Only use the fingerprint + /// value as defined in Section 5 of [RFC4572]. + /// + [getter] + string fingerprint; + + /// + /// Gets the hash function used to compute the certificate fingerprint. + /// For instance, "sha-256". + /// + [getter] + string fingerprintAlgorithm; + + /// + /// Gets the DER-encoded base-64 representation of the certificate. + /// + [getter] + string base64Certificate; + + /// + /// Gets the issuerCertificateId refers to the stats object that contains + /// the next certificate in the certificate chain. If the current certificate + /// is at the end of the chain (i.e. a self-signed certificate), this will not be set. + /// + [getter] + string issuerCertificateId; + + [constructor, default, delete] + void RTCCertificateStats(); + }; + + /// + /// The RTCStatsReport contains a collection of statistic object for + /// statistics for the inspected objects. + /// + interface RTCStatsReport + { + typedef StringList IdList; + + [constructor, delete] + void RTCStatsReport(); + + /// + /// Gets a unique object instance identifier for this object. + /// + [getter] + puid objectId; + + /// + /// Gets the list of statistics object identifiers contained within this + /// stats report. + /// + [getter] + IdList statsIds; + /// + /// Gets an RTCStats object for the specified statistic object + /// identifier. + /// + RTCStats getStats(string id); + }; + } +} diff --git a/webrtc/idl/VideoCapturer.idl b/webrtc/idl/VideoCapturer.idl new file mode 100644 index 00000000..59db45d5 --- /dev/null +++ b/webrtc/idl/VideoCapturer.idl @@ -0,0 +1,211 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + + +namespace org +{ + namespace webRtc + { + [special] + struct VideoDeviceInfo + { + [constructor, default, delete] + void VideoDeviceInfo(); + + [getter] + zs::Any info; + }; + typedef std::list VideoDeviceInfoList; + typedef zs::PromiseWith PromiseWithVideoDeviceInfoList; + + struct VideoFormat + { + /// + /// Number of pixels. + /// + int width; + + /// + /// Number of pixels. + /// + int height; + + /// + /// Number of pixels. + /// + Nanoseconds interval; /// Nanoseconds. + + /// + /// Color space. FOURCC_ANY (0xFFFFFFFF) means that any color space is OK. + /// + uint32 fourcc; + + [getter] + int framerate; + + [getter] + float framerateFloat; + + [getter] + bool isSize0x0; + + bool IsPixelRateLess(VideoFormat other); + + [constructor, default] + void VideoFormat(); + + [constructor, default, altname(VideoFormatClone)] + void VideoFormat(VideoFormat source); + }; + + [dictionary] + struct VideoCapturerInputSize + { + int width; + int height; + }; + + [disposable] + interface VideoCapturer + { + [constructor, default, delete] + void VideoCapturer(); + + [static] + VideoCapturer create(string name, string id); + + [static] + PromiseWithVideoDeviceInfoList getDevices(); + + /// + /// Get the capture formats supported by the video capturer. The supported + /// formats are non empty after the device has been opened successfully. + /// + VideoFormats getSupportedFormats(); + + /// + /// Get the best capture format for the desired format. The best format is the + /// same as one of the supported formats except that the frame interval may be + /// different. If the application asks for 16x9 and the camera does not support + /// 16x9 HD or the application asks for 16x10, we find the closest 4x3 and then + /// crop; Otherwise, we find what the application asks for. Note that we assume + /// that for HD, the desired format is always 16x9. The subclasses can override + /// the default implementation. + /// Parameters + /// desired: the input desired format. If desired.fourcc is not kAnyFourcc, + /// the best capture format has the exactly same fourcc. Otherwise, + /// the best capture format uses a fourcc in GetPreferredFourccs(). + /// best_format: the output of the best capture format. + /// Return false if there is no such a best format, that is, the desired format + /// is not supported. + /// + VideoFormat getBestCaptureFormat(VideoFormat desired); + + /// + /// Start the video capturer with the specified capture format. + /// Parameter + /// captureFormat: The caller got this parameter by either calling + /// GetSupportedFormats() and selecting one of the supported + /// or calling GetBestCaptureFormat(). + /// Return + /// starting: The capturer is trying to start. Success or failure will + /// be notified via the onSignalStateChange callback. + /// running: if the capturer is started and capturing. + /// failed: if the capturer failes to start.. + /// noDevie: if the capturer has no device and fails to start. + /// + VideoCaptureState start(VideoFormat captureFormat); + + /// + /// Get the current capture format, which is set by the Start() call. + /// Note that the width and height of the captured frames may differ from the + /// capture format. For example, the capture format is HD but the captured + /// frames may be smaller than HD. + /// + VideoFormat getCaptureFormat(); + + /// + /// Stop the video capturer. + /// + void stop(); + + /// + /// Caps the VideoCapturer's format according to max_format. It can e.g. be + /// used to prevent cameras from capturing at a resolution or framerate that + /// the capturer is capable of but not performing satisfactorily at. + /// The capping is an upper bound for each component of the capturing format. + /// The fourcc component is ignored. + /// + void constrainSupportedFormats(VideoFormat maxFormat); + + /// + /// Gets the id of the underlying device, which is available after the capturer + /// is initialized. Can be used to determine if two capturers reference the + /// same device. + /// + [getter] + string id; + + [getter,setter] + bool enableCameraList; + + /// + /// If true, run video adaptation. By default, video adaptation is enabled + /// and users must call video_adapter()->OnOutputFormatRequest() + /// to receive frames. + /// + [getter,setter] + bool enableVideoAdapter; + + /// + /// Check if the video capturer is running. + /// + [getter] + bool isRunning; + + [getter] + bool applyRotation; + + /// + /// Returns true if the capturer is screencasting. This can be used to + /// implement screencast specific behavior. + /// + [getter] + bool isScreencast; + + [getter] + VideoCapturerInputSize inputSize; + + [getter] + VideoCaptureState state; + }; + } +} diff --git a/webrtc/idl/VideoTrackSource.idl b/webrtc/idl/VideoTrackSource.idl new file mode 100644 index 00000000..17dfd515 --- /dev/null +++ b/webrtc/idl/VideoTrackSource.idl @@ -0,0 +1,92 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + /// + /// Original size of captured frame, before video adaptation. + /// + [dictionary] + struct VideoTrackSourceStats + { + int inputWidth; + int inputHeight; + }; + + /// + /// VideoTrackSourceInterface is a used for VideoTracks. The same source can + /// be used by multiple VideoTracks. + /// + [disposable] + interface VideoTrackSource : MediaTrackSource + { + [constructor, delete] + void VideoTrackSource(); + + /// + /// Creates an VideoTrackSource for use with an MediaStreamTrack. + /// + [static, default] + VideoTrackSource create(VideoCapturer capturer); + + /// + /// Creates a VideoTrackSource for use with an MediaStreamTrack. + /// + [static, default, altname(createWithContraints)] + VideoTrackSource create(VideoCapturer capturer, MediaConstraints constraints); + + /// + /// Indicates that parameters suitable for screencasts should be automatically + /// applied to RtpSenders. + /// + [getter] + bool isScreencast; + + /// + /// Indicates that the encoder should denoise video before encoding it. + /// If it is not set, the default configuration is used which is different + /// depending on video codec. + /// + [getter,optional] + bool needsDenoising; + + /// + /// Returns null if no stats are available, e.g, for a remote source, or a + /// source which has not seen its first frame yet. + /// + [getter,optional] + VideoTrackSourceStats stats; + + }; + } +} diff --git a/webrtc/idl/WebRtc.idl b/webrtc/idl/WebRtc.idl new file mode 100644 index 00000000..926d963b --- /dev/null +++ b/webrtc/idl/WebRtc.idl @@ -0,0 +1,249 @@ + +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + */ + +namespace org +{ + namespace webRtc + { + typedef zs::exceptions::BadState InvalidStateError; + typedef zs::exceptions::InvalidArgument invalidParameter; + typedef zs::exceptions::NotSupported NotSupportedError; + + typedef std::list StringList; + typedef zs::Milliseconds Milliseconds; + typedef zs::Nanoseconds Nanoseconds; + + typedef zs::Any Any; + typedef zs::Time Time; + typedef zs::puid puid; + typedef zs::size_t size_t; + typedef zs::Promise Promise; + + struct VideoFormat; + struct RTCOAuthCredential; + struct RTCIceServer; + struct RTCConfiguration; + struct RTCCertificate; + struct RTCOfferAnswerOptions; + struct RTCOfferOptions; + struct RTCAnswerOptions; + struct RTCDataChannelInit; + struct MessageEvent; + struct RTCSessionDescriptionInit; + struct Constraint; + struct RTCIceCandidateInit; + struct RTCBitrateParameters; + struct RTCRtpEncodingParameters; + struct RTCRtpHeaderExtensionParameters; + struct RTCRtpCodecParameters; + struct RTCRtpContributingSource; + struct RTCRtpSynchronizationSource; + struct RTCRtpDecodingParameters; + struct RTCRtpCodecCapability; + struct RTCDtlsFingerprint; + struct RTCRtpCodecCapability; + struct RTCRtpHeaderExtensionCapability; + struct RTCRtcpFeedback; + interface RTCError; + interface RTCPeerConnection; + interface RTCDtmfSender; + interface RTCRtpSender; + interface RTCRtpReceiver; + interface RTCRtpTransceiver; + interface RTCStatsReport; + interface RTCStatsProvider; + interface RTCDataChannel; + interface RTCDataChannelEvent; + interface RTCSessionDescription; + interface MediaConstraints; + interface RTCIceCandidate; + interface RTCCertificate; + interface RTCKeyParams; + interface VideoCapturer; + + typedef zs::PromiseRejectionReason PromiseWithRejectionRTCError; + typedef zs::PromiseWith PromiseWithDescription; + typedef zs::PromiseWith PromiseWithRTCCertificate; + + typedef std::list RTCRtcpFeedbackList; + typedef std::list RTCRtpHeaderExtensionCapabilityList; + typedef std::list RTCRtpCodecCapabilityList; + typedef std::list RTCDtlsFingerprints; + typedef std::list VideoFormats; + typedef std::list RTCRtpCodecCapabilityList; + typedef std::list RTCRtpDecodingParametersList; + typedef std::list RTCRtpSynchronizationSources; + typedef std::list RTCRtpContributingSources; + typedef std::list RTCRtpEncodingParametersList; + typedef std::list RTCRtpHeaderExtensionParametersList; + typedef std::list RTCRtpCodecParametersList; + typedef std::list Constraints; + typedef std::list RTCIceServers; + typedef std::list RTCCertificates; + typedef std::list RTCRtpSenders; + typedef std::list RTCRtpReceivers; + typedef std::list RTCRtpTransceivers; + typedef std::list RTCIceCandidates; + + + [dictionary] + struct MillisecondIntervalRange + { + Milliseconds min; + Milliseconds max; + + /// + /// Constructs an empty instance of an RTCConfiguration object. + /// + [constructor, default] + void MillisecondIntervalRange(); + + /// + /// Constructs an instance of an RTCConfiguration object by cloning the data from an existing object. + /// + [constructor, default, altname(MillisecondIntervalRangeClone)] + void MillisecondIntervalRange(MillisecondIntervalRange source); + }; + + /// + /// A message queue for receiving delegate events. + /// + [special] + interface EventQueue + { + /// + /// Constructs an event queue object. + /// + [constructor, delete] + void EventQueue(); + + /// + /// Constructs an event queue object from a native queue type. + /// + [constructor, default, altname(EventQueueWithNativeQueue)] + void EventQueue(Any queue); + + /// + /// The default windows message queue for the system GUI thread. + /// + [static] + EventQueue getDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + [static, getter, setter] + EventQueue singleton; + + /// + /// Gets a native queue from an event queue object. + /// + [getter] + Any queue; + }; + + [special, static, platform(webhidden)] + interface EventQueueMaker + { + /// + /// Creates an event queue object from a native queue type. + /// + [static] + EventQueue bind(Any queue); + /// + /// Extracts a native queue from an event queue object. + /// + [static] + Any extract(EventQueue queue); + }; + + /// + /// Setup methods for the ORTC Lib stack. + /// + [static] + interface WebRtcLib + { + /// + /// Initialize the ORTC stack. + /// + [static, default] + void setup(); + + /// + /// Initialize the ORTC stack with a target event queue for delegate events. + /// + [static, altname(setupWithQueue)] + void setup(EventQueue queue); + + /// + /// Gets or sets the NTP server time discovered in milliseconds since + /// NTP epoch. This property must only be set at the actual moment when + /// the server time was discovered to ensure the NTP clock is as closed + /// to accurate as possible. + /// + [static] + Milliseconds ntpServerTime; + + /// + /// Starts media engine trancing system. The collected traces can be + /// saved to file or sent to TCP listener. Traces can be visualised + /// further by importing the data into Chrome browser tool that can be + /// accessed using following option - chrome://tracing. + /// This method starts the tracing engine. + /// + [static] + void startMediaTracing(); + /// + /// Stops media tracing process. + /// + [static] + void stopMediaTracing(); + /// + /// Indicates whether tracing system is activated. + /// + [static] + bool isMediaTracing(); + /// + /// Saves media trace data to the file specified by filename. + /// + [static] + bool startMediaTrace(string filename); + /// + /// Sends all traced data to TCP listener specified by host name and port. + /// + [static, altname(startMediaTraceWithHostPort)] + bool startMediaTrace(string host, int port); + }; + + } +} + diff --git a/webrtc/idl/config.json b/webrtc/idl/config.json new file mode 100644 index 00000000..2a7818cd --- /dev/null +++ b/webrtc/idl/config.json @@ -0,0 +1,54 @@ +{ + "project": { + "name": "org.webRtc", + "aliases": { + "alias": [ + { + "in": "bogus_ortc_test_alias", + "out": "bogus" + } + ] + }, + "exclusives": { + "exclusive": [ + "xplatform" + ] + }, + "includes": { + "include": [ + "../../../zsLib/zsLib/idl/config.json" + ] + }, + "sources": { + "source": [ + "enums.idl", + "WebRtc.idl", + "Error.idl", + "MediaSource.idl", + "MediaElement.idl", + "StatsReport.idl", + "StatsProvider.idl", + "Certificate.idl", + "DataChannel.idl", + "MediaConstraints.idl", + "AudioOptions.idl", + "AudioTrackSource.idl", + "VideoTrackSource.idl", + "VideoCapturer.idl", + "MediaStreamTrack.idl", + "OAuthCredential.idl", + "IceCandidate.idl", + "IceServer.idl", + "Configuration.idl", + "OfferAnswerOptions.idl", + "RtpParameters.idl", + "RtpSender.idl", + "RtpReceiver.idl", + "DTMFSender.idl", + "RtpTransceiver.idl", + "SessionDescription.idl", + "PeerConnection.idl", + ] + } + } +} diff --git a/webrtc/idl/enums.idl b/webrtc/idl/enums.idl new file mode 100644 index 00000000..152871ba --- /dev/null +++ b/webrtc/idl/enums.idl @@ -0,0 +1,926 @@ +/* + + Copyright (c) 2017, Optical Tone Ltd. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of the FreeBSD Project. + + + */ + +namespace org +{ + namespace webRtc + { + /// + /// The RTCSignalingState describes the current state of an offer / + /// answer exchanged as it relates to the SDP negotiation process. WHen + /// JSON style signaling is used the state is always Stable. + /// + enum RTCSignalingState + { + /// + /// There is no offer­answer exchange in progress. This is also the + /// initial state in which case the local and remote descriptions are + /// empty. + /// + stable, + /// + /// A local description, of type "offer", has been successfully + /// applied. + /// + haveLocalOffer, + /// + /// A remote description of type "offer" has been successfully + /// applied and a local description of type "pranswer" has been + /// successfully applied. + /// + haveLocalPranswer, + /// + /// A remote description, of type "offer", has been successfully + /// applied. + /// + haveRemoteOffer, + /// + /// A local description of type "offer" has been successfully applied + /// and a remote description of type "pranswer" has been successfully + /// applied. + /// + haveRemotePranswer, + /// + /// The connection is closed. + /// + closed, + }; + + /// + /// RTCIceGatheringState represents the current state of the ICE gatherer. + /// + enum RTCIceGatheringState + { + /// + /// The object has been created but Gather() has not been called. + /// + new, + /// + /// Gather() has been called, and the RTCIceGatherer is in the process + /// of gathering candidates (which includes adding new candidates and + /// removing invalidated candidates). + /// + gathering, + /// + /// The RTCIceGatherer has completed gathering. Events such as adding, + /// updating or removing an interface, or adding, changing or removing a + /// TURN server will cause the state to go back to gathering before + /// re-entering "complete" once all candidate changes are finalized. + /// + complete, + }; + + + /// + /// The RTCIceConnectionState indicates the combined state of all the + /// RTCIceTransport objects states. + /// + enum RTCIceConnectionState + { + /// + /// The ICE Agent is gathering addresses and/or waiting for remote + /// candidates to be supplied. + /// + new, + /// + /// The ICE Agent has received remote candidates on at least one + /// component, and is checking candidate pairs but has not yet found a + /// connection. In addition to checking, it may also still be + /// gathering. + /// + checking, + /// + /// The ICE Agent has found a usable connection for all components but + /// is still checking other candidate pairs to see if there is a + /// better connection. It may also still be gathering. + /// + connected, + /// + /// The ICE Agent has finished gathering and checking and found a + /// connection for all components. Details on how the completed state + /// in ICE is reached are covered in [RFC5245]. + /// + completed, + /// + /// The ICE Agent is finished checking all candidate pairs and failed + /// to find a connection for at least one component. Connections may + /// have been found for some components. + /// + failed, + /// + /// Liveness checks have failed for one or more components. This is + /// more aggressive than failed, and may trigger intermittently (and + /// resolve itself without action) on a flaky network. + /// + disconnected, + /// + /// The ICE Agent has shut down and is no longer responding to STUN + /// requests. + /// + closed, + }; + + /// + /// The RTCTlsCertPolicy indicates the TLS certificate policy + /// + enum RTCTlsCertPolicy + { + /// + /// For TLS based protocols, ensure the connection is secure by not + /// circumventing certificate validation. + /// + tlsCertPolicySecure, + /// + /// For TLS based protocols, disregard security completely by skipping + /// certificate validation. This is insecure and should never be used unless + /// security is irrelevant in that particular context. + /// + tlsCertPolicyInsecureNoCheck, + } + + /// + /// RTCIceCredentialType represents the type of credential used by a TURN + /// server. + /// + enum RTCIceCredentialType + { + /// + /// The credential is a long-term authentication password. + /// + password, + /// + /// An OAuth 2.0 based authentication method, as described in [RFC7635]. + /// + oauth, + }; + + /// + /// RTCIceTransportPolicy represents the ICE candidate policy + /// [JSEP] (section 3.5.3.) + /// + enum RTCIceTransportPolicy + { + /// + /// The ICE agent has no policy specified. + /// + none, + + /// + /// The ICE Agent uses only media relay candidates such as candidates passing through a TURN server. + /// + relay, + + /// + /// The ICE Agent does not use any system host candidates. + /// + noHost, + + /// + /// The ICE Agent can use any type of candidate when this value is specified. + /// + all, + }; + + /// + /// RTCBundlePolicy is described in [JSEP] (section 4.1.1.). The bundle + /// policy affects which media tracks are negotiated if the remote + /// endpoint is not bundle-aware, and what ICE candidates are gathered. + /// + enum RTCBundlePolicy + { + /// + /// Gather ICE candidates for each media type in use (audio, video, + /// and data). If the remote endpoint is not bundle-aware, + /// negotiate only one audio and video track on separate transports. + /// + balanced, + /// + /// Gather ICE candidates for only one track. If the remote endpoint + /// is not bundle-aware, negotiate only one media track. + /// + maxBundle, + /// + /// Gather ICE candidates for each track. If the remote endpoint is + /// not bundle-aware, negotiate all media tracks on separate transports. + /// + maxCompat, + }; + + + /// + /// RTCRtcpMuxPolicy is described in [JSEP] (section 4.1.1.). The + /// RtcpMuxPolicy affects what ICE candidates are gathered to + /// support non-multiplexed RTCP. + /// + enum RTCRtcpMuxPolicy + { + /// + /// Gather ICE candidates for both RTP and RTCP candidates. If the + /// remote-endpoint is capable of multiplexing RTCP, multiplex RTCP + /// on the RTP candidates. If it is not, use both the RTP and RTCP + /// candidates separately. Note that, as stated in [JSEP] (section 4.1.1.), + /// the user agent MAY not implement non-multiplexed RTCP, in + /// which case it will reject attempts to construct an RTCPeerConnection + /// with the negotiate policy. + /// + negotiate, + /// + /// Gather ICE candidates only for RTP and multiplex RTCP on the RTP + /// candidates. If the remote endpoint is not capable of rtcp-mux, session + /// negotiation will fail. + /// + require, + }; + + enum RTCTcpCandidatePolicy { + enabled, + disabled, + }; + + + enum RTCCandidateNetworkPolicy { + all, + lowCost, + }; + + + enum RTCContinualGatheringPolicy { + once, + continually, + }; + + enum RTCConfigurationType { + /// + /// A configuration that is safer to use, despite not having the best + /// performance. Currently this is the default configuration. + /// + safe, + /// + /// An aggressive configuration that has better performance, although it + /// may be riskier and may need extra support in the application. + /// + aggressive + }; + + /// + /// This enum resembles the one in Chromium net::ConnectionType. + /// + enum RTCNetworkType { + unknown = 0, + ethernet = 1, + wifi = 2, + cellular = 4, + vpn = 8, + loopback = 16, + bluetooth = 32, + wimax = 64, + }; + + /// + /// For now, kDefault is interpreted as kPlanB. + /// + enum RTCSdpSemantics + { + default, + planB, + unifiedPlan + }; + + /// + /// Used by GetStats to decide which stats to include in the stats reports. + /// |standard| includes the standard stats for Javascript API; + /// |debug| includes both the standard stats and additional + /// stats for debugging purposes. + /// + enum RTCStatsOutputLevel { + standard, + debug, + }; + + enum MediaSourceState { + initializing, + live, + ended, + muted + }; + + enum MediaStreamTrackState { + live, + ended, + }; + + /// + /// Enumeration to represent distinct classes of errors that an application + /// may wish to act upon differently. These roughly map to DOMExceptions or + /// RTCError "errorDetailEnum" values in the web API, as described in the + /// comments below. + /// + enum RTCErrorType { + /// + /// No error. + /// + none, + + /// + /// An operation is valid, but currently unsupported. + /// Maps to OperationError DOMException. + /// + unsupportedOperation, + + /// + /// A supplied parameter is valid, but currently unsupported. + /// Maps to OperationError DOMException. + /// + unsupportedParameter, + + /// + /// General error indicating that a supplied parameter is invalid. + /// Maps to InvalidAccessError or TypeError DOMException depending on context. + /// + invalidParameter, + + /// + /// Slightly more specific than invalidParameter; a parameter's value was + /// outside the allowed range. + /// Maps to RangeError DOMException. + /// + invalidRange, + + /// + /// Slightly more specific than invalidParameter; an error occurred while + /// parsing string input. + /// Maps to SyntaxError DOMException. + /// + syntaxError, + + /// + /// The object does not support this operation in its current state. + /// Maps to InvalidStateError DOMException. + /// + invalidState, + + /// + /// An attempt was made to modify the object in an invalid way. + /// Maps to InvalidModificationError DOMException. + /// + invalidModification, + + /// + /// An error occurred within an underlying network protocol. + /// Maps to NetworkError DOMException. + /// + networkError, + + /// + /// Some resource has been exhausted; file handles, hardware resources, ports, + /// etc. + /// Maps to OperationError DOMException. + /// + resourceExhausted, + + /// + /// The operation failed due to an internal error. + /// Maps to OperationError DOMException. + /// + internalError, + }; + + /// + /// RTCStatsType object is initialized to the name of the dictionary that + /// the RTCStats represents. + /// + enum RTCStatsType + { + /// + /// Statistics for a codec that is currently being used by RTP streams being + /// sent or received by this RTCPeerConnection object. It is accessed by the RTCCodecStats. + /// + codec, + /// + /// Statistics for an inbound RTP stream that is currently received with this + /// RTCPeerConnection object. It is accessed by the RTCInboundRtpStreamStats. + /// + inboundRtp, + /// + /// Statistics for an outbound RTP stream that is currently sent with + /// this RTCPeerConnection object. It is accessed by the RTCOutboundRtpStreamStats. + /// + outboundRtp, + /// + /// Statistics for the remote endpoint's inbound RTP stream corresponding to + /// an outbound stream that is currently sent with this RTCPeerConnection object. + /// It is measured at the remote endpoint and reported in an RTCP Receiver Report + /// (RR) or RTCP Extended Report (XR). It is accessed by the RTCRemoteInboundRtpStreamStats. + /// + remoteInboundRtp, + /// + /// Statistics for the remote endpoint's outbound RTP stream corresponding to + /// an inbound stream that is currently received with this RTCPeerConnection + /// object. It is measured at the remote endpoint and reported in an RTCP Sender + /// Report (SR). It is accessed by the RTCRemoteOutboundRtpStreamStats. + /// + remoteOutboundRtp, + /// + /// Statistics for a contributing source (CSRC) that contributed to an + /// inbound RTP stream. It is accessed by the RTCRtpContributingSourceStats. + /// + csrc, + /// + /// Statistics related to the RTCPeerConnection object. It is accessed by the RTCPeerConnectionStats. + /// + peerConnection, + /// + /// Statistics related to each RTCDataChannel id. It is accessed by the RTCDataChannelStats. + /// + dataChannel, + /// + /// Contains statistics related to a specific MediaStream. It is accessed by the RTCMediaStreamStats. + /// + stream, + /// + /// Contains statistics related to a specific MediaStreamTrack's attachment to an RTCRtpSender + /// and the corresponding media-level metrics. It is accessed by either + /// RTCSenderVideoTrackAttachmentStats or RTCSenderAudioTrackAttachmentStats, both inherited from RTCMediaHandlerStats. + /// + /// The monitored "track" object is deleted when the sender it reports on has its "track" value changed + /// to no longer refer to the same track. + /// + track, + /// + /// Contains statistics related to a specific RTCRtpSender and the corresponding media-level metrics. + /// It is accessed by the RTCAudioSenderStats or the RTCVideoSenderStats depending on kind. + /// + sender, + /// + /// Contains statistics related to a specific receiver and the corresponding media-level metrics. + /// It is accessed by the RTCAudioReceiverStats or the RTCVideoSenderStats depending on kind. + /// + receiver, + /// + /// Transport statistics related to the RTCPeerConnection object. It is accessed by the RTCTransportStats. + /// + transport, + /// + /// ICE candidate pair statistics related to the RTCIceTransport objects. It is accessed by + /// the RTCIceCandidatePairStats. + /// + /// A candidate pair that is not the current pair for a transport is deleted when the RTCIceTransport + /// does an ICE restart, at the time the state changes to "new". The candidate pair that is the current + /// pair for a transport is deleted after an ICE restart when the RTCIceTransport switches to using a + /// candidate pair generated from the new candidates; this time doesn't correspond to any other + /// externally observable event. + /// + candidatePair, + /// + /// ICE local candidate statistics related to the RTCIceTransport objects. It is accessed + /// by the RTCIceCandidateStats for the local candidate. + /// + /// A local candidate is deleted when the RTCIceTransport does an ICE restart, and the candidate + /// is no longer a member of any non-deleted candidate pair. + /// + localCandidate, + /// + /// ICE remote candidate statistics related to the RTCIceTransport objects. It is accessed by + /// the RTCIceCandidateStats for the remote candidate. + /// + /// A remote candidate is deleted when the RTCIceTransport does an ICE restart, and the candidate + /// is no longer a member of any non-deleted candidate pair. + /// + remoteCandidate, + /// + /// Information about a certificate used by an RTCIceTransport. It is accessed by the RTCCertificateStats. + /// + certificate + }; + + /// + /// RTCDataChannelState represents the state of the RTCDataChannel object. + /// + enum RTCDataChannelState + { + /// + /// The user agent is attempting to establish the underlying data + /// transport. This is the initial state of an RTCDataChannel object, + /// whether created with createDataChannel, or dispatched as a part + /// of an RTCDataChannelEvent. + /// + connecting, + /// + /// The underlying data transport is established and communication is possible. + /// + open, + /// + /// The procedure to close down the underlying data transport has started. + /// + closing, + /// + /// The underlying data transport has been closed or could not be established. + /// + closed, + }; + + /// + /// The RTCIceCandidateType includes the type of the ICE candidate. + /// + enum RTCIceCandidateType + { + /// + /// A host candidate, defined in [RFC5245] Section 3. + /// + host, + /// + /// A server reflexive candidate, defined in [RFC5245] Section 3. + /// + srflex, + /// + /// A peer reflexive candidate, defined in [RFC5245] Section 3. + /// + prflx, + /// + /// A relay candidate, defined in [RFC5245] Section 3. + /// + relay, + }; + + /// + /// Candidate pair state is defined in Section 5.7.4 of [RFC5245]. + /// + enum RTCStatsIceCandidatePairState + { + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + frozen, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + waiting, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + inProgress, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + failed, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + succeeded, + /// + /// Defined in Section 5.7.4 of [RFC5245]. + /// + cancelled, + }; + + enum RTCPriorityType { + /// + /// See [RTCWEB-TRANSPORT], Section 4. Corresponds to "below normal" as defined in [RTCWEB-DATA]. + /// + veryLow, + /// + /// See [RTCWEB-TRANSPORT], Section 4. Corresponds to "normal" as defined in [RTCWEB-DATA]. + /// + low, + /// + /// See [RTCWEB-TRANSPORT], Section 4. Corresponds to "high" as defined in [RTCWEB-DATA]. + /// + medium, + /// + /// See [RTCWEB-TRANSPORT], Section 4. Corresponds to "extra high" as defined in [RTCWEB-DATA] + /// + high + }; + + /// + /// The RTCSdpType enum describes the type of RTCSessionDescription + /// instance. + /// + enum RTCSdpType + { + /// + /// An RTCSdpType of offer indicates that a description must be + /// treated as an [RTC3264] offer. + /// + offer, + /// + /// An RTCSdpType of pranswer indicates that a description must be + /// treated as an [RTC3264] answer, but not a final answer. A + /// description used as an SDP pranswer may be applied as a response + /// to an SDP offer, or an update to a previously sent SDP pranswer. + /// + pranswer, + /// + /// The format of the description is that of an SDP answer. + /// + answer, + /// + /// The format of the description is that of an SDP rollback. + /// + rollback, + }; + + + /// + /// RTCIceComponent contains the component-id of the RTCIceTransport, + /// which will be "RTP" unless RTP and RTCP are not multiplexed and the + /// RTCIceTransport object was returned by createAssociatedTransport(). + /// + enum RTCIceComponent + { + /// + /// The RTP component ID, defined (as '1') in [RFC5245] Section 4.1.1.1. + /// Protocols multiplexed with RTP (e.g. SCTP data channel) share its + /// component ID. + /// + rtp = 1, + /// + /// The RTCP component ID, defined (as '2') in [RFC5245] Section + /// 4.1.1.1. + /// + rtcp = 2, + }; + + + enum RTCIceProtocol + { + /// + /// A UDP candidate, as described in [RFC5245]. + /// + udp, + /// + /// A TCP candidate, as described in [RFC5245]. + /// + tcp, + }; + + + /// + /// The RTCIceTcpCandidateType includes the type of the ICE TCP candidate, + /// as described in [RFC6544]. + /// + enum RTCIceTcpCandidateType + { + /// + /// An active TCP candidate is one for which the transport will attempt + /// to open an outbound connection but will not receive incoming + /// connection requests. + /// + active, + /// + /// A passive TCP candidate is one for which the transport will receive + /// incoming connection attempts but not attempt a connection. + /// + passive, + /// + /// An so candidate is one for which the transport will attempt to open + /// a connection simultaneously with its peer. + /// + so, + }; + + enum RTCKeyType { + /// + /// Default key type used (currently ecdsa). + /// + default, + /// + /// RSA public key. + /// + rsa, + /// + /// Ellipical curve public key. + /// + ecdsa, + }; + + enum RTCECCurve { + nistP256 + }; + + enum RTCPeerConnectionState { + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in the + /// "new" state and none of the transports are in the + /// "connecting", "checking", "failed" or "disconnected" + /// state, or all transports are in the "closed" state, or + /// there are no transports. + /// + new, + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in + /// the "connecting" or "checking" state and none of them is + /// in the "failed" state. + /// + connecting, + /// + /// All RTCIceTransports and RTCDtlsTransports are in the + /// "connected", "completed" or "closed" state and at least + /// one of them is in the "connected" or "completed" state. + /// + connected, + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are in + /// the "disconnected" state and none of them are in the + /// "failed" or "connecting" or "checking" state. + /// + disconnected, + /// + /// Any of the RTCIceTransports or RTCDtlsTransports are + /// in a "failed" state. + /// + failed, + /// + /// The RTCPeerConnection object's [[IsClosed]] slot is true. + /// + closed + }; + + enum RTCDtxStatus { + /// + /// Discontinuous transmission is disabled. + /// + disabled, + /// + /// Discontinuous transmission is enabled if negotiated. + /// + enabled + }; + + enum RTCDegradationPreference { + /// + /// Degrade resolution in order to maintain framerate. + /// + maintainFramerate, + /// + /// Degrade framerate in order to maintain resolution. + /// + maintainResolution, + /// + /// Degrade a balance of framerate and resolution. + /// + balanced + }; + + enum RTCRtpTransceiverDirection { + /// + /// The RTCRtpTransceiver's RTCRtpSender sender will offer to + /// send RTP, and will send RTP if the remote peer accepts and + /// sender.getParameters().encodings[i].active is true for any + /// value of i. The RTCRtpTransceiver's RTCRtpReceiver will + /// offer to receive RTP, and will receive RTP if the remote + /// peer accepts. + /// + sendrecv, + /// + /// The RTCRtpTransceiver's RTCRtpSender sender will offer to + /// send RTP, and will send RTP if the remote peer accepts and + /// sender.getParameters().encodings[i].active is true for any + /// value of i. The RTCRtpTransceiver's RTCRtpReceiver will not + /// offer to receive RTP, and will not receive RTP. + /// + sendonly, + /// + /// The RTCRtpTransceiver's RTCRtpSender will not offer to send + /// RTP, and will not send RTP. The RTCRtpTransceiver's + /// RTCRtpReceiver will offer to receive RTP, and will receive + /// RTP if the remote peer accepts. + /// + recvonly, + /// + /// The RTCRtpTransceiver's RTCRtpSender will not offer to + /// send RTP, and will not send RTP. The RTCRtpTransceiver's + /// RTCRtpReceiver will not offer to receive RTP, and will + /// not receive RTP. + /// + inactive + }; + + + /// + /// Current state of the capturer. + /// + enum VideoCaptureState + { + /// + /// The capturer has been stopped or hasn't started yet. + /// + stopped, + /// + /// The capturer is in the process of starting. Note, it may still fail to start. + /// + starting, + /// + /// The capturer has been started successfully and is now capturing. + /// + running, + /// + /// The capturer failed to start. + /// + failed, + }; + + enum RTCCodecType + { + /// + /// The attached RTCCodecStats represents a media format that is + /// being encoded, or that the implementation is prepared to encode. + /// + encode, + /// + /// The attached RTCCodecStats represents a media format that + /// the implementation is prepared to decode. + /// + decode, + }; + + enum RTCQualityLimitationReason { + /// + /// The resolution and/or framerate is not limited. + /// + none, + /// + /// The resolution and/or framerate is primarily limited due to CPU load. + /// + cpu, + /// + /// The resolution and/or framerate is primarily limited due to congestion + /// cues during bandwidth estimation. Typical, congestion control algorithms + /// use inter-arrival time, round-trip time, packet or other congestion cues + /// to perform bandwidth estimation. + /// + bandwidth, + /// + /// The resolution and/or framerate is primarily limited for a reason other than the above. + /// + other, + }; + + enum RTCIceRole { + /// + /// A controlling agent as defined by [ICE], Section 3. + /// + controlling, + /// + /// A controlled agent as defined by [ICE], Section 3. + /// + controlled + }; + + enum RTCDtlsTransportState { + /// + /// DTLS has not started negotiating yet. + /// + new, + /// + /// DTLS is in the process of negotiating a secure connection and verifying the remote fingerprint. + /// + connecting, + /// + /// DTLS has completed negotiation of a secure connection and verified the remote fingerprint. + /// + connected, + /// + /// The transport has been closed intentionally as the result of receipt of a + /// close_notify alert, or calling close(). + /// + closed, + /// + /// The transport has failed as the result of an error (such as receipt of an error alert + /// or failure to validate the remote fingerprint). + /// + failed + }; + + } +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_AudioOptions.cpp b/webrtc/idl/wrapper/impl_org_webRtc_AudioOptions.cpp new file mode 100644 index 00000000..8f8ebe9e --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_AudioOptions.cpp @@ -0,0 +1,236 @@ + +#include "impl_org_webRtc_AudioOptions.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::AudioOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::AudioOptions::AudioOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::AudioOptionsPtr wrapper::org::webRtc::AudioOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::AudioOptions::~AudioOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::AudioOptions::wrapper_init_org_webRtc_AudioOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + if (from.echo_cancellation.has_value()) { + to.echoCancellation = from.echo_cancellation.value(); + } +#if defined(WEBRTC_IOS) + if (from.ios_force_software_aec_HACK.has_value()) { + to.iosForceSoftwareAec_HACK = from.ios_force_software_aec_HACK.value(); + } +#endif //defined(WEBRTC_IOS) + if (from.auto_gain_control.has_value()) { + to.autoGainControl = from.auto_gain_control.value(); + } + if (from.noise_suppression.has_value()) { + to.noiseSuppression = from.noise_suppression.value(); + } + if (from.highpass_filter.has_value()) { + to.highpassFilter = from.highpass_filter.value(); + } + if (from.stereo_swapping.has_value()) { + to.stereoSwapping = from.stereo_swapping.value(); + } + if (from.audio_jitter_buffer_max_packets.has_value()) { + to.audioJitterBufferMaxPackets = SafeInt(from.audio_jitter_buffer_max_packets.value()); + } + if (from.audio_jitter_buffer_fast_accelerate.has_value()) { + to.audioJitterBufferFastAccelerate = from.audio_jitter_buffer_fast_accelerate.value(); + } + if (from.typing_detection.has_value()) { + to.typingDetection = from.typing_detection.value(); + } + if (from.aecm_generate_comfort_noise.has_value()) { + to.aecmGenerateComfortNoise = from.aecm_generate_comfort_noise.value(); + } + if (from.experimental_agc.has_value()) { + to.experimentalAgc = from.experimental_agc.value(); + } + if (from.extended_filter_aec.has_value()) { + to.extendedFilterAec = from.extended_filter_aec.value(); + } + if (from.delay_agnostic_aec.has_value()) { + to.delayAgnosticAec = from.delay_agnostic_aec.value(); + } + if (from.experimental_ns.has_value()) { + to.experimentalNs = from.experimental_ns.value(); + } + if (from.intelligibility_enhancer.has_value()) { + to.intelligibilityEnhancer = from.intelligibility_enhancer.value(); + } + if (from.level_control.has_value()) { + to.levelControl = from.level_control.value(); + } + if (from.level_control_initial_peak_level_dbfs.has_value()) { + to.levelControlInitialPeakLevelDbfs = from.level_control_initial_peak_level_dbfs.value(); + } + if (from.residual_echo_detector.has_value()) { + to.residualEchoDetector = from.residual_echo_detector.value(); + } + if (from.tx_agc_target_dbov.has_value()) { + to.txAgcTargetDbov = SafeInt(from.tx_agc_target_dbov.value()); + } + if (from.tx_agc_digital_compression_gain.has_value()) { + to.txAgcDigitalCompressionGain = SafeInt(from.tx_agc_digital_compression_gain.value()); + } + if (from.tx_agc_limiter.has_value()) { + to.txAgcLimiter = from.tx_agc_limiter.value(); + } + if (from.combined_audio_video_bwe.has_value()) { + to.combinedAudioVideoBwe = from.combined_audio_video_bwe.value(); + } + if (from.audio_network_adaptor.has_value()) { + to.audioNetworkAdaptor = from.audio_network_adaptor.value(); + } + if (from.audio_network_adaptor_config.has_value()) { + to.audioNetworkAdaptorConfig = from.audio_network_adaptor_config.value(); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + if (from.echoCancellation.has_value()) { + to.echo_cancellation = from.echoCancellation.value(); + } +#if defined(WEBRTC_IOS) + if (from.iosForceSoftwareAec_HACK.has_value()) { + to.ios_force_software_aec_HACK = from.iosForceSoftwareAec_HACK.value(); + } +#endif //defined(WEBRTC_IOS) + if (from.autoGainControl.has_value()) { + to.auto_gain_control = from.autoGainControl.value(); + } + if (from.noiseSuppression.has_value()) { + to.noise_suppression = from.noiseSuppression.value(); + } + if (from.highpassFilter.has_value()) { + to.highpass_filter = from.highpassFilter.value(); + } + if (from.stereoSwapping.has_value()) { + to.stereo_swapping = from.stereoSwapping.value(); + } + if (from.audioJitterBufferMaxPackets.has_value()) { + to.audio_jitter_buffer_max_packets = (int)SafeInt(from.audioJitterBufferMaxPackets.value()); + } + if (from.audioJitterBufferFastAccelerate.has_value()) { + to.audio_jitter_buffer_fast_accelerate = from.audioJitterBufferFastAccelerate.value(); + } + if (from.typingDetection.has_value()) { + to.typing_detection = from.typingDetection.value(); + } + if (from.aecmGenerateComfortNoise.has_value()) { + to.aecm_generate_comfort_noise = from.aecmGenerateComfortNoise.value(); + } + if (from.experimentalAgc.has_value()) { + to.experimental_agc = from.experimentalAgc.value(); + } + if (from.extendedFilterAec.has_value()) { + to.extended_filter_aec = from.extendedFilterAec.value(); + } + if (from.delayAgnosticAec.has_value()) { + to.delay_agnostic_aec = from.delayAgnosticAec.value(); + } + if (from.experimentalNs.has_value()) { + to.experimental_ns = from.experimentalNs.value(); + } + if (from.intelligibilityEnhancer.has_value()) { + to.intelligibility_enhancer = from.intelligibilityEnhancer.value(); + } + if (from.levelControl.has_value()) { + to.level_control = from.levelControl.value(); + } + if (from.levelControlInitialPeakLevelDbfs.has_value()) { + to.level_control_initial_peak_level_dbfs = from.levelControlInitialPeakLevelDbfs.value(); + } + if (from.residualEchoDetector.has_value()) { + to.residual_echo_detector = from.residualEchoDetector.value(); + } + if (from.txAgcTargetDbov.has_value()) { + to.tx_agc_target_dbov = (uint16_t)SafeInt(from.txAgcTargetDbov.value()); + } + if (from.txAgcTargetDbov.has_value()) { + to.tx_agc_digital_compression_gain = (uint16_t)SafeInt(from.txAgcDigitalCompressionGain.value()); + } + if (from.txAgcLimiter.has_value()) { + to.tx_agc_limiter = from.txAgcLimiter.value(); + } + if (from.combinedAudioVideoBwe.has_value()) { + to.combined_audio_video_bwe = from.combinedAudioVideoBwe.value(); + } + if (from.combinedAudioVideoBwe.has_value()) { + to.audio_network_adaptor = from.audioNetworkAdaptor.value(); + } + if (from.audioNetworkAdaptorConfig.hasData()) { + to.audio_network_adaptor_config = from.audioNetworkAdaptorConfig; + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_AudioOptions.h b/webrtc/idl/wrapper/impl_org_webRtc_AudioOptions.h new file mode 100644 index 00000000..2cf3053b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_AudioOptions.h @@ -0,0 +1,39 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_AudioOptions.h" + + +#include "impl_org_webRtc_pre_include.h" +#include "api/audio_options.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct AudioOptions : public wrapper::org::webRtc::AudioOptions + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::AudioOptions, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::AudioOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::cricket::AudioOptions, NativeType); + + AudioOptionsWeakPtr thisWeak_; + + AudioOptions() noexcept; + virtual ~AudioOptions() noexcept; + void wrapper_init_org_webRtc_AudioOptions() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_AudioTrackSource.cpp b/webrtc/idl/wrapper/impl_org_webRtc_AudioTrackSource.cpp new file mode 100644 index 00000000..7259a1bf --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_AudioTrackSource.cpp @@ -0,0 +1,208 @@ + +#include "impl_org_webRtc_AudioTrackSource.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_AudioOptions.h" +#include "impl_org_webRtc_MediaConstraints.h" +#include "impl_org_webRtc_WebrtcLib.h" +#include "impl_org_webRtc_enums.h" + +//#include "impl_org_webRtc_pre_include.h" +//#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::AudioTrackSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaConstraints, UseMediaConstraints); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::AudioOptions, UseAudioOptions); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +#if 0 +//------------------------------------------------------------------------------ +static NativeType *unproxy(NativeType *native) +{ + if (!native) return nullptr; + + return WRAPPER_DEPROXIFY_CLASS(::webrtc::AudioSource, ::webrtc::AudioSource, native); +} +#endif //0 + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::AudioTrackSource::AudioTrackSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::AudioTrackSourcePtr wrapper::org::webRtc::AudioTrackSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::AudioTrackSource::~AudioTrackSource() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::AudioTrackSource::wrapper_dispose() noexcept +{ + if (!native_) return; + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::AudioTrackSourcePtr wrapper::org::webRtc::AudioTrackSource::create(wrapper::org::webRtc::AudioOptionsPtr options) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + ZS_ASSERT(factory); + if (!factory) return WrapperTypePtr(); + + auto converted = UseAudioOptions::toNative(options); + + return WrapperImplType::toWrapper(factory->CreateAudioSource(*converted)); +} +//------------------------------------------------------------------------------ +wrapper::org::webRtc::AudioTrackSourcePtr wrapper::org::webRtc::AudioTrackSource::create(wrapper::org::webRtc::MediaConstraintsPtr constraints) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + ZS_ASSERT(factory); + if (!factory) return WrapperTypePtr(); + + auto converted = UseMediaConstraints::toNative(constraints); + + return WrapperImplType::toWrapper(factory->CreateAudioSource(converted.get())); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::AudioTrackSource::wrapper_onObserverCountChanged(ZS_MAYBE_USED() size_t count) noexcept +{ + ZS_MAYBE_USED(count); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourceState wrapper::impl::org::webRtc::AudioTrackSource::get_state() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::MediaSourceState::MediaSourceState_ended; + return UseEnum::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::AudioTrackSource::get_remote() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->remote(); +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::AudioTrackSource::get_volume() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return 0.0; + return lastVolume_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::AudioTrackSource::set_volume(double value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + lastVolume_ = value; + native_->SetVolume(value); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverSetVolume(double volume) noexcept +{ + onSetVolume(volume); +} + + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + if (!native_) return; + if (observer_) return; + + observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); + native_->RegisterAudioObserver(observer_.get()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + if (!observer_) return; + if (!native_) return; + + native_->UnregisterAudioObserver(observer_.get()); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(native, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +rtc::scoped_refptr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_AudioTrackSource.h b/webrtc/idl/wrapper/impl_org_webRtc_AudioTrackSource.h new file mode 100644 index 00000000..9e9c8b6a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_AudioTrackSource.h @@ -0,0 +1,83 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_AudioTrackSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "api/mediastreaminterface.h" +#include "impl_org_webRtc_post_include.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct AudioTrackSource : public wrapper::org::webRtc::AudioTrackSource + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::AudioTrackSource, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::AudioTrackSource, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::AudioSourceInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + ZS_DECLARE_STRUCT_PTR(WebrtcObserver); + + struct WebrtcObserver : public NativeType::AudioObserver + { + WebrtcObserver( + WrapperImplTypePtr wrapper, + IMessageQueuePtr queue + ) noexcept : outer_(wrapper), queue_(queue) {} + + void OnSetVolume(double volume) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, volume]() { outer->onWebrtcObserverSetVolume(volume); }); + } + + private: + WrapperImplTypeWeakPtr outer_; + IMessageQueuePtr queue_; + }; + + std::atomic lastVolume_; + WebrtcObserverUniPtr observer_; + NativeTypeScopedPtr native_; + AudioTrackSourceWeakPtr thisWeak_; + + AudioTrackSource() noexcept; + virtual ~AudioTrackSource() noexcept; + void wrapper_dispose() noexcept override; + + + // properties MediaTrackSource + wrapper::org::webRtc::MediaSourceState get_state() noexcept override; + bool get_remote() noexcept override; + + // properties AudioTrackSource + double get_volume() noexcept override; + void set_volume(double value) noexcept override; + + void wrapper_onObserverCountChanged(size_t count) noexcept override; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + // WebrtcObserver methods + void onWebrtcObserverSetVolume(double volume) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_Constraint.cpp b/webrtc/idl/wrapper/impl_org_webRtc_Constraint.cpp new file mode 100644 index 00000000..b553932b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_Constraint.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_webRtc_Constraint.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::Constraint::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::Constraint::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::Constraint::Constraint() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::ConstraintPtr wrapper::org::webRtc::Constraint::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::Constraint::~Constraint() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::Constraint::wrapper_init_org_webRtc_Constraint() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::Constraint::wrapper_init_org_webRtc_Constraint(wrapper::org::webRtc::ConstraintPtr source) noexcept +{ + if (!source) { + native_ = make_shared(); + return; + } + native_ = make_shared(source->get_key(), source->get_value()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::Constraint::wrapper_init_org_webRtc_Constraint( + String key, + String value + ) noexcept +{ + native_ = make_shared(key, value); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::Constraint::get_key() noexcept +{ + if (!native_) return String(); + return native_->key; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::Constraint::set_key(String value) noexcept +{ + if (!native_) return; + native_->key = value; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::Constraint::get_value() noexcept +{ + if (!native_) return String(); + return native_->value; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::Constraint::set_value(String value) noexcept +{ + if (!native_) return; + native_->value = value; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(native.key, native.value); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return nullptr; + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return nullptr; + auto cast = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!cast) return nullptr; + return cast->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_Constraint.h b/webrtc/idl/wrapper/impl_org_webRtc_Constraint.h new file mode 100644 index 00000000..2d402d50 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_Constraint.h @@ -0,0 +1,53 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_Constraint.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/mediaconstraintsinterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct Constraint : public wrapper::org::webRtc::Constraint + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::Constraint, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::Constraint, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::MediaConstraintsInterface::Constraint, NativeType); + + NativeTypePtr native_; + ConstraintWeakPtr thisWeak_; + + Constraint() noexcept; + virtual ~Constraint() noexcept; + + + // methods Constraint + void wrapper_init_org_webRtc_Constraint() noexcept override; + void wrapper_init_org_webRtc_Constraint(wrapper::org::webRtc::ConstraintPtr source) noexcept override; + void wrapper_init_org_webRtc_Constraint( + String key, + String value + ) noexcept override; + + // properties Constraint + String get_key() noexcept override; + void set_key(String value) noexcept override; + String get_value() noexcept override; + void set_value(String value) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_EventQueue.cpp b/webrtc/idl/wrapper/impl_org_webRtc_EventQueue.cpp new file mode 100644 index 00000000..b26bf1c9 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_EventQueue.cpp @@ -0,0 +1,226 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#include +#endif //WINUWP + +#include "impl_org_webRtc_EventQueue.h" +#include "impl_org_webRtc_helpers.h" + +#include + + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::EventQueue::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(EventQueueWrapperAnyCx); + + struct EventQueueWrapperAnyCx : Any + { + Windows::UI::Core::CoreDispatcher^ queue_ {nullptr}; + }; +} } } } + +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(EventQueueWrapperAnyCx); + + struct EventQueueWrapperAnyWinrt : Any + { + winrt::Windows::UI::Core::CoreDispatcher queue_ {nullptr}; + }; +} } } } + +#endif // CPPWINRT_VERSION + +#else + + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(EventQueueWrapperAny); + + struct EventQueueWrapperAny : Any + { + ::zsLib::IMessageQueuePtr queue_ {nullptr}; + }; +} } } } + +#endif //WINUWP + +//------------------------------------------------------------------------------ +static wrapper::org::webRtc::EventQueuePtr &getSingleton() noexcept +{ + static wrapper::org::webRtc::EventQueuePtr singleton_ {}; + return singleton_; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::EventQueue::EventQueue() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr wrapper::org::webRtc::EventQueue::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::EventQueue::~EventQueue() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::EventQueue::wrapper_init_org_webRtc_EventQueue(AnyPtr queue) noexcept +{ + ZS_ASSERT(queue); + queue_ = queue; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr wrapper::org::webRtc::EventQueue::getDefaultForUi() noexcept +{ +#ifndef WINUWP + auto result {std::make_shared()}; + auto any {std::make_shared()}; + any->queue_ = zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue(); + result->queue_ = any; + return result; +#else + return get_singleton(); +#endif //ndef WINUWP +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr wrapper::org::webRtc::EventQueue::get_singleton() noexcept +{ + return getSingleton(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::webRtc::EventQueue::set_singleton(wrapper::org::webRtc::EventQueuePtr value) noexcept +{ + getSingleton() = value; +} + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +wrapper::org::webRtc::EventQueuePtr wrapper::impl::org::webRtc::EventQueue::toWrapper(Windows::UI::Core::CoreDispatcher^ queue) noexcept +{ + auto any {make_shared()}; + any->queue_ = queue; + auto result = wrapper::org::webRtc::EventQueue::wrapper_create(); + result->wrapper_init_org_webRtc_EventQueue(any); + return result; +} + +Windows::UI::Core::CoreDispatcher^ wrapper::impl::org::webRtc::EventQueue::toNative_cx(wrapper::org::webRtc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + AnyPtr any = queue->get_queue(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::EventQueueWrapperAnyCx, any); + if (!castedAny) { +#ifdef CPPWINRT_VERSION + auto result = toNative_winrt(queue); + if (result) return WRAPPER_TO_CX(Windows::UI::Core::CoreDispatcher, result); +#endif //CPPWINRT_VERSION + return nullptr; + } + return castedAny->queue_; +} +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +wrapper::org::webRtc::EventQueuePtr wrapper::impl::org::webRtc::EventQueue::toWrapper(winrt::Windows::UI::Core::CoreDispatcher queue) noexcept +{ + auto any {make_shared()}; + any->queue_ = queue; + auto result = wrapper::org::webRtc::EventQueue::wrapper_create(); + result->wrapper_init_org_webRtc_EventQueue(any); + return result; +} + +winrt::Windows::UI::Core::CoreDispatcher wrapper::impl::org::webRtc::EventQueue::toNative_winrt(wrapper::org::webRtc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + AnyPtr any = queue->get_queue(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::EventQueueWrapperAnyWinrt, any); + if (!castedAny) { +#ifdef __cplusplus_winrt + auto result = toNative_cx(queue); + if (result) return WRAPPER_FROM_CX(winrt::Windows::UI::Core::CoreDispatcher, result); +#endif //__cplusplus_winrt + return nullptr; + } + return castedAny->queue_; +} + +#endif // CPPWINRT_VERSION + +#else + +wrapper::org::webRtc::EventQueuePtr wrapper::impl::org::webRtc::EventQueue::toWrapper(::zsLib::IMessageQueuePtr queue) noexcept +{ + auto any {make_shared()}; + any->queue_ = queue; + auto result = wrapper::org::webRtc::EventQueue::wrapper_create(); + result->wrapper_init_org_webRtc_EventQueue(any); + return result; +} + +::zsLib::IMessageQueuePtr wrapper::impl::org::webRtc::EventQueue::toNative(wrapper::org::webRtc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + AnyPtr any = queue->get_queue(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::EventQueueWrapperAny, any); + if (!castedAny) return nullptr; + return castedAny->queue_; +} + +#endif //WINUWP diff --git a/webrtc/idl/wrapper/impl_org_webRtc_EventQueue.h b/webrtc/idl/wrapper/impl_org_webRtc_EventQueue.h new file mode 100644 index 00000000..99a42812 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_EventQueue.h @@ -0,0 +1,51 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_EventQueue.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct EventQueue : public wrapper::org::webRtc::EventQueue + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::EventQueue, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::EventQueue, WrapperImplType); + EventQueueWeakPtr thisWeak_; + + AnyPtr queue_{}; + + EventQueue() noexcept; + virtual ~EventQueue() noexcept; + + + // methods EventQueue + void wrapper_init_org_webRtc_EventQueue(AnyPtr queue) noexcept override; + + // properties EventQueue + AnyPtr get_queue() noexcept override { return queue_; } + +#ifdef WINUWP +#ifdef __cplusplus_winrt + ZS_NO_DISCARD() static wrapper::org::webRtc::EventQueuePtr toWrapper(Windows::UI::Core::CoreDispatcher^ queue) noexcept; + ZS_NO_DISCARD() static Windows::UI::Core::CoreDispatcher^ toNative_cx(wrapper::org::webRtc::EventQueuePtr queue) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + ZS_NO_DISCARD() static wrapper::org::webRtc::EventQueuePtr toWrapper(winrt::Windows::UI::Core::CoreDispatcher queue) noexcept; + ZS_NO_DISCARD() static winrt::Windows::UI::Core::CoreDispatcher toNative_winrt(wrapper::org::webRtc::EventQueuePtr queue) noexcept; +#endif // CPPWINRT_VERSION +#else + ZS_NO_DISCARD() static wrapper::org::webRtc::EventQueuePtr toWrapper(::zsLib::IMessageQueuePtr queue) noexcept; + ZS_NO_DISCARD() static ::zsLib::IMessageQueuePtr toNative(wrapper::org::webRtc::EventQueuePtr queue) noexcept; +#endif //WINUWP + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_EventQueueMaker.cpp b/webrtc/idl/wrapper/impl_org_webRtc_EventQueueMaker.cpp new file mode 100644 index 00000000..a75ed054 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_EventQueueMaker.cpp @@ -0,0 +1,48 @@ + +#include "impl_org_webRtc_EventQueue.h" +#include "impl_org_webRtc_EventQueueMaker.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::EventQueueMaker::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::EventQueueMaker::~EventQueueMaker() noexcept +{ +} + +#if 0 +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr wrapper::org::webRtc::EventQueueMaker::bind(AnyPtr queue) noexcept +{ + wrapper::org::webRtc::EventQueuePtr result = wrapper::org::webRtc::EventQueue::wrapper_create(); + result->wrapper_init_org_webRtc_EventQueue(queue); + return result; +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::org::webRtc::EventQueueMaker::extract(wrapper::org::webRtc::EventQueuePtr queue) noexcept +{ + if (!queue) return nullptr; + return queue->get_queue(); +} +#endif //0 + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_EventQueueMaker.h b/webrtc/idl/wrapper/impl_org_webRtc_EventQueueMaker.h new file mode 100644 index 00000000..12e94059 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_EventQueueMaker.h @@ -0,0 +1,27 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_EventQueueMaker.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct EventQueueMaker : public wrapper::org::webRtc::EventQueueMaker + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::EventQueueMaker, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::EventQueueMaker, WrapperImplType); + EventQueueMaker() noexcept = delete; + EventQueueMaker(const EventQueueMaker &) noexcept = delete; + virtual ~EventQueueMaker() noexcept; + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaConstraints.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaConstraints.cpp new file mode 100644 index 00000000..b45ec595 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaConstraints.cpp @@ -0,0 +1,196 @@ + +#include "impl_org_webRtc_MediaConstraints.h" +#include "impl_org_webRtc_Constraint.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaConstraints::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeImplType, NativeImplType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::Constraint, WrapperConstraintType); + +//------------------------------------------------------------------------------ +NativeImplType::~MediaConstraintsImpl() noexcept +{ +} + +//------------------------------------------------------------------------------ +NativeImplType::MediaConstraintsImpl() noexcept +{ +} + +//------------------------------------------------------------------------------ +NativeImplType::MediaConstraintsImpl( + const NativeType::Constraints& mandatory, + const NativeType::Constraints& optional +) noexcept : mandatory_(mandatory), optional_(optional) +{ +} + +//------------------------------------------------------------------------------ +const NativeType::Constraints& NativeImplType::GetMandatory() const +{ + return mandatory_; +} + +//------------------------------------------------------------------------------ +const NativeType::Constraints& NativeImplType::GetOptional() const +{ + return optional_; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaConstraints::MediaConstraints() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaConstraintsPtr wrapper::org::webRtc::MediaConstraints::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaConstraints::~MediaConstraints() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaConstraints::wrapper_init_org_webRtc_MediaConstraints() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaConstraints::wrapper_init_org_webRtc_MediaConstraints(wrapper::org::webRtc::MediaConstraintsPtr source) noexcept +{ + if (!source) { + native_ = make_shared(); + return; + } + wrapper_init_org_webRtc_MediaConstraints(source->get_mandatory(), source->get_optional()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaConstraints::wrapper_init_org_webRtc_MediaConstraints( + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > mandatory, + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > optional + ) noexcept +{ + native_ = make_shared(); + set_mandatory(mandatory); + set_optional(optional); +} + +//------------------------------------------------------------------------------ +static shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > toWrapperList(const NativeType::Constraints &constraints) +{ + auto result = make_shared< list< wrapper::org::webRtc::ConstraintPtr > >(); + + for (auto iter = constraints.begin(); iter != constraints.end(); ++iter) { + auto &constraint = (*iter); + auto converted = WrapperConstraintType::toWrapper(constraint); + if (!converted) continue; + result->push_back(converted); + } + return result; +} + +//------------------------------------------------------------------------------ +void fillNativeList( + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > value, + NativeType::Constraints &output +) +{ + if (!value) return; + for (auto iter = value->begin(); iter != value->end(); ++iter) { + auto &wrapperType = (*iter); + auto converted = WrapperConstraintType::toNative(wrapperType); + if (!converted) continue; + output.push_back(*converted); + } +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > wrapper::impl::org::webRtc::MediaConstraints::get_mandatory() noexcept +{ + if (!native_) return nullptr; + return toWrapperList(native_->GetMandatory()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaConstraints::set_mandatory(shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > value) noexcept +{ + if (!native_) return; + + NativeType::Constraints constraints; + native_->mandatory_.clear(); + fillNativeList(value, native_->mandatory_); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > wrapper::impl::org::webRtc::MediaConstraints::get_optional() noexcept +{ + if (!native_) return nullptr; + return toWrapperList(native_->GetOptional()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaConstraints::set_optional(shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > value) noexcept +{ + if (!native_) return; + + NativeType::Constraints constraints; + native_->optional_.clear(); + fillNativeList(value, native_->optional_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto nativeImpl = make_shared(native.GetMandatory(), native.GetOptional()); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = nativeImpl; + return result; +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + ZS_ASSERT(converted); + if (!converted) return NativeTypePtr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaConstraints.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaConstraints.h new file mode 100644 index 00000000..fdf60c24 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaConstraints.h @@ -0,0 +1,69 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MediaConstraints.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/mediaconstraintsinterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MediaConstraints : public wrapper::org::webRtc::MediaConstraints + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaConstraints, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaConstraints, WrapperImplType); + + struct MediaConstraintsImpl : public ::webrtc::MediaConstraintsInterface { + public: + virtual ~MediaConstraintsImpl() noexcept; + MediaConstraintsImpl() noexcept; + MediaConstraintsImpl( + const MediaConstraintsInterface::Constraints& mandatory, + const MediaConstraintsInterface::Constraints& optional) noexcept; + const MediaConstraintsInterface::Constraints& GetMandatory() const override; + const MediaConstraintsInterface::Constraints& GetOptional() const override; + + MediaConstraintsInterface::Constraints mandatory_; + MediaConstraintsInterface::Constraints optional_; + }; + + ZS_DECLARE_TYPEDEF_PTR(::webrtc::MediaConstraintsInterface, NativeType); + ZS_DECLARE_TYPEDEF_PTR(MediaConstraintsImpl, NativeImplType); + + NativeImplTypePtr native_; + MediaConstraintsWeakPtr thisWeak_; + + MediaConstraints() noexcept; + virtual ~MediaConstraints() noexcept; + + + // methods MediaConstraints + void wrapper_init_org_webRtc_MediaConstraints() noexcept override; + void wrapper_init_org_webRtc_MediaConstraints(wrapper::org::webRtc::MediaConstraintsPtr source) noexcept override; + void wrapper_init_org_webRtc_MediaConstraints( + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > mandatory, + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > optional + ) noexcept override; + + // properties MediaConstraints + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > get_mandatory() noexcept override; + void set_mandatory(shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > value) noexcept override; + shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > get_optional() noexcept override; + void set_optional(shared_ptr< list< wrapper::org::webRtc::ConstraintPtr > > value) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaElement.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaElement.cpp new file mode 100644 index 00000000..59236ead --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaElement.cpp @@ -0,0 +1,203 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#ifdef _WIN32 +#include +#endif //_WIN32 + +#endif //WINUWP + +#include "impl_org_webRtc_MediaElement.h" +#include "impl_org_webRtc_helpers.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaElement::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(MediaElementWrapperAnyCx); + + struct MediaElementWrapperAnyCx : Any + { + Windows::UI::Xaml::Controls::MediaElement^ element_ {nullptr}; + }; +} } } } + +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(MediaElementWrapperAnyCx); + + struct MediaElementWrapperAnyWinrt : Any + { + winrt::Windows::UI::Xaml::Controls::MediaElement element_ {nullptr}; + }; +} } } } + +#endif // CPPWINRT_VERSION + +#else + + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(MediaElementWrapperAny); + + struct MediaElementWrapperAny : Any + { + HWND element_ {}; + }; +} } } } + +#endif //WINUWP + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaElement::MediaElement() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr wrapper::org::webRtc::MediaElement::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaElement::~MediaElement() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaElement::wrapper_init_org_webRtc_MediaElement(AnyPtr element) noexcept +{ + ZS_ASSERT(element); + element_ = element; +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::impl::org::webRtc::MediaElement::get_element() noexcept +{ + return element_; +} + + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +wrapper::org::webRtc::MediaElementPtr wrapper::impl::org::webRtc::MediaElement::toWrapper(Windows::UI::Xaml::Controls::MediaElement^ element) noexcept +{ + auto any{ make_shared() }; + any->element_ = element; + auto result = make_shared(); + result->thisWeak_ = result; + result->element_ = any; + return result; +} + +Windows::UI::Xaml::Controls::MediaElement^ wrapper::impl::org::webRtc::MediaElement::toNative_cx(wrapper::org::webRtc::MediaElementPtr element) noexcept +{ + if (!element) return nullptr; + AnyPtr any = element->get_element(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaElementWrapperAnyCx, any); + if (!castedAny) { +#ifdef CPPWINRT_VERSION + auto result = toNative_winrt(element); + if (result) return WRAPPER_TO_CX(Windows::UI::Xaml::Controls::MediaElement, result); +#endif //CPPWINRT_VERSION + return nullptr; + } + return castedAny->element_; +} +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +wrapper::org::webRtc::MediaElementPtr wrapper::impl::org::webRtc::MediaElement::toWrapper(winrt::Windows::UI::Xaml::Controls::MediaElement const & element) noexcept +{ + auto any{ make_shared() }; + any->element_ = element; + auto result = make_shared(); + result->thisWeak_ = result; + result->element_ = any; + return result; +} + +winrt::Windows::UI::Xaml::Controls::MediaElement wrapper::impl::org::webRtc::MediaElement::toNative_winrt(wrapper::org::webRtc::MediaElementPtr element) noexcept +{ + if (!element) return nullptr; + AnyPtr any = element->get_element(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaElementWrapperAnyWinrt, any); + if (!castedAny) { +#ifdef __cplusplus_winrt + auto result = toNative_cx(element); + if (result) return WRAPPER_FROM_CX(winrt::Windows::UI::Xaml::Controls::MediaElement, result); +#endif //__cplusplus_winrt + return nullptr; + } + return castedAny->element_; +} + +#endif // CPPWINRT_VERSION + +#else + +wrapper::org::webRtc::MediaElementPtr wrapper::impl::org::webRtc::MediaElement::toWrapper(HWND element) noexcept +{ + auto any{ make_shared() }; + any->element_ = element; + auto result = wrapper::org::webRtc::MediaElement::wrapper_create(); + any->element_ = element; + return result; +} + +HWND wrapper::impl::org::webRtc::MediaElement::toNative(wrapper::org::webRtc::MediaElementPtr element) noexcept +{ + if (!element) return nullptr; + AnyPtr any = element->get_element(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaElementWrapperAny, any); + if (!castedAny) return nullptr; + return castedAny->element_; +} + +#endif //WINUWP + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaElement.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaElement.h new file mode 100644 index 00000000..ed9ec53e --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaElement.h @@ -0,0 +1,60 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MediaElement.h" + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION +#include +#endif // CPPWINRT_VERSION + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MediaElement : public wrapper::org::webRtc::MediaElement + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaElement, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaElement, WrapperImplType); + + AnyPtr element_{}; + MediaElementWeakPtr thisWeak_; + + MediaElement() noexcept; + virtual ~MediaElement() noexcept; + + + // methods MediaElement + void wrapper_init_org_webRtc_MediaElement(AnyPtr element) noexcept override; + + // properties MediaElement + AnyPtr get_element() noexcept override; + +#ifdef WINUWP +#ifdef __cplusplus_winrt + ZS_NO_DISCARD() static wrapper::org::webRtc::MediaElementPtr toWrapper(Windows::UI::Xaml::Controls::MediaElement^ element) noexcept; + ZS_NO_DISCARD() static Windows::UI::Xaml::Controls::MediaElement^ toNative_cx(wrapper::org::webRtc::MediaElementPtr element) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + ZS_NO_DISCARD() static wrapper::org::webRtc::MediaElementPtr toWrapper(winrt::Windows::UI::Xaml::Controls::MediaElement const & element) noexcept; + ZS_NO_DISCARD() static winrt::Windows::UI::Xaml::Controls::MediaElement toNative_winrt(wrapper::org::webRtc::MediaElementPtr element) noexcept; +#endif // CPPWINRT_VERSION +#else +#ifdef _WIN32 + ZS_NO_DISCARD() static wrapper::org::webRtc::MediaElementPtr toWrapper(HWND element) noexcept; + ZS_NO_DISCARD() static element toNative(wrapper::org::webRtc::MediaElementPtr element) noexcept; +#endif //_WIN32 +#endif //WINUWP + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaElementMaker.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaElementMaker.cpp new file mode 100644 index 00000000..bd32a11c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaElementMaker.cpp @@ -0,0 +1,46 @@ + +#include "impl_org_webRtc_MediaElementMaker.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaElementMaker::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaElementMaker::~MediaElementMaker() noexcept +{ +} + +#if 0 +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr wrapper::org::webRtc::MediaElementMaker::bind(AnyPtr element) noexcept +{ + wrapper::org::webRtc::MediaElementPtr result {}; + return result; +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::org::webRtc::MediaElementMaker::extract(wrapper::org::webRtc::MediaElementPtr element) noexcept +{ + AnyPtr result {}; + return result; +} +#endif //0 + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaElementMaker.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaElementMaker.h new file mode 100644 index 00000000..0badf5d4 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaElementMaker.h @@ -0,0 +1,27 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MediaElementMaker.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MediaElementMaker : public wrapper::org::webRtc::MediaElementMaker + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaElementMaker, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaElementMaker, WrapperImplType); + MediaElementMaker() noexcept = delete; + MediaElementMaker(const MediaElementMaker &) noexcept = delete; + virtual ~MediaElementMaker() noexcept; + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaSource.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaSource.cpp new file mode 100644 index 00000000..fc36da9c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaSource.cpp @@ -0,0 +1,187 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#ifdef _WIN32 +#endif //_WIN32 + +#endif //WINUWP + +#include "impl_org_webRtc_MediaSource.h" +#include "impl_org_webRtc_helpers.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(MediaSourceWrapperAnyCx); + + struct MediaSourceWrapperAnyCx : Any + { + Windows::Media::Core::IMediaSource^ source_ {nullptr}; + }; +} } } } + +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(MediaSourceWrapperAnyWinrt); + + struct MediaSourceWrapperAnyWinrt : Any + { + winrt::Windows::Media::Core::IMediaSource source_ {nullptr}; + }; +} } } } + +#endif // CPPWINRT_VERSION + +#else + + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(MediaSourceWrapperAny); + + struct MediaSourceWrapperAny : Any + { + HWND source_ {}; + }; +} } } } + +#endif //WINUWP + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaSource::MediaSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr wrapper::org::webRtc::MediaSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaSource::~MediaSource() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaSource::wrapper_init_org_webRtc_MediaSource(AnyPtr source) noexcept +{ + ZS_ASSERT(source); + source_ = source; +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::impl::org::webRtc::MediaSource::get_source() noexcept +{ + return source_; +} + + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +WrapperImplTypePtr wrapper::impl::org::webRtc::MediaSource::toWrapper(Windows::Media::Core::IMediaSource^ source) noexcept +{ + auto any{ make_shared() }; + any->source_ = source; + auto result = make_shared(); + result->thisWeak_ = result; + result->source_ = any; + return result; +} + +Windows::Media::Core::IMediaSource^ wrapper::impl::org::webRtc::MediaSource::toNative_cx(wrapper::org::webRtc::MediaSourcePtr source) noexcept +{ + if (!source) return nullptr; + AnyPtr any = source->get_source(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaSourceWrapperAnyCx, any); + if (!castedAny) { +#ifdef CPPWINRT_VERSION + auto result = toNative_winrt(source); + if (result) return WRAPPER_TO_CX(Windows::Media::Core::IMediaSource, result); +#endif //CPPWINRT_VERSION + return nullptr; + } + return castedAny->source_; +} +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +WrapperImplTypePtr wrapper::impl::org::webRtc::MediaSource::toWrapper(winrt::Windows::Media::Core::IMediaSource const & source) noexcept +{ + auto any{ make_shared() }; + any->source_ = source; + auto result = make_shared(); + result->thisWeak_ = result; + result->source_ = any; + return result; +} + +winrt::Windows::Media::Core::IMediaSource wrapper::impl::org::webRtc::MediaSource::toNative_winrt(wrapper::org::webRtc::MediaSourcePtr source) noexcept +{ + if (!source) return nullptr; + AnyPtr any = source->get_source(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::MediaSourceWrapperAnyWinrt, any); + if (!castedAny) { +#ifdef __cplusplus_winrt + auto result = toNative_cx(source); + if (result) return WRAPPER_FROM_CX(winrt::Windows::Media::Core::IMediaSource, result); +#endif //__cplusplus_winrt + return nullptr; + } + return castedAny->source_; +} + +#endif // CPPWINRT_VERSION + +#else + +#ifdef _WIN32 +#endif //_WIN32 + +#endif //WINUWP + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaSource.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaSource.h new file mode 100644 index 00000000..6aeff562 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaSource.h @@ -0,0 +1,55 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MediaSource.h" + +#ifdef CPPWINRT_VERSION +#include +#endif // CPPWINRT_VERSION + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MediaSource : public wrapper::org::webRtc::MediaSource + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaSource, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaSource, WrapperImplType); + + AnyPtr source_{}; + + MediaSourceWeakPtr thisWeak_; + + MediaSource() noexcept; + virtual ~MediaSource() noexcept; + + + // methods MediaSource + void wrapper_init_org_webRtc_MediaSource(AnyPtr source) noexcept override; + + // properties MediaSource + AnyPtr get_source() noexcept override; + +#ifdef WINUWP +#ifdef __cplusplus_winrt + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(Windows::Media::Core::IMediaSource^ source) noexcept; + ZS_NO_DISCARD() static Windows::Media::Core::IMediaSource^ toNative_cx(wrapper::org::webRtc::MediaSourcePtr source) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(winrt::Windows::Media::Core::IMediaSource const & source) noexcept; + ZS_NO_DISCARD() static winrt::Windows::Media::Core::IMediaSource toNative_winrt(wrapper::org::webRtc::MediaSourcePtr source) noexcept; +#endif // CPPWINRT_VERSION +#else +#ifdef _WIN32 +#endif //_WIN32 +#endif //WINUWP + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaSourceHelper_cx.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaSourceHelper_cx.cpp new file mode 100644 index 00000000..0993b426 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaSourceHelper_cx.cpp @@ -0,0 +1,391 @@ +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#include "impl_org_webRtc_MediaSourceHelper_cx.h" +#include +#include +#include + + +#include +#include "api/videosourceinterface.h" +#include "libyuv/convert.h" +#include "modules/video_coding/timing.h" +#include "third_party/winuwp_h264/H264Decoder/H264Decoder.h" +#include + +// note: +/* +using Microsoft::WRL::ComPtr; +using Platform::Collections::Vector; +using Windows::Media::Core::VideoStreamDescriptor; +using Windows::Media::Core::MediaStreamSourceSampleRequestedEventArgs; +using Windows::Media::Core::MediaStreamSourceSampleRequest; +using Windows::Media::Core::MediaStreamSourceStartingEventArgs; +using Windows::Media::Core::MediaStreamSource; +using Windows::Media::MediaProperties::VideoEncodingProperties; +using Windows::Media::MediaProperties::MediaEncodingSubtypes; +using Windows::System::Threading::TimerElapsedHandler; +using Windows::System::Threading::ThreadPoolTimer; +*/ + +// Helper functions defined below. +static bool IsSampleIDR(IMFSample* sample); +static bool DropFramesToIDR(std::list& frames); + +using wrapper::impl::org::webRtc::SampleData; +using wrapper::impl::org::webRtc::MediaSourceHelper; +using wrapper::impl::org::webRtc::FirstFrameRenderHelper; +using wrapper::impl::org::webRtc::VideoFrameType; + +//----------------------------------------------------------------------------- +SampleData::SampleData() + : sizeHasChanged(false) + , size({ -1, -1 }) + , rotationHasChanged(false) + , rotation(-1) { +} + +//----------------------------------------------------------------------------- +MediaSourceHelper::MediaSourceHelper( + VideoFrameType frameType, + std::function mkSample, + std::function fpsCallback + ) : + _mkSample(mkSample), + _fpsCallback(fpsCallback), + _frameType(frameType), + _isFirstFrame(true), + _futureOffsetMs(45), + _lastSampleTime(0), + _lastSize({ 0, 0 }), + _lastRotation(-1), + _frameCounter(0), + _startTime(0), + _lastTimeFPSCalculated(rtc::TimeMillis()) { +} + +//----------------------------------------------------------------------------- +MediaSourceHelper::~MediaSourceHelper() +{ + rtc::CritScope lock(&_critSect); + // Clear the buffered frames. + while (!_frames.empty()) { + std::unique_ptr frame(_frames.front()); + _frames.pop_front(); + } +} + +//----------------------------------------------------------------------------- +void MediaSourceHelper::QueueFrame(webrtc::VideoFrame* frame) +{ + rtc::CritScope lock(&_critSect); + + if (_frameType == VideoFrameType::FrameTypeH264) { + // Check it is really a H.264 frame, the codec might have been switched within the call, in this case just ignore frames + if (frame->video_frame_buffer()->ToI420() == nullptr) { + // For H264 we keep all frames since they are encoded. + _frames.push_back(frame); + } else { + // Delete the frame, it's not the expected codec + delete frame; + } + } else { + // Check it is not H.264 frame, the codec might have been switched within the call, in this case just ignore frames + if (frame->video_frame_buffer()->ToI420() != nullptr) { + // For I420 frame, keep only the latest. + for (auto oldFrame : _frames) { + delete oldFrame; + } + _frames.clear(); + _frames.push_back(frame); + } else { + // Delete the frame, it's not the expected codec + delete frame; + } + } +} + +//----------------------------------------------------------------------------- +std::unique_ptr MediaSourceHelper::DequeueFrame() +{ + rtc::CritScope lock(&_critSect); + + if (_frames.size() == 0) { + return nullptr; + } + + std::unique_ptr data; + if (_frameType == VideoFrameType::FrameTypeH264) { + data = DequeueH264Frame(); + } else { + data = DequeueI420Frame(); + } + + if (_frameType == VideoFrameType::FrameTypeI420) { + // Set the timestamp property + if (_isFirstFrame) { + _isFirstFrame = false; + FirstFrameRenderHelper::FireEvent(rtc::TimeMillis() * rtc::kNumMillisecsPerSec); + LONGLONG frameTime = GetNextSampleTimeHns(data->renderTime, _frameType == VideoFrameType::FrameTypeH264); + data->sample->SetSampleTime(frameTime); + } + else { + LONGLONG frameTime = GetNextSampleTimeHns(data->renderTime, _frameType == VideoFrameType::FrameTypeH264); + + data->sample->SetSampleTime(frameTime); + + // Set the duration property + if (_frameType == VideoFrameType::FrameTypeH264) { + data->sample->SetSampleDuration(frameTime - _lastSampleTime); + } + else { + LONGLONG duration = (LONGLONG)((1.0 / 30) * 1000 * 1000 * 10); + data->sample->SetSampleDuration(duration); + } + _lastSampleTime = frameTime; + } + } + + UpdateFrameRate(); + + return data; +} + +//----------------------------------------------------------------------------- +bool MediaSourceHelper::HasFrames() +{ + rtc::CritScope lock(&_critSect); + return _frames.size() > 0; +} + +// === Private functions below === + +//----------------------------------------------------------------------------- +std::unique_ptr MediaSourceHelper::DequeueH264Frame() +{ + + if (_frames.size() > 15) + DropFramesToIDR(_frames); + + std::unique_ptr frame(_frames.front()); + _frames.pop_front(); + + std::unique_ptr data(new SampleData); + + // Get the IMFSample in the frame. + { + rtc::scoped_refptr frameBuffer = + static_cast(frame->video_frame_buffer().get()); + IMFSample* tmp = (IMFSample*)frameBuffer->native_handle(); + if (tmp != nullptr) { + tmp->AddRef(); + data->sample.Attach(tmp); + + ComPtr sampleAttributes; + data->sample.As(&sampleAttributes); + if (IsSampleIDR(tmp)) { + // sampleAttributes->SetUINT32(MFSampleExtension_Discontinuity, TRUE); + sampleAttributes->SetUINT32(MFSampleExtension_CleanPoint, TRUE); + } + } + } + + CheckForAttributeChanges(frame.get(), data.get()); + return data; +} + +//----------------------------------------------------------------------------- +std::unique_ptr MediaSourceHelper::DequeueI420Frame() +{ + std::unique_ptr frame(_frames.front()); + _frames.pop_front(); + + std::unique_ptr data(new SampleData); + + if (FAILED(_mkSample(frame.get(), &data->sample))) { + return nullptr; + } + + ComPtr sampleAttributes; + data->sample.As(&sampleAttributes); + sampleAttributes->SetUINT32(MFSampleExtension_CleanPoint, TRUE); + sampleAttributes->SetUINT32(MFSampleExtension_Discontinuity, TRUE); + + CheckForAttributeChanges(frame.get(), data.get()); + return data; +} + +// Guid to cache the IDR check result in the sample attributes. +static const GUID GUID_IS_IDR = { 0x588e319a, 0x218c, 0x4d0d,{ 0x99, 0x6e, 0x77, 0x96, 0xb1, 0x46, 0x3e, 0x7e } }; + +//----------------------------------------------------------------------------- +static bool IsSampleIDR(IMFSample* sample) +{ + ComPtr sampleAttributes; + sample->QueryInterface(&sampleAttributes); + + UINT32 isIdr; + if (SUCCEEDED(sampleAttributes->GetUINT32(GUID_IS_IDR, &isIdr))) { + return isIdr > 0; + } + + ComPtr pBuffer; + sample->GetBufferByIndex(0, &pBuffer); + BYTE* pBytes; + DWORD maxLength, curLength; + if (FAILED(pBuffer->Lock(&pBytes, &maxLength, &curLength))) { + return false; + } + + // Search for the beginnings of nal units. + for (DWORD i = 0; i < curLength - 5; ++i) { + BYTE* ptr = pBytes + i; + int prefixLengthFound = 0; + if (ptr[0] == 0x00 && ptr[1] == 0x00 && ptr[2] == 0x00 && ptr[3] == 0x01) { + prefixLengthFound = 4; + } else if (ptr[0] == 0x00 && ptr[1] == 0x00 && ptr[2] == 0x01) { + prefixLengthFound = 3; + } + + if (prefixLengthFound > 0 && (ptr[prefixLengthFound] & 0x1f) == 0x05) { + // Found IDR NAL unit + pBuffer->Unlock(); + sampleAttributes->SetUINT32(GUID_IS_IDR, 1); // Cache result + return true; + } + } + pBuffer->Unlock(); + sampleAttributes->SetUINT32(GUID_IS_IDR, 0); // Cache result + return false; +} + +//----------------------------------------------------------------------------- +static bool DropFramesToIDR(std::list& frames) +{ + webrtc::VideoFrame* idrFrame = nullptr; + // Go through the frames in reverse order (from newest to oldest) and look + // for an IDR frame. + for (auto it = frames.rbegin(); it != frames.rend(); ++it) { + if ((*it)->video_frame_buffer()->ToI420() != nullptr) { + continue; // Frame type is I420, skip it + } + rtc::scoped_refptr frameBuffer = + static_cast((*it)->video_frame_buffer().get()); + IMFSample* pSample = (IMFSample*)frameBuffer->native_handle(); + if (pSample == nullptr) { + continue; // I don't expect this will ever happen. + } + + if (IsSampleIDR(pSample)) { + idrFrame = *it; + break; + } + } + + // If we have an IDR frame, drop all older frames. + if (idrFrame != nullptr) { + OutputDebugString(L"IDR found, dropping all other samples.\r\n"); + while (!frames.empty()) { + if (frames.front() == idrFrame) { + break; + } + auto frame = frames.front(); + frames.pop_front(); + delete frame; + } + } + return idrFrame != nullptr; +} + +//----------------------------------------------------------------------------- +void MediaSourceHelper::SetStartTimeNow() +{ + rtc::CritScope lock(&_critSect); + _startTickTime = rtc::TimeMillis(); + if (!DropFramesToIDR(_frames)) { + // Flush all frames then. + while (!_frames.empty()) { + std::unique_ptr frame(_frames.front()); + _frames.pop_front(); + } + } +} + +#define USE_WALL_CLOCK + +//----------------------------------------------------------------------------- +LONGLONG MediaSourceHelper::GetNextSampleTimeHns(LONGLONG frameRenderTime, bool isH264) +{ + if (isH264) { +#ifdef USE_WALL_CLOCK + if (_startTickTime == 0) { + _startTickTime = rtc::TimeMillis(); + return 0; + } + LONGLONG frameTime = ((rtc::TimeMillis() - _startTickTime) + _futureOffsetMs) * 1000 * 10; +#else + if (_startTime == 0) { + + _startTime = frameRenderTime; + // Return zero here so the first frame starts at zero. + // Only follow-up samples get an future offset. + return 0; + } + + LONGLONG frameTime = (frameRenderTime - _startTime) / 100 + (_futureOffsetMs * 1000 * 10); +#endif + + return frameTime; + } else { + // Non-encoded samples seem to work best with a zero timestamp. + return 0; + } +} + +//----------------------------------------------------------------------------- +void MediaSourceHelper::CheckForAttributeChanges(webrtc::VideoFrame* frame, SampleData* data) +{ + + // Update size property + SIZE currentSize = { (LONG)frame->width(), (LONG)frame->height() }; + // If the size has changed + if (_lastSize.cx != currentSize.cx || _lastSize.cy != currentSize.cy) { + data->sizeHasChanged = true; + data->size = currentSize; + _lastSize = currentSize; + } + + // Update rotation property + int currentRotation = (int)frame->rotation(); + // If the rotation has changed + if (_lastRotation == -1 || _lastRotation != currentRotation) { + data->rotationHasChanged = true; + data->rotation = currentRotation; + _lastRotation = currentRotation; + } +} + +// Called whenever a new sample is sent for rendering. +//----------------------------------------------------------------------------- +void MediaSourceHelper::UpdateFrameRate() { + // Do FPS calculation and notification. + _frameCounter++; + // If we have about a second worth of frames + int64_t now = rtc::TimeMillis(); + if ((now - _lastTimeFPSCalculated) > 1000) { + _fpsCallback(_frameCounter); + _frameCounter = 0; + _lastTimeFPSCalculated = now; + } +} + +//----------------------------------------------------------------------------- +void FirstFrameRenderHelper::FireEvent(double timestamp) { + FirstFrameRendered(timestamp); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaSourceHelper_cx.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaSourceHelper_cx.h new file mode 100644 index 00000000..509572d8 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaSourceHelper_cx.h @@ -0,0 +1,124 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#pragma once + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +#include +#include +#include + +#include +#include "api/mediastreaminterface.h" +#include "rtc_base/criticalsection.h" +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + using Microsoft::WRL::ComPtr; + + /// + /// Delegate used to notify about first video frame rendering. + /// + private delegate void FirstFrameRenderedEventHandler(double timestamp); + + ref class FirstFrameRenderHelper sealed + { + public: + /// + /// Event fires when the first video frame renders. + /// + static event FirstFrameRenderedEventHandler^ FirstFrameRendered; + internal: + static void FireEvent(double timestamp); + }; + + enum class VideoFrameType + { + FrameTypeI420, + FrameTypeH264 + }; + + struct SampleData + { + SampleData(); + ComPtr sample; + bool sizeHasChanged; + SIZE size; + bool rotationHasChanged; + int rotation; + LONGLONG renderTime; + }; + + class MediaSourceHelper + { + public: + MediaSourceHelper( + VideoFrameType frameType, + std::function mkSample, + std::function fpsCallback); + ~MediaSourceHelper(); + + void SetStartTimeNow(); + void QueueFrame(webrtc::VideoFrame* frame); + std::unique_ptr DequeueFrame(); + bool HasFrames(); + + private: + rtc::CriticalSection _critSect; + std::list _frames; + VideoFrameType _frameType; + bool _isFirstFrame; + LONGLONG _startTime; + // One peculiarity, the timestamp of a sample should be slightly + // in the future for Media Foundation to handle it properly. + int _futureOffsetMs; + // We keep the last sample time to catch cases where samples are + // requested so quickly that the sample time doesn't change. + // We then increment it slightly to prevent giving MF duplicate times. + LONGLONG _lastSampleTime; + // Stored to detect changes. + SIZE _lastSize; + // In degrees. In practice it can only be 0, 90, 180 or 270. + int _lastRotation; + + std::unique_ptr DequeueH264Frame(); + std::unique_ptr DequeueI420Frame(); + + + // Gets the next timestamp using the clock. + // Guarantees no duplicate timestamps. + LONGLONG GetNextSampleTimeHns(LONGLONG frameRenderTime, bool isH264); + + void CheckForAttributeChanges(webrtc::VideoFrame* frame, SampleData* data); + + std::function _mkSample; + std::function _fpsCallback; + + // Called whenever a new sample is sent for rendering. + void UpdateFrameRate(); + // State related to calculating FPS. + int _frameCounter; + int64_t _lastTimeFPSCalculated; + + int64_t _startTickTime; + }; + + } // namespace webRtc + } // namespace org + } // namespace impl +} // namespace wrapper + +#endif // __cplusplus_winrt +#endif // WINUWP diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamSource_cx.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamSource_cx.cpp new file mode 100644 index 00000000..afdb8af9 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamSource_cx.cpp @@ -0,0 +1,531 @@ +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#include "impl_org_webRtc_MediaStreamSource_cx.h" + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +#include +#include +#include + +#include +#include "api/videosourceinterface.h" +#include "libyuv/convert.h" +#include "common_video/video_common_winuwp.h" +#include "rtc_base/logging.h" +#include "media/base/videocommon.h" +#include + +using Windows::Media::MediaProperties::VideoEncodingProperties; +using Windows::Media::MediaProperties::MediaEncodingSubtypes; +using Windows::Media::Core::VideoStreamDescriptor; +using Windows::Media::Core::MediaStreamSourceStartingEventArgs; +using Windows::Media::Core::MediaStreamSourceSampleRequestedEventArgs; +typedef Windows::Media::Core::MediaStreamSource UseMediaStreamSource; +using wrapper::impl::org::webRtc::MediaStreamSource; +using wrapper::impl::org::webRtc::VideoFrameType; + +/// +/// Delegate used to notify an update of the frame per second on a video stream. +/// +private delegate void FramesPerSecondChangedEventHandler(Platform::String^ id, Platform::String^ fps); + +/// +/// Delegate used to notify an update of the frame resolutions. +/// +private delegate void ResolutionChangedEventHandler(Platform::String^ id, unsigned int width, unsigned int height); + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/// +/// Class used to get frame rate events from renderer. +/// +ref class FrameCounterHelper sealed { +public: +/// +/// Event fires when the frame rate changes. +/// +static event FramesPerSecondChangedEventHandler^ FramesPerSecondChanged; +internal: +static void FireEvent(Platform::String^ id, Platform::String^ str); +}; + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +/// +/// Class used to get frame size change events from renderer. +/// +ref class ResolutionHelper sealed +{ +public: + /// + /// Event fires when the resolution changes. + /// + static event ResolutionChangedEventHandler^ ResolutionChanged; +internal: + static void FireEvent(Platform::String^ id, unsigned int width, unsigned int height); +}; + +//----------------------------------------------------------------------------- +void FrameCounterHelper::FireEvent( + Platform::String^ id, + Platform::String^ str + ) +{ + Windows::UI::Core::CoreDispatcher^ windowDispatcher = webrtc::VideoCommonWinUWP::GetCoreDispatcher(); + if (windowDispatcher != nullptr) { + windowDispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler([id, str] { + FramesPerSecondChanged(id, str); + }) + ); + } else { + FramesPerSecondChanged(id, str); + } +} + +//----------------------------------------------------------------------------- +void ResolutionHelper::FireEvent( + Platform::String^ id, + unsigned int width, + unsigned int heigth + ) +{ + Windows::UI::Core::CoreDispatcher^ windowDispatcher = webrtc::VideoCommonWinUWP::GetCoreDispatcher(); + if (windowDispatcher) { + windowDispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler([id, width, heigth] { + ResolutionChanged(id, width, heigth); + }) + ); + } else { + ResolutionChanged(id, width, heigth); + } +} + +//----------------------------------------------------------------------------- +MediaStreamSource^ MediaStreamSource::CreateMediaSource( + VideoFrameType frameType, + Platform::String^ id + ) +{ + auto streamState = ref new MediaStreamSource(frameType); + streamState->_id = id; + streamState->_idUtf8 = rtc::ToUtf8(streamState->_id->Data()); + streamState->_rtcRenderer = std::unique_ptr( + new RTCRenderer(streamState)); + VideoEncodingProperties^ videoProperties; + if (frameType == VideoFrameType::FrameTypeH264) { + videoProperties = VideoEncodingProperties::CreateH264(); + //videoProperties->ProfileId = Windows::Media::MediaProperties::H264ProfileIds::Baseline; + } else { + videoProperties = VideoEncodingProperties::CreateUncompressed(MediaEncodingSubtypes::Nv12, 10, 10); + } + + streamState->_videoDesc = ref new VideoStreamDescriptor(videoProperties); + + // initial value, this will be override by incoming frame from webrtc. + // this is needed since the UI element might request sample before webrtc has + // incoming frame ready(ex.: remote stream), in this case, this initial value + // will make sure we will at least create a small dummy frame. + streamState->_videoDesc->EncodingProperties->Width = 720; + streamState->_videoDesc->EncodingProperties->Height = 1280; + + ResolutionHelper::FireEvent(id, + streamState->_videoDesc->EncodingProperties->Width, + streamState->_videoDesc->EncodingProperties->Height); + + streamState->_videoDesc->EncodingProperties->FrameRate->Numerator = 30; + streamState->_videoDesc->EncodingProperties->FrameRate->Denominator = 1; + auto streamSource = ref new UseMediaStreamSource(streamState->_videoDesc); + + auto startingCookie = streamSource->Starting += + ref new Windows::Foundation::TypedEventHandler< + UseMediaStreamSource ^, + MediaStreamSourceStartingEventArgs ^>([streamState]( + UseMediaStreamSource^ sender, + MediaStreamSourceStartingEventArgs^ args) { + // Get a deferall on the starting event so we can trigger it + // when the first frame arrives. + streamState->_startingDeferral = args->Request->GetDeferral(); + streamState->_startingArgs = args; + }); + + // Set buffertime to 0 for rtc + auto timespan = Windows::Foundation::TimeSpan(); + timespan.Duration = 0; + streamSource->BufferTime = timespan; + streamState->_mediaStreamSource = streamSource; + + // Use a lambda to capture a strong reference to MediaStreamSource. + // This is the only way to tie the lifetime of the MediaStreamSource + // to that of the MediaStreamSource. + auto sampleRequestedCookie = streamSource->SampleRequested += + ref new Windows::Foundation::TypedEventHandler( + [streamState](UseMediaStreamSource^ sender, MediaStreamSourceSampleRequestedEventArgs^ args) { + streamState->OnSampleRequested(sender, args); + } + ); + + streamSource->Closed += + ref new Windows::Foundation::TypedEventHandler( + [streamState, startingCookie, sampleRequestedCookie](Windows::Media::Core::MediaStreamSource^ sender, Windows::Media::Core::MediaStreamSourceClosedEventArgs^ args) { + RTC_LOG(LS_INFO) << "MediaStreamSource::OnClosed"; + streamState->Teardown(); + sender->Starting -= startingCookie; + sender->SampleRequested -= sampleRequestedCookie; + } + ); + + // Create a timer which sends request progress periodically. + //{ + // auto handler = ref new TimerElapsedHandler(streamState, + // &MediaStreamSource::ProgressTimerElapsedExecute); + // auto timespan = Windows::Foundation::TimeSpan(); + // timespan.Duration = 500 * 1000 * 10; // 500 ms in hns + // streamState->_progressTimer = ThreadPoolTimer::CreatePeriodicTimer( + // handler, timespan); + //} + + //// Create a timer which ensures we don't display frames faster that expected. + //// Required because Media Foundation sometimes requests samples in burst mode + //// but we use the wall clock to drive timestamps. + //{ + // auto handler = ref new TimerElapsedHandler(streamState, + // &MediaStreamSource::FPSTimerElapsedExecute); + // auto timespan = Windows::Foundation::TimeSpan(); + // timespan.Duration = 15 * 1000 * 10; + // streamState->_fpsTimer = ThreadPoolTimer::CreatePeriodicTimer(handler, + // timespan); + //} + + return streamState; +} + +//----------------------------------------------------------------------------- +UseMediaStreamSource^ MediaStreamSource::GetMediaStreamSource() +{ + rtc::CritScope lock(&_critSect); + return _mediaStreamSource; +} + +//------------------------------------------------------------------------- +void MediaStreamSource::RenderFrame(const webrtc::VideoFrame *frame) +{ + auto frameCopy = new webrtc::VideoFrame(frame->video_frame_buffer(), frame->rotation(), 0); + ProcessReceivedFrame(frameCopy); +} + +//------------------------------------------------------------------------- +MediaStreamSource::MediaStreamSource(VideoFrameType frameType) : + _frameSentThisTime(false), + _frameBeingQueued(0) +{ + RTC_LOG(LS_INFO) << "MediaStreamSource::MediaStreamSource"; + + // Create the helper with the callback functions. + _helper.reset(new MediaSourceHelper(frameType, + [this](webrtc::VideoFrame* frame, IMFSample** sample) -> HRESULT { + return MakeSampleCallback(frame, sample); + }, + [this](int fps) { + return FpsCallback(fps); + } + )); +} + +//------------------------------------------------------------------------- +MediaStreamSource::~MediaStreamSource() +{ + RTC_LOG(LS_INFO) << "MediaStreamSource::~MediaStreamSource ID=" << _idUtf8; + Teardown(); +} + +//------------------------------------------------------------------------- +void MediaStreamSource::Teardown() +{ + RTC_LOG(LS_INFO) << "MediaStreamSource::Teardown() ID=" << _idUtf8; + { + rtc::CritScope lock(&_critSect); + if (_progressTimer != nullptr) { + _progressTimer->Cancel(); + _progressTimer = nullptr; + } + if (_fpsTimer != nullptr) { + _fpsTimer->Cancel(); + _fpsTimer = nullptr; + } + + _request = nullptr; + if (_deferral != nullptr) { + _deferral->Complete(); + _deferral = nullptr; + } + if (_startingDeferral != nullptr) { + _startingDeferral->Complete(); + _startingDeferral = nullptr; + } + _helper.reset(); + } + + // Wait until no frames are being queued + // from the webrtc callback. + while (_frameBeingQueued > 0) { + Sleep(1); + } + + { + rtc::CritScope lock(&_critSect); + if (_rtcRenderer != nullptr) { + _rtcRenderer.reset(); + } + } + RTC_LOG(LS_INFO) << "MediaStreamSource::Teardown() done ID=" << _idUtf8; +} + +//------------------------------------------------------------------------- +MediaStreamSource::RTCRenderer::RTCRenderer(MediaStreamSource^ streamSource) : _streamSource(streamSource) +{ +} + +//------------------------------------------------------------------------- +MediaStreamSource::RTCRenderer::~RTCRenderer() +{ + RTC_LOG(LS_INFO) << "MediaStreamSource::RTCRenderer::~RTCRenderer"; +} + +//------------------------------------------------------------------------- +void MediaStreamSource::RTCRenderer::SetSize( + uint32 width, + uint32 height, + uint32 reserved + ) +{ + auto stream = _streamSource.Resolve(); + if (stream != nullptr) { + stream->ResizeSource(width, height); + } +} + +//------------------------------------------------------------------------- +void MediaStreamSource::RTCRenderer::RenderFrame(const webrtc::VideoFrame *frame) +{ + auto stream = _streamSource.Resolve(); + if (stream != nullptr) { + auto frameCopy = new webrtc::VideoFrame( + frame->video_frame_buffer(), frame->rotation(), + 0); + + stream->ProcessReceivedFrame(frameCopy); + } +} + +//------------------------------------------------------------------------- +void MediaStreamSource::ProgressTimerElapsedExecute(ThreadPoolTimer^ source) +{ + //rtc::CritScope lock(&_critSect); + //if (_request != nullptr) {} +} + +//------------------------------------------------------------------------- +void MediaStreamSource::FPSTimerElapsedExecute(ThreadPoolTimer^ source) +{ + rtc::CritScope lock(&_critSect); + _frameSentThisTime = false; + if (_request != nullptr) { + ReplyToSampleRequest(); + } +} + +//------------------------------------------------------------------------- +void MediaStreamSource::ReplyToSampleRequest() +{ + auto sampleData = _helper->DequeueFrame(); + if (sampleData == nullptr) return; + + // Update rotation property + if (sampleData->rotationHasChanged) { + auto props = _videoDesc->EncodingProperties->Properties; + OutputDebugString((L"Video rotation changed: " + sampleData->rotation + "\r\n")->Data()); + props->Insert(MF_MT_VIDEO_ROTATION, sampleData->rotation); + } + + // Frame size in EncodingProperties needs to be updated before completing + // deferral, otherwise the MediaElement will receive a frame having different + // size and application may crash. + if (sampleData->sizeHasChanged) { + auto props = _videoDesc->EncodingProperties; + props->Width = (unsigned int)sampleData->size.cx; + props->Height = (unsigned int)sampleData->size.cy; + ResolutionHelper::FireEvent( + _id, props->Width, props->Height); + OutputDebugString((L"Video frame size changed for " + _id + + L" W=" + props->Width + + L" H=" + props->Height + L"\r\n")->Data()); + } + + Microsoft::WRL::ComPtr spRequest; + HRESULT hr = reinterpret_cast(_request)->QueryInterface( + spRequest.ReleaseAndGetAddressOf()); + + hr = spRequest->SetSample(sampleData->sample.Get()); + + if (_deferral != nullptr) { + _deferral->Complete(); + } + + _deferral = nullptr; +} + +//------------------------------------------------------------------------- +HRESULT MediaStreamSource::MakeSampleCallback( + webrtc::VideoFrame* frame, + IMFSample** sample + ) +{ + ComPtr spSample; + HRESULT hr = MFCreateSample(spSample.GetAddressOf()); + if (FAILED(hr)) { + return E_FAIL; + } + ComPtr mediaBuffer; + hr = MFCreate2DMediaBuffer( + (DWORD)frame->width(), (DWORD)frame->height(), + cricket::FOURCC_NV12, FALSE, + mediaBuffer.GetAddressOf()); + if (FAILED(hr)) { + return E_FAIL; + } + + spSample->AddBuffer(mediaBuffer.Get()); + + ComPtr imageBuffer; + if (FAILED(mediaBuffer.As(&imageBuffer))) { + return E_FAIL; + } + + BYTE* destRawData; + BYTE* buffer; + LONG pitch; + DWORD destMediaBufferSize; + + if (FAILED(imageBuffer->Lock2DSize(MF2DBuffer_LockFlags_Write, + &destRawData, &pitch, &buffer, &destMediaBufferSize))) { + return E_FAIL; + } + try { + //TODO Check + //frame->MakeExclusive(); + // Convert to NV12 + rtc::scoped_refptr frameBuffer = + static_cast(frame->video_frame_buffer().get()); + uint8* uvDest = destRawData + (pitch * frame->height()); + libyuv::I420ToNV12(frameBuffer->DataY(), frameBuffer->StrideY(), + frameBuffer->DataU(), frameBuffer->StrideU(), + frameBuffer->DataV(), frameBuffer->StrideV(), + reinterpret_cast(destRawData), pitch, + uvDest, pitch, + static_cast(frame->width()), + static_cast(frame->height())); + } catch (...) { + RTC_LOG(LS_ERROR) << "Exception caught in MediaStreamSource::ConvertFrame()"; + } + imageBuffer->Unlock2D(); + + *sample = spSample.Detach(); + return S_OK; +} + +//------------------------------------------------------------------------- +void MediaStreamSource::FpsCallback(int fps) +{ + FrameCounterHelper::FireEvent(_id, fps.ToString()); +} + +//------------------------------------------------------------------------- +void MediaStreamSource::OnSampleRequested( + UseMediaStreamSource ^sender, + MediaStreamSourceSampleRequestedEventArgs ^args + ) +{ + try { + + if (_mediaStreamSource == nullptr) + return; + + rtc::CritScope lock(&_critSect); + + _request = args->Request; + if (_request == nullptr) { + return; + } + if (_helper == nullptr) { // may be null while tearing down + return; + } + + if (_helper->HasFrames()) { + ReplyToSampleRequest(); + return; + } + else { + // Save the request and referral for when a sample comes in. + if (_deferral != nullptr) { + RTC_LOG(LS_ERROR) << "Got deferral when another hasn't completed."; + } + + _deferral = _request->GetDeferral(); + return; + } + } catch (...) { + RTC_LOG(LS_ERROR) << "Exception in MediaStreamSource::OnSampleRequested."; + } +} + +//------------------------------------------------------------------------- +void MediaStreamSource::ProcessReceivedFrame(webrtc::VideoFrame *frame) +{ + rtc::CritScope lock(&_critSect); + + if (_startingDeferral) { + auto timespan = Windows::Foundation::TimeSpan(); + timespan.Duration = 0; + _startingArgs->Request->SetActualStartPosition(timespan); + _startingDeferral->Complete(); + _startingDeferral = nullptr; + _startingArgs = nullptr; + + //TODO: Request a keyframe from the server when the first frame is received. + } + + if (!_helper) { // May be null while tearing down the MSS + return; + } + _helper->QueueFrame(frame); + + // If we have a pending request, reply to it now. + if (_deferral != nullptr) { + ReplyToSampleRequest(); + } +} + +//------------------------------------------------------------------------- +void MediaStreamSource::ResizeSource(uint32 width, uint32 height) +{ +} + +#endif //__cplusplus_winrt +#endif // WINUWP diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamSource_cx.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamSource_cx.h new file mode 100644 index 00000000..2aa04928 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamSource_cx.h @@ -0,0 +1,131 @@ + +// Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#pragma once + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +#include "impl_org_webRtc_MediaSourceHelper_cx.h" + +#include +#include "api/mediastreaminterface.h" +#include "rtc_base/criticalsection.h" +#include + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + //using Windows::Media::Core::MediaStreamSource; + //using Platform::WeakReference; + //using Windows::System::Threading::ThreadPoolTimer; + //using Windows::Media::Core::MediaStreamSourceSampleRequest; + + ref class MediaStreamSource sealed { + typedef Windows::Media::Core::MediaStreamSource UseMediaStreamSource; + typedef Windows::System::Threading::ThreadPoolTimer ThreadPoolTimer; + typedef Windows::Media::Core::MediaStreamSourceSampleRequest MediaStreamSourceSampleRequest; + typedef Platform::WeakReference WeakReference; + + public: + virtual ~MediaStreamSource(); + void Teardown(); + + void OnSampleRequested( + UseMediaStreamSource ^sender, + Windows::Media::Core::MediaStreamSourceSampleRequestedEventArgs ^args + ); + + internal: + static MediaStreamSource^ CreateMediaSource( + VideoFrameType frameType, + Platform::String^ id + ); + + UseMediaStreamSource^ GetMediaStreamSource(); + + void RenderFrame(const webrtc::VideoFrame *frame); + + private: + class RTCRenderer : public rtc::VideoSinkInterface { + public: + explicit RTCRenderer(MediaStreamSource^ streamSource); + virtual ~RTCRenderer(); + virtual void SetSize( + uint32 width, + uint32 height, + uint32 reserved + ); + virtual void RenderFrame(const webrtc::VideoFrame *frame); + virtual bool CanApplyRotation() { return true; } + void OnFrame(const webrtc::VideoFrame& frame) override + { + RenderFrame(&frame); + } + private: + // This object is owned by MediaStreamSource + // so _streamSource must be a weak reference + WeakReference _streamSource; + }; + + MediaStreamSource(VideoFrameType frameType); + void ProcessReceivedFrame(webrtc::VideoFrame *frame); + bool ConvertFrame( + IMFMediaBuffer* mediaBuffer, + webrtc::VideoFrame* frame + ); + void ResizeSource( + uint32 width, + uint32 height + ); + + HRESULT MakeSampleCallback( + webrtc::VideoFrame* frame, + IMFSample** sample + ); + void FpsCallback(int fps); + + void ProgressTimerElapsedExecute(ThreadPoolTimer^ source); + void FPSTimerElapsedExecute(ThreadPoolTimer^ source); + void ReplyToSampleRequest(); + + Platform::String^ _id; // Provided by the calling API. + std::string _idUtf8; // Provided by the calling API, same as _id + + UseMediaStreamSource^ _mediaStreamSource; + std::unique_ptr _rtcRenderer; + rtc::CriticalSection _critSect; + + std::unique_ptr _helper; + + ThreadPoolTimer^ _progressTimer; + + ThreadPoolTimer^ _fpsTimer; + bool _frameSentThisTime {}; + + Windows::Media::Core::VideoStreamDescriptor^ _videoDesc; + + MediaStreamSourceSampleRequest^ _request; + Windows::Media::Core::MediaStreamSourceSampleRequestDeferral^ _deferral; + Windows::Media::Core::MediaStreamSourceStartingRequestDeferral^ _startingDeferral; + Windows::Media::Core::MediaStreamSourceStartingEventArgs^ _startingArgs; + + ULONG _frameBeingQueued {}; + }; + + } // namespace webRtc + } // namespace org + } // namespace impl +} // namespace wrapper + +#endif // __cplusplus_winrt +#endif // WINUWP diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamTrack.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamTrack.cpp new file mode 100644 index 00000000..e6630852 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamTrack.cpp @@ -0,0 +1,531 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#ifdef _WIN32 +#endif //_WIN32 + +#endif //WINUWP + +#include "impl_org_webRtc_MediaStreamTrack.h" + +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_MediaElement.h" +#include "impl_org_webRtc_MediaSource.h" +#include "impl_org_webRtc_MediaConstraints.h" +#include "impl_org_webRtc_AudioTrackSource.h" +#include "impl_org_webRtc_VideoTrackSource.h" +#include "impl_org_webRtc_WebrtcLib.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "pc/audiotrack.h" +#include "pc/videotrack.h" +#include "api/mediastreamtrackproxy.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaStreamTrack::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::AudioTrackSource, UseAudioTrackSource); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoTrackSource, UseVideoTrackSource); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static ::webrtc::AudioTrackInterface *unproxyAudioTrack(NativeType *native) +{ + if (!native) return nullptr; + auto converted = dynamic_cast<::webrtc::AudioTrackInterface *>(native); + if (!converted) return nullptr; + + return WRAPPER_DEPROXIFY_CLASS(::webrtc::AudioTrack, ::webrtc::AudioTrack, converted); +} + +//------------------------------------------------------------------------------ +static ::webrtc::VideoTrackInterface *unproxyVideoTrack(NativeType *native) +{ + if (!native) return nullptr; + auto converted = dynamic_cast<::webrtc::VideoTrackInterface *>(native); + if (!converted) return nullptr; + + return WRAPPER_DEPROXIFY_CLASS(::webrtc::VideoTrack, ::webrtc::VideoTrack, converted); +} + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +//------------------------------------------------------------------------------ +static void notifyAboutNewMediaSource(WrapperImplType &wrapper, Windows::Media::Core::IMediaSource^ newSource) +{ + typedef WrapperImplType::UseMediaSourceImpl UseMediaSourceImpl; + auto source = UseMediaSourceImpl::toWrapper(newSource); + wrapper.notifySourceChanged(source); +} +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION +//------------------------------------------------------------------------------ +static void notifyAboutNewMediaSource(WrapperImplType &wrapper, winrt::Windows::Media::Core::IMediaSource const & newSource) +{ + typedef WrapperImplType::UseMediaSourceImpl UseMediaSourceImpl; + auto source = UseMediaSourceImpl::toWrapper(newSource); + wrapper.notifySourceChanged(source); +} +#endif //CPPWINRT_VERSION + +#endif //WINUWP + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaStreamTrack::MediaStreamTrack() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackPtr wrapper::org::webRtc::MediaStreamTrack::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaStreamTrack::~MediaStreamTrack() noexcept +{ + thisWeak_.reset(); + teardownObserver(); + mapperSingleton().remove(native_.get()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaStreamTrack::wrapper_dispose() noexcept +{ + if (!native_) return; + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackPtr wrapper::org::webRtc::MediaStreamTrack::createAudioTrack( + String label, + wrapper::org::webRtc::AudioTrackSourcePtr source + ) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + ZS_ASSERT(factory); + if (!factory) return WrapperTypePtr(); + + auto nativeSource = UseAudioTrackSource::toNative(source); + + auto native = factory->CreateAudioTrack(label, nativeSource); + + return WrapperImplType::toWrapper(native); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackPtr wrapper::org::webRtc::MediaStreamTrack::createVideoTrack( + String label, + wrapper::org::webRtc::VideoTrackSourcePtr source + ) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + ZS_ASSERT(factory); + if (!factory) return WrapperTypePtr(); + + auto nativeSource = UseVideoTrackSource::toNative(source); + + auto native = factory->CreateVideoTrack(label, nativeSource); + + return WrapperImplType::toWrapper(native); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::MediaStreamTrack::get_kind() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + return native_->kind(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::MediaStreamTrack::get_id() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + return native_->id(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::MediaStreamTrack::get_enabled() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->enabled(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaStreamTrack::set_enabled(bool value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + + native_->set_enabled(value); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackState wrapper::impl::org::webRtc::MediaStreamTrack::get_state() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::MediaStreamTrackState::MediaStreamTrackState_ended; + + return UseEnum::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr wrapper::impl::org::webRtc::MediaStreamTrack::get_source() noexcept +{ + zsLib::AutoLock lock(lock_); + return source_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr wrapper::impl::org::webRtc::MediaStreamTrack::get_element() noexcept +{ + zsLib::AutoLock lock(lock_); + return element_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaStreamTrack::set_element(wrapper::org::webRtc::MediaElementPtr value) noexcept +{ + { + zsLib::AutoLock lock(lock_); + element_ = value; + } + + autoAttachSourceToElement(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaStreamTrack::wrapper_onObserverCountChanged(ZS_MAYBE_USED() size_t count) noexcept +{ + ZS_MAYBE_USED(count); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::notifySourceChanged(UseMediaSourcePtr source) +{ + { + zsLib::AutoLock lock(lock_); + source_ = source; + } + + // notify subscribers of event + onMediaSourceChanged(); + + // auto attach media source to media element + autoAttachSourceToElement(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::autoAttachSourceToElement() +{ +#pragma ZS_BUILD_NOTE("VERIFY","(mosa) verify this is correct behaviour (REMOVE IF GOOD)") + + if (!native_) return; + + UseMediaElementPtr element; + UseMediaSourcePtr source; + + // get mapping within lock + { + zsLib::AutoLock lock(lock_); + element = element_; + source = source_; + } + + if (!element) return; + + { + auto queue = UseWebrtcLib::delegateQueue(); + ZS_ASSERT(queue); + + queue->postClosure([element, source]() { + ZS_MAYBE_USED() bool didAttachment = false; + ZS_MAYBE_USED(didAttachment); + +#ifdef __cplusplus_winrt + if (!didAttachment) { + auto nativeElement = UseMediaElementImpl::toNative_cx(element); + if (nativeElement) { + auto nativeSource = UseMediaSourceImpl::toNative_cx(source); + if (nativeSource) { + nativeElement->SetMediaStreamSource(nativeSource); + } else { + nativeElement->Source = nullptr; + } + didAttachment = true; + } + } +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + if (!didAttachment) { + auto nativeElement = UseMediaElementImpl::toNative_winrt(element); + if (nativeElement) { + auto nativeSource = UseMediaSourceImpl::toNative_winrt(source); + if (nativeSource) { + nativeElement.SetMediaStreamSource(nativeSource); + } else { + nativeElement.Source(winrt::Windows::Foundation::Uri{ nullptr }); + } + didAttachment = true; + } + } +#endif //CPPWINRT_VERSION + + }); + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + if (!native_) return; + + auto converted = dynamic_cast<::webrtc::VideoTrackInterface *>(native_.get()); + if (converted) { + if (!converted) return; + + videoObserver_ = std::make_shared(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); + + rtc::VideoSinkWants wants; + +#pragma ZS_BUILD_NOTE("TODO","(mosa) you may want to tweak these properties -- not sure") + + // wants.rotation_applied = ; + // wants.black_frames = ; + // wants.max_pixel_count = ; + // wants.target_pixel_count = ; + // wants.max_framerate_fps = ; + + converted->AddOrUpdateSink(videoObserver_.get(), wants); + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + if (!native_) return; + + if (videoObserver_) { + auto converted = dynamic_cast<::webrtc::VideoTrackInterface *>(native_.get()); + ZS_ASSERT(converted); + if (!converted) return; + + converted->RemoveSink(videoObserver_.get()); + videoObserver_.reset(); + } +} + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + +//------------------------------------------------------------------------------ +void WrapperImplType::notifyWebrtcObserverFrame(const ::webrtc::VideoFrame& frame) noexcept +{ + UseVideoFrameType frameType {}; + if (frame.video_frame_buffer()->ToI420() != nullptr) + frameType = UseMediaStreamSource::VideoFrameType::VideoFrameType_I420; + else + frameType = UseMediaStreamSource::VideoFrameType::VideoFrameType_H264; + + if (frameType != currentFrameType_ || !firstFrameReceived_) { + { + zsLib::AutoLock lock(lock_); + + firstFrameReceived_ = true; + currentFrameType_ = frameType; + mediaStreamSource_ = UseMediaStreamSource::create(UseMediaStreamSource::CreationProperties { frameType }); + subscription_ = mediaStreamSource_->subscribe(videoObserver_); + } + + auto source = mediaStreamSource_->source(); + notifyAboutNewMediaSource(*this, source); + } + + mediaStreamSource_->notifyFrame(frame); +} + +#elif defined(__cplusplus_winrt) +//------------------------------------------------------------------------------ +void WrapperImplType::notifyWebrtcObserverFrame(const ::webrtc::VideoFrame& frame) noexcept +{ + UseVideoFrameType frameType{}; + if (frame.video_frame_buffer()->ToI420() != nullptr) + frameType = UseVideoFrameType::FrameTypeI420; + else + frameType = UseVideoFrameType::FrameTypeH264; + + if (frameType != currentFrameType_ || !firstFrameReceived_) { + { + zsLib::AutoLock lock(lock_); + + firstFrameReceived_ = true; + currentFrameType_ = frameType; + mediaStreamSource_ = UseMediaStreamSource::CreateMediaSource(frameType, ""); + } + Windows::Media::Core::IMediaSource^ source = mediaStreamSource_->GetMediaStreamSource(); + notifyAboutNewMediaSource(*this, source); + } + mediaStreamSource_->RenderFrame(&frame); +} +#endif // CPPWINRT_VERSION +#endif //WINUWP + +//------------------------------------------------------------------------------ +void WrapperImplType::notifyWebrtcObserverDiscardedFrame() noexcept +{ +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverResolutionChanged( + uint32_t width, + uint32_t height + ) noexcept +{ + onResolutionChanged(width, height); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverRotationChanged(int rotation) noexcept +{ + onRotationChanged(rotation); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverFrameRateChanged(float frameRate) noexcept +{ + onFrameRateChanged(frameRate); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + ::webrtc::MediaStreamTrackInterface *original {}; + if (!original) { + original = unproxyAudioTrack(native); + } + if (!original) { + original = unproxyVideoTrack(native); + } + if (!original) original = native; + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapperBase(NativeType *native) noexcept +{ + return toWrapper(native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapperBase(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AudioNativeType *native) noexcept +{ + return toWrapperBase(native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(AudioNativeTypeScopedPtr native) noexcept +{ + return toWrapperBase(native.get()); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(VideoNativeType *native) noexcept +{ + return toWrapperBase(native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(VideoNativeTypeScopedPtr native) noexcept +{ + return toWrapperBase(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamTrack.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamTrack.h new file mode 100644 index 00000000..032bea71 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaStreamTrack.h @@ -0,0 +1,197 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MediaStreamTrack.h" + +#include "impl_org_webRtc_MediaSourceHelper_cx.h" +#include "impl_org_webRtc_MediaStreamSource_cx.h" +#include "impl_webrtc_IMediaStreamSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "api/video/video_frame.h" +#include "api/mediastreaminterface.h" +#include "impl_org_webRtc_post_include.h" + +#include + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MediaStreamTrack : public wrapper::org::webRtc::MediaStreamTrack + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaStreamTrack, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaStreamTrack, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::MediaStreamTrackInterface, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::AudioTrackInterface, AudioNativeType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::VideoTrackInterface, VideoNativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + typedef rtc::scoped_refptr AudioNativeTypeScopedPtr; + typedef rtc::scoped_refptr VideoNativeTypeScopedPtr; + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + ZS_DECLARE_TYPEDEF_PTR(webrtc::IMediaStreamSource, UseMediaStreamSource); + typedef UseMediaStreamSource::VideoFrameType UseVideoFrameType; +#elif defined(__cplusplus_winrt) + typedef MediaStreamSource UseMediaStreamSource; + typedef VideoFrameType UseVideoFrameType; +#endif // CPPWINRT_VERSION +#endif //WINUWP + + + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaElement, UseMediaElement); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaElement, UseMediaElementImpl); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaSource, UseMediaSource); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaSource, UseMediaSourceImpl); + + ZS_DECLARE_STRUCT_PTR(WebrtcVideoObserver); + + struct WebrtcVideoObserver : public rtc::VideoSinkInterface<::webrtc::VideoFrame> +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + , public ::webrtc::IMediaStreamSourceDelegate +#endif // CPPWINRT_VERSION +#endif //WINUWP + { + WebrtcVideoObserver( + WrapperImplTypePtr wrapper, + IMessageQueuePtr queue + ) noexcept : outer_(wrapper), queue_(queue) {} + + void OnFrame(const ::webrtc::VideoFrame& frame) final + { + auto outer = outer_.lock(); + if (!outer) return; + outer->notifyWebrtcObserverFrame(frame); // NOTE: intentionally called synchronously + } + + // Should be called by the source when it discards the frame due to rate + // limiting. + void OnDiscardedFrame() + { + auto outer = outer_.lock(); + if (!outer) return; + outer->notifyWebrtcObserverDiscardedFrame(); // NOTE: intentionally called synchronously + } + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + void onMediaStreamSourceResolutionChanged( + UseMediaStreamSourcePtr source, + uint32_t width, + uint32_t height + ) override + { + auto outer = outer_.lock(); + if (!outer) return; + outer->onWebrtcObserverResolutionChanged(width, height); + } + + void onMediaStreamSourceRotationChanged( + UseMediaStreamSourcePtr source, + int rotation + ) override + { + auto outer = outer_.lock(); + if (!outer) return; + outer->onWebrtcObserverRotationChanged(rotation); + } + + void onMediaStreamSourceFrameRateChanged( + UseMediaStreamSourcePtr source, + float frameRate + ) override + { + auto outer = outer_.lock(); + if (!outer) return; + outer->onWebrtcObserverFrameRateChanged(frameRate); + } +#endif // CPPWINRT_VERSION +#endif //WINUWP + + private: + WrapperImplTypeWeakPtr outer_; + IMessageQueuePtr queue_; + }; + + WebrtcVideoObserverPtr videoObserver_; + rtc::scoped_refptr native_; + + mutable zsLib::Lock lock_; + UseMediaElementPtr element_; + UseMediaSourcePtr source_; + webrtc::IMediaStreamSourceSubscriptionPtr subscription_; + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + UseMediaStreamSourcePtr mediaStreamSource_; +#elif defined(__cplusplus_winrt) + UseMediaStreamSource^ mediaStreamSource_; +#endif // CPPWINRT_VERSION +#endif //WINUWP + UseVideoFrameType currentFrameType_{}; + bool firstFrameReceived_ { false }; + + MediaStreamTrackWeakPtr thisWeak_; + + MediaStreamTrack() noexcept; + virtual ~MediaStreamTrack() noexcept; + void wrapper_dispose() noexcept override; + + + // properties MediaStreamTrack + String get_kind() noexcept override; + String get_id() noexcept override; + bool get_enabled() noexcept override; + void set_enabled(bool value) noexcept override; + wrapper::org::webRtc::MediaStreamTrackState get_state() noexcept override; + wrapper::org::webRtc::MediaSourcePtr get_source() noexcept override; + wrapper::org::webRtc::MediaElementPtr get_element() noexcept override; + void set_element(wrapper::org::webRtc::MediaElementPtr value) noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + void notifySourceChanged(UseMediaSourcePtr source); + void autoAttachSourceToElement(); + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + // WebrtcObserver methods + void notifyWebrtcObserverFrame(const ::webrtc::VideoFrame& frame) noexcept; + void notifyWebrtcObserverDiscardedFrame() noexcept; + void onWebrtcObserverResolutionChanged( + uint32_t width, + uint32_t height + ) noexcept; + void onWebrtcObserverRotationChanged(int rotation) noexcept; + void onWebrtcObserverFrameRateChanged(float frameRate) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapperBase(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapperBase(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(AudioNativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(AudioNativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(VideoNativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(VideoNativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaTrackSource.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MediaTrackSource.cpp new file mode 100644 index 00000000..24311978 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaTrackSource.cpp @@ -0,0 +1,104 @@ + +#include "impl_org_webRtc_MediaTrackSource.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/mediastreaminterface.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaTrackSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaTrackSource::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaTrackSource::MediaTrackSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaTrackSourcePtr wrapper::org::webRtc::MediaTrackSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MediaTrackSource::~MediaTrackSource() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MediaTrackSource::wrapper_dispose() noexcept +{ + if (!native_) return; + + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourceState wrapper::impl::org::webRtc::MediaTrackSource::get_state() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::MediaSourceState::MediaSourceState_ended; + return UseEnum::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::MediaTrackSource::get_remote() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->remote(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = NativeTypeScopedPtr(native); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeScopedPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeScopedPtr(); + return converted->native_; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MediaTrackSource.h b/webrtc/idl/wrapper/impl_org_webRtc_MediaTrackSource.h new file mode 100644 index 00000000..21615bda --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MediaTrackSource.h @@ -0,0 +1,45 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MediaTrackSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MediaTrackSource : public wrapper::org::webRtc::MediaTrackSource + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MediaTrackSource, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaTrackSource, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::MediaSourceInterface, NativeType); + + typedef ::rtc::scoped_refptr NativeTypeScopedPtr; + + NativeTypeScopedPtr native_; + MediaTrackSourceWeakPtr thisWeak_; + + MediaTrackSource() noexcept; + virtual ~MediaTrackSource() noexcept; + void wrapper_dispose() noexcept override; + + + // properties MediaTrackSource + wrapper::org::webRtc::MediaSourceState get_state() noexcept override; + bool get_remote() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MessageEvent.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MessageEvent.cpp new file mode 100644 index 00000000..7cb54ab2 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MessageEvent.cpp @@ -0,0 +1,118 @@ + +#include "impl_org_webRtc_MessageEvent.h" + +//#include "impl_org_webRtc_pre_include.h" +//#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MessageEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(zsLib::eventing::IHelper, UseHelper); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MessageEvent::MessageEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MessageEventPtr wrapper::org::webRtc::MessageEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MessageEvent::~MessageEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +SecureByteBlockPtr wrapper::impl::org::webRtc::MessageEvent::get_binary() noexcept +{ + return native_; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::MessageEvent::get_text() noexcept +{ + if (isBinary_) return String(); + if (!native_) return String(); + + return UseHelper::convertToString(*native_); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = UseHelper::convertToBuffer(native.data.data(), native.size()); + wrapper->isBinary_ = native.binary; + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const SecureByteBlock &native) noexcept +{ + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = make_shared(native); + wrapper->isBinary_ = true; + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(SecureByteBlockPtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const String &native) noexcept +{ + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = UseHelper::convertToBuffer(native); + wrapper->isBinary_ = false; + return wrapper; +} + +//------------------------------------------------------------------------------ +NativeType WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeType(rtc::CopyOnWriteBuffer(), true); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + ZS_ASSERT(converted); + if (!converted) return NativeType(rtc::CopyOnWriteBuffer(), false); + auto buffer = converted->get_binary(); + if ((buffer) && (buffer->SizeInBytes() > 0)) { + rtc::CopyOnWriteBuffer nativeBuffer(buffer->BytePtr(), buffer->SizeInBytes(), buffer->SizeInBytes() + sizeof(char)); // add space for nul character + return NativeType(nativeBuffer, converted->isBinary_); + } + return NativeType(rtc::CopyOnWriteBuffer(), converted->isBinary_); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MessageEvent.h b/webrtc/idl/wrapper/impl_org_webRtc_MessageEvent.h new file mode 100644 index 00000000..e9fedbd8 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MessageEvent.h @@ -0,0 +1,45 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MessageEvent.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/datachannelinterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MessageEvent : public wrapper::org::webRtc::MessageEvent + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MessageEvent, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MessageEvent, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::DataBuffer, NativeType); + + SecureByteBlockPtr native_; + bool isBinary_ {}; + MessageEventWeakPtr thisWeak_; + + MessageEvent() noexcept; + virtual ~MessageEvent() noexcept; + + + // properties MessageEvent + SecureByteBlockPtr get_binary() noexcept override; + String get_text() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const SecureByteBlock &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(SecureByteBlockPtr native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const String &native) noexcept; + ZS_NO_DISCARD() static NativeType toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MillisecondIntervalRange.cpp b/webrtc/idl/wrapper/impl_org_webRtc_MillisecondIntervalRange.cpp new file mode 100644 index 00000000..e4174eb2 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MillisecondIntervalRange.cpp @@ -0,0 +1,99 @@ + +#include "impl_org_webRtc_MillisecondIntervalRange.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/timeutils.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MillisecondIntervalRange::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MillisecondIntervalRange::MillisecondIntervalRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MillisecondIntervalRangePtr wrapper::org::webRtc::MillisecondIntervalRange::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::MillisecondIntervalRange::~MillisecondIntervalRange() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MillisecondIntervalRange::wrapper_init_org_webRtc_MillisecondIntervalRange() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::MillisecondIntervalRange::wrapper_init_org_webRtc_MillisecondIntervalRange(wrapper::org::webRtc::MillisecondIntervalRangePtr source) noexcept +{ + if (!source) { + wrapper_init_org_webRtc_MillisecondIntervalRange(); + return; + } + + min = source->min; + max = source->max; +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.min = decltype(to.min)(SafeInt(from.min())); + to.max = decltype(to.min)(SafeInt(from.max())); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + return make_shared(SafeInt(wrapper->min.count()), SafeInt(wrapper->max.count())); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_MillisecondIntervalRange.h b/webrtc/idl/wrapper/impl_org_webRtc_MillisecondIntervalRange.h new file mode 100644 index 00000000..28a8aa12 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_MillisecondIntervalRange.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_MillisecondIntervalRange.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct MillisecondIntervalRange : public wrapper::org::webRtc::MillisecondIntervalRange + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::MillisecondIntervalRange, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MillisecondIntervalRange, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::rtc::IntervalRange, NativeType); + + MillisecondIntervalRangeWeakPtr thisWeak_; + + MillisecondIntervalRange() noexcept; + virtual ~MillisecondIntervalRange() noexcept; + + + // methods MillisecondIntervalRange + void wrapper_init_org_webRtc_MillisecondIntervalRange() noexcept override; + void wrapper_init_org_webRtc_MillisecondIntervalRange(wrapper::org::webRtc::MillisecondIntervalRangePtr source) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAnswerOptions.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCAnswerOptions.cpp new file mode 100644 index 00000000..040ac246 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAnswerOptions.cpp @@ -0,0 +1,96 @@ + +#include "impl_org_webRtc_RTCAnswerOptions.h" +#include "impl_org_webRtc_RTCOfferAnswerOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAnswerOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferAnswerOptions, UseOfferAnswerOptions); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAnswerOptions::RTCAnswerOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCAnswerOptionsPtr wrapper::org::webRtc::RTCAnswerOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAnswerOptions::~RTCAnswerOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCAnswerOptions::wrapper_init_org_webRtc_RTCAnswerOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCAnswerOptions::wrapper_init_org_webRtc_RTCAnswerOptions(wrapper::org::webRtc::RTCAnswerOptionsPtr source) noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + UseOfferAnswerOptions::apply(from, to); +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + UseOfferAnswerOptions::apply(from, to); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAnswerOptions.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCAnswerOptions.h new file mode 100644 index 00000000..bb30ffca --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAnswerOptions.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCAnswerOptions.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCAnswerOptions : public wrapper::org::webRtc::RTCAnswerOptions + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCAnswerOptions, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAnswerOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface::RTCOfferAnswerOptions, NativeType); + + RTCAnswerOptionsWeakPtr thisWeak_; + + RTCAnswerOptions() noexcept; + virtual ~RTCAnswerOptions() noexcept; + + + // methods RTCAnswerOptions + void wrapper_init_org_webRtc_RTCAnswerOptions() noexcept override; + void wrapper_init_org_webRtc_RTCAnswerOptions(wrapper::org::webRtc::RTCAnswerOptionsPtr source) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioHandlerStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioHandlerStats.cpp new file mode 100644 index 00000000..9c6b6e26 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioHandlerStats.cpp @@ -0,0 +1,137 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCAudioHandlerStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAudioHandlerStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAudioHandlerStats::RTCAudioHandlerStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCAudioHandlerStatsPtr wrapper::org::webRtc::RTCAudioHandlerStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAudioHandlerStats::~RTCAudioHandlerStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_audioLevel() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_totalAudioEnergy() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_voiceActivityFlag() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioHandlerStats::get_totalSamplesDuration() noexcept +{ + double result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioHandlerStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioHandlerStats.h new file mode 100644 index 00000000..1c7d5f75 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioHandlerStats.h @@ -0,0 +1,48 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCAudioHandlerStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCAudioHandlerStats : public wrapper::org::webRtc::RTCAudioHandlerStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCAudioHandlerStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAudioHandlerStats, WrapperImplType); + RTCAudioHandlerStatsWeakPtr thisWeak_; + + RTCAudioHandlerStats() noexcept; + virtual ~RTCAudioHandlerStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCAudioHandlerStats + double get_audioLevel() noexcept override; + double get_totalAudioEnergy() noexcept override; + bool get_voiceActivityFlag() noexcept override; + double get_totalSamplesDuration() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioReceiverStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioReceiverStats.cpp new file mode 100644 index 00000000..fed7b775 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioReceiverStats.cpp @@ -0,0 +1,179 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCAudioReceiverStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAudioReceiverStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAudioReceiverStats::RTCAudioReceiverStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCAudioReceiverStatsPtr wrapper::org::webRtc::RTCAudioReceiverStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAudioReceiverStats::~RTCAudioReceiverStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_audioLevel() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_totalAudioEnergy() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_voiceActivityFlag() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_totalSamplesDuration() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_estimatedPlayoutTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_jitterBufferDelay() noexcept +{ + ::zsLib::Milliseconds result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_jitterBufferEmittedCount() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_totalSamplesReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_concealedSamples() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCAudioReceiverStats::get_concealmentEvents() noexcept +{ + unsigned long long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioReceiverStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioReceiverStats.h new file mode 100644 index 00000000..1a5ee67a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioReceiverStats.h @@ -0,0 +1,56 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCAudioReceiverStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCAudioReceiverStats : public wrapper::org::webRtc::RTCAudioReceiverStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCAudioReceiverStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAudioReceiverStats, WrapperImplType); + RTCAudioReceiverStatsWeakPtr thisWeak_; + + RTCAudioReceiverStats() noexcept; + virtual ~RTCAudioReceiverStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCAudioHandlerStats + double get_audioLevel() noexcept override; + double get_totalAudioEnergy() noexcept override; + bool get_voiceActivityFlag() noexcept override; + double get_totalSamplesDuration() noexcept override; + + // properties RTCAudioReceiverStats + ::zsLib::Time get_estimatedPlayoutTimestamp() noexcept override; + ::zsLib::Milliseconds get_jitterBufferDelay() noexcept override; + unsigned long long get_jitterBufferEmittedCount() noexcept override; + unsigned long long get_totalSamplesReceived() noexcept override; + unsigned long long get_concealedSamples() noexcept override; + unsigned long long get_concealmentEvents() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioSenderStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioSenderStats.cpp new file mode 100644 index 00000000..d73b2654 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioSenderStats.cpp @@ -0,0 +1,158 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCAudioSenderStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAudioSenderStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAudioSenderStats::RTCAudioSenderStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCAudioSenderStatsPtr wrapper::org::webRtc::RTCAudioSenderStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCAudioSenderStats::~RTCAudioSenderStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCAudioSenderStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCAudioSenderStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioSenderStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioSenderStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioSenderStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCAudioSenderStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCAudioSenderStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCAudioSenderStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCAudioSenderStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioSenderStats::get_audioLevel() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioSenderStats::get_totalAudioEnergy() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCAudioSenderStats::get_voiceActivityFlag() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCAudioSenderStats::get_totalSamplesDuration() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCAudioSenderStats::get_echoReturnLoss() noexcept +{ + Optional< double > result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCAudioSenderStats::get_echoReturnLossEnhancement() noexcept +{ + Optional< double > result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCAudioSenderStats::get_totalSamplesSent() noexcept +{ + unsigned long long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioSenderStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioSenderStats.h new file mode 100644 index 00000000..b957e530 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCAudioSenderStats.h @@ -0,0 +1,53 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCAudioSenderStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCAudioSenderStats : public wrapper::org::webRtc::RTCAudioSenderStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCAudioSenderStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAudioSenderStats, WrapperImplType); + RTCAudioSenderStatsWeakPtr thisWeak_; + + RTCAudioSenderStats() noexcept; + virtual ~RTCAudioSenderStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCAudioHandlerStats + double get_audioLevel() noexcept override; + double get_totalAudioEnergy() noexcept override; + bool get_voiceActivityFlag() noexcept override; + double get_totalSamplesDuration() noexcept override; + + // properties RTCAudioSenderStats + Optional< double > get_echoReturnLoss() noexcept override; + Optional< double > get_echoReturnLossEnhancement() noexcept override; + unsigned long long get_totalSamplesSent() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCBitrateParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCBitrateParameters.cpp new file mode 100644 index 00000000..7a4773d0 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCBitrateParameters.cpp @@ -0,0 +1,106 @@ + +#include "impl_org_webRtc_RTCBitrateParameters.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCBitrateParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCBitrateParameters::RTCBitrateParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCBitrateParametersPtr wrapper::org::webRtc::RTCBitrateParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCBitrateParameters::~RTCBitrateParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCBitrateParameters::wrapper_init_org_webRtc_RTCBitrateParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + if (from.min_bitrate_bps.has_value()) { + to.minBitrateBps = SafeInt(from.min_bitrate_bps.value()); + } + if (from.current_bitrate_bps.has_value()) { + to.currentBitrateBps = SafeInt(from.current_bitrate_bps.value()); + } + if (from.max_bitrate_bps.has_value()) { + to.maxBitrateBps = SafeInt(from.max_bitrate_bps.value()); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + if (from.minBitrateBps.has_value()) { + to.min_bitrate_bps = (int)SafeInt(from.minBitrateBps.value()); + } + if (from.currentBitrateBps.has_value()) { + to.current_bitrate_bps = (int)SafeInt(from.currentBitrateBps.value()); + } + if (from.maxBitrateBps.has_value()) { + to.max_bitrate_bps = (int)SafeInt(from.maxBitrateBps.value()); + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCBitrateParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCBitrateParameters.h new file mode 100644 index 00000000..1d0d9aed --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCBitrateParameters.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCBitrateParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCBitrateParameters : public wrapper::org::webRtc::RTCBitrateParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCBitrateParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCBitrateParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface::BitrateParameters, NativeType); + + RTCBitrateParametersWeakPtr thisWeak_; + + RTCBitrateParameters() noexcept; + virtual ~RTCBitrateParameters() noexcept; + void wrapper_init_org_webRtc_RTCBitrateParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificate.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificate.cpp new file mode 100644 index 00000000..ea84301c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificate.cpp @@ -0,0 +1,121 @@ + +#include "impl_org_webRtc_RTCCertificate.h" +#include "impl_org_webRtc_RTCDtlsFingerprint.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/rtccertificate.h" +#include "rtc_base/sslidentity.h" +#include "rtc_base/sslfingerprint.h" +#include "impl_org_webRtc_post_include.h" + +#include +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +using namespace date; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCertificate::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtlsFingerprint, UseFingerprint); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCCertificate::RTCCertificate() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCCertificatePtr wrapper::org::webRtc::RTCCertificate::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCCertificate::~RTCCertificate() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCCertificate::get_expires() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return zsLib::Time(); + + auto msSince1970 = native_->Expires(); + zsLib::Time t = day_point(jan / 1 / 1970); + zsLib::Milliseconds converted = zsLib::Milliseconds(SafeInt(msSince1970)); + return t + converted; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::RTCDtlsFingerprintPtr > > wrapper::impl::org::webRtc::RTCCertificate::get_fingerprints() noexcept +{ + typedef list< wrapper::org::webRtc::RTCDtlsFingerprintPtr > ResultType; + + auto result = make_shared(); + + ZS_ASSERT(native_); + if (!native_) return result; + + std::string digest_alg; + auto &sslCert = native_->ssl_certificate(); + if (!sslCert.GetSignatureDigestAlgorithm(&digest_alg)) return result; + + std::unique_ptr<::rtc::SSLFingerprint> nativeFingerprint(::rtc::SSLFingerprint::Create(digest_alg, &sslCert)); + + auto wrapperFingerprint = UseFingerprint::toWrapper(digest_alg, std::move(nativeFingerprint)); + if (wrapperFingerprint) { + result->push_back(wrapperFingerprint); + } + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = NativeTypeScopedPtr(native); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeScopedPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeScopedPtr(); + return converted->native_; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificate.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificate.h new file mode 100644 index 00000000..76547292 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificate.h @@ -0,0 +1,44 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCCertificate.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCCertificate : public wrapper::org::webRtc::RTCCertificate + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCCertificate, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCertificate, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::rtc::RTCCertificate, NativeType); + + typedef ::rtc::scoped_refptr NativeTypeScopedPtr; + + NativeTypeScopedPtr native_; + RTCCertificateWeakPtr thisWeak_; + + RTCCertificate() noexcept; + virtual ~RTCCertificate() noexcept; + + + // properties RTCCertificate + ::zsLib::Time get_expires() noexcept override; + shared_ptr< list< wrapper::org::webRtc::RTCDtlsFingerprintPtr > > get_fingerprints() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificateStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificateStats.cpp new file mode 100644 index 00000000..e0b361da --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificateStats.cpp @@ -0,0 +1,102 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCCertificateStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCertificateStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCCertificateStats::RTCCertificateStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCCertificateStatsPtr wrapper::org::webRtc::RTCCertificateStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCCertificateStats::~RTCCertificateStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCCertificateStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCCertificateStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCertificateStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCertificateStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCertificateStats::get_fingerprint() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCertificateStats::get_fingerprintAlgorithm() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCertificateStats::get_base64Certificate() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCertificateStats::get_issuerCertificateId() noexcept +{ + String result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificateStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificateStats.h new file mode 100644 index 00000000..02a80536 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCCertificateStats.h @@ -0,0 +1,41 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCCertificateStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCCertificateStats : public wrapper::org::webRtc::RTCCertificateStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCCertificateStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCertificateStats, WrapperImplType); + RTCCertificateStatsWeakPtr thisWeak_; + + RTCCertificateStats() noexcept; + virtual ~RTCCertificateStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCCertificateStats + String get_fingerprint() noexcept override; + String get_fingerprintAlgorithm() noexcept override; + String get_base64Certificate() noexcept override; + String get_issuerCertificateId() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCCodecStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCCodecStats.cpp new file mode 100644 index 00000000..f509f389 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCCodecStats.cpp @@ -0,0 +1,135 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCCodecStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCodecStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCCodecStats::RTCCodecStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCCodecStatsPtr wrapper::org::webRtc::RTCCodecStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCCodecStats::~RTCCodecStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCCodecStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCCodecStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCodecStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCodecStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint8_t > wrapper::impl::org::webRtc::RTCCodecStats::get_payloadType() noexcept +{ + Optional< uint8_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCCodecType > wrapper::impl::org::webRtc::RTCCodecStats::get_codecType() noexcept +{ + Optional< wrapper::org::webRtc::RTCCodecType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCodecStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCCodecStats::set_transportId(String value) noexcept +{ +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCodecStats::get_mimeType() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCCodecStats::get_clockRate() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< unsigned long > wrapper::impl::org::webRtc::RTCCodecStats::get_channels() noexcept +{ + Optional< unsigned long > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCodecStats::get_sdpFmtpLine() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCCodecStats::get_implementation() noexcept +{ + String result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCCodecStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCCodecStats.h new file mode 100644 index 00000000..ec420829 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCCodecStats.h @@ -0,0 +1,46 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCCodecStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCCodecStats : public wrapper::org::webRtc::RTCCodecStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCCodecStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCodecStats, WrapperImplType); + RTCCodecStatsWeakPtr thisWeak_; + + RTCCodecStats() noexcept; + virtual ~RTCCodecStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCCodecStats + Optional< uint8_t > get_payloadType() noexcept override; + Optional< wrapper::org::webRtc::RTCCodecType > get_codecType() noexcept override; + String get_transportId() noexcept override; + void set_transportId(String value) noexcept override; + String get_mimeType() noexcept override; + unsigned long get_clockRate() noexcept override; + Optional< unsigned long > get_channels() noexcept override; + String get_sdpFmtpLine() noexcept override; + String get_implementation() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCConfiguration.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCConfiguration.cpp new file mode 100644 index 00000000..e7fc758a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCConfiguration.cpp @@ -0,0 +1,371 @@ + +#include "impl_org_webRtc_RTCConfiguration.h" +#include "impl_org_webRtc_RTCIceServer.h" +#include "impl_org_webRtc_RTCCertificate.h" +#include "impl_org_webRtc_MillisecondIntervalRange.h" + +#include "impl_org_webRtc_enums.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; +using zsLib::Milliseconds; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCConfiguration::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceServer, UseIceServer); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCertificate, UseCertificate); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MillisecondIntervalRange, UseMillisecondIntervalRange); + + +static void apply(const WrapperImplType &from, NativeType &to) noexcept; +static void apply(const NativeType &from, WrapperImplType &to) noexcept; + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCConfiguration::RTCConfiguration() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCConfigurationPtr wrapper::org::webRtc::RTCConfiguration::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCConfiguration::~RTCConfiguration() noexcept +{ + ZS_ASSERT(native_); + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::wrapper_init_org_webRtc_RTCConfiguration() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::wrapper_init_org_webRtc_RTCConfiguration(wrapper::org::webRtc::RTCConfigurationType type) noexcept +{ + native_ = make_shared(UseEnum::toNative(type)); + apply(*native_, *this); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::wrapper_init_org_webRtc_RTCConfiguration(wrapper::org::webRtc::RTCConfigurationPtr source) noexcept +{ + auto native = toNative(source); + if (!native) { + wrapper_init_org_webRtc_RTCConfiguration(); + return; + } + native_ = make_shared(*native); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCConfiguration::get_dscp() noexcept +{ + if (!native_) return false; + return native_->dscp(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::set_dscp(bool value) noexcept +{ + if (!native_) return; + native_->set_dscp(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCConfiguration::get_cpuAdaptation() noexcept +{ + if (!native_) return false; + return native_->cpu_adaptation(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::set_cpuAdaptation(bool value) noexcept +{ + if (!native_) return; + native_->set_cpu_adaptation(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCConfiguration::get_suspendBelowMinBitrate() noexcept +{ + if (!native_) return false; + return native_->suspend_below_min_bitrate(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::set_suspendBelowMinBitrate(bool value) noexcept +{ + if (!native_) return; + native_->set_suspend_below_min_bitrate(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCConfiguration::get_prerendererSmoothing() noexcept +{ + if (!native_) return false; + return native_->prerenderer_smoothing(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::set_prerendererSmoothing(bool value) noexcept +{ + if (!native_) return; + native_->set_prerenderer_smoothing(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCConfiguration::get_experimentCpuLoadEstimator() noexcept +{ + if (!native_) return false; + return native_->experiment_cpu_load_estimator(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCConfiguration::set_experimentCpuLoadEstimator(bool value) noexcept +{ + if (!native_) return; + native_->set_experiment_cpu_load_estimator(value); +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) noexcept +{ + to.servers.clear(); + if (from.iceServers) { + for (auto iter = from.iceServers->begin(); iter != from.iceServers->end(); ++iter) { + auto converted = UseIceServer::toNative(*iter); + if (!converted) continue; + to.servers.push_back(*converted); + } + } + + to.type = UseEnum::toNative(from.iceTransportPolicy); + to.bundle_policy = UseEnum::toNative(from.bundlePolicy); + to.rtcp_mux_policy = UseEnum::toNative(from.rtcpMuxPolicy); + + to.certificates.clear(); + if (from.certificates) { + for (auto iter = from.certificates->begin(); iter != from.certificates->end(); ++iter) { + auto converted = UseCertificate::toNative(*iter); + if (!converted) continue; + to.certificates.push_back(converted); + } + } + +#pragma ZS_BUILD_NOTE("LATER", "peer identity is not supported in webrtc") + // to. = from.peerIdentity; + + to.ice_candidate_pool_size = SafeInt(from.iceCandidatePoolSize); + to.disable_ipv6 = from.disableIpv6; + to.disable_ipv6_on_wifi = from.disableIpv6OnWifi; + + if (from.maxIpv6Networks.has_value()) { + to.max_ipv6_networks = SafeInt(from.maxIpv6Networks.value()); + } else { + to.max_ipv6_networks = ::cricket::kDefaultMaxIPv6Networks; + } + + to.disable_link_local_networks = from.disableLinkLocalNetworks; + to.enable_rtp_data_channel = from.enableRtpDataChannel; + + if (from.screencastMinBitrate.has_value()) { + to.screencast_min_bitrate = (int)(SafeInt(from.screencastMinBitrate.value())); + } else { + to.screencast_min_bitrate.reset(); + } + if (from.combinedAudioVideoBwe.has_value()) { + to.combined_audio_video_bwe = from.combinedAudioVideoBwe.value(); + } else { + to.combined_audio_video_bwe.reset(); + } + + if (from.enableDtlsSrtp.has_value()) { + to.enable_dtls_srtp = from.enableDtlsSrtp.value(); + } + else { + to.enable_dtls_srtp.reset(); + } + to.tcp_candidate_policy = UseEnum::toNative(from.tcpCandidatePolicy); + to.candidate_network_policy = UseEnum::toNative(from.candidateNetworkPolicy); + to.audio_jitter_buffer_max_packets = SafeInt(from.audioJitterBufferMaxPackets); + to.audio_jitter_buffer_fast_accelerate = from.audioJitterBufferFastAccelerate; + + to.ice_connection_receiving_timeout = (Milliseconds() == from.iceConnectionReceivingTimeout ? NativeType::kUndefined : SafeInt(from.iceConnectionReceivingTimeout.count())); + to.ice_backup_candidate_pair_ping_interval = (Milliseconds() == from.iceBackupCandidatePairPingInterval ? NativeType::kUndefined : SafeInt(from.iceBackupCandidatePairPingInterval.count())); + + to.continual_gathering_policy = UseEnum::toNative(from.continualGatheringPolicy); + to.prioritize_most_likely_ice_candidate_pairs = from.prioritizeMostLikelyIceCandidatePairs; + to.prune_turn_ports = from.pruneTurnPorts; + to.enable_ice_renomination = from.enableIceRenomination; + to.redetermine_role_on_ice_restart = from.redetermineRoleOnIceRestart; + + if (Milliseconds() != from.iceCheckMinInterval) { + to.ice_check_min_interval = (int)SafeInt(from.iceCheckMinInterval.count()); + } else { + to.ice_check_min_interval.reset(); + } + if (Milliseconds() != from.stunCandidateKeepaliveInterval) { + to.stun_candidate_keepalive_interval = (int)SafeInt(from.stunCandidateKeepaliveInterval.count()); + } + else { + to.stun_candidate_keepalive_interval.reset(); + } + + if (from.iceRegatherIntervalRange.has_value()) { + auto converted = UseMillisecondIntervalRange::toNative(from.iceRegatherIntervalRange.value()); + if (converted) { + to.ice_regather_interval_range = *converted; + } else { + to.ice_regather_interval_range.reset(); + } + } else { + to.ice_regather_interval_range.reset(); + } + + if (from.networkPreference.has_value()) { + to.network_preference = UseEnum::toNative(from.networkPreference.value()); + } else { + to.network_preference.reset(); + } + + to.sdp_semantics = UseEnum::toNative(from.sdpSemantics); +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) noexcept +{ + to.iceServers = make_shared< list< wrapper::org::webRtc::RTCIceServerPtr > >(); + for (auto iter = from.servers.begin(); iter != from.servers.end(); ++iter) { + auto converted = UseIceServer::toWrapper(*iter); + if (!converted) continue; + to.iceServers->push_back(converted); + } + + to.iceTransportPolicy = UseEnum::toWrapper(from.type); + to.bundlePolicy = UseEnum::toWrapper(from.bundle_policy); + to.rtcpMuxPolicy = UseEnum::toWrapper(from.rtcp_mux_policy); + + to.certificates = make_shared< list< wrapper::org::webRtc::RTCCertificatePtr > >(); + for (auto iter = from.certificates.begin(); iter != from.certificates.end(); ++iter) { + auto converted = UseCertificate::toWrapper((*iter).get()); + if (!converted) continue; + to.certificates->push_back(converted); + } + +#pragma ZS_BUILD_NOTE("LATER", "peer identity is not supported in webrtc") + // to.peerIdentity = from. + + to.iceCandidatePoolSize = SafeInt(from.ice_candidate_pool_size); + to.disableIpv6 = from.disable_ipv6; + to.disableIpv6OnWifi = from.disable_ipv6_on_wifi; + + if (::cricket::kDefaultMaxIPv6Networks != from.max_ipv6_networks) { + to.maxIpv6Networks = SafeInt(from.max_ipv6_networks); + } + + to.disableLinkLocalNetworks = from.disable_link_local_networks; + to.enableRtpDataChannel = from.enable_rtp_data_channel; + if (from.screencast_min_bitrate.has_value()) { + to.screencastMinBitrate = from.screencast_min_bitrate.value(); + } + if (from.combined_audio_video_bwe.has_value()) { + to.combinedAudioVideoBwe = from.combined_audio_video_bwe.value(); + } + if (from.enable_dtls_srtp.has_value()) { + to.enableDtlsSrtp = from.enable_dtls_srtp.value(); + } + + to.tcpCandidatePolicy = UseEnum::toWrapper(from.tcp_candidate_policy); + to.candidateNetworkPolicy = UseEnum::toWrapper(from.candidate_network_policy); + to.audioJitterBufferMaxPackets = SafeInt(from.audio_jitter_buffer_max_packets); + to.audioJitterBufferFastAccelerate = from.audio_jitter_buffer_fast_accelerate; + + if (NativeType::kUndefined != from.ice_connection_receiving_timeout) { + to.iceConnectionReceivingTimeout = Milliseconds(SafeInt(from.ice_connection_receiving_timeout)); + } + if (NativeType::kUndefined != from.ice_backup_candidate_pair_ping_interval) { + to.iceBackupCandidatePairPingInterval = Milliseconds(SafeInt(from.ice_backup_candidate_pair_ping_interval)); + } + + to.continualGatheringPolicy = UseEnum::toWrapper(from.continual_gathering_policy); + to.prioritizeMostLikelyIceCandidatePairs = from.prioritize_most_likely_ice_candidate_pairs; + to.pruneTurnPorts = from.prune_turn_ports; + to.enableIceRenomination = from.enable_ice_renomination; + to.redetermineRoleOnIceRestart = from.redetermine_role_on_ice_restart; + + if (from.ice_check_min_interval.has_value()) { + to.iceCheckMinInterval = Milliseconds(SafeInt(from.ice_check_min_interval.value())); + } + + if (from.stun_candidate_keepalive_interval.has_value()) { + to.stunCandidateKeepaliveInterval = Milliseconds(SafeInt(from.stun_candidate_keepalive_interval.value())); + } + + if (from.ice_regather_interval_range.has_value()) { + auto temp = UseMillisecondIntervalRange::toWrapper(from.ice_regather_interval_range.value()); + if (temp) to.iceRegatherIntervalRange = temp; + } + + if (from.network_preference.has_value()) { + to.networkPreference = UseEnum::toWrapper(from.network_preference.value()); + } + + to.sdpSemantics = UseEnum::toWrapper(from.sdp_semantics); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(native); + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(*converted->native_); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCConfiguration.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCConfiguration.h new file mode 100644 index 00000000..280a0c13 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCConfiguration.h @@ -0,0 +1,56 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCConfiguration.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCConfiguration : public wrapper::org::webRtc::RTCConfiguration + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCConfiguration, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCConfiguration, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface::RTCConfiguration, NativeType); + + RTCConfigurationWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCConfiguration() noexcept; + virtual ~RTCConfiguration() noexcept; + + + // methods RTCConfiguration + void wrapper_init_org_webRtc_RTCConfiguration() noexcept override; + void wrapper_init_org_webRtc_RTCConfiguration(wrapper::org::webRtc::RTCConfigurationType type) noexcept override; + void wrapper_init_org_webRtc_RTCConfiguration(wrapper::org::webRtc::RTCConfigurationPtr source) noexcept override; + + // properties RTCConfiguration + bool get_dscp() noexcept override; + void set_dscp(bool value) noexcept override; + bool get_cpuAdaptation() noexcept override; + void set_cpuAdaptation(bool value) noexcept override; + bool get_suspendBelowMinBitrate() noexcept override; + void set_suspendBelowMinBitrate(bool value) noexcept override; + bool get_prerendererSmoothing() noexcept override; + void set_prerendererSmoothing(bool value) noexcept override; + bool get_experimentCpuLoadEstimator() noexcept override; + void set_experimentCpuLoadEstimator(bool value) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannel.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannel.cpp new file mode 100644 index 00000000..3a96014c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannel.cpp @@ -0,0 +1,364 @@ + +#include "impl_org_webRtc_RTCDataChannel.h" +#include "impl_org_webRtc_MessageEvent.h" +#include "impl_org_webRtc_WebrtcLib.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "pc/datachannel.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +// borrow types from call defintions +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannel::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MessageEvent, UseMessageEvent); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static NativeType *unproxy(NativeType *native) +{ + if (!native) return native; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::DataChannel, ::webrtc::DataChannel, native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannel::RTCDataChannel() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelPtr wrapper::org::webRtc::RTCDataChannel::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannel::~RTCDataChannel() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::wrapper_dispose() noexcept +{ + if (!native_) return; + + if (!closeCalled_.exchange(true)) { + native_->Close(); + } + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > wrapper::impl::org::webRtc::RTCDataChannel::getStats(wrapper::org::webRtc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ +#pragma ZS_BUILD_NOTE("TODO","getStats") + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > result {}; + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::close() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + closeCalled_ = true; + notifiedOpen_ = true; + notifiedClosed_ = true; + native_->Close(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::send(String text) noexcept(false) +{ + bufferLowNotified_ = false; + + ZS_ASSERT(native_); + if (!native_) return; + + auto wrapperValue = UseMessageEvent::toWrapper(text); + auto nativeValue = UseMessageEvent::toNative(wrapperValue); + native_->Send(nativeValue); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::send(SecureByteBlockPtr data) noexcept(false) +{ + bufferLowNotified_ = false; + + ZS_ASSERT(native_); + if (!native_) return; + + auto wrapperValue = UseMessageEvent::toWrapper(data); + auto nativeValue = UseMessageEvent::toNative(wrapperValue); + native_->Send(nativeValue); +} + +//------------------------------------------------------------------------------ +unsigned short wrapper::impl::org::webRtc::RTCDataChannel::get_id() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return 0; + return SafeInt(native_->id()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannel::get_label() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + return native_->label(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCDataChannel::get_ordered() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->ordered(); +} + +//------------------------------------------------------------------------------ +Optional< ::zsLib::Milliseconds > wrapper::impl::org::webRtc::RTCDataChannel::get_maxPacketLifeTime() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return ::zsLib::Milliseconds(); + auto max = native_->maxRetransmitTime(); + if (max < 0) return Optional< ::zsLib::Milliseconds >(); + return ::zsLib::Milliseconds(SafeInt<::zsLib::Milliseconds::rep>()); +} + +//------------------------------------------------------------------------------ +Optional< unsigned short > wrapper::impl::org::webRtc::RTCDataChannel::get_maxRetransmits() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< unsigned short >(); + auto value = native_->maxRetransmits(); + if (value < 0) return Optional< unsigned short >(); + return value; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannel::get_protocol() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + return native_->protocol(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCDataChannel::get_negotiated() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_veryLow; + return native_->negotiated(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCDataChannel::get_priority() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_veryLow; + +#pragma ZS_BUILD_NOTE("LATER","Does not appear to have any method to get / set priority") + return wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_medium; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelState wrapper::impl::org::webRtc::RTCDataChannel::get_readyState() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closed; + + return UseEnum::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::webRtc::RTCDataChannel::get_bufferedAmount() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return 0; + + return native_->buffered_amount(); +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::webRtc::RTCDataChannel::get_bufferedAmountLowThreshold() noexcept +{ + return bufferLowThreshold_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::set_bufferedAmountLowThreshold(uint64_t value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + + bufferLowThreshold_ = value; + + auto bufferedAmount = native_->buffered_amount(); + if (bufferedAmount < value) { + // notify async to self object about buffer amount change to cause a notification + observer_->OnBufferedAmountChange(bufferedAmount); + } +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannel::get_binaryType() noexcept +{ + zsLib::AutoLock lock(lock_); + return binaryType_; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::set_binaryType(String value) noexcept +{ + zsLib::AutoLock lock(lock_); + binaryType_ = value; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannel::wrapper_onObserverCountChanged(ZS_MAYBE_USED() size_t count) noexcept +{ + ZS_MAYBE_USED(count); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverStateChange() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + auto state = native_->state(); + switch (state) { + case ::webrtc::DataChannelInterface::DataState::kConnecting: break; + case ::webrtc::DataChannelInterface::DataState::kOpen: { + if (!notifiedOpen_.exchange(true)) onOpen(); + break; + } + case ::webrtc::DataChannelInterface::DataState::kClosing: { + if (!notifiedOpen_.exchange(true)) onOpen(); + break; + } + case ::webrtc::DataChannelInterface::DataState::kClosed: { + if (!notifiedClosed_.exchange(true)) onClose(); + break; + } + } + +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverMessage(const ::webrtc::DataBuffer& buffer) noexcept +{ + auto messageEvent = UseMessageEvent::toWrapper(buffer); + onMessage(messageEvent); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverBufferedAmountChange(ZS_MAYBE_USED() uint64_t previous_amount) noexcept +{ + ZS_MAYBE_USED(previous_amount); + ZS_ASSERT(native_); + if (!native_) return; + + auto bufferedAmount = native_->buffered_amount(); + + if (bufferedAmount < bufferLowThreshold_) { + if (!bufferLowNotified_.exchange(true)) onBufferedAmountLow(); + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + if (!native_) return; + if (observer_) return; + + observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); + native_->RegisterObserver(observer_.get()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + if (!observer_) return; + if (!native_) return; + + native_->UnregisterObserver(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto original = unproxy(native); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeScopedPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeScopedPtr(); + return converted->native_; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannel.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannel.h new file mode 100644 index 00000000..9c840eea --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannel.h @@ -0,0 +1,118 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDataChannel.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "api/datachannelinterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDataChannel : public wrapper::org::webRtc::RTCDataChannel + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDataChannel, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannel, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::DataChannelInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + ZS_DECLARE_STRUCT_PTR(WebrtcObserver); + + struct WebrtcObserver : public ::webrtc::DataChannelObserver + { + WebrtcObserver( + WrapperImplTypePtr wrapper, + IMessageQueuePtr queue + ) noexcept : outer_(wrapper), queue_(queue) {} + + void OnStateChange() final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer]() { outer->onWebrtcObserverStateChange(); }); + } + void OnMessage(const ::webrtc::DataBuffer& buffer) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, buffer]() { outer->onWebrtcObserverMessage(buffer); }); + } + void OnBufferedAmountChange(uint64_t previous_amount) + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, previous_amount]() { outer->onWebrtcObserverBufferedAmountChange(previous_amount); }); + } + + private: + WrapperImplTypeWeakPtr outer_; + IMessageQueuePtr queue_; + }; + + std::atomic_bool closeCalled_ {}; + std::atomic bufferLowThreshold_ {}; + std::atomic bufferLowNotified_ {}; + std::atomic notifiedOpen_ {}; + std::atomic notifiedClosed_ {}; + zsLib::Lock lock_; + String binaryType_ {}; + + WebrtcObserverUniPtr observer_; + NativeTypeScopedPtr native_; + RTCDataChannelWeakPtr thisWeak_; + + RTCDataChannel() noexcept; + virtual ~RTCDataChannel() noexcept; + void wrapper_dispose() noexcept override; + + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > getStats(wrapper::org::webRtc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + + // methods RTCDataChannel + void close() noexcept override; + void send(String text) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + void send(SecureByteBlockPtr data) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + + // properties RTCDataChannel + unsigned short get_id() noexcept override; + String get_label() noexcept override; + bool get_ordered() noexcept override; + Optional< ::zsLib::Milliseconds > get_maxPacketLifeTime() noexcept override; + Optional< unsigned short > get_maxRetransmits() noexcept override; + String get_protocol() noexcept override; + bool get_negotiated() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + wrapper::org::webRtc::RTCDataChannelState get_readyState() noexcept override; + uint64_t get_bufferedAmount() noexcept override; + uint64_t get_bufferedAmountLowThreshold() noexcept override; + void set_bufferedAmountLowThreshold(uint64_t value) noexcept override; + String get_binaryType() noexcept override; + void set_binaryType(String value) noexcept override; + + void wrapper_onObserverCountChanged(size_t count) noexcept override; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + // WebrtcObserver methods + void onWebrtcObserverStateChange() noexcept; + void onWebrtcObserverMessage(const ::webrtc::DataBuffer& buffer) noexcept; + void onWebrtcObserverBufferedAmountChange(uint64_t previous_amount) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelEvent.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelEvent.cpp new file mode 100644 index 00000000..ac77a67f --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelEvent.cpp @@ -0,0 +1,60 @@ + +#include "impl_org_webRtc_RTCDataChannelEvent.h" +#include "impl_org_webRtc_RTCDataChannel.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannelEvent::RTCDataChannelEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelEventPtr wrapper::org::webRtc::RTCDataChannelEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannelEvent::~RTCDataChannelEvent() noexcept +{ + thisWeak_.reset(); +} + + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelPtr wrapper::impl::org::webRtc::RTCDataChannelEvent::get_channel() noexcept +{ + return dataChannel_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseDataChannelPtr value) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->dataChannel_ = value; + return result; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelEvent.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelEvent.h new file mode 100644 index 00000000..1c510404 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelEvent.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDataChannelEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDataChannelEvent : public wrapper::org::webRtc::RTCDataChannelEvent + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDataChannelEvent, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelEvent, WrapperImplType); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannel, UseDataChannel); + + UseDataChannelPtr dataChannel_; + RTCDataChannelEventWeakPtr thisWeak_; + + RTCDataChannelEvent() noexcept; + virtual ~RTCDataChannelEvent() noexcept; + + + // properties RTCDataChannelEvent + wrapper::org::webRtc::RTCDataChannelPtr get_channel() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseDataChannelPtr value) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelInit.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelInit.cpp new file mode 100644 index 00000000..cac2db7d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelInit.cpp @@ -0,0 +1,122 @@ + +#include "impl_org_webRtc_RTCDataChannelInit.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/datachannelinterface.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelInit::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannelInit::RTCDataChannelInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelInitPtr wrapper::org::webRtc::RTCDataChannelInit::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannelInit::~RTCDataChannelInit() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannelInit::wrapper_init_org_webRtc_RTCDataChannelInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannelInit::wrapper_init_org_webRtc_RTCDataChannelInit(wrapper::org::webRtc::RTCDataChannelInitPtr source) noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.ordered = from.ordered; + if (from.maxRetransmitTime >= 0) { + to.maxPacketLifetime = ::zsLib::Milliseconds(SafeInt<::zsLib::Milliseconds::rep>(from.maxRetransmitTime)); + } + if (from.maxRetransmits >= 0) { + to.maxRetransmits = SafeInt(from.maxRetransmits); + } + to.protocol = from.protocol; + to.negotiated = from.negotiated; + if (from.id >= 0) { + to.id = SafeInt(from.id); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.ordered = from.ordered; + if (from.maxPacketLifetime.has_value()) { + to.maxRetransmitTime = (int)SafeInt(from.maxPacketLifetime.value().count()); + } + if (from.maxRetransmits.has_value()) { + to.maxRetransmits = (int)SafeInt(from.maxRetransmits.value()); + } + to.protocol = from.protocol; + to.negotiated = from.negotiated; + if (from.id >= 0) { + to.id = (int)SafeInt(from.id.value()); + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelInit.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelInit.h new file mode 100644 index 00000000..13e321ef --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelInit.h @@ -0,0 +1,41 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDataChannelInit.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDataChannelInit : public wrapper::org::webRtc::RTCDataChannelInit + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDataChannelInit, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelInit, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::DataChannelInit, NativeType); + + RTCDataChannelInitWeakPtr thisWeak_; + + RTCDataChannelInit() noexcept; + virtual ~RTCDataChannelInit() noexcept; + + + // methods RTCDataChannelInit + void wrapper_init_org_webRtc_RTCDataChannelInit() noexcept override; + void wrapper_init_org_webRtc_RTCDataChannelInit(wrapper::org::webRtc::RTCDataChannelInitPtr source) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelStats.cpp new file mode 100644 index 00000000..1f4da8f7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelStats.cpp @@ -0,0 +1,142 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCDataChannelStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannelStats::RTCDataChannelStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelStatsPtr wrapper::org::webRtc::RTCDataChannelStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDataChannelStats::~RTCDataChannelStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDataChannelStats::wrapper_init_org_webRtc_RTCDataChannelStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCDataChannelStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCDataChannelStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannelStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannelStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannelStats::get_label() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannelStats::get_protocol() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +long wrapper::impl::org::webRtc::RTCDataChannelStats::get_dataChannelIdentifier() noexcept +{ + long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDataChannelStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelState wrapper::impl::org::webRtc::RTCDataChannelStats::get_state() noexcept +{ + wrapper::org::webRtc::RTCDataChannelState result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCDataChannelStats::get_messagesSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCDataChannelStats::get_bytesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCDataChannelStats::get_messagesReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCDataChannelStats::get_bytesReceived() noexcept +{ + unsigned long long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelStats.h new file mode 100644 index 00000000..ad2bd20f --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDataChannelStats.h @@ -0,0 +1,47 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDataChannelStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDataChannelStats : public wrapper::org::webRtc::RTCDataChannelStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDataChannelStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelStats, WrapperImplType); + RTCDataChannelStatsWeakPtr thisWeak_; + + RTCDataChannelStats() noexcept; + virtual ~RTCDataChannelStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + void wrapper_init_org_webRtc_RTCDataChannelStats() noexcept override; + + // properties RTCDataChannelStats + String get_label() noexcept override; + String get_protocol() noexcept override; + long get_dataChannelIdentifier() noexcept override; + String get_transportId() noexcept override; + wrapper::org::webRtc::RTCDataChannelState get_state() noexcept override; + unsigned long get_messagesSent() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long get_messagesReceived() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDtlsFingerprint.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtlsFingerprint.cpp new file mode 100644 index 00000000..ddf5f09d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtlsFingerprint.cpp @@ -0,0 +1,86 @@ + +#include "impl_org_webRtc_RTCDtlsFingerprint.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/sslfingerprint.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtlsFingerprint::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDtlsFingerprint::RTCDtlsFingerprint() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDtlsFingerprintPtr wrapper::org::webRtc::RTCDtlsFingerprint::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDtlsFingerprint::~RTCDtlsFingerprint() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtlsFingerprint::wrapper_init_org_webRtc_RTCDtlsFingerprint() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtlsFingerprint::wrapper_init_org_webRtc_RTCDtlsFingerprint(wrapper::org::webRtc::RTCDtlsFingerprintPtr source) noexcept +{ + if (!source) { + wrapper_init_org_webRtc_RTCDtlsFingerprint(); + return; + } + algorithm = source->algorithm; + value = source->value; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const std::string &alg, NativeTypeUniPtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + result->algorithm = alg; + result->value = native->GetRfc4572Fingerprint(); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypeUniPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeUniPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeUniPtr(); + + std::unique_ptr native(::rtc::SSLFingerprint::CreateFromRfc4572(converted->algorithm, converted->value)); + return std::move(native); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDtlsFingerprint.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtlsFingerprint.h new file mode 100644 index 00000000..3c4a8ebf --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtlsFingerprint.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDtlsFingerprint.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDtlsFingerprint : public wrapper::org::webRtc::RTCDtlsFingerprint + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDtlsFingerprint, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtlsFingerprint, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::rtc::SSLFingerprint, NativeType); + + + RTCDtlsFingerprintWeakPtr thisWeak_; + + RTCDtlsFingerprint() noexcept; + virtual ~RTCDtlsFingerprint() noexcept; + + + // methods RTCDtlsFingerprint + void wrapper_init_org_webRtc_RTCDtlsFingerprint() noexcept override; + void wrapper_init_org_webRtc_RTCDtlsFingerprint(wrapper::org::webRtc::RTCDtlsFingerprintPtr source) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const std::string &alg, NativeTypeUniPtr native) noexcept; + ZS_NO_DISCARD() static NativeTypeUniPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfSender.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfSender.cpp new file mode 100644 index 00000000..07b46d73 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfSender.cpp @@ -0,0 +1,226 @@ + +#include "impl_org_webRtc_RTCDtmfSender.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_RTCDtmfToneChangeEvent.h" +#include "impl_org_webRtc_WebrtcLib.h" + +#include "impl_org_webRtc_pre_include.h" +#include "pc/dtmfsender.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtmfSender::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtmfToneChangeEvent, UseToneChangeEvent); + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static NativeType *unproxyNative(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::DtmfSender, ::webrtc::DtmfSender, native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDtmfSender::RTCDtmfSender() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDtmfSenderPtr wrapper::org::webRtc::RTCDtmfSender::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDtmfSender::~RTCDtmfSender() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtmfSender::wrapper_dispose() noexcept +{ + if (!native_) return; + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCDtmfSender::canInsertDtmf() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->CanInsertDtmf(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtmfSender::insertDtmf(String tones) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return; + + native_->InsertDtmf(tones, 100, 70); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtmfSender::insertDtmf( + String tones, + ::zsLib::Milliseconds duration + ) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return; + + native_->InsertDtmf(tones, SafeInt(duration.count()), 70); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtmfSender::insertDtmf( + String tones, + ::zsLib::Milliseconds duration, + ::zsLib::Milliseconds interToneGap + ) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return; + + native_->InsertDtmf(tones, SafeInt(duration.count()), SafeInt(interToneGap.count())); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDtmfSender::get_toneBuffer() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + + return native_->tones(); +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCDtmfSender::get_duration() noexcept +{ + typedef ::zsLib::Milliseconds ResultType; + + ZS_ASSERT(native_); + if (!native_) return ResultType(); + auto ms = native_->duration(); + + return ResultType(SafeInt<::zsLib::Milliseconds::rep>(ms)); +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCDtmfSender::get_interToneGap() noexcept +{ + typedef ::zsLib::Milliseconds ResultType; + + ZS_ASSERT(native_); + if (!native_) return ResultType(); + auto ms = native_->inter_tone_gap(); + + return ResultType(SafeInt<::zsLib::Milliseconds::rep>(ms)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCDtmfSender::wrapper_onObserverCountChanged(ZS_MAYBE_USED() size_t count) noexcept +{ + ZS_MAYBE_USED(count); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverToneChange(const String &tones) noexcept +{ + String tone = tones.substr(0, 1); + auto event = UseToneChangeEvent::toWrapper(tone); + if (!event) return; + onToneChange(event); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + if (!native_) return; + observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); + native_->RegisterObserver(observer_.get()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + if (!observer_) return; + if (!native_) return; + + native_->UnregisterObserver(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + NativeType *original = unproxyNative(native); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfSender.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfSender.h new file mode 100644 index 00000000..c2046435 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfSender.h @@ -0,0 +1,92 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDtmfSender.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "api/dtmfsenderinterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDtmfSender : public wrapper::org::webRtc::RTCDtmfSender + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDtmfSender, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtmfSender, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::DtmfSenderInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + + ZS_DECLARE_STRUCT_PTR(WebrtcObserver); + + struct WebrtcObserver : public ::webrtc::DtmfSenderObserverInterface + { + WebrtcObserver( + WrapperImplTypePtr wrapper, + IMessageQueuePtr queue + ) noexcept : outer_(wrapper), queue_(queue) {} + + void OnToneChange(const std::string& tone) override + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, tone]() { outer->onWebrtcObserverToneChange(tone); }); + } + + private: + WrapperImplTypeWeakPtr outer_; + IMessageQueuePtr queue_; + }; + + WebrtcObserverUniPtr observer_; + NativeTypeScopedPtr native_; + RTCDtmfSenderWeakPtr thisWeak_; + + RTCDtmfSender() noexcept; + virtual ~RTCDtmfSender() noexcept; + void wrapper_dispose() noexcept override; + + + // methods RTCDtmfSender + bool canInsertDtmf() noexcept override; + void insertDtmf(String tones) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + void insertDtmf( + String tones, + ::zsLib::Milliseconds duration + ) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + void insertDtmf( + String tones, + ::zsLib::Milliseconds duration, + ::zsLib::Milliseconds interToneGap + ) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + + // properties RTCDtmfSender + String get_toneBuffer() noexcept override; + ::zsLib::Milliseconds get_duration() noexcept override; + ::zsLib::Milliseconds get_interToneGap() noexcept override; + + void wrapper_onObserverCountChanged(size_t count) noexcept override; + + + void onWebrtcObserverToneChange(const String &tones) noexcept; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfToneChangeEvent.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfToneChangeEvent.cpp new file mode 100644 index 00000000..40a51d4c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfToneChangeEvent.cpp @@ -0,0 +1,59 @@ + +#include "impl_org_webRtc_RTCDtmfToneChangeEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtmfToneChangeEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDtmfToneChangeEvent::RTCDtmfToneChangeEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDtmfToneChangeEventPtr wrapper::org::webRtc::RTCDtmfToneChangeEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCDtmfToneChangeEvent::~RTCDtmfToneChangeEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCDtmfToneChangeEvent::get_tone() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const String &tone) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->tone_ = tone; + return result; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfToneChangeEvent.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfToneChangeEvent.h new file mode 100644 index 00000000..09b4e80c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCDtmfToneChangeEvent.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCDtmfToneChangeEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCDtmfToneChangeEvent : public wrapper::org::webRtc::RTCDtmfToneChangeEvent + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCDtmfToneChangeEvent, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtmfToneChangeEvent, WrapperImplType); + + String tone_; + RTCDtmfToneChangeEventWeakPtr thisWeak_; + + RTCDtmfToneChangeEvent() noexcept; + virtual ~RTCDtmfToneChangeEvent() noexcept; + + + // properties RTCDtmfToneChangeEvent + String get_tone() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const String &tone) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCError.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCError.cpp new file mode 100644 index 00000000..6dc373c5 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCError.cpp @@ -0,0 +1,175 @@ + +#include "impl_org_webRtc_RTCError.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_WebrtcLib.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtcerror.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCError::RTCError() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCErrorPtr wrapper::org::webRtc::RTCError::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCError::~RTCError() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCError::wrapper_init_org_webRtc_RTCError() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCErrorType wrapper::impl::org::webRtc::RTCError::get_type() noexcept +{ + if (!native_) return wrapper::org::webRtc::RTCErrorType::RTCErrorType_none; + return IEnum::toWrapper(native_->type()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCError::get_message() noexcept +{ + if (!native_) return String(); + return native_->message(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCError::get_ok() noexcept +{ + if (!native_) return false; + return native_->ok(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::reject(PromisePtr promise) noexcept +{ + if (!promise) return; + + if (native_) { + if (native_->ok()) { + promise->resolve(); + return; + } + } + + auto pThis = thisWeak_.lock(); + ZS_ASSERT(pThis); + + auto holder = make_shared< ::zsLib::AnyHolder< wrapper::org::webRtc::RTCErrorPtr > >(); + holder->value_ = pThis; + promise->reject(holder); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::rejectPromise(PromisePtr promise, const NativeType &native) noexcept +{ + if (!promise) return; + if (native.ok()) { + promise->resolve(); + return; + } + + auto wrapper = toWrapper(native); + + auto holder = make_shared< ::zsLib::AnyHolder< wrapper::org::webRtc::RTCErrorPtr > >(); + holder->value_ = wrapper; + + promise->reject(holder); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::rejectPromise(PromisePtr promise, NativeTypePtr native) noexcept +{ + if (!promise) return; + if (!native) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INTERNAL_ERROR); + rejectPromise(promise, error); + return; + } + rejectPromise(promise, *native); +} + +//------------------------------------------------------------------------------ +PromisePtr WrapperImplType::toPromise(const NativeType &native) noexcept +{ + if (native.ok()) return Promise::createResolved(UseWebrtcLib::delegateQueue()); + auto wrapper = toWrapper(native); + + auto holder = make_shared< ::zsLib::AnyHolder< wrapper::org::webRtc::RTCErrorPtr > >(); + holder->value_ = wrapper; + + return Promise::createRejected(holder, UseWebrtcLib::delegateQueue()); +} + +//------------------------------------------------------------------------------ +PromisePtr WrapperImplType::toPromise(NativeTypePtr native) noexcept +{ + if (!native) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INTERNAL_ERROR); + return toPromise(error); + } + return toPromise(native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(native.type(), native.message()); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCError.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCError.h new file mode 100644 index 00000000..8c40089d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCError.h @@ -0,0 +1,52 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCError.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCError : public wrapper::org::webRtc::RTCError + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCError, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RTCError, NativeType); + + RTCErrorWeakPtr thisWeak_; + NativeTypePtr native_; + + RTCError() noexcept; + virtual ~RTCError() noexcept; + + void wrapper_init_org_webRtc_RTCError() noexcept override; + + // properties RTCError + wrapper::org::webRtc::RTCErrorType get_type() noexcept override; + String get_message() noexcept override; + bool get_ok() noexcept override; + + void reject(PromisePtr promise) noexcept; + + static void rejectPromise(PromisePtr promise, const NativeType &native) noexcept; + static void rejectPromise(PromisePtr promise, NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static PromisePtr toPromise(const NativeType &native) noexcept; + ZS_NO_DISCARD() static PromisePtr toPromise(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidate.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidate.cpp new file mode 100644 index 00000000..3fe2044f --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidate.cpp @@ -0,0 +1,331 @@ + +#include "impl_org_webRtc_RTCIceCandidate.h" +#include "impl_org_webRtc_RTCIceCandidateInit.h" +#include "impl_org_webRtc_RTCError.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/jsepicecandidate.h" +#include "impl_org_webRtc_post_include.h" + +#include + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidate::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError, UseError); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidateInit, UseIceCandidateInit); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidate::RTCIceCandidate() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidatePtr wrapper::org::webRtc::RTCIceCandidate::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidate::~RTCIceCandidate() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCIceCandidate::wrapper_init_org_webRtc_RTCIceCandidate() noexcept +{ + native_ = std::make_unique(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCIceCandidate::wrapper_init_org_webRtc_RTCIceCandidate(wrapper::org::webRtc::RTCIceCandidateInitPtr init) noexcept(false) +{ + if (!init) { + wrapper_init_org_webRtc_RTCIceCandidate(); + return; + } + webrtc::SdpParseError error; + NativeTypeUniPtr candidate(webrtc::CreateIceCandidate(init->sdpMid, init->sdpMLineIndex, init->candidate, &error)); + + if (!candidate) { + std::stringstream ss; + ss << error.line; + if (error.line.length() > 0) { + ss << " <- "; + } + ss << error.description; + throw UseError::toWrapper(::webrtc::RTCError(::webrtc::RTCErrorType::SYNTAX_ERROR, ss.str())); + } + + native_ = std::make_unique(candidate->candidate()); + mid_ = candidate->sdp_mid(); + mLineIndex = SafeInt(candidate->sdp_mline_index()); + serverUrl_ = candidate->server_url(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidateInitPtr wrapper::impl::org::webRtc::RTCIceCandidate::toJson() noexcept +{ + return UseIceCandidateInit::toWrapper(thisWeak_.lock()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidate::get_candidate() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + ::zsLib::AutoLock lock(lock_); + + ::webrtc::JsepIceCandidate temp(mid_, mLineIndex.has_value() ? mLineIndex.value() : 0, *native_); + String result; + temp.ToString(&result); + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidate::get_sdpMid() noexcept +{ + ::zsLib::AutoLock lock(lock_); + return mid_; +} + +//------------------------------------------------------------------------------ +Optional< unsigned short > wrapper::impl::org::webRtc::RTCIceCandidate::get_sdpMLineIndex() noexcept +{ + ::zsLib::AutoLock lock(lock_); + return mLineIndex; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidate::get_foundation() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + ::zsLib::AutoLock lock(lock_); + return native_->foundation(); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCIceComponent > wrapper::impl::org::webRtc::RTCIceCandidate::get_component() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< wrapper::org::webRtc::RTCIceComponent >(); + + ::zsLib::AutoLock lock(lock_); + auto value = native_->component(); + try { + return UseEnum::toWrapperRTCIceComponent(value); + } catch (const zsLib::Exceptions::InvalidArgument &) { + } + return Optional< wrapper::org::webRtc::RTCIceComponent >(); +} + +//------------------------------------------------------------------------------ +Optional< unsigned long > wrapper::impl::org::webRtc::RTCIceCandidate::get_priority() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return 0; + ::zsLib::AutoLock lock(lock_); + return native_->priority(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidate::get_ip() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + ::zsLib::AutoLock lock(lock_); + return native_->address().HostAsURIString(); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCIceProtocol > wrapper::impl::org::webRtc::RTCIceCandidate::get_protocol() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< wrapper::org::webRtc::RTCIceProtocol >(); + + ::zsLib::AutoLock lock(lock_); + String str = native_->protocol(); + if (!str.hasData()) return Optional< wrapper::org::webRtc::RTCIceProtocol >(); + try { + return UseEnum::toWrapperRTCIceProtocol(str.c_str()); + } catch (const zsLib::Exceptions::InvalidArgument &) { + } + return Optional< wrapper::org::webRtc::RTCIceProtocol >(); +} + +//------------------------------------------------------------------------------ +Optional< uint16_t > wrapper::impl::org::webRtc::RTCIceCandidate::get_port() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< uint16_t >(); + ::zsLib::AutoLock lock(lock_); + auto port = native_->address().port(); + if (port < 1) return Optional< uint16_t >(); + return SafeInt(port); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCIceCandidateType > wrapper::impl::org::webRtc::RTCIceCandidate::get_type() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< wrapper::org::webRtc::RTCIceCandidateType >(); + + ::zsLib::AutoLock lock(lock_); + String str = native_->type(); + if (!str.hasData()) return Optional< wrapper::org::webRtc::RTCIceCandidateType >(); + try { + return UseEnum::toWrapperRTCIceCandidateType(str.c_str()); + } catch (const zsLib::Exceptions::InvalidArgument &) { + } + return Optional< wrapper::org::webRtc::RTCIceCandidateType >(); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCIceTcpCandidateType > wrapper::impl::org::webRtc::RTCIceCandidate::get_tcpType() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< wrapper::org::webRtc::RTCIceTcpCandidateType >(); + + ::zsLib::AutoLock lock(lock_); + String str = native_->tcptype(); + if (!str.hasData()) return Optional< wrapper::org::webRtc::RTCIceTcpCandidateType >(); + try { + return UseEnum::toWrapperRTCIceTcpCandidateType(str.c_str()); + } catch (const zsLib::Exceptions::InvalidArgument &) { + } + return Optional< wrapper::org::webRtc::RTCIceTcpCandidateType >(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidate::get_relatedAddress() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + ::zsLib::AutoLock lock(lock_); + return native_->related_address().HostAsURIString(); +} + +//------------------------------------------------------------------------------ +Optional< uint16_t > wrapper::impl::org::webRtc::RTCIceCandidate::get_relatedPort() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< uint16_t >(); + ::zsLib::AutoLock lock(lock_); + auto port = native_->related_address().port(); + if (port < 1) return Optional< uint16_t >(); + return SafeInt(port); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidate::get_usernameFragment() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + ::zsLib::AutoLock lock(lock_); + return native_->username(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const UseIceCandidateInit &candidate) noexcept +{ + auto mline = candidate.sdpMLineIndex; + ::webrtc::SdpParseError error; + auto result = ::webrtc::CreateIceCandidate(candidate.sdpMid, mline.has_value() ? mline.value() : -1, candidate.candidate, &error); + return toWrapper(result); +} + +WrapperImplTypePtr WrapperImplType::toWrapper(UseIceCandidateInitPtr candidate) noexcept +{ + if (!candidate) return WrapperImplTypePtr(); + return toWrapper(*candidate); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const CricketNativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = std::make_unique(native); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const CricketNativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< WrapperImplTypePtr > > WrapperImplType::toWrapper(const std::vector &native) noexcept +{ + auto result = make_shared< list< WrapperImplTypePtr > >(); + + for (auto iter = native.begin(); iter != native.end(); ++iter) { + result->push_back(toWrapper(*iter)); + } + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = std::make_unique(native.candidate()); + result->mid_ = native.sdp_mid(); + auto mline = native.sdp_mline_index(); + if (mline >= 0) { + result->mLineIndex = SafeIntmLineIndex)::value_type>(mline); + } + result->serverUrl_ = native.server_url(); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypeUniPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeUniPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeUniPtr(); + if (!converted->native_) return NativeTypeUniPtr(); + + auto mLine = wrapper->get_sdpMLineIndex(); + auto result = std::make_unique<::webrtc::JsepIceCandidate>(wrapper->get_sdpMid(), mLine.has_value() ? mLine.value() : -1, *converted->native_); + return std::move(result); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidate.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidate.h new file mode 100644 index 00000000..d87ccf82 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidate.h @@ -0,0 +1,77 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCIceCandidate.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/jsep.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCIceCandidate : public wrapper::org::webRtc::RTCIceCandidate + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCIceCandidate, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidate, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::IceCandidateInterface, NativeType); + ZS_DECLARE_TYPEDEF_PTR(::cricket::Candidate, CricketNativeType); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidateInit, UseIceCandidateInit); + + String mid_; + Optional mLineIndex {}; + String serverUrl_; + CricketNativeTypeUniPtr native_; + zsLib::Lock lock_; + RTCIceCandidateWeakPtr thisWeak_; + + RTCIceCandidate() noexcept; + virtual ~RTCIceCandidate() noexcept; + + + // methods RTCIceCandidate + void wrapper_init_org_webRtc_RTCIceCandidate() noexcept override; + void wrapper_init_org_webRtc_RTCIceCandidate(wrapper::org::webRtc::RTCIceCandidateInitPtr init) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + wrapper::org::webRtc::RTCIceCandidateInitPtr toJson() noexcept override; + + // properties RTCIceCandidate + String get_candidate() noexcept override; + String get_sdpMid() noexcept override; + Optional< unsigned short > get_sdpMLineIndex() noexcept override; + String get_foundation() noexcept override; + Optional< wrapper::org::webRtc::RTCIceComponent > get_component() noexcept override; + Optional< unsigned long > get_priority() noexcept override; + String get_ip() noexcept override; + Optional< wrapper::org::webRtc::RTCIceProtocol > get_protocol() noexcept override; + Optional< uint16_t > get_port() noexcept override; + Optional< wrapper::org::webRtc::RTCIceCandidateType > get_type() noexcept override; + Optional< wrapper::org::webRtc::RTCIceTcpCandidateType > get_tcpType() noexcept override; + String get_relatedAddress() noexcept override; + Optional< uint16_t > get_relatedPort() noexcept override; + String get_usernameFragment() noexcept override; + + String serverUrl() const noexcept { return serverUrl_; } + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const UseIceCandidateInit &candidate) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseIceCandidateInitPtr candidate) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const CricketNativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const CricketNativeType *native) noexcept; + + ZS_NO_DISCARD() static shared_ptr< list< WrapperImplTypePtr > > toWrapper(const std::vector &native) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType *native) noexcept; + + ZS_NO_DISCARD() static NativeTypeUniPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateInit.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateInit.cpp new file mode 100644 index 00000000..8e369274 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateInit.cpp @@ -0,0 +1,69 @@ + +#include "impl_org_webRtc_RTCIceCandidateInit.h" +#include "impl_org_webRtc_RTCIceCandidate.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidateInit::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidateInit::RTCIceCandidateInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidateInitPtr wrapper::org::webRtc::RTCIceCandidateInit::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidateInit::~RTCIceCandidateInit() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCIceCandidateInit::wrapper_init_org_webRtc_RTCIceCandidateInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const UseIceCandidate &candidate) noexcept +{ + auto converted = const_cast(&candidate); + auto result = make_shared(); + result->thisWeak_ = result; + result->candidate = converted->get_candidate(); + result->sdpMid = converted->get_sdpMid(); + result->sdpMLineIndex = converted->get_sdpMLineIndex(); + result->usernameFragment = converted->get_usernameFragment(); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseIceCandidatePtr candidate) noexcept +{ + if (!candidate) return WrapperImplTypePtr(); + return toWrapper(*candidate); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateInit.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateInit.h new file mode 100644 index 00000000..d11a0773 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateInit.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCIceCandidateInit.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCIceCandidateInit : public wrapper::org::webRtc::RTCIceCandidateInit + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCIceCandidateInit, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidateInit, WrapperImplType); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidate, UseIceCandidate); + + RTCIceCandidateInitWeakPtr thisWeak_; + + RTCIceCandidateInit() noexcept; + virtual ~RTCIceCandidateInit() noexcept; + void wrapper_init_org_webRtc_RTCIceCandidateInit() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const UseIceCandidate &candidate) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseIceCandidatePtr candidate) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidatePairStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidatePairStats.cpp new file mode 100644 index 00000000..064b9804 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidatePairStats.cpp @@ -0,0 +1,263 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCIceCandidatePairStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidatePairStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidatePairStats::RTCIceCandidatePairStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidatePairStatsPtr wrapper::org::webRtc::RTCIceCandidatePairStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidatePairStats::~RTCIceCandidatePairStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_localCandidateId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_remoteCandidateId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCStatsIceCandidatePairState wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_state() noexcept +{ + wrapper::org::webRtc::RTCStatsIceCandidatePairState result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_nominated() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_packetsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_packetsReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_bytesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_bytesReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_lastPacketSentTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_lastPacketReceivedTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_firstRequestTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_lastRequestTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_lastResponseTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_totalRoundTripTime() noexcept +{ + ::zsLib::Milliseconds result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_currentRoundTripTime() noexcept +{ + ::zsLib::Milliseconds result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_availableOutgoingBitrate() noexcept +{ + Optional< double > result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_availableIncomingBitrate() noexcept +{ + Optional< double > result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_circuitBreakerTriggerCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_requestsReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_requestsSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_responsesReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_responsesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_retransmissionsReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_retransmissionsSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_consentRequestsSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidatePairStats::get_consentExpiredTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidatePairStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidatePairStats.h new file mode 100644 index 00000000..d6a96670 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidatePairStats.h @@ -0,0 +1,64 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCIceCandidatePairStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCIceCandidatePairStats : public wrapper::org::webRtc::RTCIceCandidatePairStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCIceCandidatePairStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidatePairStats, WrapperImplType); + RTCIceCandidatePairStatsWeakPtr thisWeak_; + + RTCIceCandidatePairStats() noexcept; + virtual ~RTCIceCandidatePairStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCIceCandidatePairStats + String get_transportId() noexcept override; + String get_localCandidateId() noexcept override; + String get_remoteCandidateId() noexcept override; + wrapper::org::webRtc::RTCStatsIceCandidatePairState get_state() noexcept override; + bool get_nominated() noexcept override; + unsigned long get_packetsSent() noexcept override; + unsigned long get_packetsReceived() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + ::zsLib::Time get_lastPacketSentTimestamp() noexcept override; + ::zsLib::Time get_lastPacketReceivedTimestamp() noexcept override; + ::zsLib::Time get_firstRequestTimestamp() noexcept override; + ::zsLib::Time get_lastRequestTimestamp() noexcept override; + ::zsLib::Time get_lastResponseTimestamp() noexcept override; + ::zsLib::Milliseconds get_totalRoundTripTime() noexcept override; + ::zsLib::Milliseconds get_currentRoundTripTime() noexcept override; + Optional< double > get_availableOutgoingBitrate() noexcept override; + Optional< double > get_availableIncomingBitrate() noexcept override; + unsigned long get_circuitBreakerTriggerCount() noexcept override; + unsigned long long get_requestsReceived() noexcept override; + unsigned long long get_requestsSent() noexcept override; + unsigned long long get_responsesReceived() noexcept override; + unsigned long long get_responsesSent() noexcept override; + unsigned long long get_retransmissionsReceived() noexcept override; + unsigned long long get_retransmissionsSent() noexcept override; + unsigned long long get_consentRequestsSent() noexcept override; + ::zsLib::Time get_consentExpiredTimestamp() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateStats.cpp new file mode 100644 index 00000000..0dfcd87d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateStats.cpp @@ -0,0 +1,144 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCIceCandidateStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidateStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidateStats::RTCIceCandidateStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidateStatsPtr wrapper::org::webRtc::RTCIceCandidateStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceCandidateStats::~RTCIceCandidateStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCIceCandidateStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCIceCandidateStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCNetworkType wrapper::impl::org::webRtc::RTCIceCandidateStats::get_networkType() noexcept +{ + wrapper::org::webRtc::RTCNetworkType result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_ip() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +long wrapper::impl::org::webRtc::RTCIceCandidateStats::get_port() noexcept +{ + long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_protocol() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidateType wrapper::impl::org::webRtc::RTCIceCandidateStats::get_candidateType() noexcept +{ + wrapper::org::webRtc::RTCIceCandidateType result {}; + return result; +} + +//------------------------------------------------------------------------------ +long wrapper::impl::org::webRtc::RTCIceCandidateStats::get_priority() noexcept +{ + long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_url() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCIceCandidateStats::get_relayProtocol() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCIceCandidateStats::get_deleted() noexcept +{ + Optional< bool > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateStats.h new file mode 100644 index 00000000..b4ba2a6d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceCandidateStats.h @@ -0,0 +1,47 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCIceCandidateStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCIceCandidateStats : public wrapper::org::webRtc::RTCIceCandidateStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCIceCandidateStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidateStats, WrapperImplType); + RTCIceCandidateStatsWeakPtr thisWeak_; + + RTCIceCandidateStats() noexcept; + virtual ~RTCIceCandidateStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCIceCandidateStats + String get_transportId() noexcept override; + wrapper::org::webRtc::RTCNetworkType get_networkType() noexcept override; + String get_ip() noexcept override; + long get_port() noexcept override; + String get_protocol() noexcept override; + wrapper::org::webRtc::RTCIceCandidateType get_candidateType() noexcept override; + long get_priority() noexcept override; + String get_url() noexcept override; + String get_relayProtocol() noexcept override; + Optional< bool > get_deleted() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceServer.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceServer.cpp new file mode 100644 index 00000000..a45f0760 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceServer.cpp @@ -0,0 +1,135 @@ + +#include "impl_org_webRtc_RTCIceServer.h" +#include "impl_org_webRtc_enums.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceServer::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceServer::RTCIceServer() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceServerPtr wrapper::org::webRtc::RTCIceServer::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCIceServer::~RTCIceServer() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCIceServer::wrapper_init_org_webRtc_RTCIceServer() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCIceServer::wrapper_init_org_webRtc_RTCIceServer(wrapper::org::webRtc::RTCIceServerPtr source) noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.uri = from.uri; + to.urls = make_shared< list< String > >(); + for (auto iter = from.urls.begin(); iter != from.urls.end(); ++iter) { + to.urls->push_back(*iter); + } + to.username = from.username; + to.credential = from.password; + // to.oauthCredential = from. + // to.credentialType = from. + to.tlsCertPolicy = UseEnum::toWrapper(from.tls_cert_policy); + to.hostname = from.hostname; + to.tlsAlpnProtocols = make_shared< list< String > >(); + for (auto iter = from.tls_alpn_protocols.begin(); iter != from.tls_alpn_protocols.end(); ++iter) { + to.tlsAlpnProtocols->push_back(*iter); + } + to.tlsEllipticCurves = make_shared< list< String > >(); + for (auto iter = from.tls_elliptic_curves.begin(); iter != from.tls_elliptic_curves.end(); ++iter) { + to.tlsEllipticCurves->push_back(*iter); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.uri = from.uri; + if (from.urls) { + for (auto iter = from.urls->begin(); iter != from.urls->end(); ++iter) { + to.urls.push_back(*iter); + } + } + to.username = from.username; + to.password = from.credential; + // to.oauthCredential = from. + // to.credentialType = from. + to.tls_cert_policy = UseEnum::toNative(from.tlsCertPolicy); + to.hostname = from.hostname; + if (from.tlsAlpnProtocols) { + for (auto iter = from.tlsAlpnProtocols->begin(); iter != from.tlsAlpnProtocols->end(); ++iter) { + to.tls_alpn_protocols.push_back(*iter); + } + } + if (from.tlsEllipticCurves) { + for (auto iter = from.tlsEllipticCurves->begin(); iter != from.tlsEllipticCurves->end(); ++iter) { + to.tls_elliptic_curves.push_back(*iter); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCIceServer.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceServer.h new file mode 100644 index 00000000..cbce69a2 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCIceServer.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCIceServer.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCIceServer : public wrapper::org::webRtc::RTCIceServer + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCIceServer, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceServer, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface::IceServer, NativeType); + + RTCIceServerWeakPtr thisWeak_; + + RTCIceServer() noexcept; + virtual ~RTCIceServer() noexcept; + + + // methods RTCIceServer + void wrapper_init_org_webRtc_RTCIceServer() noexcept override; + void wrapper_init_org_webRtc_RTCIceServer(wrapper::org::webRtc::RTCIceServerPtr source) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCInboundRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCInboundRtpStreamStats.cpp new file mode 100644 index 00000000..16513b40 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCInboundRtpStreamStats.cpp @@ -0,0 +1,305 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCInboundRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::RTCInboundRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCInboundRtpStreamStatsPtr wrapper::org::webRtc::RTCInboundRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::~RTCInboundRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_packetsReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_packetsLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_jitter() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_packetsDiscarded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_packetsRepaired() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_burstPacketsLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_burstPacketsDiscarded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_burstLossCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_burstDiscardCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_burstLossRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_burstDiscardRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_gapLossRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_gapDiscardRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_trackId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_receiverId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_remoteId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< unsigned long > wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_framesDecoded() noexcept +{ + Optional< unsigned long > result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_lastPacketReceivedTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_averageRtcpInterval() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_fecPacketsReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_bytesReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_packetsFailedDecryption() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_packetsDuplicated() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< map< String, unsigned long > > wrapper::impl::org::webRtc::RTCInboundRtpStreamStats::get_perDscpPacketsReceived() noexcept +{ + shared_ptr< map< String, unsigned long > > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCInboundRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCInboundRtpStreamStats.h new file mode 100644 index 00000000..1f517d5a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCInboundRtpStreamStats.h @@ -0,0 +1,74 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCInboundRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCInboundRtpStreamStats : public wrapper::org::webRtc::RTCInboundRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCInboundRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCInboundRtpStreamStats, WrapperImplType); + RTCInboundRtpStreamStatsWeakPtr thisWeak_; + + RTCInboundRtpStreamStats() noexcept; + virtual ~RTCInboundRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + + // properties RTCReceivedRtpStreamStats + unsigned long get_packetsReceived() noexcept override; + unsigned long get_packetsLost() noexcept override; + double get_jitter() noexcept override; + unsigned long get_packetsDiscarded() noexcept override; + unsigned long get_packetsRepaired() noexcept override; + unsigned long get_burstPacketsLost() noexcept override; + unsigned long get_burstPacketsDiscarded() noexcept override; + unsigned long get_burstLossCount() noexcept override; + unsigned long get_burstDiscardCount() noexcept override; + double get_burstLossRate() noexcept override; + double get_burstDiscardRate() noexcept override; + double get_gapLossRate() noexcept override; + double get_gapDiscardRate() noexcept override; + + // properties RTCInboundRtpStreamStats + String get_trackId() noexcept override; + String get_receiverId() noexcept override; + String get_remoteId() noexcept override; + Optional< unsigned long > get_framesDecoded() noexcept override; + ::zsLib::Time get_lastPacketReceivedTimestamp() noexcept override; + double get_averageRtcpInterval() noexcept override; + unsigned long get_fecPacketsReceived() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + unsigned long get_packetsFailedDecryption() noexcept override; + unsigned long get_packetsDuplicated() noexcept override; + shared_ptr< map< String, unsigned long > > get_perDscpPacketsReceived() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCKeyParams.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCKeyParams.cpp new file mode 100644 index 00000000..58fc46ea --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCKeyParams.cpp @@ -0,0 +1,172 @@ + +#include "impl_org_webRtc_RTCKeyParams.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRSAParams.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/sslidentity.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCKeyParams::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRSAParams, UseRsaParams); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCKeyParams::RTCKeyParams() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCKeyParamsPtr wrapper::org::webRtc::RTCKeyParams::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCKeyParams::~RTCKeyParams() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCKeyParams::wrapper_init_org_webRtc_RTCKeyParams() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCKeyParams::wrapper_init_org_webRtc_RTCKeyParams(wrapper::org::webRtc::RTCKeyType key_type) noexcept +{ + native_ = make_shared(UseEnum::toNative(key_type)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCKeyParamsPtr wrapper::org::webRtc::RTCKeyParams::createRsa() noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(NativeType::RSA()); + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCKeyParamsPtr wrapper::org::webRtc::RTCKeyParams::createRsaWithParams(wrapper::org::webRtc::RTCRSAParamsPtr params) noexcept +{ + if (!params) return createRsa(); + + auto native = UseRsaParams::toNative(params); + if (!native) return createRsa(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(NativeType::RSA(native->mod_size, native->pub_exp)); + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCKeyParamsPtr wrapper::org::webRtc::RTCKeyParams::createEcdsa() noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(NativeType::ECDSA()); + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCKeyParamsPtr wrapper::org::webRtc::RTCKeyParams::createEcdsaWithCurve(wrapper::org::webRtc::RTCECCurve curve) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(NativeType::ECDSA(UseEnum::toNative(curve))); + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCKeyParams::get_valid() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->IsValid(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRSAParamsPtr wrapper::impl::org::webRtc::RTCKeyParams::get_rsa() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return UseRsaParams::toWrapper(native_->rsa_params()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCECCurve wrapper::impl::org::webRtc::RTCKeyParams::get_ec() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCECCurve {}; + return UseEnum::toWrapper(native_->ec_curve()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCKeyType wrapper::impl::org::webRtc::RTCKeyParams::get_type() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCKeyType{}; + return UseEnum::toWrapper(native_->type()); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::createDefault() +{ + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = make_shared(); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto wrapper = make_shared(); + wrapper->thisWeak_ = wrapper; + wrapper->native_ = make_shared(native); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCKeyParams.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCKeyParams.h new file mode 100644 index 00000000..459e3a0d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCKeyParams.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCKeyParams.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCKeyParams : public wrapper::org::webRtc::RTCKeyParams + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCKeyParams, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCKeyParams, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::rtc::KeyParams, NativeType); + + NativeTypePtr native_; + RTCKeyParamsWeakPtr thisWeak_; + + RTCKeyParams() noexcept; + virtual ~RTCKeyParams() noexcept; + + + // methods RTCKeyParams + void wrapper_init_org_webRtc_RTCKeyParams() noexcept override; + void wrapper_init_org_webRtc_RTCKeyParams(wrapper::org::webRtc::RTCKeyType key_type) noexcept override; + + // properties RTCKeyParams + bool get_valid() noexcept override; + wrapper::org::webRtc::RTCRSAParamsPtr get_rsa() noexcept override; + wrapper::org::webRtc::RTCECCurve get_ec() noexcept override; + wrapper::org::webRtc::RTCKeyType get_type() noexcept override; + + static WrapperImplTypePtr createDefault(); + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaHandlerStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaHandlerStats.cpp new file mode 100644 index 00000000..1f3023b9 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaHandlerStats.cpp @@ -0,0 +1,109 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCMediaHandlerStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCMediaHandlerStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCMediaHandlerStats::RTCMediaHandlerStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCMediaHandlerStatsPtr wrapper::org::webRtc::RTCMediaHandlerStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCMediaHandlerStats::~RTCMediaHandlerStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCMediaHandlerStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaHandlerStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaHandlerStats.h new file mode 100644 index 00000000..6087ec28 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaHandlerStats.h @@ -0,0 +1,42 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCMediaHandlerStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCMediaHandlerStats : public wrapper::org::webRtc::RTCMediaHandlerStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCMediaHandlerStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCMediaHandlerStats, WrapperImplType); + RTCMediaHandlerStatsWeakPtr thisWeak_; + + RTCMediaHandlerStats() noexcept; + virtual ~RTCMediaHandlerStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaStreamStats.cpp new file mode 100644 index 00000000..edb0ca8e --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaStreamStats.cpp @@ -0,0 +1,88 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCMediaStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCMediaStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCMediaStreamStats::RTCMediaStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCMediaStreamStatsPtr wrapper::org::webRtc::RTCMediaStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCMediaStreamStats::~RTCMediaStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCMediaStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCMediaStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCMediaStreamStats::get_streamIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< String > > wrapper::impl::org::webRtc::RTCMediaStreamStats::get_trackIds() noexcept +{ + shared_ptr< list< String > > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaStreamStats.h new file mode 100644 index 00000000..3a4e9719 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCMediaStreamStats.h @@ -0,0 +1,39 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCMediaStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCMediaStreamStats : public wrapper::org::webRtc::RTCMediaStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCMediaStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCMediaStreamStats, WrapperImplType); + RTCMediaStreamStatsWeakPtr thisWeak_; + + RTCMediaStreamStats() noexcept; + virtual ~RTCMediaStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaStreamStats + String get_streamIdentifier() noexcept override; + shared_ptr< list< String > > get_trackIds() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOAuthCredential.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCOAuthCredential.cpp new file mode 100644 index 00000000..ee13dc52 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOAuthCredential.cpp @@ -0,0 +1,107 @@ + +#include "impl_org_webRtc_RTCOAuthCredential.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOAuthCredential::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +//ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOAuthCredential::RTCOAuthCredential() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCOAuthCredentialPtr wrapper::org::webRtc::RTCOAuthCredential::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOAuthCredential::~RTCOAuthCredential() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCOAuthCredential::wrapper_init_org_webRtc_RTCOAuthCredential() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCOAuthCredential::wrapper_init_org_webRtc_RTCOAuthCredential(wrapper::org::webRtc::RTCOAuthCredentialPtr source) noexcept +{ + if (!source) { + wrapper_init_org_webRtc_RTCOAuthCredential(); + return; + } + macKey = source->macKey; + accessToken = source->accessToken; +} + +#if 0 +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.macKey = from.first; + to.accessToken = from.second; +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.first = from.macKey; + to.second = from.accessToken; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + +#endif //0 diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOAuthCredential.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCOAuthCredential.h new file mode 100644 index 00000000..17082262 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOAuthCredential.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCOAuthCredential.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCOAuthCredential : public wrapper::org::webRtc::RTCOAuthCredential + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCOAuthCredential, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOAuthCredential, WrapperImplType); + //ZS_DECLARE_TYPEDEF_PTR(SomeType, NativeType); + + RTCOAuthCredentialWeakPtr thisWeak_; + + RTCOAuthCredential() noexcept; + virtual ~RTCOAuthCredential() noexcept; + + + // methods RTCOAuthCredential + void wrapper_init_org_webRtc_RTCOAuthCredential() noexcept override; + void wrapper_init_org_webRtc_RTCOAuthCredential(wrapper::org::webRtc::RTCOAuthCredentialPtr source) noexcept override; + + //ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + //ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + //ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferAnswerOptions.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferAnswerOptions.cpp new file mode 100644 index 00000000..50cc86a3 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferAnswerOptions.cpp @@ -0,0 +1,42 @@ + +#include "impl_org_webRtc_RTCOfferAnswerOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferAnswerOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOfferAnswerOptions::~RTCOfferAnswerOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const NativeType &from, WrapperType &to) noexcept +{ + to.voiceActivityDetection = from.voice_activity_detection; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const WrapperType &from, NativeType &to) noexcept +{ + to.voice_activity_detection = from.voiceActivityDetection; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferAnswerOptions.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferAnswerOptions.h new file mode 100644 index 00000000..79b50f67 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferAnswerOptions.h @@ -0,0 +1,34 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCOfferAnswerOptions.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCOfferAnswerOptions : public wrapper::org::webRtc::RTCOfferAnswerOptions + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCOfferAnswerOptions, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferAnswerOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface::RTCOfferAnswerOptions, NativeType); + + RTCOfferAnswerOptions() noexcept = delete; + RTCOfferAnswerOptions(const RTCOfferAnswerOptions &) noexcept = delete; + virtual ~RTCOfferAnswerOptions() noexcept; + + static void apply(const NativeType &from, WrapperType &to) noexcept; + static void apply(const WrapperType &from, NativeType &to) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferOptions.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferOptions.cpp new file mode 100644 index 00000000..6ab3a2f2 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferOptions.cpp @@ -0,0 +1,115 @@ + +#include "impl_org_webRtc_RTCOfferOptions.h" +#include "impl_org_webRtc_RTCOfferAnswerOptions.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferOptions::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferAnswerOptions, UseOfferAnswerOptions); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOfferOptions::RTCOfferOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCOfferOptionsPtr wrapper::org::webRtc::RTCOfferOptions::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOfferOptions::~RTCOfferOptions() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCOfferOptions::wrapper_init_org_webRtc_RTCOfferOptions() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCOfferOptions::wrapper_init_org_webRtc_RTCOfferOptions(wrapper::org::webRtc::RTCOfferOptionsPtr source) noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + UseOfferAnswerOptions::apply(from, to); + + to.iceRestart = from.ice_restart; + if (NativeType::kUndefined != from.offer_to_receive_video) { + to.offerToReceiveVideo = (0 == from.offer_to_receive_video ? false : true); + } + if (NativeType::kUndefined != from.offer_to_receive_audio) { + to.offerToReceiveAudio = (0 == from.offer_to_receive_audio ? false : true); + } + to.useRtpMux = from.use_rtp_mux; +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + UseOfferAnswerOptions::apply(from, to); + + to.ice_restart = from.iceRestart; + if (from.offerToReceiveVideo.has_value()) { + to.offer_to_receive_video = (from.offerToReceiveVideo.value() ? 1 : 0); + } + if (from.offerToReceiveAudio.hasValue()) { + to.offer_to_receive_audio = (from.offerToReceiveAudio.value() ? 1 : 0); + } + to.use_rtp_mux = from.useRtpMux; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferOptions.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferOptions.h new file mode 100644 index 00000000..663c8577 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOfferOptions.h @@ -0,0 +1,42 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCOfferOptions.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCOfferOptions : public wrapper::org::webRtc::RTCOfferOptions + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCOfferOptions, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferOptions, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface::RTCOfferAnswerOptions, NativeType); + + RTCOfferOptionsWeakPtr thisWeak_; + + RTCOfferOptions() noexcept; + virtual ~RTCOfferOptions() noexcept; + + + // methods RTCOfferOptions + void wrapper_init_org_webRtc_RTCOfferOptions() noexcept override; + void wrapper_init_org_webRtc_RTCOfferOptions(wrapper::org::webRtc::RTCOfferOptionsPtr source) noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOutboundRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCOutboundRtpStreamStats.cpp new file mode 100644 index 00000000..8f4cffb7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOutboundRtpStreamStats.cpp @@ -0,0 +1,249 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCOutboundRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::RTCOutboundRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCOutboundRtpStreamStatsPtr wrapper::org::webRtc::RTCOutboundRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::~RTCOutboundRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_packetsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_packetsDiscardedOnSend() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_fecPacketsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_bytesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_bytesDiscardedOnSend() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_trackId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_senderId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_remoteId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_lastPacketSentTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_targetBitrate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< unsigned long > wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_framesEncoded() noexcept +{ + Optional< unsigned long > result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_totalEncodeTime() noexcept +{ + ::zsLib::Milliseconds result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_averageRtcpInterval() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCQualityLimitationReason > wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_qualityLimitationReason() noexcept +{ + Optional< wrapper::org::webRtc::RTCQualityLimitationReason > result {}; + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< map< wrapper::org::webRtc::RTCQualityLimitationReason, ::zsLib::Milliseconds > > wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_qualityLimitationDurations() noexcept +{ + shared_ptr< map< wrapper::org::webRtc::RTCQualityLimitationReason, ::zsLib::Milliseconds > > result {}; + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< map< String, unsigned long > > wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats::get_perDscpPacketsSent() noexcept +{ + shared_ptr< map< String, unsigned long > > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCOutboundRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCOutboundRtpStreamStats.h new file mode 100644 index 00000000..c7c5c7b5 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCOutboundRtpStreamStats.h @@ -0,0 +1,66 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCOutboundRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCOutboundRtpStreamStats : public wrapper::org::webRtc::RTCOutboundRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCOutboundRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOutboundRtpStreamStats, WrapperImplType); + RTCOutboundRtpStreamStatsWeakPtr thisWeak_; + + RTCOutboundRtpStreamStats() noexcept; + virtual ~RTCOutboundRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + + // properties RTCSentRtpStreamStats + unsigned long get_packetsSent() noexcept override; + unsigned long get_packetsDiscardedOnSend() noexcept override; + unsigned long get_fecPacketsSent() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesDiscardedOnSend() noexcept override; + + // properties RTCOutboundRtpStreamStats + String get_trackId() noexcept override; + String get_senderId() noexcept override; + String get_remoteId() noexcept override; + ::zsLib::Time get_lastPacketSentTimestamp() noexcept override; + double get_targetBitrate() noexcept override; + Optional< unsigned long > get_framesEncoded() noexcept override; + ::zsLib::Milliseconds get_totalEncodeTime() noexcept override; + double get_averageRtcpInterval() noexcept override; + Optional< wrapper::org::webRtc::RTCQualityLimitationReason > get_qualityLimitationReason() noexcept override; + shared_ptr< map< wrapper::org::webRtc::RTCQualityLimitationReason, ::zsLib::Milliseconds > > get_qualityLimitationDurations() noexcept override; + shared_ptr< map< String, unsigned long > > get_perDscpPacketsSent() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnection.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnection.cpp new file mode 100644 index 00000000..63dd0cf8 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnection.cpp @@ -0,0 +1,880 @@ + +#include "impl_org_webRtc_RTCPeerConnection.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCConfiguration.h" +#include "impl_org_webRtc_RTCCertificate.h" +#include "impl_org_webRtc_RTCOfferOptions.h" +#include "impl_org_webRtc_RTCAnswerOptions.h" +#include "impl_org_webRtc_RTCSessionDescription.h" +#include "impl_org_webRtc_RTCDataChannelEvent.h" +#include "impl_org_webRtc_RTCDataChannel.h" +#include "impl_org_webRtc_RTCDataChannelInit.h" +#include "impl_org_webRtc_RTCIceCandidate.h" +#include "impl_org_webRtc_RTCPeerConnectionIceEvent.h" +#include "impl_org_webRtc_RTCTrackEvent.h" +#include "impl_org_webRtc_MediaStreamTrack.h" +#include "impl_org_webRtc_MediaConstraints.h" +#include "impl_org_webRtc_RTCRtpSender.h" +#include "impl_org_webRtc_RTCRtpReceiver.h" +#include "impl_org_webRtc_RTCRtpTransceiver.h" +#include "impl_org_webRtc_RTCRtpTransceiverInit.h" +#include "impl_org_webRtc_RTCSessionDescription.h" +#include "impl_org_webRtc_RTCError.h" +#include "impl_org_webRtc_RTCBitrateParameters.h" +#include "impl_org_webRtc_RTCKeyParams.h" +#include "impl_org_webRtc_WebrtcLib.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectionproxy.h" +#include "api/rtcerror.h" +#include "pc/peerconnection.h" +#include "rtc_base/refcountedobject.h" +#include "rtc_base/rtccertificategenerator.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnection::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef wrapper::impl::org::webRtc::RTCPeerConnection::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCConfiguration, UseConfiguration); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCCertificate, UseCertificate); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError, UseError); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCOfferOptions, UseOfferOptions); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCAnswerOptions, UseAnswerOptions); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescription, UseSessionDescription); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannel, UseDataChannel); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelInit, UseDataChannelInit); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDataChannelEvent, UseDataChannelEvent); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidate, UseIceCandidate); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent, UseIceCandidateEvent); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSender, UseRtpSender); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiver, UseRtpReceiver); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiver, UseRtpTransceiver); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiverInit, UseRtpTransceiverInit); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCTrackEvent, UseTrackEvent); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaStreamTrack, UseMediaStreamTrack); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaConstraints, UseMediaConstraints); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCBitrateParameters, UseBitrateParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCKeyParams, UseKeyParams); + + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static ::webrtc::PeerConnectionInterface *unproxyNative(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::PeerConnection, ::webrtc::PeerConnection, native); +} + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + namespace peer_connection { + typedef PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > SessionDescriptionPromiseType; + ZS_DECLARE_PTR(SessionDescriptionPromiseType); + + class SessionDescriptionObserver : public ::rtc::RefCountedObject<::webrtc::CreateSessionDescriptionObserver> { + public: + typedef rtc::scoped_refptr ObserverScopedPtr; + + void OnSuccess(::webrtc::SessionDescriptionInterface* desc) override + { + auto wrapper = UseSessionDescription::toWrapper(desc); + promise_->resolve(wrapper); + } + + void OnFailure(const std::string& error) override + { + UseError::rejectPromise(promise_, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER, error.c_str())); + } + + static ObserverScopedPtr create(SessionDescriptionPromiseTypePtr promise) noexcept { + ObserverScopedPtr result(new SessionDescriptionObserver()); + result->promise_ = promise; + return result; + } + + SessionDescriptionPromiseTypePtr promise_; + }; + } // namespace peer_connection + } // namespace webRtc + } // namespace org + } // namespace impl +} // namespace wrapper + +using namespace wrapper::impl::org::webRtc::peer_connection; + + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnection::RTCPeerConnection() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPeerConnectionPtr wrapper::org::webRtc::RTCPeerConnection::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnection::~RTCPeerConnection() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::wrapper_dispose() noexcept +{ + if (!native_) return; + + if (!closeCalled_.exchange(true)) { + native_->Close(); + } + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::getStats(wrapper::org::webRtc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > result {}; + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCCertificatePtr > > wrapper::org::webRtc::RTCPeerConnection::generateCertificate(wrapper::org::webRtc::RTCKeyParamsPtr keygenAlgorithm) noexcept +{ + typedef PromiseWithHolderPtr< wrapper::org::webRtc::RTCCertificatePtr > CertificatePromiseType; + ZS_DECLARE_PTR(CertificatePromiseType); + + class Observer : public ::rtc::RefCountedObject<::rtc::RTCCertificateGeneratorCallback> { + public: + typedef rtc::scoped_refptr ObserverScopedPtr; + typedef rtc::scoped_refptr<::rtc::RTCCertificate> CertificateScopedPtr; + + void OnSuccess(const CertificateScopedPtr& certificate) override + { + auto wrapper = UseCertificate::toWrapper(certificate); + promise_->resolve(wrapper); + } + + void OnFailure() + { + UseError::rejectPromise(promise_, ::webrtc::RTCError(::webrtc::RTCErrorType::UNSUPPORTED_PARAMETER)); + } + + static ObserverScopedPtr create( + CertificatePromiseTypePtr promise, + const std::shared_ptr &gen + ) noexcept + { + ObserverScopedPtr result(new Observer()); + result->promise_ = promise; + result->gen_ = std::move(gen); + return result; + } + + CertificatePromiseTypePtr promise_; + std::shared_ptr gen_; + }; + + + auto result = CertificatePromiseType::create(UseWebrtcLib::delegateQueue()); + + auto realFactory = UseWebrtcLib::realPeerConnectionFactory(); + ZS_ASSERT(realFactory); + if (!realFactory) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return result; + } + + auto nativeValue = UseKeyParams::toNative(keygenAlgorithm); + if (!nativeValue) nativeValue = UseKeyParams::toNative(UseKeyParams::createDefault()); + ZS_ASSERT(nativeValue); + if (!nativeValue) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return result; + } + + auto gen = std::make_shared(realFactory->signaling_thread(), realFactory->network_thread()); + + auto observer = Observer::create(result, std::move(gen)); + + gen->GenerateCertificateAsync(*nativeValue, ::rtc::Optional(), observer); + + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::wrapper_init_org_webRtc_RTCPeerConnection(wrapper::org::webRtc::RTCConfigurationPtr config) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + if (!factory) return; + + ZS_ASSERT(config); + + setupObserver(); + ZS_ASSERT(observer_); + + auto nativeConfig = UseConfiguration::toNative(config); + + native_ = factory->CreatePeerConnection(*nativeConfig, nullptr, nullptr, observer_.get()); + ZS_ASSERT(native_); +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::createOffer(wrapper::org::webRtc::RTCOfferOptionsPtr options) noexcept +{ + auto result = SessionDescriptionPromiseType::create(UseWebrtcLib::delegateQueue()); + + ZS_ASSERT(native_); + if (!native_) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return result; + } + + auto nativeOptions = UseOfferOptions::toNative(options); + if (!nativeOptions) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + return result; + } + + native_->CreateOffer(SessionDescriptionObserver::create(result), *nativeOptions); + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::createOffer(wrapper::org::webRtc::MediaConstraintsPtr constraints) noexcept +{ + auto result = SessionDescriptionPromiseType::create(UseWebrtcLib::delegateQueue()); + + ZS_ASSERT(native_); + if (!native_) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return result; + } + + auto nativeConstraints = UseMediaConstraints::toNative(constraints); + if (!nativeConstraints) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + return result; + } + + native_->CreateOffer(SessionDescriptionObserver::create(result), nativeConstraints.get()); + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::createAnswer(wrapper::org::webRtc::RTCAnswerOptionsPtr options) noexcept +{ + auto result = SessionDescriptionPromiseType::create(UseWebrtcLib::delegateQueue()); + + ZS_ASSERT(native_); + if (!native_) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return result; + } + + auto nativeOptions = UseAnswerOptions::toNative(options); + if (!nativeOptions) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + return result; + } + + native_->CreateAnswer(SessionDescriptionObserver::create(result), *nativeOptions); + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::createAnswer(wrapper::org::webRtc::MediaConstraintsPtr constraints) noexcept +{ + auto result = SessionDescriptionPromiseType::create(UseWebrtcLib::delegateQueue()); + + ZS_ASSERT(native_); + if (!native_) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return result; + } + + auto nativeConstraints = UseMediaConstraints::toNative(constraints); + if (!nativeConstraints) { + UseError::rejectPromise(result, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + return result; + } + + native_->CreateAnswer(SessionDescriptionObserver::create(result), nativeConstraints.get()); + return result; +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::webRtc::RTCPeerConnection::setLocalDescription(wrapper::org::webRtc::RTCSessionDescriptionPtr description) noexcept +{ + class Observer : public ::rtc::RefCountedObject<::webrtc::SetSessionDescriptionObserver> { + public: + typedef rtc::scoped_refptr ObserverScopedPtr; + + void OnSuccess() override + { + promise_->resolve(); + } + + void OnFailure(const std::string& error) override + { + UseError::rejectPromise(promise_, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER, error.c_str())); + } + + static ObserverScopedPtr create(PromisePtr promise) noexcept { + ObserverScopedPtr result(new Observer()); + result->promise_ = promise; + return result; + } + + PromisePtr promise_; + }; + + ZS_ASSERT(native_); + if (!native_) return UseError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + + auto nativeDescription = UseSessionDescription::toNative(description); + if (!nativeDescription) return UseError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + + auto promise = Promise::create(UseWebrtcLib::delegateQueue()); + native_->SetLocalDescription(Observer::create(promise), nativeDescription.release()); + return promise; +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::webRtc::RTCPeerConnection::setRemoteDescription(wrapper::org::webRtc::RTCSessionDescriptionPtr description) noexcept +{ + class Observer : public ::rtc::RefCountedObject<::webrtc::SetRemoteDescriptionObserverInterface> { + public: + typedef rtc::scoped_refptr ObserverScopedPtr; + + void OnSetRemoteDescriptionComplete(::webrtc::RTCError error) override + { + if (error.ok()) { + promise_->resolve(); + return; + } + UseError::rejectPromise(promise_, error); + } + + static ObserverScopedPtr create(PromisePtr promise) noexcept { + ObserverScopedPtr result(new Observer()); + result->promise_ = promise; + return result; + } + + PromisePtr promise_; + }; + + ZS_ASSERT(native_); + if (!native_) return UseError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + + auto nativeDescription = UseSessionDescription::toNative(description); + if (!nativeDescription) return UseError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + + auto promise = Promise::create(UseWebrtcLib::delegateQueue()); + native_->SetRemoteDescription(std::move(nativeDescription), Observer::create(promise)); + return promise; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCConfigurationPtr wrapper::impl::org::webRtc::RTCPeerConnection::getConfiguration() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseConfigurationPtr(); + + auto nativeResult = native_->GetConfiguration(); + return UseConfiguration::toWrapper(nativeResult); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::setConfiguration(wrapper::org::webRtc::RTCConfigurationPtr config) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return; + + auto nativeConfig = UseConfiguration::toNative(config); + ZS_ASSERT(nativeConfig); + if (!nativeConfig) return; + + ::webrtc::RTCError error; + if (!native_->SetConfiguration(*nativeConfig, &error)) throw UseError::toWrapper(error); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::webRtc::RTCPeerConnection::addIceCandidate(wrapper::org::webRtc::RTCIceCandidatePtr candidate) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return zsLib::Promise::createRejected(UseWebrtcLib::delegateQueue()); + + auto nativeCandidate = UseIceCandidate::toNative(candidate); + if (!nativeCandidate) return zsLib::Promise::createRejected(UseWebrtcLib::delegateQueue()); + + auto result = native_->AddIceCandidate(nativeCandidate.get()); + if (!result) return zsLib::Promise::createRejected(UseWebrtcLib::delegateQueue()); + return zsLib::Promise::createResolved(UseWebrtcLib::delegateQueue()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::removeIceCandidates(shared_ptr< list< wrapper::org::webRtc::RTCIceCandidatePtr > > candidates) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + + if (!candidates) return; + + std::vector nativeCandidates; + + for (auto iter = candidates->begin(); iter != candidates->end(); ++iter) { + auto native = UseIceCandidate::toNative(*iter); + if (!native) continue; + nativeCandidates.push_back(native->candidate()); + } + + native_->RemoveIceCandidates(nativeCandidates); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::setBitrate(wrapper::org::webRtc::RTCBitrateParametersPtr params) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return; + auto nativeParams = UseBitrateParameters::toNative(params); + + auto result = native_->SetBitrate(*nativeParams); + if (!result.ok()) throw UseError::toWrapper(result); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::close() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + closeCalled_ = true; + native_->Close(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSenderPtr wrapper::impl::org::webRtc::RTCPeerConnection::addTrack(wrapper::org::webRtc::MediaStreamTrackPtr track) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCRtpSenderPtr(); + + auto nativeTrack = UseMediaStreamTrack::toNative(track); + if (!nativeTrack) return wrapper::org::webRtc::RTCRtpSenderPtr(); + + std::vector<::webrtc::MediaStreamInterface*> ignored; + return UseRtpSender::toWrapper(native_->AddTrack(nativeTrack, ignored)); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCPeerConnection::removeTrack(wrapper::org::webRtc::RTCRtpSenderPtr sender) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + + auto nativeSender = UseRtpSender::toNative(sender); + if (!nativeSender) return false; + + return native_->RemoveTrack(nativeSender); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverPtr wrapper::impl::org::webRtc::RTCPeerConnection::addTransceiver(wrapper::org::webRtc::MediaStreamTrackPtr track) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return UseRtpTransceiverPtr(); + + auto nativeTrack = UseMediaStreamTrack::toNative(track); + if (!nativeTrack) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INVALID_PARAMETER); + throw UseError::toWrapper(error); + } + + auto result = native_->AddTransceiver(nativeTrack); + if (!result.ok()) throw UseError::toWrapper(result.error()); + return UseRtpTransceiver::toWrapper(result.value()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverPtr wrapper::impl::org::webRtc::RTCPeerConnection::addTransceiver( + wrapper::org::webRtc::MediaStreamTrackPtr track, + wrapper::org::webRtc::RTCRtpTransceiverInitPtr init + ) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return UseRtpTransceiverPtr(); + + auto nativeTrack = UseMediaStreamTrack::toNative(track); + auto nativeInit = UseRtpTransceiverInit::toNative(init); + if ((!nativeTrack) || + (!nativeInit)) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INVALID_PARAMETER); + throw UseError::toWrapper(error); + } + + auto result = native_->AddTransceiver(nativeTrack, *nativeInit); + if (!result.ok()) throw UseError::toWrapper(result.error()); + return UseRtpTransceiver::toWrapper(result.value()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverPtr wrapper::impl::org::webRtc::RTCPeerConnection::addTransceiver(String kind) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return UseRtpTransceiverPtr(); + + ::cricket::MediaType type {}; + try { + type = UseEnum::toNativeMediaType(kind); + } catch (const ::zsLib::Exceptions::InvalidArgument &) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INVALID_PARAMETER); + throw UseError::toWrapper(error); + } + + auto result = native_->AddTransceiver(type); + if (!result.ok()) throw UseError::toWrapper(result.error()); + return UseRtpTransceiver::toWrapper(result.value()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSenderPtr wrapper::impl::org::webRtc::RTCPeerConnection::addSender( + String kind, + String trackId + ) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseRtpSenderPtr(); + + return UseRtpSender::toWrapper(native_->CreateSender(kind, trackId)); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::RTCRtpSenderPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::getSenders() noexcept +{ + auto result = make_shared< list< wrapper::org::webRtc::RTCRtpSenderPtr > >(); + ZS_ASSERT(native_); + if (!native_) return result; + + auto values = native_->GetSenders(); + for (auto iter = values.begin(); iter != values.end(); ++iter) { + auto wrapper = UseRtpSender::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::RTCRtpReceiverPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::getReceivers() noexcept +{ + auto result = make_shared< list< wrapper::org::webRtc::RTCRtpReceiverPtr > >(); + ZS_ASSERT(native_); + if (!native_) return result; + + auto values = native_->GetReceivers(); + for (auto iter = values.begin(); iter != values.end(); ++iter) { + auto wrapper = UseRtpReceiver::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::RTCRtpTransceiverPtr > > wrapper::impl::org::webRtc::RTCPeerConnection::getTransceivers() noexcept +{ + auto result = make_shared< list< wrapper::org::webRtc::RTCRtpTransceiverPtr > >(); + ZS_ASSERT(native_); + if (!native_) return result; + + auto values = native_->GetTransceivers(); + for (auto iter = values.begin(); iter != values.end(); ++iter) { + auto wrapper = UseRtpTransceiver::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDataChannelPtr wrapper::impl::org::webRtc::RTCPeerConnection::createDataChannel( + String label, + wrapper::org::webRtc::RTCDataChannelInitPtr init + ) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCDataChannelPtr(); + + auto nativeInit = UseDataChannelInit::toNative(init); + if (!nativeInit) return wrapper::org::webRtc::RTCDataChannelPtr(); + + return UseDataChannel::toWrapper(native_->CreateDataChannel(label, nativeInit.get())); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSignalingState wrapper::impl::org::webRtc::RTCPeerConnection::get_signalingState() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_closed; + return UseEnum::toWrapper(native_->signaling_state()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceGatheringState wrapper::impl::org::webRtc::RTCPeerConnection::get_iceGatheringState() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_complete; + return UseEnum::toWrapper(native_->ice_gathering_state()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceConnectionState wrapper::impl::org::webRtc::RTCPeerConnection::get_iceConnectionState() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_closed; + return UseEnum::toWrapper(native_->ice_connection_state()); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCPeerConnectionState > wrapper::impl::org::webRtc::RTCPeerConnection::get_connectionState_NotAvailable() noexcept +{ +#pragma ZS_BUILD_NOTE("LATER","Does not appear to be any way to ask peer connection for connection state") + Optional< wrapper::org::webRtc::RTCPeerConnectionState > result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCPeerConnection::get_canTrickleIceCandidates_NotAvailable() noexcept +{ +#pragma ZS_BUILD_NOTE("LATER","Does not appear to be any way to check if peer connection is allowed to trickle or not") + return Optional< bool >(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::impl::org::webRtc::RTCPeerConnection::get_localDescription() noexcept +{ + auto result = get_pendingLocalDescription(); + if (result) return result; + return get_currentLocalDescription(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::impl::org::webRtc::RTCPeerConnection::get_currentLocalDescription() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseSessionDescriptionPtr(); + return UseSessionDescription::toWrapper(native_->current_local_description()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::impl::org::webRtc::RTCPeerConnection::get_pendingLocalDescription() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseSessionDescriptionPtr(); + return UseSessionDescription::toWrapper(native_->pending_local_description()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::impl::org::webRtc::RTCPeerConnection::get_remoteDescription() noexcept +{ + auto result = get_pendingRemoteDescription(); + if (result) return result; + return get_currentRemoteDescription(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::impl::org::webRtc::RTCPeerConnection::get_currentRemoteDescription() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseSessionDescriptionPtr(); + return UseSessionDescription::toWrapper(native_->current_remote_description()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::impl::org::webRtc::RTCPeerConnection::get_pendingRemoteDescription() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseSessionDescriptionPtr(); + return UseSessionDescription::toWrapper(native_->pending_remote_description()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCPeerConnection::wrapper_onObserverCountChanged(ZS_MAYBE_USED() size_t count) noexcept +{ + ZS_MAYBE_USED(count); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverSignalingChange(ZS_MAYBE_USED() NativeType::SignalingState new_state) noexcept +{ + ZS_MAYBE_USED(new_state); + onSignalingStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverDataChannel(rtc::scoped_refptr<::webrtc::DataChannelInterface> data_channel) noexcept +{ + auto event = RTCDataChannelEvent::toWrapper(UseDataChannel::toWrapper(data_channel)); + if (!event) return; + onDataChannel(event); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverRenegotiationNeeded() noexcept +{ + onNegotiationNeeded(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverIceConnectionChange(ZS_MAYBE_USED() NativeType::PeerConnectionInterface::IceConnectionState new_state) noexcept +{ + ZS_MAYBE_USED(new_state); + onIceConnectionStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverIceGatheringChange(ZS_MAYBE_USED() NativeType::PeerConnectionInterface::IceGatheringState new_state) noexcept +{ + ZS_MAYBE_USED(new_state); + onIceGatheringStateChange(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverIceCandidate(UseIceCandidatePtr candidate) noexcept +{ + auto event = UseIceCandidateEvent::toWrapper(candidate); + if (!event) return; + onIceCandidate(event); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverIceCandidatesRemoved(shared_ptr< list< UseIceCandidatePtr > > candidates) noexcept +{ + if (!candidates) return; + for (auto iter = candidates->begin(); iter != candidates->end(); ++iter) { + auto &candidate = (*iter); + auto event = UseIceCandidateEvent::toWrapper(candidate); + if (!event) continue; + onIceCandidateRemoved(event); + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverIceConnectionReceivingChange(ZS_MAYBE_USED() bool receiving) noexcept +{ + ZS_MAYBE_USED(receiving); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverAddTrack(rtc::scoped_refptr<::webrtc::RtpReceiverInterface> receiver) noexcept +{ + auto event = UseTrackEvent::toWrapper(UseRtpReceiver::toWrapper(receiver)); + if (!event) return; + onTrack(event); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverTrack(rtc::scoped_refptr<::webrtc::RtpTransceiverInterface> transceiver) noexcept +{ + auto event = UseTrackEvent::toWrapper(UseRtpTransceiver::toWrapper(transceiver)); + if (!event) return; + onTrack(event); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::onWebrtcObserverRemoveTrack(rtc::scoped_refptr<::webrtc::RtpReceiverInterface> receiver) noexcept +{ + auto event = UseTrackEvent::toWrapper(UseRtpReceiver::toWrapper(receiver)); + if (!event) return; + onRemoveTrack(event); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + if (!observer_) return; + if (!native_) return; + +#pragma ZS_BUILD_NOTE("LATER","no apparent way to remove obvserver from peer connection object") +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + NativeType *original = unproxyNative(native); + if (!original) return WrapperImplTypePtr(); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnection.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnection.h new file mode 100644 index 00000000..5e25b1dc --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnection.h @@ -0,0 +1,217 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCPeerConnection.h" +#include "impl_org_webRtc_RTCIceCandidate.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "api/peerconnectioninterface.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCPeerConnection : public wrapper::org::webRtc::RTCPeerConnection + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCPeerConnection, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnection, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidate, UseIceCandidate); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescription, UseSessionDescription); + + ZS_DECLARE_STRUCT_PTR(WebrtcObserver); + + struct WebrtcObserver : public ::webrtc::PeerConnectionObserver + { + WebrtcObserver( + WrapperImplTypePtr wrapper, + IMessageQueuePtr queue + ) noexcept : outer_(wrapper), queue_(queue) {} + + void OnSignalingChange(NativeType::SignalingState new_state) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, new_state]() { outer->onWebrtcObserverSignalingChange(new_state); }); + } + + // deprecated + //virtual void OnAddStream(rtc::scoped_refptr<::webrtc::MediaStreamInterface> stream) {} + //virtual void OnRemoveStream(rtc::scoped_refptr<::webrtc::MediaStreamInterface> stream) {} + + void OnDataChannel(rtc::scoped_refptr<::webrtc::DataChannelInterface> data_channel) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, data_channel]() {outer->onWebrtcObserverDataChannel(data_channel); }); + } + + void OnRenegotiationNeeded() override + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer]() { outer->onWebrtcObserverRenegotiationNeeded(); }); + } + + void OnIceConnectionChange(NativeType::PeerConnectionInterface::IceConnectionState new_state) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, new_state]() { outer->onWebrtcObserverIceConnectionChange(new_state); }); + } + + void OnIceGatheringChange(NativeType::PeerConnectionInterface::IceGatheringState new_state) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, new_state]() { outer->onWebrtcObserverIceGatheringChange(new_state); }); + } + + void OnIceCandidate(const ::webrtc::IceCandidateInterface* candidate) final + { + auto outer = outer_.lock(); + if (!outer) return; + auto temp = UseIceCandidate::toWrapper(candidate); + queue_->postClosure([outer, temp]() { outer->onWebrtcObserverIceCandidate(temp); }); + } + + void OnIceCandidatesRemoved(const std::vector& candidates) final + { + auto outer = outer_.lock(); + if (!outer) return; + auto temp = UseIceCandidate::toWrapper(candidates); + queue_->postClosure([outer, temp]() { outer->onWebrtcObserverIceCandidatesRemoved(temp); }); + } + + void OnIceConnectionReceivingChange(bool receiving) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, receiving]() { outer->onWebrtcObserverIceConnectionReceivingChange(receiving); }); + } + + void OnAddTrack( + rtc::scoped_refptr<::webrtc::RtpReceiverInterface> receiver, + ZS_MAYBE_USED() const std::vector>& streams + ) final + { + ZS_MAYBE_USED(streams); + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, receiver]() { outer->onWebrtcObserverAddTrack(receiver); }); + } + + void OnTrack(rtc::scoped_refptr<::webrtc::RtpTransceiverInterface> transceiver) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, transceiver]() { outer->onWebrtcObserverTrack(transceiver); }); + } + + void OnRemoveTrack(rtc::scoped_refptr<::webrtc::RtpReceiverInterface> receiver) final + { + auto outer = outer_.lock(); + if (!outer) return; + queue_->postClosure([outer, receiver]() { outer->onWebrtcObserverRemoveTrack(receiver); }); + } + + private: + WrapperImplTypeWeakPtr outer_; + IMessageQueuePtr queue_; + }; + + std::atomic_bool closeCalled_{}; + WebrtcObserverUniPtr observer_; + NativeTypeScopedPtr native_; + RTCPeerConnectionWeakPtr thisWeak_; + + RTCPeerConnection() noexcept; + virtual ~RTCPeerConnection() noexcept; + void wrapper_dispose() noexcept override; + + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > getStats(wrapper::org::webRtc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + + // methods RTCPeerConnection + void wrapper_init_org_webRtc_RTCPeerConnection(wrapper::org::webRtc::RTCConfigurationPtr config) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > createOffer(wrapper::org::webRtc::RTCOfferOptionsPtr options) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > createOffer(wrapper::org::webRtc::MediaConstraintsPtr constraints) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > createAnswer(wrapper::org::webRtc::RTCAnswerOptionsPtr options) noexcept override; + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCSessionDescriptionPtr > > createAnswer(wrapper::org::webRtc::MediaConstraintsPtr constraints) noexcept override; + PromisePtr setLocalDescription(wrapper::org::webRtc::RTCSessionDescriptionPtr description) noexcept override; + PromisePtr setRemoteDescription(wrapper::org::webRtc::RTCSessionDescriptionPtr description) noexcept override; + wrapper::org::webRtc::RTCConfigurationPtr getConfiguration() noexcept override; + void setConfiguration(wrapper::org::webRtc::RTCConfigurationPtr config) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + PromisePtr addIceCandidate(wrapper::org::webRtc::RTCIceCandidatePtr candidate) noexcept override; + void removeIceCandidates(shared_ptr< list< wrapper::org::webRtc::RTCIceCandidatePtr > > candidates) noexcept override; + void setBitrate(wrapper::org::webRtc::RTCBitrateParametersPtr params) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + void close() noexcept override; + wrapper::org::webRtc::RTCRtpSenderPtr addTrack(wrapper::org::webRtc::MediaStreamTrackPtr track) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + bool removeTrack(wrapper::org::webRtc::RTCRtpSenderPtr sender) noexcept override; + wrapper::org::webRtc::RTCRtpTransceiverPtr addTransceiver(wrapper::org::webRtc::MediaStreamTrackPtr track) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + wrapper::org::webRtc::RTCRtpTransceiverPtr addTransceiver( + wrapper::org::webRtc::MediaStreamTrackPtr track, + wrapper::org::webRtc::RTCRtpTransceiverInitPtr init + ) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + wrapper::org::webRtc::RTCRtpTransceiverPtr addTransceiver(String kind) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + wrapper::org::webRtc::RTCRtpSenderPtr addSender( + String kind, + String trackId + ) noexcept override; + shared_ptr< list< wrapper::org::webRtc::RTCRtpSenderPtr > > getSenders() noexcept override; + shared_ptr< list< wrapper::org::webRtc::RTCRtpReceiverPtr > > getReceivers() noexcept override; + shared_ptr< list< wrapper::org::webRtc::RTCRtpTransceiverPtr > > getTransceivers() noexcept override; + wrapper::org::webRtc::RTCDataChannelPtr createDataChannel( + String label, + wrapper::org::webRtc::RTCDataChannelInitPtr init + ) noexcept override; + + // properties RTCPeerConnection + wrapper::org::webRtc::RTCSignalingState get_signalingState() noexcept override; + wrapper::org::webRtc::RTCIceGatheringState get_iceGatheringState() noexcept override; + wrapper::org::webRtc::RTCIceConnectionState get_iceConnectionState() noexcept override; + Optional< wrapper::org::webRtc::RTCPeerConnectionState > get_connectionState_NotAvailable() noexcept override; + Optional< bool > get_canTrickleIceCandidates_NotAvailable() noexcept override; + wrapper::org::webRtc::RTCSessionDescriptionPtr get_localDescription() noexcept override; + wrapper::org::webRtc::RTCSessionDescriptionPtr get_currentLocalDescription() noexcept override; + wrapper::org::webRtc::RTCSessionDescriptionPtr get_pendingLocalDescription() noexcept override; + wrapper::org::webRtc::RTCSessionDescriptionPtr get_remoteDescription() noexcept override; + wrapper::org::webRtc::RTCSessionDescriptionPtr get_currentRemoteDescription() noexcept override; + wrapper::org::webRtc::RTCSessionDescriptionPtr get_pendingRemoteDescription() noexcept override; + + virtual void wrapper_onObserverCountChanged(size_t count) noexcept override; + + void onWebrtcObserverSignalingChange(NativeType::SignalingState new_state) noexcept; + void onWebrtcObserverDataChannel(rtc::scoped_refptr<::webrtc::DataChannelInterface> data_channel) noexcept; + void onWebrtcObserverRenegotiationNeeded() noexcept; + void onWebrtcObserverIceConnectionChange(NativeType::PeerConnectionInterface::IceConnectionState new_state) noexcept; + void onWebrtcObserverIceGatheringChange(NativeType::PeerConnectionInterface::IceGatheringState new_state) noexcept; + void onWebrtcObserverIceCandidate(UseIceCandidatePtr candidate) noexcept; + void onWebrtcObserverIceCandidatesRemoved(shared_ptr< list < UseIceCandidatePtr > > candidates) noexcept; + void onWebrtcObserverIceConnectionReceivingChange(bool receiving) noexcept; + void onWebrtcObserverAddTrack(rtc::scoped_refptr<::webrtc::RtpReceiverInterface> receiver) noexcept; + void onWebrtcObserverTrack(rtc::scoped_refptr<::webrtc::RtpTransceiverInterface> transceiver) noexcept; + void onWebrtcObserverRemoveTrack(rtc::scoped_refptr<::webrtc::RtpReceiverInterface> receiver) noexcept; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceErrorEvent.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceErrorEvent.cpp new file mode 100644 index 00000000..40a68139 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceErrorEvent.cpp @@ -0,0 +1,74 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCPeerConnectionIceErrorEvent.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::RTCPeerConnectionIceErrorEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPeerConnectionIceErrorEventPtr wrapper::org::webRtc::RTCPeerConnectionIceErrorEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::~RTCPeerConnectionIceErrorEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::get_hostCandidate() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::get_url() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned short wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::get_errorCode() noexcept +{ + unsigned short result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent::get_errorText() noexcept +{ + String result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceErrorEvent.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceErrorEvent.h new file mode 100644 index 00000000..8980b7d8 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceErrorEvent.h @@ -0,0 +1,35 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCPeerConnectionIceErrorEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCPeerConnectionIceErrorEvent : public wrapper::org::webRtc::RTCPeerConnectionIceErrorEvent + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCPeerConnectionIceErrorEvent, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionIceErrorEvent, WrapperImplType); + RTCPeerConnectionIceErrorEventWeakPtr thisWeak_; + + RTCPeerConnectionIceErrorEvent() noexcept; + virtual ~RTCPeerConnectionIceErrorEvent() noexcept; + + + // properties RTCPeerConnectionIceErrorEvent + String get_hostCandidate() noexcept override; + String get_url() noexcept override; + unsigned short get_errorCode() noexcept override; + String get_errorText() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceEvent.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceEvent.cpp new file mode 100644 index 00000000..4be692c0 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceEvent.cpp @@ -0,0 +1,69 @@ + +#include "impl_org_webRtc_RTCPeerConnectionIceEvent.h" +#include "impl_org_webRtc_RTCIceCandidate.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent::RTCPeerConnectionIceEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPeerConnectionIceEventPtr wrapper::org::webRtc::RTCPeerConnectionIceEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent::~RTCPeerConnectionIceEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCIceCandidatePtr wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent::get_candidate() noexcept +{ + return candidate_; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent::get_url() noexcept +{ + ZS_ASSERT(candidate_); + if (!candidate_) return String(); + return candidate_->serverUrl(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseIceCandidatePtr value) noexcept +{ + if (!value) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + result->candidate_ = value; + return result; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceEvent.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceEvent.h new file mode 100644 index 00000000..87ce9535 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionIceEvent.h @@ -0,0 +1,38 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCPeerConnectionIceEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCPeerConnectionIceEvent : public wrapper::org::webRtc::RTCPeerConnectionIceEvent + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCPeerConnectionIceEvent, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionIceEvent, WrapperImplType); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCIceCandidate, UseIceCandidate); + + UseIceCandidatePtr candidate_; + RTCPeerConnectionIceEventWeakPtr thisWeak_; + + RTCPeerConnectionIceEvent() noexcept; + virtual ~RTCPeerConnectionIceEvent() noexcept; + + + // properties RTCPeerConnectionIceEvent + wrapper::org::webRtc::RTCIceCandidatePtr get_candidate() noexcept override; + String get_url() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseIceCandidatePtr value) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionStats.cpp new file mode 100644 index 00000000..b65ce1ab --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionStats.cpp @@ -0,0 +1,102 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCPeerConnectionStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnectionStats::RTCPeerConnectionStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPeerConnectionStatsPtr wrapper::org::webRtc::RTCPeerConnectionStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCPeerConnectionStats::~RTCPeerConnectionStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_dataChannelsOpened() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_dataChannelsClosed() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_dataChannelsRequested() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCPeerConnectionStats::get_dataChannelsAccepted() noexcept +{ + unsigned long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionStats.h new file mode 100644 index 00000000..e1bfdf29 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCPeerConnectionStats.h @@ -0,0 +1,41 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCPeerConnectionStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCPeerConnectionStats : public wrapper::org::webRtc::RTCPeerConnectionStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCPeerConnectionStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCPeerConnectionStats, WrapperImplType); + RTCPeerConnectionStatsWeakPtr thisWeak_; + + RTCPeerConnectionStats() noexcept; + virtual ~RTCPeerConnectionStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCPeerConnectionStats + unsigned long get_dataChannelsOpened() noexcept override; + unsigned long get_dataChannelsClosed() noexcept override; + unsigned long get_dataChannelsRequested() noexcept override; + unsigned long get_dataChannelsAccepted() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRSAParams.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRSAParams.cpp new file mode 100644 index 00000000..464771bc --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRSAParams.cpp @@ -0,0 +1,102 @@ + +#include "impl_org_webRtc_RTCRSAParams.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/sslidentity.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRSAParams::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRSAParams::RTCRSAParams() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRSAParamsPtr wrapper::org::webRtc::RTCRSAParams::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRSAParams::~RTCRSAParams() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRSAParams::wrapper_init_org_webRtc_RTCRSAParams() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.modSize = SafeInt(from.mod_size); + to.publicExponent = SafeInt(from.pub_exp); +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + if (from.modSize.has_value()) { + to.mod_size = SafeInt(from.modSize.value()); + } + if (from.publicExponent.has_value()) { + to.pub_exp = SafeInt(from.publicExponent.value()); + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + cloned->mod_size = rtc::kRsaDefaultModSize; + cloned->pub_exp = rtc::kRsaDefaultExponent; + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRSAParams.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRSAParams.h new file mode 100644 index 00000000..f6905604 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRSAParams.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRSAParams.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRSAParams : public wrapper::org::webRtc::RTCRSAParams + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRSAParams, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRSAParams, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::rtc::RSAParams, NativeType); + + RTCRSAParamsWeakPtr thisWeak_; + + RTCRSAParams() noexcept; + virtual ~RTCRSAParams() noexcept; + void wrapper_init_org_webRtc_RTCRSAParams() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCReceivedRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCReceivedRtpStreamStats.cpp new file mode 100644 index 00000000..ca1a993a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCReceivedRtpStreamStats.cpp @@ -0,0 +1,228 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCReceivedRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::RTCReceivedRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCReceivedRtpStreamStatsPtr wrapper::org::webRtc::RTCReceivedRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::~RTCReceivedRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_packetsReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_packetsLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_jitter() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_packetsDiscarded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_packetsRepaired() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_burstPacketsLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_burstPacketsDiscarded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_burstLossCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_burstDiscardCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_burstLossRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_burstDiscardRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_gapLossRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats::get_gapDiscardRate() noexcept +{ + double result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCReceivedRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCReceivedRtpStreamStats.h new file mode 100644 index 00000000..a84e6228 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCReceivedRtpStreamStats.h @@ -0,0 +1,61 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCReceivedRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCReceivedRtpStreamStats : public wrapper::org::webRtc::RTCReceivedRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCReceivedRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCReceivedRtpStreamStats, WrapperImplType); + RTCReceivedRtpStreamStatsWeakPtr thisWeak_; + + RTCReceivedRtpStreamStats() noexcept; + virtual ~RTCReceivedRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + + // properties RTCReceivedRtpStreamStats + unsigned long get_packetsReceived() noexcept override; + unsigned long get_packetsLost() noexcept override; + double get_jitter() noexcept override; + unsigned long get_packetsDiscarded() noexcept override; + unsigned long get_packetsRepaired() noexcept override; + unsigned long get_burstPacketsLost() noexcept override; + unsigned long get_burstPacketsDiscarded() noexcept override; + unsigned long get_burstLossCount() noexcept override; + unsigned long get_burstDiscardCount() noexcept override; + double get_burstLossRate() noexcept override; + double get_burstDiscardRate() noexcept override; + double get_gapLossRate() noexcept override; + double get_gapDiscardRate() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteInboundRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteInboundRtpStreamStats.cpp new file mode 100644 index 00000000..858d7587 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteInboundRtpStreamStats.cpp @@ -0,0 +1,249 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCRemoteInboundRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRemoteInboundRtpStreamStatsPtr wrapper::org::webRtc::RTCRemoteInboundRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_packetsReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_packetsLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_jitter() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_packetsDiscarded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_packetsRepaired() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_burstPacketsLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_burstPacketsDiscarded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_burstLossCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_burstDiscardCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_burstLossRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_burstDiscardRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_gapLossRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_gapDiscardRate() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_localId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_roundTripTime() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats::get_fractionLost() noexcept +{ + double result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteInboundRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteInboundRtpStreamStats.h new file mode 100644 index 00000000..19c02d5a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteInboundRtpStreamStats.h @@ -0,0 +1,66 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRemoteInboundRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRemoteInboundRtpStreamStats : public wrapper::org::webRtc::RTCRemoteInboundRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRemoteInboundRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRemoteInboundRtpStreamStats, WrapperImplType); + RTCRemoteInboundRtpStreamStatsWeakPtr thisWeak_; + + RTCRemoteInboundRtpStreamStats() noexcept; + virtual ~RTCRemoteInboundRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + + // properties RTCReceivedRtpStreamStats + unsigned long get_packetsReceived() noexcept override; + unsigned long get_packetsLost() noexcept override; + double get_jitter() noexcept override; + unsigned long get_packetsDiscarded() noexcept override; + unsigned long get_packetsRepaired() noexcept override; + unsigned long get_burstPacketsLost() noexcept override; + unsigned long get_burstPacketsDiscarded() noexcept override; + unsigned long get_burstLossCount() noexcept override; + unsigned long get_burstDiscardCount() noexcept override; + double get_burstLossRate() noexcept override; + double get_burstDiscardRate() noexcept override; + double get_gapLossRate() noexcept override; + double get_gapDiscardRate() noexcept override; + + // properties RTCRemoteInboundRtpStreamStats + String get_localId() noexcept override; + double get_roundTripTime() noexcept override; + double get_fractionLost() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.cpp new file mode 100644 index 00000000..604ca412 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.cpp @@ -0,0 +1,186 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRemoteOutboundRtpStreamStatsPtr wrapper::org::webRtc::RTCRemoteOutboundRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::~RTCRemoteOutboundRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_packetsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_packetsDiscardedOnSend() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_fecPacketsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_bytesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_bytesDiscardedOnSend() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_localId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats::get_remoteTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.h new file mode 100644 index 00000000..7557f116 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRemoteOutboundRtpStreamStats.h @@ -0,0 +1,57 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRemoteOutboundRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRemoteOutboundRtpStreamStats : public wrapper::org::webRtc::RTCRemoteOutboundRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRemoteOutboundRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRemoteOutboundRtpStreamStats, WrapperImplType); + RTCRemoteOutboundRtpStreamStatsWeakPtr thisWeak_; + + RTCRemoteOutboundRtpStreamStats() noexcept; + virtual ~RTCRemoteOutboundRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + + // properties RTCSentRtpStreamStats + unsigned long get_packetsSent() noexcept override; + unsigned long get_packetsDiscardedOnSend() noexcept override; + unsigned long get_fecPacketsSent() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesDiscardedOnSend() noexcept override; + + // properties RTCRemoteOutboundRtpStreamStats + String get_localId() noexcept override; + ::zsLib::Time get_remoteTimestamp() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpFeedback.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpFeedback.cpp new file mode 100644 index 00000000..55d2bd8f --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpFeedback.cpp @@ -0,0 +1,107 @@ + +#include "impl_org_webRtc_RTCRtcpFeedback.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtcpFeedback::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtcpFeedback::RTCRtcpFeedback() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtcpFeedbackPtr wrapper::org::webRtc::RTCRtcpFeedback::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtcpFeedback::~RTCRtcpFeedback() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtcpFeedback::wrapper_init_org_webRtc_RTCRtcpFeedback() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.type = UseEnum::toString(from.type); + if (from.message_type.has_value()) { + to.parameter = UseEnum::toString(from.message_type.value()); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + try { + to.type = UseEnum::toNativeRtcpFeedbackType(from.type); + } catch (const ::zsLib::Exceptions::InvalidArgument &) { + } + if (from.parameter.hasData()) { + try { + to.message_type = UseEnum::toNativeRtcpFeedbackMessageType(from.parameter); + } catch (const ::zsLib::Exceptions::InvalidArgument &) { + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpFeedback.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpFeedback.h new file mode 100644 index 00000000..c9a494d4 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpFeedback.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtcpFeedback.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtcpFeedback : public wrapper::org::webRtc::RTCRtcpFeedback + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtcpFeedback, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtcpFeedback, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtcpFeedback, NativeType); + + RTCRtcpFeedbackWeakPtr thisWeak_; + + RTCRtcpFeedback() noexcept; + virtual ~RTCRtcpFeedback() noexcept; + void wrapper_init_org_webRtc_RTCRtcpFeedback() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpParameters.cpp new file mode 100644 index 00000000..76196960 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpParameters.cpp @@ -0,0 +1,53 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCRtcpParameters.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtcpParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +#pragma ZS_BUILD_NOTE("LATER","No way to convert RTCRtcpParameters") + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtcpParameters::RTCRtcpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtcpParametersPtr wrapper::org::webRtc::RTCRtcpParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtcpParameters::~RTCRtcpParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtcpParameters::wrapper_init_org_webRtc_RTCRtcpParameters() noexcept +{ +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpParameters.h new file mode 100644 index 00000000..3e9d1ddb --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtcpParameters.h @@ -0,0 +1,30 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtcpParameters.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtcpParameters : public wrapper::org::webRtc::RTCRtcpParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtcpParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtcpParameters, WrapperImplType); + RTCRtcpParametersWeakPtr thisWeak_; + + RTCRtcpParameters() noexcept; + virtual ~RTCRtcpParameters() noexcept; + + void wrapper_init_org_webRtc_RTCRtcpParameters() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCapabilities.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCapabilities.cpp new file mode 100644 index 00000000..9134303b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCapabilities.cpp @@ -0,0 +1,142 @@ + +#include "impl_org_webRtc_RTCRtpCapabilities.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRtpCodecCapability.h" +#include "impl_org_webRtc_RTCRtpHeaderExtensionCapability.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCapabilities::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecCapability, UseRtpCodecCapability); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpHeaderExtensionCapability, UseRtpHeaderExtensionCapability); + + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCapabilities::RTCRtpCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpCapabilitiesPtr wrapper::org::webRtc::RTCRtpCapabilities::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCapabilities::~RTCRtpCapabilities() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpCapabilities::wrapper_init_org_webRtc_RTCRtpCapabilities() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.codecs = make_shared< decltype(to.codecs)::element_type >(); + to.headerExtensions = make_shared< decltype(to.headerExtensions)::element_type >(); + to.fecMechanisms = make_shared< decltype(to.fecMechanisms)::element_type >(); + + for (auto iter = from.codecs.begin(); iter != from.codecs.end(); ++iter) { + auto wrapper = UseRtpCodecCapability::toWrapper(*iter); + if (!wrapper) continue; + to.codecs->push_back(wrapper); + } + + for (auto iter = from.header_extensions.begin(); iter != from.header_extensions.end(); ++iter) { + auto wrapper = UseRtpHeaderExtensionCapability::toWrapper(*iter); + if (!wrapper) continue; + to.headerExtensions->push_back(wrapper); + } + + for (auto iter = from.fec.begin(); iter != from.fec.end(); ++iter) { + to.fecMechanisms->push_back(UseEnum::toString(*iter)); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + if (from.codecs) { + for (auto iter = from.codecs->begin(); iter != from.codecs->end(); ++iter) { + auto native = UseRtpCodecCapability::toNative(*iter); + if (!native) continue; + to.codecs.push_back(*native); + } + } + + if (from.headerExtensions) { + for (auto iter = from.headerExtensions->begin(); iter != from.headerExtensions->end(); ++iter) { + auto native = UseRtpHeaderExtensionCapability::toNative(*iter); + if (!native) continue; + to.header_extensions.push_back(*native); + } + } + + if (from.fecMechanisms) { + for (auto iter = from.fecMechanisms->begin(); iter != from.fecMechanisms->end(); ++iter) { + try { + to.fec.push_back(UseEnum::toNativeFecMechanism(*iter)); + } catch (::zsLib::Exceptions::InvalidArgument &) { + } + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCapabilities.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCapabilities.h new file mode 100644 index 00000000..ed437487 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCapabilities.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpCapabilities.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpCapabilities : public wrapper::org::webRtc::RTCRtpCapabilities + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpCapabilities, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCapabilities, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpCapabilities, NativeType); + + RTCRtpCapabilitiesWeakPtr thisWeak_; + + RTCRtpCapabilities() noexcept; + virtual ~RTCRtpCapabilities() noexcept; + void wrapper_init_org_webRtc_RTCRtpCapabilities() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecCapability.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecCapability.cpp new file mode 100644 index 00000000..b94bc2f9 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecCapability.cpp @@ -0,0 +1,162 @@ + +#include "impl_org_webRtc_RTCRtpCodecCapability.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRtcpFeedback.h" +#include "impl_org_webRtc_RTCRtpCodecParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecCapability::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtcpFeedback, UseRtcpFeedback); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecParameters, UseRtpCodecParameters); + +ZS_DECLARE_TYPEDEF_PTR(::zsLib::IHelper, UseHelper); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCodecCapability::RTCRtpCodecCapability() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpCodecCapabilityPtr wrapper::org::webRtc::RTCRtpCodecCapability::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCodecCapability::~RTCRtpCodecCapability() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpCodecCapability::wrapper_init_org_webRtc_RTCRtpCodecCapability() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + if (from.preferred_payload_type.has_value()) { + to.preferredPayloadType = SafeInt(from.preferred_payload_type.value()); + } + to.name = from.name; + to.mimeType = from.mime_type(); + if (from.clock_rate.has_value()) { + to.clockRate = SafeInt(from.clock_rate.value()); + } + if (from.num_channels.has_value()) { + to.channels = SafeInt(from.num_channels.value()); + } + to.sdpFmtpLine = UseRtpCodecParameters::toFmtp(from.parameters); + if (from.ptime.has_value()) { + to.ptime = decltype(to.ptime)(SafeInt(from.ptime.value())); + } + if (from.max_ptime.has_value()) { + to.maxPtime = decltype(to.maxPtime)(SafeInt(from.max_ptime.value())); + } + to.rtcpFeedback = make_shared(); + for (auto iter = from.rtcp_feedback.begin(); iter != from.rtcp_feedback.end(); ++iter) { + auto wrapper = UseRtcpFeedback::toWrapper(*iter); + if (!wrapper) continue; + to.rtcpFeedback->push_back(wrapper); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + if (from.preferredPayloadType.has_value()) { + to.preferred_payload_type = (int)SafeInt(from.preferredPayloadType.value()); + } + to.name = from.name; + + { + UseHelper::SplitMap splits; + UseHelper::split(from.mimeType, splits, "/"); + if (splits.size() > 0) { + try { + to.kind = UseEnum::toNativeMediaType(splits[0]); + } + catch (const ::zsLib::Exceptions::InvalidArgument &) { + } + } + } + if (from.clockRate.has_value()) { + to.clock_rate = (int)SafeInt(from.clockRate.value()); + } + if (from.channels.has_value()) { + to.num_channels = (int)SafeInt(from.channels.value()); + } + UseRtpCodecParameters::fromFmtp(from.sdpFmtpLine, to.parameters); + if (decltype(from.ptime)() != from.ptime) { + to.ptime = (int)SafeInt(from.ptime.count()); + } + if (decltype(from.maxPtime)() != from.maxPtime) { + to.max_ptime = (int)SafeInt(from.maxPtime.count()); + } + if (from.rtcpFeedback) { + for (auto iter = from.rtcpFeedback->begin(); iter != from.rtcpFeedback->end(); ++iter) { + auto native = UseRtcpFeedback::toNative(*iter); + if (!native) continue; + to.rtcp_feedback.push_back(*native); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecCapability.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecCapability.h new file mode 100644 index 00000000..64cb46ba --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecCapability.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpCodecCapability.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpCodecCapability : public wrapper::org::webRtc::RTCRtpCodecCapability + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpCodecCapability, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecCapability, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpCodecCapability, NativeType); + + RTCRtpCodecCapabilityWeakPtr thisWeak_; + + RTCRtpCodecCapability() noexcept; + virtual ~RTCRtpCodecCapability() noexcept; + void wrapper_init_org_webRtc_RTCRtpCodecCapability() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecParameters.cpp new file mode 100644 index 00000000..3fdc8b64 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecParameters.cpp @@ -0,0 +1,211 @@ + +#include "impl_org_webRtc_RTCRtpCodecParameters.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRtcpFeedback.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include +#include + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtcpFeedback, UseRtcpFeedback); + +ZS_DECLARE_TYPEDEF_PTR(::zsLib::IHelper, UseHelper); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCodecParameters::RTCRtpCodecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpCodecParametersPtr wrapper::org::webRtc::RTCRtpCodecParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCodecParameters::~RTCRtpCodecParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpCodecParameters::wrapper_init_org_webRtc_RTCRtpCodecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +String WrapperImplType::toFmtp(const std::unordered_map &input) noexcept +{ + if (input.size() < 1) return String(); + + std::stringstream ss; + bool first{ true }; + for (auto iter = input.begin(); iter != input.end(); ++iter) { + auto &name = (*iter).first; + auto &value = (*iter).second; + + if (!first) { + ss << "; "; + } + ss << name; + if (value.size() > 0) { + ss << "="; + ss << value; + } + } + return ss.str(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::fromFmtp(const String &input, std::unordered_map &output) noexcept +{ + if (!input.hasData()) return; + + UseHelper::SplitMap splits; + UseHelper::split(input, splits, " "); + + for (auto iter = splits.begin(); iter != splits.end(); ++iter) { + UseHelper::SplitMap splitsSemi; + UseHelper::split((*iter).second, splitsSemi, ";"); + for (auto iterSemi = splitsSemi.begin(); iterSemi != splitsSemi.end(); ++iter) { + UseHelper::SplitMap splitsEquals; + UseHelper::split((*iterSemi).second, splitsEquals, "="); + + if (splitsEquals.size() > 0) { + String name = splitsEquals[0]; + splitsEquals.erase(splitsEquals.begin()); + + String combined; + if (splitsEquals.size() > 1) { + combined = UseHelper::combine(splitsEquals, "="); + } + if (name.hasData()) { + output[name] = combined; + } + } + } + } +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.payloadType = SafeInt(from.payload_type); + to.name = from.name; + to.mimeType = from.mime_type(); + if (from.clock_rate.has_value()) { + to.clockRate = SafeInt(from.clock_rate.value()); + } + if (from.num_channels.has_value()) { + to.channels = SafeInt(from.num_channels.value()); + } + to.sdpFmtpLine = WrapperImplType::toFmtp(from.parameters); + if (from.ptime.has_value()) { + to.ptime = decltype(to.ptime)(SafeInt(from.ptime.value())); + } + if (from.max_ptime.has_value()) { + to.maxPtime = decltype(to.maxPtime)(SafeInt(from.max_ptime.value())); + } + to.rtcpFeedback = make_shared(); + for (auto iter = from.rtcp_feedback.begin(); iter != from.rtcp_feedback.end(); ++iter) { + auto wrapper = UseRtcpFeedback::toWrapper(*iter); + if (!wrapper) continue; + to.rtcpFeedback->push_back(wrapper); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.payload_type = SafeInt(from.payloadType); + to.name = from.name; + + { + UseHelper::SplitMap splits; + UseHelper::split(from.mimeType, splits, "/"); + if (splits.size() > 0) { + try { + to.kind = UseEnum::toNativeMediaType(splits[0]); + } catch (const ::zsLib::Exceptions::InvalidArgument &) { + } + } + } + if (from.clockRate.has_value()) { + to.clock_rate = (int)SafeInt(from.clockRate.value()); + } + if (from.channels.has_value()) { + to.num_channels = (int)SafeInt(from.channels.value()); + } + WrapperImplType::fromFmtp(from.sdpFmtpLine, to.parameters); + if (decltype(from.ptime)() != from.ptime) { + to.ptime = (int)SafeInt(from.ptime.count()); + } + if (decltype(from.maxPtime)() != from.maxPtime) { + to.max_ptime = (int)SafeInt(from.maxPtime.count()); + } + if (from.rtcpFeedback) { + for (auto iter = from.rtcpFeedback->begin(); iter != from.rtcpFeedback->end(); ++iter) { + auto native = UseRtcpFeedback::toNative(*iter); + if (!native) continue; + to.rtcp_feedback.push_back(*native); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecParameters.h new file mode 100644 index 00000000..ccbdfd10 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodecParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpCodecParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpCodecParameters : public wrapper::org::webRtc::RTCRtpCodecParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpCodecParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpCodecParameters, NativeType); + + RTCRtpCodecParametersWeakPtr thisWeak_; + + RTCRtpCodecParameters() noexcept; + virtual ~RTCRtpCodecParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpCodecParameters() noexcept override; + + static String toFmtp(const std::unordered_map &input) noexcept; + static void fromFmtp(const String &input, std::unordered_map &output) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodingParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodingParameters.cpp new file mode 100644 index 00000000..c6a7b310 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodingParameters.cpp @@ -0,0 +1,132 @@ + +#include "impl_org_webRtc_RTCRtpCodingParameters.h" +#include "impl_org_webRtc_RTCRtpRtxParameters.h" +#include "impl_org_webRtc_RTCRtpFecParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodingParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpRtxParameters, UseRtxParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpFecParameters, UseFecParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCodingParameters::RTCRtpCodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpCodingParametersPtr wrapper::org::webRtc::RTCRtpCodingParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpCodingParameters::~RTCRtpCodingParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpCodingParameters::wrapper_init_org_webRtc_RTCRtpCodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const NativeType &from, WrapperType &to) noexcept +{ + to.rid = from.rid; + if (from.ssrc.has_value()) { + to.ssrc = SafeInt(from.ssrc.value()); + } + if (from.codec_payload_type.has_value()) { + to.codecPayloadType = SafeInt(from.codec_payload_type.value()); + } + + if (from.fec.has_value()) { + auto temp = UseFecParameters::toWrapper(from.fec.value()); + if (temp) to.fec = temp; + } + if (from.rtx.has_value()) { + auto temp = UseRtxParameters::toWrapper(from.rtx.value()); + if (temp) to.rtx = temp; + } + to.active = from.active; + +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const WrapperType &from, NativeType &to) noexcept +{ + to.rid = from.rid; + if (from.ssrc.has_value()) { + to.ssrc = (uint32_t)SafeInt(from.ssrc.value()); + } + if (from.codecPayloadType.has_value()) { + to.codec_payload_type = (int)SafeInt(from.codecPayloadType.value()); + } + if (from.fec.has_value()) { + auto temp = UseFecParameters::toNative(from.fec.value()); + if (temp) to.fec = *temp; + } + if (from.rtx.has_value()) { + auto temp = UseRtxParameters::toNative(from.rtx.value()); + if (temp) to.rtx = *temp; + } + to.active = from.active; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodingParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodingParameters.h new file mode 100644 index 00000000..5dca8304 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpCodingParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpCodingParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpCodingParameters : public wrapper::org::webRtc::RTCRtpCodingParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpCodingParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodingParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpEncodingParameters, NativeType); + + RTCRtpCodingParametersWeakPtr thisWeak_; + + RTCRtpCodingParameters() noexcept; + virtual ~RTCRtpCodingParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpCodingParameters() noexcept override; + + static void apply(const NativeType &from, WrapperType &to) noexcept; + static void apply(const WrapperType &from, NativeType &to) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSource.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSource.cpp new file mode 100644 index 00000000..29b71cd3 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSource.cpp @@ -0,0 +1,79 @@ + +#include "impl_org_webRtc_RTCRtpContributingSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpreceiverinterface.h" +#include "impl_org_webRtc_post_include.h" + +#include + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpContributingSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpContributingSource::RTCRtpContributingSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpContributingSourcePtr wrapper::org::webRtc::RTCRtpContributingSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpContributingSource::~RTCRtpContributingSource() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const NativeType &from, WrapperType &to) +{ + + auto tempLevel = from.audio_level(); + if (tempLevel.has_value()) { + auto levelValue = tempLevel.value(); + if (127 != levelValue) { + to.audioLevel = pow(((double)10.0), ((-1.0 *((double)levelValue)) / 20.0)); + } + } + to.source = SafeInt(from.source_id()); + to.timestamp = ::zsLib::Milliseconds(SafeInt<::zsLib::Milliseconds::rep>(from.timestamp_ms())); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + if (::webrtc::RtpSourceType::CSRC != native.source_type()) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + + apply(native, *result); + + return result; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSource.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSource.h new file mode 100644 index 00000000..9172666d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSource.h @@ -0,0 +1,35 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpContributingSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpContributingSource : public wrapper::org::webRtc::RTCRtpContributingSource + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpContributingSource, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpContributingSource, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpSource, NativeType); + + RTCRtpContributingSourceWeakPtr thisWeak_; + + RTCRtpContributingSource() noexcept; + virtual ~RTCRtpContributingSource() noexcept; + + static void apply(const NativeType &from, WrapperType &to); + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSourceStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSourceStats.cpp new file mode 100644 index 00000000..14e3091f --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSourceStats.cpp @@ -0,0 +1,102 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCRtpContributingSourceStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::RTCRtpContributingSourceStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpContributingSourceStatsPtr wrapper::org::webRtc::RTCRtpContributingSourceStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::~RTCRtpContributingSourceStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_contributorSsrc() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_inboundRtpStreamId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_packetsContributedTo() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCRtpContributingSourceStats::get_audioLevel() noexcept +{ + Optional< double > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSourceStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSourceStats.h new file mode 100644 index 00000000..f61ef616 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpContributingSourceStats.h @@ -0,0 +1,41 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpContributingSourceStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpContributingSourceStats : public wrapper::org::webRtc::RTCRtpContributingSourceStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpContributingSourceStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpContributingSourceStats, WrapperImplType); + RTCRtpContributingSourceStatsWeakPtr thisWeak_; + + RTCRtpContributingSourceStats() noexcept; + virtual ~RTCRtpContributingSourceStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpContributingSourceStats + unsigned long get_contributorSsrc() noexcept override; + String get_inboundRtpStreamId() noexcept override; + unsigned long get_packetsContributedTo() noexcept override; + Optional< double > get_audioLevel() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpDecodingParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpDecodingParameters.cpp new file mode 100644 index 00000000..46d44f53 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpDecodingParameters.cpp @@ -0,0 +1,97 @@ + +#include "impl_org_webRtc_RTCRtpDecodingParameters.h" +#include "impl_org_webRtc_RTCRtpCodingParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpDecodingParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodingParameters, UseRtpCodingParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpDecodingParameters::RTCRtpDecodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpDecodingParametersPtr wrapper::org::webRtc::RTCRtpDecodingParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpDecodingParameters::~RTCRtpDecodingParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpDecodingParameters::wrapper_init_org_webRtc_RTCRtpDecodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) noexcept +{ + UseRtpCodingParameters::apply(from, to); + +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) noexcept +{ + UseRtpCodingParameters::apply(from, to); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpDecodingParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpDecodingParameters.h new file mode 100644 index 00000000..3767c3a1 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpDecodingParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpDecodingParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpDecodingParameters : public wrapper::org::webRtc::RTCRtpDecodingParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpDecodingParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpDecodingParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpEncodingParameters, NativeType); + + RTCRtpDecodingParametersWeakPtr thisWeak_; + + RTCRtpDecodingParameters() noexcept; + virtual ~RTCRtpDecodingParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpDecodingParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpEncodingParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpEncodingParameters.cpp new file mode 100644 index 00000000..16767835 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpEncodingParameters.cpp @@ -0,0 +1,155 @@ + +#include "impl_org_webRtc_RTCRtpEncodingParameters.h" +#include "impl_org_webRtc_RTCRtpCodingParameters.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpEncodingParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodingParameters, UseRtpCodingParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpEncodingParameters::RTCRtpEncodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpEncodingParametersPtr wrapper::org::webRtc::RTCRtpEncodingParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpEncodingParameters::~RTCRtpEncodingParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpEncodingParameters::wrapper_init_org_webRtc_RTCRtpEncodingParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) noexcept +{ + UseRtpCodingParameters::apply(from, to); + + if (from.dtx.has_value()) { + to.dtx = UseEnum::toWrapper(from.dtx.value()); + } + + to.priority = UseEnum::toWrapperRTCPriorityType(from.bitrate_priority); + + if (from.ptime.has_value()) { + to.ptime = decltype(to.ptime)(((decltype(to.ptime)::rep)SafeInt(from.ptime.value()))); + } + + if (from.max_bitrate_bps.has_value()) { + to.maxBitrate = SafeInt(from.max_bitrate_bps.value()); + } + + if (from.max_framerate.has_value()) { + to.maxFramerate = decltype(to.maxFramerate)::value_type(from.max_framerate.value()); + } + + to.scaleResolutionDownBy = from.scale_resolution_down_by; + to.scaleFramerateDownBy = from.scale_framerate_down_by; + + to.dependencyEncodingIds = make_shared< list >(); + if (from.dependency_rids.size() > 0) { + for (auto iter = from.dependency_rids.begin(); iter != from.dependency_rids.end(); ++iter) { + to.dependencyEncodingIds->push_back(*iter); + } + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) noexcept +{ + UseRtpCodingParameters::apply(from, to); + + if (from.dtx.has_value()) { + to.dtx = UseEnum::toNative(from.dtx.value()); + } + + to.bitrate_priority = UseEnum::toNative(from.priority); + + if (from.ptime != decltype(from.ptime)()) { + to.ptime = (int)SafeInt(from.ptime.count()); + } + + if (from.maxBitrate.has_value()) { + to.max_bitrate_bps = (int)SafeInt(from.maxBitrate.value()); + } + + if (from.maxFramerate.has_value()) { + to.max_framerate = int(from.maxFramerate.value()); + } + + to.scale_resolution_down_by = from.scaleResolutionDownBy; + to.scale_framerate_down_by = from.scaleFramerateDownBy; + + if (from.dependencyEncodingIds) { + for (auto iter = from.dependencyEncodingIds->begin(); iter != from.dependencyEncodingIds->end(); ++iter) { + to.dependency_rids.push_back(*iter); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpEncodingParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpEncodingParameters.h new file mode 100644 index 00000000..6da2f12a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpEncodingParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpEncodingParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpEncodingParameters : public wrapper::org::webRtc::RTCRtpEncodingParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpEncodingParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpEncodingParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpEncodingParameters, NativeType); + + RTCRtpEncodingParametersWeakPtr thisWeak_; + + RTCRtpEncodingParameters() noexcept; + virtual ~RTCRtpEncodingParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpEncodingParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpFecParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpFecParameters.cpp new file mode 100644 index 00000000..6a298d5b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpFecParameters.cpp @@ -0,0 +1,111 @@ + +#include "impl_org_webRtc_RTCRtpFecParameters.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpFecParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpFecParameters::RTCRtpFecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpFecParametersPtr wrapper::org::webRtc::RTCRtpFecParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpFecParameters::~RTCRtpFecParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpFecParameters::wrapper_init_org_webRtc_RTCRtpFecParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + if (from.ssrc.has_value()) { + to.ssrc = SafeInt(from.ssrc.value()); + } + to.mechanism = UseEnum::toString(from.mechanism); +} + +//------------------------------------------------------------------------------ +static bool apply(const WrapperImplType &from, NativeType &to) +{ + if (from.ssrc.has_value()) { + to.ssrc = (uint32_t)SafeInt(from.ssrc.value()); + } + + try { + to.mechanism = UseEnum::toNativeFecMechanism(from.mechanism); + } catch (const ::zsLib::Exceptions::InvalidArgument &) { + return false; + } + return true; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + auto result = apply(*converted, *cloned); + if (!result) return NativeTypePtr(); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpFecParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpFecParameters.h new file mode 100644 index 00000000..d8fe1e7c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpFecParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpFecParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpFecParameters : public wrapper::org::webRtc::RTCRtpFecParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpFecParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpFecParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpFecParameters, NativeType); + + RTCRtpFecParametersWeakPtr thisWeak_; + + RTCRtpFecParameters() noexcept; + virtual ~RTCRtpFecParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpFecParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionCapability.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionCapability.cpp new file mode 100644 index 00000000..c7beed6c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionCapability.cpp @@ -0,0 +1,106 @@ + +#include "impl_org_webRtc_RTCRtpHeaderExtensionCapability.h" + +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpHeaderExtensionCapability::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpHeaderExtensionCapability::RTCRtpHeaderExtensionCapability() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpHeaderExtensionCapabilityPtr wrapper::org::webRtc::RTCRtpHeaderExtensionCapability::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpHeaderExtensionCapability::~RTCRtpHeaderExtensionCapability() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpHeaderExtensionCapability::wrapper_init_org_webRtc_RTCRtpHeaderExtensionCapability() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.uri = from.uri; + if (from.preferred_id.has_value()) { + to.preferredId = SafeInt(from.preferred_id.value()); + } + to.preferredEncrypt = from.preferred_encrypt; +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.uri = from.uri; + if (from.preferredId.has_value()) { + to.preferred_id = (int)SafeInt(from.preferredId.value()); + } + to.preferred_encrypt = from.preferredEncrypt; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionCapability.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionCapability.h new file mode 100644 index 00000000..0f2d17bf --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionCapability.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpHeaderExtensionCapability.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpHeaderExtensionCapability : public wrapper::org::webRtc::RTCRtpHeaderExtensionCapability + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpHeaderExtensionCapability, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpHeaderExtensionCapability, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpHeaderExtensionCapability, NativeType); + + RTCRtpHeaderExtensionCapabilityWeakPtr thisWeak_; + + RTCRtpHeaderExtensionCapability() noexcept; + virtual ~RTCRtpHeaderExtensionCapability() noexcept; + void wrapper_init_org_webRtc_RTCRtpHeaderExtensionCapability() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionParameters.cpp new file mode 100644 index 00000000..a94018fd --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionParameters.cpp @@ -0,0 +1,101 @@ + +#include "impl_org_webRtc_RTCRtpHeaderExtensionParameters.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpHeaderExtensionParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpHeaderExtensionParameters::RTCRtpHeaderExtensionParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpHeaderExtensionParametersPtr wrapper::org::webRtc::RTCRtpHeaderExtensionParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpHeaderExtensionParameters::~RTCRtpHeaderExtensionParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpHeaderExtensionParameters::wrapper_init_org_webRtc_RTCRtpHeaderExtensionParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.uri = from.uri; + to.id = SafeInt(from.id); + to.encrypted = from.encrypt; +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.uri = from.uri; + to.id = SafeInt(from.id); + to.encrypt = from.encrypted; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionParameters.h new file mode 100644 index 00000000..c3ff314d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpHeaderExtensionParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpHeaderExtensionParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpHeaderExtensionParameters : public wrapper::org::webRtc::RTCRtpHeaderExtensionParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpHeaderExtensionParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpHeaderExtensionParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpExtension, NativeType); + + RTCRtpHeaderExtensionParametersWeakPtr thisWeak_; + + RTCRtpHeaderExtensionParameters() noexcept; + virtual ~RTCRtpHeaderExtensionParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpHeaderExtensionParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpParameters.cpp new file mode 100644 index 00000000..d0e44e11 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpParameters.cpp @@ -0,0 +1,130 @@ + +#include "impl_org_webRtc_RTCRtpParameters.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRtpCodecParameters.h" +#include "impl_org_webRtc_RTCRtpHeaderExtensionParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecParameters, UseRtpCodecParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpHeaderExtensionParameters, UseRtpHeaderExtensionParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpParameters::RTCRtpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpParametersPtr wrapper::org::webRtc::RTCRtpParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpParameters::~RTCRtpParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpParameters::wrapper_init_org_webRtc_RTCRtpParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const NativeType &from, WrapperType &to) +{ + to.muxId = from.mid; + to.codecs = make_shared< decltype(to.codecs)::element_type >(); + to.headerExtensions = make_shared< decltype(to.headerExtensions)::element_type >(); + +#pragma ZS_BUILD_NOTE("LATER","no rtcp parameters") + + for (auto iter = from.codecs.begin(); iter != from.codecs.end(); ++iter) { + auto wrapper = UseRtpCodecParameters::toWrapper(*iter); + if (!wrapper) continue; + to.codecs->push_back(wrapper); + } + + for (auto iter = from.header_extensions.begin(); iter != from.header_extensions.end(); ++iter) { + auto wrapper = UseRtpHeaderExtensionParameters::toWrapper(*iter); + if (!wrapper) continue; + to.headerExtensions->push_back(wrapper); + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::apply(const WrapperType &from, NativeType &to) +{ + if (from.codecs) { + for (auto iter = from.codecs->begin(); iter != from.codecs->end(); ++iter) { + auto native = UseRtpCodecParameters::toNative(*iter); + if (!native) continue; + to.codecs.push_back(*native); + } + } + + if (from.headerExtensions) { + for (auto iter = from.headerExtensions->begin(); iter != from.headerExtensions->end(); ++iter) { + auto native = UseRtpHeaderExtensionParameters::toNative(*iter); + if (!native) continue; + to.header_extensions.push_back(*native); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpParameters.h new file mode 100644 index 00000000..d0c443e1 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpParameters.h @@ -0,0 +1,40 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpParameters : public wrapper::org::webRtc::RTCRtpParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpParameters, NativeType); + + RTCRtpParametersWeakPtr thisWeak_; + + RTCRtpParameters() noexcept; + virtual ~RTCRtpParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpParameters() noexcept override; + + static void apply(const NativeType &from, WrapperType &to); + static void apply(const WrapperType &from, NativeType &to); + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiveParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiveParameters.cpp new file mode 100644 index 00000000..be9e4c7d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiveParameters.cpp @@ -0,0 +1,116 @@ + +#include "impl_org_webRtc_RTCRtpReceiveParameters.h" +#include "impl_org_webRtc_RTCRtpParameters.h" +#include "impl_org_webRtc_RTCRtpDecodingParameters.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiveParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpParameters, UseRtpParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpDecodingParameters, UseRtpDecodingParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpReceiveParameters::RTCRtpReceiveParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpReceiveParametersPtr wrapper::org::webRtc::RTCRtpReceiveParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpReceiveParameters::~RTCRtpReceiveParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpReceiveParameters::wrapper_init_org_webRtc_RTCRtpReceiveParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.encodings = make_shared< decltype(to.encodings)::element_type >(); + + UseRtpParameters::apply(from, to); + + for (auto iter = from.encodings.begin(); iter != from.encodings.end(); ++iter) { + auto converted = UseRtpDecodingParameters::toWrapper(*iter); + if (!converted) continue; + to.encodings->push_back(converted); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + UseRtpParameters::apply(from, to); + + if (from.encodings) { + for (auto iter = from.encodings->begin(); iter != from.encodings->end(); ++iter) { + auto converted = UseRtpDecodingParameters::toNative(*iter); + if (!converted) continue; + to.encodings.push_back(*converted); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiveParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiveParameters.h new file mode 100644 index 00000000..e4703794 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiveParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpReceiveParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpReceiveParameters : public wrapper::org::webRtc::RTCRtpReceiveParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpReceiveParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiveParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpParameters, NativeType); + + RTCRtpReceiveParametersWeakPtr thisWeak_; + + RTCRtpReceiveParameters() noexcept; + virtual ~RTCRtpReceiveParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpReceiveParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiver.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiver.cpp new file mode 100644 index 00000000..85136a93 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiver.cpp @@ -0,0 +1,272 @@ + +#include "impl_org_webRtc_RTCRtpReceiver.h" +#include "impl_org_webRtc_RTCRtpReceiveParameters.h" +#include "impl_org_webRtc_RTCRtpCapabilities.h" +#include "impl_org_webRtc_MediaStreamTrack.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRtpContributingSource.h" +#include "impl_org_webRtc_RTCRtpSynchronizationSource.h" +#include "impl_org_webRtc_WebrtcLib.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpreceiverinterface.h" +#include "pc/rtpreceiver.h" +#include "pc/peerconnectionfactory.h" +#include "media/base/mediaengine.h" +#include "ortc/rtpparametersconversion.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiver::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiveParameters, UseRtpReceiveParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCapabilities, UseRtpCapabilities); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaStreamTrack, UseMediaStreamTrack); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpContributingSource, UseRtpContributingSource); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSynchronizationSource, UseRtpSynchronizationSource); + + +//----------------------------------------------------------------------------- +// NOTE: borrowed from webrtc/ortc/ortcfactory.cc +namespace { + + // Asserts that all of the built-in capabilities can be converted to + // RtpCapabilities. If they can't, something's wrong (for example, maybe a new + // feedback mechanism is supported, but an enum value wasn't added to + // rtpparameters.h). + template + ::webrtc::RtpCapabilities ToRtpCapabilitiesWithAsserts( + const std::vector& cricket_codecs, + const cricket::RtpHeaderExtensions& cricket_extensions) { + ::webrtc::RtpCapabilities capabilities = + ::webrtc::ToRtpCapabilities(cricket_codecs, cricket_extensions); + RTC_DCHECK_EQ(capabilities.codecs.size(), cricket_codecs.size()); + for (size_t i = 0; i < capabilities.codecs.size(); ++i) { + RTC_DCHECK_EQ(capabilities.codecs[i].rtcp_feedback.size(), + cricket_codecs[i].feedback_params.params().size()); + } + RTC_DCHECK_EQ(capabilities.header_extensions.size(), + cricket_extensions.size()); + return capabilities; + } + +} // namespace + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static NativeType *unproxyAudioNative(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::RtpReceiver, ::webrtc::AudioRtpReceiver, native); +} + +//------------------------------------------------------------------------------ +static NativeType *unproxyVideoNative(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::RtpReceiver, ::webrtc::VideoRtpReceiver, native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpReceiver::RTCRtpReceiver() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpReceiverPtr wrapper::org::webRtc::RTCRtpReceiver::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpReceiver::~RTCRtpReceiver() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpReceiver::wrapper_dispose() noexcept +{ + if (!native_) return; + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpCapabilitiesPtr wrapper::org::webRtc::RTCRtpReceiver::getCapabilities(String kindStr) noexcept +{ + auto realFactory = UseWebrtcLib::realPeerConnectionFactory(); + ZS_ASSERT(realFactory); + if (!realFactory) return wrapper::org::webRtc::RTCRtpCapabilitiesPtr(); + + auto channelManager = realFactory->channel_manager(); + + try { + auto kind = UseEnum::toNativeMediaType(kindStr); + + switch (kind) { + case cricket::MEDIA_TYPE_AUDIO: { + cricket::AudioCodecs cricket_codecs; + cricket::RtpHeaderExtensions cricket_extensions; + channelManager->GetSupportedAudioReceiveCodecs(&cricket_codecs); + channelManager->GetSupportedAudioRtpHeaderExtensions( + &cricket_extensions); + return UseRtpCapabilities::toWrapper(ToRtpCapabilitiesWithAsserts(cricket_codecs, cricket_extensions)); + } + case cricket::MEDIA_TYPE_VIDEO: { + cricket::VideoCodecs cricket_codecs; + cricket::RtpHeaderExtensions cricket_extensions; + channelManager->GetSupportedVideoCodecs(&cricket_codecs); + channelManager->GetSupportedVideoRtpHeaderExtensions( + &cricket_extensions); + return UseRtpCapabilities::toWrapper(ToRtpCapabilitiesWithAsserts(cricket_codecs, cricket_extensions)); + } + case cricket::MEDIA_TYPE_DATA: + return UseRtpCapabilities::toWrapper(::webrtc::RtpCapabilities()); + } + } catch (const ::zsLib::Exceptions::InvalidArgument &) { + } + + return wrapper::org::webRtc::RTCRtpCapabilitiesPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpReceiveParametersPtr wrapper::impl::org::webRtc::RTCRtpReceiver::getParameters() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCRtpReceiveParametersPtr(); + + return UseRtpReceiveParameters::toWrapper(native_->GetParameters()); +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::RTCRtpContributingSourcePtr > > wrapper::impl::org::webRtc::RTCRtpReceiver::getContributingSources() noexcept +{ + typedef shared_ptr< list< wrapper::org::webRtc::RTCRtpContributingSourcePtr > > ReturnType; + ZS_ASSERT(native_); + if (!native_) return ReturnType(); + + auto result = make_shared< ReturnType::element_type >(); + + auto sources = native_->GetSources(); + for (auto iter = sources.begin(); iter != sources.end(); ++iter) { + auto wrapper = UseRtpContributingSource::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::RTCRtpSynchronizationSourcePtr > > wrapper::impl::org::webRtc::RTCRtpReceiver::getSynchronizationSources() noexcept +{ + typedef shared_ptr< list< wrapper::org::webRtc::RTCRtpSynchronizationSourcePtr > > ReturnType; + ZS_ASSERT(native_); + if (!native_) return ReturnType(); + + auto result = make_shared< ReturnType::element_type >(); + + auto sources = native_->GetSources(); + for (auto iter = sources.begin(); iter != sources.end(); ++iter) { + auto wrapper = UseRtpSynchronizationSource::toWrapper(*iter); + if (!wrapper) continue; + result->push_back(wrapper); + } + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackPtr wrapper::impl::org::webRtc::RTCRtpReceiver::get_track() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::MediaStreamTrackPtr(); + + return UseMediaStreamTrack::toWrapper(native_->track()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ +// if (!native_) return; +// observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ +// if (!observer_) return; +// if (!native_) return; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + NativeType *original = unproxyAudioNative(native); + original = unproxyVideoNative(original); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiver.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiver.h new file mode 100644 index 00000000..d936f6f5 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpReceiver.h @@ -0,0 +1,53 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpReceiver.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpReceiver : public wrapper::org::webRtc::RTCRtpReceiver + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpReceiver, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiver, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpReceiverInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + NativeTypeScopedPtr native_; + RTCRtpReceiverWeakPtr thisWeak_; + + RTCRtpReceiver() noexcept; + virtual ~RTCRtpReceiver() noexcept; + void wrapper_dispose() noexcept override; + + + // methods RTCRtpReceiver + wrapper::org::webRtc::RTCRtpReceiveParametersPtr getParameters() noexcept override; + shared_ptr< list< wrapper::org::webRtc::RTCRtpContributingSourcePtr > > getContributingSources() noexcept override; + shared_ptr< list< wrapper::org::webRtc::RTCRtpSynchronizationSourcePtr > > getSynchronizationSources() noexcept override; + + // properties RTCRtpReceiver + wrapper::org::webRtc::MediaStreamTrackPtr get_track() noexcept override; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpRtxParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpRtxParameters.cpp new file mode 100644 index 00000000..3574f600 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpRtxParameters.cpp @@ -0,0 +1,100 @@ + +#include "impl_org_webRtc_RTCRtpRtxParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpRtxParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpRtxParameters::RTCRtpRtxParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpRtxParametersPtr wrapper::org::webRtc::RTCRtpRtxParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpRtxParameters::~RTCRtpRtxParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpRtxParameters::wrapper_init_org_webRtc_RTCRtpRtxParameters() noexcept +{ +} + + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + if (from.ssrc.has_value()) { + to.ssrc = SafeInt(from.ssrc.value()); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + if (from.ssrc.has_value()) { + to.ssrc = (uint32_t)SafeInt(from.ssrc.value()); + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpRtxParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpRtxParameters.h new file mode 100644 index 00000000..397ff63b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpRtxParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpRtxParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpRtxParameters : public wrapper::org::webRtc::RTCRtpRtxParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpRtxParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpRtxParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpRtxParameters, NativeType); + + RTCRtpRtxParametersWeakPtr thisWeak_; + + RTCRtpRtxParameters() noexcept; + virtual ~RTCRtpRtxParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpRtxParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSendParameters.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSendParameters.cpp new file mode 100644 index 00000000..3c6b641e --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSendParameters.cpp @@ -0,0 +1,120 @@ + +#include "impl_org_webRtc_RTCRtpSendParameters.h" +#include "impl_org_webRtc_RTCRtpParameters.h" +#include "impl_org_webRtc_RTCRtpEncodingParameters.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpparameters.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSendParameters::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpParameters, UseRtpParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpEncodingParameters, UseRtpEncodingParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpSendParameters::RTCRtpSendParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSendParametersPtr wrapper::org::webRtc::RTCRtpSendParameters::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpSendParameters::~RTCRtpSendParameters() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpSendParameters::wrapper_init_org_webRtc_RTCRtpSendParameters() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.encodings = make_shared< decltype(to.encodings)::element_type >(); + + UseRtpParameters::apply(from, to); + + to.transactionId = from.transaction_id; + to.degradationPreference = UseEnum::toWrapper(from.degradation_preference); + for (auto iter = from.encodings.begin(); iter != from.encodings.end(); ++iter) { + auto converted = UseRtpEncodingParameters::toWrapper(*iter); + if (!converted) continue; + to.encodings->push_back(converted); + } +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + UseRtpParameters::apply(from, to); + + to.transaction_id = from.transactionId; + to.degradation_preference = UseEnum::toNative(from.degradationPreference); + if (from.encodings) { + for (auto iter = from.encodings->begin(); iter != from.encodings->end(); ++iter) { + auto converted = UseRtpEncodingParameters::toNative(*iter); + if (!converted) continue; + to.encodings.push_back(*converted); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSendParameters.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSendParameters.h new file mode 100644 index 00000000..a5475c8d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSendParameters.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpSendParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpSendParameters : public wrapper::org::webRtc::RTCRtpSendParameters + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpSendParameters, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSendParameters, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpParameters, NativeType); + + RTCRtpSendParametersWeakPtr thisWeak_; + + RTCRtpSendParameters() noexcept; + virtual ~RTCRtpSendParameters() noexcept; + void wrapper_init_org_webRtc_RTCRtpSendParameters() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSender.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSender.cpp new file mode 100644 index 00000000..ee1c4fe1 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSender.cpp @@ -0,0 +1,206 @@ + +#include "impl_org_webRtc_RTCRtpSender.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_RTCError.h" +#include "impl_org_webRtc_MediaStreamTrack.h" +#include "impl_org_webRtc_RTCDtmfSender.h" +#include "impl_org_webRtc_RTCRtpSendParameters.h" +#include "impl_org_webRtc_WebrtcLib.h" +#include "generated/org_webRtc_RTCRtpReceiver.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpsenderinterface.h" +#include "pc/rtpsender.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSender::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSendParameters, UseRtpSendParameters); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError, UseRtcError); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCDtmfSender, UseDtmfSender); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaStreamTrack, UseMediaStreamTrack); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static NativeType *unproxyAudioNative(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::RtpSender, ::webrtc::AudioRtpSender, native); +} + +//------------------------------------------------------------------------------ +static NativeType *unproxyVideoNative(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::RtpSender, ::webrtc::VideoRtpSender, native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpSender::RTCRtpSender() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSenderPtr wrapper::org::webRtc::RTCRtpSender::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpSender::~RTCRtpSender() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpSender::wrapper_dispose() noexcept +{ + if (!native_) return; + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpCapabilitiesPtr wrapper::org::webRtc::RTCRtpSender::getCapabilities(String kind) noexcept +{ +#pragma ZS_BUILD_NOTE("NOTE","Sender and receiver share same capabilities within WebRTC (for now)") + return wrapper::org::webRtc::RTCRtpReceiver::getCapabilities(kind); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSendParametersPtr wrapper::impl::org::webRtc::RTCRtpSender::getParameters() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCRtpSendParametersPtr(); + + return UseRtpSendParameters::toWrapper(native_->GetParameters()); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::webRtc::RTCRtpSender::setParameters(wrapper::org::webRtc::RTCRtpSendParametersPtr parameters) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return UseRtcError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INTERNAL_ERROR)); + + auto nativeValue = UseRtpSendParameters::toNative(parameters); + if (!nativeValue) return UseRtcError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + + return UseRtcError::toPromise(native_->SetParameters(*nativeValue)); +} + +//------------------------------------------------------------------------------ +PromisePtr wrapper::impl::org::webRtc::RTCRtpSender::replaceTrack(wrapper::org::webRtc::MediaStreamTrackPtr withTrack) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return UseRtcError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INTERNAL_ERROR)); + + auto nativeValue = UseMediaStreamTrack::toNative(withTrack); + bool result = native_->SetTrack(nativeValue); + + if (!result) return UseRtcError::toPromise(::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_PARAMETER)); + + return UseRtcError::toPromise(::webrtc::RTCError::OK()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackPtr wrapper::impl::org::webRtc::RTCRtpSender::get_track() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::MediaStreamTrackPtr(); + + return UseMediaStreamTrack::toWrapper(native_->track()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDtmfSenderPtr wrapper::impl::org::webRtc::RTCRtpSender::get_dtmf() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCDtmfSenderPtr(); + + return UseDtmfSender::toWrapper(native_->GetDtmfSender()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + // if (!native_) return; + // observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + // if (!observer_) return; + // if (!native_) return; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + NativeType *original = unproxyAudioNative(native); + original = unproxyVideoNative(original); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSender.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSender.h new file mode 100644 index 00000000..e0a64fd0 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSender.h @@ -0,0 +1,54 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpSender.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpSender : public wrapper::org::webRtc::RTCRtpSender + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpSender, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSender, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpSenderInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + NativeTypeScopedPtr native_; + RTCRtpSenderWeakPtr thisWeak_; + + RTCRtpSender() noexcept; + virtual ~RTCRtpSender() noexcept; + void wrapper_dispose() noexcept override; + + + // methods RTCRtpSender + wrapper::org::webRtc::RTCRtpSendParametersPtr getParameters() noexcept override; + PromisePtr setParameters(wrapper::org::webRtc::RTCRtpSendParametersPtr parameters) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + PromisePtr replaceTrack(wrapper::org::webRtc::MediaStreamTrackPtr withTrack) noexcept override; + + // properties RTCRtpSender + wrapper::org::webRtc::MediaStreamTrackPtr get_track() noexcept override; + wrapper::org::webRtc::RTCDtmfSenderPtr get_dtmf() noexcept override; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpStreamStats.cpp new file mode 100644 index 00000000..c28b2818 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpStreamStats.cpp @@ -0,0 +1,137 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpStreamStats::RTCRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpStreamStatsPtr wrapper::org::webRtc::RTCRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpStreamStats::~RTCRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpStreamStats.h new file mode 100644 index 00000000..b58fd7b7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpStreamStats.h @@ -0,0 +1,46 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpStreamStats : public wrapper::org::webRtc::RTCRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpStreamStats, WrapperImplType); + RTCRtpStreamStatsWeakPtr thisWeak_; + + RTCRtpStreamStats() noexcept; + virtual ~RTCRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSynchronizationSource.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSynchronizationSource.cpp new file mode 100644 index 00000000..a266b48e --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSynchronizationSource.cpp @@ -0,0 +1,65 @@ + +#include "impl_org_webRtc_RTCRtpSynchronizationSource.h" +#include "impl_org_webRtc_RTCRtpContributingSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtpreceiverinterface.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSynchronizationSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpContributingSource, UseRtpContributingSource); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpSynchronizationSource::RTCRtpSynchronizationSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSynchronizationSourcePtr wrapper::org::webRtc::RTCRtpSynchronizationSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpSynchronizationSource::~RTCRtpSynchronizationSource() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + if (::webrtc::RtpSourceType::SSRC != native.source_type()) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + + UseRtpContributingSource::apply(native, *result); + +#pragma ZS_BUILD_NOTE("LATER","WebRTC does not appear to have a voice activity flag indicator") + + return result; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSynchronizationSource.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSynchronizationSource.h new file mode 100644 index 00000000..6f1b73bb --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpSynchronizationSource.h @@ -0,0 +1,33 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpSynchronizationSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpSynchronizationSource : public wrapper::org::webRtc::RTCRtpSynchronizationSource + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpSynchronizationSource, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSynchronizationSource, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpSource, NativeType); + + RTCRtpSynchronizationSourceWeakPtr thisWeak_; + + RTCRtpSynchronizationSource() noexcept; + virtual ~RTCRtpSynchronizationSource() noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiver.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiver.cpp new file mode 100644 index 00000000..f7b730a9 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiver.cpp @@ -0,0 +1,238 @@ + +#include "impl_org_webRtc_RTCRtpTransceiver.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_org_webRtc_RTCRtpCodecCapability.h" +#include "impl_org_webRtc_RTCRtpSender.h" +#include "impl_org_webRtc_RTCRtpReceiver.h" +#include "impl_org_webRtc_WebrtcLib.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtptransceiverinterface.h" +#include "pc/rtptransceiver.h" +#include "api/array_view.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiver::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +typedef wrapper::impl::org::webRtc::WrapperMapper UseWrapperMapper; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpCodecCapability, UseRtpCodecCapability); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpSender, UseRtpSender); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiver, UseRtpReceiver); + +//------------------------------------------------------------------------------ +static UseWrapperMapper &mapperSingleton() +{ + static UseWrapperMapper singleton; + return singleton; +} + +//------------------------------------------------------------------------------ +static NativeType *unproxy(NativeType *native) +{ + if (!native) return nullptr; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::RtpTransceiver, ::webrtc::RtpTransceiver, native); +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpTransceiver::RTCRtpTransceiver() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverPtr wrapper::org::webRtc::RTCRtpTransceiver::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpTransceiver::~RTCRtpTransceiver() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpTransceiver::wrapper_dispose() noexcept +{ + if (!native_) return; + + teardownObserver(); + mapperSingleton().remove(native_.get()); + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpTransceiver::stop() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + + native_->Stop(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpTransceiver::setCodecPreferences(shared_ptr< list< wrapper::org::webRtc::RTCRtpCodecCapabilityPtr > > codecs) noexcept(false) +{ + ZS_ASSERT(native_); + if (!native_) return; + + if (!codecs) return; + if (codecs->size() < 1) return; + + std::unique_ptr<::webrtc::RtpCodecCapability[]> nativeCodecs(new ::webrtc::RtpCodecCapability[codecs->size()]); + + size_t found = 0; + for (auto iter = codecs->begin(); iter != codecs->end(); ++iter) { + auto nativeValue = UseRtpCodecCapability::toNative(*iter); + if (!nativeValue) continue; + (nativeCodecs.get())[found] = *nativeValue; + ++found; + } + + rtc::ArrayView<::webrtc::RtpCodecCapability> view(nativeCodecs.get(), found); + native_->SetCodecPreferences(view); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCRtpTransceiver::get_mid() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + + auto value = native_->mid(); + if (value.has_value()) return value.value(); + return String(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpSenderPtr wrapper::impl::org::webRtc::RTCRtpTransceiver::get_sender() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCRtpSenderPtr(); + + return UseRtpSender::toWrapper(native_->sender()); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpReceiverPtr wrapper::impl::org::webRtc::RTCRtpTransceiver::get_receiver() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCRtpReceiverPtr(); + + return UseRtpReceiver::toWrapper(native_->receiver()); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCRtpTransceiver::get_stopped() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return true; + + return native_->stopped(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverDirection wrapper::impl::org::webRtc::RTCRtpTransceiver::get_direction() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_inactive; + + return UseEnum::toWrapper(native_->direction()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpTransceiver::set_direction(wrapper::org::webRtc::RTCRtpTransceiverDirection value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + + native_->SetDirection(UseEnum::toNative(value)); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCRtpTransceiverDirection > wrapper::impl::org::webRtc::RTCRtpTransceiver::get_currentDirection() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return Optional< wrapper::org::webRtc::RTCRtpTransceiverDirection >(); + + auto result = native_->current_direction(); + if (!result.has_value()) return Optional< wrapper::org::webRtc::RTCRtpTransceiverDirection >(); + + return UseEnum::toWrapper(result.value()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::setupObserver() noexcept +{ + // if (!native_) return; + // observer_ = std::make_unique(thisWeak_.lock(), UseWebrtcLib::delegateQueue()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::teardownObserver() noexcept +{ + // if (!observer_) return; + // if (!native_) return; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + NativeType *original = unproxy(native); + + // search for original non-proxied pointer in map + auto wrapper = mapperSingleton().getExistingOrCreateNew(original, [native]() { + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = rtc::scoped_refptr(native); // only use proxy and never original pointer + result->setupObserver(); + return result; + }); + return wrapper; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return rtc::scoped_refptr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return rtc::scoped_refptr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiver.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiver.h new file mode 100644 index 00000000..c6255cfa --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiver.h @@ -0,0 +1,59 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpTransceiver.h" + + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpTransceiver : public wrapper::org::webRtc::RTCRtpTransceiver + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpTransceiver, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiver, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpTransceiverInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + NativeTypeScopedPtr native_; + RTCRtpTransceiverWeakPtr thisWeak_; + + RTCRtpTransceiver() noexcept; + virtual ~RTCRtpTransceiver() noexcept; + void wrapper_dispose() noexcept override; + + + // methods RTCRtpTransceiver + void stop() noexcept override; + void setCodecPreferences(shared_ptr< list< wrapper::org::webRtc::RTCRtpCodecCapabilityPtr > > codecs) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + + // properties RTCRtpTransceiver + String get_mid() noexcept override; + wrapper::org::webRtc::RTCRtpSenderPtr get_sender() noexcept override; + wrapper::org::webRtc::RTCRtpReceiverPtr get_receiver() noexcept override; + bool get_stopped() noexcept override; + wrapper::org::webRtc::RTCRtpTransceiverDirection get_direction() noexcept override; + void set_direction(wrapper::org::webRtc::RTCRtpTransceiverDirection value) noexcept override; + Optional< wrapper::org::webRtc::RTCRtpTransceiverDirection > get_currentDirection() noexcept override; + + void setupObserver() noexcept; + void teardownObserver() noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiverInit.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiverInit.cpp new file mode 100644 index 00000000..6f1e58be --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiverInit.cpp @@ -0,0 +1,114 @@ + +#include "impl_org_webRtc_RTCRtpTransceiverInit.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCRtpEncodingParameters.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtptransceiverinterface.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiverInit::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpEncodingParameters, UseRtpEncodingParameters); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpTransceiverInit::RTCRtpTransceiverInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverInitPtr wrapper::org::webRtc::RTCRtpTransceiverInit::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCRtpTransceiverInit::~RTCRtpTransceiverInit() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCRtpTransceiverInit::wrapper_init_org_webRtc_RTCRtpTransceiverInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +static void apply(const NativeType &from, WrapperImplType &to) +{ + to.direction = UseEnum::toWrapper(from.direction); + to.sendEncodings = make_shared< decltype(to.sendEncodings)::element_type >(); + + for (auto iter = from.send_encodings.begin(); iter != from.send_encodings.end(); ++iter) { + auto wrapper = UseRtpEncodingParameters::toWrapper(*iter); + if (!wrapper) continue; + to.sendEncodings->push_back(wrapper); + } + +} + +//------------------------------------------------------------------------------ +static void apply(const WrapperImplType &from, NativeType &to) +{ + to.direction = UseEnum::toNative(from.direction); + to.send_encodings.clear(); + + if (from.sendEncodings) { + for (auto iter = from.sendEncodings->begin(); iter != from.sendEncodings->end(); ++iter) { + auto native = UseRtpEncodingParameters::toNative(*iter); + if (!native) continue; + to.send_encodings.push_back(*native); + } + } +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + apply(native, *result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypePtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypePtr(); + auto cloned = make_shared(); + apply(*converted, *cloned); + return cloned; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiverInit.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiverInit.h new file mode 100644 index 00000000..73a019bf --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCRtpTransceiverInit.h @@ -0,0 +1,37 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCRtpTransceiverInit.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCRtpTransceiverInit : public wrapper::org::webRtc::RTCRtpTransceiverInit + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCRtpTransceiverInit, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiverInit, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::RtpTransceiverInit, NativeType); + + RTCRtpTransceiverInitWeakPtr thisWeak_; + + RTCRtpTransceiverInit() noexcept; + virtual ~RTCRtpTransceiverInit() noexcept; + void wrapper_init_org_webRtc_RTCRtpTransceiverInit() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypePtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.cpp new file mode 100644 index 00000000..f1de2fc7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.cpp @@ -0,0 +1,158 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::RTCSenderAudioTrackAttachmentStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSenderAudioTrackAttachmentStatsPtr wrapper::org::webRtc::RTCSenderAudioTrackAttachmentStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::~RTCSenderAudioTrackAttachmentStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_audioLevel() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_totalAudioEnergy() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_voiceActivityFlag() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_totalSamplesDuration() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_echoReturnLoss() noexcept +{ + Optional< double > result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< double > wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_echoReturnLossEnhancement() noexcept +{ + Optional< double > result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats::get_totalSamplesSent() noexcept +{ + unsigned long long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.h new file mode 100644 index 00000000..c62f5689 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderAudioTrackAttachmentStats.h @@ -0,0 +1,53 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCSenderAudioTrackAttachmentStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCSenderAudioTrackAttachmentStats : public wrapper::org::webRtc::RTCSenderAudioTrackAttachmentStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCSenderAudioTrackAttachmentStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSenderAudioTrackAttachmentStats, WrapperImplType); + RTCSenderAudioTrackAttachmentStatsWeakPtr thisWeak_; + + RTCSenderAudioTrackAttachmentStats() noexcept; + virtual ~RTCSenderAudioTrackAttachmentStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCAudioHandlerStats + double get_audioLevel() noexcept override; + double get_totalAudioEnergy() noexcept override; + bool get_voiceActivityFlag() noexcept override; + double get_totalSamplesDuration() noexcept override; + + // properties RTCAudioSenderStats + Optional< double > get_echoReturnLoss() noexcept override; + Optional< double > get_echoReturnLossEnhancement() noexcept override; + unsigned long long get_totalSamplesSent() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.cpp new file mode 100644 index 00000000..52f573c7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.cpp @@ -0,0 +1,158 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::RTCSenderVideoTrackAttachmentStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSenderVideoTrackAttachmentStatsPtr wrapper::org::webRtc::RTCSenderVideoTrackAttachmentStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::~RTCSenderVideoTrackAttachmentStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_frameWidth() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_frameHeight() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_framesPerSecond() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_framesCaptured() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_framesSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_hugeFramesSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats::get_keyFramesSent() noexcept +{ + unsigned long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.h new file mode 100644 index 00000000..abf596c3 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSenderVideoTrackAttachmentStats.h @@ -0,0 +1,53 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCSenderVideoTrackAttachmentStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCSenderVideoTrackAttachmentStats : public wrapper::org::webRtc::RTCSenderVideoTrackAttachmentStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCSenderVideoTrackAttachmentStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSenderVideoTrackAttachmentStats, WrapperImplType); + RTCSenderVideoTrackAttachmentStatsWeakPtr thisWeak_; + + RTCSenderVideoTrackAttachmentStats() noexcept; + virtual ~RTCSenderVideoTrackAttachmentStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCVideoHandlerStats + unsigned long get_frameWidth() noexcept override; + unsigned long get_frameHeight() noexcept override; + double get_framesPerSecond() noexcept override; + + // properties RTCVideoSenderStats + unsigned long get_framesCaptured() noexcept override; + unsigned long get_framesSent() noexcept override; + unsigned long get_hugeFramesSent() noexcept override; + unsigned long get_keyFramesSent() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSentRtpStreamStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCSentRtpStreamStats.cpp new file mode 100644 index 00000000..3e3b58c6 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSentRtpStreamStats.cpp @@ -0,0 +1,177 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCSentRtpStreamStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSentRtpStreamStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSentRtpStreamStats::RTCSentRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSentRtpStreamStatsPtr wrapper::org::webRtc::RTCSentRtpStreamStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSentRtpStreamStats::~RTCSentRtpStreamStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< uint32_t > wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_ssrc() noexcept +{ + Optional< uint32_t > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_transportId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_codecId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_firCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_pliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_nackCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_sliCount() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_qpSum() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCSentRtpStreamStats::wrapper_init_org_webRtc_RTCSentRtpStreamStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_packetsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_packetsDiscardedOnSend() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_fecPacketsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_bytesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCSentRtpStreamStats::get_bytesDiscardedOnSend() noexcept +{ + unsigned long long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSentRtpStreamStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCSentRtpStreamStats.h new file mode 100644 index 00000000..f864e554 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSentRtpStreamStats.h @@ -0,0 +1,56 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCSentRtpStreamStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCSentRtpStreamStats : public wrapper::org::webRtc::RTCSentRtpStreamStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCSentRtpStreamStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSentRtpStreamStats, WrapperImplType); + RTCSentRtpStreamStatsWeakPtr thisWeak_; + + RTCSentRtpStreamStats() noexcept; + virtual ~RTCSentRtpStreamStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCRtpStreamStats + Optional< uint32_t > get_ssrc() noexcept override; + String get_kind() noexcept override; + String get_transportId() noexcept override; + String get_codecId() noexcept override; + unsigned long get_firCount() noexcept override; + unsigned long get_pliCount() noexcept override; + unsigned long get_nackCount() noexcept override; + unsigned long get_sliCount() noexcept override; + unsigned long long get_qpSum() noexcept override; + + // methods RTCSentRtpStreamStats + void wrapper_init_org_webRtc_RTCSentRtpStreamStats() noexcept override; + + // properties RTCSentRtpStreamStats + unsigned long get_packetsSent() noexcept override; + unsigned long get_packetsDiscardedOnSend() noexcept override; + unsigned long get_fecPacketsSent() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesDiscardedOnSend() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescription.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescription.cpp new file mode 100644 index 00000000..49e4c128 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescription.cpp @@ -0,0 +1,160 @@ + +#include "impl_org_webRtc_RTCSessionDescription.h" +#include "impl_org_webRtc_RTCSessionDescriptionInit.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_RTCError.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/jsep.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescription::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError, UseError); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::UseSessionDescriptionInit, UseSessionDescriptionInit); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSessionDescription::RTCSessionDescription() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionPtr wrapper::org::webRtc::RTCSessionDescription::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSessionDescription::~RTCSessionDescription() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCSessionDescription::wrapper_init_org_webRtc_RTCSessionDescription(wrapper::org::webRtc::RTCSessionDescriptionInitPtr init) noexcept(false) +{ + if (!init) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INVALID_PARAMETER); + throw UseError::toWrapper(error); + } + + if (init->sdp.isEmpty()) { + ::webrtc::RTCError error(::webrtc::RTCErrorType::INVALID_PARAMETER); + throw UseError::toWrapper(error); + } + + ::webrtc::SdpParseError sdpError; + auto native = ::webrtc::CreateSessionDescription(UseEnum::toNative(init->type), init->sdp, &sdpError); + if (!native) { + String message = "line= " + sdpError.line + " description=" + sdpError.description; + ::webrtc::RTCError error(::webrtc::RTCErrorType::INVALID_PARAMETER, message); + throw UseError::toWrapper(error); + } + + native_ = std::move(native); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSdpType wrapper::impl::org::webRtc::RTCSessionDescription::get_sdpType() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::RTCSdpType::RTCSdpType_rollback; + return UseEnum::toWrapper(native_->GetType()); +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCSessionDescription::get_sdp() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return String(); + + String result; + native_->ToString(&result); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + String sdp; + native.ToString(&sdp); + if (sdp.isEmpty()) return WrapperImplTypePtr(); + + ::webrtc::SdpParseError error; + auto cloned = ::webrtc::CreateSessionDescription(native.GetType(), sdp, &error); + if (!cloned) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = std::move(cloned); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const UseSessionDescriptionInit &value) noexcept +{ + ::webrtc::SdpParseError error; + auto native = ::webrtc::CreateSessionDescription(UseEnum::toNative(value.type), value.sdp, &error); + + if (!native) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = std::move(native); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseSessionDescriptionInitPtr value) noexcept +{ + if (!value) return WrapperImplTypePtr(); + return toWrapper(*value); +} + +//------------------------------------------------------------------------------ +NativeTypeUniPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeUniPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeUniPtr(); + + if (!converted->native_) return NativeTypeUniPtr(); + + String sdp; + converted->native_->ToString(&sdp); + if (sdp.isEmpty()) return NativeTypeUniPtr(); + + ::webrtc::SdpParseError error; + return std::move(::webrtc::CreateSessionDescription(converted->native_->GetType(), sdp, &error)); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescription.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescription.h new file mode 100644 index 00000000..736374c6 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescription.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCSessionDescription.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCSessionDescription : public wrapper::org::webRtc::RTCSessionDescription + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCSessionDescription, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescription, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::SessionDescriptionInterface, NativeType); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescriptionInit, UseSessionDescriptionInit); + + NativeTypeUniPtr native_; + RTCSessionDescriptionWeakPtr thisWeak_; + + RTCSessionDescription() noexcept; + virtual ~RTCSessionDescription() noexcept; + + + // methods RTCSessionDescription + void wrapper_init_org_webRtc_RTCSessionDescription(wrapper::org::webRtc::RTCSessionDescriptionInitPtr init) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + + // properties RTCSessionDescription + wrapper::org::webRtc::RTCSdpType get_sdpType() noexcept override; + String get_sdp() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType *native) noexcept; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const UseSessionDescriptionInit &value) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseSessionDescriptionInitPtr value) noexcept; + + ZS_NO_DISCARD() static NativeTypeUniPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescriptionInit.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescriptionInit.cpp new file mode 100644 index 00000000..b9c06a80 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescriptionInit.cpp @@ -0,0 +1,50 @@ + +#include "impl_org_webRtc_RTCSessionDescriptionInit.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescriptionInit::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSessionDescriptionInit::RTCSessionDescriptionInit() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCSessionDescriptionInitPtr wrapper::org::webRtc::RTCSessionDescriptionInit::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCSessionDescriptionInit::~RTCSessionDescriptionInit() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCSessionDescriptionInit::wrapper_init_org_webRtc_RTCSessionDescriptionInit() noexcept +{ +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescriptionInit.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescriptionInit.h new file mode 100644 index 00000000..ff5a2f36 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCSessionDescriptionInit.h @@ -0,0 +1,29 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCSessionDescriptionInit.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCSessionDescriptionInit : public wrapper::org::webRtc::RTCSessionDescriptionInit + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCSessionDescriptionInit, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCSessionDescriptionInit, WrapperImplType); + RTCSessionDescriptionInitWeakPtr thisWeak_; + + RTCSessionDescriptionInit() noexcept; + virtual ~RTCSessionDescriptionInit() noexcept; + + void wrapper_init_org_webRtc_RTCSessionDescriptionInit() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCStats.cpp new file mode 100644 index 00000000..fc5537cb --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStats.cpp @@ -0,0 +1,74 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStats::RTCStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCStatsPtr wrapper::org::webRtc::RTCStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStats::~RTCStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCStats::get_id() noexcept +{ + String result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCStats.h new file mode 100644 index 00000000..5de1c72b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStats.h @@ -0,0 +1,35 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCStats : public wrapper::org::webRtc::RTCStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStats, WrapperImplType); + RTCStatsWeakPtr thisWeak_; + + RTCStats() noexcept; + virtual ~RTCStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsProvider.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsProvider.cpp new file mode 100644 index 00000000..5563132c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsProvider.cpp @@ -0,0 +1,39 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCStatsProvider.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStatsProvider::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStatsProvider::~RTCStatsProvider() noexcept +{ +} + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > wrapper::impl::org::webRtc::RTCStatsProvider::getStats(wrapper::org::webRtc::RTCStatsTypeSetPtr statTypes) noexcept(false) +{ + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsProvider.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsProvider.h new file mode 100644 index 00000000..bb6d5af4 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsProvider.h @@ -0,0 +1,31 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCStatsProvider.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCStatsProvider : public wrapper::org::webRtc::RTCStatsProvider + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCStatsProvider, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStatsProvider, WrapperImplType); + RTCStatsProvider() noexcept = delete; + RTCStatsProvider(const RTCStatsProvider &) noexcept = delete; + virtual ~RTCStatsProvider() noexcept; + + + // methods RTCStatsProvider + shared_ptr< PromiseWithHolderPtr< wrapper::org::webRtc::RTCStatsReportPtr > > getStats(wrapper::org::webRtc::RTCStatsTypeSetPtr statTypes) noexcept(false) override; // throws wrapper::org::webRtc::RTCErrorPtr + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsReport.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsReport.cpp new file mode 100644 index 00000000..f1350ec8 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsReport.cpp @@ -0,0 +1,67 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCStatsReport.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStatsReport::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStatsReport::RTCStatsReport() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCStatsReportPtr wrapper::org::webRtc::RTCStatsReport::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStatsReport::~RTCStatsReport() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCStatsPtr wrapper::impl::org::webRtc::RTCStatsReport::getStats(String id) noexcept +{ + wrapper::org::webRtc::RTCStatsPtr result {}; + return result; +} + +//------------------------------------------------------------------------------ +uint64_t wrapper::impl::org::webRtc::RTCStatsReport::get_objectId() noexcept +{ + uint64_t result {}; + return result; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< String > > wrapper::impl::org::webRtc::RTCStatsReport::get_statsIds() noexcept +{ + shared_ptr< list< String > > result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsReport.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsReport.h new file mode 100644 index 00000000..eac0b01e --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsReport.h @@ -0,0 +1,36 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCStatsReport.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCStatsReport : public wrapper::org::webRtc::RTCStatsReport + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCStatsReport, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStatsReport, WrapperImplType); + RTCStatsReportWeakPtr thisWeak_; + + RTCStatsReport() noexcept; + virtual ~RTCStatsReport() noexcept; + + + // methods RTCStatsReport + wrapper::org::webRtc::RTCStatsPtr getStats(String id) noexcept override; + + // properties RTCStatsReport + uint64_t get_objectId() noexcept override; + shared_ptr< list< String > > get_statsIds() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsTypeSet.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsTypeSet.cpp new file mode 100644 index 00000000..67635fc2 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsTypeSet.cpp @@ -0,0 +1,63 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCStatsTypeSet.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStatsTypeSet::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStatsTypeSet::RTCStatsTypeSet() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCStatsTypeSetPtr wrapper::org::webRtc::RTCStatsTypeSet::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCStatsTypeSet::~RTCStatsTypeSet() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCStatsTypeSet::wrapper_init_org_webRtc_RTCStatsTypeSet() noexcept +{ +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCStatsTypeSet::wrapper_init_org_webRtc_RTCStatsTypeSet(shared_ptr< set< wrapper::org::webRtc::RTCStatsType > > values) noexcept +{ +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCStatsTypeSet::hasStatType(wrapper::org::webRtc::RTCStatsType type) noexcept +{ + bool result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsTypeSet.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsTypeSet.h new file mode 100644 index 00000000..48e164c7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCStatsTypeSet.h @@ -0,0 +1,34 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCStatsTypeSet.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCStatsTypeSet : public wrapper::org::webRtc::RTCStatsTypeSet + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCStatsTypeSet, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCStatsTypeSet, WrapperImplType); + RTCStatsTypeSetWeakPtr thisWeak_; + + RTCStatsTypeSet() noexcept; + virtual ~RTCStatsTypeSet() noexcept; + + + // methods RTCStatsTypeSet + void wrapper_init_org_webRtc_RTCStatsTypeSet() noexcept override; + void wrapper_init_org_webRtc_RTCStatsTypeSet(shared_ptr< set< wrapper::org::webRtc::RTCStatsType > > values) noexcept override; + bool hasStatType(wrapper::org::webRtc::RTCStatsType type) noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCTrackEvent.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCTrackEvent.cpp new file mode 100644 index 00000000..599a9834 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCTrackEvent.cpp @@ -0,0 +1,107 @@ + +#include "impl_org_webRtc_RTCTrackEvent.h" +#include "impl_org_webRtc_RTCRtpReceiver.h" +#include "impl_org_webRtc_MediaStreamTrack.h" +#include "impl_org_webRtc_RTCRtpTransceiver.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCTrackEvent::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::UseRtpReceiver, UseRtpReceiver); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::UseMediaStreamTrack, UseMediaStreamTrack); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::UseRtpTransceiver, UseRtpTransceiver); + + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCTrackEvent::RTCTrackEvent() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCTrackEventPtr wrapper::org::webRtc::RTCTrackEvent::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCTrackEvent::~RTCTrackEvent() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpReceiverPtr wrapper::impl::org::webRtc::RTCTrackEvent::get_receiver() noexcept +{ + return receiver_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaStreamTrackPtr wrapper::impl::org::webRtc::RTCTrackEvent::get_track() noexcept +{ + return track_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCRtpTransceiverPtr wrapper::impl::org::webRtc::RTCTrackEvent::get_transceiver() noexcept +{ + return transceiver_; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseRtpReceiverPtr value) noexcept +{ + if (!value) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + result->receiver_ = value; + if (value) { + result->track_ = value->get_track(); + } + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseMediaStreamTrackPtr value) noexcept +{ + if (!value) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + result->track_ = value; + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(UseRtpTransceiverPtr value) noexcept +{ + if (!value) return WrapperImplTypePtr(); + auto result = make_shared(); + result->thisWeak_ = result; + result->transceiver_ = value; + if (value) { + result->receiver_ = value->get_receiver(); + if (result->receiver_) { + result->track_ = result->receiver_->get_track(); + } + } + return result; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCTrackEvent.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCTrackEvent.h new file mode 100644 index 00000000..3d25f44c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCTrackEvent.h @@ -0,0 +1,45 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCTrackEvent.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCTrackEvent : public wrapper::org::webRtc::RTCTrackEvent + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCTrackEvent, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCTrackEvent, WrapperImplType); + + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpReceiver, UseRtpReceiver); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaStreamTrack, UseMediaStreamTrack); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCRtpTransceiver, UseRtpTransceiver); + + wrapper::org::webRtc::RTCRtpReceiverPtr receiver_; + wrapper::org::webRtc::MediaStreamTrackPtr track_; + wrapper::org::webRtc::RTCRtpTransceiverPtr transceiver_; + RTCTrackEventWeakPtr thisWeak_; + + RTCTrackEvent() noexcept; + virtual ~RTCTrackEvent() noexcept; + + + // properties RTCTrackEvent + wrapper::org::webRtc::RTCRtpReceiverPtr get_receiver() noexcept override; + wrapper::org::webRtc::MediaStreamTrackPtr get_track() noexcept override; + wrapper::org::webRtc::RTCRtpTransceiverPtr get_transceiver() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseRtpReceiverPtr value) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(UseMediaStreamTrackPtr value) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(RTCRtpTransceiverPtr value) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCTransportStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCTransportStats.cpp new file mode 100644 index 00000000..7dfc8ffc --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCTransportStats.cpp @@ -0,0 +1,158 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCTransportStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCTransportStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCTransportStats::RTCTransportStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCTransportStatsPtr wrapper::org::webRtc::RTCTransportStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCTransportStats::~RTCTransportStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCTransportStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCTransportStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCTransportStats::get_packetsSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCTransportStats::get_packetsReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCTransportStats::get_bytesSent() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCTransportStats::get_bytesReceived() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_rtcpTransportStatsId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCIceRole > wrapper::impl::org::webRtc::RTCTransportStats::get_iceRole() noexcept +{ + Optional< wrapper::org::webRtc::RTCIceRole > result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCDtlsTransportState wrapper::impl::org::webRtc::RTCTransportStats::get_dtlsState() noexcept +{ + wrapper::org::webRtc::RTCDtlsTransportState result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_selectedCandidatePairId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_localCertificateId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_remoteCertificateId() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_dtlsCipher() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCTransportStats::get_srtpCipher() noexcept +{ + String result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCTransportStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCTransportStats.h new file mode 100644 index 00000000..aecb86db --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCTransportStats.h @@ -0,0 +1,49 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCTransportStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCTransportStats : public wrapper::org::webRtc::RTCTransportStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCTransportStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCTransportStats, WrapperImplType); + RTCTransportStatsWeakPtr thisWeak_; + + RTCTransportStats() noexcept; + virtual ~RTCTransportStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCTransportStats + unsigned long get_packetsSent() noexcept override; + unsigned long get_packetsReceived() noexcept override; + unsigned long long get_bytesSent() noexcept override; + unsigned long long get_bytesReceived() noexcept override; + String get_rtcpTransportStatsId() noexcept override; + Optional< wrapper::org::webRtc::RTCIceRole > get_iceRole() noexcept override; + wrapper::org::webRtc::RTCDtlsTransportState get_dtlsState() noexcept override; + String get_selectedCandidatePairId() noexcept override; + String get_localCertificateId() noexcept override; + String get_remoteCertificateId() noexcept override; + String get_dtlsCipher() noexcept override; + String get_srtpCipher() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoHandlerStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoHandlerStats.cpp new file mode 100644 index 00000000..c7b2256d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoHandlerStats.cpp @@ -0,0 +1,135 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCVideoHandlerStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCVideoHandlerStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCVideoHandlerStats::RTCVideoHandlerStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCVideoHandlerStatsPtr wrapper::org::webRtc::RTCVideoHandlerStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCVideoHandlerStats::~RTCVideoHandlerStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::RTCVideoHandlerStats::wrapper_init_org_webRtc_RTCVideoHandlerStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_frameWidth() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_frameHeight() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCVideoHandlerStats::get_framesPerSecond() noexcept +{ + double result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoHandlerStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoHandlerStats.h new file mode 100644 index 00000000..b4b45198 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoHandlerStats.h @@ -0,0 +1,48 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCVideoHandlerStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCVideoHandlerStats : public wrapper::org::webRtc::RTCVideoHandlerStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCVideoHandlerStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCVideoHandlerStats, WrapperImplType); + RTCVideoHandlerStatsWeakPtr thisWeak_; + + RTCVideoHandlerStats() noexcept; + virtual ~RTCVideoHandlerStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + void wrapper_init_org_webRtc_RTCVideoHandlerStats() noexcept override; + + // properties RTCVideoHandlerStats + unsigned long get_frameWidth() noexcept override; + unsigned long get_frameHeight() noexcept override; + double get_framesPerSecond() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoReceiverStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoReceiverStats.cpp new file mode 100644 index 00000000..19c7a8fa --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoReceiverStats.cpp @@ -0,0 +1,193 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCVideoReceiverStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCVideoReceiverStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCVideoReceiverStats::RTCVideoReceiverStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCVideoReceiverStatsPtr wrapper::org::webRtc::RTCVideoReceiverStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCVideoReceiverStats::~RTCVideoReceiverStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_frameWidth() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_frameHeight() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_framesPerSecond() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_estimatedPlayoutTimestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_jitterBufferDelay() noexcept +{ + ::zsLib::Milliseconds result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_jitterBufferEmittedCount() noexcept +{ + unsigned long long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_framesReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_keyFramesReceived() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_framesDecoded() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_framesDropped() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_partialFramesLost() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoReceiverStats::get_fullFramesLost() noexcept +{ + unsigned long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoReceiverStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoReceiverStats.h new file mode 100644 index 00000000..882aed37 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoReceiverStats.h @@ -0,0 +1,58 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCVideoReceiverStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCVideoReceiverStats : public wrapper::org::webRtc::RTCVideoReceiverStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCVideoReceiverStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCVideoReceiverStats, WrapperImplType); + RTCVideoReceiverStatsWeakPtr thisWeak_; + + RTCVideoReceiverStats() noexcept; + virtual ~RTCVideoReceiverStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCVideoHandlerStats + unsigned long get_frameWidth() noexcept override; + unsigned long get_frameHeight() noexcept override; + double get_framesPerSecond() noexcept override; + + // properties RTCVideoReceiverStats + ::zsLib::Time get_estimatedPlayoutTimestamp() noexcept override; + ::zsLib::Milliseconds get_jitterBufferDelay() noexcept override; + unsigned long long get_jitterBufferEmittedCount() noexcept override; + unsigned long get_framesReceived() noexcept override; + unsigned long get_keyFramesReceived() noexcept override; + unsigned long get_framesDecoded() noexcept override; + unsigned long get_framesDropped() noexcept override; + unsigned long get_partialFramesLost() noexcept override; + unsigned long get_fullFramesLost() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoSenderStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoSenderStats.cpp new file mode 100644 index 00000000..2ebc822c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoSenderStats.cpp @@ -0,0 +1,158 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_RTCVideoSenderStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCVideoSenderStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCVideoSenderStats::RTCVideoSenderStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCVideoSenderStatsPtr wrapper::org::webRtc::RTCVideoSenderStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::RTCVideoSenderStats::~RTCVideoSenderStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +::zsLib::Time wrapper::impl::org::webRtc::RTCVideoSenderStats::get_timestamp() noexcept +{ + ::zsLib::Time result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::RTCStatsType > wrapper::impl::org::webRtc::RTCVideoSenderStats::get_statsType() noexcept +{ + Optional< wrapper::org::webRtc::RTCStatsType > result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoSenderStats::get_statsTypeOther() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoSenderStats::get_id() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoSenderStats::get_trackIdentifier() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::RTCVideoSenderStats::get_remoteSource() noexcept +{ + Optional< bool > result {}; + return result; +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::RTCVideoSenderStats::get_ended() noexcept +{ + bool result {}; + return result; +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::RTCVideoSenderStats::get_kind() noexcept +{ + String result {}; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::RTCPriorityType wrapper::impl::org::webRtc::RTCVideoSenderStats::get_priority() noexcept +{ + wrapper::org::webRtc::RTCPriorityType result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoSenderStats::get_frameWidth() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoSenderStats::get_frameHeight() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +double wrapper::impl::org::webRtc::RTCVideoSenderStats::get_framesPerSecond() noexcept +{ + double result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoSenderStats::get_framesCaptured() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoSenderStats::get_framesSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoSenderStats::get_hugeFramesSent() noexcept +{ + unsigned long result {}; + return result; +} + +//------------------------------------------------------------------------------ +unsigned long wrapper::impl::org::webRtc::RTCVideoSenderStats::get_keyFramesSent() noexcept +{ + unsigned long result {}; + return result; +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoSenderStats.h b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoSenderStats.h new file mode 100644 index 00000000..c4e2634b --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_RTCVideoSenderStats.h @@ -0,0 +1,53 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_RTCVideoSenderStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct RTCVideoSenderStats : public wrapper::org::webRtc::RTCVideoSenderStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::RTCVideoSenderStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCVideoSenderStats, WrapperImplType); + RTCVideoSenderStatsWeakPtr thisWeak_; + + RTCVideoSenderStats() noexcept; + virtual ~RTCVideoSenderStats() noexcept; + + + // properties RTCStats + ::zsLib::Time get_timestamp() noexcept override; + Optional< wrapper::org::webRtc::RTCStatsType > get_statsType() noexcept override; + String get_statsTypeOther() noexcept override; + String get_id() noexcept override; + + // properties RTCMediaHandlerStats + String get_trackIdentifier() noexcept override; + Optional< bool > get_remoteSource() noexcept override; + bool get_ended() noexcept override; + String get_kind() noexcept override; + wrapper::org::webRtc::RTCPriorityType get_priority() noexcept override; + + // properties RTCVideoHandlerStats + unsigned long get_frameWidth() noexcept override; + unsigned long get_frameHeight() noexcept override; + double get_framesPerSecond() noexcept override; + + // properties RTCVideoSenderStats + unsigned long get_framesCaptured() noexcept override; + unsigned long get_framesSent() noexcept override; + unsigned long get_hugeFramesSent() noexcept override; + unsigned long get_keyFramesSent() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturer.cpp b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturer.cpp new file mode 100644 index 00000000..5b970b8d --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturer.cpp @@ -0,0 +1,408 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#endif //WINUWP + +#include "impl_org_webRtc_VideoCapturer.h" +#include "impl_org_webRtc_VideoFormat.h" +#include "impl_org_webRtc_RTCError.h" +#include "impl_org_webRtc_VideoDeviceInfo.h" +#include "impl_org_webRtc_WebrtcLib.h" +#include "impl_org_webRtc_enums.h" +#include "impl_org_webRtc_VideoCapturerInputSize.h" + +#include "impl_org_webRtc_pre_include.h" +#ifdef WINUWP +#include "media/engine/webrtcvideocapturer.h" +#endif //WINUWP +#include "api/rtcerror.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +#ifdef WINUWP +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt +#endif //WINUWP + + +// borrow types from call defintions +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturer::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturer::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturer::NativeType, NativeType); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::RTCError, UseError); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoDeviceInfo, UseVideoDeviceInfo); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoFormat, UseVideoFormat); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturerInputSize, UseVideoCapturerInputSize); + + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoCapturer::VideoCapturer() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoCapturerPtr wrapper::org::webRtc::VideoCapturer::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoCapturer::~VideoCapturer() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoCapturer::wrapper_dispose() noexcept +{ + if (!native_) return; + + if (!stopCalled_.exchange(true)) { + native_->Stop(); + } + native_.reset(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoCapturerPtr wrapper::org::webRtc::VideoCapturer::create( + String name, + String id + ) noexcept +{ + auto factory = UseWebrtcLib::videoDeviceCaptureFactory(); + if (!factory) return WrapperTypePtr(); + + ::cricket::Device device(name, id); + auto native = factory->Create(device); + if (!native) return WrapperTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = std::move(native); + return result; +} + +static bool alwaysTrue() { return true; } + +//------------------------------------------------------------------------------ +shared_ptr< PromiseWithHolderPtr< shared_ptr< list< wrapper::org::webRtc::VideoDeviceInfoPtr > > > > wrapper::org::webRtc::VideoCapturer::getDevices() noexcept +{ + typedef shared_ptr< PromiseWithHolderPtr< shared_ptr< list< wrapper::org::webRtc::VideoDeviceInfoPtr > > > > ResultType; + typedef shared_ptr< list< wrapper::org::webRtc::VideoDeviceInfoPtr > > ResultListType; + + auto delegateQueue = UseWebrtcLib::delegateQueue(); + if (!delegateQueue) { + auto failedResult = ResultType::element_type::create(); + UseError::rejectPromise(failedResult, ::webrtc::RTCError(::webrtc::RTCErrorType::INVALID_STATE)); + return failedResult; + } + + auto promise = ResultType::element_type::create(delegateQueue); + +#ifdef WINUWP + +#ifdef CPPWINRT_VERSION + if (alwaysTrue()) { + //auto results = winrt::Windows::Devices::Enumeration::DeviceInformation::FindAllAsync(); + //co_await results; + delegateQueue->postClosure([promise]() { + + auto asyncResults = winrt::Windows::Devices::Enumeration::DeviceInformation::FindAllAsync(winrt::Windows::Devices::Enumeration::DeviceClass::VideoCapture); + + asyncResults.Completed([promise](auto &&asyncResults, ZS_MAYBE_USED() winrt::Windows::Foundation::AsyncStatus status) { + auto results = asyncResults.GetResults(); + ZS_MAYBE_USED(status); + auto output = make_shared(); + for (auto device : results) { + auto wrapper = UseVideoDeviceInfo::toWrapper(device); + if (!wrapper) continue; + output->push_back(wrapper); + } + promise->resolve(output); + }); + }); + return promise; + } +#endif // CPPWINRT_VERSION + +#ifdef __cplusplus_winrt + if (alwaysTrue()) { + delegateQueue->postClosure([promise]() { + + concurrency::create_task(Windows::Devices::Enumeration::DeviceInformation::FindAllAsync(Windows::Devices::Enumeration::DeviceClass::VideoCapture)).then([promise](Windows::Devices::Enumeration::DeviceInformationCollection^ devices) { + + auto output = make_shared(); + for (decltype(devices->Size) i = 0; i < devices->Size; i++) + { + Windows::Devices::Enumeration::DeviceInformation^ device = devices->GetAt(i); + auto wrapper = UseVideoDeviceInfo::toWrapper(device); + if (!wrapper) continue; + output->push_back(wrapper); + } + + promise->resolve(output); + }); + }); + return promise; + } +#endif //__cplusplus_winrt + +#endif //WINUWP + + UseError::rejectPromise(promise, ::webrtc::RTCError(::webrtc::RTCErrorType::RESOURCE_EXHAUSTED)); + return promise; +} + +//------------------------------------------------------------------------------ +shared_ptr< list< wrapper::org::webRtc::VideoFormatPtr > > wrapper::impl::org::webRtc::VideoCapturer::getSupportedFormats() noexcept +{ + typedef shared_ptr< list< wrapper::org::webRtc::VideoFormatPtr > > ResultType; + ResultType result = make_shared< ResultType::element_type >(); + + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return result; + } + + auto formats = native_->GetSupportedFormats(); + if (!formats) return result; + + for (auto iter = formats->begin(); iter != formats->end(); ++iter) { + auto converted = UseVideoFormat::toWrapper(*iter); + if (!converted) continue; + result->push_back(converted); + } + + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoFormatPtr wrapper::impl::org::webRtc::VideoCapturer::getBestCaptureFormat(wrapper::org::webRtc::VideoFormatPtr desired) noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return wrapper::org::webRtc::VideoFormatPtr(); + } + + ZS_ASSERT(desired); + if (!desired) return wrapper::org::webRtc::VideoFormatPtr(); + + auto converted = UseVideoFormat::toNative(desired); + ZS_ASSERT(converted); + if (!converted) return wrapper::org::webRtc::VideoFormatPtr(); + + ::cricket::VideoFormat format; + if (!native_->GetBestCaptureFormat(*converted, &format)) return wrapper::org::webRtc::VideoFormatPtr(); + + return UseVideoFormat::toWrapper(format); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoCaptureState wrapper::impl::org::webRtc::VideoCapturer::start(wrapper::org::webRtc::VideoFormatPtr captureFormat) noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_failed; + } + + ZS_ASSERT(captureFormat); + if (!captureFormat) return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_failed; + + auto converted = UseVideoFormat::toNative(captureFormat); + ZS_ASSERT(converted); + if (!converted) return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_failed; + + return UseEnum::toWrapper(native_->Start(*converted)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoFormatPtr wrapper::impl::org::webRtc::VideoCapturer::getCaptureFormat() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return wrapper::org::webRtc::VideoFormatPtr(); + } + + return UseVideoFormat::toWrapper(native_->GetCaptureFormat()); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoCapturer::stop() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return; + } + stopCalled_ = true; + native_->Stop(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoCapturer::constrainSupportedFormats(wrapper::org::webRtc::VideoFormatPtr maxFormat) noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return; + } +} + +//------------------------------------------------------------------------------ +String wrapper::impl::org::webRtc::VideoCapturer::get_id() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return String(); + } + return native_->GetId(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoCapturer::get_enableCameraList() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return false; + } + return native_->enable_camera_list(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoCapturer::set_enableCameraList(bool value) noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return; + } + return native_->set_enable_camera_list(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoCapturer::get_enableVideoAdapter() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return false; + } + return native_->enable_video_adapter(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoCapturer::set_enableVideoAdapter(bool value) noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return; + } + native_->set_enable_video_adapter(value); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoCapturer::get_isRunning() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return false; + } + return native_->IsRunning(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoCapturer::get_applyRotation() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return false; + } + return native_->apply_rotation(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoCapturer::get_isScreencast() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return false; + } + return native_->IsScreencast(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoCapturerInputSizePtr wrapper::impl::org::webRtc::VideoCapturer::get_inputSize() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return wrapper::org::webRtc::VideoCapturerInputSizePtr(); + } + + int width{}; + int height{}; + if (!native_->GetInputSize(&width, &height)) return wrapper::org::webRtc::VideoCapturerInputSizePtr(); + + return UseVideoCapturerInputSize::toWrapper(width, height); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoCaptureState wrapper::impl::org::webRtc::VideoCapturer::get_state() noexcept +{ + if (!native_) { + ZS_ASSERT_FAIL("Cannot call into VideoCapturer after VideoCapturer has been passed into to a VideoTrackSource."); + return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_failed; + } + return UseEnum::toWrapper(native_->capture_state()); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeUniPtr native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = std::move(native); + return result; +} + +//------------------------------------------------------------------------------ +NativeTypeUniPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeUniPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeUniPtr(); + return NativeTypeUniPtr(std::move(converted->native_)); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturer.h b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturer.h new file mode 100644 index 00000000..c2894a04 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturer.h @@ -0,0 +1,61 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_VideoCapturer.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "media/base/videocapturer.h" +#include "impl_org_webRtc_post_include.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct VideoCapturer : public wrapper::org::webRtc::VideoCapturer + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::VideoCapturer, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturer, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::cricket::VideoCapturer, NativeType); + + std::atomic_bool stopCalled_{}; + NativeTypeUniPtr native_; + VideoCapturerWeakPtr thisWeak_; + + VideoCapturer() noexcept; + virtual ~VideoCapturer() noexcept; + void wrapper_dispose() noexcept override; + + + // methods VideoCapturer + shared_ptr< list< wrapper::org::webRtc::VideoFormatPtr > > getSupportedFormats() noexcept override; + wrapper::org::webRtc::VideoFormatPtr getBestCaptureFormat(wrapper::org::webRtc::VideoFormatPtr desired) noexcept override; + wrapper::org::webRtc::VideoCaptureState start(wrapper::org::webRtc::VideoFormatPtr captureFormat) noexcept override; + wrapper::org::webRtc::VideoFormatPtr getCaptureFormat() noexcept override; + void stop() noexcept override; + void constrainSupportedFormats(wrapper::org::webRtc::VideoFormatPtr maxFormat) noexcept override; + + // properties VideoCapturer + String get_id() noexcept override; + bool get_enableCameraList() noexcept override; + void set_enableCameraList(bool value) noexcept override; + bool get_enableVideoAdapter() noexcept override; + void set_enableVideoAdapter(bool value) noexcept override; + bool get_isRunning() noexcept override; + bool get_applyRotation() noexcept override; + bool get_isScreencast() noexcept override; + wrapper::org::webRtc::VideoCapturerInputSizePtr get_inputSize() noexcept override; + wrapper::org::webRtc::VideoCaptureState get_state() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeUniPtr native) noexcept; + ZS_NO_DISCARD() static NativeTypeUniPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturerInputSize.cpp b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturerInputSize.cpp new file mode 100644 index 00000000..fc8a2098 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturerInputSize.cpp @@ -0,0 +1,60 @@ + +#include "impl_org_webRtc_VideoCapturerInputSize.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturerInputSize::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoCapturerInputSize::VideoCapturerInputSize() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoCapturerInputSizePtr wrapper::org::webRtc::VideoCapturerInputSize::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoCapturerInputSize::~VideoCapturerInputSize() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoCapturerInputSize::wrapper_init_org_webRtc_VideoCapturerInputSize() noexcept +{ +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(int width, int height) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->width = SafeIntwidth)>(width); + result->height = SafeIntheight)>(height); + return result; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturerInputSize.h b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturerInputSize.h new file mode 100644 index 00000000..5b299036 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoCapturerInputSize.h @@ -0,0 +1,30 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_VideoCapturerInputSize.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct VideoCapturerInputSize : public wrapper::org::webRtc::VideoCapturerInputSize + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::VideoCapturerInputSize, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturerInputSize, WrapperImplType); + VideoCapturerInputSizeWeakPtr thisWeak_; + + VideoCapturerInputSize() noexcept; + virtual ~VideoCapturerInputSize() noexcept; + void wrapper_init_org_webRtc_VideoCapturerInputSize() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(int width, int height) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoDeviceInfo.cpp b/webrtc/idl/wrapper/impl_org_webRtc_VideoDeviceInfo.cpp new file mode 100644 index 00000000..db15acf2 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoDeviceInfo.cpp @@ -0,0 +1,174 @@ + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#endif //WINUWP + +#include "impl_org_webRtc_VideoDeviceInfo.h" +#include "impl_org_webRtc_helpers.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoDeviceInfo::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(VideoDeviceInfoWrapperAnyCx); + + struct VideoDeviceInfoWrapperAnyCx : Any + { + Windows::Devices::Enumeration::DeviceInformation^ info_ {nullptr}; + }; +} } } } + +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(VideoDeviceInfoWrapperAnyWinrt); + + struct VideoDeviceInfoWrapperAnyWinrt : Any + { + winrt::Windows::Devices::Enumeration::DeviceInformation info_{nullptr}; + }; +} } } } + +#endif // CPPWINRT_VERSION + +#else + + +namespace wrapper { namespace impl { namespace org { namespace webRtc { + ZS_DECLARE_STRUCT_PTR(VideoDeviceInfoWrapperAny); + + struct VideoDeviceInfoWrapperAny : Any + { + void *ptr {}; + }; +} } } } + +#endif //WINUWP + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoDeviceInfo::VideoDeviceInfo() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoDeviceInfoPtr wrapper::org::webRtc::VideoDeviceInfo::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoDeviceInfo::~VideoDeviceInfo() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +AnyPtr wrapper::impl::org::webRtc::VideoDeviceInfo::get_info() noexcept +{ + return info_; +} + + + +#ifdef WINUWP +#ifdef __cplusplus_winrt + +wrapper::org::webRtc::VideoDeviceInfoPtr wrapper::impl::org::webRtc::VideoDeviceInfo::toWrapper(Windows::Devices::Enumeration::DeviceInformation^ info) noexcept +{ + auto any{ make_shared() }; + any->info_ = info; + auto result = make_shared(); + result->thisWeak_ = result; + result->info_ = any; + return result; +} + +Windows::Devices::Enumeration::DeviceInformation^ wrapper::impl::org::webRtc::VideoDeviceInfo::toNative_cx(wrapper::org::webRtc::VideoDeviceInfoPtr info) noexcept +{ + if (!info) return nullptr; + AnyPtr any = info->get_info(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::VideoDeviceInfoWrapperAnyCx, any); + if (!castedAny) { +#ifdef CPPWINRT_VERSION + auto result = toNative_winrt(info); + if (result) return WRAPPER_TO_CX(Windows::Devices::Enumeration::DeviceInformation, result); +#endif //CPPWINRT_VERSION + return nullptr; + } + return castedAny->info_; +} +#endif //__cplusplus_winrt + +#ifdef CPPWINRT_VERSION + +wrapper::org::webRtc::VideoDeviceInfoPtr wrapper::impl::org::webRtc::VideoDeviceInfo::toWrapper(winrt::Windows::Devices::Enumeration::DeviceInformation const & info) noexcept +{ + auto any{ make_shared() }; + any->info_ = info; + auto result = make_shared(); + result->thisWeak_ = result; + result->info_ = any; + return result; +} + +winrt::Windows::Devices::Enumeration::DeviceInformation wrapper::impl::org::webRtc::VideoDeviceInfo::toNative_winrt(wrapper::org::webRtc::VideoDeviceInfoPtr info) noexcept +{ + if (!info) return nullptr; + AnyPtr any = info->get_info(); + if (!any) return nullptr; + auto castedAny = ZS_DYNAMIC_PTR_CAST(wrapper::impl::org::webRtc::VideoDeviceInfoWrapperAnyWinrt, any); + if (!castedAny) { +#ifdef __cplusplus_winrt + auto result = toNative_cx(info); + if (result) return WRAPPER_FROM_CX(winrt::Windows::Devices::Enumeration::DeviceInformation, result); +#endif //__cplusplus_winrt + return nullptr; + } + return castedAny->info_; +} + +#endif // CPPWINRT_VERSION + +#else + +#ifdef _WIN32 +#endif //_WIN32 + +#endif //WINUWP diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoDeviceInfo.h b/webrtc/idl/wrapper/impl_org_webRtc_VideoDeviceInfo.h new file mode 100644 index 00000000..bda2039c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoDeviceInfo.h @@ -0,0 +1,52 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_VideoDeviceInfo.h" + +#ifdef CPPWINRT_VERSION +#include +#endif // CPPWINRT_VERSION + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct VideoDeviceInfo : public wrapper::org::webRtc::VideoDeviceInfo + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::VideoDeviceInfo, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoDeviceInfo, WrapperImplType); + + AnyPtr info_ {}; + + VideoDeviceInfoWeakPtr thisWeak_; + + VideoDeviceInfo() noexcept; + virtual ~VideoDeviceInfo() noexcept; + + + // properties VideoDeviceInfo + AnyPtr get_info() noexcept override; + +#ifdef WINUWP +#ifdef __cplusplus_winrt + ZS_NO_DISCARD() static wrapper::org::webRtc::VideoDeviceInfoPtr toWrapper(Windows::Devices::Enumeration::DeviceInformation^ info) noexcept; + ZS_NO_DISCARD() static Windows::Devices::Enumeration::DeviceInformation^ toNative_cx(wrapper::org::webRtc::VideoDeviceInfoPtr info) noexcept; +#endif //__cplusplus_winrt +#ifdef CPPWINRT_VERSION + ZS_NO_DISCARD() static wrapper::org::webRtc::VideoDeviceInfoPtr toWrapper(winrt::Windows::Devices::Enumeration::DeviceInformation const & info) noexcept; + ZS_NO_DISCARD() static winrt::Windows::Devices::Enumeration::DeviceInformation toNative_winrt(wrapper::org::webRtc::VideoDeviceInfoPtr info) noexcept; +#endif // CPPWINRT_VERSION +#else +#ifdef _WIN32 +#endif //_WIN32 +#endif //WINUWP + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoFormat.cpp b/webrtc/idl/wrapper/impl_org_webRtc_VideoFormat.cpp new file mode 100644 index 00000000..c0165372 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoFormat.cpp @@ -0,0 +1,203 @@ + +#include "impl_org_webRtc_VideoFormat.h" + +#include "impl_org_webRtc_pre_include.h" +#include "media/base/videocommon.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoFormat::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoFormat::VideoFormat() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoFormatPtr wrapper::org::webRtc::VideoFormat::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoFormat::~VideoFormat() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoFormat::IsPixelRateLess(wrapper::org::webRtc::VideoFormatPtr other) noexcept +{ + if (!other) return false; + + ZS_ASSERT(native_); + if (!native_) return false; + + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, other); + ZS_ASSERT(converted); + if (!converted) return false; + + return native_->IsPixelRateLess(*(converted->native_)); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoFormat::wrapper_init_org_webRtc_VideoFormat() noexcept +{ + native_ = make_shared(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoFormat::wrapper_init_org_webRtc_VideoFormat(wrapper::org::webRtc::VideoFormatPtr source) noexcept +{ + if (!source) { + wrapper_init_org_webRtc_VideoFormat(); + return; + } + + native_ = toNative(source); +} + +//------------------------------------------------------------------------------ +int wrapper::impl::org::webRtc::VideoFormat::get_width() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return int{}; + return SafeInt(native_->width); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoFormat::set_width(int value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + native_->width = SafeIntwidth)>(value); +} + +//------------------------------------------------------------------------------ +int wrapper::impl::org::webRtc::VideoFormat::get_height() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return int{}; + return SafeInt(native_->height); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoFormat::set_height(int value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + native_->height = SafeIntheight)>(value); +} + +//------------------------------------------------------------------------------ +::zsLib::Nanoseconds wrapper::impl::org::webRtc::VideoFormat::get_interval() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return ::zsLib::Nanoseconds{}; + return ::zsLib::Nanoseconds{ native_->interval = SafeInt<::zsLib::Nanoseconds::rep>(native_->interval) }; +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoFormat::set_interval(::zsLib::Nanoseconds value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + native_->interval = SafeIntinterval)>(value.count()); +} + +//------------------------------------------------------------------------------ +uint32_t wrapper::impl::org::webRtc::VideoFormat::get_fourcc() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return uint32_t{}; + + return SafeInt(native_->fourcc); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoFormat::set_fourcc(uint32_t value) noexcept +{ + ZS_ASSERT(native_); + if (!native_) return; + native_->fourcc = value; +} + +//------------------------------------------------------------------------------ +int wrapper::impl::org::webRtc::VideoFormat::get_framerate() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return int{}; + + return native_->framerate(); +} + +//------------------------------------------------------------------------------ +float wrapper::impl::org::webRtc::VideoFormat::get_framerateFloat() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return float{}; + + return NativeType::IntervalToFpsFloat(native_->interval); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoFormat::get_isSize0x0() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + + return native_->IsSize0x0(); +} + + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType &native) noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = make_shared(native); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(const NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + return toWrapper(*native); +} + +//------------------------------------------------------------------------------ +NativeTypePtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypePtr(); + + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + ZS_ASSERT(converted); + if (!converted) return NativeTypePtr(); + ZS_ASSERT(converted->native_); + return make_shared(*converted->native_); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoFormat.h b/webrtc/idl/wrapper/impl_org_webRtc_VideoFormat.h new file mode 100644 index 00000000..2af1f0fe --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoFormat.h @@ -0,0 +1,55 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_VideoFormat.h" + +#include "impl_org_webRtc_pre_include.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct VideoFormat : public wrapper::org::webRtc::VideoFormat + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::VideoFormat, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoFormat, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::cricket::VideoFormat, NativeType); + + NativeTypePtr native_; + VideoFormatWeakPtr thisWeak_; + + VideoFormat() noexcept; + virtual ~VideoFormat() noexcept; + + + // methods VideoFormat + bool IsPixelRateLess(wrapper::org::webRtc::VideoFormatPtr other) noexcept override; + void wrapper_init_org_webRtc_VideoFormat() noexcept override; + void wrapper_init_org_webRtc_VideoFormat(wrapper::org::webRtc::VideoFormatPtr source) noexcept override; + + // properties VideoFormat + int get_width() noexcept override; + void set_width(int value) noexcept override; + int get_height() noexcept override; + void set_height(int value) noexcept override; + ::zsLib::Nanoseconds get_interval() noexcept override; + void set_interval(::zsLib::Nanoseconds value) noexcept override; + uint32_t get_fourcc() noexcept override; + void set_fourcc(uint32_t value) noexcept override; + int get_framerate() noexcept override; + float get_framerateFloat() noexcept override; + bool get_isSize0x0() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType &native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(const NativeType *native) noexcept; + ZS_NO_DISCARD() static NativeTypePtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSource.cpp b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSource.cpp new file mode 100644 index 00000000..4bc13a1f --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSource.cpp @@ -0,0 +1,166 @@ + +#include "impl_org_webRtc_VideoTrackSource.h" +#include "impl_org_webRtc_MediaConstraints.h" +#include "impl_org_webRtc_VideoCapturer.h" +#include "impl_org_webRtc_WebrtcLib.h" +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/mediastreaminterface.h" +#include "impl_org_webRtc_post_include.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoTrackSource::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::NativeType, NativeType); + +typedef WrapperImplType::NativeTypeScopedPtr NativeTypeScopedPtr; + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, UseWebrtcLib); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::MediaConstraints, UseMediaConstraints); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoCapturer, UseVideoCapturer); +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoTrackSource::VideoTrackSource() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoTrackSourcePtr wrapper::org::webRtc::VideoTrackSource::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoTrackSource::~VideoTrackSource() noexcept +{ + thisWeak_.reset(); + wrapper_dispose(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoTrackSource::wrapper_dispose() noexcept +{ + if (!native_) return; + + native_ = NativeTypeScopedPtr(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourceState wrapper::impl::org::webRtc::VideoTrackSource::get_state() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return wrapper::org::webRtc::MediaSourceState::MediaSourceState_ended; + + return UseEnum::toWrapper(native_->state()); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoTrackSource::get_remote() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->remote(); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoTrackSourcePtr wrapper::org::webRtc::VideoTrackSource::create(wrapper::org::webRtc::VideoCapturerPtr capturer) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + ZS_ASSERT(factory); + if (!factory) return WrapperTypePtr(); + + auto converted = UseVideoCapturer::toNative(capturer); + + return WrapperImplType::toWrapper(factory->CreateVideoSource(std::move(converted))); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoTrackSourcePtr wrapper::org::webRtc::VideoTrackSource::create( + wrapper::org::webRtc::VideoCapturerPtr capturer, + wrapper::org::webRtc::MediaConstraintsPtr constraints + ) noexcept +{ + auto factory = UseWebrtcLib::peerConnectionFactory(); + ZS_ASSERT(factory); + if (!factory) return WrapperTypePtr(); + + auto convertedCapture = UseVideoCapturer::toNative(capturer); + auto convertedConstraints = UseMediaConstraints::toNative(constraints); + + return WrapperImplType::toWrapper(factory->CreateVideoSource(std::move(convertedCapture), convertedConstraints.get())); +} + +//------------------------------------------------------------------------------ +bool wrapper::impl::org::webRtc::VideoTrackSource::get_isScreencast() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + return native_->is_screencast(); +} + +//------------------------------------------------------------------------------ +Optional< bool > wrapper::impl::org::webRtc::VideoTrackSource::get_needsDenoising() noexcept +{ + ZS_ASSERT(native_); + if (!native_) return false; + auto value = native_->needs_denoising(); + + if (!value.has_value()) return Optional(); + return value.value(); +} + +//------------------------------------------------------------------------------ +Optional< wrapper::org::webRtc::VideoTrackSourceStatsPtr > wrapper::impl::org::webRtc::VideoTrackSource::get_stats() noexcept +{ +#pragma ZS_BUILD_NOTE("TODO","(robin) get_stats") + Optional< wrapper::org::webRtc::VideoTrackSourceStatsPtr > result {}; + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeType *native) noexcept +{ + if (!native) return WrapperImplTypePtr(); + + auto result = make_shared(); + result->thisWeak_ = result; + result->native_ = NativeTypeScopedPtr(native); + return result; +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::toWrapper(NativeTypeScopedPtr native) noexcept +{ + return toWrapper(native.get()); +} + +//------------------------------------------------------------------------------ +NativeTypeScopedPtr WrapperImplType::toNative(WrapperTypePtr wrapper) noexcept +{ + if (!wrapper) return NativeTypeScopedPtr(); + auto converted = ZS_DYNAMIC_PTR_CAST(WrapperImplType, wrapper); + if (!converted) return NativeTypeScopedPtr(); + return converted->native_; +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSource.h b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSource.h new file mode 100644 index 00000000..47175d15 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSource.h @@ -0,0 +1,51 @@ + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_VideoTrackSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "impl_org_webRtc_post_include.h" + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct VideoTrackSource : public wrapper::org::webRtc::VideoTrackSource + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::VideoTrackSource, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoTrackSource, WrapperImplType); + ZS_DECLARE_TYPEDEF_PTR(::webrtc::VideoTrackSourceInterface, NativeType); + + typedef rtc::scoped_refptr NativeTypeScopedPtr; + + NativeTypeScopedPtr native_; + VideoTrackSourceWeakPtr thisWeak_; + + VideoTrackSource() noexcept; + virtual ~VideoTrackSource() noexcept; + void wrapper_dispose() noexcept override; + + + // properties MediaTrackSource + wrapper::org::webRtc::MediaSourceState get_state() noexcept override; + bool get_remote() noexcept override; + + // properties VideoTrackSource + bool get_isScreencast() noexcept override; + Optional< bool > get_needsDenoising() noexcept override; + Optional< wrapper::org::webRtc::VideoTrackSourceStatsPtr > get_stats() noexcept override; + + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeType *native) noexcept; + ZS_NO_DISCARD() static WrapperImplTypePtr toWrapper(NativeTypeScopedPtr native) noexcept; + + ZS_NO_DISCARD() static NativeTypeScopedPtr toNative(WrapperTypePtr wrapper) noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSourceStats.cpp b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSourceStats.cpp new file mode 100644 index 00000000..0e8fc26a --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSourceStats.cpp @@ -0,0 +1,51 @@ +// Generated by zsLibEventingTool + +#include "impl_org_webRtc_VideoTrackSourceStats.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoTrackSourceStats::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoTrackSourceStats::VideoTrackSourceStats() noexcept +{ +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoTrackSourceStatsPtr wrapper::org::webRtc::VideoTrackSourceStats::wrapper_create() noexcept +{ + auto pThis = make_shared(); + pThis->thisWeak_ = pThis; + return pThis; +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::VideoTrackSourceStats::~VideoTrackSourceStats() noexcept +{ + thisWeak_.reset(); +} + +//------------------------------------------------------------------------------ +void wrapper::impl::org::webRtc::VideoTrackSourceStats::wrapper_init_org_webRtc_VideoTrackSourceStats() noexcept +{ +} + + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSourceStats.h b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSourceStats.h new file mode 100644 index 00000000..555b32c5 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_VideoTrackSourceStats.h @@ -0,0 +1,30 @@ +// Generated by zsLibEventingTool + +#pragma once + +#include "types.h" +#include "generated/org_webRtc_VideoTrackSourceStats.h" + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct VideoTrackSourceStats : public wrapper::org::webRtc::VideoTrackSourceStats + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::VideoTrackSourceStats, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::VideoTrackSourceStats, WrapperImplType); + VideoTrackSourceStatsWeakPtr thisWeak_; + + VideoTrackSourceStats() noexcept; + virtual ~VideoTrackSourceStats() noexcept; + + void wrapper_init_org_webRtc_VideoTrackSourceStats() noexcept override; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_WebRtcLib.cpp b/webrtc/idl/wrapper/impl_org_webRtc_WebRtcLib.cpp new file mode 100644 index 00000000..9d3fb5f5 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_WebRtcLib.cpp @@ -0,0 +1,595 @@ + +#define ZS_DECLARE_TEMPLATE_GENERATE_IMPLEMENTATION + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#ifdef _WIN32 +#endif //_WIN32 + +#endif //WINUWP + +#include "impl_org_webRtc_WebRtcLib.h" +#include "impl_org_webRtc_EventQueue.h" +#include "impl_org_webRtc_helpers.h" +#include "impl_webrtc_IMediaStreamSource.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/audio_codecs/builtin_audio_decoder_factory.h" +#include "api/audio_codecs/builtin_audio_encoder_factory.h" +#include "api/peerconnectioninterface.h" +#include "api/peerconnectionfactoryproxy.h" +#include "api/test/fakeconstraints.h" +#include "common_video/video_common_winuwp.h" +#include "rtc_base/event_tracer.h" +#include "rtc_base/ssladapter.h" +#include "rtc_base/win32socketinit.h" +#include "third_party/winuwp_h264/winuwp_h264_factory.h" +#include "media/engine/webrtcvideocapturerfactory.h" +#include "pc/peerconnectionfactory.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +#include + +namespace wrapper { namespace impl { namespace org { namespace webRtc { ZS_DECLARE_SUBSYSTEM(wrapper_org_webRtc); } } } } + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION +ZS_DECLARE_PROXY_IMPLEMENT(webrtc::IMediaStreamSourceDelegate) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_IMPLEMENT(webrtc::IMediaStreamSourceDelegate, webrtc::IMediaStreamSourceSubscription) +#endif //CPPWINRT_VERSION +#endif //WINUWP + +// borrow definitions from class +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib::WrapperImplType, WrapperImplType); +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::WrapperType, WrapperType); + +typedef WrapperImplType::PeerConnectionFactoryInterfaceScopedPtr PeerConnectionFactoryInterfaceScopedPtr; +typedef WrapperImplType::PeerConnectionFactoryScopedPtr PeerConnectionFactoryScopedPtr; + +ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionFactory, NativePeerConnectionFactory) +ZS_DECLARE_TYPEDEF_PTR(::webrtc::PeerConnectionFactoryInterface, NativePeerConnectionFactoryInterface) + +ZS_DECLARE_TYPEDEF_PTR(WrapperImplType::UseVideoDeviceCaptureFacrtory, UseVideoDeviceCaptureFacrtory); + +ZS_DECLARE_TYPEDEF_PTR(::cricket::WebRtcVideoDeviceCapturerFactory, UseWebrtcVideoDeviceCaptureFacrtory); + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::EventQueue, UseEventQueue); + +ZS_DECLARE_TYPEDEF_PTR(zsLib::eventing::IHelper, UseHelper); + +//------------------------------------------------------------------------------ +static NativePeerConnectionFactoryInterface *unproxy(NativePeerConnectionFactoryInterface *native) +{ + if (!native) return native; + return WRAPPER_DEPROXIFY_CLASS(::webrtc::PeerConnectionFactory, ::webrtc::PeerConnectionFactory, native); +} + +//------------------------------------------------------------------------------ +WrapperImplType::WebRtcLib() noexcept +{ + ZS_GET_LOG_LEVEL(); // force the subsystem to get referenced before any usage happens +} + +//------------------------------------------------------------------------------ +wrapper::impl::org::webRtc::WebRtcLib::~WebRtcLib() +{ + thisWeak_.reset(); + notifySingletonCleanup(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::create() noexcept +{ + auto result = make_shared(); + result->thisWeak_ = result; + return result; +} + +//------------------------------------------------------------------------------ +void wrapper::org::webRtc::WebRtcLib::setup() noexcept +{ + auto singleton = WrapperImplType::singleton(); + singleton->actual_setup(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::webRtc::WebRtcLib::setup(wrapper::org::webRtc::EventQueuePtr queue) noexcept +{ + auto singleton = WrapperImplType::singleton(); + singleton->actual_setup(queue); +} + +//------------------------------------------------------------------------------ +void wrapper::org::webRtc::WebRtcLib::startMediaTracing() noexcept +{ + auto singleton = WrapperImplType::singleton(); + singleton->actual_startMediaTracing(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::webRtc::WebRtcLib::stopMediaTracing() noexcept +{ + auto singleton = WrapperImplType::singleton(); + singleton->actual_stopMediaTracing(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::webRtc::WebRtcLib::isMediaTracing() noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_isMediaTracing(); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::webRtc::WebRtcLib::startMediaTrace(String filename) noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_startMediaTrace(filename); +} + +//------------------------------------------------------------------------------ +bool wrapper::org::webRtc::WebRtcLib::startMediaTrace( + String host, + int port + ) noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_startMediaTrace(host, port); +} + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds wrapper::org::webRtc::WebRtcLib::get_ntpServerTime() noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_get_ntpServerTime(); +} + +//------------------------------------------------------------------------------ +void wrapper::org::webRtc::WebRtcLib::set_ntpServerTime(::zsLib::Milliseconds value) noexcept +{ + auto singleton = WrapperImplType::singleton(); + singleton->actual_set_ntpServerTime(value); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::actual_setup() noexcept +{ + actual_setup(wrapper::org::webRtc::EventQueuePtr()); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::actual_setup(wrapper::org::webRtc::EventQueuePtr queue) noexcept +{ + // prevent multiple setups being called simulatuously + if (setupCalledOnce_.test_and_set()) return; + +#ifdef WINUWP + + // Setup for WinWUP... + +#if defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION) + +#else + +#ifdef __cplusplus_winrt + // setup when ONLY WinUWP CX is defined... +#endif // __cplusplus_winrt + +#ifdef CPPWINRT_VERSION + // setup when ONLY CppWinRT is defined... +#endif //CPPWINRT_VERSION + +#endif //defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION) + +#ifdef CPPWINRT_VERSION + { + // Setup if WinUWP CppWinRT is defined... + auto nativeCppWinrt = UseEventQueue::toNative_winrt(queue); + if ((nativeCppWinrt) && (!didSetupZsLib_.test_and_set())) { + UseHelper::setup(nativeCppWinrt); + } + } +#endif //CPPWINRT_VERSION + +#ifdef __cplusplus_winrt + // Setup if WinUWP CX is defined... + { + auto nativeCx = UseEventQueue::toNative_cx(queue); + if ((nativeCx) && (!didSetupZsLib_.test_and_set())) { + UseHelper::setup(nativeCx); + } + } +#endif //__cplusplus_winrt + +#else + + // setup for non WinWUP targets... + +#ifdef _WIN32 + + // setup specific to Win32... + +#endif //_WIN32 + +#endif //WINUWP + + if (!didSetupZsLib_.test_and_set()) { + UseHelper::setup(); + } + +#ifdef WINUWP + + // Setup for WinWUP... + +#if defined(__cplusplus_winrt) + + Windows::UI::Core::CoreDispatcher^ dispatcher{}; + + dispatcher = UseEventQueue::toNative_cx(queue); + + // on WinUWP a dispatcher is not optional + ZS_ASSERT(dispatcher); + + ::webrtc::VideoCommonWinUWP::SetCoreDispatcher(dispatcher); + +#else + +#error cppwinrt requires CX consume runtime support to be enabled (for now) + +#endif //(defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION)) || defined(__cplusplus_winrt) + +#else //WINUWP + +#endif //WINUWP + + rtc::EnsureWinsockInit(); + rtc::InitializeSSL([](void *) { return false; }); // no custom verifier of SSL + + networkThread = rtc::Thread::CreateWithSocketServer(); + networkThread->Start(); + + workerThread = rtc::Thread::Create(); + workerThread->Start(); + + signalingThread = rtc::Thread::Create(); + signalingThread->Start(); + + + auto encoderFactory = new ::webrtc::WinUWPH264EncoderFactory(); + auto decoderFactory = new ::webrtc::WinUWPH264DecoderFactory(); + + peerConnectionFactory_ = ::webrtc::CreatePeerConnectionFactory( + networkThread.get(), + workerThread.get(), + signalingThread.get(), + nullptr, + ::webrtc::CreateBuiltinAudioEncoderFactory(), + ::webrtc::CreateBuiltinAudioDecoderFactory(), + encoderFactory, + decoderFactory + ); + +#ifdef WINUWP + videoDeviceCaptureFactory_ = make_shared<::cricket::WebRtcVideoDeviceCapturerFactory>(); +#else +#error PLATFORM REQUIRES FACTORY +#endif //WEBRTC + + rtc::tracing::SetupInternalTracer(); + + if (setupComplete_.exchange(true)) { + ZS_ASSERT_FAIL("already setup webrtc wrapper"); + return; + } +} + +//------------------------------------------------------------------------------ +void WrapperImplType::actual_startMediaTracing() noexcept +{ + if (!actual_checkSetup()) return; + + // prevent multiple calls to start or stop simultaneously + if (isTracingStartOrStopping_.test_and_set()) return; + + if (isTracing_.exchange(false)) { + isTracingStartOrStopping_.clear(); + return; + } + + //rtc::tracing::StartInternalCapture(); +#pragma ZS_BUILD_NOTE("TODO","(mosa) actual_startMediaTrace no options") + + isTracingStartOrStopping_.clear(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::actual_stopMediaTracing() noexcept +{ + if (!actual_checkSetup()) return; + + // prevent multiple calls to start or stop simultaneously + if (isTracingStartOrStopping_.test_and_set()) return; + + if (isTracing_.exchange(false)) { + isTracingStartOrStopping_.clear(); + return; + } + + rtc::tracing::StopInternalCapture(); + + isTracingStartOrStopping_.clear(); +} + +//------------------------------------------------------------------------------ +bool WrapperImplType::actual_isMediaTracing() noexcept +{ + if (!actual_checkSetup(false)) return false; + return isTracing_; +} + +//------------------------------------------------------------------------------ +bool WrapperImplType::actual_startMediaTrace(String filename) noexcept +{ + if (!actual_checkSetup()) return false; + + // prevent multiple calls to start or stop simultaneously + if (isTracingStartOrStopping_.test_and_set()) return false; + + ZS_ASSERT(!isTracing_); + if (isTracing_.exchange(true)) { + isTracingStartOrStopping_.clear(); + return false; + } + + rtc::tracing::StartInternalCapture(filename.c_str()); + + isTracingStartOrStopping_.clear(); + return false; +} + +//------------------------------------------------------------------------------ +bool WrapperImplType::actual_startMediaTrace( + String host, + int port + ) noexcept +{ + if (!actual_checkSetup()) return false; + + // prevent multiple calls to start or stop simultaneously + if (isTracingStartOrStopping_.test_and_set()) return false; + + ZS_ASSERT(!isTracing_); + if (isTracing_.exchange(true)) { + isTracingStartOrStopping_.clear(); + return false; + } + +#pragma ZS_BUILD_NOTE("TODO","(mosa) actual_startMediaTrace host/port") + + isTracingStartOrStopping_.clear(); + return false; +} + + +//------------------------------------------------------------------------------ +::zsLib::Milliseconds WrapperImplType::actual_get_ntpServerTime() noexcept +{ + if (!actual_checkSetup()) return ::zsLib::Milliseconds(); + zsLib::AutoLock lock(lock_); + return ntpServerTime_; +} + +//------------------------------------------------------------------------------ +void WrapperImplType::actual_set_ntpServerTime(::zsLib::Milliseconds value) noexcept +{ + if (!actual_checkSetup()) return; + + { + zsLib::AutoLock lock(lock_); + ntpServerTime_ = value; + } + +#pragma ZS_BUILD_NOTE("TODO","(mosa) set the NTP time from the server inside webrtc engine here") + +} + +//------------------------------------------------------------------------------ +bool WrapperImplType::actual_checkSetup(bool assert) noexcept +{ + if ((assert) && ((!setupComplete_) && (!alreadyCleaned_))) { + ZS_ASSERT_FAIL("Setup was never called on wrapper"); + } + return setupComplete_ && (!alreadyCleaned_); +} + +//------------------------------------------------------------------------------ +PeerConnectionFactoryInterfaceScopedPtr WrapperImplType::actual_peerConnectionFactory() noexcept +{ + if (!actual_checkSetup()) return PeerConnectionFactoryInterfaceScopedPtr(); + + return peerConnectionFactory_; +} + +//------------------------------------------------------------------------------ +PeerConnectionFactoryScopedPtr WrapperImplType::actual_realPeerConnectionFactory() noexcept +{ + if (!actual_checkSetup()) return PeerConnectionFactoryScopedPtr(); + + auto realInterface = unproxy(peerConnectionFactory_); + return dynamic_cast(realInterface); +} + +//------------------------------------------------------------------------------ +UseVideoDeviceCaptureFacrtoryPtr WrapperImplType::actual_videoDeviceCaptureFactory() noexcept +{ + if (!actual_checkSetup()) return UseVideoDeviceCaptureFacrtoryPtr(); + + return videoDeviceCaptureFactory_; +} + +//------------------------------------------------------------------------------ +zsLib::IMessageQueuePtr WrapperImplType::actual_delegateQueue() noexcept +{ + return zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue(); +} + +//------------------------------------------------------------------------------ +void WrapperImplType::notifySingletonCleanup() noexcept +{ + // prevent clean-up twice + if (!actual_checkSetup()) return; + if (alreadyCleaned_.exchange(true)) return; + + // Add what is needed to shutdown webrtc... + +#pragma ZS_BUILD_NOTE("TODO","(mosa) shutdown webrtc engine here") + + rtc::tracing::ShutdownInternalTracer(); + + // reset the factory (cannot be used anymore)... + peerConnectionFactory_ = PeerConnectionFactoryInterfaceScopedPtr(); + videoDeviceCaptureFactory_.reset(); + +#pragma ZS_BUILD_NOTE("TODO","(mosa) shutdown threads need something more?") + + networkThread.reset(); + workerThread.reset(); + signalingThread.reset(); + + rtc::CleanupSSL(); +} + +//------------------------------------------------------------------------------ +WrapperImplTypePtr WrapperImplType::singleton() noexcept +{ + static zsLib::SingletonLazySharedPtr singleton(WrapperImplType::create()); + + auto result = singleton.singleton(); + + static zsLib::SingletonManager::Register registerSingleton("org.webrtc.WebRtcLib", result); + + // prevent crashes when accessing singleton during shutdown + if (!result) { + class BogusSingleton : public WrapperImplType { + + private: + + void actual_setup() noexcept final {} + void actual_setup(wrapper::org::webRtc::EventQueuePtr queue) noexcept final {} + void actual_startMediaTracing() noexcept final {} + void actual_stopMediaTracing() noexcept final {} + bool actual_isMediaTracing() noexcept final { return false; } + bool actual_startMediaTrace(String) noexcept final { return false; } + bool actual_startMediaTrace( + String, + int + ) noexcept final { return false; } + + ::zsLib::Milliseconds actual_get_ntpServerTime() noexcept final { return zsLib::Milliseconds(); } + void actual_set_ntpServerTime(::zsLib::Milliseconds) noexcept final {} + + bool actual_checkSetup(bool) noexcept final { return false; } + + //----------------------------------------------------------------------- + PeerConnectionFactoryInterfaceScopedPtr actual_peerConnectionFactory() noexcept final + { + ZS_ASSERT_FAIL("why is the factory needed during shutdown?"); + // no way around this one with a bogus factory... + return PeerConnectionFactoryInterfaceScopedPtr(); + } + + //----------------------------------------------------------------------- + PeerConnectionFactoryScopedPtr actual_realPeerConnectionFactory() noexcept final + { + ZS_ASSERT_FAIL("why is the factory needed during shutdown?"); + // no way around this one with a bogus factory... + return PeerConnectionFactoryScopedPtr(); + } + + //----------------------------------------------------------------------- + UseVideoDeviceCaptureFacrtoryPtr actual_videoDeviceCaptureFactory() noexcept final + { + ZS_ASSERT_FAIL("why is the factory needed during shutdown?"); + // no way around this one with a bogus factory... + return UseVideoDeviceCaptureFacrtoryPtr(); + } + + //----------------------------------------------------------------------- + zsLib::IMessageQueuePtr actual_delegateQueue() noexcept final + { + return zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue(); + } + + void notifySingletonCleanup() noexcept final {} + }; + return make_shared(); + } + return result; +} + +//------------------------------------------------------------------------------ +bool WrapperImplType::checkSetup(bool assert) noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_checkSetup(assert); +} + +//------------------------------------------------------------------------------ +PeerConnectionFactoryInterfaceScopedPtr WrapperImplType::peerConnectionFactory() noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_peerConnectionFactory(); +} + +//------------------------------------------------------------------------------ +PeerConnectionFactoryScopedPtr WrapperImplType::realPeerConnectionFactory() noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_realPeerConnectionFactory(); +} + +//------------------------------------------------------------------------------ +UseVideoDeviceCaptureFacrtoryPtr WrapperImplType::videoDeviceCaptureFactory() noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_videoDeviceCaptureFactory(); +} + +//------------------------------------------------------------------------------ +zsLib::IMessageQueuePtr WrapperImplType::delegateQueue() noexcept +{ + auto singleton = WrapperImplType::singleton(); + return singleton->actual_delegateQueue(); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_WebRtcLib.h b/webrtc/idl/wrapper/impl_org_webRtc_WebRtcLib.h new file mode 100644 index 00000000..8876fe3c --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_WebRtcLib.h @@ -0,0 +1,97 @@ + +#pragma once + +#include "types.h" + +#include "generated/org_webRtc_WebRtcLib.h" + +#include "impl_org_webRtc_pre_include.h" +#include "rtc_base/scoped_ref_ptr.h" +#include "media/base/videocapturerfactory.h" +#include "impl_org_webRtc_post_include.h" + +#include + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + struct WebRtcLib : public wrapper::org::webRtc::WebRtcLib, + public zsLib::ISingletonManagerDelegate + { + ZS_DECLARE_TYPEDEF_PTR(wrapper::org::webRtc::WebRtcLib, WrapperType); + ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::WebRtcLib, WrapperImplType); + + typedef rtc::scoped_refptr<::webrtc::PeerConnectionFactoryInterface> PeerConnectionFactoryInterfaceScopedPtr; + typedef rtc::scoped_refptr<::webrtc::PeerConnectionFactory> PeerConnectionFactoryScopedPtr; + + ZS_DECLARE_TYPEDEF_PTR(::cricket::VideoDeviceCapturerFactory, UseVideoDeviceCaptureFacrtory); + + WebRtcLib() noexcept; + WebRtcLib(const WebRtcLib &) = delete; + virtual ~WebRtcLib() noexcept; + + WebRtcLibWeakPtr thisWeak_; + std::atomic_flag setupCalledOnce_{}; + std::atomic_bool setupComplete_ {}; + std::atomic_bool alreadyCleaned_{}; + std::atomic_flag didSetupZsLib_ {}; + std::atomic_flag isTracingStartOrStopping_ {}; + std::atomic_bool isTracing_ {}; + zsLib::Lock lock_; + PeerConnectionFactoryInterfaceScopedPtr peerConnectionFactory_; + UseVideoDeviceCaptureFacrtoryPtr videoDeviceCaptureFactory_; + ::zsLib::Milliseconds ntpServerTime_; + + std::unique_ptr networkThread; + std::unique_ptr workerThread; + std::unique_ptr signalingThread; + + // constructor + static WrapperImplTypePtr create() noexcept; + + // overrides of base class + virtual void actual_setup() noexcept; + virtual void actual_setup(wrapper::org::webRtc::EventQueuePtr queue) noexcept; + virtual void actual_startMediaTracing() noexcept; + virtual void actual_stopMediaTracing() noexcept; + virtual bool actual_isMediaTracing() noexcept; + virtual bool actual_startMediaTrace(String filename) noexcept; + virtual bool actual_startMediaTrace( + String host, + int port + ) noexcept; + + virtual ::zsLib::Milliseconds actual_get_ntpServerTime() noexcept; + virtual void actual_set_ntpServerTime(::zsLib::Milliseconds value) noexcept; + + // addition methods needed + virtual bool actual_checkSetup(bool assert = true) noexcept; + virtual PeerConnectionFactoryInterfaceScopedPtr actual_peerConnectionFactory() noexcept; + virtual PeerConnectionFactoryScopedPtr actual_realPeerConnectionFactory() noexcept; + virtual UseVideoDeviceCaptureFacrtoryPtr actual_videoDeviceCaptureFactory() noexcept; + virtual zsLib::IMessageQueuePtr actual_delegateQueue() noexcept; + + //------------------------------------------------------------------- + // + // zsLib::ISingletonManagerDelegate + // + void notifySingletonCleanup() noexcept override; + + // public methods + static WebRtcLibPtr singleton() noexcept; + + // addition methods needed + static PeerConnectionFactoryInterfaceScopedPtr peerConnectionFactory() noexcept; + static PeerConnectionFactoryScopedPtr realPeerConnectionFactory() noexcept; + static UseVideoDeviceCaptureFacrtoryPtr videoDeviceCaptureFactory() noexcept; + static bool checkSetup(bool assert = true) noexcept; + static zsLib::IMessageQueuePtr delegateQueue() noexcept; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_enums.cpp b/webrtc/idl/wrapper/impl_org_webRtc_enums.cpp new file mode 100644 index 00000000..f7d4cf95 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_enums.cpp @@ -0,0 +1,1239 @@ + +#include "impl_org_webRtc_enums.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/rtcerror.h" +#include "api/mediatypes.h" +#include "rtc_base/sslidentity.h" +#include "api/rtptransceiverinterface.h" +#include "media/base/videocapturer.h" +#include "api/stats/rtcstats_objects.h" +#include "impl_org_webRtc_post_include.h" + +#include + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + + + +namespace { + static const char kSeparator = '_'; + static const char *kMediaTypeData = "data"; +} // namespace + +ZS_DECLARE_TYPEDEF_PTR(wrapper::impl::org::webRtc::IEnum, UseEnum); + +namespace wrapper { namespace impl { namespace org { namespace webRtc { ZS_DECLARE_SUBSYSTEM(wrapper_org_webRtc); } } } } + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCErrorType UseEnum::toWrapper(::webrtc::RTCErrorType value) noexcept +{ + switch (value) { + case ::webrtc::RTCErrorType::NONE: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_none; + case ::webrtc::RTCErrorType::UNSUPPORTED_OPERATION: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedOperation; + case ::webrtc::RTCErrorType::UNSUPPORTED_PARAMETER: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedParameter; + case ::webrtc::RTCErrorType::INVALID_PARAMETER: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidParameter; + case ::webrtc::RTCErrorType::INVALID_RANGE: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidRange; + case ::webrtc::RTCErrorType::SYNTAX_ERROR: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_syntaxError; + case ::webrtc::RTCErrorType::INVALID_STATE: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidState; + case ::webrtc::RTCErrorType::INVALID_MODIFICATION: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidModification; + case ::webrtc::RTCErrorType::NETWORK_ERROR: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_networkError; + case ::webrtc::RTCErrorType::RESOURCE_EXHAUSTED: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_resourceExhausted; + case ::webrtc::RTCErrorType::INTERNAL_ERROR: return wrapper::org::webRtc::RTCErrorType::RTCErrorType_internalError; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCErrorType::RTCErrorType_none; +} + +//----------------------------------------------------------------------------- +::webrtc::RTCErrorType UseEnum::toNative(wrapper::org::webRtc::RTCErrorType value) noexcept +{ + switch (value) { + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_none: return ::webrtc::RTCErrorType::NONE; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedOperation: return ::webrtc::RTCErrorType::UNSUPPORTED_OPERATION; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedParameter: return ::webrtc::RTCErrorType::UNSUPPORTED_PARAMETER; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidParameter: return ::webrtc::RTCErrorType::INVALID_PARAMETER; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidRange: return ::webrtc::RTCErrorType::INVALID_RANGE; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_syntaxError: return ::webrtc::RTCErrorType::SYNTAX_ERROR; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidState: return ::webrtc::RTCErrorType::INVALID_STATE; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidModification: return ::webrtc::RTCErrorType::INVALID_MODIFICATION; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_networkError: return ::webrtc::RTCErrorType::NETWORK_ERROR; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_resourceExhausted: return ::webrtc::RTCErrorType::RESOURCE_EXHAUSTED; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_internalError: return ::webrtc::RTCErrorType::INTERNAL_ERROR; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::RTCErrorType::INTERNAL_ERROR; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceTransportPolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::IceTransportsType value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::IceTransportsType::kNone: return wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_none; + case ::webrtc::PeerConnectionInterface::IceTransportsType::kRelay: return wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_relay; + case ::webrtc::PeerConnectionInterface::IceTransportsType::kNoHost: return wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_noHost; + case ::webrtc::PeerConnectionInterface::IceTransportsType::kAll: return wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_all; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_all; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::IceTransportsType UseEnum::toNative(wrapper::org::webRtc::RTCIceTransportPolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_none: return ::webrtc::PeerConnectionInterface::IceTransportsType::kNone; + case wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_relay: return ::webrtc::PeerConnectionInterface::IceTransportsType::kRelay; + case wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_noHost: return ::webrtc::PeerConnectionInterface::IceTransportsType::kNoHost; + case wrapper::org::webRtc::RTCIceTransportPolicy::RTCIceTransportPolicy_all: return ::webrtc::PeerConnectionInterface::IceTransportsType::kAll; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::IceTransportsType::kAll; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCBundlePolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::BundlePolicy value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyBalanced: return wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_balanced; + case ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyMaxBundle: return wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_maxBundle; + case ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyMaxCompat: return wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_maxCompat; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_balanced; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::BundlePolicy UseEnum::toNative(wrapper::org::webRtc::RTCBundlePolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_balanced: return ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyBalanced; + case wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_maxBundle: return ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyMaxBundle; + case wrapper::org::webRtc::RTCBundlePolicy::RTCBundlePolicy_maxCompat: return ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyMaxCompat; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::BundlePolicy::kBundlePolicyBalanced; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCRtcpMuxPolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::RtcpMuxPolicy value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::RtcpMuxPolicy::kRtcpMuxPolicyNegotiate: return wrapper::org::webRtc::RTCRtcpMuxPolicy::RTCRtcpMuxPolicy_negotiate; + case ::webrtc::PeerConnectionInterface::RtcpMuxPolicy::kRtcpMuxPolicyRequire: return wrapper::org::webRtc::RTCRtcpMuxPolicy::RTCRtcpMuxPolicy_require; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCRtcpMuxPolicy::RTCRtcpMuxPolicy_require; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::RtcpMuxPolicy UseEnum::toNative(wrapper::org::webRtc::RTCRtcpMuxPolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCRtcpMuxPolicy::RTCRtcpMuxPolicy_negotiate: return ::webrtc::PeerConnectionInterface::RtcpMuxPolicy::kRtcpMuxPolicyNegotiate; + case wrapper::org::webRtc::RTCRtcpMuxPolicy::RTCRtcpMuxPolicy_require: return ::webrtc::PeerConnectionInterface::RtcpMuxPolicy::kRtcpMuxPolicyRequire; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::RtcpMuxPolicy::kRtcpMuxPolicyRequire; +} + + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCTcpCandidatePolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::TcpCandidatePolicy value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::TcpCandidatePolicy::kTcpCandidatePolicyEnabled: return wrapper::org::webRtc::RTCTcpCandidatePolicy::RTCTcpCandidatePolicy_enabled; + case ::webrtc::PeerConnectionInterface::TcpCandidatePolicy::kTcpCandidatePolicyDisabled: return wrapper::org::webRtc::RTCTcpCandidatePolicy::RTCTcpCandidatePolicy_disabled; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCTcpCandidatePolicy::RTCTcpCandidatePolicy_disabled; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::TcpCandidatePolicy UseEnum::toNative(wrapper::org::webRtc::RTCTcpCandidatePolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCTcpCandidatePolicy::RTCTcpCandidatePolicy_enabled: return ::webrtc::PeerConnectionInterface::TcpCandidatePolicy::kTcpCandidatePolicyEnabled; + case wrapper::org::webRtc::RTCTcpCandidatePolicy::RTCTcpCandidatePolicy_disabled: return ::webrtc::PeerConnectionInterface::TcpCandidatePolicy::kTcpCandidatePolicyDisabled; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::TcpCandidatePolicy::kTcpCandidatePolicyDisabled; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCCandidateNetworkPolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::CandidateNetworkPolicy value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::CandidateNetworkPolicy::kCandidateNetworkPolicyAll: return wrapper::org::webRtc::RTCCandidateNetworkPolicy::RTCCandidateNetworkPolicy_all; + case ::webrtc::PeerConnectionInterface::CandidateNetworkPolicy::kCandidateNetworkPolicyLowCost: return wrapper::org::webRtc::RTCCandidateNetworkPolicy::RTCCandidateNetworkPolicy_lowCost; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCCandidateNetworkPolicy::RTCCandidateNetworkPolicy_all; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::CandidateNetworkPolicy UseEnum::toNative(wrapper::org::webRtc::RTCCandidateNetworkPolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCCandidateNetworkPolicy::RTCCandidateNetworkPolicy_all: return ::webrtc::PeerConnectionInterface::CandidateNetworkPolicy::kCandidateNetworkPolicyAll; + case wrapper::org::webRtc::RTCCandidateNetworkPolicy::RTCCandidateNetworkPolicy_lowCost: return ::webrtc::PeerConnectionInterface::CandidateNetworkPolicy::kCandidateNetworkPolicyLowCost; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::CandidateNetworkPolicy::kCandidateNetworkPolicyLowCost; +} + + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCContinualGatheringPolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::ContinualGatheringPolicy value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::ContinualGatheringPolicy::GATHER_ONCE: return wrapper::org::webRtc::RTCContinualGatheringPolicy::RTCContinualGatheringPolicy_once; + case ::webrtc::PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY: return wrapper::org::webRtc::RTCContinualGatheringPolicy::RTCContinualGatheringPolicy_continually; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCContinualGatheringPolicy::RTCContinualGatheringPolicy_once; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::ContinualGatheringPolicy UseEnum::toNative(wrapper::org::webRtc::RTCContinualGatheringPolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCContinualGatheringPolicy::RTCContinualGatheringPolicy_once: return ::webrtc::PeerConnectionInterface::ContinualGatheringPolicy::GATHER_ONCE; + case wrapper::org::webRtc::RTCContinualGatheringPolicy::RTCContinualGatheringPolicy_continually: return ::webrtc::PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::ContinualGatheringPolicy::GATHER_ONCE; +} + + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCNetworkType UseEnum::toWrapper(::rtc::AdapterType value) noexcept +{ + switch (value) + { + case ::rtc::AdapterType::ADAPTER_TYPE_UNKNOWN: return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_unknown; + case ::rtc::AdapterType::ADAPTER_TYPE_ETHERNET: return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_ethernet; + case ::rtc::AdapterType::ADAPTER_TYPE_WIFI: return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wifi; + case ::rtc::AdapterType::ADAPTER_TYPE_CELLULAR: return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_cellular; + case ::rtc::AdapterType::ADAPTER_TYPE_VPN: return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_vpn; + case ::rtc::AdapterType::ADAPTER_TYPE_LOOPBACK: return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_loopback; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_unknown; +} + +//----------------------------------------------------------------------------- +::rtc::AdapterType UseEnum::toNative(wrapper::org::webRtc::RTCNetworkType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_unknown: return ::rtc::AdapterType::ADAPTER_TYPE_UNKNOWN; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_ethernet: return ::rtc::AdapterType::ADAPTER_TYPE_ETHERNET; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wifi: return ::rtc::AdapterType::ADAPTER_TYPE_WIFI; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_cellular: return ::rtc::AdapterType::ADAPTER_TYPE_CELLULAR; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_vpn: return ::rtc::AdapterType::ADAPTER_TYPE_VPN; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_loopback: return ::rtc::AdapterType::ADAPTER_TYPE_LOOPBACK; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_bluetooth: return ::rtc::AdapterType::ADAPTER_TYPE_UNKNOWN; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wimax: return ::rtc::AdapterType::ADAPTER_TYPE_UNKNOWN; + } + ZS_ASSERT_FAIL("unknown type"); + return ::rtc::AdapterType::ADAPTER_TYPE_UNKNOWN; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCNetworkType UseEnum::toWrapperRTCNetworkType(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCNetworkType enums[] = { + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_unknown, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_ethernet, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wifi, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_cellular, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_vpn, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_loopback, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_bluetooth, + wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wimax + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("RTCNetworkType is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCNetworkType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_unknown: return ::webrtc::RTCNetworkType::kUnknown; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_ethernet: return ::webrtc::RTCNetworkType::kEthernet; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wifi: return ::webrtc::RTCNetworkType::kWifi; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_cellular: return ::webrtc::RTCNetworkType::kCellular; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_vpn: return ::webrtc::RTCNetworkType::kVpn; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_loopback: return "loopback"; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_bluetooth: return ::webrtc::RTCNetworkType::kBluetooth; + case wrapper::org::webRtc::RTCNetworkType::RTCNetworkType_wimax: return ::webrtc::RTCNetworkType::kWimax; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::RTCNetworkType::kUnknown; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCSdpSemantics UseEnum::toWrapper(::webrtc::SdpSemantics value) noexcept +{ + switch (value) + { + case ::webrtc::SdpSemantics::kDefault: return wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_default; + case ::webrtc::SdpSemantics::kPlanB: return wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_planB; + case ::webrtc::SdpSemantics::kUnifiedPlan: return wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_unifiedPlan; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_default; +} + +//----------------------------------------------------------------------------- +::webrtc::SdpSemantics UseEnum::toNative(wrapper::org::webRtc::RTCSdpSemantics value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_default: return ::webrtc::SdpSemantics::kDefault; + case wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_planB: return ::webrtc::SdpSemantics::kPlanB; + case wrapper::org::webRtc::RTCSdpSemantics::RTCSdpSemantics_unifiedPlan: return ::webrtc::SdpSemantics::kUnifiedPlan; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::SdpSemantics::kDefault; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCTlsCertPolicy UseEnum::toWrapper(::webrtc::PeerConnectionInterface::TlsCertPolicy value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::TlsCertPolicy::kTlsCertPolicySecure: return wrapper::org::webRtc::RTCTlsCertPolicy::RTCTlsCertPolicy_tlsCertPolicySecure; + case ::webrtc::PeerConnectionInterface::TlsCertPolicy::kTlsCertPolicyInsecureNoCheck: return wrapper::org::webRtc::RTCTlsCertPolicy::RTCTlsCertPolicy_tlsCertPolicyInsecureNoCheck; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCTlsCertPolicy::RTCTlsCertPolicy_tlsCertPolicySecure; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::TlsCertPolicy UseEnum::toNative(wrapper::org::webRtc::RTCTlsCertPolicy value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCTlsCertPolicy::RTCTlsCertPolicy_tlsCertPolicySecure: return ::webrtc::PeerConnectionInterface::TlsCertPolicy::kTlsCertPolicySecure; + case wrapper::org::webRtc::RTCTlsCertPolicy::RTCTlsCertPolicy_tlsCertPolicyInsecureNoCheck: return ::webrtc::PeerConnectionInterface::TlsCertPolicy::kTlsCertPolicyInsecureNoCheck; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::TlsCertPolicy::kTlsCertPolicySecure; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCSdpType UseEnum::toWrapper(::webrtc::SdpType value) noexcept +{ + switch (value) + { + case ::webrtc::SdpType::kOffer: return wrapper::org::webRtc::RTCSdpType::RTCSdpType_offer; + case ::webrtc::SdpType::kPrAnswer: return wrapper::org::webRtc::RTCSdpType::RTCSdpType_pranswer; + case ::webrtc::SdpType::kAnswer: return wrapper::org::webRtc::RTCSdpType::RTCSdpType_answer; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCSdpType::RTCSdpType_rollback; +} + +//----------------------------------------------------------------------------- +::webrtc::SdpType UseEnum::toNative(wrapper::org::webRtc::RTCSdpType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCSdpType::RTCSdpType_offer: return ::webrtc::SdpType::kOffer; + case wrapper::org::webRtc::RTCSdpType::RTCSdpType_pranswer: return ::webrtc::SdpType::kPrAnswer; + case wrapper::org::webRtc::RTCSdpType::RTCSdpType_answer: return ::webrtc::SdpType::kAnswer; +#pragma ZS_BUILD_NOTE("LATER","webrtc does not support rollback sdp type") + case wrapper::org::webRtc::RTCSdpType::RTCSdpType_rollback: break; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::SdpType::kPrAnswer; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::MediaSourceState UseEnum::toWrapper(::webrtc::MediaSourceInterface::SourceState value) noexcept +{ + switch (value) + { + case ::webrtc::MediaSourceInterface::SourceState::kInitializing: return wrapper::org::webRtc::MediaSourceState::MediaSourceState_initializing; + case ::webrtc::MediaSourceInterface::SourceState::kLive: return wrapper::org::webRtc::MediaSourceState::MediaSourceState_live; + case ::webrtc::MediaSourceInterface::SourceState::kEnded: return wrapper::org::webRtc::MediaSourceState::MediaSourceState_ended; + case ::webrtc::MediaSourceInterface::SourceState::kMuted: return wrapper::org::webRtc::MediaSourceState::MediaSourceState_muted; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::MediaSourceState::MediaSourceState_ended; +} + +//----------------------------------------------------------------------------- +::webrtc::MediaSourceInterface::SourceState UseEnum::toNative(wrapper::org::webRtc::MediaSourceState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::MediaSourceState::MediaSourceState_initializing: return ::webrtc::MediaSourceInterface::SourceState::kInitializing; + case wrapper::org::webRtc::MediaSourceState::MediaSourceState_live: return ::webrtc::MediaSourceInterface::SourceState::kLive; + case wrapper::org::webRtc::MediaSourceState::MediaSourceState_ended: return ::webrtc::MediaSourceInterface::SourceState::kEnded; + case wrapper::org::webRtc::MediaSourceState::MediaSourceState_muted: return ::webrtc::MediaSourceInterface::SourceState::kMuted; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::MediaSourceInterface::SourceState::kEnded; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::MediaStreamTrackState UseEnum::toWrapper(::webrtc::MediaStreamTrackInterface::TrackState value) noexcept +{ + switch (value) + { + case ::webrtc::MediaStreamTrackInterface::TrackState::kLive: return wrapper::org::webRtc::MediaStreamTrackState::MediaStreamTrackState_live; + case ::webrtc::MediaStreamTrackInterface::TrackState::kEnded: return wrapper::org::webRtc::MediaStreamTrackState::MediaStreamTrackState_ended; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::MediaStreamTrackState::MediaStreamTrackState_ended; +} + +//----------------------------------------------------------------------------- +::webrtc::MediaStreamTrackInterface::TrackState UseEnum::toNative(wrapper::org::webRtc::MediaStreamTrackState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::MediaStreamTrackState::MediaStreamTrackState_live: return ::webrtc::MediaStreamTrackInterface::TrackState::kLive; + case wrapper::org::webRtc::MediaStreamTrackState::MediaStreamTrackState_ended: return ::webrtc::MediaStreamTrackInterface::TrackState::kEnded; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::MediaStreamTrackInterface::TrackState::kEnded; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCConfigurationType UseEnum::toWrapper(::webrtc::PeerConnectionInterface::RTCConfigurationType value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::RTCConfigurationType::kSafe: return wrapper::org::webRtc::RTCConfigurationType::RTCConfigurationType_safe; + case ::webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive: return wrapper::org::webRtc::RTCConfigurationType::RTCConfigurationType_aggressive; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCConfigurationType::RTCConfigurationType_safe; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::RTCConfigurationType UseEnum::toNative(wrapper::org::webRtc::RTCConfigurationType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCConfigurationType::RTCConfigurationType_safe: return ::webrtc::PeerConnectionInterface::RTCConfigurationType::kSafe; + case wrapper::org::webRtc::RTCConfigurationType::RTCConfigurationType_aggressive: return ::webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::RTCConfigurationType::kSafe; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCDataChannelState UseEnum::toWrapper(::webrtc::DataChannelInterface::DataState value) noexcept +{ + switch (value) + { + case ::webrtc::DataChannelInterface::DataState::kConnecting: return wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_connecting; + case ::webrtc::DataChannelInterface::DataState::kOpen: return wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_open; + case ::webrtc::DataChannelInterface::DataState::kClosing: return wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closing; + case ::webrtc::DataChannelInterface::DataState::kClosed: return wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closed; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closed; +} + +//----------------------------------------------------------------------------- +::webrtc::DataChannelInterface::DataState UseEnum::toNative(wrapper::org::webRtc::RTCDataChannelState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_connecting: return ::webrtc::DataChannelInterface::DataState::kConnecting; + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_open: return ::webrtc::DataChannelInterface::DataState::kOpen; + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closing: return ::webrtc::DataChannelInterface::DataState::kClosing; + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closed: return ::webrtc::DataChannelInterface::DataState::kClosed; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::DataChannelInterface::DataState::kClosed; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCDegradationPreference UseEnum::toWrapper(::webrtc::DegradationPreference value) noexcept +{ + switch (value) + { + case ::webrtc::DegradationPreference::MAINTAIN_FRAMERATE: return wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_maintainFramerate; + case ::webrtc::DegradationPreference::MAINTAIN_RESOLUTION: return wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_maintainResolution; + case ::webrtc::DegradationPreference::BALANCED: return wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_balanced; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_balanced; +} + +//----------------------------------------------------------------------------- +::webrtc::DegradationPreference UseEnum::toNative(wrapper::org::webRtc::RTCDegradationPreference value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_maintainFramerate: return ::webrtc::DegradationPreference::MAINTAIN_FRAMERATE; + case wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_maintainResolution: return ::webrtc::DegradationPreference::MAINTAIN_RESOLUTION; + case wrapper::org::webRtc::RTCDegradationPreference::RTCDegradationPreference_balanced: return ::webrtc::DegradationPreference::BALANCED; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::DegradationPreference::BALANCED; +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(::webrtc::FecMechanism value) noexcept +{ + switch (value) + { + case ::webrtc::FecMechanism::RED: return "red"; + case ::webrtc::FecMechanism::RED_AND_ULPFEC: return "red+ulpfec"; + case ::webrtc::FecMechanism::FLEXFEC: return "flexfec"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +::webrtc::FecMechanism UseEnum::toNativeFecMechanism(const char *value) noexcept(false) +{ + static const ::webrtc::FecMechanism enums[] = { + ::webrtc::FecMechanism::RED, + ::webrtc::FecMechanism::RED_AND_ULPFEC, + ::webrtc::FecMechanism::FLEXFEC + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("FecMechanism is not understood: " + str); +} + + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCDtxStatus UseEnum::toWrapper(::webrtc::DtxStatus value) noexcept +{ + switch (value) + { + case ::webrtc::DtxStatus::DISABLED: return wrapper::org::webRtc::RTCDtxStatus::RTCDtxStatus_disabled; + case ::webrtc::DtxStatus::ENABLED: return wrapper::org::webRtc::RTCDtxStatus::RTCDtxStatus_enabled; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCDtxStatus::RTCDtxStatus_enabled; +} + +//----------------------------------------------------------------------------- +::webrtc::DtxStatus UseEnum::toNative(wrapper::org::webRtc::RTCDtxStatus value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCDtxStatus::RTCDtxStatus_disabled: return ::webrtc::DtxStatus::DISABLED; + case wrapper::org::webRtc::RTCDtxStatus::RTCDtxStatus_enabled: return ::webrtc::DtxStatus::ENABLED; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::DtxStatus::ENABLED; +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(::webrtc::RtcpFeedbackType value) noexcept +{ + switch (value) + { + case ::webrtc::RtcpFeedbackType::CCM: return "ccm"; + case ::webrtc::RtcpFeedbackType::NACK: return "nack"; + case ::webrtc::RtcpFeedbackType::REMB: return "goog-remb"; + case ::webrtc::RtcpFeedbackType::TRANSPORT_CC: return "transport-cc"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +::webrtc::RtcpFeedbackType UseEnum::toNativeRtcpFeedbackType(const char *value) noexcept(false) +{ + static const ::webrtc::RtcpFeedbackType enums[] = { + ::webrtc::RtcpFeedbackType::CCM, + ::webrtc::RtcpFeedbackType::NACK, + ::webrtc::RtcpFeedbackType::REMB, + ::webrtc::RtcpFeedbackType::TRANSPORT_CC + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("RtcpFeedbackType is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(::webrtc::RtcpFeedbackMessageType value) noexcept +{ + switch (value) + { + case ::webrtc::RtcpFeedbackMessageType::GENERIC_NACK: return "nack"; + case ::webrtc::RtcpFeedbackMessageType::PLI: return "pli"; + case ::webrtc::RtcpFeedbackMessageType::FIR: return "fir"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +::webrtc::RtcpFeedbackMessageType UseEnum::toNativeRtcpFeedbackMessageType(const char *value) noexcept(false) +{ + static const ::webrtc::RtcpFeedbackMessageType enums[] = { + ::webrtc::RtcpFeedbackMessageType::GENERIC_NACK, + ::webrtc::RtcpFeedbackMessageType::PLI, + ::webrtc::RtcpFeedbackMessageType::FIR + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("RtcpFeedbackMessageType is not understood: " + str); +} + + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCECCurve UseEnum::toWrapper(::rtc::ECCurve value) noexcept +{ + switch (value) + { + case ::rtc::ECCurve::EC_NIST_P256: return wrapper::org::webRtc::RTCECCurve::RTCECCurve_nistP256; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCECCurve::RTCECCurve_nistP256; +} + +//----------------------------------------------------------------------------- +::rtc::ECCurve UseEnum::toNative(wrapper::org::webRtc::RTCECCurve value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCECCurve::RTCECCurve_nistP256: return ::rtc::ECCurve::EC_NIST_P256; + } + ZS_ASSERT_FAIL("unknown type"); + return ::rtc::ECCurve::EC_NIST_P256; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCKeyType UseEnum::toWrapper(::rtc::KeyType value) noexcept +{ + switch (value) + { + case ::rtc::KeyType::KT_RSA: return wrapper::org::webRtc::RTCKeyType::RTCKeyType_rsa; + case ::rtc::KeyType::KT_ECDSA: return wrapper::org::webRtc::RTCKeyType::RTCKeyType_ecdsa; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCKeyType::RTCKeyType_default; +} + +//----------------------------------------------------------------------------- +::rtc::KeyType UseEnum::toNative(wrapper::org::webRtc::RTCKeyType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCKeyType::RTCKeyType_default: return ::rtc::KeyType::KT_DEFAULT; + case wrapper::org::webRtc::RTCKeyType::RTCKeyType_rsa: return ::rtc::KeyType::KT_RSA; + case wrapper::org::webRtc::RTCKeyType::RTCKeyType_ecdsa: return ::rtc::KeyType::KT_RSA; + } + ZS_ASSERT_FAIL("unknown type"); + return ::rtc::KeyType::KT_DEFAULT; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceCandidateType UseEnum::toWrapperRTCIceCandidateType(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCIceCandidateType enums[] = { + wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_host, + wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_srflex, + wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_prflx, + wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_relay, + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("RTCIceCandidateType is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCIceCandidateType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_host: return ::webrtc::RTCIceCandidateType::kHost; + case wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_srflex: return ::webrtc::RTCIceCandidateType::kSrflx; + case wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_prflx: return ::webrtc::RTCIceCandidateType::kPrflx; + case wrapper::org::webRtc::RTCIceCandidateType::RTCIceCandidateType_relay: return ::webrtc::RTCIceCandidateType::kRelay; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceComponent UseEnum::toWrapperRTCIceComponent(int value) noexcept(false) +{ + switch (value) + { + case 1: return wrapper::org::webRtc::RTCIceComponent::RTCIceComponent_rtp; + case 2: return wrapper::org::webRtc::RTCIceComponent::RTCIceComponent_rtcp; + } + ZS_THROW_INVALID_ARGUMENT("RTCIceComponent is not understood: " + zsLib::string(value)); +} + +//----------------------------------------------------------------------------- +int UseEnum::toNative(wrapper::org::webRtc::RTCIceComponent value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceComponent::RTCIceComponent_rtp: return 1; + case wrapper::org::webRtc::RTCIceComponent::RTCIceComponent_rtcp: return 2; + } + ZS_ASSERT_FAIL("unknown type"); + return 0; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceConnectionState UseEnum::toWrapper(::webrtc::PeerConnectionInterface::IceConnectionState value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionNew: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_new; + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionChecking: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_checking; + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionConnected: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_connected; + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionCompleted: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_completed; + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionFailed: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_failed; + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionDisconnected: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_disconnected; + case ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionClosed: return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_closed; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_closed; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::IceConnectionState UseEnum::toNative(wrapper::org::webRtc::RTCIceConnectionState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_new: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionNew; + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_checking: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionChecking; + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_connected: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionConnected; + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_completed: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionCompleted; + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_failed: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionFailed; + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_disconnected: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionDisconnected; + case wrapper::org::webRtc::RTCIceConnectionState::RTCIceConnectionState_closed: return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionClosed; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::IceConnectionState::kIceConnectionClosed; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceGatheringState UseEnum::toWrapper(::webrtc::PeerConnectionInterface::IceGatheringState value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringNew: return wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_new; + case ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringGathering: return wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_gathering; + case ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringComplete: return wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_complete; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_complete; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::IceGatheringState UseEnum::toNative(wrapper::org::webRtc::RTCIceGatheringState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_new: return ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringNew; + case wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_gathering: return ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringGathering; + case wrapper::org::webRtc::RTCIceGatheringState::RTCIceGatheringState_complete: return ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringComplete; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::IceGatheringState::kIceGatheringComplete; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCSignalingState UseEnum::toWrapper(::webrtc::PeerConnectionInterface::SignalingState value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::SignalingState::kStable: return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_stable; + case ::webrtc::PeerConnectionInterface::SignalingState::kHaveLocalOffer: return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveLocalOffer; + case ::webrtc::PeerConnectionInterface::SignalingState::kHaveLocalPrAnswer: return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveLocalPranswer; + case ::webrtc::PeerConnectionInterface::SignalingState::kHaveRemoteOffer: return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveRemoteOffer; + case ::webrtc::PeerConnectionInterface::SignalingState::kHaveRemotePrAnswer: return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveRemotePranswer; + case ::webrtc::PeerConnectionInterface::SignalingState::kClosed: return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_closed; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_closed; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::SignalingState UseEnum::toNative(wrapper::org::webRtc::RTCSignalingState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_stable: return ::webrtc::PeerConnectionInterface::SignalingState::kStable; + case wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveLocalOffer: return ::webrtc::PeerConnectionInterface::SignalingState::kHaveLocalOffer; + case wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveLocalPranswer: return ::webrtc::PeerConnectionInterface::SignalingState::kHaveLocalPrAnswer; + case wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveRemoteOffer: return ::webrtc::PeerConnectionInterface::SignalingState::kHaveRemoteOffer; + case wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_haveRemotePranswer: return ::webrtc::PeerConnectionInterface::SignalingState::kHaveRemotePrAnswer; + case wrapper::org::webRtc::RTCSignalingState::RTCSignalingState_closed: return ::webrtc::PeerConnectionInterface::SignalingState::kClosed; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::SignalingState::kClosed; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceProtocol UseEnum::toWrapperRTCIceProtocol(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCIceProtocol enums[] = { + wrapper::org::webRtc::RTCIceProtocol::RTCIceProtocol_udp, + wrapper::org::webRtc::RTCIceProtocol::RTCIceProtocol_tcp + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("RTCIceProtocol is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCIceProtocol value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceProtocol::RTCIceProtocol_udp: return "udp"; + case wrapper::org::webRtc::RTCIceProtocol::RTCIceProtocol_tcp: return "tcp"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCIceTcpCandidateType UseEnum::toWrapperRTCIceTcpCandidateType(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCIceTcpCandidateType enums[] = { + wrapper::org::webRtc::RTCIceTcpCandidateType::RTCIceTcpCandidateType_active, + wrapper::org::webRtc::RTCIceTcpCandidateType::RTCIceTcpCandidateType_passive, + wrapper::org::webRtc::RTCIceTcpCandidateType::RTCIceTcpCandidateType_so + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(enums) / sizeof(enums[0]); ++loop) { + if (0 == str.compareNoCase(toString(enums[loop]))) return enums[loop]; + } + + ZS_THROW_INVALID_ARGUMENT("RTCIceTcpCandidateType is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCIceTcpCandidateType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCIceTcpCandidateType::RTCIceTcpCandidateType_active: return "active"; + case wrapper::org::webRtc::RTCIceTcpCandidateType::RTCIceTcpCandidateType_passive: return "passive"; + case wrapper::org::webRtc::RTCIceTcpCandidateType::RTCIceTcpCandidateType_so: return "so"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCPriorityType UseEnum::toWrapperRTCPriorityType(double value) noexcept +{ + static const wrapper::org::webRtc::RTCPriorityType values[] = + { + wrapper::org::webRtc::RTCPriorityType_veryLow, + wrapper::org::webRtc::RTCPriorityType_low, + wrapper::org::webRtc::RTCPriorityType_medium, + wrapper::org::webRtc::RTCPriorityType_high + }; + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (value <= toNative(values[loop])) return values[loop]; + } + return wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_high; +} + +//----------------------------------------------------------------------------- +double UseEnum::toNative(wrapper::org::webRtc::RTCPriorityType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_veryLow: return 0.25; + case wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_low: return 0.5; + case wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_medium: return 1.0; + case wrapper::org::webRtc::RTCPriorityType::RTCPriorityType_high: return 2.0; + } + ZS_ASSERT_FAIL("unknown type"); + return 1.0; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCRtpTransceiverDirection UseEnum::toWrapper(::webrtc::RtpTransceiverDirection value) noexcept +{ + switch (value) + { + case ::webrtc::RtpTransceiverDirection::kSendRecv: return wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_sendrecv; + case ::webrtc::RtpTransceiverDirection::kSendOnly: return wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_sendonly; + case ::webrtc::RtpTransceiverDirection::kRecvOnly: return wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_recvonly; + case ::webrtc::RtpTransceiverDirection::kInactive: return wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_inactive; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_inactive; +} + +//----------------------------------------------------------------------------- +::webrtc::RtpTransceiverDirection UseEnum::toNative(wrapper::org::webRtc::RTCRtpTransceiverDirection value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_sendrecv: return ::webrtc::RtpTransceiverDirection::kSendRecv; + case wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_sendonly: return ::webrtc::RtpTransceiverDirection::kSendOnly; + case wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_recvonly: return ::webrtc::RtpTransceiverDirection::kRecvOnly; + case wrapper::org::webRtc::RTCRtpTransceiverDirection::RTCRtpTransceiverDirection_inactive: return ::webrtc::RtpTransceiverDirection::kInactive; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::RtpTransceiverDirection::kInactive; +} + + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::VideoCaptureState UseEnum::toWrapper(::cricket::CaptureState value) noexcept +{ + switch (value) + { + case ::cricket::CaptureState::CS_STOPPED: return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_stopped; + case ::cricket::CaptureState::CS_STARTING: return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_starting; + case ::cricket::CaptureState::CS_RUNNING: return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_running; + case ::cricket::CaptureState::CS_FAILED: return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_failed; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_stopped; +} + +//----------------------------------------------------------------------------- +::cricket::CaptureState UseEnum::toNative(wrapper::org::webRtc::VideoCaptureState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_stopped: return ::cricket::CaptureState::CS_STOPPED; + case wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_starting: return ::cricket::CaptureState::CS_STARTING; + case wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_running: return ::cricket::CaptureState::CS_RUNNING; + case wrapper::org::webRtc::VideoCaptureState::VideoCaptureState_failed: return ::cricket::CaptureState::CS_FAILED; + } + ZS_ASSERT_FAIL("unknown type"); + return ::cricket::CaptureState::CS_STOPPED; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCStatsOutputLevel UseEnum::toWrapper(::webrtc::PeerConnectionInterface::StatsOutputLevel value) noexcept +{ + switch (value) + { + case ::webrtc::PeerConnectionInterface::kStatsOutputLevelStandard: return wrapper::org::webRtc::RTCStatsOutputLevel::RTCStatsOutputLevel_standard; + case ::webrtc::PeerConnectionInterface::kStatsOutputLevelDebug: return wrapper::org::webRtc::RTCStatsOutputLevel::RTCStatsOutputLevel_debug; + } + ZS_ASSERT_FAIL("unknown type"); + return wrapper::org::webRtc::RTCStatsOutputLevel::RTCStatsOutputLevel_standard; +} + +//----------------------------------------------------------------------------- +::webrtc::PeerConnectionInterface::StatsOutputLevel UseEnum::toNative(wrapper::org::webRtc::RTCStatsOutputLevel value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCStatsOutputLevel::RTCStatsOutputLevel_standard: return ::webrtc::PeerConnectionInterface::kStatsOutputLevelStandard; + case wrapper::org::webRtc::RTCStatsOutputLevel::RTCStatsOutputLevel_debug: return ::webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; + } + ZS_ASSERT_FAIL("unknown type"); + return ::webrtc::PeerConnectionInterface::kStatsOutputLevelStandard; +} + +//----------------------------------------------------------------------------- +zsLib::Optional<::webrtc::StatsReport::Direction> UseEnum::toWrapperDirection(const char *statId) noexcept +{ + zsLib::Optional<::webrtc::StatsReport::Direction> result {}; + + String str(statId); + if (str.isEmpty()) return result; + + const char *pos = strrchr(str.c_str(), kSeparator); + if (!pos) return result; + + String remainder(pos + 1); + + static const ::webrtc::StatsReport::Direction values[] = + { + ::webrtc::StatsReport::Direction::kSend, + ::webrtc::StatsReport::Direction::kReceive + }; + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (0 == remainder.compareNoCase(toString(values[loop]))) return values[loop]; + } + return result; +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(::webrtc::StatsReport::Direction value) noexcept +{ + switch (value) + { + case ::webrtc::StatsReport::Direction::kSend: return "send"; + case ::webrtc::StatsReport::Direction::kReceive: return "receive"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCStatsType UseEnum::toWrapperRTCStatsType(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCStatsType values[] = + { + wrapper::org::webRtc::RTCStatsType::RTCStatsType_codec, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_inboundRtp, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_outboundRtp, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_remoteInboundRtp, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_remoteOutboundRtp, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_csrc, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_peerConnection, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_dataChannel, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_stream, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_track, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_sender, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_receiver, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_transport, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_candidatePair, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_localCandidate, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_remoteCandidate, + wrapper::org::webRtc::RTCStatsType::RTCStatsType_certificate + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (0 == str.compareNoCase(toString(values[loop]))) return values[loop]; + } + ZS_THROW_INVALID_ARGUMENT("RTCStatsType is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCStatsType value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_codec: return ::webrtc::RTCCodecStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_inboundRtp: return ::webrtc::RTCInboundRTPStreamStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_outboundRtp: return ::webrtc::RTCOutboundRTPStreamStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_remoteInboundRtp: return "remote-inbound-rtp"; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_remoteOutboundRtp: return "remote-outbound-rtp"; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_csrc: return "csrc"; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_peerConnection: return ::webrtc::RTCPeerConnectionStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_dataChannel: return ::webrtc::RTCDataChannelStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_stream: return ::webrtc::RTCMediaStreamStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_track: return ::webrtc::RTCMediaStreamTrackStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_sender: return "sender"; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_receiver: return "receiver"; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_transport: return ::webrtc::RTCTransportStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_candidatePair: return ::webrtc::RTCIceCandidatePairStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_localCandidate: return ::webrtc::RTCLocalIceCandidateStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_remoteCandidate: return ::webrtc::RTCRemoteIceCandidateStats::kType; + case wrapper::org::webRtc::RTCStatsType::RTCStatsType_certificate: return ::webrtc::RTCCertificateStats::kType; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCDtlsTransportState UseEnum::toWrapperRTCDtlsTransportState(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCDtlsTransportState values[] = + { + wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_new, + wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_connecting, + wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_connected, + wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_closed, + wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_failed, + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (0 == str.compareNoCase(toString(values[loop]))) return values[loop]; + } + ZS_THROW_INVALID_ARGUMENT("RTCDtlsTransportState is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCDtlsTransportState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_new: return ::webrtc::RTCDtlsTransportState::kNew; + case wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_connecting: return ::webrtc::RTCDtlsTransportState::kConnecting; + case wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_connected: return ::webrtc::RTCDtlsTransportState::kConnected; + case wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_closed: return ::webrtc::RTCDtlsTransportState::kClosed; + case wrapper::org::webRtc::RTCDtlsTransportState::RTCDtlsTransportState_failed: return ::webrtc::RTCDtlsTransportState::kFailed; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCStatsIceCandidatePairState UseEnum::toWrapperRTCStatsIceCandidatePairState(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCStatsIceCandidatePairState values[] = + { + wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_frozen, + wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_waiting, + wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_inProgress, + wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_failed, + wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_succeeded, + wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_cancelled, + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (0 == str.compareNoCase(toString(values[loop]))) return values[loop]; + } + ZS_THROW_INVALID_ARGUMENT("RTCDtlsTransportState is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCStatsIceCandidatePairState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_frozen: return ::webrtc::RTCStatsIceCandidatePairState::kFrozen; + case wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_waiting: return ::webrtc::RTCStatsIceCandidatePairState::kWaiting; + case wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_inProgress: return ::webrtc::RTCStatsIceCandidatePairState::kInProgress; + case wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_failed: return ::webrtc::RTCStatsIceCandidatePairState::kFailed; + case wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_succeeded: return ::webrtc::RTCStatsIceCandidatePairState::kSucceeded; + case wrapper::org::webRtc::RTCStatsIceCandidatePairState::RTCStatsIceCandidatePairState_cancelled: return "cancelled"; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +wrapper::org::webRtc::RTCDataChannelState UseEnum::toWrapperRTCDataChannelState(const char *value) noexcept(false) +{ + static const wrapper::org::webRtc::RTCDataChannelState values[] = + { + wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_connecting, + wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_open, + wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closing, + wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closed, + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (0 == str.compareNoCase(toString(values[loop]))) return values[loop]; + } + ZS_THROW_INVALID_ARGUMENT("RTCDtlsTransportState is not understood: " + str); +} + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(wrapper::org::webRtc::RTCDataChannelState value) noexcept +{ + switch (value) + { + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_connecting: return ::webrtc::RTCDataChannelState::kConnecting; + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_open: return ::webrtc::RTCDataChannelState::kOpen; + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closing: return ::webrtc::RTCDataChannelState::kClosing; + case wrapper::org::webRtc::RTCDataChannelState::RTCDataChannelState_closed: return ::webrtc::RTCDataChannelState::kClosed; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + + +//----------------------------------------------------------------------------- +const char *UseEnum::toString(::cricket::MediaType value) noexcept +{ + switch (value) + { + case ::cricket::MediaType::MEDIA_TYPE_AUDIO: return ::webrtc::MediaStreamTrackInterface::kAudioKind; + case ::cricket::MediaType::MEDIA_TYPE_VIDEO: return ::webrtc::MediaStreamTrackInterface::kVideoKind; + case ::cricket::MediaType::MEDIA_TYPE_DATA: return kMediaTypeData; + } + ZS_ASSERT_FAIL("unknown type"); + return "unknown"; +} + +//----------------------------------------------------------------------------- +::cricket::MediaType UseEnum::toNativeMediaType(const char *value) noexcept(false) +{ + static const ::cricket::MediaType values[] = + { + ::cricket::MediaType::MEDIA_TYPE_AUDIO, + ::cricket::MediaType::MEDIA_TYPE_VIDEO, + ::cricket::MediaType::MEDIA_TYPE_DATA + }; + + String str(value); + + for (size_t loop = 0; loop < sizeof(values) / sizeof(values[0]); ++loop) { + if (0 == str.compareNoCase(toString(values[loop]))) return values[loop]; + } + ZS_THROW_INVALID_ARGUMENT("MediaType is not understood: " + str); +} diff --git a/webrtc/idl/wrapper/impl_org_webRtc_enums.h b/webrtc/idl/wrapper/impl_org_webRtc_enums.h new file mode 100644 index 00000000..f1031367 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_enums.h @@ -0,0 +1,207 @@ + +#pragma once + +#include "types.h" + +#include "impl_org_webRtc_pre_include.h" +#include "api/peerconnectioninterface.h" +#include "api/mediastreaminterface.h" +#include "api/datachannelinterface.h" +#include "api/statstypes.h" +#include "rtc_base/network_constants.h" +#include "impl_org_webRtc_post_include.h" + + +namespace webRtc +{ + enum class RTCErrorType; +} + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + // + // (helper functions) + // + + struct IEnum + { + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCErrorType toWrapper(::webrtc::RTCErrorType value) noexcept; + ZS_NO_DISCARD() static ::webrtc::RTCErrorType toNative(wrapper::org::webRtc::RTCErrorType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceTransportPolicy toWrapper(::webrtc::PeerConnectionInterface::IceTransportsType value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::IceTransportsType toNative(wrapper::org::webRtc::RTCIceTransportPolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCBundlePolicy toWrapper(::webrtc::PeerConnectionInterface::BundlePolicy value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::BundlePolicy toNative(wrapper::org::webRtc::RTCBundlePolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCRtcpMuxPolicy toWrapper(::webrtc::PeerConnectionInterface::RtcpMuxPolicy value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::RtcpMuxPolicy toNative(wrapper::org::webRtc::RTCRtcpMuxPolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCTcpCandidatePolicy toWrapper(::webrtc::PeerConnectionInterface::TcpCandidatePolicy value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::TcpCandidatePolicy toNative(wrapper::org::webRtc::RTCTcpCandidatePolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCCandidateNetworkPolicy toWrapper(::webrtc::PeerConnectionInterface::CandidateNetworkPolicy value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::CandidateNetworkPolicy toNative(wrapper::org::webRtc::RTCCandidateNetworkPolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCContinualGatheringPolicy toWrapper(::webrtc::PeerConnectionInterface::ContinualGatheringPolicy value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::ContinualGatheringPolicy toNative(wrapper::org::webRtc::RTCContinualGatheringPolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCNetworkType toWrapper(::rtc::AdapterType value) noexcept; + ZS_NO_DISCARD() static ::rtc::AdapterType toNative(wrapper::org::webRtc::RTCNetworkType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCNetworkType toWrapperRTCNetworkType(const char *value) noexcept(false); + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCNetworkType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCSdpSemantics toWrapper(::webrtc::SdpSemantics value) noexcept; + ZS_NO_DISCARD() static ::webrtc::SdpSemantics toNative(wrapper::org::webRtc::RTCSdpSemantics value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCTlsCertPolicy toWrapper(::webrtc::PeerConnectionInterface::TlsCertPolicy value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::TlsCertPolicy toNative(wrapper::org::webRtc::RTCTlsCertPolicy value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCSdpType toWrapper(::webrtc::SdpType value) noexcept; + ZS_NO_DISCARD() static ::webrtc::SdpType toNative(wrapper::org::webRtc::RTCSdpType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::MediaSourceState toWrapper(::webrtc::MediaSourceInterface::SourceState value) noexcept; + ZS_NO_DISCARD() static ::webrtc::MediaSourceInterface::SourceState toNative(wrapper::org::webRtc::MediaSourceState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::MediaStreamTrackState toWrapper(::webrtc::MediaStreamTrackInterface::TrackState value) noexcept; + ZS_NO_DISCARD() static ::webrtc::MediaStreamTrackInterface::TrackState toNative(wrapper::org::webRtc::MediaStreamTrackState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCConfigurationType toWrapper(::webrtc::PeerConnectionInterface::RTCConfigurationType value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::RTCConfigurationType toNative(wrapper::org::webRtc::RTCConfigurationType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCDataChannelState toWrapper(::webrtc::DataChannelInterface::DataState value) noexcept; + ZS_NO_DISCARD() static ::webrtc::DataChannelInterface::DataState toNative(wrapper::org::webRtc::RTCDataChannelState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCDegradationPreference toWrapper(::webrtc::DegradationPreference value) noexcept; + ZS_NO_DISCARD() static ::webrtc::DegradationPreference toNative(wrapper::org::webRtc::RTCDegradationPreference value) noexcept; + + ZS_NO_DISCARD() static const char *toString(::webrtc::FecMechanism value) noexcept; + ZS_NO_DISCARD() static ::webrtc::FecMechanism toNativeFecMechanism(const char *value) noexcept(false); // throws InvalidParameters + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCDtxStatus toWrapper(::webrtc::DtxStatus value) noexcept; + ZS_NO_DISCARD() static ::webrtc::DtxStatus toNative(wrapper::org::webRtc::RTCDtxStatus value) noexcept; + + ZS_NO_DISCARD() static const char *toString(::webrtc::RtcpFeedbackType value) noexcept; + ZS_NO_DISCARD() static ::webrtc::RtcpFeedbackType toNativeRtcpFeedbackType(const char *value) noexcept(false); // throws InvalidParameters + + ZS_NO_DISCARD() static const char *toString(::webrtc::RtcpFeedbackMessageType value) noexcept; + ZS_NO_DISCARD() static ::webrtc::RtcpFeedbackMessageType toNativeRtcpFeedbackMessageType(const char *value) noexcept(false); // throws InvalidParameters + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCECCurve toWrapper(::rtc::ECCurve value) noexcept; + ZS_NO_DISCARD() static ::rtc::ECCurve toNative(wrapper::org::webRtc::RTCECCurve value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCKeyType toWrapper(::rtc::KeyType value) noexcept; + ZS_NO_DISCARD() static ::rtc::KeyType toNative(wrapper::org::webRtc::RTCKeyType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceCandidateType toWrapperRTCIceCandidateType(const char *value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCIceCandidateType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceComponent toWrapperRTCIceComponent(int value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static int toNative(wrapper::org::webRtc::RTCIceComponent value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceConnectionState toWrapper(::webrtc::PeerConnectionInterface::IceConnectionState value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::IceConnectionState toNative(wrapper::org::webRtc::RTCIceConnectionState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceGatheringState toWrapper(::webrtc::PeerConnectionInterface::IceGatheringState value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::IceGatheringState toNative(wrapper::org::webRtc::RTCIceGatheringState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCSignalingState toWrapper(::webrtc::PeerConnectionInterface::SignalingState value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::SignalingState toNative(wrapper::org::webRtc::RTCSignalingState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceProtocol toWrapperRTCIceProtocol(const char *value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCIceProtocol value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCIceTcpCandidateType toWrapperRTCIceTcpCandidateType(const char *value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCIceTcpCandidateType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCPriorityType toWrapperRTCPriorityType(double value) noexcept; + ZS_NO_DISCARD() static double toNative(wrapper::org::webRtc::RTCPriorityType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCRtpTransceiverDirection toWrapper(::webrtc::RtpTransceiverDirection value) noexcept; + ZS_NO_DISCARD() static ::webrtc::RtpTransceiverDirection toNative(wrapper::org::webRtc::RTCRtpTransceiverDirection value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::VideoCaptureState toWrapper(::cricket::CaptureState value) noexcept; + ZS_NO_DISCARD() static ::cricket::CaptureState toNative(wrapper::org::webRtc::VideoCaptureState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCStatsOutputLevel toWrapper(::webrtc::PeerConnectionInterface::StatsOutputLevel value) noexcept; + ZS_NO_DISCARD() static ::webrtc::PeerConnectionInterface::StatsOutputLevel toNative(wrapper::org::webRtc::RTCStatsOutputLevel value) noexcept; + + ZS_NO_DISCARD() static zsLib::Optional<::webrtc::StatsReport::Direction> toWrapperDirection(const char *statId) noexcept; + ZS_NO_DISCARD() static const char *toString(::webrtc::StatsReport::Direction value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCStatsType toWrapperRTCStatsType(const char *value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCStatsType value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCDtlsTransportState toWrapperRTCDtlsTransportState(const char *value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCDtlsTransportState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCStatsIceCandidatePairState toWrapperRTCStatsIceCandidatePairState(const char *value) noexcept(false); // throws InvalidParameters + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCStatsIceCandidatePairState value) noexcept; + + ZS_NO_DISCARD() static wrapper::org::webRtc::RTCDataChannelState toWrapperRTCDataChannelState(const char *value) noexcept(false); + ZS_NO_DISCARD() static const char *toString(wrapper::org::webRtc::RTCDataChannelState value) noexcept; + + ZS_NO_DISCARD() static const char *toString(::cricket::MediaType value) noexcept; + ZS_NO_DISCARD() static ::cricket::MediaType toNativeMediaType(const char *value) noexcept(false); // throws InvalidParameters + + +#if 0 + + enum MediaType { + MEDIA_TYPE_AUDIO, + MEDIA_TYPE_VIDEO, + MEDIA_TYPE_DATA + }; + // not possible to convery + enum RTCCodecType { + RTCCodecType_encode, + RTCCodecType_decode, + }; + + // not possible to convert + enum RTCQualityLimitationReason { + RTCQualityLimitationReason_none, + RTCQualityLimitationReason_cpu, + RTCQualityLimitationReason_bandwidth, + RTCQualityLimitationReason_other, + }; + + // not possible to convert + enum RTCIceRole { + RTCIceRole_controlling, + RTCIceRole_controlled, + }; + + // no conversion possible + enum RTCPeerConnectionState { + RTCPeerConnectionState_new, + RTCPeerConnectionState_connecting, + RTCPeerConnectionState_connected, + RTCPeerConnectionState_disconnected, + RTCPeerConnectionState_failed, + RTCPeerConnectionState_closed, + }; + + // no conversion possible + enum RTCIceCredentialType { + RTCIceCredentialType_password, + RTCIceCredentialType_oauth, + }; + +#endif //0 + + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_helpers.cpp b/webrtc/idl/wrapper/impl_org_webRtc_helpers.cpp new file mode 100644 index 00000000..89e73386 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_helpers.cpp @@ -0,0 +1,42 @@ + + +#ifdef WINUWP + +#ifdef __cplusplus_winrt +#include +#endif //__cplusplus_winrt + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#else + +#ifdef _WIN32 +#endif //_WIN32 + +#endif //WINUWP + +#include "impl_org_webRtc_helpers.h" + +using ::zsLib::String; +using ::zsLib::Optional; +using ::zsLib::Any; +using ::zsLib::AnyPtr; +using ::zsLib::AnyHolder; +using ::zsLib::Promise; +using ::zsLib::PromisePtr; +using ::zsLib::PromiseWithHolder; +using ::zsLib::PromiseWithHolderPtr; +using ::zsLib::eventing::SecureByteBlock; +using ::zsLib::eventing::SecureByteBlockPtr; +using ::std::shared_ptr; +using ::std::weak_ptr; +using ::std::make_shared; +using ::std::list; +using ::std::set; +using ::std::map; + +namespace wrapper { namespace impl { namespace org { namespace webRtc { ZS_IMPLEMENT_SUBSYSTEM(wrapper_org_webRtc); } } } } diff --git a/webrtc/idl/wrapper/impl_org_webRtc_helpers.h b/webrtc/idl/wrapper/impl_org_webRtc_helpers.h new file mode 100644 index 00000000..fe1027f7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_helpers.h @@ -0,0 +1,137 @@ + +#pragma once + +#include "types.h" + +#include +#include + +#define WRAPPER_DEPROXIFY_CLASS(xProxyClass, xDerivedClassType, xPtr) \ + ::wrapper::impl::org::webRtc::deproxifyClass(xPtr) + +#ifdef WINUWP +#if defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION) +#define WRAPPER_TO_CX(xCxType, xWinrtObject) \ + ::wrapper::impl::org::webRtc::to_cx(xWinrtObject) +#define WRAPPER_FROM_CX(xWinrtType, xCxObject) \ + ::wrapper::impl::org::webRtc::from_cx(xCxObject) +#else +#define WRAPPER_TO_CX(xCxType, xWinrtObject) \ + ERROR_USING_CONVERSION_ROUTING_TO_CX_WHEN_BOTH_CX_AND_CPPWINRT_ARE_NOT_AVAILABLE() +#endif //defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION) +#endif //WINUWP + + +namespace wrapper { + namespace impl { + namespace org { + namespace webRtc { + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + // + // (helper functions) + // + + //--------------------------------------------------------------------- + template + ZS_NO_DISCARD() XOriginalInterfaceType *deproxifyClass(XOriginalInterfaceType *possibleProxy) noexcept + { + do + { + XProxyType *proxy = dynamic_cast(possibleProxy); + if (!proxy) break; + auto temp = proxy->internal(); + if (!temp) return possibleProxy; + possibleProxy = dynamic_cast(temp); + if (!possibleProxy) return temp; + } while (true); + return possibleProxy; + } + +#ifdef WINUWP +#if defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION) + // see: https://github.com/Microsoft/cppwinrt/blob/master/Docs/Interoperability%20Helper%20Functions.md + // from version: https://github.com/Microsoft/cppwinrt/blob/eaf572eafbc7506f977b9adcbdb7919751ef3e4b/Docs/Interoperability%20Helper%20Functions.md + + //--------------------------------------------------------------------- + template + T^ to_cx(winrt::Windows::Foundation::IUnknown const& from) + { + return safe_cast(reinterpret_cast(winrt::get_abi(from))); + } + + //--------------------------------------------------------------------- + template + T from_cx(Platform::Object^ from) + { + T to{ nullptr }; + + winrt::check_hresult(reinterpret_cast<::IUnknown*>(from)->QueryInterface(winrt::guid_of(), + reinterpret_cast(winrt::put_abi(to)))); + + return to; + } +#endif //defined(__cplusplus_winrt) && defined(CPPWINRT_VERSION) +#endif //WINUWP + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + // + // WrapperMapper + // + template + class WrapperMapper + { + public: + ZS_DECLARE_TYPEDEF_PTR(XWrapperImplType, WrapperImplType); + typedef XInterfaceType NativeType; + + typedef std::map NativeWrapperMap; + + //------------------------------------------------------------------- + WrapperImplTypePtr getExistingOrCreateNew( + NativeType *native, + std::function creatorFunc + ) noexcept + { + zsLib::AutoLock lock(lock_); + + { + auto found = map_.find(native); + if (found != map_.end()) { + auto &weak = found->second; + auto strong = weak.lock(); + if (!strong) goto create_new_entry; + return strong; + } + } + + create_new_entry: + auto temp = creatorFunc(); + map_[native] = temp; + return temp; + } + + //------------------------------------------------------------------- + void remove(NativeType *native) + { + if (!native) return; + zsLib::AutoLock lock(lock_); + map_.erase(native); + } + + private: + zsLib::Lock lock_; + NativeWrapperMap map_; + }; + + } // webRtc + } // org + } // namespace impl +} // namespace wrapper + diff --git a/webrtc/idl/wrapper/impl_org_webRtc_post_include.h b/webrtc/idl/wrapper/impl_org_webRtc_post_include.h new file mode 100644 index 00000000..8308bd85 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_post_include.h @@ -0,0 +1,4 @@ + +#ifdef _MSC_VER +#pragma warning(pop) +#endif //_MSC_VER diff --git a/webrtc/idl/wrapper/impl_org_webRtc_pre_include.h b/webrtc/idl/wrapper/impl_org_webRtc_pre_include.h new file mode 100644 index 00000000..fe303dd7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_org_webRtc_pre_include.h @@ -0,0 +1,73 @@ + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4100) +#pragma warning(disable: 4458) +#pragma warning(disable: 4244) +#pragma warning(disable: 4242) +#endif //_MSC_VER + +namespace cricket +{ + enum CaptureState; + enum MediaType; + + struct VideoFormat; +} + +// forward for webrtc can go here +namespace rtc +{ + class Thread; + class RTCCertificate; + class IntervalRange; + class KeyParams; + struct SSLFingerprint; + + struct RSAParams; + + enum ECCurve; + enum KeyType; +} + +namespace webrtc +{ + enum class SdpSemantics; + enum class SdpType; + enum class RtpTransceiverDirection; + + struct DataBuffer; + struct DataChannelInit; + struct RtpTransceiverInit; + struct RtpParameters; + struct RtpEncodingParameters; + struct RtpRtxParameters; + struct RtpFecParameters; + struct RtcpFeedback; + struct RtpCodecParameters; + struct RtpCodecCapability; + struct RtpHeaderExtensionCapability; + struct RtpExtension; + struct RtpCapabilities; + struct RtpParameters; + + class RtpSource; + class AudioTrackInterface; + class VideoTrackInterface; + class DtmfSenderInterface; + class RtpSenderInterface; + class RtpReceiverInterface; + class RtpTransceiverInterface; + class SessionDescriptionInterface; + class PeerConnectionInterface; + class PeerConnectionFactoryInterface; + class PeerConnectionFactory; + + class MediaSourceInterface; + class AudioSourceInterface; + class VideoTrackSourceInterface; + + class RTCError; + + class VideoFrame; +} diff --git a/webrtc/idl/wrapper/impl_webrtc_IMediaStreamSource.h b/webrtc/idl/wrapper/impl_webrtc_IMediaStreamSource.h new file mode 100644 index 00000000..671389ba --- /dev/null +++ b/webrtc/idl/wrapper/impl_webrtc_IMediaStreamSource.h @@ -0,0 +1,112 @@ + +#pragma once + +#ifdef WINUWP + +#ifdef __has_include +#if __has_include() +#include +#endif //__has_include() +#endif //__has_include + +#ifdef CPPWINRT_VERSION + +#include +#include "api/mediastreaminterface.h" +#include + +#include +#include +#include + +#include +#include +#include + + +namespace webrtc +{ + ZS_DECLARE_INTERACTION_PTR(IMediaStreamSource); + ZS_DECLARE_INTERACTION_PROXY(IMediaStreamSourceDelegate); + ZS_DECLARE_CLASS_PTR(MediaStreamSource); + ZS_DECLARE_INTERACTION_PROXY_SUBSCRIPTION(IMediaStreamSourceSubscription, IMediaStreamSourceDelegate); + + + interaction IMediaStreamSource + { + enum VideoFrameType + { + VideoFrameType_Default, + + VideoFrameType_I420 = VideoFrameType_Default, + VideoFrameType_H264, + + VideoFrameType_Last = VideoFrameType_H264, + }; + + struct CreationProperties + { + VideoFrameType frameType_ {}; + IMediaStreamSourceDelegatePtr delegate_; + + const char *id_{}; + float frameRateChangeTolerance_ {0.1f}; + }; + + static IMediaStreamSourcePtr create(const CreationProperties &info) noexcept; + + virtual IMediaStreamSourceSubscriptionPtr subscribe(IMediaStreamSourceDelegatePtr delegate) = 0; + + virtual winrt::Windows::Media::Core::MediaStreamSource source() const noexcept = 0; + virtual std::string id() const noexcept = 0; + + virtual uint32_t width() const noexcept = 0; + virtual uint32_t height() const noexcept = 0; + virtual int rotation() const noexcept = 0; + + virtual void notifyFrame(const webrtc::VideoFrame &frame) noexcept = 0; + }; + + interaction IMediaStreamSourceDelegate + { + virtual void onMediaStreamSourceResolutionChanged( + IMediaStreamSourcePtr source, + uint32_t width, + uint32_t height + ) = 0; + virtual void onMediaStreamSourceRotationChanged( + IMediaStreamSourcePtr source, + int rotation + ) = 0; + + virtual void onMediaStreamSourceFrameRateChanged( + IMediaStreamSourcePtr source, + float frameRate + ) = 0; + }; + + interaction IMediaStreamSourceSubscription + { + virtual zsLib::PUID getID() const noexcept = 0; + virtual void cancel() noexcept = 0; + virtual void background() noexcept = 0; + }; +} // namespace webrtc + + +ZS_DECLARE_PROXY_BEGIN(webrtc::IMediaStreamSourceDelegate) +ZS_DECLARE_PROXY_TYPEDEF(webrtc::IMediaStreamSourcePtr, IMediaStreamSourcePtr) +ZS_DECLARE_PROXY_METHOD(onMediaStreamSourceResolutionChanged, IMediaStreamSourcePtr, uint32_t, uint32_t) +ZS_DECLARE_PROXY_METHOD(onMediaStreamSourceRotationChanged, IMediaStreamSourcePtr, int) +ZS_DECLARE_PROXY_METHOD(onMediaStreamSourceFrameRateChanged, IMediaStreamSourcePtr, float) +ZS_DECLARE_PROXY_END() + +ZS_DECLARE_PROXY_SUBSCRIPTIONS_BEGIN(webrtc::IMediaStreamSourceDelegate, webrtc::IMediaStreamSourceSubscription) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_TYPEDEF(webrtc::IMediaStreamSourcePtr, IMediaStreamSourcePtr) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamSourceResolutionChanged, IMediaStreamSourcePtr, uint32_t, uint32_t) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamSourceRotationChanged, IMediaStreamSourcePtr, int) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_METHOD(onMediaStreamSourceFrameRateChanged, IMediaStreamSourcePtr, float) +ZS_DECLARE_PROXY_SUBSCRIPTIONS_END() + +#endif //CPPWINRT_VERSION +#endif //WINUWP diff --git a/webrtc/idl/wrapper/impl_webrtc_MediaStreamSource.cpp b/webrtc/idl/wrapper/impl_webrtc_MediaStreamSource.cpp new file mode 100644 index 00000000..7c1fac99 --- /dev/null +++ b/webrtc/idl/wrapper/impl_webrtc_MediaStreamSource.cpp @@ -0,0 +1,666 @@ + +#include "impl_webrtc_MediaStreamSource.h" + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + +#include +#include + +#include +#include "third_party/winuwp_h264/H264Decoder/H264Decoder.h" +#include "media/base/videocommon.h" +#include "libyuv/convert.h" +#include "rtc_base/logging.h" +#include + +#include + +//#include +//#include + +using namespace webrtc; +using zsLib::String; +using zsLib::Time; +using zsLib::Seconds; +using zsLib::Milliseconds; +using zsLib::AutoRecursiveLock; + +//----------------------------------------------------------------------------- +static bool isSampleIDR(IMFSample* sample) +{ + ZS_ASSERT(nullptr != sample); + + ComPtr pBuffer; + sample->GetBufferByIndex(0, &pBuffer); + BYTE* pBytes{}; + DWORD maxLength{}; + DWORD curLength{}; + if (FAILED(pBuffer->Lock(&pBytes, &maxLength, &curLength))) return false; + + bool found{}; + + // Search for the beginnings of nal units. + for (DWORD i = 0; i < curLength - 5; ++i) + { + BYTE* ptr = pBytes + i; + + if ((0x00 != ptr[0]) || (0x00 != ptr[1])) continue; + + int prefixLengthFound = 0; + + if ((0x00 == ptr[2]) && (0x01 == ptr[3])) + prefixLengthFound = 4; + else if (0x01 == ptr[2]) + prefixLengthFound = 3; + else continue; + + if (0x05 != (ptr[prefixLengthFound] & 0x1f)) continue; + + // Found IDR NAL unit + pBuffer->Unlock(); + found = true; + break; + } + pBuffer->Unlock(); + return found; +} + +//----------------------------------------------------------------------------- +MediaStreamSource::MediaStreamSource(const make_private &) : + subscriptions_(decltype(subscriptions_)::create()) +{ +} + +//----------------------------------------------------------------------------- +MediaStreamSource::~MediaStreamSource() +{ + thisWeak_.reset(); + stop(); +} + +//----------------------------------------------------------------------------- +MediaStreamSourcePtr MediaStreamSource::create(const CreationProperties &info) noexcept +{ + auto result = std::make_shared(make_private{}); + result->thisWeak_ = result; + result->init(info); + return result; +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::init(const CreationProperties &props) noexcept +{ + frameType_ = props.frameType_; + id_ = String(props.id_); + frameRateChangeTolerance_ = props.frameRateChangeTolerance_; + + if (props.delegate_) { + defaultSubscription_ = subscriptions_.subscribe(props.delegate_, zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue()); + } + + winrt::Windows::Media::MediaProperties::VideoEncodingProperties properties {nullptr}; + switch (frameType_) { + case VideoFrameType::VideoFrameType_H264: { + properties = winrt::Windows::Media::MediaProperties::VideoEncodingProperties::CreateH264(); + break; + } + case VideoFrameType::VideoFrameType_I420: { + properties = winrt::Windows::Media::MediaProperties::VideoEncodingProperties::CreateUncompressed(winrt::Windows::Media::MediaProperties::MediaEncodingSubtypes::Nv12(), 10, 10); + break; + } + } + + lastWidth_ = 720; + lastHeight_ = 1280; + + // Initial value, this will be override by incoming frame from webrtc. + // This is needed since the UI element might request sample before webrtc has + // incoming frame ready (ex.: remote stream), in this case, this initial value + // will make sure we will at least create a small dummy frame. + descriptor_ = winrt::Windows::Media::Core::VideoStreamDescriptor(properties); + descriptor_.EncodingProperties().Width(lastWidth_); + descriptor_.EncodingProperties().Height(lastHeight_); + descriptor_.EncodingProperties().FrameRate().Numerator(30); + descriptor_.EncodingProperties().FrameRate().Denominator(1); + + source_ = winrt::Windows::Media::Core::MediaStreamSource(descriptor_); + + auto thisWeak = thisWeak_; + + startingToken_ = source_.Starting([thisWeak](auto &&, auto &&args) { auto pThis = thisWeak.lock(); if (!pThis) return; pThis->handleStarting(args); }); + requestingSampleToken_ = source_.SampleRequested([thisWeak](auto &&, auto &&args) { auto pThis = thisWeak.lock(); if (!pThis) return; pThis->handleSampleRequested(args); } ); + stoppingToken_ = source_.Closed([thisWeak](auto &&, auto &&args) { auto pThis = thisWeak.lock(); if (!pThis) return; pThis->handleStreamClosed(args); }); +} + +//----------------------------------------------------------------------------- +IMediaStreamSourceSubscriptionPtr MediaStreamSource::subscribe(IMediaStreamSourceDelegatePtr originalDelegate) +{ + AutoRecursiveLock lock(lock_); + if (!originalDelegate) return defaultSubscription_; + + auto subscription = subscriptions_.subscribe(originalDelegate, zsLib::IMessageQueueThread::singletonUsingCurrentGUIThreadsMessageQueue()); + + auto delegate = subscriptions_.delegate(subscription, true); + + if (delegate) { + auto pThis = thisWeak_.lock(); + + if (firedResolutionChange_) { + delegate->onMediaStreamSourceResolutionChanged(pThis, lastWidth_, lastHeight_); + } + if (firedRotationChange_) { + delegate->onMediaStreamSourceRotationChanged(pThis, lastRotation_); + } + if (firedFrameRateChange_) { + delegate->onMediaStreamSourceFrameRateChanged(pThis, lastAverageFrameRate_); + } + } + + return subscription; +} + +//----------------------------------------------------------------------------- +uint32_t MediaStreamSource::width() const noexcept +{ + AutoRecursiveLock lock(lock_); + return lastWidth_; +} + +//----------------------------------------------------------------------------- +uint32_t MediaStreamSource::height() const noexcept +{ + AutoRecursiveLock lock(lock_); + return lastHeight_; +} + +//----------------------------------------------------------------------------- +int MediaStreamSource::rotation() const noexcept +{ + AutoRecursiveLock lock(lock_); + return lastRotation_; +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::notifyFrame(const webrtc::VideoFrame &frame) noexcept +{ + auto dataPtr = std::make_unique(); + auto &data = *dataPtr; + + data.width_ = frame.width(); + data.height_ = frame.height(); + data.rotation_ = frame.rotation(); + data.renderTime_ = static_cast(frame.render_time_ms()) * decltype(data.renderTime_)(10000); // 1000 * 10 => 100s nanosecond + + switch (frameType_) { + case VideoFrameType::VideoFrameType_I420: + { + data.frame_ = std::make_unique(frame.video_frame_buffer(), frame.rotation(), frame.timestamp()); + data.isIDR_ = true; + break; + } + case VideoFrameType::VideoFrameType_H264: + { + auto frameBuffer = static_cast(frame.video_frame_buffer().get()); + if (!frameBuffer) return; + + IMFSample* tmpSample = (IMFSample*)frameBuffer->native_handle(); + if (!tmpSample) return; + + tmpSample->AddRef(); + data.sample_.Attach(tmpSample); + + if (isSampleIDR(tmpSample)) { + data.isIDR_ = true; + + ComPtr sampleAttributes; + data.sample_.As(&sampleAttributes); + + // sampleAttributes->SetUINT32(MFSampleExtension_Discontinuity, TRUE); + sampleAttributes->SetUINT32(MFSampleExtension_CleanPoint, TRUE); + } + break; + } + } + + putInQueue(std::move(dataPtr)); + + notifyStartCompleteIfReady(); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::putInQueue(SampleDataUniPtr sample) noexcept +{ + { + AutoRecursiveLock lock(lock_); + + if (sample->isIDR_) { + ++totalIDRFramesInQueue_; + putIDRIntoQueue_ = true; + } else { + // reject sample if it's not an IDR and no IDR frames have ever been put in + if (!putIDRIntoQueue_) return; + } + queue_.push(std::move(sample)); + + // if a deferral is installed then flush only after the deferral is resolved + if (!requestingSampleDeferral_) { + flushQueueOfExcessiveIDRs(); + } + } + + pendingRequestRespondToRequestedFrame(); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::flushQueueOfExcessiveIDRs() noexcept +{ + // WARNING: MUST ALREADY BE IN A LOCK + + // no need to pop if there is only one IDR frame in the queue + if (totalIDRFramesInQueue_ < 2) return; + + // cannot flush more than 2 frames as a "look ahead" frame is needed to calculates the sample duration + if (queue_.size() < 3) return; + + // do not pop if the front sample is not an IDR + if (!queue_.front()->isIDR_) return; + + size_t totalEndOfQueueIDRs = (queue_.back()->isIDR_ ? 1 : 0); + + // never allow more than one IDR frame in the queue at a time + bool popping{}; + while (((totalIDRFramesInQueue_ - totalEndOfQueueIDRs) > 1) && (queue_.size() > 2)) { + popping = true; + popFromQueue(); + } + + if (popping) { + // pop until the next IDR is found + do { + { + auto &frontSample = queue_.front(); + if (frontSample->isIDR_) break; + } + popFromQueue(); + } while (true); + } +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::popFromQueue() noexcept +{ + { + auto &sample = queue_.front(); + if (sample->isIDR_) { + --totalIDRFramesInQueue_; + } + } + queue_.pop(); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::pendingRequestRespondToRequestedFrame() noexcept +{ + decltype(requestingSampleDeferral_) deferral {nullptr}; + decltype(requestSample_) request {nullptr}; + + { + AutoRecursiveLock lock(lock_); + deferral = requestingSampleDeferral_; + requestingSampleDeferral_ = nullptr; + request = requestSample_; + requestSample_ = nullptr; + } + + if (!deferral) return; + + if (!respondToRequest(request)) { + AutoRecursiveLock lock(lock_); + requestingSampleDeferral_ = deferral; + requestSample_ = request; + return; + } + deferral.Complete(); + deferral = nullptr; +} + +//----------------------------------------------------------------------------- +bool MediaStreamSource::respondToRequest(const winrt::Windows::Media::Core::MediaStreamSourceSampleRequest &request) noexcept +{ + ZS_ASSERT(request); + + auto data = dequeue(); + if (!data) return false; + + auto imfRequest = request.as(); + + if (!imfRequest) return false; + if (!data->sample_) return false; + + auto result = imfRequest->SetSample(data->sample_.Get()); + ZS_ASSERT(SUCCEEDED(result)); + + return SUCCEEDED(result); +} + +//----------------------------------------------------------------------------- +MediaStreamSource::SampleDataUniPtr MediaStreamSource::dequeue() noexcept +{ + SampleDataUniPtr result; + + bool frameRateChange{}; + bool resolutionChange{}; + bool rotationChange{}; + + { + AutoRecursiveLock lock(lock_); + + // must be at least 2 frames in the queue to be able to dequeue any single frame + if (queue_.size() < 2) return result; + + result = std::move(queue_.front()); + queue_.pop(); + + auto &sample = *result; + auto &lookAheadSample = *(queue_.front()); + + if (0 == firstRenderTime_) firstRenderTime_ = sample.renderTime_; // zero base the sample time + sample.renderTime_ -= firstRenderTime_; + sample.renderTime_ += 45; + + switch (frameType_) { + case VideoFrameType::VideoFrameType_I420: + { + // Only make full I420 frame when actually dequeing to prevent + // unneeded conversions where some I420 frames may end up being dropped. + if (!makeI420Sample(sample)) { + result.reset(); + return result; + } + + ComPtr sampleAttributes; + sample.sample_.As(&sampleAttributes); + if (sampleAttributes) { + sampleAttributes->SetUINT32(MFSampleExtension_CleanPoint, TRUE); + sampleAttributes->SetUINT32(MFSampleExtension_Discontinuity, TRUE); + } + LONGLONG duration = (LONGLONG)((1.0 / 30) * 1000 * 1000 * 10); + sample.sample_->SetSampleDuration(duration); + break; + } + case VideoFrameType::VideoFrameType_H264: + { + sample.renderTime_ = 0; + sample.sample_->SetSampleDuration(lookAheadSample.renderTime_ - sample.renderTime_); + break; + } + } + + + sample.sample_->SetSampleTime(sample.renderTime_); + + ++totalFrameCounted_; + frameRateChange = updateFrameRate(); + if ((sample.width_ != lastWidth_) || (sample.height_ != lastHeight_)) { + lastWidth_ = sample.width_; + lastHeight_ = sample.height_; + resolutionChange = true; + } + if (sample.rotation_ != lastRotation_) { + lastRotation_ = sample.rotation_; + rotationChange = true; + } + + if (rotationChange) { + auto props = descriptor_.EncodingProperties().Properties(); + props.Insert(MF_MT_VIDEO_ROTATION, winrt::box_value(static_cast(lastRotation_))); + } + if (resolutionChange) { + auto props = descriptor_.EncodingProperties(); + props.Width(sample.width_); + props.Height(sample.height_); + } + + flushQueueOfExcessiveIDRs(); + } + + if (frameRateChange) fireFrameRateChanged(); + if (resolutionChange) fireResolutionChanged(); + if (rotationChange) fireRotationChanged(); + + return result; +} + + +//------------------------------------------------------------------------- +bool MediaStreamSource::makeI420Sample(SampleData &sample) +{ + ZS_ASSERT(sample.frame_); + + ComPtr &spSample = sample.sample_; + HRESULT hr = MFCreateSample(spSample.GetAddressOf()); + if (FAILED(hr)) { + return false; + } + + ComPtr mediaBuffer; + hr = MFCreate2DMediaBuffer( + (DWORD)sample.frame_->width(), + (DWORD)sample.frame_->height(), + cricket::FOURCC_NV12, + FALSE, + mediaBuffer.GetAddressOf() + ); + + if (FAILED(hr)) { + return false; + } + + spSample->AddBuffer(mediaBuffer.Get()); + + ComPtr imageBuffer; + if (FAILED(mediaBuffer.As(&imageBuffer))) { + return false; + } + + BYTE* destRawData; + BYTE* buffer; + LONG pitch; + DWORD destMediaBufferSize; + + if (FAILED(imageBuffer->Lock2DSize(MF2DBuffer_LockFlags_Write, &destRawData, &pitch, &buffer, &destMediaBufferSize))) { + return false; + } + + try { + // Convert to NV12 + rtc::scoped_refptr frameBuffer = static_cast(sample.frame_->video_frame_buffer().get()); + + uint8* uvDest = destRawData + (pitch * sample.frame_->height()); + libyuv::I420ToNV12( + frameBuffer->DataY(), frameBuffer->StrideY(), + frameBuffer->DataU(), frameBuffer->StrideU(), + frameBuffer->DataV(), frameBuffer->StrideV(), + reinterpret_cast(destRawData), + pitch, + uvDest, + pitch, + static_cast(sample.frame_->width()), + static_cast(sample.frame_->height()) + ); + } catch (...) { + RTC_LOG(LS_ERROR) << "Exception caught in MediaStreamSource::ConvertFrame()"; + } + imageBuffer->Unlock2D(); + + return true; +} + +//----------------------------------------------------------------------------- +bool MediaStreamSource::updateFrameRate() noexcept +{ + if (Time() == lastTimeChecked_) { + lastTimeChecked_ = zsLib::now(); + totalFrameCounted_ = 0; + return true; + } + + auto tick = zsLib::now(); + auto diff = tick - lastTimeChecked_; + + if (diff < Seconds(1)) return false; + + lastTimeChecked_ = tick; + float fps = (float(totalFrameCounted_) / float(zsLib::toMilliseconds(diff).count())) * 1000.0f; + auto diffFps = abs(lastAverageFrameRate_ - fps); + if (diffFps > frameRateChangeTolerance_) { + lastAverageFrameRate_ = fps; + totalFrameCounted_ = 0; + return true; + } else { + totalFrameCounted_ = 0; + return false; + } +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::fireResolutionChanged() noexcept +{ + firedResolutionChange_ = true; + subscriptions_.delegate()->onMediaStreamSourceResolutionChanged(thisWeak_.lock(), lastWidth_, lastHeight_); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::fireRotationChanged() noexcept +{ + firedRotationChange_ = true; + subscriptions_.delegate()->onMediaStreamSourceRotationChanged(thisWeak_.lock(), lastRotation_); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::fireFrameRateChanged() noexcept +{ + firedFrameRateChange_ = true; + subscriptions_.delegate()->onMediaStreamSourceFrameRateChanged(thisWeak_.lock(), lastAverageFrameRate_); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::notifyStartCompleteIfReady() noexcept +{ + if (!started_) return; + + decltype(startingDeferral_) startingDeferral {nullptr}; + decltype(startingArgs_) startingArgs {nullptr}; + + { + AutoRecursiveLock lock(lock_); + if (totalIDRFramesInQueue_ < 1) return; // not ready + + startingDeferral = startingDeferral_; + startingDeferral_ = nullptr; + + startingArgs = startingArgs_; + startingArgs_ = nullptr; + } + + if (!startingDeferral) return; + ZS_ASSERT(startingArgs); + + startingArgs.Request().SetActualStartPosition(winrt::Windows::Foundation::TimeSpan{}); + + startingDeferral.Complete(); + startingDeferral = nullptr; +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::stop() noexcept +{ + if (!stopping_.exchange(true)) return; + + decltype(startingDeferral_) startingDeferral {nullptr}; + decltype(requestingSampleDeferral_) requestingSampleDeferral {nullptr}; + + { + AutoRecursiveLock lock(lock_); + + if (source_) { + if (startingToken_) { + source_.Starting(startingToken_); + startingToken_ = winrt::event_token{}; + } + + if (requestingSampleToken_) { + source_.SampleRequested(requestingSampleToken_); + requestingSampleToken_ = decltype(requestingSampleToken_) {}; + } + + if (stoppingToken_) { + source_.Closed(stoppingToken_); + stoppingToken_ = decltype(stoppingToken_) {}; + } + } + + startingDeferral = startingDeferral_; + requestingSampleDeferral = requestingSampleDeferral_; + } + + if (startingDeferral) { + startingDeferral_.Complete(); + startingDeferral_ = nullptr; + } + + if (requestingSampleDeferral) { + requestingSampleDeferral.Complete(); + requestingSampleDeferral = nullptr; + } + + stopped_ = true; +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::handleStarting(const winrt::Windows::Media::Core::MediaStreamSourceStartingEventArgs &args) +{ + { + AutoRecursiveLock lock(lock_); + startingDeferral_ = args.Request().GetDeferral(); + startingArgs_ = args; + started_ = true; + } + + notifyStartCompleteIfReady(); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::handleSampleRequested(const winrt::Windows::Media::Core::MediaStreamSourceSampleRequestedEventArgs &args) +{ + auto request = args.Request(); + bool responded = respondToRequest(request); + if (responded) return; + + { + AutoRecursiveLock lock(lock_); + requestSample_ = request; + requestingSampleDeferral_ = requestSample_.GetDeferral(); + } + + // possible race condition where frame was inserted while deferral was installed + pendingRequestRespondToRequestedFrame(); +} + +//----------------------------------------------------------------------------- +void MediaStreamSource::handleStreamClosed(ZS_MAYBE_USED() const winrt::Windows::Media::Core::MediaStreamSourceClosedEventArgs &args) +{ + ZS_MAYBE_USED(args); + + stop(); +} + +//----------------------------------------------------------------------------- +IMediaStreamSourcePtr IMediaStreamSource::create(const CreationProperties &info) noexcept +{ + return MediaStreamSource::create(info); +} + +#endif //CPPWINRT_VERSION +#endif //WINUWP diff --git a/webrtc/idl/wrapper/impl_webrtc_MediaStreamSource.h b/webrtc/idl/wrapper/impl_webrtc_MediaStreamSource.h new file mode 100644 index 00000000..383986e7 --- /dev/null +++ b/webrtc/idl/wrapper/impl_webrtc_MediaStreamSource.h @@ -0,0 +1,144 @@ + +#pragma once + +#include "impl_webrtc_IMediaStreamSource.h" + +#ifdef WINUWP +#ifdef CPPWINRT_VERSION + +#include +#include "api/mediastreaminterface.h" +#include "rtc_base/criticalsection.h" +#include + +#include +#include +#include + +#include +#include +#include + +namespace webrtc +{ + class MediaStreamSource : public IMediaStreamSource + { + private: + typedef Microsoft::WRL::ComPtr IMFSampleComPtr; + struct make_private {}; + + typedef uint32_t DimensionType; + typedef int RotationType; + typedef LONGLONG RenderTime; // The presentation time, in 100-nanosecond units. + + ZS_DECLARE_STRUCT_PTR(SampleData); + + typedef std::queue< SampleDataUniPtr > SampleDataQueue; + + struct SampleData + { + std::unique_ptr frame_; + IMFSampleComPtr sample_; + DimensionType width_ {}; + DimensionType height_ {}; + RotationType rotation_ {}; + RenderTime renderTime_ {}; + bool isIDR_ {}; + }; + + private: + void init(const CreationProperties &props) noexcept; + + public: + + MediaStreamSource(const make_private &); + ~MediaStreamSource(); + + static MediaStreamSourcePtr create(const CreationProperties &info) noexcept; + + IMediaStreamSourceSubscriptionPtr subscribe(IMediaStreamSourceDelegatePtr delegate) override; + + winrt::Windows::Media::Core::MediaStreamSource source() const noexcept override { return source_; } + std::string id() const noexcept override { return id_; } + + uint32_t width() const noexcept override; + uint32_t height() const noexcept override; + int rotation() const noexcept override; + + void notifyFrame(const webrtc::VideoFrame &frame) noexcept override; + + private: + void putInQueue(SampleDataUniPtr sample) noexcept; + void flushQueueOfExcessiveIDRs() noexcept; + void popFromQueue() noexcept; + + void pendingRequestRespondToRequestedFrame() noexcept; + bool respondToRequest(const winrt::Windows::Media::Core::MediaStreamSourceSampleRequest &request) noexcept; + SampleDataUniPtr dequeue() noexcept; + bool makeI420Sample(SampleData &sample); + + bool updateFrameRate() noexcept; + + void fireResolutionChanged() noexcept; + void fireRotationChanged() noexcept; + void fireFrameRateChanged() noexcept; + + void notifyStartCompleteIfReady() noexcept; + void stop() noexcept; + + void handleStarting(const winrt::Windows::Media::Core::MediaStreamSourceStartingEventArgs &args); + void handleSampleRequested(const winrt::Windows::Media::Core::MediaStreamSourceSampleRequestedEventArgs &args); + void handleStreamClosed(const winrt::Windows::Media::Core::MediaStreamSourceClosedEventArgs &args); + + private: + MediaStreamSourceWeakPtr thisWeak_; + mutable zsLib::RecursiveLock lock_; + + IMediaStreamSourceDelegateSubscriptions subscriptions_; + IMediaStreamSourceSubscriptionPtr defaultSubscription_; + + VideoFrameType frameType_ {}; + std::string id_; + + winrt::Windows::Media::Core::MediaStreamSource source_ {nullptr}; + winrt::Windows::Media::Core::VideoStreamDescriptor descriptor_ {nullptr}; + + std::atomic_bool started_ {}; + std::atomic_bool stopping_ {}; + std::atomic_bool stopped_ {}; + winrt::event_token startingToken_ {}; + winrt::Windows::Media::Core::MediaStreamSourceStartingRequestDeferral startingDeferral_ {nullptr}; + winrt::Windows::Media::Core::MediaStreamSourceStartingEventArgs startingArgs_ {nullptr}; + + winrt::event_token requestingSampleToken_ {}; + winrt::Windows::Media::Core::MediaStreamSourceSampleRequest requestSample_ {nullptr}; + winrt::Windows::Media::Core::MediaStreamSourceSampleRequestDeferral requestingSampleDeferral_ {nullptr}; + + winrt::event_token stoppingToken_ {}; + + bool putIDRIntoQueue_{}; + + size_t totalFrameCounted_ {}; + + std::atomic_bool firedResolutionChange_{}; + DimensionType lastWidth_ {}; + DimensionType lastHeight_ {}; + + std::atomic_bool firedRotationChange_{}; + RotationType lastRotation_{}; + + std::atomic_bool firedFrameRateChange_{}; + float frameRateChangeTolerance_ {}; + float lastAverageFrameRate_ {}; + zsLib::Time lastTimeChecked_ {}; + + RenderTime firstRenderTime_ {}; + + SampleDataQueue queue_; + size_t totalIDRFramesInQueue_ {}; + }; + +} + +#endif //CPPWINRT_VERSION +#endif //WINUWP diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueue.cpp b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueue.cpp new file mode 100644 index 00000000..bac35855 --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueue.cpp @@ -0,0 +1,113 @@ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#include +#include +#include +#include + +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperClone(org_webRtc_EventQueue_t handle) +{ + typedef wrapper::org::webRtc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast(new WrapperTypePtr(*reinterpret_cast(handle))); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperDestroy(org_webRtc_EventQueue_t handle) +{ + typedef wrapper::org::webRtc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return; + delete reinterpret_cast(handle); +} + +//------------------------------------------------------------------------------ +instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperInstanceId(org_webRtc_EventQueue_t handle) +{ + typedef wrapper::org::webRtc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast((*reinterpret_cast(handle)).get()); +} + +#if 0 +//------------------------------------------------------------------------------ +org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperCreate_EventQueueWithNativeQueue(zs_Any_t queue) +{ + auto wrapperThis = wrapper::org::webRtc::EventQueue::wrapper_create(); + wrapperThis->wrapper_init_org_webRtc_EventQueue(wrapper::zs_Any_wrapperFromHandle(queue)); + return wrapper::org_webRtc_EventQueue_wrapperToHandle(wrapperThis); +} +#endif /* 0 NOT USED */ + +//------------------------------------------------------------------------------ +org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_getDefaultForUi() +{ + return wrapper::org_webRtc_EventQueue_wrapperToHandle(wrapper::org::webRtc::EventQueue::getDefaultForUi()); +} + +//------------------------------------------------------------------------------ +org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_get_singleton() +{ + return wrapper::org_webRtc_EventQueue_wrapperToHandle(wrapper::org::webRtc::EventQueue::get_singleton()); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_set_singleton(org_webRtc_EventQueue_t value) +{ + wrapper::org::webRtc::EventQueue::set_singleton(wrapper::org_webRtc_EventQueue_wrapperFromHandle(value)); +} + +#if 0 +//------------------------------------------------------------------------------ +zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_get_queue(org_webRtc_EventQueue_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_webRtc_EventQueue_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_queue()); +} +#endif /* 0 NOT USED */ + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_webRtc_EventQueue_t org_webRtc_EventQueue_wrapperToHandle(wrapper::org::webRtc::EventQueuePtr value) + { + typedef org_webRtc_EventQueue_t CType; + typedef wrapper::org::webRtc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::webRtc::EventQueuePtr org_webRtc_EventQueue_wrapperFromHandle(org_webRtc_EventQueue_t handle) + { + typedef wrapper::org::webRtc::EventQueuePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueue.h b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueue.h new file mode 100644 index 00000000..ba6d7d0d --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueue.h @@ -0,0 +1,41 @@ + +#ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#pragma once + +#include + + +WEBRTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_webRtc_EventQueue*/ + +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperClone(org_webRtc_EventQueue_t handle); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperDestroy(org_webRtc_EventQueue_t handle); +WEBRTC_WRAPPER_C_EXPORT_API instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperInstanceId(org_webRtc_EventQueue_t handle); +#if 0 +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_wrapperCreate_EventQueueWithNativeQueue(zs_Any_t queue); +#endif /* 0 NOT USED */ +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_getDefaultForUi(); +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_get_singleton(); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_set_singleton(org_webRtc_EventQueue_t value); +#if 0 +WEBRTC_WRAPPER_C_EXPORT_API zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueue_get_queue(org_webRtc_EventQueue_t wrapperThisHandle); +#endif /* 0 NOT USED */ + + +WEBRTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_webRtc_EventQueue_t org_webRtc_EventQueue_wrapperToHandle(wrapper::org::webRtc::EventQueuePtr value); + wrapper::org::webRtc::EventQueuePtr org_webRtc_EventQueue_wrapperFromHandle(org_webRtc_EventQueue_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueueMaker.cpp b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueueMaker.cpp new file mode 100644 index 00000000..9980a113 --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueueMaker.cpp @@ -0,0 +1,65 @@ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +#if 0 +//------------------------------------------------------------------------------ +org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueueMaker_bind(zs_Any_t queue) +{ + return wrapper::org_webRtc_EventQueue_wrapperToHandle(wrapper::org::webRtc::EventQueueMaker::bind(wrapper::zs_Any_wrapperFromHandle(queue))); +} + +//------------------------------------------------------------------------------ +zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueueMaker_extract(org_webRtc_EventQueue_t queue) +{ + return wrapper::zs_Any_wrapperToHandle(wrapper::org::webRtc::EventQueueMaker::extract(wrapper::org_webRtc_EventQueue_wrapperFromHandle(queue))); +} +#endif //0 + +namespace wrapper +{ +#if 0 + //---------------------------------------------------------------------------- + org_webRtc_EventQueueMaker_t org_webRtc_EventQueueMaker_wrapperToHandle(wrapper::org::webRtc::EventQueueMakerPtr value) + { + typedef org_webRtc_EventQueueMaker_t CType; + typedef wrapper::org::webRtc::EventQueueMakerPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::webRtc::EventQueueMakerPtr org_webRtc_EventQueueMaker_wrapperFromHandle(org_webRtc_EventQueueMaker_t handle) + { + typedef wrapper::org::webRtc::EventQueueMakerPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } +#endif //0 + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER */ + diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueueMaker.h b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueueMaker.h new file mode 100644 index 00000000..928a76ba --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_EventQueueMaker.h @@ -0,0 +1,36 @@ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#pragma once + +#include + + +WEBRTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_webRtc_EventQueueMaker*/ + +#if 0 +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_EventQueue_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueueMaker_bind(zs_Any_t queue); +WEBRTC_WRAPPER_C_EXPORT_API zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_EventQueueMaker_extract(org_webRtc_EventQueue_t queue); +#endif //0 + + +WEBRTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ +#if 0 + org_webRtc_EventQueueMaker_t org_webRtc_EventQueueMaker_wrapperToHandle(wrapper::org::webRtc::EventQueueMakerPtr value); + wrapper::org::webRtc::EventQueueMakerPtr org_webRtc_EventQueueMaker_wrapperFromHandle(org_webRtc_EventQueueMaker_t handle); +#endif //0 + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElement.cpp b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElement.cpp new file mode 100644 index 00000000..dd4e7de9 --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElement.cpp @@ -0,0 +1,93 @@ + +/* Generated by zsLibEventingTool */ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT +#include +#else /* C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT */ + +#include "c_helpers.h" +#include +#include +#include + +#include "c_org_webRtc_MediaElement.h" +#include "../org_webRtc_MediaElement.h" + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_webRtc_MediaElement_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperClone(org_webRtc_MediaElement_t handle) +{ + typedef wrapper::org::webRtc::MediaElementPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast(new WrapperTypePtr(*reinterpret_cast(handle))); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperDestroy(org_webRtc_MediaElement_t handle) +{ + typedef wrapper::org::webRtc::MediaElementPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return; + delete reinterpret_cast(handle); +} + +//------------------------------------------------------------------------------ +instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperInstanceId(org_webRtc_MediaElement_t handle) +{ + typedef wrapper::org::webRtc::MediaElementPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast((*reinterpret_cast(handle)).get()); +} + +//------------------------------------------------------------------------------ +org_webRtc_MediaElement_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperCreate_MediaElementWithNativeQueue(zs_Any_t queue) +{ + auto wrapperThis = wrapper::org::webRtc::MediaElement::wrapper_create(); + wrapperThis->wrapper_init_org_webRtc_MediaElement(wrapper::zs_Any_wrapperFromHandle(queue)); + return wrapper::org_webRtc_MediaElement_wrapperToHandle(wrapperThis); +} + +//------------------------------------------------------------------------------ +zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_get_element(org_webRtc_MediaElement_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_webRtc_MediaElement_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_element()); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_set_element(org_webRtc_MediaElement_t wrapperThisHandle, zs_Any_t value) +{ + auto wrapperThis = wrapper::org_webRtc_MediaElement_wrapperFromHandle(wrapperThisHandle); + wrapperThis->set_element(wrapper::zs_Any_wrapperFromHandle(value)); +} + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_webRtc_MediaElement_t org_webRtc_MediaElement_wrapperToHandle(wrapper::org::webRtc::MediaElementPtr value) + { + typedef org_webRtc_MediaElement_t CType; + typedef wrapper::org::webRtc::MediaElementPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::webRtc::MediaElementPtr org_webRtc_MediaElement_wrapperFromHandle(org_webRtc_MediaElement_t handle) + { + typedef wrapper::org::webRtc::MediaElementPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElement.h b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElement.h new file mode 100644 index 00000000..a511bd6c --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElement.h @@ -0,0 +1,39 @@ + +/* Generated by zsLibEventingTool */ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT +#include +#else /* C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT */ +#pragma once + +#include "types.h" + + +WEBRTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_webRtc_MediaElement*/ + +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_MediaElement_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperClone(org_webRtc_MediaElement_t handle); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperDestroy(org_webRtc_MediaElement_t handle); +WEBRTC_WRAPPER_C_EXPORT_API instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperInstanceId(org_webRtc_MediaElement_t handle); +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_MediaElement_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_wrapperCreate_MediaElementWithNativeQueue(zs_Any_t queue); +WEBRTC_WRAPPER_C_EXPORT_API zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_get_element(org_webRtc_MediaElement_t wrapperThisHandle); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElement_set_element(org_webRtc_MediaElement_t wrapperThisHandle, zs_Any_t value); + + +WEBRTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_webRtc_MediaElement_t org_webRtc_MediaElement_wrapperToHandle(wrapper::org::webRtc::MediaElementPtr value); + wrapper::org::webRtc::MediaElementPtr org_webRtc_MediaElement_wrapperFromHandle(org_webRtc_MediaElement_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElementMaker.cpp b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElementMaker.cpp new file mode 100644 index 00000000..087c7a4f --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElementMaker.cpp @@ -0,0 +1,57 @@ + +/* Generated by zsLibEventingTool */ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER +#include +#else /* C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER */ + +#include "c_helpers.h" +#include +#include +#include + +#include "c_org_webRtc_MediaElementMaker.h" +#include "../org_webRtc_MediaElementMaker.h" +#include "c_org_webRtc_MediaElement.h" + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_webRtc_MediaElement_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElementMaker_bind(zs_Any_t element) +{ + return wrapper::org_webRtc_MediaElement_wrapperToHandle(wrapper::org::webRtc::MediaElementMaker::bind(wrapper::zs_Any_wrapperFromHandle(element))); +} + +//------------------------------------------------------------------------------ +zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElementMaker_extract(org_webRtc_MediaElement_t element) +{ + return wrapper::zs_Any_wrapperToHandle(wrapper::org::webRtc::MediaElementMaker::extract(wrapper::org_webRtc_MediaElement_wrapperFromHandle(element))); +} + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_webRtc_MediaElementMaker_t org_webRtc_MediaElementMaker_wrapperToHandle(wrapper::org::webRtc::MediaElementMakerPtr value) + { + typedef org_webRtc_MediaElementMaker_t CType; + typedef wrapper::org::webRtc::MediaElementMakerPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::webRtc::MediaElementMakerPtr org_webRtc_MediaElementMaker_wrapperFromHandle(org_webRtc_MediaElementMaker_t handle) + { + typedef wrapper::org::webRtc::MediaElementMakerPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElementMaker.h b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElementMaker.h new file mode 100644 index 00000000..df8e30de --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaElementMaker.h @@ -0,0 +1,35 @@ + +/* Generated by zsLibEventingTool */ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER +#include +#else /* C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER */ +#pragma once + +#include "types.h" + + +WEBRTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_webRtc_MediaElementMaker*/ + +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_MediaElement_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElementMaker_bind(zs_Any_t element); +WEBRTC_WRAPPER_C_EXPORT_API zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaElementMaker_extract(org_webRtc_MediaElement_t element); + + +WEBRTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_webRtc_MediaElementMaker_t org_webRtc_MediaElementMaker_wrapperToHandle(wrapper::org::webRtc::MediaElementMakerPtr value); + wrapper::org::webRtc::MediaElementMakerPtr org_webRtc_MediaElementMaker_wrapperFromHandle(org_webRtc_MediaElementMaker_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaSource.cpp b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaSource.cpp new file mode 100644 index 00000000..8321cfa0 --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaSource.cpp @@ -0,0 +1,108 @@ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#include +#include +#include +#include + +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wheader-hygiene" +#endif /* __clang__ */ + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_webRtc_MediaSource_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperCreate_MediaSource() +{ + typedef org_webRtc_MediaSource_t CType; + typedef wrapper::org::webRtc::MediaSourcePtr WrapperTypePtr; + auto result = wrapper::org::webRtc::MediaSource::wrapper_create(); + result->wrapper_init_org_webRtc_MediaSource(); + return reinterpret_cast(new WrapperTypePtr(result)); +} + +//------------------------------------------------------------------------------ +org_webRtc_MediaSource_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperClone(org_webRtc_MediaSource_t handle) +{ + typedef wrapper::org::webRtc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast(new WrapperTypePtr(*reinterpret_cast(handle))); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperDestroy(org_webRtc_MediaSource_t handle) +{ + typedef wrapper::org::webRtc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return; + delete reinterpret_cast(handle); +} + +//------------------------------------------------------------------------------ +instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperInstanceId(org_webRtc_MediaSource_t handle) +{ + typedef wrapper::org::webRtc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast((*reinterpret_cast(handle)).get()); +} + +//------------------------------------------------------------------------------ +org_webRtc_MediaSource_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperCreate_MediaSourceWithNativeQueue(zs_Any_t queue) +{ + auto wrapperThis = wrapper::org::webRtc::MediaSource::wrapper_create(); + wrapperThis->wrapper_init_org_webRtc_MediaSource(wrapper::zs_Any_wrapperFromHandle(queue)); + return wrapper::org_webRtc_MediaSource_wrapperToHandle(wrapperThis); +} + +//------------------------------------------------------------------------------ +zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_get_source(org_webRtc_MediaSource_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_webRtc_MediaSource_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_source()); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_set_source(org_webRtc_MediaSource_t wrapperThisHandle, zs_Any_t value) +{ + auto wrapperThis = wrapper::org_webRtc_MediaSource_wrapperFromHandle(wrapperThisHandle); + wrapperThis->set_source(wrapper::zs_Any_wrapperFromHandle(value)); +} + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_webRtc_MediaSource_t org_webRtc_MediaSource_wrapperToHandle(wrapper::org::webRtc::MediaSourcePtr value) + { + typedef org_webRtc_MediaSource_t CType; + typedef wrapper::org::webRtc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::webRtc::MediaSourcePtr org_webRtc_MediaSource_wrapperFromHandle(org_webRtc_MediaSource_t handle) + { + typedef wrapper::org::webRtc::MediaSourcePtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaSource.h b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaSource.h new file mode 100644 index 00000000..4b28d982 --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_MediaSource.h @@ -0,0 +1,35 @@ + +#ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#pragma once + +#include + + +WEBRTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_webRtc_MediaSource*/ + +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_MediaSource_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperClone(org_webRtc_MediaSource_t handle); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperDestroy(org_webRtc_MediaSource_t handle); +WEBRTC_WRAPPER_C_EXPORT_API instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperInstanceId(org_webRtc_MediaSource_t handle); +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_MediaSource_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_wrapperCreate_MediaSourceWithNativeQueue(zs_Any_t queue); +WEBRTC_WRAPPER_C_EXPORT_API zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_get_source(org_webRtc_MediaSource_t wrapperThisHandle); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_MediaSource_set_source(org_webRtc_MediaSource_t wrapperThisHandle, zs_Any_t value); + + +WEBRTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_webRtc_MediaSource_t org_webRtc_MediaSource_wrapperToHandle(wrapper::org::webRtc::MediaSourcePtr value); + wrapper::org::webRtc::MediaSourcePtr org_webRtc_MediaSource_wrapperFromHandle(org_webRtc_MediaSource_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_VideoDeviceInfo.cpp b/webrtc/idl/wrapper/override/c/c_org_webRtc_VideoDeviceInfo.cpp new file mode 100644 index 00000000..b350117f --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_VideoDeviceInfo.cpp @@ -0,0 +1,88 @@ + +/* Generated by zsLibEventingTool */ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO +#include +#else /* C_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO */ + +#include "c_helpers.h" +#include +#include +#include + +#include "c_org_webRtc_VideoDeviceInfo.h" +#include "../org_webRtc_VideoDeviceInfo.h" + +using namespace wrapper; + +//------------------------------------------------------------------------------ +org_webRtc_VideoDeviceInfo_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperCreate_VideoDeviceInfo() +{ + typedef org_webRtc_VideoDeviceInfo_t CType; + typedef wrapper::org::webRtc::VideoDeviceInfoPtr WrapperTypePtr; + auto result = wrapper::org::webRtc::VideoDeviceInfo::wrapper_create(); + result->wrapper_init_org_webRtc_VideoDeviceInfo(); + return reinterpret_cast(new WrapperTypePtr(result)); +} + +//------------------------------------------------------------------------------ +org_webRtc_VideoDeviceInfo_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperClone(org_webRtc_VideoDeviceInfo_t handle) +{ + typedef wrapper::org::webRtc::VideoDeviceInfoPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast(new WrapperTypePtr(*reinterpret_cast(handle))); +} + +//------------------------------------------------------------------------------ +void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperDestroy(org_webRtc_VideoDeviceInfo_t handle) +{ + typedef wrapper::org::webRtc::VideoDeviceInfoPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return; + delete reinterpret_cast(handle); +} + +//------------------------------------------------------------------------------ +instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperInstanceId(org_webRtc_VideoDeviceInfo_t handle) +{ + typedef wrapper::org::webRtc::VideoDeviceInfoPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return 0; + return reinterpret_cast((*reinterpret_cast(handle)).get()); +} + +//------------------------------------------------------------------------------ +zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_get_info(org_webRtc_VideoDeviceInfo_t wrapperThisHandle) +{ + auto wrapperThis = wrapper::org_webRtc_VideoDeviceInfo_wrapperFromHandle(wrapperThisHandle); + return wrapper::zs_Any_wrapperToHandle(wrapperThis->get_info()); +} + + +namespace wrapper +{ + //---------------------------------------------------------------------------- + org_webRtc_VideoDeviceInfo_t org_webRtc_VideoDeviceInfo_wrapperToHandle(wrapper::org::webRtc::VideoDeviceInfoPtr value) + { + typedef org_webRtc_VideoDeviceInfo_t CType; + typedef wrapper::org::webRtc::VideoDeviceInfoPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (!value) return 0; + return reinterpret_cast(new WrapperTypePtr(value)); + } + + //---------------------------------------------------------------------------- + wrapper::org::webRtc::VideoDeviceInfoPtr org_webRtc_VideoDeviceInfo_wrapperFromHandle(org_webRtc_VideoDeviceInfo_t handle) + { + typedef wrapper::org::webRtc::VideoDeviceInfoPtr WrapperTypePtr; + typedef WrapperTypePtr * WrapperTypePtrRawPtr; + if (0 == handle) return WrapperTypePtr(); + return (*reinterpret_cast(handle)); + } + + +} /* namespace wrapper */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO */ diff --git a/webrtc/idl/wrapper/override/c/c_org_webRtc_VideoDeviceInfo.h b/webrtc/idl/wrapper/override/c/c_org_webRtc_VideoDeviceInfo.h new file mode 100644 index 00000000..89388398 --- /dev/null +++ b/webrtc/idl/wrapper/override/c/c_org_webRtc_VideoDeviceInfo.h @@ -0,0 +1,38 @@ + +/* Generated by zsLibEventingTool */ + + +#ifndef C_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO +#include +#else /* C_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO */ +#pragma once + +#include "types.h" + + +WEBRTC_WRAPPER_C_PLUS_PLUS_BEGIN_GUARD + + +/* org_webRtc_VideoDeviceInfo*/ + +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_VideoDeviceInfo_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperCreate_VideoDeviceInfo(); +WEBRTC_WRAPPER_C_EXPORT_API org_webRtc_VideoDeviceInfo_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperClone(org_webRtc_VideoDeviceInfo_t handle); +WEBRTC_WRAPPER_C_EXPORT_API void WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperDestroy(org_webRtc_VideoDeviceInfo_t handle); +WEBRTC_WRAPPER_C_EXPORT_API instance_id_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_wrapperInstanceId(org_webRtc_VideoDeviceInfo_t handle); +WEBRTC_WRAPPER_C_EXPORT_API zs_Any_t WEBRTC_WRAPPER_C_CALLING_CONVENTION org_webRtc_VideoDeviceInfo_get_info(org_webRtc_VideoDeviceInfo_t wrapperThisHandle); + + +WEBRTC_WRAPPER_C_PLUS_PLUS_END_GUARD + +#ifdef __cplusplus + + +namespace wrapper +{ + org_webRtc_VideoDeviceInfo_t org_webRtc_VideoDeviceInfo_wrapperToHandle(wrapper::org::webRtc::VideoDeviceInfoPtr value); + wrapper::org::webRtc::VideoDeviceInfoPtr org_webRtc_VideoDeviceInfo_wrapperFromHandle(org_webRtc_VideoDeviceInfo_t handle); + +} /* namespace wrapper */ +#endif /* __cplusplus */ + +#endif /* ifndef C_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO */ diff --git a/webrtc/idl/wrapper/override/cppwinrt/EventQueue.cpp b/webrtc/idl/wrapper/override/cppwinrt/EventQueue.cpp new file mode 100644 index 00000000..417f1f9b --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/EventQueue.cpp @@ -0,0 +1,173 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#include +#include "EventQueue.h" + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueue > Org::WebRtc::implementation::EventQueue::ToCppWinrtImpl(wrapper::org::webRtc::EventQueuePtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueue > Org::WebRtc::implementation::EventQueue::ToCppWinrtImpl(Org::WebRtc::EventQueue const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::EventQueue > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueue > Org::WebRtc::implementation::EventQueue::ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueue > Org::WebRtc::implementation::EventQueue::ToCppWinrtImpl(Org::WebRtc::IEventQueue const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::EventQueue > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrt(wrapper::org::webRtc::EventQueuePtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::EventQueue {nullptr}; + return result.as< Org::WebRtc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrt(Org::WebRtc::EventQueue const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value) +{ + if (!value) return Org::WebRtc::EventQueue {nullptr}; + return value.as< Org::WebRtc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrt(Org::WebRtc::IEventQueue const & value) +{ + if (!value) return Org::WebRtc::EventQueue {nullptr}; + return value.as< Org::WebRtc::EventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrtInterface(wrapper::org::webRtc::EventQueuePtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::IEventQueue {nullptr}; + return result.as< Org::WebRtc::IEventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrtInterface(Org::WebRtc::EventQueue const & value) +{ + if (!value) return Org::WebRtc::IEventQueue {nullptr}; + return value.as< Org::WebRtc::IEventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value) +{ + if (!value) return Org::WebRtc::IEventQueue {nullptr}; + return value.as< Org::WebRtc::IEventQueue >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueue::ToCppWinrtInterface(Org::WebRtc::IEventQueue const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr Org::WebRtc::implementation::EventQueue::FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value) +{ + if (!value) return wrapper::org::webRtc::EventQueuePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr Org::WebRtc::implementation::EventQueue::FromCppWinrt(Org::WebRtc::EventQueue const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr Org::WebRtc::implementation::EventQueue::FromCppWinrt(wrapper::org::webRtc::EventQueuePtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr Org::WebRtc::implementation::EventQueue::FromCppWinrt(Org::WebRtc::IEventQueue const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueue Org::WebRtc::implementation::EventQueue::Cast(Org::WebRtc::IEventQueue const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_WebRtc_EventQueue(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::webRtc::EventQueue >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +#if 0 +//------------------------------------------------------------------------------ +Org::WebRtc::implementation::EventQueue::EventQueue(Windows::Foundation::IInspectable const & queue) + : native_(wrapper::org::webRtc::EventQueue::wrapper_create()) +{ + if (!native_) {throw hresult_error(E_POINTER);} + native_->wrapper_init_org_webRtc_EventQueue(::Internal::Helper::FromCppWinrt(queue)); +} +#endif //0 + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueue::GetDefaultForUi() +{ + Org::WebRtc::IEventQueue result {nullptr}; + result = ::Internal::Helper::ToCppWinrt_Org_WebRtc_EventQueue(wrapper::org::webRtc::EventQueue::getDefaultForUi()); + return result; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueue::Singleton() +{ + return ::Internal::Helper::ToCppWinrt_Org_WebRtc_EventQueue(wrapper::org::webRtc::EventQueue::get_singleton()); +} + +//------------------------------------------------------------------------------ +void Org::WebRtc::implementation::EventQueue::Singleton(Org::WebRtc::IEventQueue const & value) +{ + wrapper::org::webRtc::EventQueue::set_singleton(::Internal::Helper::FromCppWinrt_Org_WebRtc_EventQueue(value)); +} + +#if 0 +//------------------------------------------------------------------------------ +Windows::Foundation::IInspectable Org::WebRtc::implementation::EventQueue::Queue() +{ + if (!native_) {throw hresult_error(E_POINTER);} + return ::Internal::Helper::ToCppWinrt(native_->get_queue()); +} +#endif //0 + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE diff --git a/webrtc/idl/wrapper/override/cppwinrt/EventQueue.h b/webrtc/idl/wrapper/override/cppwinrt/EventQueue.h new file mode 100644 index 00000000..abe4b7c3 --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/EventQueue.h @@ -0,0 +1,101 @@ + +#pragma once + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#include + +#include "EventQueue.g.h" +#include + +namespace winrt { + namespace Org { + namespace WebRtc { + namespace implementation { + + + /// + /// A message queue for receiving delegate events. + /// + struct EventQueue : EventQueueT + { + // internal + wrapper::org::webRtc::EventQueuePtr native_; + + struct WrapperCreate {}; + EventQueue(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::WebRtc::implementation::EventQueue > ToCppWinrtImpl(wrapper::org::webRtc::EventQueuePtr value); + static winrt::com_ptr< Org::WebRtc::implementation::EventQueue > ToCppWinrtImpl(Org::WebRtc::EventQueue const & value); + static winrt::com_ptr< Org::WebRtc::implementation::EventQueue > ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value); + static winrt::com_ptr< Org::WebRtc::implementation::EventQueue > ToCppWinrtImpl(Org::WebRtc::IEventQueue const & value); + + // ToCppWinrt + static Org::WebRtc::EventQueue ToCppWinrt(wrapper::org::webRtc::EventQueuePtr value); + static Org::WebRtc::EventQueue ToCppWinrt(Org::WebRtc::EventQueue const & value); + static Org::WebRtc::EventQueue ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value); + static Org::WebRtc::EventQueue ToCppWinrt(Org::WebRtc::IEventQueue const & value); + + // ToCppWinrtInterface + static Org::WebRtc::IEventQueue ToCppWinrtInterface(wrapper::org::webRtc::EventQueuePtr value); + static Org::WebRtc::IEventQueue ToCppWinrtInterface(Org::WebRtc::EventQueue const & value); + static Org::WebRtc::IEventQueue ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value); + static Org::WebRtc::IEventQueue ToCppWinrtInterface(Org::WebRtc::IEventQueue const & value); + + // FromCppWinrt + static wrapper::org::webRtc::EventQueuePtr FromCppWinrt(wrapper::org::webRtc::EventQueuePtr value); + static wrapper::org::webRtc::EventQueuePtr FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueue > const & value); + static wrapper::org::webRtc::EventQueuePtr FromCppWinrt(Org::WebRtc::EventQueue const & value); + static wrapper::org::webRtc::EventQueuePtr FromCppWinrt(Org::WebRtc::IEventQueue const & value); + + + + + public: + /// + /// Cast from Org::WebRtc::IEventQueue to EventQueue + /// + static Org::WebRtc::EventQueue Cast(Org::WebRtc::IEventQueue const & value); + + // ::org::webRtc::EventQueue + +#if 0 + /// + /// Constructs an event queue object from a native queue type. + /// + EventQueue(Windows::Foundation::IInspectable const & queue); +#endif //0 + /// + /// The default windows message queue for the system GUI thread. + /// + static Org::WebRtc::IEventQueue GetDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + static Org::WebRtc::IEventQueue Singleton(); + static void Singleton(Org::WebRtc::IEventQueue const & value); +#if 0 + /// + /// Gets a native queue from an event queue object. + /// + Windows::Foundation::IInspectable Queue(); +#endif //0 + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct EventQueue : EventQueueT + { + }; + + } // namespace factory_implementation + + } // namespace WebRtc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE diff --git a/webrtc/idl/wrapper/override/cppwinrt/EventQueueMaker.cpp b/webrtc/idl/wrapper/override/cppwinrt/EventQueueMaker.cpp new file mode 100644 index 00000000..5673a2ff --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/EventQueueMaker.cpp @@ -0,0 +1,154 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#include +#include "EventQueueMaker.h" +#include "EventQueue.h" + +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtImpl(wrapper::org::webRtc::EventQueueMakerPtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtImpl(Org::WebRtc::EventQueueMaker const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtImpl(Org::WebRtc::IEventQueueMaker const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrt(wrapper::org::webRtc::EventQueueMakerPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::EventQueueMaker {nullptr}; + return result.as< Org::WebRtc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrt(Org::WebRtc::EventQueueMaker const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value) +{ + if (!value) return Org::WebRtc::EventQueueMaker {nullptr}; + return value.as< Org::WebRtc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrt(Org::WebRtc::IEventQueueMaker const & value) +{ + if (!value) return Org::WebRtc::EventQueueMaker {nullptr}; + return value.as< Org::WebRtc::EventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtInterface(wrapper::org::webRtc::EventQueueMakerPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::IEventQueueMaker {nullptr}; + return result.as< Org::WebRtc::IEventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtInterface(Org::WebRtc::EventQueueMaker const & value) +{ + if (!value) return Org::WebRtc::IEventQueueMaker {nullptr}; + return value.as< Org::WebRtc::IEventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value) +{ + if (!value) return Org::WebRtc::IEventQueueMaker {nullptr}; + return value.as< Org::WebRtc::IEventQueueMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueueMaker Org::WebRtc::implementation::EventQueueMaker::ToCppWinrtInterface(Org::WebRtc::IEventQueueMaker const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueueMakerPtr Org::WebRtc::implementation::EventQueueMaker::FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value) +{ + if (!value) return wrapper::org::webRtc::EventQueueMakerPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueueMakerPtr Org::WebRtc::implementation::EventQueueMaker::FromCppWinrt(Org::WebRtc::EventQueueMaker const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueueMakerPtr Org::WebRtc::implementation::EventQueueMaker::FromCppWinrt(wrapper::org::webRtc::EventQueueMakerPtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueueMakerPtr Org::WebRtc::implementation::EventQueueMaker::FromCppWinrt(Org::WebRtc::IEventQueueMaker const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueueMaker Org::WebRtc::implementation::EventQueueMaker::Cast(Org::WebRtc::IEventQueueMaker const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_WebRtc_EventQueueMaker(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::webRtc::EventQueueMaker >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IEventQueue Org::WebRtc::implementation::EventQueueMaker::Bind(Windows::UI::Core::CoreDispatcher const & queue) +{ + Org::WebRtc::IEventQueue result {nullptr}; + result = Org::WebRtc::implementation::EventQueue::ToCppWinrtInterface(wrapper::impl::org::webRtc::EventQueue::toWrapper(queue)); + return result; +} + +//------------------------------------------------------------------------------ +Windows::UI::Core::CoreDispatcher Org::WebRtc::implementation::EventQueueMaker::Extract(Org::WebRtc::IEventQueue const & queue) +{ + Windows::UI::Core::CoreDispatcher result {nullptr}; + result = wrapper::impl::org::webRtc::EventQueue::toNative_winrt(Org::WebRtc::implementation::EventQueue::FromCppWinrt(queue)); + return result; +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER diff --git a/webrtc/idl/wrapper/override/cppwinrt/EventQueueMaker.h b/webrtc/idl/wrapper/override/cppwinrt/EventQueueMaker.h new file mode 100644 index 00000000..4c6d4051 --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/EventQueueMaker.h @@ -0,0 +1,86 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#include + +#include "EventQueueMaker.g.h" +#include + +namespace winrt { + namespace Org { + namespace WebRtc { + namespace implementation { + + + struct EventQueueMaker : EventQueueMakerT + { + // internal + wrapper::org::webRtc::EventQueueMakerPtr native_; + + struct WrapperCreate {}; + EventQueueMaker(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > ToCppWinrtImpl(wrapper::org::webRtc::EventQueueMakerPtr value); + static winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > ToCppWinrtImpl(Org::WebRtc::EventQueueMaker const & value); + static winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value); + static winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > ToCppWinrtImpl(Org::WebRtc::IEventQueueMaker const & value); + + // ToCppWinrt + static Org::WebRtc::EventQueueMaker ToCppWinrt(wrapper::org::webRtc::EventQueueMakerPtr value); + static Org::WebRtc::EventQueueMaker ToCppWinrt(Org::WebRtc::EventQueueMaker const & value); + static Org::WebRtc::EventQueueMaker ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value); + static Org::WebRtc::EventQueueMaker ToCppWinrt(Org::WebRtc::IEventQueueMaker const & value); + + // ToCppWinrtInterface + static Org::WebRtc::IEventQueueMaker ToCppWinrtInterface(wrapper::org::webRtc::EventQueueMakerPtr value); + static Org::WebRtc::IEventQueueMaker ToCppWinrtInterface(Org::WebRtc::EventQueueMaker const & value); + static Org::WebRtc::IEventQueueMaker ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value); + static Org::WebRtc::IEventQueueMaker ToCppWinrtInterface(Org::WebRtc::IEventQueueMaker const & value); + + // FromCppWinrt + static wrapper::org::webRtc::EventQueueMakerPtr FromCppWinrt(wrapper::org::webRtc::EventQueueMakerPtr value); + static wrapper::org::webRtc::EventQueueMakerPtr FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::EventQueueMaker > const & value); + static wrapper::org::webRtc::EventQueueMakerPtr FromCppWinrt(Org::WebRtc::EventQueueMaker const & value); + static wrapper::org::webRtc::EventQueueMakerPtr FromCppWinrt(Org::WebRtc::IEventQueueMaker const & value); + + + + + public: + /// + /// Cast from Org::WebRtc::IEventQueueMaker to EventQueueMaker + /// + static Org::WebRtc::EventQueueMaker Cast(Org::WebRtc::IEventQueueMaker const & value); + + // ::org::webRtc::EventQueueMaker + + /// + /// Creates an event queue object from a native queue type. + /// + static Org::WebRtc::IEventQueue Bind(Windows::UI::Core::CoreDispatcher const & queue); + /// + /// Extracts a native queue from an event queue object. + /// + static Windows::UI::Core::CoreDispatcher Extract(Org::WebRtc::IEventQueue const & queue); + + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct EventQueueMaker : EventQueueMakerT + { + }; + + } // namespace factory_implementation + + } // namespace WebRtc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER diff --git a/webrtc/idl/wrapper/override/cppwinrt/MediaElement.cpp b/webrtc/idl/wrapper/override/cppwinrt/MediaElement.cpp new file mode 100644 index 00000000..a71d28bb --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/MediaElement.cpp @@ -0,0 +1,155 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT + +#include +#include + +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElement > Org::WebRtc::implementation::MediaElement::ToCppWinrtImpl(wrapper::org::webRtc::MediaElementPtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElement > Org::WebRtc::implementation::MediaElement::ToCppWinrtImpl(Org::WebRtc::MediaElement const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::MediaElement > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElement > Org::WebRtc::implementation::MediaElement::ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElement > Org::WebRtc::implementation::MediaElement::ToCppWinrtImpl(Org::WebRtc::IMediaElement const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::MediaElement > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrt(wrapper::org::webRtc::MediaElementPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::MediaElement {nullptr}; + return result.as< Org::WebRtc::MediaElement >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrt(Org::WebRtc::MediaElement const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value) +{ + if (!value) return Org::WebRtc::MediaElement {nullptr}; + return value.as< Org::WebRtc::MediaElement >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrt(Org::WebRtc::IMediaElement const & value) +{ + if (!value) return Org::WebRtc::MediaElement {nullptr}; + return value.as< Org::WebRtc::MediaElement >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrtInterface(wrapper::org::webRtc::MediaElementPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::IMediaElement {nullptr}; + return result.as< Org::WebRtc::IMediaElement >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrtInterface(Org::WebRtc::MediaElement const & value) +{ + if (!value) return Org::WebRtc::IMediaElement {nullptr}; + return value.as< Org::WebRtc::IMediaElement >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value) +{ + if (!value) return Org::WebRtc::IMediaElement {nullptr}; + return value.as< Org::WebRtc::IMediaElement >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElement Org::WebRtc::implementation::MediaElement::ToCppWinrtInterface(Org::WebRtc::IMediaElement const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr Org::WebRtc::implementation::MediaElement::FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value) +{ + if (!value) return wrapper::org::webRtc::MediaElementPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr Org::WebRtc::implementation::MediaElement::FromCppWinrt(Org::WebRtc::MediaElement const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr Org::WebRtc::implementation::MediaElement::FromCppWinrt(wrapper::org::webRtc::MediaElementPtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr Org::WebRtc::implementation::MediaElement::FromCppWinrt(Org::WebRtc::IMediaElement const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElement Org::WebRtc::implementation::MediaElement::Cast(Org::WebRtc::IMediaElement const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_WebRtc_MediaElement(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::webRtc::MediaElement >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +#if 0 +//------------------------------------------------------------------------------ +Windows::UI::Xaml::Controls::MediaElement Org::WebRtc::implementation::MediaElement::Element() +{ + if (!native_) {throw hresult_error(E_POINTER);} + + Windows::UI::Xaml::Controls::MediaElement result{ nullptr }; + result = wrapper::impl::org::webRtc::MediaElement::toNative_winrt(native_); + return result; +} + +//------------------------------------------------------------------------------ +void Org::WebRtc::implementation::MediaElement::Element(Windows::UI::Xaml::Controls::MediaElement const & element) +{ + native_ = wrapper::impl::org::webRtc::MediaElement::toWrapper(element); +} +#endif //0 + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT diff --git a/webrtc/idl/wrapper/override/cppwinrt/MediaElement.h b/webrtc/idl/wrapper/override/cppwinrt/MediaElement.h new file mode 100644 index 00000000..f01714fa --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/MediaElement.h @@ -0,0 +1,93 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT + +#include + +#include "MediaElement.g.h" +#include + +namespace winrt { + namespace Org { + namespace WebRtc { + namespace implementation { + + + /// + /// MediaSource represents an object holder for a platform specific + /// media element. + /// + struct MediaElement : MediaElementT + { + // internal + wrapper::org::webRtc::MediaElementPtr native_; + + struct WrapperCreate {}; + MediaElement(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::WebRtc::implementation::MediaElement > ToCppWinrtImpl(wrapper::org::webRtc::MediaElementPtr value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaElement > ToCppWinrtImpl(Org::WebRtc::MediaElement const & value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaElement > ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaElement > ToCppWinrtImpl(Org::WebRtc::IMediaElement const & value); + + // ToCppWinrt + static Org::WebRtc::MediaElement ToCppWinrt(wrapper::org::webRtc::MediaElementPtr value); + static Org::WebRtc::MediaElement ToCppWinrt(Org::WebRtc::MediaElement const & value); + static Org::WebRtc::MediaElement ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value); + static Org::WebRtc::MediaElement ToCppWinrt(Org::WebRtc::IMediaElement const & value); + + // ToCppWinrtInterface + static Org::WebRtc::IMediaElement ToCppWinrtInterface(wrapper::org::webRtc::MediaElementPtr value); + static Org::WebRtc::IMediaElement ToCppWinrtInterface(Org::WebRtc::MediaElement const & value); + static Org::WebRtc::IMediaElement ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value); + static Org::WebRtc::IMediaElement ToCppWinrtInterface(Org::WebRtc::IMediaElement const & value); + + // FromCppWinrt + static wrapper::org::webRtc::MediaElementPtr FromCppWinrt(wrapper::org::webRtc::MediaElementPtr value); + static wrapper::org::webRtc::MediaElementPtr FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElement > const & value); + static wrapper::org::webRtc::MediaElementPtr FromCppWinrt(Org::WebRtc::MediaElement const & value); + static wrapper::org::webRtc::MediaElementPtr FromCppWinrt(Org::WebRtc::IMediaElement const & value); + + + + + public: + /// + /// Cast from Org::WebRtc::IMediaElement to MediaElement + /// + static Org::WebRtc::MediaElement Cast(Org::WebRtc::IMediaElement const & value); + + // ::org::webRtc::MediaElement + +#if 0 + /// + /// Constructs a media element object from a native media element + /// type. + /// + MediaElement(Windows::UI::Xaml::Controls::MediaElement const & element); + + /// + /// Gets the platform specific media element. + /// + Windows::UI::Xaml::Controls::MediaElement Element(); +#endif //0 + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct MediaElement : MediaElementT + { + }; + + } // namespace factory_implementation + + } // namespace WebRtc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT diff --git a/webrtc/idl/wrapper/override/cppwinrt/MediaElementMaker.cpp b/webrtc/idl/wrapper/override/cppwinrt/MediaElementMaker.cpp new file mode 100644 index 00000000..2c41b1c2 --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/MediaElementMaker.cpp @@ -0,0 +1,154 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER + +#include +#include +#include + +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtImpl(wrapper::org::webRtc::MediaElementMakerPtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtImpl(Org::WebRtc::MediaElementMaker const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtImpl(Org::WebRtc::IMediaElementMaker const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrt(wrapper::org::webRtc::MediaElementMakerPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::MediaElementMaker {nullptr}; + return result.as< Org::WebRtc::MediaElementMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrt(Org::WebRtc::MediaElementMaker const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value) +{ + if (!value) return Org::WebRtc::MediaElementMaker {nullptr}; + return value.as< Org::WebRtc::MediaElementMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrt(Org::WebRtc::IMediaElementMaker const & value) +{ + if (!value) return Org::WebRtc::MediaElementMaker {nullptr}; + return value.as< Org::WebRtc::MediaElementMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtInterface(wrapper::org::webRtc::MediaElementMakerPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::IMediaElementMaker {nullptr}; + return result.as< Org::WebRtc::IMediaElementMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtInterface(Org::WebRtc::MediaElementMaker const & value) +{ + if (!value) return Org::WebRtc::IMediaElementMaker {nullptr}; + return value.as< Org::WebRtc::IMediaElementMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value) +{ + if (!value) return Org::WebRtc::IMediaElementMaker {nullptr}; + return value.as< Org::WebRtc::IMediaElementMaker >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElementMaker Org::WebRtc::implementation::MediaElementMaker::ToCppWinrtInterface(Org::WebRtc::IMediaElementMaker const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementMakerPtr Org::WebRtc::implementation::MediaElementMaker::FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value) +{ + if (!value) return wrapper::org::webRtc::MediaElementMakerPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementMakerPtr Org::WebRtc::implementation::MediaElementMaker::FromCppWinrt(Org::WebRtc::MediaElementMaker const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementMakerPtr Org::WebRtc::implementation::MediaElementMaker::FromCppWinrt(wrapper::org::webRtc::MediaElementMakerPtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementMakerPtr Org::WebRtc::implementation::MediaElementMaker::FromCppWinrt(Org::WebRtc::IMediaElementMaker const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElementMaker Org::WebRtc::implementation::MediaElementMaker::Cast(Org::WebRtc::IMediaElementMaker const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_WebRtc_MediaElementMaker(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::webRtc::MediaElementMaker >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaElement Org::WebRtc::implementation::MediaElementMaker::Bind(Windows::UI::Xaml::Controls::MediaElement const & element) +{ + Org::WebRtc::IMediaElement result {nullptr}; + result = Org::WebRtc::implementation::MediaElement::ToCppWinrtInterface(wrapper::impl::org::webRtc::MediaElement::toWrapper(element)); + return result; +} + +//------------------------------------------------------------------------------ +Windows::UI::Xaml::Controls::MediaElement Org::WebRtc::implementation::MediaElementMaker::Extract(Org::WebRtc::IMediaElement const & element) +{ + Windows::UI::Xaml::Controls::MediaElement result {nullptr}; + result = wrapper::impl::org::webRtc::MediaElement::toNative_winrt(Org::WebRtc::implementation::MediaElement::FromCppWinrt(element)); + return result; +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER diff --git a/webrtc/idl/wrapper/override/cppwinrt/MediaElementMaker.h b/webrtc/idl/wrapper/override/cppwinrt/MediaElementMaker.h new file mode 100644 index 00000000..8f2aeafa --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/MediaElementMaker.h @@ -0,0 +1,86 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER + +#include + +#include "MediaElementMaker.g.h" +#include + +namespace winrt { + namespace Org { + namespace WebRtc { + namespace implementation { + + + struct MediaElementMaker : MediaElementMakerT + { + // internal + wrapper::org::webRtc::MediaElementMakerPtr native_; + + struct WrapperCreate {}; + MediaElementMaker(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > ToCppWinrtImpl(wrapper::org::webRtc::MediaElementMakerPtr value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > ToCppWinrtImpl(Org::WebRtc::MediaElementMaker const & value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > ToCppWinrtImpl(Org::WebRtc::IMediaElementMaker const & value); + + // ToCppWinrt + static Org::WebRtc::MediaElementMaker ToCppWinrt(wrapper::org::webRtc::MediaElementMakerPtr value); + static Org::WebRtc::MediaElementMaker ToCppWinrt(Org::WebRtc::MediaElementMaker const & value); + static Org::WebRtc::MediaElementMaker ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value); + static Org::WebRtc::MediaElementMaker ToCppWinrt(Org::WebRtc::IMediaElementMaker const & value); + + // ToCppWinrtInterface + static Org::WebRtc::IMediaElementMaker ToCppWinrtInterface(wrapper::org::webRtc::MediaElementMakerPtr value); + static Org::WebRtc::IMediaElementMaker ToCppWinrtInterface(Org::WebRtc::MediaElementMaker const & value); + static Org::WebRtc::IMediaElementMaker ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value); + static Org::WebRtc::IMediaElementMaker ToCppWinrtInterface(Org::WebRtc::IMediaElementMaker const & value); + + // FromCppWinrt + static wrapper::org::webRtc::MediaElementMakerPtr FromCppWinrt(wrapper::org::webRtc::MediaElementMakerPtr value); + static wrapper::org::webRtc::MediaElementMakerPtr FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaElementMaker > const & value); + static wrapper::org::webRtc::MediaElementMakerPtr FromCppWinrt(Org::WebRtc::MediaElementMaker const & value); + static wrapper::org::webRtc::MediaElementMakerPtr FromCppWinrt(Org::WebRtc::IMediaElementMaker const & value); + + + + + public: + /// + /// Cast from Org::WebRtc::IMediaElementMaker to MediaElementMaker + /// + static Org::WebRtc::MediaElementMaker Cast(Org::WebRtc::IMediaElementMaker const & value); + + // ::org::webRtc::MediaElementMaker + + /// + /// Creates an media element object from a media element type. + /// + static Org::WebRtc::IMediaElement Bind(Windows::UI::Xaml::Controls::MediaElement const & element); + /// + /// Extracts a native media element from an media element object. + /// + static Windows::UI::Xaml::Controls::MediaElement Extract(Org::WebRtc::IMediaElement const & element); + + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct MediaElementMaker : MediaElementMakerT + { + }; + + } // namespace factory_implementation + + } // namespace WebRtc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER diff --git a/webrtc/idl/wrapper/override/cppwinrt/MediaSource.cpp b/webrtc/idl/wrapper/override/cppwinrt/MediaSource.cpp new file mode 100644 index 00000000..9370f4de --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/MediaSource.cpp @@ -0,0 +1,156 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#include +#include + +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaSource > Org::WebRtc::implementation::MediaSource::ToCppWinrtImpl(wrapper::org::webRtc::MediaSourcePtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaSource > Org::WebRtc::implementation::MediaSource::ToCppWinrtImpl(Org::WebRtc::MediaSource const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::MediaSource > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaSource > Org::WebRtc::implementation::MediaSource::ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::MediaSource > Org::WebRtc::implementation::MediaSource::ToCppWinrtImpl(Org::WebRtc::IMediaSource const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::MediaSource > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrt(wrapper::org::webRtc::MediaSourcePtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::MediaSource {nullptr}; + return result.as< Org::WebRtc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrt(Org::WebRtc::MediaSource const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value) +{ + if (!value) return Org::WebRtc::MediaSource {nullptr}; + return value.as< Org::WebRtc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrt(Org::WebRtc::IMediaSource const & value) +{ + if (!value) return Org::WebRtc::MediaSource {nullptr}; + return value.as< Org::WebRtc::MediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrtInterface(wrapper::org::webRtc::MediaSourcePtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::IMediaSource {nullptr}; + return result.as< Org::WebRtc::IMediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrtInterface(Org::WebRtc::MediaSource const & value) +{ + if (!value) return Org::WebRtc::IMediaSource {nullptr}; + return value.as< Org::WebRtc::IMediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value) +{ + if (!value) return Org::WebRtc::IMediaSource {nullptr}; + return value.as< Org::WebRtc::IMediaSource >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IMediaSource Org::WebRtc::implementation::MediaSource::ToCppWinrtInterface(Org::WebRtc::IMediaSource const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr Org::WebRtc::implementation::MediaSource::FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value) +{ + if (!value) return wrapper::org::webRtc::MediaSourcePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr Org::WebRtc::implementation::MediaSource::FromCppWinrt(Org::WebRtc::MediaSource const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr Org::WebRtc::implementation::MediaSource::FromCppWinrt(wrapper::org::webRtc::MediaSourcePtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr Org::WebRtc::implementation::MediaSource::FromCppWinrt(Org::WebRtc::IMediaSource const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaSource Org::WebRtc::implementation::MediaSource::Cast(Org::WebRtc::IMediaSource const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_WebRtc_MediaSource(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::webRtc::MediaSource >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::implementation::MediaSource::MediaSource(Windows::Media::Core::IMediaSource const & source) + : native_(wrapper::org::webRtc::MediaSource::wrapper_create()) +{ + ZS_ASSERT(source); + if (!native_) { throw hresult_error(E_POINTER); } + auto wrapperSource = wrapper::impl::org::webRtc::MediaSource::toWrapper(source); + ZS_ASSERT(wrapperSource); + + native_->wrapper_init_org_webRtc_MediaSource(wrapperSource->source_); +} + +//------------------------------------------------------------------------------ +Windows::Media::Core::IMediaSource Org::WebRtc::implementation::MediaSource::Source() +{ + if (!native_) {throw hresult_error(E_POINTER);} + return wrapper::impl::org::webRtc::MediaSource::toNative_winrt(native_); +} + + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE diff --git a/webrtc/idl/wrapper/override/cppwinrt/MediaSource.h b/webrtc/idl/wrapper/override/cppwinrt/MediaSource.h new file mode 100644 index 00000000..b8f2d03f --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/MediaSource.h @@ -0,0 +1,90 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#include + +#include "MediaSource.g.h" +#include + +namespace winrt { + namespace Org { + namespace WebRtc { + namespace implementation { + + + /// + /// MediaSource represents an object holder for a platform specific + /// media source. + /// + struct MediaSource : MediaSourceT + { + // internal + wrapper::org::webRtc::MediaSourcePtr native_; + + struct WrapperCreate {}; + MediaSource(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::WebRtc::implementation::MediaSource > ToCppWinrtImpl(wrapper::org::webRtc::MediaSourcePtr value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaSource > ToCppWinrtImpl(Org::WebRtc::MediaSource const & value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaSource > ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value); + static winrt::com_ptr< Org::WebRtc::implementation::MediaSource > ToCppWinrtImpl(Org::WebRtc::IMediaSource const & value); + + // ToCppWinrt + static Org::WebRtc::MediaSource ToCppWinrt(wrapper::org::webRtc::MediaSourcePtr value); + static Org::WebRtc::MediaSource ToCppWinrt(Org::WebRtc::MediaSource const & value); + static Org::WebRtc::MediaSource ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value); + static Org::WebRtc::MediaSource ToCppWinrt(Org::WebRtc::IMediaSource const & value); + + // ToCppWinrtInterface + static Org::WebRtc::IMediaSource ToCppWinrtInterface(wrapper::org::webRtc::MediaSourcePtr value); + static Org::WebRtc::IMediaSource ToCppWinrtInterface(Org::WebRtc::MediaSource const & value); + static Org::WebRtc::IMediaSource ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value); + static Org::WebRtc::IMediaSource ToCppWinrtInterface(Org::WebRtc::IMediaSource const & value); + + // FromCppWinrt + static wrapper::org::webRtc::MediaSourcePtr FromCppWinrt(wrapper::org::webRtc::MediaSourcePtr value); + static wrapper::org::webRtc::MediaSourcePtr FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::MediaSource > const & value); + static wrapper::org::webRtc::MediaSourcePtr FromCppWinrt(Org::WebRtc::MediaSource const & value); + static wrapper::org::webRtc::MediaSourcePtr FromCppWinrt(Org::WebRtc::IMediaSource const & value); + + + + + public: + /// + /// Cast from Org::WebRtc::IMediaSource to MediaSource + /// + static Org::WebRtc::MediaSource Cast(Org::WebRtc::IMediaSource const & value); + + // ::org::webRtc::MediaSource + + /// + /// Constructs a media source object from a native media source type. + /// + MediaSource(Windows::Media::Core::IMediaSource const & source); + + /// + /// Gets the platform specific media source. + /// + Windows::Media::Core::IMediaSource Source(); + + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct MediaSource : MediaSourceT + { + }; + + } // namespace factory_implementation + + } // namespace WebRtc + } // namespace Org +} // namespace winrt +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE diff --git a/webrtc/idl/wrapper/override/cppwinrt/VideoDeviceInfo.cpp b/webrtc/idl/wrapper/override/cppwinrt/VideoDeviceInfo.cpp new file mode 100644 index 00000000..88e6cfb4 --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/VideoDeviceInfo.cpp @@ -0,0 +1,148 @@ + +#include "pch.h" + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO + +#include "VideoDeviceInfo.h" + +#include +#include + +#include + +using namespace winrt; + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtImpl(wrapper::org::webRtc::VideoDeviceInfoPtr value) +{ + if (!value) return nullptr; + auto result = winrt::make_self(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtImpl(Org::WebRtc::VideoDeviceInfo const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtImpl(Org::WebRtc::IVideoDeviceInfo const & value) +{ + winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > impl {nullptr}; + impl.copy_from(winrt::from_abi(value)); + return impl; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::VideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrt(wrapper::org::webRtc::VideoDeviceInfoPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::VideoDeviceInfo {nullptr}; + return result.as< Org::WebRtc::VideoDeviceInfo >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::VideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrt(Org::WebRtc::VideoDeviceInfo const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::VideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value) +{ + if (!value) return Org::WebRtc::VideoDeviceInfo {nullptr}; + return value.as< Org::WebRtc::VideoDeviceInfo >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::VideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrt(Org::WebRtc::IVideoDeviceInfo const & value) +{ + if (!value) return Org::WebRtc::VideoDeviceInfo {nullptr}; + return value.as< Org::WebRtc::VideoDeviceInfo >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IVideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtInterface(wrapper::org::webRtc::VideoDeviceInfoPtr value) +{ + auto result = ToCppWinrtImpl(value); + if (!result) return Org::WebRtc::IVideoDeviceInfo {nullptr}; + return result.as< Org::WebRtc::IVideoDeviceInfo >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IVideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtInterface(Org::WebRtc::VideoDeviceInfo const & value) +{ + if (!value) return Org::WebRtc::IVideoDeviceInfo{nullptr}; + return value.as< Org::WebRtc::IVideoDeviceInfo >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IVideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value) +{ + if (!value) return Org::WebRtc::IVideoDeviceInfo{nullptr}; + return value.as< Org::WebRtc::IVideoDeviceInfo >(); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::IVideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::ToCppWinrtInterface(Org::WebRtc::IVideoDeviceInfo const & value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoDeviceInfoPtr Org::WebRtc::implementation::VideoDeviceInfo::FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value) +{ + if (!value) return wrapper::org::webRtc::VideoDeviceInfoPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoDeviceInfoPtr Org::WebRtc::implementation::VideoDeviceInfo::FromCppWinrt(Org::WebRtc::VideoDeviceInfo const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoDeviceInfoPtr Org::WebRtc::implementation::VideoDeviceInfo::FromCppWinrt(wrapper::org::webRtc::VideoDeviceInfoPtr value) +{ + return value; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoDeviceInfoPtr Org::WebRtc::implementation::VideoDeviceInfo::FromCppWinrt(Org::WebRtc::IVideoDeviceInfo const & value) +{ + return FromCppWinrt(ToCppWinrtImpl(value)); +} + +//------------------------------------------------------------------------------ +Org::WebRtc::VideoDeviceInfo Org::WebRtc::implementation::VideoDeviceInfo::Cast(Org::WebRtc::IVideoDeviceInfo const & value) +{ + if (!value) return nullptr; + auto nativeObject = ::Internal::Helper::FromCppWinrt_Org_WebRtc_VideoDeviceInfo(value); + if (!nativeObject) return nullptr; + auto result = std::dynamic_pointer_cast< wrapper::org::webRtc::VideoDeviceInfo >(nativeObject); + if (!result) return nullptr; + return ToCppWinrt(result); +} + +//------------------------------------------------------------------------------ +Windows::Devices::Enumeration::DeviceInformation Org::WebRtc::implementation::VideoDeviceInfo::Info() +{ + if (!native_) { throw hresult_error(E_POINTER); } + + Windows::Devices::Enumeration::DeviceInformation result{ nullptr }; + result = wrapper::impl::org::webRtc::VideoDeviceInfo::toNative_winrt(native_); + return result; +} + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO diff --git a/webrtc/idl/wrapper/override/cppwinrt/VideoDeviceInfo.h b/webrtc/idl/wrapper/override/cppwinrt/VideoDeviceInfo.h new file mode 100644 index 00000000..ad2e21b4 --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/VideoDeviceInfo.h @@ -0,0 +1,77 @@ + +#pragma once + + +#ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO + +#include + +#include "VideoDeviceInfo.g.h" +#include + +namespace winrt { + namespace Org { + namespace WebRtc { + namespace implementation { + + + struct VideoDeviceInfo : VideoDeviceInfoT + { + // internal + wrapper::org::webRtc::VideoDeviceInfoPtr native_; + + struct WrapperCreate {}; + VideoDeviceInfo(const WrapperCreate &) {} + + // ToCppWinrtImpl + static winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > ToCppWinrtImpl(wrapper::org::webRtc::VideoDeviceInfoPtr value); + static winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > ToCppWinrtImpl(Org::WebRtc::VideoDeviceInfo const & value); + static winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > ToCppWinrtImpl(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value); + static winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > ToCppWinrtImpl(Org::WebRtc::IVideoDeviceInfo const & value); + + // ToCppWinrt + static Org::WebRtc::VideoDeviceInfo ToCppWinrt(wrapper::org::webRtc::VideoDeviceInfoPtr value); + static Org::WebRtc::VideoDeviceInfo ToCppWinrt(Org::WebRtc::VideoDeviceInfo const & value); + static Org::WebRtc::VideoDeviceInfo ToCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value); + static Org::WebRtc::VideoDeviceInfo ToCppWinrt(Org::WebRtc::IVideoDeviceInfo const & value); + + // ToCppWinrtInterface + static Org::WebRtc::IVideoDeviceInfo ToCppWinrtInterface(wrapper::org::webRtc::VideoDeviceInfoPtr value); + static Org::WebRtc::IVideoDeviceInfo ToCppWinrtInterface(Org::WebRtc::VideoDeviceInfo const & value); + static Org::WebRtc::IVideoDeviceInfo ToCppWinrtInterface(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value); + static Org::WebRtc::IVideoDeviceInfo ToCppWinrtInterface(Org::WebRtc::IVideoDeviceInfo const & value); + + // FromCppWinrt + static wrapper::org::webRtc::VideoDeviceInfoPtr FromCppWinrt(wrapper::org::webRtc::VideoDeviceInfoPtr value); + static wrapper::org::webRtc::VideoDeviceInfoPtr FromCppWinrt(winrt::com_ptr< Org::WebRtc::implementation::VideoDeviceInfo > const & value); + static wrapper::org::webRtc::VideoDeviceInfoPtr FromCppWinrt(Org::WebRtc::VideoDeviceInfo const & value); + static wrapper::org::webRtc::VideoDeviceInfoPtr FromCppWinrt(Org::WebRtc::IVideoDeviceInfo const & value); + + + + + public: + VideoDeviceInfo(); + /// + /// Cast from Org::WebRtc::IVideoDeviceInfo to VideoDeviceInfo + /// + static Org::WebRtc::VideoDeviceInfo Cast(Org::WebRtc::IVideoDeviceInfo const & value); + + Windows::Devices::Enumeration::DeviceInformation Info(); + }; + + } // namepsace implementation + + namespace factory_implementation { + + struct VideoDeviceInfo : VideoDeviceInfoT + { + }; + + } // namespace factory_implementation + + } // namespace WebRtc + } // namespace Org +} // namespace winrt + +#endif //ifndef CPPWINRT_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO diff --git a/webrtc/idl/wrapper/override/cppwinrt/cppwinrt_Helpers_Throwers.cpp b/webrtc/idl/wrapper/override/cppwinrt/cppwinrt_Helpers_Throwers.cpp new file mode 100644 index 00000000..4549b6c0 --- /dev/null +++ b/webrtc/idl/wrapper/override/cppwinrt/cppwinrt_Helpers_Throwers.cpp @@ -0,0 +1,46 @@ + +#include "pch.h" + +#include +#include + +#include +#include + +using namespace winrt; + +typedef Internal::Helper::Throwers ThrowersType; + +ThrowersType &ThrowersType::singleton() noexcept +{ + static ThrowersType result{}; + return result; +} + +//#define FACILITY_WIN32 0x0007 + +#define CUSTOM_MAKE_HRESULT(xCustomerBit, xFacility, xErrorCode) ((HRESULT)(xErrorCode) <= 0 ? ((HRESULT)(xErrorCode)) : ((HRESULT) (((xErrorCode) & 0x0000FFFF) | ((xFacility) << 16) | ((xCustomerBit) << 29) | 0x80000000))) + + +void ThrowersType::customThrow(wrapper::org::webRtc::RTCErrorPtr error) noexcept(false) +{ + if (!error) throw hresult_error(E_FAIL, L"No error object provided."); + + std::wstring message = error->get_message().wstring(); + + switch (error->get_type()) + { + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_none: break; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedOperation: throw hresult_illegal_method_call(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedParameter: throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_UNSUPPORTED_TYPE), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidParameter: throw hresult_invalid_argument(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidRange: throw hresult_out_of_bounds(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_syntaxError: throw hresult_error(MK_E_SYNTAX, message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidState: throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_INVALID_STATE), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidModification: throw hresult_illegal_state_change(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_networkError: throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_UNEXP_NET_ERR), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_resourceExhausted: throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_DEVICE_NO_RESOURCES), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_internalError: throw hresult_error(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_INTERNAL_ERROR), message); + } + throw hresult_error(E_FAIL, message); +} diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueue.cpp b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueue.cpp new file mode 100644 index 00000000..f5df5990 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueue.cpp @@ -0,0 +1,63 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#include +#include + +//------------------------------------------------------------------------------ +::Org::WebRtc::EventQueue^ Org::WebRtc::EventQueue::ToCx(wrapper::org::webRtc::EventQueuePtr value) +{ + if (!value) return nullptr; + auto result = ref new EventQueue(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueuePtr Org::WebRtc::EventQueue::FromCx(::Org::WebRtc::EventQueue^ value) +{ + if (nullptr == value) return wrapper::org::webRtc::EventQueuePtr(); + return value->native_; +} + +#if 0 +//------------------------------------------------------------------------------ +Org::WebRtc::EventQueue::EventQueue(Platform::Object^ queue) + : native_(wrapper::org::webRtc::EventQueue::wrapper_create()) +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + native_->wrapper_init_org_webRtc_EventQueue(::Internal::Helper::FromCx(queue)); +} +#endif //0 + +//------------------------------------------------------------------------------ +::Org::WebRtc::EventQueue^ Org::WebRtc::EventQueue::GetDefaultForUi() +{ + ::Org::WebRtc::EventQueue^ result {}; + result = ::Internal::Helper::ToCx_Org_WebRtc_EventQueue(wrapper::org::webRtc::EventQueue::getDefaultForUi()); + return result; +} + +//------------------------------------------------------------------------------ +::Org::WebRtc::EventQueue^ Org::WebRtc::EventQueue::Singleton::get() +{ + return ::Internal::Helper::ToCx_Org_WebRtc_EventQueue(wrapper::org::webRtc::EventQueue::get_singleton()); +} + +//------------------------------------------------------------------------------ +void Org::WebRtc::EventQueue::Singleton::set(::Org::WebRtc::EventQueue^ value) +{ + wrapper::org::webRtc::EventQueue::set_singleton(::Internal::Helper::FromCx_Org_WebRtc_EventQueue(value)); +} + +#if 0 +//------------------------------------------------------------------------------ +Platform::Object^ Org::WebRtc::EventQueue::Queue::get() +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + return ::Internal::Helper::ToCx(native_->get_queue()); +} +#endif //0 + +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueue.h b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueue.h new file mode 100644 index 00000000..09c1a8f0 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueue.h @@ -0,0 +1,65 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#pragma once + +#include +#include + +namespace Org { + namespace WebRtc { + + + + /// + /// A message queue for receiving delegate events. + /// + public ref class EventQueue sealed + { + internal: + wrapper::org::webRtc::EventQueuePtr native_; + + struct WrapperCreate {}; + EventQueue(const WrapperCreate &) {} + + static EventQueue^ ToCx(wrapper::org::webRtc::EventQueuePtr value); + static wrapper::org::webRtc::EventQueuePtr FromCx(EventQueue^ value); + + + + public: + // ::org::webRtc::EventQueue + +#if 0 + /// + /// Constructs an event queue object from a native queue type. + /// + [Windows::Foundation::Metadata::DefaultOverloadAttribute, Windows::Foundation::Metadata::OverloadAttribute("EventQueueWithNativeQueue")] + EventQueue(Platform::Object^ queue); +#endif //0 + /// + /// The default windows message queue for the system GUI thread. + /// + static ::Org::WebRtc::EventQueue^ GetDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + static property ::Org::WebRtc::EventQueue^ Singleton + { + ::Org::WebRtc::EventQueue^ get(); + void set(::Org::WebRtc::EventQueue^ value); + } +#if 0 + /// + /// Gets a native queue from an event queue object. + /// + property Platform::Object^ Queue { Platform::Object^ get(); } +#endif //0 + + }; + + } // namespace WebRtc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueueMaker.cpp b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueueMaker.cpp new file mode 100644 index 00000000..ea3ac64d --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueueMaker.cpp @@ -0,0 +1,42 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#include +#include +#include + +#include + +//------------------------------------------------------------------------------ +::Org::WebRtc::EventQueueMaker^ Org::WebRtc::EventQueueMaker::ToCx(wrapper::org::webRtc::EventQueueMakerPtr value) +{ + if (!value) return nullptr; + auto result = ref new EventQueueMaker(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::EventQueueMakerPtr Org::WebRtc::EventQueueMaker::FromCx(::Org::WebRtc::EventQueueMaker^ value) +{ + if (nullptr == value) return wrapper::org::webRtc::EventQueueMakerPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +::Org::WebRtc::EventQueue^ Org::WebRtc::EventQueueMaker::Bind(Windows::UI::Core::CoreDispatcher^ queue) +{ + ::Org::WebRtc::EventQueue^ result {}; + result = ::Internal::Helper::ToCx_Org_WebRtc_EventQueue(wrapper::impl::org::webRtc::EventQueue::toWrapper(queue)); + return result; +} + +//------------------------------------------------------------------------------ +Windows::UI::Core::CoreDispatcher^ Org::WebRtc::EventQueueMaker::Extract(::Org::WebRtc::EventQueue^ queue) +{ + return wrapper::impl::org::webRtc::EventQueue::toNative_cx(::Internal::Helper::FromCx_Org_WebRtc_EventQueue(queue)); +} + + +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueueMaker.h b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueueMaker.h new file mode 100644 index 00000000..bedfe6f7 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_EventQueueMaker.h @@ -0,0 +1,46 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#pragma once + +#include +#include + +namespace Org { + namespace WebRtc { + + + + [Windows::Foundation::Metadata::WebHostHiddenAttribute] + public ref class EventQueueMaker sealed + { + internal: + wrapper::org::webRtc::EventQueueMakerPtr native_; + + struct WrapperCreate {}; + EventQueueMaker(const WrapperCreate &) {} + + static EventQueueMaker^ ToCx(wrapper::org::webRtc::EventQueueMakerPtr value); + static wrapper::org::webRtc::EventQueueMakerPtr FromCx(EventQueueMaker^ value); + + + + public: + // ::org::webRtc::EventQueueMaker + + /// + /// Creates an event queue object from a native queue type. + /// + static ::Org::WebRtc::EventQueue^ Bind(Windows::UI::Core::CoreDispatcher^ queue); + /// + /// Extracts a native queue from an event queue object. + /// + static Windows::UI::Core::CoreDispatcher^ Extract(::Org::WebRtc::EventQueue^ queue); + + + }; + + } // namespace WebRtc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElement.cpp b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElement.cpp new file mode 100644 index 00000000..8e963fdf --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElement.cpp @@ -0,0 +1,41 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT + +#include +#include + +//------------------------------------------------------------------------------ +::Org::WebRtc::MediaElement^ Org::WebRtc::MediaElement::ToCx(wrapper::org::webRtc::MediaElementPtr value) +{ + if (!value) return nullptr; + auto result = ref new MediaElement(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementPtr Org::WebRtc::MediaElement::FromCx(::Org::WebRtc::MediaElement^ value) +{ + if (nullptr == value) return wrapper::org::webRtc::MediaElementPtr(); + return value->native_; +} + +#if 0 +//------------------------------------------------------------------------------ +Org::WebRtc::MediaElement::MediaElement(Platform::Object^ element) + : native_(wrapper::org::webRtc::MediaElement::wrapper_create()) +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + native_->wrapper_init_org_webRtc_MediaElement(::Internal::Helper::FromCx(element)); +} + +//------------------------------------------------------------------------------ +Platform::Object^ Org::WebRtc::MediaElement::Element::get() +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + return ::Internal::Helper::ToCx(native_->get_element()); +} +#endif //0 + +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElement.h b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElement.h new file mode 100644 index 00000000..02cfff35 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElement.h @@ -0,0 +1,52 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT + +#pragma once + +#include +#include + +namespace Org { + namespace WebRtc { + + + + /// + /// MediaSource represents an object holder for a platform specific media + /// element. + /// + public ref class MediaElement sealed + { + internal: + wrapper::org::webRtc::MediaElementPtr native_; + + struct WrapperCreate {}; + MediaElement(const WrapperCreate &) {} + + static MediaElement^ ToCx(wrapper::org::webRtc::MediaElementPtr value); + static wrapper::org::webRtc::MediaElementPtr FromCx(MediaElement^ value); + + + + public: + // ::org::webRtc::MediaElement + +#if 0 + /// + /// Constructs a media element object from a native media element type. + /// + [Windows::Foundation::Metadata::DefaultOverloadAttribute, Windows::Foundation::Metadata::OverloadAttribute("MediaElementWithNativeQueue")] + MediaElement(Platform::Object^ element); + + /// + /// Gets the platform specific media element. + /// + property Platform::Object^ Element { Platform::Object^ get(); } +#endif //0 + + }; + + } // namespace WebRtc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElementMaker.cpp b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElementMaker.cpp new file mode 100644 index 00000000..822137b9 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElementMaker.cpp @@ -0,0 +1,44 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER + +#include +#include +#include + +#include + +//------------------------------------------------------------------------------ +::Org::WebRtc::MediaElementMaker^ Org::WebRtc::MediaElementMaker::ToCx(wrapper::org::webRtc::MediaElementMakerPtr value) +{ + if (!value) return nullptr; + auto result = ref new MediaElementMaker(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaElementMakerPtr Org::WebRtc::MediaElementMaker::FromCx(::Org::WebRtc::MediaElementMaker^ value) +{ + if (nullptr == value) return wrapper::org::webRtc::MediaElementMakerPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +::Org::WebRtc::MediaElement^ Org::WebRtc::MediaElementMaker::Bind(Windows::UI::Xaml::Controls::MediaElement^ element) +{ + ::Org::WebRtc::MediaElement^ result {}; + result = ::Internal::Helper::ToCx_Org_WebRtc_MediaElement(wrapper::impl::org::webRtc::MediaElement::toWrapper(element)); + return result; +} + +//------------------------------------------------------------------------------ +Windows::UI::Xaml::Controls::MediaElement^ Org::WebRtc::MediaElementMaker::Extract(::Org::WebRtc::MediaElement^ element) +{ + Windows::UI::Xaml::Controls::MediaElement^ result {}; + result = wrapper::impl::org::webRtc::MediaElement::toNative_cx(::Internal::Helper::FromCx_Org_WebRtc_MediaElement(element)); + return result; +} + + +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElementMaker.h b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElementMaker.h new file mode 100644 index 00000000..049d2c2f --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaElementMaker.h @@ -0,0 +1,46 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER + +#pragma once + +#include +#include + +namespace Org { + namespace WebRtc { + + + + [Windows::Foundation::Metadata::WebHostHiddenAttribute] + public ref class MediaElementMaker sealed + { + internal: + wrapper::org::webRtc::MediaElementMakerPtr native_; + + struct WrapperCreate {}; + MediaElementMaker(const WrapperCreate &) {} + + static MediaElementMaker^ ToCx(wrapper::org::webRtc::MediaElementMakerPtr value); + static wrapper::org::webRtc::MediaElementMakerPtr FromCx(MediaElementMaker^ value); + + + + public: + // ::org::webRtc::MediaElementMaker + + /// + /// Creates an media element object from a media element type. + /// + static ::Org::WebRtc::MediaElement^ Bind(Windows::UI::Xaml::Controls::MediaElement^ element); + /// + /// Extracts a native media element from an media element object. + /// + static Windows::UI::Xaml::Controls::MediaElement^ Extract(::Org::WebRtc::MediaElement^ element); + + + }; + + } // namespace WebRtc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaSource.cpp b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaSource.cpp new file mode 100644 index 00000000..fec9e8db --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaSource.cpp @@ -0,0 +1,45 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#include +#include + +#include + +//------------------------------------------------------------------------------ +::Org::WebRtc::MediaSource^ Org::WebRtc::MediaSource::ToCx(wrapper::org::webRtc::MediaSourcePtr value) +{ + if (!value) return nullptr; + auto result = ref new MediaSource(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::MediaSourcePtr Org::WebRtc::MediaSource::FromCx(::Org::WebRtc::MediaSource^ value) +{ + if (nullptr == value) return wrapper::org::webRtc::MediaSourcePtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +Org::WebRtc::MediaSource::MediaSource(Windows::Media::Core::IMediaSource^ source) + : native_(wrapper::org::webRtc::MediaSource::wrapper_create()) +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + + auto wrapperSource = wrapper::impl::org::webRtc::MediaSource::toWrapper(source); + ZS_ASSERT(wrapperSource); + native_->wrapper_init_org_webRtc_MediaSource(wrapperSource->source_); +} + +//------------------------------------------------------------------------------ +Windows::Media::Core::IMediaSource^ Org::WebRtc::MediaSource::Source::get() +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + return wrapper::impl::org::webRtc::MediaSource::toNative_cx(native_); +} + + +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaSource.h b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaSource.h new file mode 100644 index 00000000..15d1be6c --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_MediaSource.h @@ -0,0 +1,50 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#pragma once + +#include +#include + +namespace Org { + namespace WebRtc { + + + + /// + /// MediaSource represents an object holder for a platform specific media + /// source. + /// + public ref class MediaSource sealed + { + internal: + wrapper::org::webRtc::MediaSourcePtr native_; + + struct WrapperCreate {}; + MediaSource(const WrapperCreate &) {} + + static MediaSource^ ToCx(wrapper::org::webRtc::MediaSourcePtr value); + static wrapper::org::webRtc::MediaSourcePtr FromCx(MediaSource^ value); + + + + public: + // ::org::webRtc::MediaSource + + /// + /// Constructs a media source object from a native media source type. + /// + [Windows::Foundation::Metadata::DefaultOverloadAttribute, Windows::Foundation::Metadata::OverloadAttribute("MediaSourceWithNativeSource")] + MediaSource(Windows::Media::Core::IMediaSource^ source); + + /// + /// Gets the platform specific media source. + /// + property Windows::Media::Core::IMediaSource^ Source { Windows::Media::Core::IMediaSource^ get(); } + + }; + + } // namespace WebRtc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_VideoDeviceInfo.cpp b/webrtc/idl/wrapper/override/cx/Org_WebRtc_VideoDeviceInfo.cpp new file mode 100644 index 00000000..dec62914 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_VideoDeviceInfo.cpp @@ -0,0 +1,34 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO + +#include +#include + +#include + +//------------------------------------------------------------------------------ +::Org::WebRtc::VideoDeviceInfo^ Org::WebRtc::VideoDeviceInfo::ToCx(wrapper::org::webRtc::VideoDeviceInfoPtr value) +{ + if (!value) return nullptr; + auto result = ref new VideoDeviceInfo(WrapperCreate{}); + result->native_ = value; + return result; +} + +//------------------------------------------------------------------------------ +wrapper::org::webRtc::VideoDeviceInfoPtr Org::WebRtc::VideoDeviceInfo::FromCx(::Org::WebRtc::VideoDeviceInfo^ value) +{ + if (nullptr == value) return wrapper::org::webRtc::VideoDeviceInfoPtr(); + return value->native_; +} + +//------------------------------------------------------------------------------ +Windows::Devices::Enumeration::DeviceInformation^ Org::WebRtc::VideoDeviceInfo::Info::get() +{ + if (!native_) {throw ref new Platform::NullReferenceException();} + return wrapper::impl::org::webRtc::VideoDeviceInfo::toNative_cx(native_); +} + + +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO diff --git a/webrtc/idl/wrapper/override/cx/Org_WebRtc_VideoDeviceInfo.h b/webrtc/idl/wrapper/override/cx/Org_WebRtc_VideoDeviceInfo.h new file mode 100644 index 00000000..543d9987 --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/Org_WebRtc_VideoDeviceInfo.h @@ -0,0 +1,35 @@ + + +#ifndef CX_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO + +#pragma once + +#include +#include + +namespace Org { + namespace WebRtc { + + + + public ref class VideoDeviceInfo sealed + { + internal: + wrapper::org::webRtc::VideoDeviceInfoPtr native_; + + struct WrapperCreate {}; + VideoDeviceInfo(const WrapperCreate &) {} + + static VideoDeviceInfo^ ToCx(wrapper::org::webRtc::VideoDeviceInfoPtr value); + static wrapper::org::webRtc::VideoDeviceInfoPtr FromCx(VideoDeviceInfo^ value); + + + + public: + property Windows::Devices::Enumeration::DeviceInformation^ Info { Windows::Devices::Enumeration::DeviceInformation^ get(); } + + }; + + } // namespace WebRtc +} // namespace Org +#endif //ifndef CX_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO diff --git a/webrtc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp b/webrtc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp new file mode 100644 index 00000000..fd58be8c --- /dev/null +++ b/webrtc/idl/wrapper/override/cx/cx_Helpers_Throwers.cpp @@ -0,0 +1,43 @@ + + +#include +#include + +#include +#include + +typedef Internal::Helper::Throwers ThrowersType; + +ThrowersType &ThrowersType::singleton() noexcept +{ + static ThrowersType result{}; + return result; +} + +//#define FACILITY_WIN32 0x0007 + +#define CUSTOM_MAKE_HRESULT(xCustomerBit, xFacility, xErrorCode) ((HRESULT)(xErrorCode) <= 0 ? ((HRESULT)(xErrorCode)) : ((HRESULT) (((xErrorCode) & 0x0000FFFF) | ((xFacility) << 16) | ((xCustomerBit) << 29) | 0x80000000))) + + +void ThrowersType::customThrow(wrapper::org::webRtc::RTCErrorPtr error) noexcept(false) +{ + if (!error) throw ref new Platform::FailureException(L"No error object provided."); + + auto message = Internal::Helper::ToCx_String(error->get_message()); + + switch (error->get_type()) + { + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_none: break; + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedOperation: throw ref new Platform::Exception(E_ILLEGAL_METHOD_CALL, message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_unsupportedParameter: throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_UNSUPPORTED_TYPE), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidParameter: throw ref new Platform::InvalidArgumentException(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidRange: throw ref new Platform::OutOfBoundsException(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_syntaxError: throw ref new Platform::Exception(MK_E_SYNTAX, message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidState: throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_INVALID_STATE), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_invalidModification: throw ref new Platform::ChangedStateException(message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_networkError: throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_UNEXP_NET_ERR), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_resourceExhausted: throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_DEVICE_NO_RESOURCES), message); + case wrapper::org::webRtc::RTCErrorType::RTCErrorType_internalError: throw ref new Platform::Exception(CUSTOM_MAKE_HRESULT(1, FACILITY_ITF, ERROR_INTERNAL_ERROR), message); + } + throw ref new Platform::FailureException(message); +} diff --git a/webrtc/idl/wrapper/override/msidl/Org.WebRtc.EventQueue.idl b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.EventQueue.idl new file mode 100644 index 00000000..1d0de29e --- /dev/null +++ b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.EventQueue.idl @@ -0,0 +1,45 @@ +//import "windows.foundation.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace WebRtc + { + + + /// + /// A message queue for receiving delegate events. + /// + [version(1.0)] + [uuid(f9ad235b-42b0-0239-d7a3-6617a42ae227)] + interface IEventQueue : IInspectable + { + }; + + /// + /// A message queue for receiving delegate events. + /// + runtimeclass EventQueue : [default] IEventQueue + { + /// + /// Cast from Org.WebRtc.IEventQueue to Org.WebRtc.EventQueue + /// + [default_overload] + [method_name("CastFromIEventQueue")] + static Org.WebRtc.EventQueue Cast(Org.WebRtc.IEventQueue source); + + /// + /// The default windows message queue for the system GUI thread. + /// + static Org.WebRtc.IEventQueue GetDefaultForUi(); + + /// + /// Gets or sets the default system dispatcher object. + /// + static Org.WebRtc.IEventQueue Singleton { get; set; }; + }; + + } // namespace WebRtc +} // namespace Org + diff --git a/webrtc/idl/wrapper/override/msidl/Org.WebRtc.EventQueueMaker.idl b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.EventQueueMaker.idl new file mode 100644 index 00000000..78e60ad3 --- /dev/null +++ b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.EventQueueMaker.idl @@ -0,0 +1,42 @@ +//import "windows.foundation.customattributes.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace WebRtc + { + + + [version(1.0)] + [uuid(de70609e-604d-5ced-6090-d3891021c4f4)] + [webhosthidden] + interface IEventQueueMaker : IInspectable + { + }; + + [webhosthidden] + runtimeclass EventQueueMaker : [default] IEventQueueMaker + { + + /// + /// Cast from Org.WebRtc.IEventQueueMaker to Org.WebRtc.EventQueueMaker + /// + [default_overload] + [method_name("CastFromIEventQueueMaker")] + static Org.WebRtc.EventQueueMaker Cast(Org.WebRtc.IEventQueueMaker source); + + /// + /// Creates an event queue object from a native queue type. + /// + static Org.WebRtc.IEventQueue Bind(Windows.UI.Core.CoreDispatcher Queue); + + /// + /// Extracts a native queue from an event queue object. + /// + static Windows.UI.Core.CoreDispatcher Extract(Org.WebRtc.IEventQueue Queue); + }; + + } // namespace WebRtc +} // namespace Org + diff --git a/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaElement.idl b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaElement.idl new file mode 100644 index 00000000..30dbd7ab --- /dev/null +++ b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaElement.idl @@ -0,0 +1,39 @@ +//import "windows.foundation.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace WebRtc + { + + + /// + /// MediaSource represents an object holder for a platform specific + /// media element. + /// + [version(1.0)] + [uuid(dcbb7685-ecf3-119e-a677-61d3379e6b5f)] + interface IMediaElement : IInspectable + { + + }; + + /// + /// MediaSource represents an object holder for a platform specific + /// media element. + /// + runtimeclass MediaElement : [default] IMediaElement + { + + /// + /// Cast from Org.WebRtc.IMediaElement to Org.WebRtc.MediaElement + /// + [default_overload] + [method_name("CastFromIMediaElement")] + static Org.WebRtc.MediaElement Cast(Org.WebRtc.IMediaElement source); + }; + + } // namespace WebRtc +} // namespace Org + diff --git a/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaElementMaker.idl b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaElementMaker.idl new file mode 100644 index 00000000..b0b4ba0b --- /dev/null +++ b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaElementMaker.idl @@ -0,0 +1,42 @@ +//import "windows.foundation.customattributes.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace WebRtc + { + + + [version(1.0)] + [uuid(d88e3313-bef8-0322-946d-ef9488c487fd)] + [webhosthidden] + interface IMediaElementMaker : IInspectable + { + }; + + [webhosthidden] + runtimeclass MediaElementMaker : [default] IMediaElementMaker + { + + /// + /// Cast from Org.WebRtc.IMediaElementMaker to Org.WebRtc.MediaElementMaker + /// + [default_overload] + [method_name("CastFromIMediaElementMaker")] + static Org.WebRtc.MediaElementMaker Cast(Org.WebRtc.IMediaElementMaker source); + + /// + /// Creates an media element object from a media element type. + /// + static Org.WebRtc.IMediaElement Bind(Windows.UI.Xaml.Controls.MediaElement Element); + + /// + /// Extracts a native media element from an media element object. + /// + static Windows.UI.Xaml.Controls.MediaElement Extract(Org.WebRtc.IMediaElement Element); + }; + + } // namespace WebRtc +} // namespace Org + diff --git a/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaSource.idl b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaSource.idl new file mode 100644 index 00000000..3a3f19ac --- /dev/null +++ b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.MediaSource.idl @@ -0,0 +1,51 @@ +//import "windows.foundation.idl"; +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace WebRtc + { + + + /// + /// MediaSource represents an object holder for a platform specific + /// media source. + /// + [version(1.0)] + [uuid(1c5627cf-8a22-f886-578a-8f7b872ef42d)] + interface IMediaSource : IInspectable + { + + /// + /// Gets the platform specific media source. + /// + Windows.Media.Core.IMediaSource Source { get; }; + }; + + /// + /// MediaSource represents an object holder for a platform specific + /// media source. + /// + runtimeclass MediaSource : [default] IMediaSource + { + + /// + /// Constructs a media source object from a native media source + /// type. + /// + [method_name("MediaSourceWithNativeSource")] + [default_overload] + MediaSource(Windows.Media.Core.IMediaSource Source); + + /// + /// Cast from Org.WebRtc.IMediaSource to Org.WebRtc.MediaSource + /// + [default_overload] + [method_name("CastFromIMediaSource")] + static Org.WebRtc.MediaSource Cast(Org.WebRtc.IMediaSource source); + }; + + } // namespace WebRtc +} // namespace Org + diff --git a/webrtc/idl/wrapper/override/msidl/Org.WebRtc.VideoDeviceInfo.idl b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.VideoDeviceInfo.idl new file mode 100644 index 00000000..ca5f5c58 --- /dev/null +++ b/webrtc/idl/wrapper/override/msidl/Org.WebRtc.VideoDeviceInfo.idl @@ -0,0 +1,31 @@ +import "forwards.idl"; +import "output.idl"; + +namespace Org +{ + namespace WebRtc + { + + + [version(1.0)] + [uuid(8f3d54d9-07d1-1747-6795-031a5c3b67f3)] + interface IVideoDeviceInfo : IInspectable + { + + Windows.Devices.Enumeration.DeviceInformation Info { get; }; + }; + + runtimeclass VideoDeviceInfo : [default] IVideoDeviceInfo + { + + /// + /// Cast from Org.WebRtc.IVideoDeviceInfo to Org.WebRtc.VideoDeviceInfo + /// + [default_overload] + [method_name("CastFromIVideoDeviceInfo")] + static Org.WebRtc.VideoDeviceInfo Cast(Org.WebRtc.IVideoDeviceInfo source); + }; + + } // namespace WebRtc +} // namespace Org + diff --git a/webrtc/idl/wrapper/override/org_webRtc_EventQueue.h b/webrtc/idl/wrapper/override/org_webRtc_EventQueue.h new file mode 100644 index 00000000..f5350e6c --- /dev/null +++ b/webrtc/idl/wrapper/override/org_webRtc_EventQueue.h @@ -0,0 +1,30 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE + +#pragma once + +#include + +namespace wrapper { + namespace org { + namespace webRtc { + + struct EventQueue + { + static EventQueuePtr wrapper_create() noexcept; + virtual ~EventQueue() noexcept {} + + + virtual void wrapper_init_org_webRtc_EventQueue(AnyPtr queue) noexcept { ZS_MAYBE_USED(queue); } + static wrapper::org::webRtc::EventQueuePtr getDefaultForUi() noexcept; + + static wrapper::org::webRtc::EventQueuePtr get_singleton() noexcept; + static void set_singleton(wrapper::org::webRtc::EventQueuePtr value) noexcept; + virtual AnyPtr get_queue() noexcept = 0; + }; + + } // webRtc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_EVENTQUEUE diff --git a/webrtc/idl/wrapper/override/org_webRtc_EventQueueMaker.h b/webrtc/idl/wrapper/override/org_webRtc_EventQueueMaker.h new file mode 100644 index 00000000..6e9e460e --- /dev/null +++ b/webrtc/idl/wrapper/override/org_webRtc_EventQueueMaker.h @@ -0,0 +1,28 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER + +#pragma once + +#include +#include + +namespace wrapper { + namespace org { + namespace webRtc { + + struct EventQueueMaker + { + virtual ~EventQueueMaker() noexcept {} + +#if 0 + static wrapper::org::webRtc::EventQueuePtr bind(AnyPtr queue) noexcept; + static AnyPtr extract(wrapper::org::webRtc::EventQueuePtr queue) noexcept; +#endif //0 + + }; + + } // webRtc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_EVENTQUEUEMAKER diff --git a/webrtc/idl/wrapper/override/org_webRtc_MediaElement.h b/webrtc/idl/wrapper/override/org_webRtc_MediaElement.h new file mode 100644 index 00000000..18459d75 --- /dev/null +++ b/webrtc/idl/wrapper/override/org_webRtc_MediaElement.h @@ -0,0 +1,26 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT +#pragma once + +#include + +namespace wrapper { + namespace org { + namespace webRtc { + + struct MediaElement + { + static MediaElementPtr wrapper_create() noexcept; + virtual ~MediaElement() noexcept {} + + + virtual void wrapper_init_org_webRtc_MediaElement(AnyPtr queue) noexcept { ZS_MAYBE_USED(queue); } + + virtual AnyPtr get_element() noexcept = 0; + }; + + } // webRtc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENT diff --git a/webrtc/idl/wrapper/override/org_webRtc_MediaElementMaker.h b/webrtc/idl/wrapper/override/org_webRtc_MediaElementMaker.h new file mode 100644 index 00000000..633ec092 --- /dev/null +++ b/webrtc/idl/wrapper/override/org_webRtc_MediaElementMaker.h @@ -0,0 +1,26 @@ + +#pragma once + +#ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER + +#include "types.h" + +namespace wrapper { + namespace org { + namespace webRtc { + + struct MediaElementMaker + { + virtual ~MediaElementMaker() noexcept {} + +#if 0 + static wrapper::org::webRtc::MediaElementPtr bind(AnyPtr element) noexcept; + static AnyPtr extract(wrapper::org::webRtc::MediaElementPtr element) noexcept; +#endif //0 + }; + + } // webRtc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_MEDIAELEMENTMAKER diff --git a/webrtc/idl/wrapper/override/org_webRtc_MediaSource.h b/webrtc/idl/wrapper/override/org_webRtc_MediaSource.h new file mode 100644 index 00000000..6b966598 --- /dev/null +++ b/webrtc/idl/wrapper/override/org_webRtc_MediaSource.h @@ -0,0 +1,27 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE + +#pragma once + +#include + +namespace wrapper { + namespace org { + namespace webRtc { + + struct MediaSource + { + static MediaSourcePtr wrapper_create() noexcept; + virtual ~MediaSource() noexcept {} + + + virtual void wrapper_init_org_webRtc_MediaSource(AnyPtr source) noexcept { ZS_MAYBE_USED(source); } + + virtual AnyPtr get_source() noexcept = 0; + }; + + } // webRtc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_MEDIASOURCE diff --git a/webrtc/idl/wrapper/override/org_webRtc_VideoDeviceInfo.h b/webrtc/idl/wrapper/override/org_webRtc_VideoDeviceInfo.h new file mode 100644 index 00000000..96f03d2f --- /dev/null +++ b/webrtc/idl/wrapper/override/org_webRtc_VideoDeviceInfo.h @@ -0,0 +1,23 @@ + +#ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO +#pragma once + +#include "types.h" + +namespace wrapper { + namespace org { + namespace webRtc { + + struct VideoDeviceInfo + { + static VideoDeviceInfoPtr wrapper_create() noexcept; + virtual ~VideoDeviceInfo() noexcept {} + + virtual AnyPtr get_info() noexcept = 0; + }; + + } // webRtc + } // org +} // namespace wrapper + +#endif //ifndef WRAPPER_USE_GENERATED_ORG_WEBRTC_VIDEODEVICEINFO diff --git a/webrtc/idl/wrapper/types.h b/webrtc/idl/wrapper/types.h new file mode 100644 index 00000000..e74275ff --- /dev/null +++ b/webrtc/idl/wrapper/types.h @@ -0,0 +1,117 @@ + +#pragma once + +#include "generated/types.h" + +#include + +namespace wrapper { + namespace impl { + + namespace org { + namespace webRtc { + + ZS_DECLARE_TYPEDEF_PTR(::zsLib::Exceptions::InvalidArgument, InvalidParameters); + ZS_DECLARE_TYPEDEF_PTR(::zsLib::IMessageQueue, IMessageQueue); + + ZS_DECLARE_STRUCT_PTR(AudioOptions); + ZS_DECLARE_STRUCT_PTR(AudioTrackSource); + ZS_DECLARE_STRUCT_PTR(Constraint); + ZS_DECLARE_STRUCT_PTR(EventQueue); + ZS_DECLARE_STRUCT_PTR(EventQueueMaker); + ZS_DECLARE_STRUCT_PTR(MediaConstraints); + ZS_DECLARE_STRUCT_PTR(MediaElement); + ZS_DECLARE_STRUCT_PTR(MediaElementMaker); + ZS_DECLARE_STRUCT_PTR(MediaSource); + ZS_DECLARE_STRUCT_PTR(MediaStreamTrack); + ZS_DECLARE_STRUCT_PTR(MediaTrackSource); + ZS_DECLARE_STRUCT_PTR(MessageEvent); + ZS_DECLARE_STRUCT_PTR(MillisecondIntervalRange); + ZS_DECLARE_STRUCT_PTR(RTCAnswerOptions); + ZS_DECLARE_STRUCT_PTR(RTCAudioHandlerStats); + ZS_DECLARE_STRUCT_PTR(RTCAudioReceiverStats); + ZS_DECLARE_STRUCT_PTR(RTCAudioSenderStats); + ZS_DECLARE_STRUCT_PTR(RTCBitrateParameters); + ZS_DECLARE_STRUCT_PTR(RTCCertificate); + ZS_DECLARE_STRUCT_PTR(RTCCertificateStats); + ZS_DECLARE_STRUCT_PTR(RTCCodecStats); + ZS_DECLARE_STRUCT_PTR(RTCConfiguration); + ZS_DECLARE_STRUCT_PTR(RTCDataChannel); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelEvent); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelInit); + ZS_DECLARE_STRUCT_PTR(RTCDataChannelStats); + ZS_DECLARE_STRUCT_PTR(RTCDtlsFingerprint); + ZS_DECLARE_STRUCT_PTR(RTCDtmfSender); + ZS_DECLARE_STRUCT_PTR(RTCDtmfToneChangeEvent); + ZS_DECLARE_STRUCT_PTR(RTCError); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidate); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidateInit); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidatePairStats); + ZS_DECLARE_STRUCT_PTR(RTCIceCandidateStats); + ZS_DECLARE_STRUCT_PTR(RTCIceServer); + ZS_DECLARE_STRUCT_PTR(RTCInboundRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCKeyParams); + ZS_DECLARE_STRUCT_PTR(RTCMediaHandlerStats); + ZS_DECLARE_STRUCT_PTR(RTCMediaStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCOAuthCredential); + ZS_DECLARE_STRUCT_PTR(RTCOfferAnswerOptions); + ZS_DECLARE_STRUCT_PTR(RTCOfferOptions); + ZS_DECLARE_STRUCT_PTR(RTCOutboundRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnection); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnectionIceErrorEvent); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnectionIceEvent); + ZS_DECLARE_STRUCT_PTR(RTCPeerConnectionStats); + ZS_DECLARE_STRUCT_PTR(RTCRSAParams); + ZS_DECLARE_STRUCT_PTR(RTCReceivedRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCRemoteInboundRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCRemoteOutboundRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCRtcpFeedback); + ZS_DECLARE_STRUCT_PTR(RTCRtcpParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpCapabilities); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecCapability); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodecParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpCodingParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpContributingSource); + ZS_DECLARE_STRUCT_PTR(RTCRtpContributingSourceStats); + ZS_DECLARE_STRUCT_PTR(RTCRtpDecodingParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpEncodingParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpFecParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpHeaderExtensionCapability); + ZS_DECLARE_STRUCT_PTR(RTCRtpHeaderExtensionParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpReceiveParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpReceiver); + ZS_DECLARE_STRUCT_PTR(RTCRtpRtxParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpSendParameters); + ZS_DECLARE_STRUCT_PTR(RTCRtpSender); + ZS_DECLARE_STRUCT_PTR(RTCRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCRtpSynchronizationSource); + ZS_DECLARE_STRUCT_PTR(RTCRtpTransceiver); + ZS_DECLARE_STRUCT_PTR(RTCRtpTransceiverInit); + ZS_DECLARE_STRUCT_PTR(RTCSenderAudioTrackAttachmentStats); + ZS_DECLARE_STRUCT_PTR(RTCSenderVideoTrackAttachmentStats); + ZS_DECLARE_STRUCT_PTR(RTCSentRtpStreamStats); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescription); + ZS_DECLARE_STRUCT_PTR(RTCSessionDescriptionInit); + ZS_DECLARE_STRUCT_PTR(RTCStats); + ZS_DECLARE_STRUCT_PTR(RTCStatsProvider); + ZS_DECLARE_STRUCT_PTR(RTCStatsReport); + ZS_DECLARE_STRUCT_PTR(RTCStatsTypeSet); + ZS_DECLARE_STRUCT_PTR(RTCTrackEvent); + ZS_DECLARE_STRUCT_PTR(RTCTransportStats); + ZS_DECLARE_STRUCT_PTR(RTCVideoHandlerStats); + ZS_DECLARE_STRUCT_PTR(RTCVideoReceiverStats); + ZS_DECLARE_STRUCT_PTR(RTCVideoSenderStats); + ZS_DECLARE_STRUCT_PTR(VideoCapturer); + ZS_DECLARE_STRUCT_PTR(VideoCapturerInputSize); + ZS_DECLARE_STRUCT_PTR(VideoDeviceInfo); + ZS_DECLARE_STRUCT_PTR(VideoFormat); + ZS_DECLARE_STRUCT_PTR(VideoTrackSource); + ZS_DECLARE_STRUCT_PTR(VideoTrackSourceStats); + ZS_DECLARE_STRUCT_PTR(WebRtcLib); + + } // namespace webRtc + } // namespace org + } // namespace impl +} // namespace wrapper +