From 7bca8ca4e2d7833da719c22bc0e1368a1d81ddc9 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 30 Aug 2018 09:30:29 +0200 Subject: [PATCH] Obj-C SDK Cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL separates the files under sdk/objc into logical directories, replacing the previous file layout under Framework/. A long term goal is to have some system set up to generate the files under sdk/objc/api (the PeerConnection API wrappers) from the C++ code. In the shorter term the goal is to abstract out shared concepts from these classes in order to make them as uniform as possible. The separation into base/, components/, and helpers/ are to differentiate between the base layer's common protocols, various utilities and the actual platform specific components. The old directory layout that resembled a framework's internal layout is not necessary, since it is generated by the framework target when building it. Bug: webrtc:9627 Change-Id: Ib084fd83f050ae980649ca99e841f4fb0580bd8f Reviewed-on: https://webrtc-review.googlesource.com/94142 Reviewed-by: Kári Helgason Reviewed-by: Mirko Bonadei Reviewed-by: Rasmus Brandt Reviewed-by: Henrik Andreassson Commit-Queue: Anders Carlsson Cr-Commit-Position: refs/heads/master@{#24493} --- BUILD.gn | 4 + examples/BUILD.gn | 74 +- examples/DEPS | 3 +- .../objc/AppRTCMobile/ARDAppClient+Internal.h | 2 +- examples/objc/AppRTCMobile/ARDAppClient.h | 4 +- examples/objc/AppRTCMobile/ARDAppClient.m | 33 +- .../objc/AppRTCMobile/ARDAppEngineClient.m | 2 +- .../objc/AppRTCMobile/ARDCaptureController.h | 2 +- .../objc/AppRTCMobile/ARDCaptureController.m | 3 +- .../AppRTCMobile/ARDExternalSampleCapturer.m | 3 +- .../AppRTCMobile/ARDSettingsModel+Private.h | 1 + examples/objc/AppRTCMobile/ARDSettingsModel.h | 2 +- examples/objc/AppRTCMobile/ARDSettingsModel.m | 7 +- .../objc/AppRTCMobile/ARDSignalingMessage.h | 4 +- .../objc/AppRTCMobile/ARDSignalingMessage.m | 2 +- examples/objc/AppRTCMobile/ARDStatsBuilder.m | 2 +- .../objc/AppRTCMobile/ARDWebSocketChannel.m | 2 +- .../objc/AppRTCMobile/RTCIceCandidate+JSON.h | 2 +- .../objc/AppRTCMobile/RTCIceCandidate+JSON.m | 2 +- .../objc/AppRTCMobile/RTCIceServer+JSON.h | 2 +- .../AppRTCMobile/RTCMediaConstraints+JSON.h | 2 +- .../AppRTCMobile/RTCSessionDescription+JSON.h | 2 +- .../objc/AppRTCMobile/common/ARDUtilities.m | 2 +- .../objc/AppRTCMobile/ios/ARDAppDelegate.m | 8 +- .../ios/ARDFileCaptureController.m | 2 +- .../AppRTCMobile/ios/ARDMainViewController.m | 9 +- examples/objc/AppRTCMobile/ios/ARDStatsView.m | 2 +- .../ios/ARDVideoCallViewController.m | 10 +- .../ios/RTCVideoCodecInfo+HumanReadable.h | 2 +- .../ios/RTCVideoCodecInfo+HumanReadable.m | 3 +- .../ARDBroadcastSampleHandler.h | 2 +- .../objc/AppRTCMobile/mac/APPRTCAppDelegate.m | 2 +- .../AppRTCMobile/mac/APPRTCViewController.m | 6 +- .../AppRTCMobile/tests/ARDAppClient_xctest.mm | 4 +- .../tests/ARDFileCaptureController_xctest.mm | 2 +- .../tests/ARDSettingsModel_xctest.mm | 2 +- .../objcnativeapi/objc/NADViewController.mm | 13 +- examples/objcnativeapi/objc/objccallclient.mm | 15 +- modules/audio_device/BUILD.gn | 3 +- modules/audio_device/DEPS | 3 + modules/audio_device/ios/audio_device_ios.h | 2 +- modules/audio_device/ios/audio_device_ios.mm | 10 +- .../ios/audio_device_unittest_ios.mm | 4 +- .../audio_device/ios/objc/RTCAudioSession.h | 2 +- .../ios/objc/RTCAudioSessionConfiguration.h | 2 +- .../ios/objc/RTCAudioSessionDelegateAdapter.h | 2 +- .../objc/RTCAudioSessionDelegateAdapter.mm | 2 +- .../ios/voice_processing_audio_unit.mm | 4 +- modules/desktop_capture/BUILD.gn | 2 +- .../mac/desktop_frame_cgimage.h | 2 +- .../mac/desktop_frame_iosurface.h | 2 +- .../mac/desktop_frame_provider.h | 2 +- .../mac/screen_capturer_mac.mm | 2 +- modules/video_coding/BUILD.gn | 1 - .../codecs/test/objc_codec_factory_helper.mm | 7 +- sdk/BUILD.gn | 1246 +++++++++++------ sdk/objc/DEPS | 13 +- .../Classes/Common/NSString+StdString.h | 17 +- .../Common/RTCUIApplicationStatusObserver.h | 16 +- .../Classes/Common/scoped_cftyperef.h | 106 +- .../PeerConnection/RTCConfiguration+Native.h | 19 +- .../Classes/PeerConnection/RTCEncodedImage.mm | 83 -- .../PeerConnection/RTCPeerConnection+Native.h | 25 +- .../RTCPeerConnectionFactory+Native.h | 45 +- .../PeerConnection/RTCVideoCodec+Private.h | 53 +- .../Classes/PeerConnection/RTCVideoCodec.mm | 167 --- .../PeerConnection/RTCVideoEncoderSettings.mm | 66 - .../Classes/Video/RTCDefaultShader.h | 14 +- .../Classes/Video/RTCNV12TextureCache.h | 22 +- .../Classes/VideoToolbox/nalu_rewriter.h | 107 +- .../Headers/WebRTC/RTCAudioSession.h | 240 +--- .../WebRTC/RTCAudioSessionConfiguration.h | 39 +- .../Framework/Headers/WebRTC/RTCAudioSource.h | 23 +- .../Framework/Headers/WebRTC/RTCAudioTrack.h | 19 +- .../Headers/WebRTC/RTCCVPixelBuffer.h | 11 + .../Headers/WebRTC/RTCCallbackLogger.h | 26 +- .../Headers/WebRTC/RTCCameraPreviewView.h | 21 +- .../Headers/WebRTC/RTCCameraVideoCapturer.h | 47 +- .../Framework/Headers/WebRTC/RTCCertificate.h | 35 +- .../Headers/WebRTC/RTCConfiguration.h | 165 +-- .../Framework/Headers/WebRTC/RTCDataChannel.h | 121 +- .../WebRTC/RTCDataChannelConfiguration.h | 43 +- .../WebRTC/RTCDefaultVideoDecoderFactory.h | 11 + .../WebRTC/RTCDefaultVideoEncoderFactory.h | 11 + .../Framework/Headers/WebRTC/RTCDispatcher.h | 35 +- .../Framework/Headers/WebRTC/RTCDtmfSender.h | 61 +- .../Headers/WebRTC/RTCEAGLVideoView.h | 35 +- .../Framework/Headers/WebRTC/RTCFieldTrials.h | 37 +- .../Framework/Headers/WebRTC/RTCFileLogger.h | 65 +- .../Headers/WebRTC/RTCFileVideoCapturer.h | 41 +- .../Headers/WebRTC/RTCH264ProfileLevelId.h | 11 + .../Headers/WebRTC/RTCIceCandidate.h | 40 +- .../Framework/Headers/WebRTC/RTCIceServer.h | 105 +- .../Headers/WebRTC/RTCIntervalRange.h | 16 +- .../Headers/WebRTC/RTCLegacyStatsReport.h | 28 +- .../Framework/Headers/WebRTC/RTCLogging.h | 57 +- .../Headers/WebRTC/RTCMTLNSVideoView.h | 11 +- .../Headers/WebRTC/RTCMTLVideoView.h | 42 +- sdk/objc/Framework/Headers/WebRTC/RTCMacros.h | 19 +- .../Headers/WebRTC/RTCMediaConstraints.h | 45 +- .../Framework/Headers/WebRTC/RTCMediaSource.h | 25 +- .../Framework/Headers/WebRTC/RTCMediaStream.h | 40 +- .../Headers/WebRTC/RTCMediaStreamTrack.h | 41 +- .../Framework/Headers/WebRTC/RTCMetrics.h | 14 +- .../Headers/WebRTC/RTCMetricsSampleInfo.h | 39 +- .../Headers/WebRTC/RTCNSGLVideoView.h | 30 +- .../Headers/WebRTC/RTCPeerConnection.h | 307 +--- .../Headers/WebRTC/RTCPeerConnectionFactory.h | 72 +- .../WebRTC/RTCPeerConnectionFactoryOptions.h | 33 +- .../Headers/WebRTC/RTCRtcpParameters.h | 21 +- .../Headers/WebRTC/RTCRtpCodecParameters.h | 64 +- .../Headers/WebRTC/RTCRtpEncodingParameters.h | 33 +- .../Headers/WebRTC/RTCRtpHeaderExtension.h | 24 +- .../Headers/WebRTC/RTCRtpParameters.h | 34 +- .../Framework/Headers/WebRTC/RTCRtpReceiver.h | 73 +- .../Framework/Headers/WebRTC/RTCRtpSender.h | 41 +- .../Headers/WebRTC/RTCRtpTransceiver.h | 120 +- .../Framework/Headers/WebRTC/RTCSSLAdapter.h | 11 +- .../Headers/WebRTC/RTCSessionDescription.h | 38 +- .../Framework/Headers/WebRTC/RTCTracing.h | 12 +- .../Headers/WebRTC/RTCVideoCapturer.h | 22 +- .../Framework/Headers/WebRTC/RTCVideoCodec.h | 186 +-- .../Headers/WebRTC/RTCVideoCodecFactory.h | 48 +- .../Headers/WebRTC/RTCVideoCodecH264.h | 87 +- .../Headers/WebRTC/RTCVideoCodecInfo.h | 11 + .../Headers/WebRTC/RTCVideoDecoderVP8.h | 16 +- .../Headers/WebRTC/RTCVideoDecoderVP9.h | 16 +- .../Headers/WebRTC/RTCVideoEncoderVP8.h | 16 +- .../Headers/WebRTC/RTCVideoEncoderVP9.h | 16 +- .../Framework/Headers/WebRTC/RTCVideoFrame.h | 76 +- .../Headers/WebRTC/RTCVideoFrameBuffer.h | 114 +- .../Headers/WebRTC/RTCVideoRenderer.h | 31 +- .../Framework/Headers/WebRTC/RTCVideoSource.h | 28 +- .../Framework/Headers/WebRTC/RTCVideoTrack.h | 28 +- .../Headers/WebRTC/RTCVideoViewShading.h | 32 +- .../Headers/WebRTC/UIDevice+RTCDevice.h | 72 +- sdk/objc/Framework/Modules/module.modulemap | 6 - .../Native/api/audio_device_module.h | 15 +- .../Native/api/video_decoder_factory.h | 18 +- .../Native/api/video_encoder_factory.h | 18 +- .../Framework/Native/api/video_frame_buffer.h | 22 +- .../Native/src/objc_video_decoder_factory.h | 29 +- .../Native/src/objc_video_encoder_factory.h | 31 +- sdk/objc/{Framework => }/Info.plist | 0 sdk/objc/README.md | 37 + .../RTCVideoRendererAdapter+Private.h | 2 +- .../RTCVideoRendererAdapter.h | 0 .../RTCVideoRendererAdapter.mm | 8 +- sdk/objc/api/logging/RTCCallbackLogger.h | 35 + .../logging}/RTCCallbackLogger.mm | 2 +- .../peerconnection}/RTCAudioSource+Private.h | 2 +- sdk/objc/api/peerconnection/RTCAudioSource.h | 32 + .../peerconnection}/RTCAudioSource.mm | 0 .../peerconnection}/RTCAudioTrack+Private.h | 2 +- sdk/objc/api/peerconnection/RTCAudioTrack.h | 28 + .../peerconnection}/RTCAudioTrack.mm | 2 +- sdk/objc/api/peerconnection/RTCCertificate.h | 44 + .../peerconnection}/RTCCertificate.mm | 5 +- .../peerconnection/RTCConfiguration+Native.h | 28 + .../RTCConfiguration+Private.h | 2 +- .../api/peerconnection/RTCConfiguration.h | 175 +++ .../peerconnection}/RTCConfiguration.mm | 3 +- .../peerconnection}/RTCDataChannel+Private.h | 2 +- sdk/objc/api/peerconnection/RTCDataChannel.h | 130 ++ .../peerconnection}/RTCDataChannel.mm | 2 +- .../RTCDataChannelConfiguration+Private.h | 2 +- .../RTCDataChannelConfiguration.h | 52 + .../RTCDataChannelConfiguration.mm | 2 +- .../peerconnection}/RTCDtmfSender+Private.h | 2 +- sdk/objc/api/peerconnection/RTCDtmfSender.h | 70 + .../peerconnection}/RTCDtmfSender.mm | 4 +- .../peerconnection/RTCEncodedImage+Private.h | 25 + .../peerconnection/RTCEncodedImage+Private.mm | 66 + sdk/objc/api/peerconnection/RTCFieldTrials.h | 46 + .../peerconnection}/RTCFieldTrials.mm | 4 +- sdk/objc/api/peerconnection/RTCFileLogger.h | 74 + .../peerconnection}/RTCFileLogger.mm | 2 +- .../peerconnection}/RTCIceCandidate+Private.h | 2 +- sdk/objc/api/peerconnection/RTCIceCandidate.h | 49 + .../peerconnection}/RTCIceCandidate.mm | 4 +- .../peerconnection}/RTCIceServer+Private.h | 2 +- sdk/objc/api/peerconnection/RTCIceServer.h | 114 ++ .../peerconnection}/RTCIceServer.mm | 2 +- .../RTCIntervalRange+Private.h | 2 +- .../api/peerconnection/RTCIntervalRange.h | 25 + .../peerconnection}/RTCIntervalRange.mm | 0 .../RTCLegacyStatsReport+Private.h | 2 +- .../api/peerconnection/RTCLegacyStatsReport.h | 37 + .../peerconnection}/RTCLegacyStatsReport.mm | 4 +- .../RTCMediaConstraints+Private.h | 2 +- .../api/peerconnection/RTCMediaConstraints.h | 54 + .../peerconnection}/RTCMediaConstraints.mm | 2 +- .../peerconnection}/RTCMediaSource+Private.h | 2 +- sdk/objc/api/peerconnection/RTCMediaSource.h | 34 + .../peerconnection}/RTCMediaSource.mm | 0 .../peerconnection}/RTCMediaStream+Private.h | 2 +- sdk/objc/api/peerconnection/RTCMediaStream.h | 49 + .../peerconnection}/RTCMediaStream.mm | 2 +- .../RTCMediaStreamTrack+Private.h | 2 +- .../api/peerconnection/RTCMediaStreamTrack.h | 50 + .../peerconnection}/RTCMediaStreamTrack.mm | 2 +- sdk/objc/api/peerconnection/RTCMetrics.h | 23 + .../peerconnection}/RTCMetrics.mm | 2 +- .../RTCMetricsSampleInfo+Private.h | 2 +- .../api/peerconnection/RTCMetricsSampleInfo.h | 48 + .../peerconnection}/RTCMetricsSampleInfo.mm | 2 +- .../RTCPeerConnection+DataChannel.mm | 2 +- .../peerconnection/RTCPeerConnection+Native.h | 34 + .../RTCPeerConnection+Private.h | 2 +- .../RTCPeerConnection+Stats.mm | 4 +- .../api/peerconnection/RTCPeerConnection.h | 316 +++++ .../peerconnection}/RTCPeerConnection.mm | 4 +- .../RTCPeerConnectionFactory+Native.h | 54 + .../RTCPeerConnectionFactory+Private.h | 2 +- .../peerconnection/RTCPeerConnectionFactory.h | 81 ++ .../RTCPeerConnectionFactory.mm | 20 +- ...nnectionFactoryBuilder+DefaultComponents.h | 0 ...nectionFactoryBuilder+DefaultComponents.mm | 9 +- .../RTCPeerConnectionFactoryBuilder.h | 2 +- .../RTCPeerConnectionFactoryBuilder.mm | 0 .../RTCPeerConnectionFactoryOptions+Private.h | 2 +- .../RTCPeerConnectionFactoryOptions.h | 42 + .../RTCPeerConnectionFactoryOptions.mm | 0 .../RTCRtcpParameters+Private.h | 2 +- .../api/peerconnection/RTCRtcpParameters.h | 30 + .../peerconnection}/RTCRtcpParameters.mm | 2 +- .../RTCRtpCodecParameters+Private.h | 2 +- .../peerconnection/RTCRtpCodecParameters.h | 73 + .../peerconnection}/RTCRtpCodecParameters.mm | 4 +- .../RTCRtpEncodingParameters+Private.h | 2 +- .../peerconnection/RTCRtpEncodingParameters.h | 42 + .../RTCRtpEncodingParameters.mm | 0 .../RTCRtpFragmentationHeader+Private.h | 26 + .../RTCRtpFragmentationHeader+Private.mm} | 29 +- .../RTCRtpHeaderExtension+Private.h | 2 +- .../peerconnection/RTCRtpHeaderExtension.h | 33 + .../peerconnection}/RTCRtpHeaderExtension.mm | 2 +- .../RTCRtpParameters+Private.h | 2 +- .../api/peerconnection/RTCRtpParameters.h | 43 + .../peerconnection}/RTCRtpParameters.mm | 2 +- .../peerconnection}/RTCRtpReceiver+Private.h | 2 +- sdk/objc/api/peerconnection/RTCRtpReceiver.h | 82 ++ .../peerconnection}/RTCRtpReceiver.mm | 4 +- .../peerconnection}/RTCRtpSender+Private.h | 2 +- sdk/objc/api/peerconnection/RTCRtpSender.h | 50 + .../peerconnection}/RTCRtpSender.mm | 4 +- .../RTCRtpTransceiver+Private.h | 2 +- .../api/peerconnection/RTCRtpTransceiver.h | 128 ++ .../peerconnection}/RTCRtpTransceiver.mm | 4 +- sdk/objc/api/peerconnection/RTCSSLAdapter.h | 20 + .../peerconnection}/RTCSSLAdapter.mm | 2 +- .../RTCSessionDescription+Private.h | 2 +- .../peerconnection/RTCSessionDescription.h | 47 + .../peerconnection}/RTCSessionDescription.mm | 4 +- sdk/objc/api/peerconnection/RTCTracing.h | 21 + .../peerconnection}/RTCTracing.mm | 2 +- .../RTCVideoCodecInfo+Private.h | 25 + .../RTCVideoCodecInfo+Private.mm | 37 + .../RTCVideoEncoderSettings+Private.h | 25 + .../RTCVideoEncoderSettings+Private.mm | 53 + .../peerconnection}/RTCVideoSource+Private.h | 2 +- sdk/objc/api/peerconnection/RTCVideoSource.h | 37 + .../peerconnection}/RTCVideoSource.mm | 2 +- .../peerconnection}/RTCVideoTrack+Private.h | 2 +- sdk/objc/api/peerconnection/RTCVideoTrack.h | 37 + .../peerconnection}/RTCVideoTrack.mm | 4 +- .../api/video_codec/RTCVideoCodecConstants.h | 16 + .../api/video_codec/RTCVideoCodecConstants.mm | 17 + sdk/objc/api/video_codec/RTCVideoDecoderVP8.h | 25 + .../video_codec/RTCVideoDecoderVP8.mm} | 17 +- sdk/objc/api/video_codec/RTCVideoDecoderVP9.h | 25 + .../video_codec/RTCVideoDecoderVP9.mm} | 17 +- sdk/objc/api/video_codec/RTCVideoEncoderVP8.h | 25 + .../api/video_codec/RTCVideoEncoderVP8.mm | 26 + sdk/objc/api/video_codec/RTCVideoEncoderVP9.h | 25 + .../api/video_codec/RTCVideoEncoderVP9.mm | 26 + .../RTCWrappedNativeVideoDecoder.h | 3 +- .../RTCWrappedNativeVideoDecoder.mm | 2 +- .../RTCWrappedNativeVideoEncoder.h | 3 +- .../RTCWrappedNativeVideoEncoder.mm | 2 +- .../RTCI420Buffer+Private.h | 7 +- .../api/video_frame_buffer/RTCI420Buffer.h | 23 + .../video_frame_buffer}/RTCI420Buffer.mm | 23 +- .../video_frame_buffer/RTCMutableI420Buffer.h | 24 + .../RTCMutableI420Buffer.mm | 31 + sdk/objc/base/RTCCodecSpecificInfo.h | 24 + sdk/objc/base/RTCEncodedImage.h | 53 + sdk/objc/base/RTCEncodedImage.m | 30 + sdk/objc/base/RTCI420Buffer.h | 21 + sdk/objc/base/RTCLogging.h | 66 + .../Classes/Common => base}/RTCLogging.mm | 3 +- sdk/objc/base/RTCMacros.h | 28 + sdk/objc/base/RTCMutableI420Buffer.h | 22 + sdk/objc/base/RTCMutableYUVPlanarBuffer.h | 26 + sdk/objc/base/RTCRtpFragmentationHeader.h | 28 + sdk/objc/base/RTCRtpFragmentationHeader.m | 20 + sdk/objc/base/RTCVideoCapturer.h | 33 + .../RTCVideoCapturer.m | 2 +- sdk/objc/base/RTCVideoCodecInfo.h | 36 + sdk/objc/base/RTCVideoCodecInfo.m | 65 + sdk/objc/base/RTCVideoDecoder.h | 45 + sdk/objc/base/RTCVideoDecoderFactory.h | 28 + sdk/objc/base/RTCVideoEncoder.h | 49 + sdk/objc/base/RTCVideoEncoderFactory.h | 28 + sdk/objc/base/RTCVideoEncoderQpThresholds.h | 28 + sdk/objc/base/RTCVideoEncoderQpThresholds.m | 26 + sdk/objc/base/RTCVideoEncoderSettings.h | 43 + sdk/objc/base/RTCVideoEncoderSettings.m | 26 + sdk/objc/base/RTCVideoFrame.h | 85 ++ .../PeerConnection => base}/RTCVideoFrame.mm | 20 +- sdk/objc/base/RTCVideoFrameBuffer.h | 30 + sdk/objc/base/RTCVideoRenderer.h | 40 + sdk/objc/base/RTCYUVPlanarBuffer.h | 44 + .../audio}/RTCAudioSession+Configuration.mm | 8 +- .../audio}/RTCAudioSession+Private.h | 2 +- sdk/objc/components/audio/RTCAudioSession.h | 249 ++++ .../audio}/RTCAudioSession.mm | 8 +- .../audio/RTCAudioSessionConfiguration.h | 48 + .../audio}/RTCAudioSessionConfiguration.m | 9 +- .../RTCNativeAudioSessionDelegateAdapter.h | 2 +- .../RTCNativeAudioSessionDelegateAdapter.mm | 4 +- .../capturer/RTCCameraVideoCapturer.h | 56 + .../capturer}/RTCCameraVideoCapturer.m | 13 +- .../capturer/RTCFileVideoCapturer.h | 51 + .../capturer}/RTCFileVideoCapturer.m | 7 +- .../renderer/metal}/RTCMTLI420Renderer.h | 0 .../renderer/metal}/RTCMTLI420Renderer.mm | 7 +- .../renderer/metal/RTCMTLNSVideoView.h | 24 + .../renderer/metal}/RTCMTLNSVideoView.m | 4 +- .../renderer/metal}/RTCMTLNV12Renderer.h | 0 .../renderer/metal}/RTCMTLNV12Renderer.mm | 9 +- .../renderer/metal}/RTCMTLRGBRenderer.h | 0 .../renderer/metal}/RTCMTLRGBRenderer.mm | 9 +- .../renderer/metal}/RTCMTLRenderer+Private.h | 3 + .../renderer/metal}/RTCMTLRenderer.h | 2 +- .../renderer/metal}/RTCMTLRenderer.mm | 6 +- .../renderer/metal/RTCMTLVideoView.h | 46 + .../renderer/metal}/RTCMTLVideoView.m | 9 +- .../renderer/opengl/RTCDefaultShader.h | 23 + .../renderer/opengl}/RTCDefaultShader.mm | 2 +- .../renderer/opengl/RTCDisplayLinkTimer.h | 24 + .../renderer/opengl/RTCDisplayLinkTimer.m | 59 + .../renderer/opengl/RTCEAGLVideoView.h | 44 + .../renderer/opengl}/RTCEAGLVideoView.m | 69 +- .../renderer/opengl}/RTCI420TextureCache.h | 2 +- .../renderer/opengl}/RTCI420TextureCache.mm | 4 +- .../renderer/opengl/RTCNSGLVideoView.h | 41 + .../renderer/opengl}/RTCNSGLVideoView.m | 6 +- .../renderer/opengl/RTCNV12TextureCache.h | 31 + .../renderer/opengl}/RTCNV12TextureCache.m | 6 +- .../renderer/opengl}/RTCOpenGLDefines.h | 0 .../renderer/opengl}/RTCShader.h | 2 +- .../renderer/opengl}/RTCShader.mm | 0 .../renderer/opengl/RTCVideoViewShading.h | 41 + .../RTCCodecSpecificInfoH264+Private.h | 24 + .../video_codec/RTCCodecSpecificInfoH264.h | 27 + .../video_codec/RTCCodecSpecificInfoH264.mm | 30 + .../RTCDefaultVideoDecoderFactory.h | 25 + .../RTCDefaultVideoDecoderFactory.m | 11 +- .../RTCDefaultVideoEncoderFactory.h | 30 + .../RTCDefaultVideoEncoderFactory.m | 12 +- .../video_codec/RTCH264ProfileLevelId.h | 60 + .../video_codec}/RTCH264ProfileLevelId.mm | 64 +- .../video_codec/RTCVideoDecoderFactoryH264.h | 18 + .../video_codec/RTCVideoDecoderFactoryH264.m | 27 + .../video_codec/RTCVideoDecoderH264.h | 18 + .../video_codec}/RTCVideoDecoderH264.mm | 38 +- .../video_codec/RTCVideoEncoderFactoryH264.h | 18 + .../video_codec/RTCVideoEncoderFactoryH264.m} | 42 +- .../video_codec/RTCVideoEncoderH264.h | 22 + .../video_codec}/RTCVideoEncoderH264.mm | 35 +- .../video_codec}/UIDevice+H264Profile.h | 0 .../video_codec}/UIDevice+H264Profile.mm | 2 +- .../video_codec}/helpers.cc | 0 .../video_codec}/helpers.h | 0 .../video_codec}/nalu_rewriter.cc | 2 +- .../components/video_codec/nalu_rewriter.h | 116 ++ .../video_codec}/nalu_rewriter_unittest.cc | 2 +- .../video_frame_buffer/RTCCVPixelBuffer.h | 52 + .../video_frame_buffer}/RTCCVPixelBuffer.mm | 4 +- .../AVCaptureSession+DevicePosition.h | 0 .../AVCaptureSession+DevicePosition.mm | 0 sdk/objc/helpers/NSString+StdString.h | 26 + .../Common => helpers}/NSString+StdString.mm | 0 sdk/objc/helpers/RTCCameraPreviewView.h | 30 + .../UI => helpers}/RTCCameraPreviewView.m | 2 +- .../RTCDispatcher+Private.h | 2 +- sdk/objc/helpers/RTCDispatcher.h | 44 + .../Common => helpers}/RTCDispatcher.m | 1 - .../helpers/RTCUIApplicationStatusObserver.h | 25 + .../RTCUIApplicationStatusObserver.m | 0 sdk/objc/helpers/UIDevice+RTCDevice.h | 81 ++ .../Common => helpers}/UIDevice+RTCDevice.mm | 4 +- .../Classes/Common => helpers}/noop.mm | 0 sdk/objc/helpers/scoped_cftyperef.h | 116 ++ sdk/objc/native/api/audio_device_module.h | 24 + .../api/audio_device_module.mm | 2 +- .../Native => native}/api/video_capturer.h | 8 +- .../Native => native}/api/video_capturer.mm | 4 +- sdk/objc/native/api/video_decoder_factory.h | 27 + .../api/video_decoder_factory.mm | 4 +- sdk/objc/native/api/video_encoder_factory.h | 27 + .../api/video_encoder_factory.mm | 4 +- .../Native => native}/api/video_frame.h | 8 +- .../Native => native}/api/video_frame.mm | 4 +- sdk/objc/native/api/video_frame_buffer.h | 29 + .../api/video_frame_buffer.mm | 4 +- .../Native => native}/api/video_renderer.h | 8 +- .../Native => native}/api/video_renderer.mm | 4 +- .../src/audio/audio_device_ios.h | 8 +- .../src/audio/audio_device_ios.mm | 12 +- .../src/audio/audio_device_module_ios.h | 6 +- .../src/audio/audio_device_module_ios.mm | 2 - .../src/audio/audio_session_observer.h | 6 +- .../Common => native/src/audio}/helpers.h | 6 +- .../Common => native/src/audio}/helpers.mm | 4 +- .../src/audio/voice_processing_audio_unit.h | 6 +- .../src/audio/voice_processing_audio_unit.mm | 4 +- .../Native => native}/src/objc_frame_buffer.h | 6 +- .../src/objc_frame_buffer.mm | 6 +- .../native/src/objc_video_decoder_factory.h | 38 + .../src/objc_video_decoder_factory.mm | 21 +- .../native/src/objc_video_encoder_factory.h | 40 + .../src/objc_video_encoder_factory.mm | 23 +- .../Native => native}/src/objc_video_frame.h | 8 +- .../Native => native}/src/objc_video_frame.mm | 4 +- .../src/objc_video_renderer.h | 6 +- .../src/objc_video_renderer.mm | 8 +- .../src/objc_video_track_source.h | 10 +- .../src/objc_video_track_source.mm | 9 +- .../ObjCVideoTrackSource_xctest.mm | 14 +- .../RTCAudioDeviceModule_xctest.mm | 2 +- .../RTCAudioDevice_xctest.mm | 6 +- .../RTCAudioSessionTest.mm | 6 +- .../RTCCVPixelBuffer_xctest.mm | 11 +- .../RTCCallbackLogger_xctest.m | 2 +- .../RTCCameraVideoCapturerTests.mm | 8 +- .../RTCCertificateTest.mm | 14 +- .../RTCConfigurationTest.mm | 11 +- .../RTCDataChannelConfigurationTest.mm | 6 +- ...NotPutCPlusPlusInFrameworkHeaders_xctest.m | 2 +- .../RTCFileVideoCapturer_xctest.mm | 2 +- .../RTCH264ProfileLevelId_xctest.m | 2 +- .../RTCIceCandidateTest.mm | 6 +- .../RTCIceServerTest.mm | 6 +- .../RTCIntervalRangeTests.mm | 4 +- .../RTCMTLVideoView_xctest.m | 8 +- .../RTCMediaConstraintsTest.mm | 6 +- .../RTCPeerConnectionFactoryBuilderTest.mm | 6 +- .../RTCPeerConnectionFactory_xctest.m | 24 +- .../RTCPeerConnectionTest.mm | 16 +- .../RTCSessionDescriptionTest.mm | 6 +- .../UnitTests => unittests}/RTCTracingTest.mm | 6 +- .../UnitTests => unittests}/audio_short16.pcm | Bin .../UnitTests => unittests}/audio_short44.pcm | Bin .../UnitTests => unittests}/audio_short48.pcm | Bin .../avformatmappertests.mm | 3 - .../UnitTests => unittests}/foreman.mp4 | Bin .../frame_buffer_helpers.h | 0 .../frame_buffer_helpers.mm | 2 +- .../{Framework/UnitTests => unittests}/main.m | 0 .../objc_video_decoder_factory_tests.mm | 6 +- .../objc_video_encoder_factory_tests.mm | 12 +- .../scoped_cftyperef_tests.mm | 2 +- test/BUILD.gn | 12 +- test/ios/test_support.mm | 6 +- test/testsupport/iosfileutils.mm | 16 +- tools_webrtc/ios/generate_umbrella_header.py | 9 +- tools_webrtc/ios/tests/common_tests.json | 4 + webrtc.gni | 5 +- 470 files changed, 7255 insertions(+), 5258 deletions(-) delete mode 100644 sdk/objc/Framework/Classes/PeerConnection/RTCEncodedImage.mm delete mode 100644 sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm delete mode 100644 sdk/objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm create mode 100644 sdk/objc/Framework/Headers/WebRTC/RTCCVPixelBuffer.h create mode 100644 sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoDecoderFactory.h create mode 100644 sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoEncoderFactory.h create mode 100644 sdk/objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h create mode 100644 sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecInfo.h delete mode 100644 sdk/objc/Framework/Modules/module.modulemap rename sdk/objc/{Framework => }/Info.plist (100%) create mode 100644 sdk/objc/README.md rename sdk/objc/{Framework/Classes/PeerConnection => api}/RTCVideoRendererAdapter+Private.h (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api}/RTCVideoRendererAdapter.h (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api}/RTCVideoRendererAdapter.mm (91%) create mode 100644 sdk/objc/api/logging/RTCCallbackLogger.h rename sdk/objc/{Framework/Classes/Common => api/logging}/RTCCallbackLogger.mm (98%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCAudioSource+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCAudioSource.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCAudioSource.mm (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCAudioTrack+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCAudioTrack.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCAudioTrack.mm (98%) create mode 100644 sdk/objc/api/peerconnection/RTCCertificate.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCCertificate.mm (97%) create mode 100644 sdk/objc/api/peerconnection/RTCConfiguration+Native.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCConfiguration+Private.h (98%) create mode 100644 sdk/objc/api/peerconnection/RTCConfiguration.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCConfiguration.mm (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCDataChannel+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCDataChannel.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCDataChannel.mm (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCDataChannelConfiguration+Private.h (93%) create mode 100644 sdk/objc/api/peerconnection/RTCDataChannelConfiguration.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCDataChannelConfiguration.mm (98%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCDtmfSender+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCDtmfSender.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCDtmfSender.mm (97%) create mode 100644 sdk/objc/api/peerconnection/RTCEncodedImage+Private.h create mode 100644 sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm create mode 100644 sdk/objc/api/peerconnection/RTCFieldTrials.h rename sdk/objc/{Framework/Classes/Common => api/peerconnection}/RTCFieldTrials.mm (98%) create mode 100644 sdk/objc/api/peerconnection/RTCFileLogger.h rename sdk/objc/{Framework/Classes/Common => api/peerconnection}/RTCFileLogger.mm (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCIceCandidate+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCIceCandidate.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCIceCandidate.mm (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCIceServer+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCIceServer.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCIceServer.mm (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCIntervalRange+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCIntervalRange.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCIntervalRange.mm (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCLegacyStatsReport+Private.h (94%) create mode 100644 sdk/objc/api/peerconnection/RTCLegacyStatsReport.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCLegacyStatsReport.mm (96%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaConstraints+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCMediaConstraints.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaConstraints.mm (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaSource+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCMediaSource.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaSource.mm (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaStream+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCMediaStream.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaStream.mm (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaStreamTrack+Private.h (98%) create mode 100644 sdk/objc/api/peerconnection/RTCMediaStreamTrack.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMediaStreamTrack.mm (99%) create mode 100644 sdk/objc/api/peerconnection/RTCMetrics.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMetrics.mm (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMetricsSampleInfo+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCMetricsSampleInfo.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCMetricsSampleInfo.mm (96%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnection+DataChannel.mm (96%) create mode 100644 sdk/objc/api/peerconnection/RTCPeerConnection+Native.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnection+Private.h (99%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnection+Stats.mm (98%) create mode 100644 sdk/objc/api/peerconnection/RTCPeerConnection.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnection.mm (99%) create mode 100644 sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactory+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCPeerConnectionFactory.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactory.mm (94%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactoryBuilder+DefaultComponents.h (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm (85%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactoryBuilder.h (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactoryBuilder.mm (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactoryOptions+Private.h (93%) create mode 100644 sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCPeerConnectionFactoryOptions.mm (100%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtcpParameters+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCRtcpParameters.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtcpParameters.mm (96%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpCodecParameters+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpCodecParameters.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpCodecParameters.mm (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpEncodingParameters+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpEncodingParameters.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpEncodingParameters.mm (100%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h rename sdk/objc/{Framework/Classes/PeerConnection/RTCRtpFragmentationHeader.mm => api/peerconnection/RTCRtpFragmentationHeader+Private.mm} (61%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpHeaderExtension+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpHeaderExtension.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpHeaderExtension.mm (96%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpParameters+Private.h (95%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpParameters.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpParameters.mm (98%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpReceiver+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpReceiver.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpReceiver.mm (98%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpSender+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpSender.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpSender.mm (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpTransceiver+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCRtpTransceiver.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCRtpTransceiver.mm (98%) create mode 100644 sdk/objc/api/peerconnection/RTCSSLAdapter.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCSSLAdapter.mm (95%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCSessionDescription+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCSessionDescription.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCSessionDescription.mm (97%) create mode 100644 sdk/objc/api/peerconnection/RTCTracing.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCTracing.mm (96%) create mode 100644 sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h create mode 100644 sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm create mode 100644 sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h create mode 100644 sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCVideoSource+Private.h (97%) create mode 100644 sdk/objc/api/peerconnection/RTCVideoSource.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCVideoSource.mm (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCVideoTrack+Private.h (96%) create mode 100644 sdk/objc/api/peerconnection/RTCVideoTrack.h rename sdk/objc/{Framework/Classes/PeerConnection => api/peerconnection}/RTCVideoTrack.mm (97%) create mode 100644 sdk/objc/api/video_codec/RTCVideoCodecConstants.h create mode 100644 sdk/objc/api/video_codec/RTCVideoCodecConstants.mm create mode 100644 sdk/objc/api/video_codec/RTCVideoDecoderVP8.h rename sdk/objc/{Framework/Classes/PeerConnection/RTCVideoCodecVP8.mm => api/video_codec/RTCVideoDecoderVP8.mm} (66%) create mode 100644 sdk/objc/api/video_codec/RTCVideoDecoderVP9.h rename sdk/objc/{Framework/Classes/PeerConnection/RTCVideoCodecVP9.mm => api/video_codec/RTCVideoDecoderVP9.mm} (66%) create mode 100644 sdk/objc/api/video_codec/RTCVideoEncoderVP8.h create mode 100644 sdk/objc/api/video_codec/RTCVideoEncoderVP8.mm create mode 100644 sdk/objc/api/video_codec/RTCVideoEncoderVP9.h create mode 100644 sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm rename sdk/objc/{Framework/Classes/PeerConnection => api/video_codec}/RTCWrappedNativeVideoDecoder.h (96%) rename sdk/objc/{Framework/Classes/PeerConnection => api/video_codec}/RTCWrappedNativeVideoDecoder.mm (97%) rename sdk/objc/{Framework/Classes/PeerConnection => api/video_codec}/RTCWrappedNativeVideoEncoder.h (96%) rename sdk/objc/{Framework/Classes/PeerConnection => api/video_codec}/RTCWrappedNativeVideoEncoder.mm (97%) rename sdk/objc/{Framework/Classes/Video => api/video_frame_buffer}/RTCI420Buffer+Private.h (84%) create mode 100644 sdk/objc/api/video_frame_buffer/RTCI420Buffer.h rename sdk/objc/{Framework/Classes/Video => api/video_frame_buffer}/RTCI420Buffer.mm (87%) create mode 100644 sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.h create mode 100644 sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.mm create mode 100644 sdk/objc/base/RTCCodecSpecificInfo.h create mode 100644 sdk/objc/base/RTCEncodedImage.h create mode 100644 sdk/objc/base/RTCEncodedImage.m create mode 100644 sdk/objc/base/RTCI420Buffer.h create mode 100644 sdk/objc/base/RTCLogging.h rename sdk/objc/{Framework/Classes/Common => base}/RTCLogging.mm (98%) create mode 100644 sdk/objc/base/RTCMacros.h create mode 100644 sdk/objc/base/RTCMutableI420Buffer.h create mode 100644 sdk/objc/base/RTCMutableYUVPlanarBuffer.h create mode 100644 sdk/objc/base/RTCRtpFragmentationHeader.h create mode 100644 sdk/objc/base/RTCRtpFragmentationHeader.m create mode 100644 sdk/objc/base/RTCVideoCapturer.h rename sdk/objc/{Framework/Classes/PeerConnection => base}/RTCVideoCapturer.m (94%) create mode 100644 sdk/objc/base/RTCVideoCodecInfo.h create mode 100644 sdk/objc/base/RTCVideoCodecInfo.m create mode 100644 sdk/objc/base/RTCVideoDecoder.h create mode 100644 sdk/objc/base/RTCVideoDecoderFactory.h create mode 100644 sdk/objc/base/RTCVideoEncoder.h create mode 100644 sdk/objc/base/RTCVideoEncoderFactory.h create mode 100644 sdk/objc/base/RTCVideoEncoderQpThresholds.h create mode 100644 sdk/objc/base/RTCVideoEncoderQpThresholds.m create mode 100644 sdk/objc/base/RTCVideoEncoderSettings.h create mode 100644 sdk/objc/base/RTCVideoEncoderSettings.m create mode 100644 sdk/objc/base/RTCVideoFrame.h rename sdk/objc/{Framework/Classes/PeerConnection => base}/RTCVideoFrame.mm (66%) create mode 100644 sdk/objc/base/RTCVideoFrameBuffer.h create mode 100644 sdk/objc/base/RTCVideoRenderer.h create mode 100644 sdk/objc/base/RTCYUVPlanarBuffer.h rename sdk/objc/{Framework/Classes/Audio => components/audio}/RTCAudioSession+Configuration.mm (98%) rename sdk/objc/{Framework/Classes/Audio => components/audio}/RTCAudioSession+Private.h (98%) create mode 100644 sdk/objc/components/audio/RTCAudioSession.h rename sdk/objc/{Framework/Classes/Audio => components/audio}/RTCAudioSession.mm (99%) create mode 100644 sdk/objc/components/audio/RTCAudioSessionConfiguration.h rename sdk/objc/{Framework/Classes/Audio => components/audio}/RTCAudioSessionConfiguration.m (97%) rename sdk/objc/{Framework/Classes/Audio => components/audio}/RTCNativeAudioSessionDelegateAdapter.h (93%) rename sdk/objc/{Framework/Classes/Audio => components/audio}/RTCNativeAudioSessionDelegateAdapter.mm (96%) create mode 100644 sdk/objc/components/capturer/RTCCameraVideoCapturer.h rename sdk/objc/{Framework/Classes/PeerConnection => components/capturer}/RTCCameraVideoCapturer.m (98%) create mode 100644 sdk/objc/components/capturer/RTCFileVideoCapturer.h rename sdk/objc/{Framework/Classes/PeerConnection => components/capturer}/RTCFileVideoCapturer.m (97%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLI420Renderer.h (100%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLI420Renderer.mm (97%) create mode 100644 sdk/objc/components/renderer/metal/RTCMTLNSVideoView.h rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLNSVideoView.m (97%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLNV12Renderer.h (100%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLNV12Renderer.mm (96%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLRGBRenderer.h (100%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLRGBRenderer.mm (96%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLRenderer+Private.h (99%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLRenderer.h (97%) rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLRenderer.mm (99%) create mode 100644 sdk/objc/components/renderer/metal/RTCMTLVideoView.h rename sdk/objc/{Framework/Classes/Metal => components/renderer/metal}/RTCMTLVideoView.m (97%) create mode 100644 sdk/objc/components/renderer/opengl/RTCDefaultShader.h rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCDefaultShader.mm (99%) create mode 100644 sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.h create mode 100644 sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.m create mode 100644 sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h rename sdk/objc/{Framework/Classes/UI => components/renderer/opengl}/RTCEAGLVideoView.m (84%) rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCI420TextureCache.h (96%) rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCI420TextureCache.mm (98%) create mode 100644 sdk/objc/components/renderer/opengl/RTCNSGLVideoView.h rename sdk/objc/{Framework/Classes/UI => components/renderer/opengl}/RTCNSGLVideoView.m (98%) create mode 100644 sdk/objc/components/renderer/opengl/RTCNV12TextureCache.h rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCNV12TextureCache.m (96%) rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCOpenGLDefines.h (100%) rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCShader.h (96%) rename sdk/objc/{Framework/Classes/Video => components/renderer/opengl}/RTCShader.mm (100%) create mode 100644 sdk/objc/components/renderer/opengl/RTCVideoViewShading.h create mode 100644 sdk/objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h create mode 100644 sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.h create mode 100644 sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.mm create mode 100644 sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h rename sdk/objc/{Framework/Classes/PeerConnection => components/video_codec}/RTCDefaultVideoDecoderFactory.m (81%) create mode 100644 sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h rename sdk/objc/{Framework/Classes/PeerConnection => components/video_codec}/RTCDefaultVideoEncoderFactory.m (90%) create mode 100644 sdk/objc/components/video_codec/RTCH264ProfileLevelId.h rename sdk/objc/{Framework/Classes/PeerConnection => components/video_codec}/RTCH264ProfileLevelId.mm (50%) create mode 100644 sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.h create mode 100644 sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m create mode 100644 sdk/objc/components/video_codec/RTCVideoDecoderH264.h rename sdk/objc/{Framework/Classes/VideoToolbox => components/video_codec}/RTCVideoDecoderH264.mm (91%) create mode 100644 sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.h rename sdk/objc/{Framework/Classes/PeerConnection/RTCVideoCodecH264.mm => components/video_codec/RTCVideoEncoderFactoryH264.m} (59%) create mode 100644 sdk/objc/components/video_codec/RTCVideoEncoderH264.h rename sdk/objc/{Framework/Classes/VideoToolbox => components/video_codec}/RTCVideoEncoderH264.mm (97%) rename sdk/objc/{Framework/Classes/Video => components/video_codec}/UIDevice+H264Profile.h (100%) rename sdk/objc/{Framework/Classes/Video => components/video_codec}/UIDevice+H264Profile.mm (99%) rename sdk/objc/{Framework/Classes/VideoToolbox => components/video_codec}/helpers.cc (100%) rename sdk/objc/{Framework/Classes/VideoToolbox => components/video_codec}/helpers.h (100%) rename sdk/objc/{Framework/Classes/VideoToolbox => components/video_codec}/nalu_rewriter.cc (99%) create mode 100644 sdk/objc/components/video_codec/nalu_rewriter.h rename sdk/objc/{Framework/Classes/VideoToolbox => components/video_codec}/nalu_rewriter_unittest.cc (99%) create mode 100644 sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.h rename sdk/objc/{Framework/Classes/Video => components/video_frame_buffer}/RTCCVPixelBuffer.mm (99%) rename sdk/objc/{Framework/Classes/Video => helpers}/AVCaptureSession+DevicePosition.h (100%) rename sdk/objc/{Framework/Classes/Video => helpers}/AVCaptureSession+DevicePosition.mm (100%) create mode 100644 sdk/objc/helpers/NSString+StdString.h rename sdk/objc/{Framework/Classes/Common => helpers}/NSString+StdString.mm (100%) create mode 100644 sdk/objc/helpers/RTCCameraPreviewView.h rename sdk/objc/{Framework/Classes/UI => helpers}/RTCCameraPreviewView.m (98%) rename sdk/objc/{Framework/Classes/Common => helpers}/RTCDispatcher+Private.h (94%) create mode 100644 sdk/objc/helpers/RTCDispatcher.h rename sdk/objc/{Framework/Classes/Common => helpers}/RTCDispatcher.m (99%) create mode 100644 sdk/objc/helpers/RTCUIApplicationStatusObserver.h rename sdk/objc/{Framework/Classes/Common => helpers}/RTCUIApplicationStatusObserver.m (100%) create mode 100644 sdk/objc/helpers/UIDevice+RTCDevice.h rename sdk/objc/{Framework/Classes/Common => helpers}/UIDevice+RTCDevice.mm (99%) rename sdk/objc/{Framework/Classes/Common => helpers}/noop.mm (100%) create mode 100644 sdk/objc/helpers/scoped_cftyperef.h create mode 100644 sdk/objc/native/api/audio_device_module.h rename sdk/objc/{Framework/Native => native}/api/audio_device_module.mm (92%) rename sdk/objc/{Framework/Native => native}/api/video_capturer.h (77%) rename sdk/objc/{Framework/Native => native}/api/video_capturer.mm (90%) create mode 100644 sdk/objc/native/api/video_decoder_factory.h rename sdk/objc/{Framework/Native => native}/api/video_decoder_factory.mm (83%) create mode 100644 sdk/objc/native/api/video_encoder_factory.h rename sdk/objc/{Framework/Native => native}/api/video_encoder_factory.mm (83%) rename sdk/objc/{Framework/Native => native}/api/video_frame.h (74%) rename sdk/objc/{Framework/Native => native}/api/video_frame.mm (82%) create mode 100644 sdk/objc/native/api/video_frame_buffer.h rename sdk/objc/{Framework/Native => native}/api/video_frame_buffer.mm (86%) rename sdk/objc/{Framework/Native => native}/api/video_renderer.h (76%) rename sdk/objc/{Framework/Native => native}/api/video_renderer.mm (85%) rename sdk/objc/{Framework/Native => native}/src/audio/audio_device_ios.h (98%) rename sdk/objc/{Framework/Native => native}/src/audio/audio_device_ios.mm (99%) rename sdk/objc/{Framework/Native => native}/src/audio/audio_device_module_ios.h (96%) rename sdk/objc/{Framework/Native => native}/src/audio/audio_device_module_ios.mm (99%) rename sdk/objc/{Framework/Native => native}/src/audio/audio_session_observer.h (85%) rename sdk/objc/{Framework/Classes/Common => native/src/audio}/helpers.h (93%) rename sdk/objc/{Framework/Classes/Common => native/src/audio}/helpers.mm (98%) rename sdk/objc/{Framework/Native => native}/src/audio/voice_processing_audio_unit.h (96%) rename sdk/objc/{Framework/Native => native}/src/audio/voice_processing_audio_unit.mm (99%) rename sdk/objc/{Framework/Native => native}/src/objc_frame_buffer.h (86%) rename sdk/objc/{Framework/Native => native}/src/objc_frame_buffer.mm (93%) create mode 100644 sdk/objc/native/src/objc_video_decoder_factory.h rename sdk/objc/{Framework/Native => native}/src/objc_video_decoder_factory.mm (89%) create mode 100644 sdk/objc/native/src/objc_video_encoder_factory.h rename sdk/objc/{Framework/Native => native}/src/objc_video_encoder_factory.mm (87%) rename sdk/objc/{Framework/Native => native}/src/objc_video_frame.h (72%) rename sdk/objc/{Framework/Native => native}/src/objc_video_frame.mm (88%) rename sdk/objc/{Framework/Native => native}/src/objc_video_renderer.h (82%) rename sdk/objc/{Framework/Native => native}/src/objc_video_renderer.mm (84%) rename sdk/objc/{Framework/Native => native}/src/objc_video_track_source.h (85%) rename sdk/objc/{Framework/Native => native}/src/objc_video_track_source.mm (94%) rename sdk/objc/{Framework/UnitTests => unittests}/ObjCVideoTrackSource_xctest.mm (98%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCAudioDeviceModule_xctest.mm (99%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCAudioDevice_xctest.mm (95%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCAudioSessionTest.mm (98%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCCVPixelBuffer_xctest.mm (98%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCCallbackLogger_xctest.m (98%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCCameraVideoCapturerTests.mm (99%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCCertificateTest.mm (88%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCConfigurationTest.mm (96%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCDataChannelConfigurationTest.mm (91%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m (97%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCFileVideoCapturer_xctest.mm (98%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCH264ProfileLevelId_xctest.m (96%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCIceCandidateTest.mm (94%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCIceServerTest.mm (98%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCIntervalRangeTests.mm (93%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCMTLVideoView_xctest.m (97%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCMediaConstraintsTest.mm (93%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCPeerConnectionFactoryBuilderTest.mm (92%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCPeerConnectionFactory_xctest.m (94%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCPeerConnectionTest.mm (92%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCSessionDescriptionTest.mm (97%) rename sdk/objc/{Framework/UnitTests => unittests}/RTCTracingTest.mm (94%) rename sdk/objc/{Framework/UnitTests => unittests}/audio_short16.pcm (100%) rename sdk/objc/{Framework/UnitTests => unittests}/audio_short44.pcm (100%) rename sdk/objc/{Framework/UnitTests => unittests}/audio_short48.pcm (100%) rename sdk/objc/{Framework/UnitTests => unittests}/avformatmappertests.mm (99%) rename sdk/objc/{Framework/UnitTests => unittests}/foreman.mp4 (100%) rename sdk/objc/{Framework/UnitTests => unittests}/frame_buffer_helpers.h (100%) rename sdk/objc/{Framework/UnitTests => unittests}/frame_buffer_helpers.mm (98%) rename sdk/objc/{Framework/UnitTests => unittests}/main.m (100%) rename sdk/objc/{Framework/UnitTests => unittests}/objc_video_decoder_factory_tests.mm (96%) rename sdk/objc/{Framework/UnitTests => unittests}/objc_video_encoder_factory_tests.mm (95%) rename sdk/objc/{Framework/UnitTests => unittests}/scoped_cftyperef_tests.mm (97%) diff --git a/BUILD.gn b/BUILD.gn index 3ae4500f39..7c8a5772c3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -320,6 +320,10 @@ config("common_config") { config("common_objc") { libs = [ "Foundation.framework" ] + + if (rtc_use_metal_rendering) { + defines = [ "RTC_SUPPORTS_METAL" ] + } } if (!build_with_chromium) { diff --git a/examples/BUILD.gn b/examples/BUILD.gn index 76526eb3be..05ddef876a 100644 --- a/examples/BUILD.gn +++ b/examples/BUILD.gn @@ -205,19 +205,15 @@ if (is_ios || (is_mac && target_cpu != "x86")) { if (is_ios) { # iOS must use WebRTC.framework which is dynamically linked. - # 'gn check' is disabled in order to avoid confusion and - # errors caused by multiple implementations. - check_includes = false deps = [ - "../sdk:framework_objc", + "../sdk:framework_objc+link", "../system_wrappers:field_trial_default", "../system_wrappers:runtime_enabled_features_default", ] } else { deps = [ - "../sdk:common_objc", + "../sdk:mac_framework_objc+link", "../system_wrappers:field_trial_default", - "../system_wrappers:metrics_default", "../system_wrappers:runtime_enabled_features_default", ] } @@ -279,23 +275,12 @@ if (is_ios || (is_mac && target_cpu != "x86")) { ] if (is_ios) { # iOS must use WebRTC.framework which is dynamically linked. - # 'gn check' is disabled in order to avoid confusion and - # errors caused by multiple implementations. - check_includes = false deps += [ - ":AppRTCMobile_ios_frameworks", - "../sdk:framework_objc", + "../sdk:framework_objc+link", + "../sdk:ios_framework_bundle", ] } else { - deps += [ - "../sdk:common_objc", - "../sdk:mediaconstraints_objc", - "../sdk:peerconnectionfactory_base_objc", - "../sdk:videocapture_objc", - "../sdk:videocodec_objc", - "../sdk:videoframebuffer_objc", - "../sdk:videosource_objc", - ] + deps += [ "../sdk:mac_framework_objc+link" ] } libs = [ "QuartzCore.framework" ] } @@ -303,9 +288,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) { if (is_ios) { rtc_static_library("AppRTCMobile_lib") { # iOS must use WebRTC.framework which is dynamically linked. - # 'gn check' is disabled in order to avoid confusion and - # errors caused by multiple implementations. - check_includes = false testonly = true sources = [ "objc/AppRTCMobile/ios/ARDAppDelegate.h", @@ -331,10 +313,10 @@ if (is_ios || (is_mac && target_cpu != "x86")) { ] deps = [ - ":AppRTCMobile_ios_frameworks", ":apprtc_common", ":apprtc_signaling", - "../sdk:framework_objc", + "../sdk:framework_objc+link", + "../sdk:ios_framework_bundle", ] } @@ -351,9 +333,9 @@ if (is_ios || (is_mac && target_cpu != "x86")) { deps = [ ":AppRTCMobile_ios_bundle_data", - ":AppRTCMobile_ios_frameworks", ":AppRTCMobile_lib", "../sdk:framework_objc", + "../sdk:ios_framework_bundle", ] if (rtc_apprtcmobile_broadcast_extension) { @@ -396,7 +378,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) { } rtc_static_library("AppRTCMobileBroadcastUpload_lib") { - check_includes = false testonly = true sources = [ "objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.h", @@ -404,9 +385,9 @@ if (is_ios || (is_mac && target_cpu != "x86")) { ] deps = [ - ":AppRTCMobile_ios_frameworks", ":apprtc_signaling", - "../sdk:framework_objc", + "../sdk:framework_objc+link", + "../sdk:ios_framework_bundle", ] libs = [ "ReplayKit.framework" ] @@ -441,18 +422,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) { } } - bundle_data("AppRTCMobile_ios_frameworks") { - deps = [ - "../sdk:framework_objc+link", - ] - sources = [ - "$root_build_dir/WebRTC.framework", - ] - outputs = [ - "{{bundle_resources_dir}}/Frameworks/{{source_file_part}}", - ] - } - bundle_data("AppRTCMobile_ios_bundle_data") { sources = [ "objc/AppRTCMobile/ios/resources/Roboto-Regular.ttf", @@ -507,10 +476,12 @@ if (is_ios || (is_mac && target_cpu != "x86")) { "../modules/audio_processing:audio_processing", "../pc:libjingle_peerconnection", "../rtc_base:rtc_base", + "../sdk:base_objc", "../sdk:default_codec_factory_objc", - "../sdk:framework_objc", + "../sdk:helpers_objc", "../sdk:native_api", "../sdk:ui_objc", + "../sdk:videocapture_objc", "../sdk:videotoolbox_objc", "../system_wrappers:field_trial_default", "../system_wrappers:metrics_default", @@ -557,14 +528,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) { deps = [ ":apprtc_common", ":apprtc_signaling", - "../sdk:default_codec_factory_objc", - "../sdk:metal_objc", - "../sdk:peerconnectionfactory_base_objc", - "../sdk:ui_objc", - "../sdk:videocapture_objc", - "../sdk:videocodec_objc", - "../sdk:videocodec_objc", - "../sdk:videotoolbox_objc", + "../sdk:mac_framework_objc+link", ] } @@ -584,6 +548,8 @@ if (is_ios || (is_mac && target_cpu != "x86")) { deps = [ ":AppRTCMobile_lib", + "../sdk:mac_framework_bundle", + "../sdk:mac_framework_objc+link", ] } } @@ -629,26 +595,22 @@ if (is_ios || (is_mac && target_cpu != "x86")) { if (is_ios) { rtc_source_set("apprtcmobile_test_sources") { # iOS must use WebRTC.framework which is dynamically linked. - # 'gn check' is disabled in order to avoid confusion and - # errors caused by multiple implementations. - check_includes = false testonly = true include_dirs = [ "objc/AppRTCMobile", "objc/AppRTCMobile/ios", ] - testonly = true sources = [ "objc/AppRTCMobile/tests/ARDAppClient_xctest.mm", "objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm", "objc/AppRTCMobile/tests/ARDSettingsModel_xctest.mm", ] deps = [ - ":AppRTCMobile_ios_frameworks", ":AppRTCMobile_lib", ":apprtc_signaling", "../rtc_base:rtc_base", - "../sdk:framework_objc", + "../sdk:framework_objc+link", + "../sdk:ios_framework_bundle", "//build/config/ios:xctest", "//third_party/ocmock", ] diff --git a/examples/DEPS b/examples/DEPS index 1570220097..6a9a9f09cf 100644 --- a/examples/DEPS +++ b/examples/DEPS @@ -1,5 +1,4 @@ include_rules = [ - "+WebRTC", "+api", "+common_video", "+media", @@ -8,6 +7,6 @@ include_rules = [ "+modules/audio_processing", "+p2p", "+pc", - "+sdk/objc/Framework/Native/api", + "+sdk/objc", "+third_party/libyuv", ] diff --git a/examples/objc/AppRTCMobile/ARDAppClient+Internal.h b/examples/objc/AppRTCMobile/ARDAppClient+Internal.h index 8e96b16909..96103c26a2 100644 --- a/examples/objc/AppRTCMobile/ARDAppClient+Internal.h +++ b/examples/objc/AppRTCMobile/ARDAppClient+Internal.h @@ -10,7 +10,7 @@ #import "ARDAppClient.h" -#import "WebRTC/RTCPeerConnection.h" +#import #import "ARDRoomServerClient.h" #import "ARDSignalingChannel.h" diff --git a/examples/objc/AppRTCMobile/ARDAppClient.h b/examples/objc/AppRTCMobile/ARDAppClient.h index 07cd53d167..5e9c4cb8d0 100644 --- a/examples/objc/AppRTCMobile/ARDAppClient.h +++ b/examples/objc/AppRTCMobile/ARDAppClient.h @@ -9,8 +9,8 @@ */ #import -#import "WebRTC/RTCPeerConnection.h" -#import "WebRTC/RTCVideoTrack.h" +#import +#import typedef NS_ENUM(NSInteger, ARDAppClientState) { // Disconnected from servers. diff --git a/examples/objc/AppRTCMobile/ARDAppClient.m b/examples/objc/AppRTCMobile/ARDAppClient.m index 465ce8c9b8..9a0d3695f9 100644 --- a/examples/objc/AppRTCMobile/ARDAppClient.m +++ b/examples/objc/AppRTCMobile/ARDAppClient.m @@ -10,22 +10,23 @@ #import "ARDAppClient+Internal.h" -#import "WebRTC/RTCAudioTrack.h" -#import "WebRTC/RTCCameraVideoCapturer.h" -#import "WebRTC/RTCConfiguration.h" -#import "WebRTC/RTCFileLogger.h" -#import "WebRTC/RTCFileVideoCapturer.h" -#import "WebRTC/RTCIceServer.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCMediaConstraints.h" -#import "WebRTC/RTCMediaStream.h" -#import "WebRTC/RTCPeerConnectionFactory.h" -#import "WebRTC/RTCRtpSender.h" -#import "WebRTC/RTCRtpTransceiver.h" -#import "WebRTC/RTCTracing.h" -#import "WebRTC/RTCVideoCodecFactory.h" -#import "WebRTC/RTCVideoSource.h" -#import "WebRTC/RTCVideoTrack.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import #import "ARDAppEngineClient.h" #import "ARDExternalSampleCapturer.h" diff --git a/examples/objc/AppRTCMobile/ARDAppEngineClient.m b/examples/objc/AppRTCMobile/ARDAppEngineClient.m index 0c22ea4b0f..a392c658ab 100644 --- a/examples/objc/AppRTCMobile/ARDAppEngineClient.m +++ b/examples/objc/AppRTCMobile/ARDAppEngineClient.m @@ -10,7 +10,7 @@ #import "ARDAppEngineClient.h" -#import "WebRTC/RTCLogging.h" +#import #import "ARDJoinResponse.h" #import "ARDMessageResponse.h" diff --git a/examples/objc/AppRTCMobile/ARDCaptureController.h b/examples/objc/AppRTCMobile/ARDCaptureController.h index bdae93a844..0150bedc3d 100644 --- a/examples/objc/AppRTCMobile/ARDCaptureController.h +++ b/examples/objc/AppRTCMobile/ARDCaptureController.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include +#import @class ARDSettingsModel; diff --git a/examples/objc/AppRTCMobile/ARDCaptureController.m b/examples/objc/AppRTCMobile/ARDCaptureController.m index 068e18ec92..6afc6c8942 100644 --- a/examples/objc/AppRTCMobile/ARDCaptureController.m +++ b/examples/objc/AppRTCMobile/ARDCaptureController.m @@ -10,8 +10,9 @@ #import "ARDCaptureController.h" +#import + #import "ARDSettingsModel.h" -#import "WebRTC/RTCLogging.h" const Float64 kFramerateLimit = 30.0; diff --git a/examples/objc/AppRTCMobile/ARDExternalSampleCapturer.m b/examples/objc/AppRTCMobile/ARDExternalSampleCapturer.m index d377033bde..9d93ea1e6c 100644 --- a/examples/objc/AppRTCMobile/ARDExternalSampleCapturer.m +++ b/examples/objc/AppRTCMobile/ARDExternalSampleCapturer.m @@ -10,7 +10,8 @@ #import "ARDExternalSampleCapturer.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import +#import @implementation ARDExternalSampleCapturer diff --git a/examples/objc/AppRTCMobile/ARDSettingsModel+Private.h b/examples/objc/AppRTCMobile/ARDSettingsModel+Private.h index 08d863d59a..dc3f24ced8 100644 --- a/examples/objc/AppRTCMobile/ARDSettingsModel+Private.h +++ b/examples/objc/AppRTCMobile/ARDSettingsModel+Private.h @@ -9,6 +9,7 @@ */ #import + #import "ARDSettingsModel.h" @class ARDSettingsStore; diff --git a/examples/objc/AppRTCMobile/ARDSettingsModel.h b/examples/objc/AppRTCMobile/ARDSettingsModel.h index 597ab38fbf..bac762c246 100644 --- a/examples/objc/AppRTCMobile/ARDSettingsModel.h +++ b/examples/objc/AppRTCMobile/ARDSettingsModel.h @@ -10,7 +10,7 @@ #import -#import "WebRTC/RTCVideoCodec.h" +#import NS_ASSUME_NONNULL_BEGIN diff --git a/examples/objc/AppRTCMobile/ARDSettingsModel.m b/examples/objc/AppRTCMobile/ARDSettingsModel.m index 34a47a4989..fb3ef7ee8b 100644 --- a/examples/objc/AppRTCMobile/ARDSettingsModel.m +++ b/examples/objc/AppRTCMobile/ARDSettingsModel.m @@ -10,9 +10,10 @@ #import "ARDSettingsModel+Private.h" #import "ARDSettingsStore.h" -#import "WebRTC/RTCCameraVideoCapturer.h" -#import "WebRTC/RTCMediaConstraints.h" -#import "WebRTC/RTCVideoCodecFactory.h" + +#import +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/examples/objc/AppRTCMobile/ARDSignalingMessage.h b/examples/objc/AppRTCMobile/ARDSignalingMessage.h index 93ff4862cf..89b2f55d09 100644 --- a/examples/objc/AppRTCMobile/ARDSignalingMessage.h +++ b/examples/objc/AppRTCMobile/ARDSignalingMessage.h @@ -10,8 +10,8 @@ #import -#import "WebRTC/RTCIceCandidate.h" -#import "WebRTC/RTCSessionDescription.h" +#import +#import typedef enum { kARDSignalingMessageTypeCandidate, diff --git a/examples/objc/AppRTCMobile/ARDSignalingMessage.m b/examples/objc/AppRTCMobile/ARDSignalingMessage.m index 3fab185848..3efc502532 100644 --- a/examples/objc/AppRTCMobile/ARDSignalingMessage.m +++ b/examples/objc/AppRTCMobile/ARDSignalingMessage.m @@ -10,7 +10,7 @@ #import "ARDSignalingMessage.h" -#import "WebRTC/RTCLogging.h" +#import #import "ARDUtilities.h" #import "RTCIceCandidate+JSON.h" diff --git a/examples/objc/AppRTCMobile/ARDStatsBuilder.m b/examples/objc/AppRTCMobile/ARDStatsBuilder.m index 370b72e867..cfe2ec5cd8 100644 --- a/examples/objc/AppRTCMobile/ARDStatsBuilder.m +++ b/examples/objc/AppRTCMobile/ARDStatsBuilder.m @@ -10,7 +10,7 @@ #import "ARDStatsBuilder.h" -#import "WebRTC/RTCLegacyStatsReport.h" +#import #import "ARDBitrateTracker.h" #import "ARDUtilities.h" diff --git a/examples/objc/AppRTCMobile/ARDWebSocketChannel.m b/examples/objc/AppRTCMobile/ARDWebSocketChannel.m index 6f60380bff..19a60d4664 100644 --- a/examples/objc/AppRTCMobile/ARDWebSocketChannel.m +++ b/examples/objc/AppRTCMobile/ARDWebSocketChannel.m @@ -10,7 +10,7 @@ #import "ARDWebSocketChannel.h" -#import "WebRTC/RTCLogging.h" +#import #import "SRWebSocket.h" #import "ARDSignalingMessage.h" diff --git a/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.h b/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.h index 1826555861..facfb7a05f 100644 --- a/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.h +++ b/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCIceCandidate.h" +#import @interface RTCIceCandidate (JSON) diff --git a/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.m b/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.m index b1be7fb7e3..e88ca11ff1 100644 --- a/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.m +++ b/examples/objc/AppRTCMobile/RTCIceCandidate+JSON.m @@ -10,7 +10,7 @@ #import "RTCIceCandidate+JSON.h" -#import "WebRTC/RTCLogging.h" +#import static NSString const *kRTCICECandidateTypeKey = @"type"; static NSString const *kRTCICECandidateTypeValue = @"candidate"; diff --git a/examples/objc/AppRTCMobile/RTCIceServer+JSON.h b/examples/objc/AppRTCMobile/RTCIceServer+JSON.h index dbc702dc7e..3f858062bd 100644 --- a/examples/objc/AppRTCMobile/RTCIceServer+JSON.h +++ b/examples/objc/AppRTCMobile/RTCIceServer+JSON.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCIceServer.h" +#import @interface RTCIceServer (JSON) diff --git a/examples/objc/AppRTCMobile/RTCMediaConstraints+JSON.h b/examples/objc/AppRTCMobile/RTCMediaConstraints+JSON.h index 42d7ab0f01..5f16a2a3af 100644 --- a/examples/objc/AppRTCMobile/RTCMediaConstraints+JSON.h +++ b/examples/objc/AppRTCMobile/RTCMediaConstraints+JSON.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMediaConstraints.h" +#import @interface RTCMediaConstraints (JSON) diff --git a/examples/objc/AppRTCMobile/RTCSessionDescription+JSON.h b/examples/objc/AppRTCMobile/RTCSessionDescription+JSON.h index f5671213a8..07bc270379 100644 --- a/examples/objc/AppRTCMobile/RTCSessionDescription+JSON.h +++ b/examples/objc/AppRTCMobile/RTCSessionDescription+JSON.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCSessionDescription.h" +#import @interface RTCSessionDescription (JSON) diff --git a/examples/objc/AppRTCMobile/common/ARDUtilities.m b/examples/objc/AppRTCMobile/common/ARDUtilities.m index 0ae44da4be..aabc45390c 100644 --- a/examples/objc/AppRTCMobile/common/ARDUtilities.m +++ b/examples/objc/AppRTCMobile/common/ARDUtilities.m @@ -12,7 +12,7 @@ #import -#import "WebRTC/RTCLogging.h" +#import @implementation NSDictionary (ARDUtilites) diff --git a/examples/objc/AppRTCMobile/ios/ARDAppDelegate.m b/examples/objc/AppRTCMobile/ios/ARDAppDelegate.m index 4f444e428d..16af444800 100644 --- a/examples/objc/AppRTCMobile/ios/ARDAppDelegate.m +++ b/examples/objc/AppRTCMobile/ios/ARDAppDelegate.m @@ -10,10 +10,10 @@ #import "ARDAppDelegate.h" -#import "WebRTC/RTCFieldTrials.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCSSLAdapter.h" -#import "WebRTC/RTCTracing.h" +#import +#import +#import +#import #import "ARDMainViewController.h" diff --git a/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m b/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m index d61bfe2d98..1f0276f189 100644 --- a/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m +++ b/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m @@ -10,7 +10,7 @@ #import "ARDFileCaptureController.h" -#import "WebRTC/RTCFileVideoCapturer.h" +#import @interface ARDFileCaptureController () diff --git a/examples/objc/AppRTCMobile/ios/ARDMainViewController.m b/examples/objc/AppRTCMobile/ios/ARDMainViewController.m index 174514ff18..fae3f7b8aa 100644 --- a/examples/objc/AppRTCMobile/ios/ARDMainViewController.m +++ b/examples/objc/AppRTCMobile/ios/ARDMainViewController.m @@ -12,11 +12,10 @@ #import -#import "WebRTC/RTCAudioSession.h" -#import "WebRTC/RTCAudioSessionConfiguration.h" -#import "WebRTC/RTCDispatcher.h" -#import "WebRTC/RTCLogging.h" - +#import +#import +#import +#import #import "ARDAppClient.h" #import "ARDMainView.h" diff --git a/examples/objc/AppRTCMobile/ios/ARDStatsView.m b/examples/objc/AppRTCMobile/ios/ARDStatsView.m index 39067e08a8..05d91b243b 100644 --- a/examples/objc/AppRTCMobile/ios/ARDStatsView.m +++ b/examples/objc/AppRTCMobile/ios/ARDStatsView.m @@ -10,7 +10,7 @@ #import "ARDStatsView.h" -#import "WebRTC/RTCLegacyStatsReport.h" +#import #import "ARDStatsBuilder.h" diff --git a/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m b/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m index dbd78ea279..2827bf9442 100644 --- a/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m +++ b/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m @@ -10,17 +10,17 @@ #import "ARDVideoCallViewController.h" -#import "WebRTC/RTCAudioSession.h" -#import "WebRTC/RTCCameraVideoCapturer.h" +#import +#import +#import +#import +#import #import "ARDAppClient.h" #import "ARDCaptureController.h" #import "ARDFileCaptureController.h" #import "ARDSettingsModel.h" #import "ARDVideoCallView.h" -#import "WebRTC/RTCDispatcher.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCMediaConstraints.h" @interface ARDVideoCallViewController () @interface RTCVideoCodecInfo (HumanReadable) diff --git a/examples/objc/AppRTCMobile/ios/RTCVideoCodecInfo+HumanReadable.m b/examples/objc/AppRTCMobile/ios/RTCVideoCodecInfo+HumanReadable.m index 6c18cf3ebb..d0bf1b5c5b 100644 --- a/examples/objc/AppRTCMobile/ios/RTCVideoCodecInfo+HumanReadable.m +++ b/examples/objc/AppRTCMobile/ios/RTCVideoCodecInfo+HumanReadable.m @@ -9,7 +9,8 @@ */ #import "RTCVideoCodecInfo+HumanReadable.h" -#import "WebRTC/RTCVideoCodecH264.h" + +#import @implementation RTCVideoCodecInfo (HumanReadable) diff --git a/examples/objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.h b/examples/objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.h index 2218261991..42a908dafc 100644 --- a/examples/objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.h +++ b/examples/objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.h @@ -10,7 +10,7 @@ #import -#import "WebRTC/RTCLogging.h" +#import #import "ARDAppClient.h" diff --git a/examples/objc/AppRTCMobile/mac/APPRTCAppDelegate.m b/examples/objc/AppRTCMobile/mac/APPRTCAppDelegate.m index dd3f192185..ea6fd733e0 100644 --- a/examples/objc/AppRTCMobile/mac/APPRTCAppDelegate.m +++ b/examples/objc/AppRTCMobile/mac/APPRTCAppDelegate.m @@ -10,7 +10,7 @@ #import "APPRTCAppDelegate.h" #import "APPRTCViewController.h" -#import "WebRTC/RTCSSLAdapter.h" +#import @interface APPRTCAppDelegate () @end diff --git a/examples/objc/AppRTCMobile/mac/APPRTCViewController.m b/examples/objc/AppRTCMobile/mac/APPRTCViewController.m index cb82e88888..9f5ed40b1b 100644 --- a/examples/objc/AppRTCMobile/mac/APPRTCViewController.m +++ b/examples/objc/AppRTCMobile/mac/APPRTCViewController.m @@ -12,9 +12,9 @@ #import -#import "WebRTC/RTCMTLNSVideoView.h" -#import "WebRTC/RTCNSGLVideoView.h" -#import "WebRTC/RTCVideoTrack.h" +#import +#import +#import #import "ARDAppClient.h" #import "ARDCaptureController.h" diff --git a/examples/objc/AppRTCMobile/tests/ARDAppClient_xctest.mm b/examples/objc/AppRTCMobile/tests/ARDAppClient_xctest.mm index f332a0f346..8c29401148 100644 --- a/examples/objc/AppRTCMobile/tests/ARDAppClient_xctest.mm +++ b/examples/objc/AppRTCMobile/tests/ARDAppClient_xctest.mm @@ -15,8 +15,8 @@ #include "rtc_base/ssladapter.h" -#import "WebRTC/RTCMediaConstraints.h" -#import "WebRTC/RTCPeerConnectionFactory.h" +#import +#import #import "ARDAppClient+Internal.h" #import "ARDJoinResponse+Internal.h" diff --git a/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm b/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm index e734f102d4..e3942c79fe 100644 --- a/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm +++ b/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm @@ -14,7 +14,7 @@ #import "ARDFileCaptureController.h" -#import "WebRTC/RTCFileVideoCapturer.h" +#import NS_CLASS_AVAILABLE_IOS(10) @interface ARDFileCaptureControllerTests : XCTestCase diff --git a/examples/objc/AppRTCMobile/tests/ARDSettingsModel_xctest.mm b/examples/objc/AppRTCMobile/tests/ARDSettingsModel_xctest.mm index b44f9358ac..7c34d0a3ca 100644 --- a/examples/objc/AppRTCMobile/tests/ARDSettingsModel_xctest.mm +++ b/examples/objc/AppRTCMobile/tests/ARDSettingsModel_xctest.mm @@ -12,7 +12,7 @@ #import #import -#import "WebRTC/RTCMediaConstraints.h" +#import #import "ARDSettingsModel+Private.h" #import "ARDSettingsStore.h" diff --git a/examples/objcnativeapi/objc/NADViewController.mm b/examples/objcnativeapi/objc/NADViewController.mm index 0d5ac9a3b9..34f54672d3 100644 --- a/examples/objcnativeapi/objc/NADViewController.mm +++ b/examples/objcnativeapi/objc/NADViewController.mm @@ -10,11 +10,14 @@ #import "NADViewController.h" -#import -#import -#import -#import -#import +#import "sdk/objc/base/RTCVideoRenderer.h" +#import "sdk/objc/components/capturer/RTCCameraVideoCapturer.h" +#if defined(RTC_SUPPORTS_METAL) +#import "sdk/objc/components/renderer/metal/RTCMTLVideoView.h" // nogncheck +#endif +#import "sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h" +#import "sdk/objc/helpers/RTCCameraPreviewView.h" + #include #include "objccallclient.h" diff --git a/examples/objcnativeapi/objc/objccallclient.mm b/examples/objcnativeapi/objc/objccallclient.mm index 0e3b8e05db..c384da3ef8 100644 --- a/examples/objcnativeapi/objc/objccallclient.mm +++ b/examples/objcnativeapi/objc/objccallclient.mm @@ -12,9 +12,10 @@ #include -#import -#import -#import +#import "sdk/objc/base/RTCVideoRenderer.h" +#import "sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h" +#import "sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h" +#import "sdk/objc/helpers/RTCCameraPreviewView.h" #include "absl/memory/memory.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" @@ -22,10 +23,10 @@ #include "api/peerconnectioninterface.h" #include "media/engine/webrtcmediaengine.h" #include "modules/audio_processing/include/audio_processing.h" -#include "sdk/objc/Framework/Native/api/video_capturer.h" -#include "sdk/objc/Framework/Native/api/video_decoder_factory.h" -#include "sdk/objc/Framework/Native/api/video_encoder_factory.h" -#include "sdk/objc/Framework/Native/api/video_renderer.h" +#include "sdk/objc/native/api/video_capturer.h" +#include "sdk/objc/native/api/video_decoder_factory.h" +#include "sdk/objc/native/api/video_encoder_factory.h" +#include "sdk/objc/native/api/video_renderer.h" namespace webrtc_examples { diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn index e0c0da8dd9..3034788b52 100644 --- a/modules/audio_device/BUILD.gn +++ b/modules/audio_device/BUILD.gn @@ -69,8 +69,9 @@ if (rtc_include_internal_audio_device && is_ios) { "../../rtc_base:gtest_prod", "../../rtc_base:rtc_base", "../../rtc_base/system:fallthrough", + "../../sdk:audio_device", "../../sdk:audio_objc", - "../../sdk:common_objc", + "../../sdk:base_objc", "../../system_wrappers:metrics_api", ] if (!build_with_chromium && is_clang) { diff --git a/modules/audio_device/DEPS b/modules/audio_device/DEPS index cb7a541b8d..f74767a67e 100644 --- a/modules/audio_device/DEPS +++ b/modules/audio_device/DEPS @@ -25,6 +25,9 @@ specific_include_rules = { "RTCAudioSessionDelegateAdapter\.h": [ "+sdk/objc", ], + "RTCAudioSessionDelegateAdapter\.mm": [ + "+sdk/objc", + ], "voice_processing_audio_unit\.mm": [ "+sdk/objc", ], diff --git a/modules/audio_device/ios/audio_device_ios.h b/modules/audio_device/ios/audio_device_ios.h index eeebbf382f..e90bb440f4 100644 --- a/modules/audio_device/ios/audio_device_ios.h +++ b/modules/audio_device/ios/audio_device_ios.h @@ -21,7 +21,7 @@ #include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/thread_checker.h" -#include "sdk/objc/Framework/Headers/WebRTC/RTCMacros.h" +#include "sdk/objc/base/RTCMacros.h" RTC_FWD_DECL_OBJC_CLASS(RTCAudioSessionDelegateAdapter); diff --git a/modules/audio_device/ios/audio_device_ios.mm b/modules/audio_device/ios/audio_device_ios.mm index 7e3d8f2181..9ca664d119 100644 --- a/modules/audio_device/ios/audio_device_ios.mm +++ b/modules/audio_device/ios/audio_device_ios.mm @@ -25,14 +25,14 @@ #include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/timeutils.h" -#include "sdk/objc/Framework/Classes/Common/helpers.h" +#include "sdk/objc/native/src/audio/helpers.h" #include "system_wrappers/include/metrics.h" -#import "WebRTC/RTCLogging.h" #import "modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.h" -#import "sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h" +#import "sdk/objc/base/RTCLogging.h" +#import "sdk/objc/components/audio/RTCAudioSession+Private.h" +#import "sdk/objc/components/audio/RTCAudioSession.h" +#import "sdk/objc/components/audio/RTCAudioSessionConfiguration.h" namespace webrtc { diff --git a/modules/audio_device/ios/audio_device_unittest_ios.mm b/modules/audio_device/ios/audio_device_unittest_ios.mm index b0a356f2e6..3baa5b5d4b 100644 --- a/modules/audio_device/ios/audio_device_unittest_ios.mm +++ b/modules/audio_device/ios/audio_device_unittest_ios.mm @@ -31,8 +31,8 @@ #include "test/gtest.h" #include "test/testsupport/fileutils.h" -#import "sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" +#import "sdk/objc/components/audio/RTCAudioSession+Private.h" +#import "sdk/objc/components/audio/RTCAudioSession.h" using std::cout; using std::endl; diff --git a/modules/audio_device/ios/objc/RTCAudioSession.h b/modules/audio_device/ios/objc/RTCAudioSession.h index 006fb81cb6..23abc3d6b1 100644 --- a/modules/audio_device/ios/objc/RTCAudioSession.h +++ b/modules/audio_device/ios/objc/RTCAudioSession.h @@ -8,4 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" +#import "sdk/objc/components/audio/RTCAudioSession.h" diff --git a/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h b/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h index b1e41d1e11..2584053054 100644 --- a/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h +++ b/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h @@ -8,4 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h" +#import "sdk/objc/components/audio/RTCAudioSessionConfiguration.h" diff --git a/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.h b/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.h index f024bfb00f..54f4c26557 100644 --- a/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.h +++ b/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" +#import "sdk/objc/components/audio/RTCAudioSession.h" namespace webrtc { class AudioSessionObserver; diff --git a/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.mm b/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.mm index 6bb3df2e67..818e077a6a 100644 --- a/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.mm +++ b/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.mm @@ -12,7 +12,7 @@ #include "modules/audio_device/ios/audio_session_observer.h" -#import "WebRTC/RTCLogging.h" +#import "sdk/objc/base/RTCLogging.h" @implementation RTCAudioSessionDelegateAdapter { webrtc::AudioSessionObserver *_observer; diff --git a/modules/audio_device/ios/voice_processing_audio_unit.mm b/modules/audio_device/ios/voice_processing_audio_unit.mm index 48bd7e117a..41477d1f67 100644 --- a/modules/audio_device/ios/voice_processing_audio_unit.mm +++ b/modules/audio_device/ios/voice_processing_audio_unit.mm @@ -14,8 +14,8 @@ #include "rtc_base/system/fallthrough.h" #include "system_wrappers/include/metrics.h" -#import "WebRTC/RTCLogging.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h" +#import "sdk/objc/base//RTCLogging.h" +#import "sdk/objc/components/audio/RTCAudioSessionConfiguration.h" #if !defined(NDEBUG) static void LogStreamDescription(AudioStreamBasicDescription description) { diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index e910adf2bf..6b944684e5 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -200,7 +200,7 @@ if (is_mac) { "../../rtc_base:rtc_base", "../../rtc_base:rtc_base_approved", "../../rtc_base/synchronization:rw_lock_wrapper", - "../../sdk:common_objc", + "../../sdk:helpers_objc", "//third_party/abseil-cpp/absl/memory", ] libs = [ diff --git a/modules/desktop_capture/mac/desktop_frame_cgimage.h b/modules/desktop_capture/mac/desktop_frame_cgimage.h index 1adc8b02cf..bf8be1b2fa 100644 --- a/modules/desktop_capture/mac/desktop_frame_cgimage.h +++ b/modules/desktop_capture/mac/desktop_frame_cgimage.h @@ -16,7 +16,7 @@ #include #include "modules/desktop_capture/desktop_frame.h" -#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h" +#include "sdk/objc/helpers/scoped_cftyperef.h" namespace webrtc { diff --git a/modules/desktop_capture/mac/desktop_frame_iosurface.h b/modules/desktop_capture/mac/desktop_frame_iosurface.h index ced60f8057..be2fc4f252 100644 --- a/modules/desktop_capture/mac/desktop_frame_iosurface.h +++ b/modules/desktop_capture/mac/desktop_frame_iosurface.h @@ -17,7 +17,7 @@ #include #include "modules/desktop_capture/desktop_frame.h" -#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h" +#include "sdk/objc/helpers/scoped_cftyperef.h" namespace webrtc { diff --git a/modules/desktop_capture/mac/desktop_frame_provider.h b/modules/desktop_capture/mac/desktop_frame_provider.h index 7e172716ea..4826f99e8e 100644 --- a/modules/desktop_capture/mac/desktop_frame_provider.h +++ b/modules/desktop_capture/mac/desktop_frame_provider.h @@ -19,7 +19,7 @@ #include "modules/desktop_capture/shared_desktop_frame.h" #include "rtc_base/thread_checker.h" -#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h" +#include "sdk/objc/helpers/scoped_cftyperef.h" namespace webrtc { diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm index ae6c47cfa3..f696d914ec 100644 --- a/modules/desktop_capture/mac/screen_capturer_mac.mm +++ b/modules/desktop_capture/mac/screen_capturer_mac.mm @@ -18,7 +18,7 @@ #include "rtc_base/logging.h" #include "rtc_base/timeutils.h" #include "rtc_base/trace_event.h" -#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h" +#include "sdk/objc/helpers/scoped_cftyperef.h" namespace webrtc { diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index d4594f66d1..3e98a7c3fd 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -536,7 +536,6 @@ if (rtc_include_tests) { "../../media:rtc_media_base", "../../modules:module_api", "../../rtc_base:rtc_base_approved", - "../../sdk:common_objc", "../../sdk:native_api", "../../sdk:peerconnectionfactory_base_objc", "../../sdk:videocodec_objc", diff --git a/modules/video_coding/codecs/test/objc_codec_factory_helper.mm b/modules/video_coding/codecs/test/objc_codec_factory_helper.mm index 6fb14f346e..df12fd9689 100644 --- a/modules/video_coding/codecs/test/objc_codec_factory_helper.mm +++ b/modules/video_coding/codecs/test/objc_codec_factory_helper.mm @@ -10,9 +10,10 @@ #include "modules/video_coding/codecs/test/objc_codec_factory_helper.h" -#import "WebRTC/RTCVideoCodecH264.h" -#include "sdk/objc/Framework/Native/api/video_decoder_factory.h" -#include "sdk/objc/Framework/Native/api/video_encoder_factory.h" +#import "sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.h" +#import "sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.h" +#include "sdk/objc/native/api/video_decoder_factory.h" +#include "sdk/objc/native/api/video_encoder_factory.h" namespace webrtc { namespace test { diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index aa62d8b07c..68f3ae69df 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -11,10 +11,8 @@ if (is_ios) { import("//build/config/ios/rules.gni") import("//build/config/ios/ios_sdk.gni") } - -declare_args() { - # Determine whether or not to include metal rendering - rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64") +if (is_mac) { + import("//build/config/mac/rules.gni") } group("sdk") { @@ -32,15 +30,14 @@ group("sdk") { if (is_ios || is_mac) { config("common_config_objc") { include_dirs = [ - "objc/Framework/Classes", - "objc/Framework/Classes/Audio", - "objc/Framework/Classes/Common", - "objc/Framework/Classes/Metal", - "objc/Framework/Classes/PeerConnection", - "objc/Framework/Classes/UI", - "objc/Framework/Classes/Video", - "objc/Framework/Classes/VideoToolbox", - "objc/Framework/Headers", + "objc", + + # This is needed so that framework headers can include base headers + # without pathname (so it works from within the framework module). + "objc/base", + + # This is here for backward compatiblity reasons. + "objc/Framework/Headers", # TODO(bugs.webrtc.org/9627): Remove this. ] cflags = [ "-Wstrict-overflow", @@ -54,24 +51,54 @@ if (is_ios || is_mac) { } } + # TODO(bugs.webrtc.org/9627): Remove this when unused. Targets should depend on base_objc + # or helpers_objc directly instead. rtc_static_library("common_objc") { visibility = [ "*" ] + sources = [ - "objc/Framework/Classes/Common/NSString+StdString.h", - "objc/Framework/Classes/Common/NSString+StdString.mm", - "objc/Framework/Classes/Common/RTCDispatcher+Private.h", - "objc/Framework/Classes/Common/RTCDispatcher.m", - "objc/Framework/Classes/Common/RTCFieldTrials.mm", - "objc/Framework/Classes/Common/RTCLogging.mm", - "objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h", - "objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.m", - "objc/Framework/Classes/Common/helpers.h", - "objc/Framework/Classes/Common/helpers.mm", - "objc/Framework/Classes/Common/scoped_cftyperef.h", - "objc/Framework/Headers/WebRTC/RTCDispatcher.h", - "objc/Framework/Headers/WebRTC/RTCFieldTrials.h", - "objc/Framework/Headers/WebRTC/RTCLogging.h", - "objc/Framework/Headers/WebRTC/RTCMacros.h", + "objc/helpers/noop.mm", + ] + + public_configs = [ ":common_config_objc" ] + + deps = [ + ":base_objc", + ":helpers_objc", + ] + } + + rtc_static_library("base_objc") { + visibility = [ "*" ] + sources = [ + "objc/base/RTCCodecSpecificInfo.h", + "objc/base/RTCEncodedImage.h", + "objc/base/RTCEncodedImage.m", + "objc/base/RTCI420Buffer.h", + "objc/base/RTCLogging.h", + "objc/base/RTCLogging.mm", + "objc/base/RTCMacros.h", + "objc/base/RTCMutableI420Buffer.h", + "objc/base/RTCMutableYUVPlanarBuffer.h", + "objc/base/RTCRtpFragmentationHeader.h", + "objc/base/RTCRtpFragmentationHeader.m", + "objc/base/RTCVideoCapturer.h", + "objc/base/RTCVideoCapturer.m", + "objc/base/RTCVideoCodecInfo.h", + "objc/base/RTCVideoCodecInfo.m", + "objc/base/RTCVideoDecoder.h", + "objc/base/RTCVideoDecoderFactory.h", + "objc/base/RTCVideoEncoder.h", + "objc/base/RTCVideoEncoderFactory.h", + "objc/base/RTCVideoEncoderQpThresholds.h", + "objc/base/RTCVideoEncoderQpThresholds.m", + "objc/base/RTCVideoEncoderSettings.h", + "objc/base/RTCVideoEncoderSettings.m", + "objc/base/RTCVideoFrame.h", + "objc/base/RTCVideoFrame.mm", + "objc/base/RTCVideoFrameBuffer.h", + "objc/base/RTCVideoRenderer.h", + "objc/base/RTCYUVPlanarBuffer.h", ] deps = [ @@ -84,20 +111,85 @@ if (is_ios || is_mac) { ] public_configs = [ ":common_config_objc" ] + } + + rtc_static_library("helpers_objc") { + sources = [ + "objc/helpers/AVCaptureSession+DevicePosition.h", + "objc/helpers/AVCaptureSession+DevicePosition.mm", + "objc/helpers/NSString+StdString.h", + "objc/helpers/NSString+StdString.mm", + "objc/helpers/RTCDispatcher+Private.h", + "objc/helpers/RTCDispatcher.h", + "objc/helpers/RTCDispatcher.m", + "objc/helpers/RTCUIApplicationStatusObserver.h", + "objc/helpers/RTCUIApplicationStatusObserver.m", + "objc/helpers/scoped_cftyperef.h", + ] + + deps = [ + ":base_objc", + "../rtc_base:checks", + ] + + libs = [ + "AVFoundation.framework", + "CoreMedia.framework", + ] + + configs += [ + "..:common_objc", + ":used_from_extension", + ] + + public_configs = [ ":common_config_objc" ] if (is_ios) { sources += [ - "objc/Framework/Classes/Common/UIDevice+RTCDevice.mm", - "objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h", + "objc/helpers/RTCCameraPreviewView.h", + "objc/helpers/RTCCameraPreviewView.m", + "objc/helpers/UIDevice+RTCDevice.h", + "objc/helpers/UIDevice+RTCDevice.mm", + ] + } + } + + if (!build_with_chromium) { + rtc_static_library("callback_logger_objc") { + sources = [ + "objc/api/logging/RTCCallbackLogger.h", + "objc/api/logging/RTCCallbackLogger.mm", + ] + + deps = [ + ":base_objc", + "../rtc_base:checks", + "../rtc_base:logging", + "../rtc_base:rtc_base", + ] + + configs += [ + "..:common_objc", + ":used_from_extension", ] } - if (!build_with_chromium) { - sources += [ - "objc/Framework/Classes/Common/RTCCallbackLogger.mm", - "objc/Framework/Classes/Common/RTCFileLogger.mm", - "objc/Framework/Headers/WebRTC/RTCCallbackLogger.h", - "objc/Framework/Headers/WebRTC/RTCFileLogger.h", + rtc_static_library("file_logger_objc") { + sources = [ + "objc/api/peerconnection/RTCFileLogger.h", + "objc/api/peerconnection/RTCFileLogger.mm", + ] + + deps = [ + ":base_objc", + "../rtc_base:checks", + "../rtc_base:logging", + "../rtc_base:rtc_base", + ] + + configs += [ + "..:common_objc", + ":used_from_extension", ] } } @@ -108,8 +200,8 @@ if (is_ios || is_mac) { visibility = [ "*" ] sources = [ - "objc/Framework/Native/api/audio_device_module.h", - "objc/Framework/Native/api/audio_device_module.mm", + "objc/native/api/audio_device_module.h", + "objc/native/api/audio_device_module.mm", ] deps = [ @@ -133,7 +225,7 @@ if (is_ios || is_mac) { visibility = [ ":*" ] sources = [ - "objc/Framework/Native/src/audio/audio_session_observer.h", + "objc/native/src/audio/audio_session_observer.h", ] deps = [ @@ -145,18 +237,20 @@ if (is_ios || is_mac) { visibility = [ "*" ] sources = [ - "objc/Framework/Native/src/audio/audio_device_ios.h", - "objc/Framework/Native/src/audio/audio_device_ios.mm", - "objc/Framework/Native/src/audio/audio_device_module_ios.h", - "objc/Framework/Native/src/audio/audio_device_module_ios.mm", - "objc/Framework/Native/src/audio/voice_processing_audio_unit.h", - "objc/Framework/Native/src/audio/voice_processing_audio_unit.mm", + "objc/native/src/audio/audio_device_ios.h", + "objc/native/src/audio/audio_device_ios.mm", + "objc/native/src/audio/audio_device_module_ios.h", + "objc/native/src/audio/audio_device_module_ios.mm", + "objc/native/src/audio/helpers.h", + "objc/native/src/audio/helpers.mm", + "objc/native/src/audio/voice_processing_audio_unit.h", + "objc/native/src/audio/voice_processing_audio_unit.mm", ] deps = [ ":audio_objc", ":audio_session_observer", - ":common_objc", + ":base_objc", "../api:array_view", "../modules/audio_device:audio_device_api", "../modules/audio_device:audio_device_buffer", @@ -164,7 +258,6 @@ if (is_ios || is_mac) { "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base/system:fallthrough", - "../sdk:common_objc", "../system_wrappers:metrics_api", ] @@ -177,14 +270,14 @@ if (is_ios || is_mac) { rtc_static_library("audio_objc") { sources = [ - "objc/Framework/Classes/Audio/RTCAudioSession+Configuration.mm", - "objc/Framework/Classes/Audio/RTCAudioSession+Private.h", - "objc/Framework/Classes/Audio/RTCAudioSession.mm", - "objc/Framework/Classes/Audio/RTCAudioSessionConfiguration.m", - "objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.h", - "objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.mm", - "objc/Framework/Headers/WebRTC/RTCAudioSession.h", - "objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h", + "objc/components/audio/RTCAudioSession+Configuration.mm", + "objc/components/audio/RTCAudioSession+Private.h", + "objc/components/audio/RTCAudioSession.h", + "objc/components/audio/RTCAudioSession.mm", + "objc/components/audio/RTCAudioSessionConfiguration.h", + "objc/components/audio/RTCAudioSessionConfiguration.m", + "objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h", + "objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm", ] configs += [ "..:common_objc", @@ -195,7 +288,8 @@ if (is_ios || is_mac) { deps = [ ":audio_session_observer", - ":common_objc", + ":base_objc", + ":helpers_objc", "../rtc_base:checks", "../rtc_base:rtc_base", "../rtc_base:rtc_base_approved", @@ -205,13 +299,13 @@ if (is_ios || is_mac) { rtc_static_library("videosource_objc") { sources = [ - "objc/Framework/Classes/PeerConnection/RTCVideoSource+Private.h", - "objc/Framework/Classes/PeerConnection/RTCVideoSource.mm", - "objc/Framework/Headers/WebRTC/RTCVideoSource.h", + "objc/api/peerconnection/RTCVideoSource+Private.h", + "objc/api/peerconnection/RTCVideoSource.h", + "objc/api/peerconnection/RTCVideoSource.mm", ] deps = [ - ":common_objc", + ":base_objc", ":mediasource_objc", ":native_video", ":videoframebuffer_objc", @@ -234,15 +328,16 @@ if (is_ios || is_mac) { rtc_static_library("videoframebuffer_objc") { visibility = [ "*" ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCVideoFrame.mm", - "objc/Framework/Classes/Video/RTCCVPixelBuffer.mm", - "objc/Framework/Classes/Video/RTCI420Buffer+Private.h", - "objc/Framework/Classes/Video/RTCI420Buffer.mm", - "objc/Framework/Headers/WebRTC/RTCVideoFrame.h", - "objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h", + "objc/api/video_frame_buffer/RTCI420Buffer+Private.h", + "objc/api/video_frame_buffer/RTCI420Buffer.h", + "objc/api/video_frame_buffer/RTCI420Buffer.mm", + "objc/api/video_frame_buffer/RTCMutableI420Buffer.h", + "objc/api/video_frame_buffer/RTCMutableI420Buffer.mm", + "objc/components/video_frame_buffer/RTCCVPixelBuffer.h", + "objc/components/video_frame_buffer/RTCCVPixelBuffer.mm", ] deps = [ - ":common_objc", + ":base_objc", "//api/video:video_frame", "//api/video:video_frame_i420", "//common_video", @@ -258,22 +353,20 @@ if (is_ios || is_mac) { rtc_static_library("video_objc") { sources = [ - "objc/Framework/Classes/Video/AVCaptureSession+DevicePosition.h", - "objc/Framework/Classes/Video/AVCaptureSession+DevicePosition.mm", - "objc/Framework/Classes/Video/RTCDefaultShader.h", - "objc/Framework/Classes/Video/RTCDefaultShader.mm", - "objc/Framework/Classes/Video/RTCI420TextureCache.h", - "objc/Framework/Classes/Video/RTCI420TextureCache.mm", - "objc/Framework/Classes/Video/RTCOpenGLDefines.h", - "objc/Framework/Classes/Video/RTCShader.h", - "objc/Framework/Classes/Video/RTCShader.mm", - "objc/Framework/Headers/WebRTC/RTCVideoViewShading.h", + "objc/components/renderer/opengl/RTCDefaultShader.h", + "objc/components/renderer/opengl/RTCDefaultShader.mm", + "objc/components/renderer/opengl/RTCI420TextureCache.h", + "objc/components/renderer/opengl/RTCI420TextureCache.mm", + "objc/components/renderer/opengl/RTCOpenGLDefines.h", + "objc/components/renderer/opengl/RTCShader.h", + "objc/components/renderer/opengl/RTCShader.mm", + "objc/components/renderer/opengl/RTCVideoViewShading.h", ] libs = [] if (is_ios) { sources += [ - "objc/Framework/Classes/Video/RTCNV12TextureCache.h", - "objc/Framework/Classes/Video/RTCNV12TextureCache.m", + "objc/components/renderer/opengl/RTCNV12TextureCache.h", + "objc/components/renderer/opengl/RTCNV12TextureCache.m", ] libs += [ "GLKit.framework", @@ -289,7 +382,8 @@ if (is_ios || is_mac) { } deps = [ - ":common_objc", + ":base_objc", + ":helpers_objc", ":mediaconstraints_objc", ":native_video", ":videoframebuffer_objc", @@ -317,21 +411,22 @@ if (is_ios || is_mac) { ] if (is_ios) { sources = [ - "objc/Framework/Classes/UI/RTCCameraPreviewView.m", - "objc/Framework/Classes/UI/RTCEAGLVideoView.m", - "objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h", - "objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h", + "objc/components/renderer/opengl/RTCDisplayLinkTimer.h", + "objc/components/renderer/opengl/RTCDisplayLinkTimer.m", + "objc/components/renderer/opengl/RTCEAGLVideoView.h", + "objc/components/renderer/opengl/RTCEAGLVideoView.m", ] } if (is_mac) { sources = [ - "objc/Framework/Classes/UI/RTCNSGLVideoView.m", - "objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h", + "objc/components/renderer/opengl/RTCNSGLVideoView.h", + "objc/components/renderer/opengl/RTCNSGLVideoView.m", ] } configs += [ "..:common_objc" ] deps = [ - ":common_objc", + ":base_objc", + ":helpers_objc", ":video_objc", ":videocapture_objc", ":videoframebuffer_objc", @@ -346,26 +441,26 @@ if (is_ios || is_mac) { "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] sources = [ - "objc/Framework/Classes/Metal/RTCMTLI420Renderer.h", - "objc/Framework/Classes/Metal/RTCMTLI420Renderer.mm", - "objc/Framework/Classes/Metal/RTCMTLRenderer+Private.h", - "objc/Framework/Classes/Metal/RTCMTLRenderer.h", - "objc/Framework/Classes/Metal/RTCMTLRenderer.mm", + "objc/components/renderer/metal/RTCMTLI420Renderer.h", + "objc/components/renderer/metal/RTCMTLI420Renderer.mm", + "objc/components/renderer/metal/RTCMTLRenderer+Private.h", + "objc/components/renderer/metal/RTCMTLRenderer.h", + "objc/components/renderer/metal/RTCMTLRenderer.mm", ] if (is_ios) { sources += [ - "objc/Framework/Classes/Metal/RTCMTLNV12Renderer.h", - "objc/Framework/Classes/Metal/RTCMTLNV12Renderer.mm", - "objc/Framework/Classes/Metal/RTCMTLRGBRenderer.h", - "objc/Framework/Classes/Metal/RTCMTLRGBRenderer.mm", - "objc/Framework/Classes/Metal/RTCMTLVideoView.m", - "objc/Framework/Headers/WebRTC/RTCMTLVideoView.h", + "objc/components/renderer/metal/RTCMTLNV12Renderer.h", + "objc/components/renderer/metal/RTCMTLNV12Renderer.mm", + "objc/components/renderer/metal/RTCMTLRGBRenderer.h", + "objc/components/renderer/metal/RTCMTLRGBRenderer.mm", + "objc/components/renderer/metal/RTCMTLVideoView.h", + "objc/components/renderer/metal/RTCMTLVideoView.m", ] } if (is_mac) { sources += [ - "objc/Framework/Classes/Metal/RTCMTLNSVideoView.m", - "objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h", + "objc/components/renderer/metal/RTCMTLNSVideoView.h", + "objc/components/renderer/metal/RTCMTLNSVideoView.m", ] } libs = [ @@ -374,11 +469,10 @@ if (is_ios || is_mac) { "MetalKit.framework", ] deps = [ - ":common_objc", + ":base_objc", ":peerconnectionfactory_base_objc", ":video_objc", ":videoframebuffer_objc", - ":videorenderer_objc", "../api/video:video_frame", "../rtc_base:checks", "../rtc_base:rtc_base_approved", @@ -388,20 +482,19 @@ if (is_ios || is_mac) { } } + # TODO(bugs.webrtc.org/9627): Remove this target. rtc_static_library("videocapturebase_objc") { visibility = [ "*" ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCVideoCapturer.m", - "objc/Framework/Headers/WebRTC/RTCVideoCapturer.h", + "objc/helpers/noop.mm", ] - libs = [ "AVFoundation.framework" ] configs += [ "..:common_objc" ] public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_objc", ":videoframebuffer_objc", ] } @@ -413,13 +506,13 @@ if (is_ios || is_mac) { "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m", - "objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h", + "objc/components/capturer/RTCCameraVideoCapturer.h", + "objc/components/capturer/RTCCameraVideoCapturer.m", ] if (is_ios) { sources += [ - "objc/Framework/Classes/PeerConnection/RTCFileVideoCapturer.m", - "objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h", + "objc/components/capturer/RTCFileVideoCapturer.h", + "objc/components/capturer/RTCFileVideoCapturer.m", ] } libs = [ "AVFoundation.framework" ] @@ -429,9 +522,9 @@ if (is_ios || is_mac) { public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_objc", + ":helpers_objc", ":video_objc", - ":videocapturebase_objc", ":videoframebuffer_objc", ] } @@ -439,21 +532,16 @@ if (is_ios || is_mac) { rtc_static_library("videocodec_objc") { visibility = [ "*" ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCEncodedImage.mm", - "objc/Framework/Classes/PeerConnection/RTCH264ProfileLevelId.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpFragmentationHeader.mm", - "objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h", - "objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm", - "objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm", - "objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm", - "objc/Framework/Headers/WebRTC/RTCVideoCodec.h", - "objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h", - "objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h", + "objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h", + "objc/components/video_codec/RTCCodecSpecificInfoH264.h", + "objc/components/video_codec/RTCCodecSpecificInfoH264.mm", + "objc/components/video_codec/RTCH264ProfileLevelId.h", + "objc/components/video_codec/RTCH264ProfileLevelId.mm", ] if (is_ios) { sources += [ - "objc/Framework/Classes/Video/UIDevice+H264Profile.h", - "objc/Framework/Classes/Video/UIDevice+H264Profile.mm", + "objc/components/video_codec/UIDevice+H264Profile.h", + "objc/components/video_codec/UIDevice+H264Profile.mm", ] } if (!build_with_chromium && is_clang) { @@ -463,13 +551,15 @@ if (is_ios || is_mac) { } public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_objc", + ":helpers_objc", "../api/video_codecs:video_codecs_api", "../common_video", "../media:rtc_h264_profile_id", "../media:rtc_media_base", "../modules:module_api", "../modules/video_coding:video_codec_interface", + "../rtc_base:checks", "../rtc_base:rtc_base_approved", "../system_wrappers:field_trial_api", ] @@ -477,16 +567,32 @@ if (is_ios || is_mac) { rtc_static_library("default_codec_factory_objc") { sources = [ - "objc/Framework/Classes/PeerConnection/RTCDefaultVideoDecoderFactory.m", - "objc/Framework/Classes/PeerConnection/RTCDefaultVideoEncoderFactory.m", + "objc/components/video_codec/RTCDefaultVideoDecoderFactory.h", + "objc/components/video_codec/RTCDefaultVideoDecoderFactory.m", + "objc/components/video_codec/RTCDefaultVideoEncoderFactory.h", + "objc/components/video_codec/RTCDefaultVideoEncoderFactory.m", ] deps = [ - ":common_objc", + ":base_objc", ":native_video", ":videocodec_objc", + ":videotoolbox_objc", ":vp8", ":vp9", + ":vpx_codec_constants", + ] + } + + rtc_static_library("vpx_codec_constants") { + sources = [ + "objc/api/video_codec/RTCVideoCodecConstants.h", + "objc/api/video_codec/RTCVideoCodecConstants.mm", + ] + + deps = [ + ":base_objc", + "../media:rtc_media_base", ] } @@ -494,12 +600,14 @@ if (is_ios || is_mac) { visibility = [ "*" ] allow_poison = [ "software_video_codecs" ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCVideoCodecVP8.mm", - "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h", - "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h", + "objc/api/video_codec/RTCVideoDecoderVP8.h", + "objc/api/video_codec/RTCVideoDecoderVP8.mm", + "objc/api/video_codec/RTCVideoEncoderVP8.h", + "objc/api/video_codec/RTCVideoEncoderVP8.mm", ] deps = [ + ":base_objc", ":wrapped_native_codec_objc", "../modules/video_coding:webrtc_vp8", "../system_wrappers:metrics_default", @@ -510,13 +618,16 @@ if (is_ios || is_mac) { visibility = [ "*" ] allow_poison = [ "software_video_codecs" ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCVideoCodecVP9.mm", - "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h", - "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h", + "objc/api/video_codec/RTCVideoDecoderVP9.h", + "objc/api/video_codec/RTCVideoDecoderVP9.mm", + "objc/api/video_codec/RTCVideoEncoderVP9.h", + "objc/api/video_codec/RTCVideoEncoderVP9.mm", ] deps = [ + ":base_objc", ":wrapped_native_codec_objc", + "../media:rtc_media_base", "../modules/video_coding:webrtc_vp9", "../system_wrappers:metrics_default", ] @@ -538,7 +649,7 @@ if (is_ios || is_mac) { defines = [ "HAVE_NO_MEDIA" ] sources = [ - "objc/Framework/Classes/Common/noop.mm", + "objc/helpers/noop.mm", ] public_configs = [ ":common_config_objc" ] @@ -554,26 +665,32 @@ if (is_ios || is_mac) { rtc_static_library("mediaconstraints_objc") { sources = [ - "objc/Framework/Classes/PeerConnection/RTCMediaConstraints+Private.h", - "objc/Framework/Classes/PeerConnection/RTCMediaConstraints.mm", - "objc/Framework/Headers/WebRTC/RTCMediaConstraints.h", + "objc/api/peerconnection/RTCMediaConstraints+Private.h", + "objc/api/peerconnection/RTCMediaConstraints.h", + "objc/api/peerconnection/RTCMediaConstraints.mm", ] public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_objc", + ":helpers_objc", "../api:libjingle_peerconnection_api", ] } + # TODO(bugs.webrtc.org/9627): Remove, targets should depend on base_objc. rtc_source_set("videorenderer_objc") { + visibility = [ "*" ] sources = [ - "objc/Framework/Headers/WebRTC/RTCVideoRenderer.h", + "objc/helpers/noop.mm", ] configs += [ "..:common_objc" ] - visibility = [ "*" ] public_configs = [ ":common_config_objc" ] + + deps = [ + ":base_objc", + ] } rtc_static_library("videorendereradapter_objc") { @@ -583,28 +700,27 @@ if (is_ios || is_mac) { "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter+Private.h", - "objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.h", - "objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.mm", + "objc/api/RTCVideoRendererAdapter+Private.h", + "objc/api/RTCVideoRendererAdapter.h", + "objc/api/RTCVideoRendererAdapter.mm", ] configs += [ "..:common_objc" ] public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_objc", ":native_api", ":videoframebuffer_objc", - ":videorenderer_objc", "../api:libjingle_peerconnection_api", ] } rtc_static_library("mediasource_objc") { sources = [ - "objc/Framework/Classes/PeerConnection/RTCMediaSource+Private.h", - "objc/Framework/Classes/PeerConnection/RTCMediaSource.mm", - "objc/Framework/Headers/WebRTC/RTCMediaSource.h", + "objc/api/peerconnection/RTCMediaSource+Private.h", + "objc/api/peerconnection/RTCMediaSource.h", + "objc/api/peerconnection/RTCMediaSource.mm", ] configs += [ @@ -614,12 +730,45 @@ if (is_ios || is_mac) { public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_objc", "../api:libjingle_peerconnection_api", "../rtc_base:checks", ] } + rtc_static_library("base_native_additions_objc") { + sources = [ + "objc/api/peerconnection/RTCEncodedImage+Private.h", + "objc/api/peerconnection/RTCEncodedImage+Private.mm", + "objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h", + "objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm", + "objc/api/peerconnection/RTCVideoCodecInfo+Private.h", + "objc/api/peerconnection/RTCVideoCodecInfo+Private.mm", + "objc/api/peerconnection/RTCVideoEncoderSettings+Private.h", + "objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm", + ] + + configs += [ "..:common_objc" ] + + public_configs = [ ":common_config_objc" ] + + deps = [ + ":base_objc", + ":helpers_objc", + "../api/video_codecs:video_codecs_api", + "../common_video", + "../modules:module_api", + "../modules/video_coding:video_codec_interface", + "../rtc_base:rtc_base", + ] + + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin + # (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + } + rtc_static_library("peerconnectionfactory_base_objc") { visibility = [ "*" ] allow_poison = [ @@ -627,101 +776,103 @@ if (is_ios || is_mac) { "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] sources = [ - "objc/Framework/Classes/PeerConnection/RTCAudioSource+Private.h", - "objc/Framework/Classes/PeerConnection/RTCAudioSource.mm", - "objc/Framework/Classes/PeerConnection/RTCAudioTrack+Private.h", - "objc/Framework/Classes/PeerConnection/RTCAudioTrack.mm", - "objc/Framework/Classes/PeerConnection/RTCCertificate.mm", - "objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h", - "objc/Framework/Classes/PeerConnection/RTCConfiguration+Private.h", - "objc/Framework/Classes/PeerConnection/RTCConfiguration.mm", - "objc/Framework/Classes/PeerConnection/RTCDataChannel+Private.h", - "objc/Framework/Classes/PeerConnection/RTCDataChannel.mm", - "objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration+Private.h", - "objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration.mm", - "objc/Framework/Classes/PeerConnection/RTCDtmfSender+Private.h", - "objc/Framework/Classes/PeerConnection/RTCDtmfSender.mm", - "objc/Framework/Classes/PeerConnection/RTCIceCandidate+Private.h", - "objc/Framework/Classes/PeerConnection/RTCIceCandidate.mm", - "objc/Framework/Classes/PeerConnection/RTCIceServer+Private.h", - "objc/Framework/Classes/PeerConnection/RTCIceServer.mm", - "objc/Framework/Classes/PeerConnection/RTCIntervalRange+Private.h", - "objc/Framework/Classes/PeerConnection/RTCIntervalRange.mm", - "objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport+Private.h", - "objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport.mm", - "objc/Framework/Classes/PeerConnection/RTCMediaStream+Private.h", - "objc/Framework/Classes/PeerConnection/RTCMediaStream.mm", - "objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack+Private.h", - "objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack.mm", - "objc/Framework/Classes/PeerConnection/RTCMetrics.mm", - "objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo+Private.h", - "objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnection+DataChannel.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Private.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Stats.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Private.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.mm", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions+Private.h", - "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions.mm", - "objc/Framework/Classes/PeerConnection/RTCRtcpParameters+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtcpParameters.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpParameters+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpParameters.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpReceiver+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpReceiver.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpSender+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpSender.mm", - "objc/Framework/Classes/PeerConnection/RTCRtpTransceiver+Private.h", - "objc/Framework/Classes/PeerConnection/RTCRtpTransceiver.mm", - "objc/Framework/Classes/PeerConnection/RTCSSLAdapter.mm", - "objc/Framework/Classes/PeerConnection/RTCSessionDescription+Private.h", - "objc/Framework/Classes/PeerConnection/RTCSessionDescription.mm", - "objc/Framework/Classes/PeerConnection/RTCTracing.mm", - "objc/Framework/Classes/PeerConnection/RTCVideoTrack+Private.h", - "objc/Framework/Classes/PeerConnection/RTCVideoTrack.mm", - "objc/Framework/Headers/WebRTC/RTCAudioSource.h", - "objc/Framework/Headers/WebRTC/RTCAudioTrack.h", - "objc/Framework/Headers/WebRTC/RTCCertificate.h", - "objc/Framework/Headers/WebRTC/RTCConfiguration.h", - "objc/Framework/Headers/WebRTC/RTCDataChannel.h", - "objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h", - "objc/Framework/Headers/WebRTC/RTCDtmfSender.h", - "objc/Framework/Headers/WebRTC/RTCIceCandidate.h", - "objc/Framework/Headers/WebRTC/RTCIceServer.h", - "objc/Framework/Headers/WebRTC/RTCIntervalRange.h", - "objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h", - "objc/Framework/Headers/WebRTC/RTCMediaStream.h", - "objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h", - "objc/Framework/Headers/WebRTC/RTCMetrics.h", - "objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h", - "objc/Framework/Headers/WebRTC/RTCPeerConnection.h", - "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h", - "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h", - "objc/Framework/Headers/WebRTC/RTCRtcpParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h", - "objc/Framework/Headers/WebRTC/RTCRtpParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpReceiver.h", - "objc/Framework/Headers/WebRTC/RTCRtpSender.h", - "objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h", - "objc/Framework/Headers/WebRTC/RTCSSLAdapter.h", - "objc/Framework/Headers/WebRTC/RTCSessionDescription.h", - "objc/Framework/Headers/WebRTC/RTCTracing.h", - "objc/Framework/Headers/WebRTC/RTCVideoTrack.h", + "objc/api/peerconnection/RTCAudioSource+Private.h", + "objc/api/peerconnection/RTCAudioSource.h", + "objc/api/peerconnection/RTCAudioSource.mm", + "objc/api/peerconnection/RTCAudioTrack+Private.h", + "objc/api/peerconnection/RTCAudioTrack.h", + "objc/api/peerconnection/RTCAudioTrack.mm", + "objc/api/peerconnection/RTCCertificate.h", + "objc/api/peerconnection/RTCCertificate.mm", + "objc/api/peerconnection/RTCConfiguration+Native.h", + "objc/api/peerconnection/RTCConfiguration+Private.h", + "objc/api/peerconnection/RTCConfiguration.h", + "objc/api/peerconnection/RTCConfiguration.mm", + "objc/api/peerconnection/RTCDataChannel+Private.h", + "objc/api/peerconnection/RTCDataChannel.h", + "objc/api/peerconnection/RTCDataChannel.mm", + "objc/api/peerconnection/RTCDataChannelConfiguration+Private.h", + "objc/api/peerconnection/RTCDataChannelConfiguration.h", + "objc/api/peerconnection/RTCDataChannelConfiguration.mm", + "objc/api/peerconnection/RTCDtmfSender+Private.h", + "objc/api/peerconnection/RTCDtmfSender.h", + "objc/api/peerconnection/RTCDtmfSender.mm", + "objc/api/peerconnection/RTCFieldTrials.h", + "objc/api/peerconnection/RTCFieldTrials.mm", + "objc/api/peerconnection/RTCIceCandidate+Private.h", + "objc/api/peerconnection/RTCIceCandidate.h", + "objc/api/peerconnection/RTCIceCandidate.mm", + "objc/api/peerconnection/RTCIceServer+Private.h", + "objc/api/peerconnection/RTCIceServer.h", + "objc/api/peerconnection/RTCIceServer.mm", + "objc/api/peerconnection/RTCIntervalRange+Private.h", + "objc/api/peerconnection/RTCIntervalRange.h", + "objc/api/peerconnection/RTCIntervalRange.mm", + "objc/api/peerconnection/RTCLegacyStatsReport+Private.h", + "objc/api/peerconnection/RTCLegacyStatsReport.h", + "objc/api/peerconnection/RTCLegacyStatsReport.mm", + "objc/api/peerconnection/RTCMediaStream+Private.h", + "objc/api/peerconnection/RTCMediaStream.h", + "objc/api/peerconnection/RTCMediaStream.mm", + "objc/api/peerconnection/RTCMediaStreamTrack+Private.h", + "objc/api/peerconnection/RTCMediaStreamTrack.h", + "objc/api/peerconnection/RTCMediaStreamTrack.mm", + "objc/api/peerconnection/RTCMetrics.h", + "objc/api/peerconnection/RTCMetrics.mm", + "objc/api/peerconnection/RTCMetricsSampleInfo+Private.h", + "objc/api/peerconnection/RTCMetricsSampleInfo.h", + "objc/api/peerconnection/RTCMetricsSampleInfo.mm", + "objc/api/peerconnection/RTCPeerConnection+DataChannel.mm", + "objc/api/peerconnection/RTCPeerConnection+Native.h", + "objc/api/peerconnection/RTCPeerConnection+Private.h", + "objc/api/peerconnection/RTCPeerConnection+Stats.mm", + "objc/api/peerconnection/RTCPeerConnection.h", + "objc/api/peerconnection/RTCPeerConnection.mm", + "objc/api/peerconnection/RTCPeerConnectionFactory+Native.h", + "objc/api/peerconnection/RTCPeerConnectionFactory+Private.h", + "objc/api/peerconnection/RTCPeerConnectionFactory.h", + "objc/api/peerconnection/RTCPeerConnectionFactory.mm", + "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h", + "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm", + "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h", + "objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.mm", + "objc/api/peerconnection/RTCPeerConnectionFactoryOptions+Private.h", + "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h", + "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.mm", + "objc/api/peerconnection/RTCRtcpParameters+Private.h", + "objc/api/peerconnection/RTCRtcpParameters.h", + "objc/api/peerconnection/RTCRtcpParameters.mm", + "objc/api/peerconnection/RTCRtpCodecParameters+Private.h", + "objc/api/peerconnection/RTCRtpCodecParameters.h", + "objc/api/peerconnection/RTCRtpCodecParameters.mm", + "objc/api/peerconnection/RTCRtpEncodingParameters+Private.h", + "objc/api/peerconnection/RTCRtpEncodingParameters.h", + "objc/api/peerconnection/RTCRtpEncodingParameters.mm", + "objc/api/peerconnection/RTCRtpHeaderExtension+Private.h", + "objc/api/peerconnection/RTCRtpHeaderExtension.h", + "objc/api/peerconnection/RTCRtpHeaderExtension.mm", + "objc/api/peerconnection/RTCRtpParameters+Private.h", + "objc/api/peerconnection/RTCRtpParameters.h", + "objc/api/peerconnection/RTCRtpParameters.mm", + "objc/api/peerconnection/RTCRtpReceiver+Private.h", + "objc/api/peerconnection/RTCRtpReceiver.h", + "objc/api/peerconnection/RTCRtpReceiver.mm", + "objc/api/peerconnection/RTCRtpSender+Private.h", + "objc/api/peerconnection/RTCRtpSender.h", + "objc/api/peerconnection/RTCRtpSender.mm", + "objc/api/peerconnection/RTCRtpTransceiver+Private.h", + "objc/api/peerconnection/RTCRtpTransceiver.h", + "objc/api/peerconnection/RTCRtpTransceiver.mm", + "objc/api/peerconnection/RTCSSLAdapter.h", + "objc/api/peerconnection/RTCSSLAdapter.mm", + "objc/api/peerconnection/RTCSessionDescription+Private.h", + "objc/api/peerconnection/RTCSessionDescription.h", + "objc/api/peerconnection/RTCSessionDescription.mm", + "objc/api/peerconnection/RTCTracing.h", + "objc/api/peerconnection/RTCTracing.mm", + "objc/api/peerconnection/RTCVideoTrack+Private.h", + "objc/api/peerconnection/RTCVideoTrack.h", + "objc/api/peerconnection/RTCVideoTrack.mm", ] configs += [ @@ -731,17 +882,20 @@ if (is_ios || is_mac) { public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", + ":base_native_additions_objc", + ":base_objc", + ":file_logger_objc", + ":helpers_objc", + ":legacy_header_paths", ":mediaconstraints_objc", ":mediasource_objc", ":native_api", ":native_video", ":video_objc", - ":videocodec_objc", ":videoframebuffer_objc", - ":videorenderer_objc", ":videorendereradapter_objc", ":videosource_objc", + ":videotoolbox_objc", "../api:libjingle_peerconnection_api", "../api/audio_codecs:audio_codecs_api", "../api/audio_codecs:builtin_audio_decoder_factory", @@ -766,44 +920,131 @@ if (is_ios || is_mac) { } } + # TODO(bugs.webrtc.org/9627): Remove this target. + rtc_source_set("legacy_header_paths") { + sources = [ + "objc/Framework/Classes/Common/NSString+StdString.h", + "objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h", + "objc/Framework/Classes/Common/scoped_cftyperef.h", + "objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h", + "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h", + "objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h", + "objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h", + "objc/Framework/Classes/Video/RTCDefaultShader.h", + "objc/Framework/Classes/Video/RTCNV12TextureCache.h", + "objc/Framework/Classes/VideoToolbox/nalu_rewriter.h", + "objc/Framework/Headers/WebRTC/RTCAudioSession.h", + "objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h", + "objc/Framework/Headers/WebRTC/RTCAudioSource.h", + "objc/Framework/Headers/WebRTC/RTCAudioTrack.h", + "objc/Framework/Headers/WebRTC/RTCCVPixelBuffer.h", + "objc/Framework/Headers/WebRTC/RTCCallbackLogger.h", + "objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h", + "objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h", + "objc/Framework/Headers/WebRTC/RTCCertificate.h", + "objc/Framework/Headers/WebRTC/RTCConfiguration.h", + "objc/Framework/Headers/WebRTC/RTCDataChannel.h", + "objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h", + "objc/Framework/Headers/WebRTC/RTCDefaultVideoDecoderFactory.h", + "objc/Framework/Headers/WebRTC/RTCDefaultVideoEncoderFactory.h", + "objc/Framework/Headers/WebRTC/RTCDispatcher.h", + "objc/Framework/Headers/WebRTC/RTCDtmfSender.h", + "objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h", + "objc/Framework/Headers/WebRTC/RTCFieldTrials.h", + "objc/Framework/Headers/WebRTC/RTCFileLogger.h", + "objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h", + "objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h", + "objc/Framework/Headers/WebRTC/RTCIceCandidate.h", + "objc/Framework/Headers/WebRTC/RTCIceServer.h", + "objc/Framework/Headers/WebRTC/RTCIntervalRange.h", + "objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h", + "objc/Framework/Headers/WebRTC/RTCLogging.h", + "objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h", + "objc/Framework/Headers/WebRTC/RTCMTLVideoView.h", + "objc/Framework/Headers/WebRTC/RTCMacros.h", + "objc/Framework/Headers/WebRTC/RTCMediaConstraints.h", + "objc/Framework/Headers/WebRTC/RTCMediaSource.h", + "objc/Framework/Headers/WebRTC/RTCMediaStream.h", + "objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h", + "objc/Framework/Headers/WebRTC/RTCMetrics.h", + "objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h", + "objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h", + "objc/Framework/Headers/WebRTC/RTCPeerConnection.h", + "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h", + "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h", + "objc/Framework/Headers/WebRTC/RTCRtcpParameters.h", + "objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h", + "objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h", + "objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h", + "objc/Framework/Headers/WebRTC/RTCRtpParameters.h", + "objc/Framework/Headers/WebRTC/RTCRtpReceiver.h", + "objc/Framework/Headers/WebRTC/RTCRtpSender.h", + "objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h", + "objc/Framework/Headers/WebRTC/RTCSSLAdapter.h", + "objc/Framework/Headers/WebRTC/RTCSessionDescription.h", + "objc/Framework/Headers/WebRTC/RTCTracing.h", + "objc/Framework/Headers/WebRTC/RTCVideoCapturer.h", + "objc/Framework/Headers/WebRTC/RTCVideoCodec.h", + "objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h", + "objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h", + "objc/Framework/Headers/WebRTC/RTCVideoCodecInfo.h", + "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h", + "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h", + "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h", + "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h", + "objc/Framework/Headers/WebRTC/RTCVideoFrame.h", + "objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h", + "objc/Framework/Headers/WebRTC/RTCVideoRenderer.h", + "objc/Framework/Headers/WebRTC/RTCVideoSource.h", + "objc/Framework/Headers/WebRTC/RTCVideoTrack.h", + "objc/Framework/Headers/WebRTC/RTCVideoViewShading.h", + "objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h", + "objc/Framework/Native/api/audio_device_module.h", + "objc/Framework/Native/api/video_decoder_factory.h", + "objc/Framework/Native/api/video_encoder_factory.h", + "objc/Framework/Native/api/video_frame_buffer.h", + "objc/Framework/Native/src/objc_video_decoder_factory.h", + "objc/Framework/Native/src/objc_video_encoder_factory.h", + ] + } + if (rtc_include_tests) { if (is_ios) { rtc_source_set("sdk_unittests_sources") { testonly = true - include_dirs = [ - "objc/Framework/Headers", - "objc/Framework/Classes", - ] + include_dirs = [ "objc/" ] sources = [ - "objc/Framework/UnitTests/ObjCVideoTrackSource_xctest.mm", - "objc/Framework/UnitTests/RTCCVPixelBuffer_xctest.mm", - "objc/Framework/UnitTests/RTCCallbackLogger_xctest.m", - "objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m", - "objc/Framework/UnitTests/RTCFileVideoCapturer_xctest.mm", - "objc/Framework/UnitTests/RTCH264ProfileLevelId_xctest.m", - "objc/Framework/UnitTests/RTCPeerConnectionFactory_xctest.m", - "objc/Framework/UnitTests/frame_buffer_helpers.h", - "objc/Framework/UnitTests/frame_buffer_helpers.mm", + "objc/unittests/ObjCVideoTrackSource_xctest.mm", + "objc/unittests/RTCCVPixelBuffer_xctest.mm", + "objc/unittests/RTCCallbackLogger_xctest.m", + "objc/unittests/RTCFileVideoCapturer_xctest.mm", + "objc/unittests/RTCH264ProfileLevelId_xctest.m", + "objc/unittests/RTCPeerConnectionFactory_xctest.m", + "objc/unittests/frame_buffer_helpers.h", + "objc/unittests/frame_buffer_helpers.mm", ] # TODO(peterhanspers): Reenable these tests on simulator. # See bugs.webrtc.org/7812 if (!use_ios_simulator) { sources += [ - "objc/Framework/UnitTests/RTCAudioDeviceModule_xctest.mm", - "objc/Framework/UnitTests/RTCAudioDevice_xctest.mm", + "objc/unittests/RTCAudioDeviceModule_xctest.mm", + "objc/unittests/RTCAudioDevice_xctest.mm", ] } deps = [ ":audio_device", ":audio_objc", - ":common_objc", + ":base_objc", + ":callback_logger_objc", ":framework_objc", + ":mediaconstraints_objc", ":native_api", ":native_api_audio_device_module", ":native_video", + ":peerconnectionfactory_base_objc", ":videocapture_objc", ":videocodec_objc", ":videoframebuffer_objc", @@ -822,7 +1063,7 @@ if (is_ios || is_mac) { ] if (rtc_use_metal_rendering) { - sources += [ "objc/Framework/UnitTests/RTCMTLVideoView_xctest.m" ] + sources += [ "objc/unittests/RTCMTLVideoView_xctest.m" ] deps += [ ":metal_objc" ] } @@ -830,28 +1071,27 @@ if (is_ios || is_mac) { "//build/config/ios:xctest", "//third_party/ocmock", ] - - include_dirs += [ "$root_out_dir/WebRTC.framework/Headers/" ] } bundle_data("sdk_unittests_bundle_data") { sources = [ - "objc/Framework/UnitTests/audio_short16.pcm", - "objc/Framework/UnitTests/audio_short44.pcm", - "objc/Framework/UnitTests/audio_short48.pcm", + "objc/unittests/audio_short16.pcm", + "objc/unittests/audio_short44.pcm", + "objc/unittests/audio_short48.pcm", # Sample video taken from https://media.xiph.org/video/derf/ - "objc/Framework/UnitTests/foreman.mp4", + "objc/unittests/foreman.mp4", ] outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}", ] } + # These tests use static linking. rtc_ios_xctest_test("sdk_unittests") { info_plist = "//test/ios/Info.plist" sources = [ - "objc/Framework/UnitTests/main.m", + "objc/unittests/main.m", ] _bundle_id_suffix = ios_generic_test_bundle_id_suffix @@ -863,6 +1103,22 @@ if (is_ios || is_mac) { ] ldflags = [ "-all_load" ] } + + # These tests link to the framework. + rtc_ios_xctest_test("sdk_framework_unittests") { + info_plist = "//test/ios/Info.plist" + sources = [ + "objc/unittests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m", + "objc/unittests/main.m", + ] + + _bundle_id_suffix = ios_generic_test_bundle_id_suffix + extra_substitutions = [ "GTEST_BUNDLE_ID_SUFFIX=$_bundle_id_suffix" ] + deps = [ + ":framework_objc+link", + ":ios_framework_bundle", + ] + } } # TODO(denicija): once all tests are migrated to xctest remove this source set. @@ -870,24 +1126,23 @@ if (is_ios || is_mac) { testonly = true sources = [ - "objc/Framework/UnitTests/RTCCertificateTest.mm", - "objc/Framework/UnitTests/RTCConfigurationTest.mm", - "objc/Framework/UnitTests/RTCDataChannelConfigurationTest.mm", - "objc/Framework/UnitTests/RTCIceCandidateTest.mm", - "objc/Framework/UnitTests/RTCIceServerTest.mm", - "objc/Framework/UnitTests/RTCIntervalRangeTests.mm", - "objc/Framework/UnitTests/RTCMediaConstraintsTest.mm", - "objc/Framework/UnitTests/RTCPeerConnectionFactoryBuilderTest.mm", - "objc/Framework/UnitTests/RTCPeerConnectionTest.mm", - "objc/Framework/UnitTests/RTCSessionDescriptionTest.mm", - "objc/Framework/UnitTests/RTCTracingTest.mm", - "objc/Framework/UnitTests/objc_video_decoder_factory_tests.mm", - "objc/Framework/UnitTests/objc_video_encoder_factory_tests.mm", - "objc/Framework/UnitTests/scoped_cftyperef_tests.mm", + "objc/unittests/RTCCertificateTest.mm", + "objc/unittests/RTCConfigurationTest.mm", + "objc/unittests/RTCDataChannelConfigurationTest.mm", + "objc/unittests/RTCIceCandidateTest.mm", + "objc/unittests/RTCIceServerTest.mm", + "objc/unittests/RTCIntervalRangeTests.mm", + "objc/unittests/RTCMediaConstraintsTest.mm", + "objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm", + "objc/unittests/RTCPeerConnectionTest.mm", + "objc/unittests/RTCSessionDescriptionTest.mm", + "objc/unittests/RTCTracingTest.mm", + "objc/unittests/objc_video_decoder_factory_tests.mm", + "objc/unittests/objc_video_encoder_factory_tests.mm", + "objc/unittests/scoped_cftyperef_tests.mm", ] if (is_ios) { - sources += - [ "objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm" ] + sources += [ "objc/unittests/RTCCameraVideoCapturerTests.mm" ] } # |-ObjC| flag needed to make sure category method implementations @@ -896,7 +1151,8 @@ if (is_ios || is_mac) { ldflags = [ "-ObjC" ] deps = [ - ":common_objc", + ":base_objc", + ":helpers_objc", ":mediaconstraints_objc", ":native_api", ":native_video", @@ -924,7 +1180,7 @@ if (is_ios || is_mac) { ] if (is_ios) { - sources += [ "objc/Framework/UnitTests/RTCAudioSessionTest.mm" ] + sources += [ "objc/unittests/RTCAudioSessionTest.mm" ] deps += [ ":audio_objc" ] } } @@ -932,73 +1188,89 @@ if (is_ios || is_mac) { if (is_ios) { ios_framework_bundle_with_umbrella_header("framework_objc") { - info_plist = "objc/Framework/Info.plist" + info_plist = "objc/Info.plist" output_name = "WebRTC" common_objc_headers = [ - "objc/Framework/Headers/WebRTC/RTCAudioSession.h", - "objc/Framework/Headers/WebRTC/RTCVideoCodec.h", - "objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h", - "objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h", - "objc/Framework/Headers/WebRTC/RTCAudioSource.h", - "objc/Framework/Headers/WebRTC/RTCAudioTrack.h", - "objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h", - "objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h", - "objc/Framework/Headers/WebRTC/RTCCertificate.h", - "objc/Framework/Headers/WebRTC/RTCConfiguration.h", - "objc/Framework/Headers/WebRTC/RTCDataChannel.h", - "objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h", - "objc/Framework/Headers/WebRTC/RTCDispatcher.h", - "objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h", - "objc/Framework/Headers/WebRTC/RTCFieldTrials.h", - "objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h", - "objc/Framework/Headers/WebRTC/RTCIceCandidate.h", - "objc/Framework/Headers/WebRTC/RTCIceServer.h", - "objc/Framework/Headers/WebRTC/RTCIntervalRange.h", - "objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h", - "objc/Framework/Headers/WebRTC/RTCLogging.h", - "objc/Framework/Headers/WebRTC/RTCMacros.h", - "objc/Framework/Headers/WebRTC/RTCMediaConstraints.h", - "objc/Framework/Headers/WebRTC/RTCMediaSource.h", - "objc/Framework/Headers/WebRTC/RTCMediaStream.h", - "objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h", - "objc/Framework/Headers/WebRTC/RTCMetrics.h", - "objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h", - "objc/Framework/Headers/WebRTC/RTCMTLVideoView.h", - "objc/Framework/Headers/WebRTC/RTCPeerConnection.h", - "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h", - "objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h", - "objc/Framework/Headers/WebRTC/RTCRtcpParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h", - "objc/Framework/Headers/WebRTC/RTCRtpParameters.h", - "objc/Framework/Headers/WebRTC/RTCRtpReceiver.h", - "objc/Framework/Headers/WebRTC/RTCRtpSender.h", - "objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h", - "objc/Framework/Headers/WebRTC/RTCDtmfSender.h", - "objc/Framework/Headers/WebRTC/RTCSSLAdapter.h", - "objc/Framework/Headers/WebRTC/RTCSessionDescription.h", - "objc/Framework/Headers/WebRTC/RTCTracing.h", - "objc/Framework/Headers/WebRTC/RTCVideoCapturer.h", - "objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h", - "objc/Framework/Headers/WebRTC/RTCVideoFrame.h", - "objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h", - "objc/Framework/Headers/WebRTC/RTCVideoRenderer.h", - "objc/Framework/Headers/WebRTC/RTCVideoSource.h", - "objc/Framework/Headers/WebRTC/RTCVideoTrack.h", - "objc/Framework/Headers/WebRTC/RTCVideoViewShading.h", - "objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h", - "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h", - "objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h", - "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h", - "objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h", + "objc/base/RTCCodecSpecificInfo.h", + "objc/base/RTCEncodedImage.h", + "objc/base/RTCLogging.h", + "objc/base/RTCMacros.h", + "objc/base/RTCRtpFragmentationHeader.h", + "objc/base/RTCVideoCapturer.h", + "objc/base/RTCVideoCodecInfo.h", + "objc/base/RTCVideoDecoder.h", + "objc/base/RTCVideoDecoderFactory.h", + "objc/base/RTCVideoEncoder.h", + "objc/base/RTCVideoEncoderFactory.h", + "objc/base/RTCVideoEncoderQpThresholds.h", + "objc/base/RTCVideoEncoderSettings.h", + "objc/base/RTCVideoFrame.h", + "objc/base/RTCVideoFrameBuffer.h", + "objc/base/RTCVideoRenderer.h", + "objc/components/audio/RTCAudioSession.h", + "objc/components/audio/RTCAudioSessionConfiguration.h", + "objc/components/capturer/RTCCameraVideoCapturer.h", + "objc/components/capturer/RTCFileVideoCapturer.h", + "objc/components/renderer/metal/RTCMTLVideoView.h", + "objc/components/renderer/opengl/RTCEAGLVideoView.h", + "objc/components/renderer/opengl/RTCVideoViewShading.h", + "objc/components/video_codec/RTCCodecSpecificInfoH264.h", + "objc/components/video_codec/RTCDefaultVideoDecoderFactory.h", + "objc/components/video_codec/RTCDefaultVideoEncoderFactory.h", + "objc/components/video_codec/RTCH264ProfileLevelId.h", + "objc/components/video_codec/RTCVideoDecoderFactoryH264.h", + "objc/components/video_codec/RTCVideoDecoderH264.h", + "objc/components/video_codec/RTCVideoEncoderFactoryH264.h", + "objc/components/video_codec/RTCVideoEncoderH264.h", + "objc/components/video_frame_buffer/RTCCVPixelBuffer.h", + "objc/helpers/RTCCameraPreviewView.h", + "objc/helpers/RTCDispatcher.h", + "objc/helpers/UIDevice+RTCDevice.h", + "objc/api/peerconnection/RTCAudioSource.h", + "objc/api/peerconnection/RTCAudioTrack.h", + "objc/api/peerconnection/RTCConfiguration.h", + "objc/api/peerconnection/RTCDataChannel.h", + "objc/api/peerconnection/RTCDataChannelConfiguration.h", + "objc/api/peerconnection/RTCFieldTrials.h", + "objc/api/peerconnection/RTCIceCandidate.h", + "objc/api/peerconnection/RTCIceServer.h", + "objc/api/peerconnection/RTCIntervalRange.h", + "objc/api/peerconnection/RTCLegacyStatsReport.h", + "objc/api/peerconnection/RTCMediaConstraints.h", + "objc/api/peerconnection/RTCMediaSource.h", + "objc/api/peerconnection/RTCMediaStream.h", + "objc/api/peerconnection/RTCMediaStreamTrack.h", + "objc/api/peerconnection/RTCMetrics.h", + "objc/api/peerconnection/RTCMetricsSampleInfo.h", + "objc/api/peerconnection/RTCPeerConnection.h", + "objc/api/peerconnection/RTCPeerConnectionFactory.h", + "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h", + "objc/api/peerconnection/RTCRtcpParameters.h", + "objc/api/peerconnection/RTCRtpCodecParameters.h", + "objc/api/peerconnection/RTCRtpEncodingParameters.h", + "objc/api/peerconnection/RTCRtpHeaderExtension.h", + "objc/api/peerconnection/RTCRtpParameters.h", + "objc/api/peerconnection/RTCRtpReceiver.h", + "objc/api/peerconnection/RTCRtpSender.h", + "objc/api/peerconnection/RTCRtpTransceiver.h", + "objc/api/peerconnection/RTCDtmfSender.h", + "objc/api/peerconnection/RTCSSLAdapter.h", + "objc/api/peerconnection/RTCSessionDescription.h", + "objc/api/peerconnection/RTCTracing.h", + "objc/api/peerconnection/RTCCertificate.h", + "objc/api/peerconnection/RTCVideoSource.h", + "objc/api/peerconnection/RTCVideoTrack.h", + "objc/api/video_codec/RTCVideoDecoderVP8.h", + "objc/api/video_codec/RTCVideoDecoderVP9.h", + "objc/api/video_codec/RTCVideoEncoderVP8.h", + "objc/api/video_codec/RTCVideoEncoderVP9.h", ] if (!build_with_chromium) { common_objc_headers += [ - "objc/Framework/Headers/WebRTC/RTCCallbackLogger.h", - "objc/Framework/Headers/WebRTC/RTCFileLogger.h", + "objc/api/logging/RTCCallbackLogger.h", + "objc/api/peerconnection/RTCFileLogger.h", ] } @@ -1013,7 +1285,7 @@ if (is_ios || is_mac) { deps = [ ":audio_objc", - ":common_objc", + ":base_objc", ":default_codec_factory_objc", ":native_api", ":native_video", @@ -1030,6 +1302,12 @@ if (is_ios || is_mac) { if (rtc_use_metal_rendering) { deps += [ ":metal_objc" ] } + if (!build_with_chromium) { + deps += [ + ":callback_logger_objc", + ":file_logger_objc", + ] + } libs = [ "AVFoundation.framework", @@ -1045,22 +1323,186 @@ if (is_ios || is_mac) { public_configs = [ ":common_config_objc" ] } + + bundle_data("ios_framework_bundle") { + deps = [ + "../sdk:framework_objc", + ] + sources = [ + "$root_build_dir/WebRTC.framework", + ] + outputs = [ + "{{bundle_resources_dir}}/Frameworks/{{source_file_part}}", + ] + } + } + + if (is_mac) { + mac_framework_header_files = [ + "objc/base/RTCCodecSpecificInfo.h", + "objc/base/RTCEncodedImage.h", + "objc/base/RTCLogging.h", + "objc/base/RTCMacros.h", + "objc/base/RTCRtpFragmentationHeader.h", + "objc/base/RTCVideoCapturer.h", + "objc/base/RTCVideoCodecInfo.h", + "objc/base/RTCVideoDecoder.h", + "objc/base/RTCVideoDecoderFactory.h", + "objc/base/RTCVideoEncoder.h", + "objc/base/RTCVideoEncoderFactory.h", + "objc/base/RTCVideoEncoderQpThresholds.h", + "objc/base/RTCVideoEncoderSettings.h", + "objc/base/RTCVideoFrame.h", + "objc/base/RTCVideoFrameBuffer.h", + "objc/base/RTCVideoRenderer.h", + "objc/components/capturer/RTCCameraVideoCapturer.h", + "objc/components/capturer/RTCFileVideoCapturer.h", + "objc/components/renderer/metal/RTCMTLNSVideoView.h", + "objc/components/renderer/opengl/RTCNSGLVideoView.h", + "objc/components/renderer/opengl/RTCVideoViewShading.h", + "objc/components/video_codec/RTCCodecSpecificInfoH264.h", + "objc/components/video_codec/RTCDefaultVideoDecoderFactory.h", + "objc/components/video_codec/RTCDefaultVideoEncoderFactory.h", + "objc/components/video_codec/RTCH264ProfileLevelId.h", + "objc/components/video_codec/RTCVideoDecoderFactoryH264.h", + "objc/components/video_codec/RTCVideoDecoderH264.h", + "objc/components/video_codec/RTCVideoEncoderFactoryH264.h", + "objc/components/video_codec/RTCVideoEncoderH264.h", + "objc/components/video_frame_buffer/RTCCVPixelBuffer.h", + "objc/helpers/RTCDispatcher.h", + "objc/api/peerconnection/RTCAudioSource.h", + "objc/api/peerconnection/RTCAudioTrack.h", + "objc/api/peerconnection/RTCConfiguration.h", + "objc/api/peerconnection/RTCDataChannel.h", + "objc/api/peerconnection/RTCDataChannelConfiguration.h", + "objc/api/peerconnection/RTCFieldTrials.h", + "objc/api/peerconnection/RTCIceCandidate.h", + "objc/api/peerconnection/RTCIceServer.h", + "objc/api/peerconnection/RTCIntervalRange.h", + "objc/api/peerconnection/RTCLegacyStatsReport.h", + "objc/api/peerconnection/RTCMediaConstraints.h", + "objc/api/peerconnection/RTCMediaSource.h", + "objc/api/peerconnection/RTCMediaStream.h", + "objc/api/peerconnection/RTCMediaStreamTrack.h", + "objc/api/peerconnection/RTCMetrics.h", + "objc/api/peerconnection/RTCMetricsSampleInfo.h", + "objc/api/peerconnection/RTCPeerConnection.h", + "objc/api/peerconnection/RTCPeerConnectionFactory.h", + "objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h", + "objc/api/peerconnection/RTCRtcpParameters.h", + "objc/api/peerconnection/RTCRtpCodecParameters.h", + "objc/api/peerconnection/RTCRtpEncodingParameters.h", + "objc/api/peerconnection/RTCRtpHeaderExtension.h", + "objc/api/peerconnection/RTCRtpParameters.h", + "objc/api/peerconnection/RTCRtpReceiver.h", + "objc/api/peerconnection/RTCRtpSender.h", + "objc/api/peerconnection/RTCRtpTransceiver.h", + "objc/api/peerconnection/RTCDtmfSender.h", + "objc/api/peerconnection/RTCSSLAdapter.h", + "objc/api/peerconnection/RTCSessionDescription.h", + "objc/api/peerconnection/RTCTracing.h", + "objc/api/peerconnection/RTCCertificate.h", + "objc/api/peerconnection/RTCVideoSource.h", + "objc/api/peerconnection/RTCVideoTrack.h", + "objc/api/video_codec/RTCVideoDecoderVP8.h", + "objc/api/video_codec/RTCVideoDecoderVP9.h", + "objc/api/video_codec/RTCVideoEncoderVP8.h", + "objc/api/video_codec/RTCVideoEncoderVP9.h", + ] + if (!build_with_chromium) { + mac_framework_header_files += [ + "objc/api/logging/RTCCallbackLogger.h", + "objc/api/peerconnection/RTCFileLogger.h", + ] + } + + bundle_data("framework_headers") { + # TODO(andersc): Generate umbrella header + sources = mac_framework_header_files + outputs = [ + "{{bundle_contents_dir}}/Headers/{{source_file_part}}", + ] + } + + mac_framework_bundle("mac_framework_objc") { + info_plist = "objc/Info.plist" + output_name = "WebRTC" + framework_version = "A" + framework_contents = [ "Headers" ] + + sources = mac_framework_header_files + + ldflags = [ + "-all_load", + "-install_name", + "@rpath/$output_name.framework/$output_name", + ] + + deps = [ + ":base_objc", + ":default_codec_factory_objc", + ":framework_headers", + ":native_api", + ":native_video", + ":peerconnectionfactory_base_objc", + ":ui_objc", + ":videocapture_objc", + ":videocodec_objc", + ":videotoolbox_objc", + "../rtc_base:rtc_base_approved", + "../system_wrappers:field_trial_default", + "../system_wrappers:metrics_default", + "../system_wrappers:runtime_enabled_features_default", + ] + if (rtc_use_metal_rendering) { + deps += [ ":metal_objc" ] + } + if (!build_with_chromium) { + deps += [ + ":callback_logger_objc", + ":file_logger_objc", + ] + } + + libs = [ + "AVFoundation.framework", + "CoreGraphics.framework", + "CoreMedia.framework", + "OpenGL.framework", + ] + + configs += [ "..:common_objc" ] + + public_configs = [ ":common_config_objc" ] + } + + bundle_data("mac_framework_bundle") { + deps = [ + "../sdk:mac_framework_objc", + ] + sources = [ + "$root_build_dir/WebRTC.framework", + ] + outputs = [ + "{{bundle_resources_dir}}/Frameworks/{{source_file_part}}", + ] + } } rtc_static_library("wrapped_native_codec_objc") { sources = [ - "objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.h", - "objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.mm", - "objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.h", - "objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.mm", + "objc/api/video_codec/RTCWrappedNativeVideoDecoder.h", + "objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm", + "objc/api/video_codec/RTCWrappedNativeVideoEncoder.h", + "objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm", ] configs += [ "..:common_objc" ] public_configs = [ ":common_config_objc" ] deps = [ - ":common_objc", - ":videocodec_objc", + ":base_objc", + ":helpers_objc", "../api/video_codecs:video_codecs_api", "../media:rtc_media_base", ] @@ -1074,18 +1516,18 @@ if (is_ios || is_mac) { "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] sources = [ - "objc/Framework/Native/api/video_capturer.h", - "objc/Framework/Native/api/video_capturer.mm", - "objc/Framework/Native/api/video_decoder_factory.h", - "objc/Framework/Native/api/video_decoder_factory.mm", - "objc/Framework/Native/api/video_encoder_factory.h", - "objc/Framework/Native/api/video_encoder_factory.mm", - "objc/Framework/Native/api/video_frame.h", - "objc/Framework/Native/api/video_frame.mm", - "objc/Framework/Native/api/video_frame_buffer.h", - "objc/Framework/Native/api/video_frame_buffer.mm", - "objc/Framework/Native/api/video_renderer.h", - "objc/Framework/Native/api/video_renderer.mm", + "objc/native/api/video_capturer.h", + "objc/native/api/video_capturer.mm", + "objc/native/api/video_decoder_factory.h", + "objc/native/api/video_decoder_factory.mm", + "objc/native/api/video_encoder_factory.h", + "objc/native/api/video_encoder_factory.mm", + "objc/native/api/video_frame.h", + "objc/native/api/video_frame.mm", + "objc/native/api/video_frame_buffer.h", + "objc/native/api/video_frame_buffer.mm", + "objc/native/api/video_renderer.h", + "objc/native/api/video_renderer.mm", ] configs += [ "..:common_objc" ] @@ -1093,11 +1535,9 @@ if (is_ios || is_mac) { public_configs = [ ":common_config_objc" ] deps = [ + ":base_objc", ":native_video", - ":videocapturebase_objc", - ":videocodec_objc", ":videoframebuffer_objc", - ":videorenderer_objc", "../api:libjingle_peerconnection_api", "../api/video:video_frame", "../api/video_codecs:video_codecs_api", @@ -1109,18 +1549,18 @@ if (is_ios || is_mac) { rtc_static_library("native_video") { sources = [ - "objc/Framework/Native/src/objc_frame_buffer.h", - "objc/Framework/Native/src/objc_frame_buffer.mm", - "objc/Framework/Native/src/objc_video_decoder_factory.h", - "objc/Framework/Native/src/objc_video_decoder_factory.mm", - "objc/Framework/Native/src/objc_video_encoder_factory.h", - "objc/Framework/Native/src/objc_video_encoder_factory.mm", - "objc/Framework/Native/src/objc_video_frame.h", - "objc/Framework/Native/src/objc_video_frame.mm", - "objc/Framework/Native/src/objc_video_renderer.h", - "objc/Framework/Native/src/objc_video_renderer.mm", - "objc/Framework/Native/src/objc_video_track_source.h", - "objc/Framework/Native/src/objc_video_track_source.mm", + "objc/native/src/objc_frame_buffer.h", + "objc/native/src/objc_frame_buffer.mm", + "objc/native/src/objc_video_decoder_factory.h", + "objc/native/src/objc_video_decoder_factory.mm", + "objc/native/src/objc_video_encoder_factory.h", + "objc/native/src/objc_video_encoder_factory.mm", + "objc/native/src/objc_video_frame.h", + "objc/native/src/objc_video_frame.mm", + "objc/native/src/objc_video_renderer.h", + "objc/native/src/objc_video_renderer.mm", + "objc/native/src/objc_video_track_source.h", + "objc/native/src/objc_video_track_source.mm", ] configs += [ "..:common_objc" ] @@ -1134,11 +1574,12 @@ if (is_ios || is_mac) { } deps = [ - ":common_objc", - ":videocapturebase_objc", + ":base_native_additions_objc", + ":base_objc", + ":helpers_objc", ":videocodec_objc", ":videoframebuffer_objc", - ":videorenderer_objc", + ":vpx_codec_constants", ":wrapped_native_codec_objc", "../api/video:video_frame", "../api/video:video_frame_i420", @@ -1157,10 +1598,10 @@ if (is_ios || is_mac) { rtc_static_library("video_toolbox_cc") { visibility = [ ":videotoolbox_objc" ] sources = [ - "objc/Framework/Classes/VideoToolbox/helpers.cc", - "objc/Framework/Classes/VideoToolbox/helpers.h", - "objc/Framework/Classes/VideoToolbox/nalu_rewriter.cc", - "objc/Framework/Classes/VideoToolbox/nalu_rewriter.h", + "objc/components/video_codec/helpers.cc", + "objc/components/video_codec/helpers.h", + "objc/components/video_codec/nalu_rewriter.cc", + "objc/components/video_codec/nalu_rewriter.h", ] deps = [ "../common_video", @@ -1178,8 +1619,14 @@ if (is_ios || is_mac) { "software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove. ] sources = [ - "objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm", - "objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm", + "objc/components/video_codec/RTCVideoDecoderFactoryH264.h", + "objc/components/video_codec/RTCVideoDecoderFactoryH264.m", + "objc/components/video_codec/RTCVideoDecoderH264.h", + "objc/components/video_codec/RTCVideoDecoderH264.mm", + "objc/components/video_codec/RTCVideoEncoderFactoryH264.h", + "objc/components/video_codec/RTCVideoEncoderFactoryH264.m", + "objc/components/video_codec/RTCVideoEncoderH264.h", + "objc/components/video_codec/RTCVideoEncoderH264.mm", ] configs += [ @@ -1192,22 +1639,15 @@ if (is_ios || is_mac) { } deps = [ - ":common_objc", - ":native_api", - ":video_objc", + ":base_native_additions_objc", + ":base_objc", + ":helpers_objc", ":video_toolbox_cc", ":videocodec_objc", ":videoframebuffer_objc", - ":videosource_objc", - "../api/video:video_frame", - "../api/video_codecs:video_codecs_api", "../common_video", - "../media:rtc_audio_video", - "../media:rtc_media", - "../media:rtc_media_base", "../modules:module_api", "../modules/video_coding:video_codec_interface", - "../modules/video_coding:video_coding_utility", "../rtc_base:checks", "../rtc_base:rtc_base_approved", "//third_party/libyuv", diff --git a/sdk/objc/DEPS b/sdk/objc/DEPS index 55621f8c1d..df90ebbd23 100644 --- a/sdk/objc/DEPS +++ b/sdk/objc/DEPS @@ -1,12 +1,8 @@ include_rules = [ - "+WebRTC", - "+Common", - "+Video", - "+Audio", - "+UI", - "+PeerConnection", - "+VideoToolbox", - "+Metal", + "+base", + "+components", + "+helpers", + "+sdk", "+api", "+common_video/h264", "+common_video/include", @@ -17,5 +13,6 @@ include_rules = [ "+system_wrappers", "+modules/audio_device", "+modules/audio_processing", + "+native", "+third_party/libyuv", ] diff --git a/sdk/objc/Framework/Classes/Common/NSString+StdString.h b/sdk/objc/Framework/Classes/Common/NSString+StdString.h index 7f51a9f3c6..3ec1b613ef 100644 --- a/sdk/objc/Framework/Classes/Common/NSString+StdString.h +++ b/sdk/objc/Framework/Classes/Common/NSString+StdString.h @@ -8,19 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#include - -NS_ASSUME_NONNULL_BEGIN - -@interface NSString (StdString) - -@property(nonatomic, readonly) std::string stdString; - -+ (std::string)stdStringForString:(NSString *)nsString; -+ (NSString *)stringForStdString:(const std::string &)stdString; - -@end - -NS_ASSUME_NONNULL_END +#import "helpers/NSString+StdString.h" diff --git a/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h b/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h index 0c032953be..f380d3f3de 100644 --- a/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h +++ b/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h @@ -8,18 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#if defined(WEBRTC_IOS) - -#import - -NS_EXTENSION_UNAVAILABLE_IOS("Application status not available in app extensions.") -@interface RTCUIApplicationStatusObserver : NSObject - -+ (instancetype)sharedInstance; -+ (void)prepareForUse; - -- (BOOL)isApplicationActive; - -@end - -#endif // WEBRTC_IOS +#import "helpers/RTCUIApplicationStatusObserver.h" diff --git a/sdk/objc/Framework/Classes/Common/scoped_cftyperef.h b/sdk/objc/Framework/Classes/Common/scoped_cftyperef.h index c54b03903c..e5e376b0bc 100644 --- a/sdk/objc/Framework/Classes/Common/scoped_cftyperef.h +++ b/sdk/objc/Framework/Classes/Common/scoped_cftyperef.h @@ -9,108 +9,4 @@ * */ -#ifndef WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COMMON_SCOPED_CFTYPEREF_H_ -#define WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COMMON_SCOPED_CFTYPEREF_H_ - -#include -namespace rtc { - -// RETAIN: ScopedTypeRef should retain the object when it takes -// ownership. -// ASSUME: Assume the object already has already been retained. -// ScopedTypeRef takes over ownership. -enum class RetainPolicy { RETAIN, ASSUME }; - -namespace internal { -template -struct CFTypeRefTraits { - static T InvalidValue() { return nullptr; } - static void Release(T ref) { CFRelease(ref); } - static T Retain(T ref) { - CFRetain(ref); - return ref; - } -}; - -template -class ScopedTypeRef { - public: - ScopedTypeRef() : ptr_(Traits::InvalidValue()) {} - explicit ScopedTypeRef(T ptr) : ptr_(ptr) {} - ScopedTypeRef(T ptr, RetainPolicy policy) : ScopedTypeRef(ptr) { - if (ptr_ && policy == RetainPolicy::RETAIN) - Traits::Retain(ptr_); - } - - ScopedTypeRef(const ScopedTypeRef& rhs) : ptr_(rhs.ptr_) { - if (ptr_) - ptr_ = Traits::Retain(ptr_); - } - - ~ScopedTypeRef() { - if (ptr_) { - Traits::Release(ptr_); - } - } - - T get() const { return ptr_; } - T operator->() const { return ptr_; } - explicit operator bool() const { return ptr_; } - - bool operator!() const { return !ptr_; } - - ScopedTypeRef& operator=(const T& rhs) { - if (ptr_) - Traits::Release(ptr_); - ptr_ = rhs; - return *this; - } - - ScopedTypeRef& operator=(const ScopedTypeRef& rhs) { - reset(rhs.get(), RetainPolicy::RETAIN); - return *this; - } - - // This is intended to take ownership of objects that are - // created by pass-by-pointer initializers. - T* InitializeInto() { - RTC_DCHECK(!ptr_); - return &ptr_; - } - - void reset(T ptr, RetainPolicy policy = RetainPolicy::ASSUME) { - if (ptr && policy == RetainPolicy::RETAIN) - Traits::Retain(ptr); - if (ptr_) - Traits::Release(ptr_); - ptr_ = ptr; - } - - T release() { - T temp = ptr_; - ptr_ = Traits::InvalidValue(); - return temp; - } - - private: - T ptr_; -}; -} // namespace internal - -template -using ScopedCFTypeRef = - internal::ScopedTypeRef>; - -template -static ScopedCFTypeRef AdoptCF(T cftype) { - return ScopedCFTypeRef(cftype, RetainPolicy::RETAIN); -} - -template -static ScopedCFTypeRef ScopedCF(T cftype) { - return ScopedCFTypeRef(cftype); -} - -} // namespace rtc - -#endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_COMMON_SCOPED_CFTYPEREF_H_ +#import "helpers/scoped_cftyperef.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h b/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h index 64653e45f6..529aa8dcf5 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Native.h @@ -8,21 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCConfiguration.h" - -#include "api/peerconnectioninterface.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RTCConfiguration () - -/** Optional TurnCustomizer. - * With this class one can modify outgoing TURN messages. - * The object passed in must remain valid until PeerConnection::Close() is - * called. - */ -@property(nonatomic, nullable) webrtc::TurnCustomizer* turnCustomizer; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCConfiguration+Native.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCEncodedImage.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCEncodedImage.mm deleted file mode 100644 index e9c0a8c055..0000000000 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCEncodedImage.mm +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017 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. - */ - -#import "WebRTC/RTCVideoCodec.h" - -#import "RTCVideoCodec+Private.h" - -#include "rtc_base/numerics/safe_conversions.h" - -@implementation RTCEncodedImage - -@synthesize buffer = _buffer; -@synthesize encodedWidth = _encodedWidth; -@synthesize encodedHeight = _encodedHeight; -@synthesize timeStamp = _timeStamp; -@synthesize captureTimeMs = _captureTimeMs; -@synthesize ntpTimeMs = _ntpTimeMs; -@synthesize flags = _flags; -@synthesize encodeStartMs = _encodeStartMs; -@synthesize encodeFinishMs = _encodeFinishMs; -@synthesize frameType = _frameType; -@synthesize rotation = _rotation; -@synthesize completeFrame = _completeFrame; -@synthesize qp = _qp; -@synthesize contentType = _contentType; - -- (instancetype)initWithNativeEncodedImage:(webrtc::EncodedImage)encodedImage { - if (self = [super init]) { - // Wrap the buffer in NSData without copying, do not take ownership. - _buffer = [NSData dataWithBytesNoCopy:encodedImage._buffer - length:encodedImage._length - freeWhenDone:NO]; - _encodedWidth = rtc::dchecked_cast(encodedImage._encodedWidth); - _encodedHeight = rtc::dchecked_cast(encodedImage._encodedHeight); - _timeStamp = encodedImage.Timestamp(); - _captureTimeMs = encodedImage.capture_time_ms_; - _ntpTimeMs = encodedImage.ntp_time_ms_; - _flags = encodedImage.timing_.flags; - _encodeStartMs = encodedImage.timing_.encode_start_ms; - _encodeFinishMs = encodedImage.timing_.encode_finish_ms; - _frameType = static_cast(encodedImage._frameType); - _rotation = static_cast(encodedImage.rotation_); - _completeFrame = encodedImage._completeFrame; - _qp = @(encodedImage.qp_); - _contentType = (encodedImage.content_type_ == webrtc::VideoContentType::SCREENSHARE) ? - RTCVideoContentTypeScreenshare : - RTCVideoContentTypeUnspecified; - } - - return self; -} - -- (webrtc::EncodedImage)nativeEncodedImage { - // Return the pointer without copying. - webrtc::EncodedImage encodedImage( - (uint8_t *)_buffer.bytes, (size_t)_buffer.length, (size_t)_buffer.length); - encodedImage._encodedWidth = rtc::dchecked_cast(_encodedWidth); - encodedImage._encodedHeight = rtc::dchecked_cast(_encodedHeight); - encodedImage.SetTimestamp(_timeStamp); - encodedImage.capture_time_ms_ = _captureTimeMs; - encodedImage.ntp_time_ms_ = _ntpTimeMs; - encodedImage.timing_.flags = _flags; - encodedImage.timing_.encode_start_ms = _encodeStartMs; - encodedImage.timing_.encode_finish_ms = _encodeFinishMs; - encodedImage._frameType = webrtc::FrameType(_frameType); - encodedImage.rotation_ = webrtc::VideoRotation(_rotation); - encodedImage._completeFrame = _completeFrame; - encodedImage.qp_ = _qp ? _qp.intValue : -1; - encodedImage.content_type_ = (_contentType == RTCVideoContentTypeScreenshare) ? - webrtc::VideoContentType::SCREENSHARE : - webrtc::VideoContentType::UNSPECIFIED; - - return encodedImage; -} - -@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h index 238f808bb5..7d8ab9af27 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h @@ -8,27 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCPeerConnection.h" - -#include - -namespace rtc { -class BitrateAllocationStrategy; -} // namespace rtc - -NS_ASSUME_NONNULL_BEGIN - -/** - * This class extension exposes methods that work directly with injectable C++ components. - */ -@interface RTCPeerConnection () - -/** Sets current strategy. If not set default WebRTC allocator will be used. May be changed during - * an active session. - */ -- (void)setBitrateAllocationStrategy: - (std::unique_ptr)bitrateAllocationStrategy; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCPeerConnection+Native.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h index 3d460fe4d8..222e06ef33 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h @@ -8,47 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCPeerConnectionFactory.h" - -#include "rtc_base/scoped_ref_ptr.h" - -namespace webrtc { - -class AudioDeviceModule; -class AudioEncoderFactory; -class AudioDecoderFactory; -class VideoEncoderFactory; -class VideoDecoderFactory; -class AudioProcessing; - -} // namespace webrtc - -NS_ASSUME_NONNULL_BEGIN - -/** - * This class extension exposes methods that work directly with injectable C++ components. - */ -@interface RTCPeerConnectionFactory () - -- (instancetype)initNative NS_DESIGNATED_INITIALIZER; - -/* Initializer used when WebRTC is compiled with no media support */ -- (instancetype)initWithNoMedia; - -/* Initialize object with injectable native audio/video encoder/decoder factories */ -- (instancetype)initWithNativeAudioEncoderFactory: - (rtc::scoped_refptr)audioEncoderFactory - nativeAudioDecoderFactory: - (rtc::scoped_refptr)audioDecoderFactory - nativeVideoEncoderFactory: - (std::unique_ptr)videoEncoderFactory - nativeVideoDecoderFactory: - (std::unique_ptr)videoDecoderFactory - audioDeviceModule: - (nullable webrtc::AudioDeviceModule *)audioDeviceModule - audioProcessingModule: - (rtc::scoped_refptr)audioProcessingModule; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCPeerConnectionFactory+Native.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h index 4a2cf5228b..3233e4e9f2 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h @@ -8,51 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCodec.h" - -#import "WebRTC/RTCVideoCodecH264.h" - -#include "api/video_codecs/sdp_video_format.h" -#include "common_video/include/video_frame.h" -#include "media/base/codec.h" -#include "modules/video_coding/include/video_codec_interface.h" - -NS_ASSUME_NONNULL_BEGIN - -/* Interfaces for converting to/from internal C++ formats. */ -@interface RTCEncodedImage () - -- (instancetype)initWithNativeEncodedImage:(webrtc::EncodedImage)encodedImage; -- (webrtc::EncodedImage)nativeEncodedImage; - -@end - -@interface RTCVideoEncoderSettings () - -- (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *__nullable)videoCodec; -- (webrtc::VideoCodec)nativeVideoCodec; - -@end - -@interface RTCCodecSpecificInfoH264 () - -- (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo; - -@end - -@interface RTCRtpFragmentationHeader () - -- (instancetype)initWithNativeFragmentationHeader: - (const webrtc::RTPFragmentationHeader *__nullable)fragmentationHeader; -- (std::unique_ptr)createNativeFragmentationHeader; - -@end - -@interface RTCVideoCodecInfo () - -- (instancetype)initWithNativeSdpVideoFormat:(webrtc::SdpVideoFormat)format; -- (webrtc::SdpVideoFormat)nativeSdpVideoFormat; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCEncodedImage+Private.h" +#import "api/peerconnection/RTCRtpFragmentationHeader+Private.h" +#import "api/peerconnection/RTCVideoCodecInfo+Private.h" +#import "api/peerconnection/RTCVideoEncoderSettings+Private.h" +#import "components/video_codec/RTCCodecSpecificInfoH264+Private.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm deleted file mode 100644 index d7521262d4..0000000000 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2017 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. - */ - -#import "WebRTC/RTCVideoCodec.h" - -#import "NSString+StdString.h" -#import "RTCVideoCodec+Private.h" -#if defined(WEBRTC_IOS) -#import "UIDevice+H264Profile.h" -#endif -#import "WebRTC/RTCVideoCodecFactory.h" - -#include "media/base/mediaconstants.h" - -namespace { - -NSString *MaxSupportedProfileLevelConstrainedHigh(); -NSString *MaxSupportedProfileLevelConstrainedBaseline(); - -} // namespace - -NSString *const kRTCVideoCodecVp8Name = @(cricket::kVp8CodecName); -NSString *const kRTCVideoCodecVp9Name = @(cricket::kVp9CodecName); -NSString *const kRTCVideoCodecH264Name = @(cricket::kH264CodecName); -NSString *const kRTCLevel31ConstrainedHigh = @"640c1f"; -NSString *const kRTCLevel31ConstrainedBaseline = @"42e01f"; -NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh = - MaxSupportedProfileLevelConstrainedHigh(); -NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline = - MaxSupportedProfileLevelConstrainedBaseline(); - -namespace { - -#if defined(WEBRTC_IOS) - -using namespace webrtc::H264; - -NSString *MaxSupportedLevelForProfile(Profile profile) { - const absl::optional profileLevelId = [UIDevice maxSupportedH264Profile]; - if (profileLevelId && profileLevelId->profile >= profile) { - const absl::optional profileString = - ProfileLevelIdToString(ProfileLevelId(profile, profileLevelId->level)); - if (profileString) { - return [NSString stringForStdString:*profileString]; - } - } - return nil; -} -#endif - -NSString *MaxSupportedProfileLevelConstrainedBaseline() { -#if defined(WEBRTC_IOS) - NSString *profile = MaxSupportedLevelForProfile(webrtc::H264::kProfileConstrainedBaseline); - if (profile != nil) { - return profile; - } -#endif - return kRTCLevel31ConstrainedBaseline; -} - -NSString *MaxSupportedProfileLevelConstrainedHigh() { -#if defined(WEBRTC_IOS) - NSString *profile = MaxSupportedLevelForProfile(webrtc::H264::kProfileConstrainedHigh); - if (profile != nil) { - return profile; - } -#endif - return kRTCLevel31ConstrainedHigh; -} - -} // namespace - -@implementation RTCVideoCodecInfo - -@synthesize name = _name; -@synthesize parameters = _parameters; - -- (instancetype)initWithName:(NSString *)name { - return [self initWithName:name parameters:nil]; -} - -- (instancetype)initWithName:(NSString *)name - parameters:(nullable NSDictionary *)parameters { - if (self = [super init]) { - _name = name; - _parameters = (parameters ? parameters : @{}); - } - - return self; -} - -- (instancetype)initWithNativeSdpVideoFormat:(webrtc::SdpVideoFormat)format { - NSMutableDictionary *params = [NSMutableDictionary dictionary]; - for (auto it = format.parameters.begin(); it != format.parameters.end(); ++it) { - [params setObject:[NSString stringForStdString:it->second] - forKey:[NSString stringForStdString:it->first]]; - } - return [self initWithName:[NSString stringForStdString:format.name] parameters:params]; -} - -- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info { - if (!info || - ![self.name isEqualToString:info.name] || - ![self.parameters isEqualToDictionary:info.parameters]) { - return NO; - } - return YES; -} - -- (BOOL)isEqual:(id)object { - if (self == object) - return YES; - if (![object isKindOfClass:[self class]]) - return NO; - return [self isEqualToCodecInfo:object]; -} - -- (NSUInteger)hash { - return [self.name hash] ^ [self.parameters hash]; -} - -- (webrtc::SdpVideoFormat)nativeSdpVideoFormat { - std::map parameters; - for (NSString *paramKey in _parameters.allKeys) { - std::string key = [NSString stdStringForString:paramKey]; - std::string value = [NSString stdStringForString:_parameters[paramKey]]; - parameters[key] = value; - } - - return webrtc::SdpVideoFormat([NSString stdStringForString:_name], parameters); -} - -#pragma mark - NSCoding - -- (instancetype)initWithCoder:(NSCoder *)decoder { - return [self initWithName:[decoder decodeObjectForKey:@"name"] - parameters:[decoder decodeObjectForKey:@"parameters"]]; -} - -- (void)encodeWithCoder:(NSCoder *)encoder { - [encoder encodeObject:_name forKey:@"name"]; - [encoder encodeObject:_parameters forKey:@"parameters"]; -} - -@end - -@implementation RTCVideoEncoderQpThresholds - -@synthesize low = _low; -@synthesize high = _high; - -- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high { - if (self = [super init]) { - _low = low; - _high = high; - } - return self; -} - -@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm deleted file mode 100644 index 95233ec4ba..0000000000 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017 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. - */ - -#import "WebRTC/RTCVideoCodec.h" - -#import "NSString+StdString.h" -#import "RTCVideoCodec+Private.h" -#import "WebRTC/RTCVideoCodecFactory.h" - -@implementation RTCVideoEncoderSettings - -@synthesize name = _name; -@synthesize width = _width; -@synthesize height = _height; -@synthesize startBitrate = _startBitrate; -@synthesize maxBitrate = _maxBitrate; -@synthesize minBitrate = _minBitrate; -@synthesize targetBitrate = _targetBitrate; -@synthesize maxFramerate = _maxFramerate; -@synthesize qpMax = _qpMax; -@synthesize mode = _mode; - -- (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec { - if (self = [super init]) { - if (videoCodec) { - const char *codecName = CodecTypeToPayloadString(videoCodec->codecType); - _name = [NSString stringWithUTF8String:codecName]; - - _width = videoCodec->width; - _height = videoCodec->height; - _startBitrate = videoCodec->startBitrate; - _maxBitrate = videoCodec->maxBitrate; - _minBitrate = videoCodec->minBitrate; - _targetBitrate = videoCodec->targetBitrate; - _maxFramerate = videoCodec->maxFramerate; - _qpMax = videoCodec->qpMax; - _mode = (RTCVideoCodecMode)videoCodec->mode; - } - } - - return self; -} - -- (webrtc::VideoCodec)nativeVideoCodec { - webrtc::VideoCodec videoCodec; - videoCodec.width = _width; - videoCodec.height = _height; - videoCodec.startBitrate = _startBitrate; - videoCodec.maxBitrate = _maxBitrate; - videoCodec.minBitrate = _minBitrate; - videoCodec.targetBitrate = _targetBitrate; - videoCodec.maxBitrate = _maxBitrate; - videoCodec.qpMax = _qpMax; - videoCodec.mode = (webrtc::VideoCodecMode)_mode; - - return videoCodec; -} - -@end diff --git a/sdk/objc/Framework/Classes/Video/RTCDefaultShader.h b/sdk/objc/Framework/Classes/Video/RTCDefaultShader.h index ed5125e2e8..136d7003c6 100644 --- a/sdk/objc/Framework/Classes/Video/RTCDefaultShader.h +++ b/sdk/objc/Framework/Classes/Video/RTCDefaultShader.h @@ -8,16 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoViewShading.h" - -NS_ASSUME_NONNULL_BEGIN - -/** Default RTCVideoViewShading that will be used in RTCNSGLVideoView and - * RTCEAGLVideoView if no external shader is specified. This shader will render - * the video in a rectangle without any color or geometric transformations. - */ -@interface RTCDefaultShader : NSObject - -@end - -NS_ASSUME_NONNULL_END +#import "components/renderer/opengl/RTCDefaultShader.h" diff --git a/sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.h b/sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.h index 9cba823271..4ba1caa41d 100644 --- a/sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.h +++ b/sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.h @@ -8,24 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -@class RTCVideoFrame; - -NS_ASSUME_NONNULL_BEGIN - -@interface RTCNV12TextureCache : NSObject - -@property(nonatomic, readonly) GLuint yTexture; -@property(nonatomic, readonly) GLuint uvTexture; - -- (instancetype)init NS_UNAVAILABLE; -- (nullable instancetype)initWithContext:(EAGLContext *)context NS_DESIGNATED_INITIALIZER; - -- (BOOL)uploadFrameToTextures:(RTCVideoFrame *)frame; - -- (void)releaseTextures; - -@end - -NS_ASSUME_NONNULL_END +#import "components/renderer/opengl/RTCNV12TextureCache.h" diff --git a/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h b/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h index cd5a51079a..21281f36ac 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h +++ b/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h @@ -6,111 +6,6 @@ * 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. - * */ -#ifndef SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_NALU_REWRITER_H_ -#define SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_NALU_REWRITER_H_ - -#include "modules/video_coding/codecs/h264/include/h264.h" - -#include -#include - -#include "common_video/h264/h264_common.h" -#include "modules/include/module_common_types.h" -#include "rtc_base/buffer.h" - -using webrtc::H264::NaluIndex; - -namespace webrtc { - -// Converts a sample buffer emitted from the VideoToolbox encoder into a buffer -// suitable for RTP. The sample buffer is in avcc format whereas the rtp buffer -// needs to be in Annex B format. Data is written directly to |annexb_buffer| -// and a new RTPFragmentationHeader is returned in |out_header|. -bool H264CMSampleBufferToAnnexBBuffer( - CMSampleBufferRef avcc_sample_buffer, - bool is_keyframe, - rtc::Buffer* annexb_buffer, - std::unique_ptr* out_header); - -// Converts a buffer received from RTP into a sample buffer suitable for the -// VideoToolbox decoder. The RTP buffer is in annex b format whereas the sample -// buffer is in avcc format. -// If |is_keyframe| is true then |video_format| is ignored since the format will -// be read from the buffer. Otherwise |video_format| must be provided. -// Caller is responsible for releasing the created sample buffer. -bool H264AnnexBBufferToCMSampleBuffer(const uint8_t* annexb_buffer, - size_t annexb_buffer_size, - CMVideoFormatDescriptionRef video_format, - CMSampleBufferRef* out_sample_buffer); - -// Returns a video format description created from the sps/pps information in -// the Annex B buffer. If there is no such information, nullptr is returned. -// The caller is responsible for releasing the description. -CMVideoFormatDescriptionRef CreateVideoFormatDescription( - const uint8_t* annexb_buffer, - size_t annexb_buffer_size); - -// Helper class for reading NALUs from an RTP Annex B buffer. -class AnnexBBufferReader final { - public: - AnnexBBufferReader(const uint8_t* annexb_buffer, size_t length); - ~AnnexBBufferReader(); - AnnexBBufferReader(const AnnexBBufferReader& other) = delete; - void operator=(const AnnexBBufferReader& other) = delete; - - // Returns a pointer to the beginning of the next NALU slice without the - // header bytes and its length. Returns false if no more slices remain. - bool ReadNalu(const uint8_t** out_nalu, size_t* out_length); - - // Returns the number of unread NALU bytes, including the size of the header. - // If the buffer has no remaining NALUs this will return zero. - size_t BytesRemaining() const; - - // Reset the reader to start reading from the first NALU - void SeekToStart(); - - // Seek to the next position that holds a NALU of the desired type, - // or the end if no such NALU is found. - // Return true if a NALU of the desired type is found, false if we - // reached the end instead - bool SeekToNextNaluOfType(H264::NaluType type); - - private: - // Returns the the next offset that contains NALU data. - size_t FindNextNaluHeader(const uint8_t* start, - size_t length, - size_t offset) const; - - const uint8_t* const start_; - std::vector offsets_; - std::vector::iterator offset_; - const size_t length_; -}; - -// Helper class for writing NALUs using avcc format into a buffer. -class AvccBufferWriter final { - public: - AvccBufferWriter(uint8_t* const avcc_buffer, size_t length); - ~AvccBufferWriter() {} - AvccBufferWriter(const AvccBufferWriter& other) = delete; - void operator=(const AvccBufferWriter& other) = delete; - - // Writes the data slice into the buffer. Returns false if there isn't - // enough space left. - bool WriteNalu(const uint8_t* data, size_t data_size); - - // Returns the unused bytes in the buffer. - size_t BytesRemaining() const; - - private: - uint8_t* const start_; - size_t offset_; - const size_t length_; -}; - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_NALU_REWRITER_H_ +#import "components/video_codec/nalu_rewriter.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h b/sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h index 15b63d39dc..64c49977c0 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h @@ -8,242 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const kRTCAudioSessionErrorDomain; -/** Method that requires lock was called without lock. */ -extern NSInteger const kRTCAudioSessionErrorLockRequired; -/** Unknown configuration error occurred. */ -extern NSInteger const kRTCAudioSessionErrorConfiguration; - -@class RTCAudioSession; -@class RTCAudioSessionConfiguration; - -// Surfaces AVAudioSession events. WebRTC will listen directly for notifications -// from AVAudioSession and handle them before calling these delegate methods, -// at which point applications can perform additional processing if required. -RTC_EXPORT -@protocol RTCAudioSessionDelegate - -@optional -/** Called on a system notification thread when AVAudioSession starts an - * interruption event. - */ -- (void)audioSessionDidBeginInterruption:(RTCAudioSession *)session; - -/** Called on a system notification thread when AVAudioSession ends an - * interruption event. - */ -- (void)audioSessionDidEndInterruption:(RTCAudioSession *)session - shouldResumeSession:(BOOL)shouldResumeSession; - -/** Called on a system notification thread when AVAudioSession changes the - * route. - */ -- (void)audioSessionDidChangeRoute:(RTCAudioSession *)session - reason:(AVAudioSessionRouteChangeReason)reason - previousRoute:(AVAudioSessionRouteDescription *)previousRoute; - -/** Called on a system notification thread when AVAudioSession media server - * terminates. - */ -- (void)audioSessionMediaServerTerminated:(RTCAudioSession *)session; - -/** Called on a system notification thread when AVAudioSession media server - * restarts. - */ -- (void)audioSessionMediaServerReset:(RTCAudioSession *)session; - -// TODO(tkchin): Maybe handle SilenceSecondaryAudioHintNotification. - -- (void)audioSession:(RTCAudioSession *)session didChangeCanPlayOrRecord:(BOOL)canPlayOrRecord; - -/** Called on a WebRTC thread when the audio device is notified to begin - * playback or recording. - */ -- (void)audioSessionDidStartPlayOrRecord:(RTCAudioSession *)session; - -/** Called on a WebRTC thread when the audio device is notified to stop - * playback or recording. - */ -- (void)audioSessionDidStopPlayOrRecord:(RTCAudioSession *)session; - -/** Called when the AVAudioSession output volume value changes. */ -- (void)audioSession:(RTCAudioSession *)audioSession didChangeOutputVolume:(float)outputVolume; - -/** Called when the audio device detects a playout glitch. The argument is the - * number of glitches detected so far in the current audio playout session. - */ -- (void)audioSession:(RTCAudioSession *)audioSession - didDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches; - -/** Called when the audio session is about to change the active state. - */ -- (void)audioSession:(RTCAudioSession *)audioSession willSetActive:(BOOL)active; - -/** Called after the audio session sucessfully changed the active state. - */ -- (void)audioSession:(RTCAudioSession *)audioSession didSetActive:(BOOL)active; - -/** Called after the audio session failed to change the active state. - */ -- (void)audioSession:(RTCAudioSession *)audioSession - failedToSetActive:(BOOL)active - error:(NSError *)error; - -@end - -/** This is a protocol used to inform RTCAudioSession when the audio session - * activation state has changed outside of RTCAudioSession. The current known use - * case of this is when CallKit activates the audio session for the application - */ -RTC_EXPORT -@protocol RTCAudioSessionActivationDelegate - -/** Called when the audio session is activated outside of the app by iOS. */ -- (void)audioSessionDidActivate:(AVAudioSession *)session; - -/** Called when the audio session is deactivated outside of the app by iOS. */ -- (void)audioSessionDidDeactivate:(AVAudioSession *)session; - -@end - -/** Proxy class for AVAudioSession that adds a locking mechanism similar to - * AVCaptureDevice. This is used to that interleaving configurations between - * WebRTC and the application layer are avoided. - * - * RTCAudioSession also coordinates activation so that the audio session is - * activated only once. See |setActive:error:|. - */ -RTC_EXPORT -@interface RTCAudioSession : NSObject - -/** Convenience property to access the AVAudioSession singleton. Callers should - * not call setters on AVAudioSession directly, but other method invocations - * are fine. - */ -@property(nonatomic, readonly) AVAudioSession *session; - -/** Our best guess at whether the session is active based on results of calls to - * AVAudioSession. - */ -@property(nonatomic, readonly) BOOL isActive; -/** Whether RTCAudioSession is currently locked for configuration. */ -@property(nonatomic, readonly) BOOL isLocked; - -/** If YES, WebRTC will not initialize the audio unit automatically when an - * audio track is ready for playout or recording. Instead, applications should - * call setIsAudioEnabled. If NO, WebRTC will initialize the audio unit - * as soon as an audio track is ready for playout or recording. - */ -@property(nonatomic, assign) BOOL useManualAudio; - -/** This property is only effective if useManualAudio is YES. - * Represents permission for WebRTC to initialize the VoIP audio unit. - * When set to NO, if the VoIP audio unit used by WebRTC is active, it will be - * stopped and uninitialized. This will stop incoming and outgoing audio. - * When set to YES, WebRTC will initialize and start the audio unit when it is - * needed (e.g. due to establishing an audio connection). - * This property was introduced to work around an issue where if an AVPlayer is - * playing audio while the VoIP audio unit is initialized, its audio would be - * either cut off completely or played at a reduced volume. By preventing - * the audio unit from being initialized until after the audio has completed, - * we are able to prevent the abrupt cutoff. - */ -@property(nonatomic, assign) BOOL isAudioEnabled; - -// Proxy properties. -@property(readonly) NSString *category; -@property(readonly) AVAudioSessionCategoryOptions categoryOptions; -@property(readonly) NSString *mode; -@property(readonly) BOOL secondaryAudioShouldBeSilencedHint; -@property(readonly) AVAudioSessionRouteDescription *currentRoute; -@property(readonly) NSInteger maximumInputNumberOfChannels; -@property(readonly) NSInteger maximumOutputNumberOfChannels; -@property(readonly) float inputGain; -@property(readonly) BOOL inputGainSettable; -@property(readonly) BOOL inputAvailable; -@property(readonly, nullable) NSArray *inputDataSources; -@property(readonly, nullable) AVAudioSessionDataSourceDescription *inputDataSource; -@property(readonly, nullable) NSArray *outputDataSources; -@property(readonly, nullable) AVAudioSessionDataSourceDescription *outputDataSource; -@property(readonly) double sampleRate; -@property(readonly) double preferredSampleRate; -@property(readonly) NSInteger inputNumberOfChannels; -@property(readonly) NSInteger outputNumberOfChannels; -@property(readonly) float outputVolume; -@property(readonly) NSTimeInterval inputLatency; -@property(readonly) NSTimeInterval outputLatency; -@property(readonly) NSTimeInterval IOBufferDuration; -@property(readonly) NSTimeInterval preferredIOBufferDuration; - -/** Default constructor. */ -+ (instancetype)sharedInstance; -- (instancetype)init NS_UNAVAILABLE; - -/** Adds a delegate, which is held weakly. */ -- (void)addDelegate:(id)delegate; -/** Removes an added delegate. */ -- (void)removeDelegate:(id)delegate; - -/** Request exclusive access to the audio session for configuration. This call - * will block if the lock is held by another object. - */ -- (void)lockForConfiguration; -/** Relinquishes exclusive access to the audio session. */ -- (void)unlockForConfiguration; - -/** If |active|, activates the audio session if it isn't already active. - * Successful calls must be balanced with a setActive:NO when activation is no - * longer required. If not |active|, deactivates the audio session if one is - * active and this is the last balanced call. When deactivating, the - * AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation option is passed to - * AVAudioSession. - */ -- (BOOL)setActive:(BOOL)active error:(NSError **)outError; - -// The following methods are proxies for the associated methods on -// AVAudioSession. |lockForConfiguration| must be called before using them -// otherwise they will fail with kRTCAudioSessionErrorLockRequired. - -- (BOOL)setCategory:(NSString *)category - withOptions:(AVAudioSessionCategoryOptions)options - error:(NSError **)outError; -- (BOOL)setMode:(NSString *)mode error:(NSError **)outError; -- (BOOL)setInputGain:(float)gain error:(NSError **)outError; -- (BOOL)setPreferredSampleRate:(double)sampleRate error:(NSError **)outError; -- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError **)outError; -- (BOOL)setPreferredInputNumberOfChannels:(NSInteger)count error:(NSError **)outError; -- (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count error:(NSError **)outError; -- (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride error:(NSError **)outError; -- (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort error:(NSError **)outError; -- (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource - error:(NSError **)outError; -- (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource - error:(NSError **)outError; -@end - -@interface RTCAudioSession (Configuration) - -/** Applies the configuration to the current session. Attempts to set all - * properties even if previous ones fail. Only the last error will be - * returned. - * |lockForConfiguration| must be called first. - */ -- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration error:(NSError **)outError; - -/** Convenience method that calls both setConfiguration and setActive. - * |lockForConfiguration| must be called first. - */ -- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration - active:(BOOL)active - error:(NSError **)outError; - -@end - -NS_ASSUME_NONNULL_END +#import "components/audio/RTCAudioSession.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h b/sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h index f3f3d80f85..6ee1bc5435 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h @@ -8,41 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import "WebRTC/RTCMacros.h" - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXTERN const int kRTCAudioSessionPreferredNumberOfChannels; -RTC_EXTERN const double kRTCAudioSessionHighPerformanceSampleRate; -RTC_EXTERN const double kRTCAudioSessionLowComplexitySampleRate; -RTC_EXTERN const double kRTCAudioSessionHighPerformanceIOBufferDuration; -RTC_EXTERN const double kRTCAudioSessionLowComplexityIOBufferDuration; - -// Struct to hold configuration values. -RTC_EXPORT -@interface RTCAudioSessionConfiguration : NSObject - -@property(nonatomic, strong) NSString *category; -@property(nonatomic, assign) AVAudioSessionCategoryOptions categoryOptions; -@property(nonatomic, strong) NSString *mode; -@property(nonatomic, assign) double sampleRate; -@property(nonatomic, assign) NSTimeInterval ioBufferDuration; -@property(nonatomic, assign) NSInteger inputNumberOfChannels; -@property(nonatomic, assign) NSInteger outputNumberOfChannels; - -/** Initializes configuration to defaults. */ -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -/** Returns the current configuration of the audio session. */ -+ (instancetype)currentConfiguration; -/** Returns the configuration that WebRTC needs. */ -+ (instancetype)webRTCConfiguration; -/** Provide a way to override the default configuration. */ -+ (void)setWebRTCConfiguration:(RTCAudioSessionConfiguration *)configuration; - -@end - -NS_ASSUME_NONNULL_END +#import "components/audio/RTCAudioSessionConfiguration.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCAudioSource.h b/sdk/objc/Framework/Headers/WebRTC/RTCAudioSource.h index 3db31573cb..a7dc191319 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCAudioSource.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCAudioSource.h @@ -8,25 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCAudioSource : RTCMediaSource - -- (instancetype)init NS_UNAVAILABLE; - -// Sets the volume for the RTCMediaSource. |volume| is a gain value in the range -// [0, 10]. -// Temporary fix to be able to modify volume of remote audio tracks. -// TODO(kthelgason): Property stays here temporarily until a proper volume-api -// is available on the surface exposed by webrtc. -@property(nonatomic, assign) double volume; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCAudioSource.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCAudioTrack.h b/sdk/objc/Framework/Headers/WebRTC/RTCAudioTrack.h index b83eede528..88515bb3fe 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCAudioTrack.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCAudioTrack.h @@ -8,21 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCAudioSource; - -RTC_EXPORT -@interface RTCAudioTrack : RTCMediaStreamTrack - -- (instancetype)init NS_UNAVAILABLE; - -/** The audio source for this audio track. */ -@property(nonatomic, readonly) RTCAudioSource *source; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCAudioTrack.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCCVPixelBuffer.h b/sdk/objc/Framework/Headers/WebRTC/RTCCVPixelBuffer.h new file mode 100644 index 0000000000..7a4f847be5 --- /dev/null +++ b/sdk/objc/Framework/Headers/WebRTC/RTCCVPixelBuffer.h @@ -0,0 +1,11 @@ +/* + * Copyright 2018 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. + */ + +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCCallbackLogger.h b/sdk/objc/Framework/Headers/WebRTC/RTCCallbackLogger.h index cdfe17f607..c4585228ed 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCCallbackLogger.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCCallbackLogger.h @@ -8,28 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -// This class intercepts WebRTC logs and forwards them to a registered block. -// This class is not threadsafe. -RTC_EXPORT -@interface RTCCallbackLogger : NSObject - -// The severity level to capture. The default is kRTCLoggingSeverityInfo. -@property(nonatomic, assign) RTCLoggingSeverity severity; - -// The callback will be called on the same thread that does the logging, so -// if the logging callback can be slow it may be a good idea to implement -// dispatching to some other queue. -- (void)start:(nullable void (^)(NSString*))callback; - -- (void)stop; - -@end - -NS_ASSUME_NONNULL_END +#import "api/logging/RTCCallbackLogger.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h b/sdk/objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h index 2995c9c3b1..388e72fce0 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCCameraPreviewView.h @@ -8,23 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import - -@class AVCaptureSession; - -/** RTCCameraPreviewView is a view that renders local video from an - * AVCaptureSession. - */ -RTC_EXPORT -@interface RTCCameraPreviewView : UIView - -/** The capture session being rendered in the view. Capture session - * is assigned to AVCaptureVideoPreviewLayer async in the same - * queue that the AVCaptureSession is started/stopped. - */ -@property(nonatomic, strong) AVCaptureSession* captureSession; - -@end +#import "helpers/RTCCameraPreviewView.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h b/sdk/objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h index 61868c5469..aac6773b6c 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCCameraVideoCapturer.h @@ -8,49 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -// Camera capture that implements RTCVideoCapturer. Delivers frames to a RTCVideoCapturerDelegate -// (usually RTCVideoSource). -NS_EXTENSION_UNAVAILABLE_IOS("Camera not available in app extensions.") -@interface RTCCameraVideoCapturer : RTCVideoCapturer - -// Capture session that is used for capturing. Valid from initialization to dealloc. -@property(readonly, nonatomic) AVCaptureSession *captureSession; - -// Returns list of available capture devices that support video capture. -+ (NSArray *)captureDevices; -// Returns list of formats that are supported by this class for this device. -+ (NSArray *)supportedFormatsForDevice:(AVCaptureDevice *)device; - -// Returns the most efficient supported output pixel format for this capturer. -- (FourCharCode)preferredOutputPixelFormat; - -// Starts the capture session asynchronously and notifies callback on completion. -// The device will capture video in the format given in the `format` parameter. If the pixel format -// in `format` is supported by the WebRTC pipeline, the same pixel format will be used for the -// output. Otherwise, the format returned by `preferredOutputPixelFormat` will be used. -- (void)startCaptureWithDevice:(AVCaptureDevice *)device - format:(AVCaptureDeviceFormat *)format - fps:(NSInteger)fps - completionHandler:(nullable void (^)(NSError *))completionHandler; -// Stops the capture session asynchronously and notifies callback on completion. -- (void)stopCaptureWithCompletionHandler:(nullable void (^)(void))completionHandler; - -// Starts the capture session asynchronously. -- (void)startCaptureWithDevice:(AVCaptureDevice *)device - format:(AVCaptureDeviceFormat *)format - fps:(NSInteger)fps; -// Stops the capture session asynchronously. -- (void)stopCapture; - -@end - -NS_ASSUME_NONNULL_END +#import "components/capturer/RTCCameraVideoCapturer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCCertificate.h b/sdk/objc/Framework/Headers/WebRTC/RTCCertificate.h index 6b4ea4323a..9e3b7dcf1a 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCCertificate.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCCertificate.h @@ -8,37 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCCertificate : NSObject - -/** Private key in PEM. */ -@property(nonatomic, readonly, copy) NSString *private_key; - -/** Public key in an x509 cert encoded in PEM. */ -@property(nonatomic, readonly, copy) NSString *certificate; - -/** - * Initialize an RTCCertificate with PEM strings for private_key and certificate. - */ -- (instancetype)initWithPrivateKey:(NSString *)private_key - certificate:(NSString *)certificate NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; - -/** Generate a new certificate for 're' use. - * - * Optional dictionary of parameters. Defaults to KeyType ECDSA if none are - * provided. - * - name: "ECDSA" or "RSASSA-PKCS1-v1_5" - */ -+ (nullable RTCCertificate *)generateCertificateWithParams:(NSDictionary *)params; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCCertificate.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCConfiguration.h b/sdk/objc/Framework/Headers/WebRTC/RTCConfiguration.h index 11ea6a3547..fe2f0cdfdb 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCConfiguration.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCConfiguration.h @@ -8,167 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -@class RTCIceServer; -@class RTCIntervalRange; - -/** - * Represents the ice transport policy. This exposes the same states in C++, - * which include one more state than what exists in the W3C spec. - */ -typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) { - RTCIceTransportPolicyNone, - RTCIceTransportPolicyRelay, - RTCIceTransportPolicyNoHost, - RTCIceTransportPolicyAll -}; - -/** Represents the bundle policy. */ -typedef NS_ENUM(NSInteger, RTCBundlePolicy) { - RTCBundlePolicyBalanced, - RTCBundlePolicyMaxCompat, - RTCBundlePolicyMaxBundle -}; - -/** Represents the rtcp mux policy. */ -typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire }; - -/** Represents the tcp candidate policy. */ -typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { - RTCTcpCandidatePolicyEnabled, - RTCTcpCandidatePolicyDisabled -}; - -/** Represents the candidate network policy. */ -typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) { - RTCCandidateNetworkPolicyAll, - RTCCandidateNetworkPolicyLowCost -}; - -/** Represents the continual gathering policy. */ -typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) { - RTCContinualGatheringPolicyGatherOnce, - RTCContinualGatheringPolicyGatherContinually -}; - -/** Represents the encryption key type. */ -typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) { - RTCEncryptionKeyTypeRSA, - RTCEncryptionKeyTypeECDSA, -}; - -/** Represents the chosen SDP semantics for the RTCPeerConnection. */ -typedef NS_ENUM(NSInteger, RTCSdpSemantics) { - RTCSdpSemanticsPlanB, - RTCSdpSemanticsUnifiedPlan, -}; - -NS_ASSUME_NONNULL_BEGIN -RTC_EXPORT -@interface RTCConfiguration : NSObject - -/** An array of Ice Servers available to be used by ICE. */ -@property(nonatomic, copy) NSArray *iceServers; - -/** An RTCCertificate for 're' use. */ -@property(nonatomic, nullable) RTCCertificate *certificate; - -/** Which candidates the ICE agent is allowed to use. The W3C calls it - * |iceTransportPolicy|, while in C++ it is called |type|. */ -@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; - -/** The media-bundling policy to use when gathering ICE candidates. */ -@property(nonatomic, assign) RTCBundlePolicy bundlePolicy; - -/** The rtcp-mux policy to use when gathering ICE candidates. */ -@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; -@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; -@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; -@property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; - -/** By default, the PeerConnection will use a limited number of IPv6 network - * interfaces, in order to avoid too many ICE candidate pairs being created - * and delaying ICE completion. - * - * Can be set to INT_MAX to effectively disable the limit. - */ -@property(nonatomic, assign) int maxIPv6Networks; - -/** Exclude link-local network interfaces - * from considertaion for gathering ICE candidates. - * Defaults to NO. - */ -@property(nonatomic, assign) BOOL disableLinkLocalNetworks; - -@property(nonatomic, assign) int audioJitterBufferMaxPackets; -@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate; -@property(nonatomic, assign) int iceConnectionReceivingTimeout; -@property(nonatomic, assign) int iceBackupCandidatePairPingInterval; - -/** Key type used to generate SSL identity. Default is ECDSA. */ -@property(nonatomic, assign) RTCEncryptionKeyType keyType; - -/** ICE candidate pool size as defined in JSEP. Default is 0. */ -@property(nonatomic, assign) int iceCandidatePoolSize; - -/** Prune turn ports on the same network to the same turn server. - * Default is NO. - */ -@property(nonatomic, assign) BOOL shouldPruneTurnPorts; - -/** If set to YES, this means the ICE transport should presume TURN-to-TURN - * candidate pairs will succeed, even before a binding response is received. - */ -@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed; - -/** If set to non-nil, controls the minimal interval between consecutive ICE - * check packets. - */ -@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; - -/** ICE Periodic Regathering - * If set, 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]. - */ -@property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange; - -/** Configure the SDP semantics used by this PeerConnection. Note that the - * WebRTC 1.0 specification requires UnifiedPlan semantics. The - * RTCRtpTransceiver API is only available with UnifiedPlan semantics. - * - * PlanB will cause RTCPeerConnection to create offers and answers with at - * most one audio and one video m= section with multiple RTCRtpSenders and - * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This - * will also cause RTCPeerConnection to ignore all but the first m= section of - * the same media type. - * - * UnifiedPlan will cause RTCPeerConnection to create offers and answers with - * multiple m= sections where each m= section maps to one RTCRtpSender and one - * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This - * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines - * that form a Plan B stream. - * - * For users who wish to send multiple audio/video streams and need to stay - * interoperable with legacy WebRTC implementations or use legacy APIs, - * specify PlanB. - * - * For all other users, specify UnifiedPlan. - */ -@property(nonatomic, assign) RTCSdpSemantics sdpSemantics; - -/** Actively reset the SRTP parameters when the DTLS transports underneath are - * changed after offer/answer negotiation. This is only intended to be a - * workaround for crbug.com/835958 - */ -@property(nonatomic, assign) BOOL activeResetSrtpParams; - -- (instancetype)init; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCConfiguration.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCDataChannel.h b/sdk/objc/Framework/Headers/WebRTC/RTCDataChannel.h index 4859e04bdb..4f35079471 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCDataChannel.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCDataChannel.h @@ -8,123 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCDataBuffer : NSObject - -/** NSData representation of the underlying buffer. */ -@property(nonatomic, readonly) NSData *data; - -/** Indicates whether |data| contains UTF-8 or binary data. */ -@property(nonatomic, readonly) BOOL isBinary; - -- (instancetype)init NS_UNAVAILABLE; - -/** - * Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data| - * contains UTF-8 or binary data. - */ -- (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary; - -@end - -@class RTCDataChannel; -RTC_EXPORT -@protocol RTCDataChannelDelegate - -/** The data channel state changed. */ -- (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel; - -/** The data channel successfully received a data buffer. */ -- (void)dataChannel:(RTCDataChannel *)dataChannel - didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer; - -@optional -/** The data channel's |bufferedAmount| changed. */ -- (void)dataChannel:(RTCDataChannel *)dataChannel didChangeBufferedAmount:(uint64_t)amount; - -@end - -/** Represents the state of the data channel. */ -typedef NS_ENUM(NSInteger, RTCDataChannelState) { - RTCDataChannelStateConnecting, - RTCDataChannelStateOpen, - RTCDataChannelStateClosing, - RTCDataChannelStateClosed, -}; - -RTC_EXPORT -@interface RTCDataChannel : NSObject - -/** - * A label that can be used to distinguish this data channel from other data - * channel objects. - */ -@property(nonatomic, readonly) NSString *label; - -/** Whether the data channel can send messages in unreliable mode. */ -@property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE; - -/** Returns whether this data channel is ordered or not. */ -@property(nonatomic, readonly) BOOL isOrdered; - -/** Deprecated. Use maxPacketLifeTime. */ -@property(nonatomic, readonly) NSUInteger maxRetransmitTime DEPRECATED_ATTRIBUTE; - -/** - * The length of the time window (in milliseconds) during which transmissions - * and retransmissions may occur in unreliable mode. - */ -@property(nonatomic, readonly) uint16_t maxPacketLifeTime; - -/** - * The maximum number of retransmissions that are attempted in unreliable mode. - */ -@property(nonatomic, readonly) uint16_t maxRetransmits; - -/** - * The name of the sub-protocol used with this data channel, if any. Otherwise - * this returns an empty string. - */ -@property(nonatomic, readonly) NSString *protocol; - -/** - * Returns whether this data channel was negotiated by the application or not. - */ -@property(nonatomic, readonly) BOOL isNegotiated; - -/** Deprecated. Use channelId. */ -@property(nonatomic, readonly) NSInteger streamId DEPRECATED_ATTRIBUTE; - -/** The identifier for this data channel. */ -@property(nonatomic, readonly) int channelId; - -/** The state of the data channel. */ -@property(nonatomic, readonly) RTCDataChannelState readyState; - -/** - * The number of bytes of application data that have been queued using - * |sendData:| but that have not yet been transmitted to the network. - */ -@property(nonatomic, readonly) uint64_t bufferedAmount; - -/** The delegate for this data channel. */ -@property(nonatomic, weak) id delegate; - -- (instancetype)init NS_UNAVAILABLE; - -/** Closes the data channel. */ -- (void)close; - -/** Attempt to send |data| on this data channel's underlying data transport. */ -- (BOOL)sendData:(RTCDataBuffer *)data; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCDataChannel.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h b/sdk/objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h index 65ca8f8d56..20cb4e1c51 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCDataChannelConfiguration.h @@ -8,45 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCDataChannelConfiguration : NSObject - -/** Set to YES if ordered delivery is required. */ -@property(nonatomic, assign) BOOL isOrdered; - -/** Deprecated. Use maxPacketLifeTime. */ -@property(nonatomic, assign) NSInteger maxRetransmitTimeMs DEPRECATED_ATTRIBUTE; - -/** - * Max period in milliseconds in which retransmissions will be sent. After this - * time, no more retransmissions will be sent. -1 if unset. - */ -@property(nonatomic, assign) int maxPacketLifeTime; - -/** The max number of retransmissions. -1 if unset. */ -@property(nonatomic, assign) int maxRetransmits; - -/** Set to YES if the channel has been externally negotiated and we do not send - * an in-band signalling in the form of an "open" message. - */ -@property(nonatomic, assign) BOOL isNegotiated; - -/** Deprecated. Use channelId. */ -@property(nonatomic, assign) int streamId DEPRECATED_ATTRIBUTE; - -/** The id of the data channel. */ -@property(nonatomic, assign) int channelId; - -/** Set by the application and opaque to the WebRTC implementation. */ -@property(nonatomic) NSString* protocol; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCDataChannelConfiguration.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoDecoderFactory.h b/sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoDecoderFactory.h new file mode 100644 index 0000000000..dc46f3f67b --- /dev/null +++ b/sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoDecoderFactory.h @@ -0,0 +1,11 @@ +/* + * Copyright 2017 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. + */ + +#import "components/video_codec/RTCDefaultVideoDecoderFactory.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoEncoderFactory.h b/sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoEncoderFactory.h new file mode 100644 index 0000000000..7588ffb84a --- /dev/null +++ b/sdk/objc/Framework/Headers/WebRTC/RTCDefaultVideoEncoderFactory.h @@ -0,0 +1,11 @@ +/* + * Copyright 2017 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. + */ + +#import "components/video_codec/RTCDefaultVideoEncoderFactory.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCDispatcher.h b/sdk/objc/Framework/Headers/WebRTC/RTCDispatcher.h index 03387471c4..2ae9cd89c8 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCDispatcher.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCDispatcher.h @@ -8,37 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -typedef NS_ENUM(NSInteger, RTCDispatcherQueueType) { - // Main dispatcher queue. - RTCDispatcherTypeMain, - // Used for starting/stopping AVCaptureSession, and assigning - // capture session to AVCaptureVideoPreviewLayer. - RTCDispatcherTypeCaptureSession, - // Used for operations on AVAudioSession. - RTCDispatcherTypeAudioSession, -}; - -/** Dispatcher that asynchronously dispatches blocks to a specific - * shared dispatch queue. - */ -RTC_EXPORT -@interface RTCDispatcher : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -/** Dispatch the block asynchronously on the queue for dispatchType. - * @param dispatchType The queue type to dispatch on. - * @param block The block to dispatch asynchronously. - */ -+ (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType block:(dispatch_block_t)block; - -/** Returns YES if run on queue for the dispatchType otherwise NO. - * Useful for asserting that a method is run on a correct queue. - */ -+ (BOOL)isOnQueueForType:(RTCDispatcherQueueType)dispatchType; - -@end +#import "helpers/RTCDispatcher.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCDtmfSender.h b/sdk/objc/Framework/Headers/WebRTC/RTCDtmfSender.h index c69af026b7..20407102c6 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCDtmfSender.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCDtmfSender.h @@ -8,63 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@protocol RTCDtmfSender - -/** - * Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise - * returns false. To be able to send DTMF, the associated RTCRtpSender must be - * able to send packets, and a "telephone-event" codec must be negotiated. - */ -@property(nonatomic, readonly) BOOL canInsertDtmf; - -/** - * Queues a task that sends the DTMF tones. The tones parameter is treated - * as a series of characters. The characters 0 through 9, A through D, #, and * - * generate the associated DTMF tones. The characters a to d are equivalent - * to A to D. The character ',' indicates a delay of 2 seconds before - * processing the next character in the tones parameter. - * - * Unrecognized characters are ignored. - * - * @param duration The parameter indicates the duration to use for each - * character passed in the tones parameter. The duration cannot be more - * than 6000 or less than 70 ms. - * - * @param interToneGap The parameter indicates the gap between tones. - * This parameter must be at least 50 ms but should be as short as - * possible. - * - * If InsertDtmf is called on the same object while an existing task for this - * object to generate DTMF is still running, the previous task is canceled. - * Returns true on success and false on failure. - */ -- (BOOL)insertDtmf:(nonnull NSString *)tones - duration:(NSTimeInterval)duration - interToneGap:(NSTimeInterval)interToneGap; - -/** The tones remaining to be played out */ -- (nonnull NSString *)remainingTones; - -/** - * The current tone duration value. This value will be the value last set via the - * insertDtmf method, or the default value of 100 ms if insertDtmf was never called. - */ -- (NSTimeInterval)duration; - -/** - * 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 50 ms if insertDtmf() was never - * called. - */ -- (NSTimeInterval)interToneGap; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCDtmfSender.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h b/sdk/objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h index 8fdd3c3c2f..ec5b1d7087 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCEAGLVideoView.h @@ -8,37 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCEAGLVideoView; - -RTC_EXPORT -@protocol RTCEAGLVideoViewDelegate -@end - -/** - * RTCEAGLVideoView is an RTCVideoRenderer which renders video frames in its - * bounds using OpenGLES 2.0 or OpenGLES 3.0. - */ -RTC_EXPORT -NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.") -@interface RTCEAGLVideoView : UIView - -@property(nonatomic, weak) id delegate; - -- (instancetype)initWithFrame:(CGRect)frame - shader:(id)shader NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithCoder:(NSCoder *)aDecoder - shader:(id)shader NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "components/renderer/opengl/RTCEAGLVideoView.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCFieldTrials.h b/sdk/objc/Framework/Headers/WebRTC/RTCFieldTrials.h index 3ce94ba937..386989abf0 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCFieldTrials.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCFieldTrials.h @@ -8,39 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -/** The only valid value for the following if set is kRTCFieldTrialEnabledValue. */ -RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweKey; -RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweForVideoKey; -RTC_EXTERN NSString * const kRTCFieldTrialAudioForceNoTWCCKey; -RTC_EXTERN NSString * const kRTCFieldTrialAudioForceABWENoTWCCKey; -RTC_EXTERN NSString * const kRTCFieldTrialSendSideBweWithOverheadKey; -RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03AdvertisedKey; -RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03Key; -RTC_EXTERN NSString * const kRTCFieldTrialImprovedBitrateEstimateKey; -RTC_EXTERN NSString * const kRTCFieldTrialH264HighProfileKey; -RTC_EXTERN NSString * const kRTCFieldTrialMinimizeResamplingOnMobileKey; - -/** The valid value for field trials above. */ -RTC_EXTERN NSString * const kRTCFieldTrialEnabledValue; - -/** Use a string returned by RTCFieldTrialMedianSlopeFilterValue as the value. */ -RTC_EXTERN NSString * const kRTCFieldTrialMedianSlopeFilterKey; -RTC_EXTERN NSString *RTCFieldTrialMedianSlopeFilterValue( - size_t windowSize, double thresholdGain); - -/** Use a string returned by RTCFieldTrialTrendlineFilterValue as the value. */ -RTC_EXTERN NSString * const kRTCFieldTrialTrendlineFilterKey; -/** Returns a valid value for kRTCFieldTrialTrendlineFilterKey. */ -RTC_EXTERN NSString *RTCFieldTrialTrendlineFilterValue( - size_t windowSize, double smoothingCoeff, double thresholdGain); - -/** Initialize field trials using a dictionary mapping field trial keys to their values. See above - * for valid keys and values. - * Must be called before any other call into WebRTC. See: - * webrtc/system_wrappers/include/field_trial_default.h - */ -RTC_EXTERN void RTCInitFieldTrialDictionary(NSDictionary *fieldTrials); +#import "api/peerconnection/RTCFieldTrials.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCFileLogger.h b/sdk/objc/Framework/Headers/WebRTC/RTCFileLogger.h index ac8a9104c1..ae7d9ef95f 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCFileLogger.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCFileLogger.h @@ -8,67 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) { - RTCFileLoggerSeverityVerbose, - RTCFileLoggerSeverityInfo, - RTCFileLoggerSeverityWarning, - RTCFileLoggerSeverityError -}; - -typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) { - RTCFileLoggerTypeCall, - RTCFileLoggerTypeApp, -}; - -NS_ASSUME_NONNULL_BEGIN - -// This class intercepts WebRTC logs and saves them to a file. The file size -// will not exceed the given maximum bytesize. When the maximum bytesize is -// reached, logs are rotated according to the rotationType specified. -// For kRTCFileLoggerTypeCall, logs from the beginning and the end -// are preserved while the middle section is overwritten instead. -// For kRTCFileLoggerTypeApp, the oldest log is overwritten. -// This class is not threadsafe. -RTC_EXPORT -@interface RTCFileLogger : NSObject - -// The severity level to capture. The default is kRTCFileLoggerSeverityInfo. -@property(nonatomic, assign) RTCFileLoggerSeverity severity; - -// The rotation type for this file logger. The default is -// kRTCFileLoggerTypeCall. -@property(nonatomic, readonly) RTCFileLoggerRotationType rotationType; - -// Disables buffering disk writes. Should be set before |start|. Buffering -// is enabled by default for performance. -@property(nonatomic, assign) BOOL shouldDisableBuffering; - -// Default constructor provides default settings for dir path, file size and -// rotation type. -- (instancetype)init; - -// Create file logger with default rotation type. -- (instancetype)initWithDirPath:(NSString *)dirPath maxFileSize:(NSUInteger)maxFileSize; - -- (instancetype)initWithDirPath:(NSString *)dirPath - maxFileSize:(NSUInteger)maxFileSize - rotationType:(RTCFileLoggerRotationType)rotationType NS_DESIGNATED_INITIALIZER; - -// Starts writing WebRTC logs to disk if not already started. Overwrites any -// existing file(s). -- (void)start; - -// Stops writing WebRTC logs to disk. This method is also called on dealloc. -- (void)stop; - -// Returns the current contents of the logs, or nil if start has been called -// without a stop. -- (nullable NSData *)logData; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCFileLogger.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h b/sdk/objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h index 7b898e494c..344eca9b00 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCFileVideoCapturer.h @@ -8,43 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Error passing block. - */ -typedef void (^RTCFileVideoCapturerErrorBlock)(NSError *error); - -/** - * Captures buffers from bundled video file. - * - * See @c RTCVideoCapturer for more info on capturers. - */ -RTC_EXPORT - -NS_CLASS_AVAILABLE_IOS(10) -@interface RTCFileVideoCapturer : RTCVideoCapturer - -/** - * Starts asynchronous capture of frames from video file. - * - * Capturing is not started if error occurs. Underlying error will be - * relayed in the errorBlock if one is provided. - * Successfully captured video frames will be passed to the delegate. - * - * @param nameOfFile The name of the bundled video file to be read. - * @errorBlock block to be executed upon error. - */ -- (void)startCapturingFromFileNamed:(NSString *)nameOfFile - onError:(__nullable RTCFileVideoCapturerErrorBlock)errorBlock; - -/** - * Immediately stops capture. - */ -- (void)stopCapture; -@end - -NS_ASSUME_NONNULL_END +#import "components/capturer/RTCFileVideoCapturer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h b/sdk/objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h new file mode 100644 index 0000000000..57798148a0 --- /dev/null +++ b/sdk/objc/Framework/Headers/WebRTC/RTCH264ProfileLevelId.h @@ -0,0 +1,11 @@ +/* + * Copyright 2017 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. + */ + +#import "components/video_codec/RTCH264ProfileLevelId.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCIceCandidate.h b/sdk/objc/Framework/Headers/WebRTC/RTCIceCandidate.h index fb5064e518..dbeea22000 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCIceCandidate.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCIceCandidate.h @@ -8,42 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCIceCandidate : NSObject - -/** - * If present, the identifier of the "media stream identification" for the media - * component this candidate is associated with. - */ -@property(nonatomic, readonly, nullable) NSString *sdpMid; - -/** - * The index (starting at zero) of the media description this candidate is - * associated with in the SDP. - */ -@property(nonatomic, readonly) int sdpMLineIndex; - -/** The SDP string for this candidate. */ -@property(nonatomic, readonly) NSString *sdp; - -/** The URL of the ICE server which this candidate is gathered from. */ -@property(nonatomic, readonly, nullable) NSString *serverUrl; - -- (instancetype)init NS_UNAVAILABLE; - -/** - * Initialize an RTCIceCandidate from SDP. - */ -- (instancetype)initWithSdp:(NSString *)sdp - sdpMLineIndex:(int)sdpMLineIndex - sdpMid:(nullable NSString *)sdpMid NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCIceCandidate.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCIceServer.h b/sdk/objc/Framework/Headers/WebRTC/RTCIceServer.h index 727da8acbe..967b19c066 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCIceServer.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCIceServer.h @@ -8,107 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) { - RTCTlsCertPolicySecure, - RTCTlsCertPolicyInsecureNoCheck -}; - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCIceServer : NSObject - -/** URI(s) for this server represented as NSStrings. */ -@property(nonatomic, readonly) NSArray *urlStrings; - -/** Username to use if this RTCIceServer object is a TURN server. */ -@property(nonatomic, readonly, nullable) NSString *username; - -/** Credential to use if this RTCIceServer object is a TURN server. */ -@property(nonatomic, readonly, nullable) NSString *credential; - -/** - * TLS certificate policy to use if this RTCIceServer object is a TURN server. - */ -@property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy; - -/** - 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. - */ -@property(nonatomic, readonly, nullable) NSString *hostname; - -/** List of protocols to be used in the TLS ALPN extension. */ -@property(nonatomic, readonly) NSArray *tlsAlpnProtocols; - -/** - List elliptic curves to be used in the TLS elliptic curves extension. - Only curve names supported by OpenSSL should be used (eg. "P-256","X25519"). - */ -@property(nonatomic, readonly) NSArray *tlsEllipticCurves; - -- (nonnull instancetype)init NS_UNAVAILABLE; - -/** Convenience initializer for a server with no authentication (e.g. STUN). */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings; - -/** - * Initialize an RTCIceServer with its associated URLs, optional username, - * optional credential, and credentialType. - */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings - username:(nullable NSString *)username - credential:(nullable NSString *)credential; - -/** - * Initialize an RTCIceServer with its associated URLs, optional username, - * optional credential, and TLS cert policy. - */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings - username:(nullable NSString *)username - credential:(nullable NSString *)credential - tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy; - -/** - * Initialize an RTCIceServer with its associated URLs, optional username, - * optional credential, TLS cert policy and hostname. - */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings - username:(nullable NSString *)username - credential:(nullable NSString *)credential - tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy - hostname:(nullable NSString *)hostname; - -/** - * Initialize an RTCIceServer with its associated URLs, optional username, - * optional credential, TLS cert policy, hostname and ALPN protocols. - */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings - username:(nullable NSString *)username - credential:(nullable NSString *)credential - tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy - hostname:(nullable NSString *)hostname - tlsAlpnProtocols:(NSArray *)tlsAlpnProtocols; - -/** - * Initialize an RTCIceServer with its associated URLs, optional username, - * optional credential, TLS cert policy, hostname, ALPN protocols and - * elliptic curves. - */ -- (instancetype)initWithURLStrings:(NSArray *)urlStrings - username:(nullable NSString *)username - credential:(nullable NSString *)credential - tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy - hostname:(nullable NSString *)hostname - tlsAlpnProtocols:(nullable NSArray *)tlsAlpnProtocols - tlsEllipticCurves:(nullable NSArray *)tlsEllipticCurves - NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCIceServer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h b/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h index 00508eba17..65726ee762 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCIntervalRange.h @@ -8,18 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RTCIntervalRange : NSObject - -@property(nonatomic, readonly) NSInteger min; -@property(nonatomic, readonly) NSInteger max; - -- (instancetype)init; -- (instancetype)initWithMin:(NSInteger)min max:(NSInteger)max NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCIntervalRange.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h b/sdk/objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h index 14d996c1ce..a727a495fc 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCLegacyStatsReport.h @@ -8,30 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** This does not currently conform to the spec. */ -RTC_EXPORT -@interface RTCLegacyStatsReport : NSObject - -/** Time since 1970-01-01T00:00:00Z in milliseconds. */ -@property(nonatomic, readonly) CFTimeInterval timestamp; - -/** The type of stats held by this object. */ -@property(nonatomic, readonly) NSString *type; - -/** The identifier for this object. */ -@property(nonatomic, readonly) NSString *reportId; - -/** A dictionary holding the actual stats. */ -@property(nonatomic, readonly) NSDictionary *values; - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCLegacyStatsReport.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCLogging.h b/sdk/objc/Framework/Headers/WebRTC/RTCLogging.h index b758785115..bb5e25dbde 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCLogging.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCLogging.h @@ -8,59 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -// Subset of rtc::LoggingSeverity. -typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { - RTCLoggingSeverityVerbose, - RTCLoggingSeverityInfo, - RTCLoggingSeverityWarning, - RTCLoggingSeverityError, -}; - -// Wrapper for C++ RTC_LOG(sev) macros. -// Logs the log string to the webrtc logstream for the given severity. -RTC_EXTERN void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); - -// Wrapper for rtc::LogMessage::LogToDebug. -// Sets the minimum severity to be logged to console. -RTC_EXTERN void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); - -// Returns the filename with the path prefix removed. -RTC_EXTERN NSString* RTCFileName(const char* filePath); - -// Some convenience macros. - -#define RTCLogString(format, ...) \ - [NSString stringWithFormat:@"(%@:%d %s): " format, RTCFileName(__FILE__), \ - __LINE__, __FUNCTION__, ##__VA_ARGS__] - -#define RTCLogFormat(severity, format, ...) \ - do { \ - NSString* log_string = RTCLogString(format, ##__VA_ARGS__); \ - RTCLogEx(severity, log_string); \ - } while (false) - -#define RTCLogVerbose(format, ...) \ - RTCLogFormat(RTCLoggingSeverityVerbose, format, ##__VA_ARGS__) - -#define RTCLogInfo(format, ...) \ - RTCLogFormat(RTCLoggingSeverityInfo, format, ##__VA_ARGS__) - -#define RTCLogWarning(format, ...) \ - RTCLogFormat(RTCLoggingSeverityWarning, format, ##__VA_ARGS__) - -#define RTCLogError(format, ...) \ - RTCLogFormat(RTCLoggingSeverityError, format, ##__VA_ARGS__) - -#if !defined(NDEBUG) -#define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__) -#else -#define RTCLogDebug(format, ...) \ - do { \ - } while (false) -#endif - -#define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__) +#import "base/RTCLogging.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h b/sdk/objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h index d28d554d9a..4368a8a95b 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMTLNSVideoView.h @@ -8,13 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import "WebRTC/RTCVideoRenderer.h" - -NS_AVAILABLE_MAC(10.11) -@interface RTCMTLNSVideoView : NSView - -@property(nonatomic, weak) id delegate; - -+ (BOOL)isMetalAvailable; -@end +#import "components/renderer/metal/RTCMTLNSVideoView.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMTLVideoView.h b/sdk/objc/Framework/Headers/WebRTC/RTCMTLVideoView.h index 0615495035..9f43dc5613 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMTLVideoView.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMTLVideoView.h @@ -8,44 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoRenderer.h" - -// Check if metal is supported in WebRTC. -// NOTE: Currently arm64 == Metal. -#if defined(__aarch64__) -#define RTC_SUPPORTS_METAL -#endif - -NS_ASSUME_NONNULL_BEGIN - -/** - * RTCMTLVideoView is thin wrapper around MTKView. - * - * It has id property that renders video frames in the view's - * bounds using Metal. - * NOTE: always check if metal is available on the running device via - * RTC_SUPPORTS_METAL macro before initializing this class. - */ -NS_CLASS_AVAILABLE_IOS(9) - -RTC_EXPORT -@interface RTCMTLVideoView : UIView - -@property(nonatomic, weak) id delegate; - -@property(nonatomic) UIViewContentMode videoContentMode; - -/** @abstract Enables/disables rendering. - */ -@property(nonatomic, getter=isEnabled) BOOL enabled; - -/** @abstract Wrapped RTCVideoRotation, or nil. - */ -@property(nonatomic, nullable) NSValue* rotationOverride; - -@end - -NS_ASSUME_NONNULL_END +#import "components/renderer/metal/RTCMTLVideoView.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMacros.h b/sdk/objc/Framework/Headers/WebRTC/RTCMacros.h index 08cb93829a..8582a33600 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMacros.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMacros.h @@ -8,21 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_HEADERS_WEBRTC_RTCMACROS_H_ -#define SDK_OBJC_FRAMEWORK_HEADERS_WEBRTC_RTCMACROS_H_ - -#define RTC_EXPORT __attribute__((visibility("default"))) - -#if defined(__cplusplus) -#define RTC_EXTERN extern "C" RTC_EXPORT -#else -#define RTC_EXTERN extern RTC_EXPORT -#endif - -#ifdef __OBJC__ -#define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname -#else -#define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname -#endif - -#endif // SDK_OBJC_FRAMEWORK_HEADERS_WEBRTC_RTCMACROS_H_ +#import "base/RTCMacros.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMediaConstraints.h b/sdk/objc/Framework/Headers/WebRTC/RTCMediaConstraints.h index fce08212e9..1059725c05 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMediaConstraints.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMediaConstraints.h @@ -8,47 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** Constraint keys for media sources. */ -RTC_EXTERN NSString *const kRTCMediaConstraintsMinAspectRatio; -RTC_EXTERN NSString *const kRTCMediaConstraintsMaxAspectRatio; -RTC_EXTERN NSString *const kRTCMediaConstraintsMaxWidth; -RTC_EXTERN NSString *const kRTCMediaConstraintsMinWidth; -RTC_EXTERN NSString *const kRTCMediaConstraintsMaxHeight; -RTC_EXTERN NSString *const kRTCMediaConstraintsMinHeight; -RTC_EXTERN NSString *const kRTCMediaConstraintsMaxFrameRate; -RTC_EXTERN NSString *const kRTCMediaConstraintsMinFrameRate; -/** The value for this key should be a base64 encoded string containing - * the data from the serialized configuration proto. - */ -RTC_EXTERN NSString *const kRTCMediaConstraintsAudioNetworkAdaptorConfig; - -/** Constraint keys for generating offers and answers. */ -RTC_EXTERN NSString *const kRTCMediaConstraintsIceRestart; -RTC_EXTERN NSString *const kRTCMediaConstraintsOfferToReceiveAudio; -RTC_EXTERN NSString *const kRTCMediaConstraintsOfferToReceiveVideo; -RTC_EXTERN NSString *const kRTCMediaConstraintsVoiceActivityDetection; - -/** Constraint values for Boolean parameters. */ -RTC_EXTERN NSString *const kRTCMediaConstraintsValueTrue; -RTC_EXTERN NSString *const kRTCMediaConstraintsValueFalse; - -RTC_EXPORT -@interface RTCMediaConstraints : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -/** Initialize with mandatory and/or optional constraints. */ -- (instancetype) - initWithMandatoryConstraints:(nullable NSDictionary *)mandatory - optionalConstraints:(nullable NSDictionary *)optional - NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCMediaConstraints.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMediaSource.h b/sdk/objc/Framework/Headers/WebRTC/RTCMediaSource.h index 6cfcb7d2ce..f642524d2a 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMediaSource.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMediaSource.h @@ -8,27 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -typedef NS_ENUM(NSInteger, RTCSourceState) { - RTCSourceStateInitializing, - RTCSourceStateLive, - RTCSourceStateEnded, - RTCSourceStateMuted, -}; - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCMediaSource : NSObject - -/** The current state of the RTCMediaSource. */ -@property(nonatomic, readonly) RTCSourceState state; - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCMediaSource.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMediaStream.h b/sdk/objc/Framework/Headers/WebRTC/RTCMediaStream.h index b97960d436..9b4d03213c 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMediaStream.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMediaStream.h @@ -8,42 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCAudioTrack; -@class RTCPeerConnectionFactory; -@class RTCVideoTrack; - -RTC_EXPORT -@interface RTCMediaStream : NSObject - -/** The audio tracks in this stream. */ -@property(nonatomic, strong, readonly) NSArray *audioTracks; - -/** The video tracks in this stream. */ -@property(nonatomic, strong, readonly) NSArray *videoTracks; - -/** An identifier for this media stream. */ -@property(nonatomic, readonly) NSString *streamId; - -- (instancetype)init NS_UNAVAILABLE; - -/** Adds the given audio track to this media stream. */ -- (void)addAudioTrack:(RTCAudioTrack *)audioTrack; - -/** Adds the given video track to this media stream. */ -- (void)addVideoTrack:(RTCVideoTrack *)videoTrack; - -/** Removes the given audio track to this media stream. */ -- (void)removeAudioTrack:(RTCAudioTrack *)audioTrack; - -/** Removes the given video track to this media stream. */ -- (void)removeVideoTrack:(RTCVideoTrack *)videoTrack; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCMediaStream.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h b/sdk/objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h index aee9bdd0a0..9de0edbfbd 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMediaStreamTrack.h @@ -8,43 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -/** - * Represents the state of the track. This exposes the same states in C++. - */ -typedef NS_ENUM(NSInteger, RTCMediaStreamTrackState) { - RTCMediaStreamTrackStateLive, - RTCMediaStreamTrackStateEnded -}; - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXTERN NSString *const kRTCMediaStreamTrackKindAudio; -RTC_EXTERN NSString *const kRTCMediaStreamTrackKindVideo; - -RTC_EXPORT -@interface RTCMediaStreamTrack : NSObject - -/** - * The kind of track. For example, "audio" if this track represents an audio - * track and "video" if this track represents a video track. - */ -@property(nonatomic, readonly) NSString *kind; - -/** An identifier string. */ -@property(nonatomic, readonly) NSString *trackId; - -/** The enabled state of the track. */ -@property(nonatomic, assign) BOOL isEnabled; - -/** The state of the track. */ -@property(nonatomic, readonly) RTCMediaStreamTrackState readyState; - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCMediaStreamTrack.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMetrics.h b/sdk/objc/Framework/Headers/WebRTC/RTCMetrics.h index cc89888219..b44289ea34 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMetrics.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMetrics.h @@ -8,16 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -/** - * Enables gathering of metrics (which can be fetched with - * RTCGetAndResetMetrics). Must be called before any other call into WebRTC. - */ -RTC_EXTERN void RTCEnableMetrics(void); - -/** Gets and clears native histograms. */ -RTC_EXTERN NSArray* RTCGetAndResetMetrics(void); +#import "api/peerconnection/RTCMetrics.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h b/sdk/objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h index f01bea9b71..5ee84c1457 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCMetricsSampleInfo.h @@ -8,41 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCMetricsSampleInfo : NSObject - -/** - * Example of RTCMetricsSampleInfo: - * name: "WebRTC.Video.InputFramesPerSecond" - * min: 1 - * max: 100 - * bucketCount: 50 - * samples: [29]:2 [30]:1 - */ - -/** The name of the histogram. */ -@property(nonatomic, readonly) NSString *name; - -/** The minimum bucket value. */ -@property(nonatomic, readonly) int min; - -/** The maximum bucket value. */ -@property(nonatomic, readonly) int max; - -/** The number of buckets. */ -@property(nonatomic, readonly) int bucketCount; - -/** A dictionary holding the samples . */ -@property(nonatomic, readonly) NSDictionary *samples; - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCMetricsSampleInfo.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h b/sdk/objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h index 77e301f189..3fa89aa30e 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCNSGLVideoView.h @@ -8,32 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#if !TARGET_OS_IPHONE - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCNSGLVideoView; - -@protocol RTCNSGLVideoViewDelegate -@end - -@interface RTCNSGLVideoView : NSOpenGLView - -@property(nonatomic, weak) id delegate; - -- (instancetype)initWithFrame:(NSRect)frameRect - pixelFormat:(NSOpenGLPixelFormat *)format - shader:(id)shader NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END - -#endif +#import "components/renderer/opengl/RTCNSGLVideoView.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnection.h b/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnection.h index 90fff25c67..df9bc85cdd 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnection.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnection.h @@ -8,309 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -@class RTCConfiguration; -@class RTCDataChannel; -@class RTCDataChannelConfiguration; -@class RTCIceCandidate; -@class RTCMediaConstraints; -@class RTCMediaStream; -@class RTCMediaStreamTrack; -@class RTCPeerConnectionFactory; -@class RTCRtpReceiver; -@class RTCRtpSender; -@class RTCRtpTransceiver; -@class RTCRtpTransceiverInit; -@class RTCSessionDescription; -@class RTCLegacyStatsReport; - -typedef NS_ENUM(NSInteger, RTCRtpMediaType); - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const kRTCPeerConnectionErrorDomain; -extern int const kRTCSessionDescriptionErrorCode; - -/** Represents the signaling state of the peer connection. */ -typedef NS_ENUM(NSInteger, RTCSignalingState) { - RTCSignalingStateStable, - RTCSignalingStateHaveLocalOffer, - RTCSignalingStateHaveLocalPrAnswer, - RTCSignalingStateHaveRemoteOffer, - RTCSignalingStateHaveRemotePrAnswer, - // Not an actual state, represents the total number of states. - RTCSignalingStateClosed, -}; - -/** Represents the ice connection state of the peer connection. */ -typedef NS_ENUM(NSInteger, RTCIceConnectionState) { - RTCIceConnectionStateNew, - RTCIceConnectionStateChecking, - RTCIceConnectionStateConnected, - RTCIceConnectionStateCompleted, - RTCIceConnectionStateFailed, - RTCIceConnectionStateDisconnected, - RTCIceConnectionStateClosed, - RTCIceConnectionStateCount, -}; - -/** Represents the ice gathering state of the peer connection. */ -typedef NS_ENUM(NSInteger, RTCIceGatheringState) { - RTCIceGatheringStateNew, - RTCIceGatheringStateGathering, - RTCIceGatheringStateComplete, -}; - -/** Represents the stats output level. */ -typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { - RTCStatsOutputLevelStandard, - RTCStatsOutputLevelDebug, -}; - -@class RTCPeerConnection; - -RTC_EXPORT -@protocol RTCPeerConnectionDelegate - -/** Called when the SignalingState changed. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didChangeSignalingState:(RTCSignalingState)stateChanged; - -/** Called when media is received on a new stream from remote peer. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection didAddStream:(RTCMediaStream *)stream; - -/** Called when a remote peer closes a stream. - * This is not called when RTCSdpSemanticsUnifiedPlan is specified. - */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection didRemoveStream:(RTCMediaStream *)stream; - -/** Called when negotiation is needed, for example ICE has restarted. */ -- (void)peerConnectionShouldNegotiate:(RTCPeerConnection *)peerConnection; - -/** Called any time the IceConnectionState changes. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didChangeIceConnectionState:(RTCIceConnectionState)newState; - -/** Called any time the IceGatheringState changes. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didChangeIceGatheringState:(RTCIceGatheringState)newState; - -/** New ice candidate has been found. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didGenerateIceCandidate:(RTCIceCandidate *)candidate; - -/** Called when a group of local Ice candidates have been removed. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didRemoveIceCandidates:(NSArray *)candidates; - -/** New data channel has been opened. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didOpenDataChannel:(RTCDataChannel *)dataChannel; - -/** Called when signaling indicates a transceiver will be receiving media from - * the remote endpoint. - * This is only called with RTCSdpSemanticsUnifiedPlan specified. - */ -@optional -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didStartReceivingOnTransceiver:(RTCRtpTransceiver *)transceiver; - -/** Called when a receiver and its track are created. */ -@optional -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didAddReceiver:(RTCRtpReceiver *)rtpReceiver - streams:(NSArray *)mediaStreams; - -/** Called when the receiver and its track are removed. */ -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didRemoveReceiver:(RTCRtpReceiver *)rtpReceiver; - -@end - -RTC_EXPORT -@interface RTCPeerConnection : NSObject - -/** The object that will be notifed about events such as state changes and - * streams being added or removed. - */ -@property(nonatomic, weak, nullable) id delegate; -/** This property is not available with RTCSdpSemanticsUnifiedPlan. Please use - * |senders| instead. - */ -@property(nonatomic, readonly) NSArray *localStreams; -@property(nonatomic, readonly, nullable) RTCSessionDescription *localDescription; -@property(nonatomic, readonly, nullable) RTCSessionDescription *remoteDescription; -@property(nonatomic, readonly) RTCSignalingState signalingState; -@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState; -@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState; -@property(nonatomic, readonly, copy) RTCConfiguration *configuration; - -/** Gets all RTCRtpSenders associated with this peer connection. - * Note: reading this property returns different instances of RTCRtpSender. - * Use isEqual: instead of == to compare RTCRtpSender instances. - */ -@property(nonatomic, readonly) NSArray *senders; - -/** Gets all RTCRtpReceivers associated with this peer connection. - * Note: reading this property returns different instances of RTCRtpReceiver. - * Use isEqual: instead of == to compare RTCRtpReceiver instances. - */ -@property(nonatomic, readonly) NSArray *receivers; - -/** Gets all RTCRtpTransceivers associated with this peer connection. - * Note: reading this property returns different instances of - * RTCRtpTransceiver. Use isEqual: instead of == to compare RTCRtpTransceiver - * instances. - * This is only available with RTCSdpSemanticsUnifiedPlan specified. - */ -@property(nonatomic, readonly) NSArray *transceivers; - -- (instancetype)init NS_UNAVAILABLE; - -/** Sets the PeerConnection's global configuration to |configuration|. - * Any changes to STUN/TURN servers or ICE candidate policy will affect the - * next gathering phase, and cause the next call to createOffer to generate - * new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies - * cannot be changed with this method. - */ -- (BOOL)setConfiguration:(RTCConfiguration *)configuration; - -/** Terminate all media and close the transport. */ -- (void)close; - -/** Provide a remote candidate to the ICE Agent. */ -- (void)addIceCandidate:(RTCIceCandidate *)candidate; - -/** Remove a group of remote candidates from the ICE Agent. */ -- (void)removeIceCandidates:(NSArray *)candidates; - -/** Add a new media stream to be sent on this peer connection. - * This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use - * addTrack instead. - */ -- (void)addStream:(RTCMediaStream *)stream; - -/** Remove the given media stream from this peer connection. - * This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use - * removeTrack instead. - */ -- (void)removeStream:(RTCMediaStream *)stream; - -/** Add a new media stream track to be sent on this peer connection, and return - * the newly created RTCRtpSender. The RTCRtpSender will be associated with - * the streams specified in the |streamIds| list. - * - * Errors: If an error occurs, returns nil. An error can occur if: - * - A sender already exists for the track. - * - The peer connection is closed. - */ -- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track streamIds:(NSArray *)streamIds; - -/** With PlanB semantics, removes an RTCRtpSender from this peer connection. - * - * With UnifiedPlan semantics, sets sender's track to null and removes the - * send component from the associated RTCRtpTransceiver's direction. - * - * Returns YES on success. - */ -- (BOOL)removeTrack:(RTCRtpSender *)sender; - -/** addTransceiver creates a new RTCRtpTransceiver and adds it to the set of - * transceivers. Adding a transceiver will cause future calls to CreateOffer - * to add a media description for the corresponding transceiver. - * - * The initial value of |mid| in the returned transceiver is nil. Setting a - * new session description may change it to a non-nil value. - * - * https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver - * - * Optionally, an RtpTransceiverInit structure can be specified to configure - * the transceiver from construction. If not specified, the transceiver will - * default to having a direction of kSendRecv and not be part of any streams. - * - * These methods are only available when Unified Plan is enabled (see - * RTCConfiguration). - */ - -/** Adds a transceiver with a sender set to transmit the given track. The kind - * of the transceiver (and sender/receiver) will be derived from the kind of - * the track. - */ -- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track; -- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track - init:(RTCRtpTransceiverInit *)init; - -/** Adds a transceiver with the given kind. Can either be RTCRtpMediaTypeAudio - * or RTCRtpMediaTypeVideo. - */ -- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType; -- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType - init:(RTCRtpTransceiverInit *)init; - -/** Generate an SDP offer. */ -- (void)offerForConstraints:(RTCMediaConstraints *)constraints - completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp, - NSError *_Nullable error))completionHandler; - -/** Generate an SDP answer. */ -- (void)answerForConstraints:(RTCMediaConstraints *)constraints - completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp, - NSError *_Nullable error))completionHandler; - -/** Apply the supplied RTCSessionDescription as the local description. */ -- (void)setLocalDescription:(RTCSessionDescription *)sdp - completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler; - -/** Apply the supplied RTCSessionDescription as the remote description. */ -- (void)setRemoteDescription:(RTCSessionDescription *)sdp - completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler; - -/** Limits the bandwidth allocated for all RTP streams sent by this - * PeerConnection. Nil parameters will be unchanged. Setting - * |currentBitrateBps| will force the available bitrate estimate to the given - * value. Returns YES if the parameters were successfully updated. - */ -- (BOOL)setBweMinBitrateBps:(nullable NSNumber *)minBitrateBps - currentBitrateBps:(nullable NSNumber *)currentBitrateBps - maxBitrateBps:(nullable NSNumber *)maxBitrateBps; - -/** Start or stop recording an Rtc EventLog. */ -- (BOOL)startRtcEventLogWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes; -- (void)stopRtcEventLog; - -@end - -@interface RTCPeerConnection (Media) - -/** Create an RTCRtpSender with the specified kind and media stream ID. - * See RTCMediaStreamTrack.h for available kinds. - * This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use - * addTransceiver instead. - */ -- (RTCRtpSender *)senderWithKind:(NSString *)kind streamId:(NSString *)streamId; - -@end - -@interface RTCPeerConnection (DataChannel) - -/** Create a new data channel with the given label and configuration. */ -- (nullable RTCDataChannel *)dataChannelForLabel:(NSString *)label - configuration:(RTCDataChannelConfiguration *)configuration; - -@end - -@interface RTCPeerConnection (Stats) - -/** Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil - * statistics are gathered for all tracks. - */ -- (void)statsForTrack:(nullable RTCMediaStreamTrack *)mediaStreamTrack - statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel - completionHandler:(nullable void (^)(NSArray *stats))completionHandler; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCPeerConnection.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h b/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h index 7f7b7e6c4c..ff544a00c8 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactory.h @@ -8,74 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCAudioSource; -@class RTCAudioTrack; -@class RTCConfiguration; -@class RTCMediaConstraints; -@class RTCMediaStream; -@class RTCPeerConnection; -@class RTCVideoSource; -@class RTCVideoTrack; -@class RTCPeerConnectionFactoryOptions; -@protocol RTCPeerConnectionDelegate; -@protocol RTCVideoDecoderFactory; -@protocol RTCVideoEncoderFactory; - -RTC_EXPORT -@interface RTCPeerConnectionFactory : NSObject - -/* Initialize object with default H264 video encoder/decoder factories */ -- (instancetype)init; - -/* Initialize object with injectable video encoder/decoder factories */ -- (instancetype)initWithEncoderFactory:(nullable id)encoderFactory - decoderFactory:(nullable id)decoderFactory; - -/** Initialize an RTCAudioSource with constraints. */ -- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints; - -/** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source with no - * constraints. - */ -- (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId; - -/** Initialize an RTCAudioTrack with a source and an id. */ -- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source trackId:(NSString *)trackId; - -/** Initialize a generic RTCVideoSource. The RTCVideoSource should be passed to a RTCVideoCapturer - * implementation, e.g. RTCCameraVideoCapturer, in order to produce frames. - */ -- (RTCVideoSource *)videoSource; - -/** Initialize an RTCVideoTrack with a source and an id. */ -- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source trackId:(NSString *)trackId; - -/** Initialize an RTCMediaStream with an id. */ -- (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId; - -/** Initialize an RTCPeerConnection with a configuration, constraints, and - * delegate. - */ -- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration - constraints:(RTCMediaConstraints *)constraints - delegate: - (nullable id)delegate; - -/** Set the options to be used for subsequently created RTCPeerConnections */ -- (void)setOptions:(nonnull RTCPeerConnectionFactoryOptions *)options; - -/** Start an AecDump recording. This API call will likely change in the future. */ -- (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes; - -/* Stop an active AecDump recording */ -- (void)stopAecDump; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCPeerConnectionFactory.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h b/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h index 725c834440..c4699c963e 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCPeerConnectionFactoryOptions.h @@ -8,35 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCPeerConnectionFactoryOptions : NSObject - -@property(nonatomic, assign) BOOL disableEncryption; - -@property(nonatomic, assign) BOOL disableNetworkMonitor; - -@property(nonatomic, assign) BOOL ignoreLoopbackNetworkAdapter; - -@property(nonatomic, assign) BOOL ignoreVPNNetworkAdapter; - -@property(nonatomic, assign) BOOL ignoreCellularNetworkAdapter; - -@property(nonatomic, assign) BOOL ignoreWiFiNetworkAdapter; - -@property(nonatomic, assign) BOOL ignoreEthernetNetworkAdapter; - -@property(nonatomic, assign) BOOL enableAes128Sha1_32CryptoCipher; - -@property(nonatomic, assign) BOOL enableGcmCryptoSuites; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCPeerConnectionFactoryOptions.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtcpParameters.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtcpParameters.h index 54b254c373..28f4f5fcfc 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtcpParameters.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtcpParameters.h @@ -8,23 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCRtcpParameters : NSObject - -/** The Canonical Name used by RTCP. */ -@property(nonatomic, readonly, copy) NSString *cname; - -/** Whether reduced size RTCP is configured or compound RTCP. */ -@property(nonatomic, assign) BOOL isReducedSize; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtcpParameters.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h index bb9aa90507..d4b76012f9 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpCodecParameters.h @@ -8,66 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXTERN const NSString *const kRTCRtxCodecName; -RTC_EXTERN const NSString *const kRTCRedCodecName; -RTC_EXTERN const NSString *const kRTCUlpfecCodecName; -RTC_EXTERN const NSString *const kRTCFlexfecCodecName; -RTC_EXTERN const NSString *const kRTCOpusCodecName; -RTC_EXTERN const NSString *const kRTCIsacCodecName; -RTC_EXTERN const NSString *const kRTCL16CodecName; -RTC_EXTERN const NSString *const kRTCG722CodecName; -RTC_EXTERN const NSString *const kRTCIlbcCodecName; -RTC_EXTERN const NSString *const kRTCPcmuCodecName; -RTC_EXTERN const NSString *const kRTCPcmaCodecName; -RTC_EXTERN const NSString *const kRTCDtmfCodecName; -RTC_EXTERN const NSString *const kRTCComfortNoiseCodecName; -RTC_EXTERN const NSString *const kRTCVp8CodecName; -RTC_EXTERN const NSString *const kRTCVp9CodecName; -RTC_EXTERN const NSString *const kRTCH264CodecName; - -/** Defined in http://w3c.github.io/webrtc-pc/#idl-def-RTCRtpCodecParameters */ -RTC_EXPORT -@interface RTCRtpCodecParameters : NSObject - -/** The RTP payload type. */ -@property(nonatomic, assign) int payloadType; - -/** - * The codec MIME subtype. Valid types are listed in: - * http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2 - * - * Several supported types are represented by the constants above. - */ -@property(nonatomic, readonly, nonnull) NSString *name; - -/** - * The media type of this codec. Equivalent to MIME top-level type. - * - * Valid values are kRTCMediaStreamTrackKindAudio and - * kRTCMediaStreamTrackKindVideo. - */ -@property(nonatomic, readonly, nonnull) NSString *kind; - -/** The codec clock rate expressed in Hertz. */ -@property(nonatomic, readonly, nullable) NSNumber *clockRate; - -/** - * The number of channels (mono=1, stereo=2). - * Set to null for video codecs. - **/ -@property(nonatomic, readonly, nullable) NSNumber *numChannels; - -/** The "format specific parameters" field from the "a=fmtp" line in the SDP */ -@property(nonatomic, readonly, nonnull) NSDictionary *parameters; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpCodecParameters.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h index 5ba0176449..a1510ba98f 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpEncodingParameters.h @@ -8,35 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCRtpEncodingParameters : NSObject - -/** Controls whether the encoding is currently transmitted. */ -@property(nonatomic, assign) BOOL isActive; - -/** The maximum bitrate to use for the encoding, or nil if there is no - * limit. - */ -@property(nonatomic, copy, nullable) NSNumber *maxBitrateBps; - -/** The minimum bitrate to use for the encoding, or nil if there is no - * limit. - * - * Not implemented. - */ -@property(nonatomic, copy, nullable) NSNumber *minBitrateBps; - -/** The SSRC being used by this encoding. */ -@property(nonatomic, readonly, nullable) NSNumber *ssrc; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpEncodingParameters.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h index b89eb063e2..3bc6b2ba54 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpHeaderExtension.h @@ -8,26 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCRtpHeaderExtension : NSObject - -/** The URI of the RTP header extension, as defined in RFC5285. */ -@property(nonatomic, readonly, copy) NSString *uri; - -/** The value put in the RTP packet to identify the header extension. */ -@property(nonatomic, readonly) int id; - -/** Whether the header extension is encrypted or not. */ -@property(nonatomic, readonly, getter=isEncrypted) BOOL encrypted; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpHeaderExtension.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpParameters.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpParameters.h index 8f0993489d..0e5b7e2178 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpParameters.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpParameters.h @@ -8,36 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCRtpParameters : NSObject - -/** A unique identifier for the last set of parameters applied. */ -@property(nonatomic, copy) NSString *transactionId; - -/** Parameters used for RTCP. */ -@property(nonatomic, readonly, copy) RTCRtcpParameters *rtcp; - -/** An array containing parameters for RTP header extensions. */ -@property(nonatomic, readonly, copy) NSArray *headerExtensions; - -/** The currently active encodings in the order of preference. */ -@property(nonatomic, copy) NSArray *encodings; - -/** The negotiated set of send codecs in order of preference. */ -@property(nonatomic, copy) NSArray *codecs; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpParameters.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h index 6156db9f93..ff61f824a0 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h @@ -8,75 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** Represents the media type of the RtpReceiver. */ -typedef NS_ENUM(NSInteger, RTCRtpMediaType) { - RTCRtpMediaTypeAudio, - RTCRtpMediaTypeVideo, - RTCRtpMediaTypeData, -}; - -@class RTCRtpReceiver; - -RTC_EXPORT -@protocol RTCRtpReceiverDelegate - -/** Called when the first RTP packet is received. - * - * Note: Currently if there are multiple RtpReceivers of the same media type, - * they will all call OnFirstPacketReceived at once. - * - * For example, if we create three audio receivers, A/B/C, they will listen to - * the same signal from the underneath network layer. Whenever the first audio packet - * is received, the underneath signal will be fired. All the receivers A/B/C will be - * notified and the callback of the receiver's delegate will be called. - * - * The process is the same for video receivers. - */ -- (void)rtpReceiver:(RTCRtpReceiver *)rtpReceiver - didReceiveFirstPacketForMediaType:(RTCRtpMediaType)mediaType; - -@end - -RTC_EXPORT -@protocol RTCRtpReceiver - -/** A unique identifier for this receiver. */ -@property(nonatomic, readonly) NSString *receiverId; - -/** The currently active RTCRtpParameters, as defined in - * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters. - * - * The WebRTC specification only defines RTCRtpParameters in terms of senders, - * but this API also applies them to receivers, similar to ORTC: - * http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*. - */ -@property(nonatomic, readonly) RTCRtpParameters *parameters; - -/** The RTCMediaStreamTrack associated with the receiver. - * Note: reading this property returns a new instance of - * RTCMediaStreamTrack. Use isEqual: instead of == to compare - * RTCMediaStreamTrack instances. - */ -@property(nonatomic, readonly, nullable) RTCMediaStreamTrack *track; - -/** The delegate for this RtpReceiver. */ -@property(nonatomic, weak) id delegate; - -@end - -RTC_EXPORT -@interface RTCRtpReceiver : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpReceiver.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpSender.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpSender.h index f6e9125026..d5a4e65d09 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpSender.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpSender.h @@ -8,43 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@protocol RTCRtpSender - -/** A unique identifier for this sender. */ -@property(nonatomic, readonly) NSString *senderId; - -/** The currently active RTCRtpParameters, as defined in - * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters. - */ -@property(nonatomic, copy) RTCRtpParameters *parameters; - -/** The RTCMediaStreamTrack associated with the sender. - * Note: reading this property returns a new instance of - * RTCMediaStreamTrack. Use isEqual: instead of == to compare - * RTCMediaStreamTrack instances. - */ -@property(nonatomic, copy, nullable) RTCMediaStreamTrack *track; - -/** The RTCDtmfSender accociated with the RTP sender. */ -@property(nonatomic, readonly, nullable) id dtmfSender; - -@end - -RTC_EXPORT -@interface RTCRtpSender : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpSender.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h b/sdk/objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h index 27fccc46c2..ff07e29fb7 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCRtpTransceiver.h @@ -8,122 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverdirection */ -typedef NS_ENUM(NSInteger, RTCRtpTransceiverDirection) { - RTCRtpTransceiverDirectionSendRecv, - RTCRtpTransceiverDirectionSendOnly, - RTCRtpTransceiverDirectionRecvOnly, - RTCRtpTransceiverDirectionInactive, -}; - -/** Structure for initializing an RTCRtpTransceiver in a call to - * RTCPeerConnection.addTransceiver. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit - */ -RTC_EXPORT -@interface RTCRtpTransceiverInit : NSObject - -/** Direction of the RTCRtpTransceiver. See RTCRtpTransceiver.direction. */ -@property(nonatomic) RTCRtpTransceiverDirection direction; - -/** The added RTCRtpTransceiver will be added to these streams. */ -@property(nonatomic) NSArray *streamIds; - -/** TODO(bugs.webrtc.org/7600): Not implemented. */ -@property(nonatomic) NSArray *sendEncodings; - -@end - -@class RTCRtpTransceiver; - -/** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the WebRTC - * specification. A transceiver represents a combination of an RTCRtpSender - * and an RTCRtpReceiver that share a common mid. As defined in JSEP, an - * RTCRtpTransceiver is said to be associated with a media description if its - * mid property is non-nil; otherwise, it is said to be disassociated. - * JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24 - * - * Note that RTCRtpTransceivers are only supported when using - * RTCPeerConnection with Unified Plan SDP. - * - * WebRTC specification for RTCRtpTransceiver, the JavaScript analog: - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver - */ -RTC_EXPORT -@protocol RTCRtpTransceiver - -/** Media type of the transceiver. The sender and receiver will also have this - * type. - */ -@property(nonatomic, readonly) RTCRtpMediaType mediaType; - -/** The mid attribute is the mid negotiated and present in the local and - * remote descriptions. Before negotiation is complete, the mid value may be - * nil. After rollbacks, the value may change from a non-nil value to nil. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid - */ -@property(nonatomic, readonly) NSString *mid; - -/** The sender attribute exposes the RTCRtpSender corresponding to the RTP - * media that may be sent with the transceiver's mid. The sender is always - * present, regardless of the direction of media. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender - */ -@property(nonatomic, readonly) RTCRtpSender *sender; - -/** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP - * media that may be received with the transceiver's mid. The receiver is - * always present, regardless of the direction of media. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver - */ -@property(nonatomic, readonly) RTCRtpReceiver *receiver; - -/** The isStopped 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. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped - */ -@property(nonatomic, readonly) BOOL isStopped; - -/** 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 - * descriptions as sendrecv, sendonly, recvonly, or inactive. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction - */ -@property(nonatomic) RTCRtpTransceiverDirection direction; - -/** The currentDirection attribute indicates the current direction negotiated - * for this transceiver. If this transceiver has never been represented in an - * offer/answer exchange, or if the transceiver is stopped, the value is not - * present and this method returns NO. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection - */ -- (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut; - -/** The stop method irreversibly stops the RTCRtpTransceiver. The sender of - * this transceiver will no longer send, the receiver will no longer receive. - * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop - */ -- (void)stop; - -@end - -RTC_EXPORT -@interface RTCRtpTransceiver : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCRtpTransceiver.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCSSLAdapter.h b/sdk/objc/Framework/Headers/WebRTC/RTCSSLAdapter.h index a0da827c35..c721875e70 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCSSLAdapter.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCSSLAdapter.h @@ -8,13 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -/** - * Initialize and clean up the SSL library. Failure is fatal. These call the - * corresponding functions in webrtc/rtc_base/ssladapter.h. - */ -RTC_EXTERN BOOL RTCInitializeSSL(void); -RTC_EXTERN BOOL RTCCleanupSSL(void); +#import "api/peerconnection/RTCSSLAdapter.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCSessionDescription.h b/sdk/objc/Framework/Headers/WebRTC/RTCSessionDescription.h index 7db53da8be..b5d55f7729 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCSessionDescription.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCSessionDescription.h @@ -8,40 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -/** - * Represents the session description type. This exposes the same types that are - * in C++, which doesn't include the rollback type that is in the W3C spec. - */ -typedef NS_ENUM(NSInteger, RTCSdpType) { - RTCSdpTypeOffer, - RTCSdpTypePrAnswer, - RTCSdpTypeAnswer, -}; - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT -@interface RTCSessionDescription : NSObject - -/** The type of session description. */ -@property(nonatomic, readonly) RTCSdpType type; - -/** The SDP string representation of this session description. */ -@property(nonatomic, readonly) NSString *sdp; - -- (instancetype)init NS_UNAVAILABLE; - -/** Initialize a session description with a type and SDP string. */ -- (instancetype)initWithType:(RTCSdpType)type sdp:(NSString *)sdp NS_DESIGNATED_INITIALIZER; - -+ (NSString *)stringForType:(RTCSdpType)type; - -+ (RTCSdpType)typeForString:(NSString *)string; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCSessionDescription.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCTracing.h b/sdk/objc/Framework/Headers/WebRTC/RTCTracing.h index 899a57001e..fd4a6ffecb 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCTracing.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCTracing.h @@ -8,14 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -RTC_EXTERN void RTCSetupInternalTracer(void); -/** Starts capture to specified file. Must be a valid writable path. - * Returns YES if capture starts. - */ -RTC_EXTERN BOOL RTCStartInternalCapture(NSString* filePath); -RTC_EXTERN void RTCStopInternalCapture(void); -RTC_EXTERN void RTCShutdownInternalTracer(void); +#import "api/peerconnection/RTCTracing.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCapturer.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCapturer.h index f0a2eaa14c..93586fc0d5 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCapturer.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCapturer.h @@ -8,24 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCVideoCapturer; - -RTC_EXPORT -@protocol RTCVideoCapturerDelegate -- (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame; -@end - -RTC_EXPORT -@interface RTCVideoCapturer : NSObject - -@property(nonatomic, weak) id delegate; - -- (instancetype)initWithDelegate:(id)delegate; - -@end - -NS_ASSUME_NONNULL_END +#import "base/RTCVideoCapturer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h index 5bc6d66d1e..b4511a9985 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h @@ -8,179 +8,13 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT extern NSString *const kRTCVideoCodecVp8Name; -RTC_EXPORT extern NSString *const kRTCVideoCodecVp9Name; -RTC_EXPORT extern NSString *const kRTCVideoCodecH264Name; -RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedHigh; -RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedBaseline; -RTC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh; -RTC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline; - -/** Represents an encoded frame's type. */ -typedef NS_ENUM(NSUInteger, RTCFrameType) { - RTCFrameTypeEmptyFrame = 0, - RTCFrameTypeAudioFrameSpeech = 1, - RTCFrameTypeAudioFrameCN = 2, - RTCFrameTypeVideoFrameKey = 3, - RTCFrameTypeVideoFrameDelta = 4, -}; - -typedef NS_ENUM(NSUInteger, RTCVideoContentType) { - RTCVideoContentTypeUnspecified, - RTCVideoContentTypeScreenshare, -}; - -/** Represents an encoded frame. Corresponds to webrtc::EncodedImage. */ -RTC_EXPORT -@interface RTCEncodedImage : NSObject - -@property(nonatomic, strong) NSData *buffer; -@property(nonatomic, assign) int32_t encodedWidth; -@property(nonatomic, assign) int32_t encodedHeight; -@property(nonatomic, assign) uint32_t timeStamp; -@property(nonatomic, assign) int64_t captureTimeMs; -@property(nonatomic, assign) int64_t ntpTimeMs; -@property(nonatomic, assign) uint8_t flags; -@property(nonatomic, assign) int64_t encodeStartMs; -@property(nonatomic, assign) int64_t encodeFinishMs; -@property(nonatomic, assign) RTCFrameType frameType; -@property(nonatomic, assign) RTCVideoRotation rotation; -@property(nonatomic, assign) BOOL completeFrame; -@property(nonatomic, strong) NSNumber *qp; -@property(nonatomic, assign) RTCVideoContentType contentType; - -@end - -/** Information for header. Corresponds to webrtc::RTPFragmentationHeader. */ -RTC_EXPORT -@interface RTCRtpFragmentationHeader : NSObject - -@property(nonatomic, strong) NSArray *fragmentationOffset; -@property(nonatomic, strong) NSArray *fragmentationLength; -@property(nonatomic, strong) NSArray *fragmentationTimeDiff; -@property(nonatomic, strong) NSArray *fragmentationPlType; - -@end - -/** Implement this protocol to pass codec specific info from the encoder. - * Corresponds to webrtc::CodecSpecificInfo. - */ -RTC_EXPORT -@protocol RTCCodecSpecificInfo - -@end - -/** Callback block for encoder. */ -typedef BOOL (^RTCVideoEncoderCallback)(RTCEncodedImage *frame, - id info, - RTCRtpFragmentationHeader *header); - -/** Callback block for decoder. */ -typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame); - -typedef NS_ENUM(NSUInteger, RTCVideoCodecMode) { - RTCVideoCodecModeRealtimeVideo, - RTCVideoCodecModeScreensharing, -}; - -/** Holds information to identify a codec. Corresponds to webrtc::SdpVideoFormat. */ -RTC_EXPORT -@interface RTCVideoCodecInfo : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -- (instancetype)initWithName:(NSString *)name; - -- (instancetype)initWithName:(NSString *)name - parameters:(nullable NSDictionary *)parameters - NS_DESIGNATED_INITIALIZER; - -- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info; - -@property(nonatomic, readonly) NSString *name; -@property(nonatomic, readonly) NSDictionary *parameters; - -@end - -/** Settings for encoder. Corresponds to webrtc::VideoCodec. */ -RTC_EXPORT -@interface RTCVideoEncoderSettings : NSObject - -@property(nonatomic, strong) NSString *name; - -@property(nonatomic, assign) unsigned short width; -@property(nonatomic, assign) unsigned short height; - -@property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec. -@property(nonatomic, assign) unsigned int maxBitrate; -@property(nonatomic, assign) unsigned int minBitrate; -@property(nonatomic, assign) unsigned int targetBitrate; - -@property(nonatomic, assign) uint32_t maxFramerate; - -@property(nonatomic, assign) unsigned int qpMax; -@property(nonatomic, assign) RTCVideoCodecMode mode; - -@end - -/** QP thresholds for encoder. Corresponds to webrtc::VideoEncoder::QpThresholds. */ -RTC_EXPORT -@interface RTCVideoEncoderQpThresholds : NSObject - -- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high; - -@property(nonatomic, readonly) NSInteger low; -@property(nonatomic, readonly) NSInteger high; - -@end - -/** Protocol for encoder implementations. */ -RTC_EXPORT -@protocol RTCVideoEncoder - -- (void)setCallback:(RTCVideoEncoderCallback)callback; -- (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings - numberOfCores:(int)numberOfCores; -- (NSInteger)releaseEncoder; -- (NSInteger)encode:(RTCVideoFrame *)frame - codecSpecificInfo:(nullable id)info - frameTypes:(NSArray *)frameTypes; -- (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate; -- (NSString *)implementationName; - -/** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to - * keep the QP from the encoded images within the given range. Returning nil from this function - * disables quality scaling. */ -- (RTCVideoEncoderQpThresholds *)scalingSettings; - -@end - -/** Protocol for decoder implementations. */ -RTC_EXPORT -@protocol RTCVideoDecoder - -- (void)setCallback:(RTCVideoDecoderCallback)callback; -- (NSInteger)startDecodeWithSettings:(RTCVideoEncoderSettings *)settings - numberOfCores:(int)numberOfCores - DEPRECATED_MSG_ATTRIBUTE("use startDecodeWithNumberOfCores: instead"); -- (NSInteger)releaseDecoder; -- (NSInteger)decode:(RTCEncodedImage *)encodedImage - missingFrames:(BOOL)missingFrames - codecSpecificInfo:(nullable id)info - renderTimeMs:(int64_t)renderTimeMs; -- (NSString *)implementationName; - -// TODO(andersc): Make non-optional when `startDecodeWithSettings:numberOfCores:` is removed. -@optional -- (NSInteger)startDecodeWithNumberOfCores:(int)numberOfCores; - -@end - -NS_ASSUME_NONNULL_END +#import "api/video_codec/RTCVideoCodecConstants.h" +#import "base/RTCCodecSpecificInfo.h" +#import "base/RTCEncodedImage.h" +#import "base/RTCRtpFragmentationHeader.h" +#import "base/RTCVideoCodecInfo.h" +#import "base/RTCVideoDecoder.h" +#import "base/RTCVideoEncoder.h" +#import "base/RTCVideoEncoderQpThresholds.h" +#import "base/RTCVideoEncoderSettings.h" +#import "components/video_codec/RTCH264ProfileLevelId.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h index 0ef2c8a655..5e8d353aa1 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h @@ -8,47 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory. */ -RTC_EXPORT -@protocol RTCVideoEncoderFactory - -- (nullable id)createEncoder:(RTCVideoCodecInfo *)info; -- (NSArray *)supportedCodecs; // TODO(andersc): "supportedFormats" instead? - -@end - -/** RTCVideoDecoderFactory is an Objective-C version of webrtc::VideoDecoderFactory. */ -RTC_EXPORT -@protocol RTCVideoDecoderFactory - -- (nullable id)createDecoder:(RTCVideoCodecInfo *)info; -- (NSArray *)supportedCodecs; // TODO(andersc): "supportedFormats" instead? - -@end - -#pragma mark - Default factories - -/** These codec factories include support for all codecs bundled with WebRTC. If using custom - * codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory. - */ -RTC_EXPORT -@interface RTCDefaultVideoEncoderFactory : NSObject - -@property(nonatomic, retain) RTCVideoCodecInfo *preferredCodec; - -+ (NSArray *)supportedCodecs; - -@end - -RTC_EXPORT -@interface RTCDefaultVideoDecoderFactory : NSObject -@end - -NS_ASSUME_NONNULL_END +#import "base/RTCVideoDecoderFactory.h" +#import "base/RTCVideoEncoderFactory.h" +#import "components/video_codec/RTCDefaultVideoDecoderFactory.h" +#import "components/video_codec/RTCDefaultVideoEncoderFactory.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h index d4dbf88f2b..d1ff92e27a 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h @@ -8,84 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -/** Class for H264 specific config. */ -typedef NS_ENUM(NSUInteger, RTCH264PacketizationMode) { - RTCH264PacketizationModeNonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed - RTCH264PacketizationModeSingleNalUnit // Mode 0 - only single NALU allowed -}; - -RTC_EXPORT -@interface RTCCodecSpecificInfoH264 : NSObject - -@property(nonatomic, assign) RTCH264PacketizationMode packetizationMode; - -@end - -/** H264 Profiles and levels. */ -typedef NS_ENUM(NSUInteger, RTCH264Profile) { - RTCH264ProfileConstrainedBaseline, - RTCH264ProfileBaseline, - RTCH264ProfileMain, - RTCH264ProfileConstrainedHigh, - RTCH264ProfileHigh, -}; - -typedef NS_ENUM(NSUInteger, RTCH264Level) { - RTCH264Level1_b = 0, - RTCH264Level1 = 10, - RTCH264Level1_1 = 11, - RTCH264Level1_2 = 12, - RTCH264Level1_3 = 13, - RTCH264Level2 = 20, - RTCH264Level2_1 = 21, - RTCH264Level2_2 = 22, - RTCH264Level3 = 30, - RTCH264Level3_1 = 31, - RTCH264Level3_2 = 32, - RTCH264Level4 = 40, - RTCH264Level4_1 = 41, - RTCH264Level4_2 = 42, - RTCH264Level5 = 50, - RTCH264Level5_1 = 51, - RTCH264Level5_2 = 52 -}; - -RTC_EXPORT -@interface RTCH264ProfileLevelId : NSObject - -@property(nonatomic, readonly) RTCH264Profile profile; -@property(nonatomic, readonly) RTCH264Level level; -@property(nonatomic, readonly) NSString *hexString; - -- (instancetype)initWithHexString:(NSString *)hexString; -- (instancetype)initWithProfile:(RTCH264Profile)profile level:(RTCH264Level)level; - -@end - -/** Encoder. */ -RTC_EXPORT -@interface RTCVideoEncoderH264 : NSObject - -- (instancetype)initWithCodecInfo:(RTCVideoCodecInfo *)codecInfo; - -@end - -/** Decoder. */ -RTC_EXPORT -@interface RTCVideoDecoderH264 : NSObject -@end - -/** Encoder factory. */ -RTC_EXPORT -@interface RTCVideoEncoderFactoryH264 : NSObject -@end - -/** Decoder factory. */ -RTC_EXPORT -@interface RTCVideoDecoderFactoryH264 : NSObject -@end +#import "components/video_codec/RTCCodecSpecificInfoH264.h" +#import "components/video_codec/RTCH264ProfileLevelId.h" +#import "components/video_codec/RTCVideoDecoderFactoryH264.h" +#import "components/video_codec/RTCVideoDecoderH264.h" +#import "components/video_codec/RTCVideoEncoderFactoryH264.h" +#import "components/video_codec/RTCVideoEncoderH264.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecInfo.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecInfo.h new file mode 100644 index 0000000000..10c5fea465 --- /dev/null +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodecInfo.h @@ -0,0 +1,11 @@ +/* + * Copyright 2017 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. + */ + +#import "base/RTCVideoCodecInfo.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h index 962b6312f7..9c9e840e6d 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP8.h @@ -8,18 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -RTC_EXPORT -@interface RTCVideoDecoderVP8 : NSObject - -/* This returns a VP8 decoder that can be returned from a RTCVideoDecoderFactory injected into - * RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be - * used independently from the RTCPeerConnectionFactory. - */ -+ (id)vp8Decoder; - -@end +#import "api/video_codec/RTCVideoDecoderVP8.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h index faf66ef065..1a7c38267b 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoDecoderVP9.h @@ -8,18 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -RTC_EXPORT -@interface RTCVideoDecoderVP9 : NSObject - -/* This returns a VP9 decoder that can be returned from a RTCVideoDecoderFactory injected into - * RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be - * used independently from the RTCPeerConnectionFactory. - */ -+ (id)vp9Decoder; - -@end +#import "api/video_codec/RTCVideoDecoderVP9.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h index e63b24dde7..65a7850884 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h @@ -8,18 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -RTC_EXPORT -@interface RTCVideoEncoderVP8 : NSObject - -/* This returns a VP8 encoder that can be returned from a RTCVideoEncoderFactory injected into - * RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be - * used independently from the RTCPeerConnectionFactory. - */ -+ (id)vp8Encoder; - -@end +#import "api/video_codec/RTCVideoEncoderVP8.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h index cef8c82e96..5d01835805 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h @@ -8,18 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import - -RTC_EXPORT -@interface RTCVideoEncoderVP9 : NSObject - -/* This returns a VP9 encoder that can be returned from a RTCVideoEncoderFactory injected into - * RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be - * used independently from the RTCPeerConnectionFactory. - */ -+ (id)vp9Encoder; - -@end +#import "api/video_codec/RTCVideoEncoderVP9.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h index cfccfa9e94..ec1543d8e3 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrame.h @@ -8,78 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSInteger, RTCVideoRotation) { - RTCVideoRotation_0 = 0, - RTCVideoRotation_90 = 90, - RTCVideoRotation_180 = 180, - RTCVideoRotation_270 = 270, -}; - -@protocol RTCVideoFrameBuffer; - -// RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame. -RTC_EXPORT -@interface RTCVideoFrame : NSObject - -/** Width without rotation applied. */ -@property(nonatomic, readonly) int width; - -/** Height without rotation applied. */ -@property(nonatomic, readonly) int height; -@property(nonatomic, readonly) RTCVideoRotation rotation; - -/** Timestamp in nanoseconds. */ -@property(nonatomic, readonly) int64_t timeStampNs; - -/** Timestamp 90 kHz. */ -@property(nonatomic, assign) int32_t timeStamp; - -@property(nonatomic, readonly) id buffer; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype) new NS_UNAVAILABLE; - -/** Initialize an RTCVideoFrame from a pixel buffer, rotation, and timestamp. - * Deprecated - initialize with a RTCCVPixelBuffer instead - */ -- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer - rotation:(RTCVideoRotation)rotation - timeStampNs:(int64_t)timeStampNs - DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead"); - -/** Initialize an RTCVideoFrame from a pixel buffer combined with cropping and - * scaling. Cropping will be applied first on the pixel buffer, followed by - * scaling to the final resolution of scaledWidth x scaledHeight. - */ -- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer - scaledWidth:(int)scaledWidth - scaledHeight:(int)scaledHeight - cropWidth:(int)cropWidth - cropHeight:(int)cropHeight - cropX:(int)cropX - cropY:(int)cropY - rotation:(RTCVideoRotation)rotation - timeStampNs:(int64_t)timeStampNs - DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead"); - -/** Initialize an RTCVideoFrame from a frame buffer, rotation, and timestamp. - */ -- (instancetype)initWithBuffer:(id)frameBuffer - rotation:(RTCVideoRotation)rotation - timeStampNs:(int64_t)timeStampNs; - -/** Return a frame that is guaranteed to be I420, i.e. it is possible to access - * the YUV data on it. - */ -- (RTCVideoFrame *)newI420VideoFrame; - -@end - -NS_ASSUME_NONNULL_END +#import "base/RTCVideoFrame.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h index d590a5f7fc..459e272aaf 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h @@ -8,109 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RTCI420Buffer; - -// RTCVideoFrameBuffer is an ObjectiveC version of webrtc::VideoFrameBuffer. -RTC_EXPORT -@protocol RTCVideoFrameBuffer - -@property(nonatomic, readonly) int width; -@property(nonatomic, readonly) int height; - -- (id)toI420; - -@end - -/** Protocol for RTCVideoFrameBuffers containing YUV planar data. */ -@protocol RTCYUVPlanarBuffer - -@property(nonatomic, readonly) int chromaWidth; -@property(nonatomic, readonly) int chromaHeight; -@property(nonatomic, readonly) const uint8_t *dataY; -@property(nonatomic, readonly) const uint8_t *dataU; -@property(nonatomic, readonly) const uint8_t *dataV; -@property(nonatomic, readonly) int strideY; -@property(nonatomic, readonly) int strideU; -@property(nonatomic, readonly) int strideV; - -- (instancetype)initWithWidth:(int)width - height:(int)height - dataY:(const uint8_t *)dataY - dataU:(const uint8_t *)dataU - dataV:(const uint8_t *)dataV; -- (instancetype)initWithWidth:(int)width height:(int)height; -- (instancetype)initWithWidth:(int)width - height:(int)height - strideY:(int)strideY - strideU:(int)strideU - strideV:(int)strideV; - -@end - -/** Extension of the YUV planar data buffer with mutable data access */ -@protocol RTCMutableYUVPlanarBuffer - -@property(nonatomic, readonly) uint8_t *mutableDataY; -@property(nonatomic, readonly) uint8_t *mutableDataU; -@property(nonatomic, readonly) uint8_t *mutableDataV; - -@end - -/** Protocol for RTCYUVPlanarBuffers containing I420 data */ -@protocol RTCI420Buffer -@end - -/** Extension of the I420 buffer with mutable data access */ -@protocol RTCMutableI420Buffer -@end - -/** RTCVideoFrameBuffer containing a CVPixelBufferRef */ -RTC_EXPORT -@interface RTCCVPixelBuffer : NSObject - -@property(nonatomic, readonly) CVPixelBufferRef pixelBuffer; -@property(nonatomic, readonly) int cropX; -@property(nonatomic, readonly) int cropY; -@property(nonatomic, readonly) int cropWidth; -@property(nonatomic, readonly) int cropHeight; - -+ (NSSet *)supportedPixelFormats; - -- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer; -- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer - adaptedWidth:(int)adaptedWidth - adaptedHeight:(int)adaptedHeight - cropWidth:(int)cropWidth - cropHeight:(int)cropHeight - cropX:(int)cropX - cropY:(int)cropY; - -- (BOOL)requiresCropping; -- (BOOL)requiresScalingToWidth:(int)width height:(int)height; -- (int)bufferSizeForCroppingAndScalingToWidth:(int)width height:(int)height; - -/** The minimum size of the |tmpBuffer| must be the number of bytes returned from the - * bufferSizeForCroppingAndScalingToWidth:height: method. - * If that size is 0, the |tmpBuffer| may be nil. - */ -- (BOOL)cropAndScaleTo:(CVPixelBufferRef)outputPixelBuffer - withTempBuffer:(nullable uint8_t *)tmpBuffer; - -@end - -/** RTCI420Buffer implements the RTCI420Buffer protocol */ -RTC_EXPORT -@interface RTCI420Buffer : NSObject -@end - -/** Mutable version of RTCI420Buffer */ -RTC_EXPORT -@interface RTCMutableI420Buffer : RTCI420Buffer -@end - -NS_ASSUME_NONNULL_END +#import "api/video_frame_buffer/RTCI420Buffer.h" +#import "api/video_frame_buffer/RTCMutableI420Buffer.h" +#import "base/RTCI420Buffer.h" +#import "base/RTCMutableI420Buffer.h" +#import "base/RTCMutableYUVPlanarBuffer.h" +#import "base/RTCVideoFrameBuffer.h" +#import "base/RTCYUVPlanarBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoRenderer.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoRenderer.h index 7d91f2f14d..0e32c02c9a 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoRenderer.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoRenderer.h @@ -8,33 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#if TARGET_OS_IPHONE -#import -#endif - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RTCVideoFrame; - -RTC_EXPORT -@protocol RTCVideoRenderer - -/** The size of the frame. */ -- (void)setSize:(CGSize)size; - -/** The frame to be displayed. */ -- (void)renderFrame:(nullable RTCVideoFrame *)frame; - -@end - -RTC_EXPORT -@protocol RTCVideoViewDelegate - -- (void)videoView:(id)videoView didChangeVideoSize:(CGSize)size; - -@end - -NS_ASSUME_NONNULL_END +#import "base/RTCVideoRenderer.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoSource.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoSource.h index a9ebc06c88..91e635de6c 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoSource.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoSource.h @@ -8,30 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -RTC_EXPORT - -@interface RTCVideoSource : RTCMediaSource - -- (instancetype)init NS_UNAVAILABLE; - -/** - * Calling this function will cause frames to be scaled down to the - * requested resolution. Also, frames will be cropped to match the - * requested aspect ratio, and frames will be dropped to match the - * requested fps. The requested aspect ratio is orientation agnostic and - * will be adjusted to maintain the input orientation, so it doesn't - * matter if e.g. 1280x720 or 720x1280 is requested. - */ -- (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCVideoSource.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoTrack.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoTrack.h index 899d7c3478..b5dd1ddf59 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoTrack.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoTrack.h @@ -8,30 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol RTCVideoRenderer; -@class RTCPeerConnectionFactory; -@class RTCVideoSource; - -RTC_EXPORT -@interface RTCVideoTrack : RTCMediaStreamTrack - -/** The video source for this video track. */ -@property(nonatomic, readonly) RTCVideoSource *source; - -- (instancetype)init NS_UNAVAILABLE; - -/** Register a renderer that will render all frames received on this track. */ -- (void)addRenderer:(id)renderer; - -/** Deregister a renderer. */ -- (void)removeRenderer:(id)renderer; - -@end - -NS_ASSUME_NONNULL_END +#import "api/peerconnection/RTCVideoTrack.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/RTCVideoViewShading.h b/sdk/objc/Framework/Headers/WebRTC/RTCVideoViewShading.h index 6f3ece94a1..7c6cd7a2e5 100644 --- a/sdk/objc/Framework/Headers/WebRTC/RTCVideoViewShading.h +++ b/sdk/objc/Framework/Headers/WebRTC/RTCVideoViewShading.h @@ -8,34 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * RTCVideoViewShading provides a way for apps to customize the OpenGL(ES) shaders used in - * rendering for the RTCEAGLVideoView/RTCNSGLVideoView. - */ -RTC_EXPORT -@protocol RTCVideoViewShading - -/** Callback for I420 frames. Each plane is given as a texture. */ -- (void)applyShadingForFrameWithWidth:(int)width - height:(int)height - rotation:(RTCVideoRotation)rotation - yPlane:(GLuint)yPlane - uPlane:(GLuint)uPlane - vPlane:(GLuint)vPlane; - -/** Callback for NV12 frames. Each plane is given as a texture. */ -- (void)applyShadingForFrameWithWidth:(int)width - height:(int)height - rotation:(RTCVideoRotation)rotation - yPlane:(GLuint)yPlane - uvPlane:(GLuint)uvPlane; - -@end - -NS_ASSUME_NONNULL_END +#import "components/renderer/opengl/RTCVideoViewShading.h" diff --git a/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h b/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h index eb39ea9cc4..724dc8dca4 100644 --- a/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h +++ b/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h @@ -8,74 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import - -typedef NS_ENUM(NSInteger, RTCDeviceType) { - RTCDeviceTypeUnknown, - RTCDeviceTypeIPhone1G, - RTCDeviceTypeIPhone3G, - RTCDeviceTypeIPhone3GS, - RTCDeviceTypeIPhone4, - RTCDeviceTypeIPhone4Verizon, - RTCDeviceTypeIPhone4S, - RTCDeviceTypeIPhone5GSM, - RTCDeviceTypeIPhone5GSM_CDMA, - RTCDeviceTypeIPhone5CGSM, - RTCDeviceTypeIPhone5CGSM_CDMA, - RTCDeviceTypeIPhone5SGSM, - RTCDeviceTypeIPhone5SGSM_CDMA, - RTCDeviceTypeIPhone6Plus, - RTCDeviceTypeIPhone6, - RTCDeviceTypeIPhone6S, - RTCDeviceTypeIPhone6SPlus, - RTCDeviceTypeIPhone7, - RTCDeviceTypeIPhone7Plus, - RTCDeviceTypeIPhoneSE, - RTCDeviceTypeIPhone8, - RTCDeviceTypeIPhone8Plus, - RTCDeviceTypeIPhoneX, - RTCDeviceTypeIPodTouch1G, - RTCDeviceTypeIPodTouch2G, - RTCDeviceTypeIPodTouch3G, - RTCDeviceTypeIPodTouch4G, - RTCDeviceTypeIPodTouch5G, - RTCDeviceTypeIPodTouch6G, - RTCDeviceTypeIPad, - RTCDeviceTypeIPad2Wifi, - RTCDeviceTypeIPad2GSM, - RTCDeviceTypeIPad2CDMA, - RTCDeviceTypeIPad2Wifi2, - RTCDeviceTypeIPadMiniWifi, - RTCDeviceTypeIPadMiniGSM, - RTCDeviceTypeIPadMiniGSM_CDMA, - RTCDeviceTypeIPad3Wifi, - RTCDeviceTypeIPad3GSM_CDMA, - RTCDeviceTypeIPad3GSM, - RTCDeviceTypeIPad4Wifi, - RTCDeviceTypeIPad4GSM, - RTCDeviceTypeIPad4GSM_CDMA, - RTCDeviceTypeIPad5, - RTCDeviceTypeIPad6, - RTCDeviceTypeIPadAirWifi, - RTCDeviceTypeIPadAirCellular, - RTCDeviceTypeIPadAirWifiCellular, - RTCDeviceTypeIPadAir2, - RTCDeviceTypeIPadMini2GWifi, - RTCDeviceTypeIPadMini2GCellular, - RTCDeviceTypeIPadMini2GWifiCellular, - RTCDeviceTypeIPadMini3, - RTCDeviceTypeIPadMini4, - RTCDeviceTypeIPadPro9Inch, - RTCDeviceTypeIPadPro12Inch, - RTCDeviceTypeIPadPro12Inch2, - RTCDeviceTypeIPadPro10Inch, - RTCDeviceTypeSimulatori386, - RTCDeviceTypeSimulatorx86_64, -}; - -@interface UIDevice (RTCDevice) - -+ (RTCDeviceType)deviceType; -+ (BOOL)isIOS11OrLater; - -@end +#import "helpers/UIDevice+RTCDevice.h" diff --git a/sdk/objc/Framework/Modules/module.modulemap b/sdk/objc/Framework/Modules/module.modulemap deleted file mode 100644 index cd485a4e81..0000000000 --- a/sdk/objc/Framework/Modules/module.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module WebRTC { - umbrella header "WebRTC.h" - - export * - module * { export * } -} diff --git a/sdk/objc/Framework/Native/api/audio_device_module.h b/sdk/objc/Framework/Native/api/audio_device_module.h index aaeb39b18c..7b448024de 100644 --- a/sdk/objc/Framework/Native/api/audio_device_module.h +++ b/sdk/objc/Framework/Native/api/audio_device_module.h @@ -8,17 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_AUDIO_DEVICE_MODULE_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_AUDIO_DEVICE_MODULE_H_ - -#include - -#include "modules/audio_device/include/audio_device.h" - -namespace webrtc { - -rtc::scoped_refptr CreateAudioDeviceModule(); - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_AUDIO_DEVICE_MODULE_H_ +#import "native/api/audio_device_module.h" diff --git a/sdk/objc/Framework/Native/api/video_decoder_factory.h b/sdk/objc/Framework/Native/api/video_decoder_factory.h index 9fda6a9527..ca9371c54d 100644 --- a/sdk/objc/Framework/Native/api/video_decoder_factory.h +++ b/sdk/objc/Framework/Native/api/video_decoder_factory.h @@ -8,20 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_DECODER_FACTORY_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_DECODER_FACTORY_H_ - -#include - -#import "WebRTC/RTCVideoCodecFactory.h" - -#include "api/video_codecs/video_decoder_factory.h" - -namespace webrtc { - -std::unique_ptr ObjCToNativeVideoDecoderFactory( - id objc_video_decoder_factory); - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_DECODER_FACTORY_H_ +#import "native/api/video_decoder_factory.h" diff --git a/sdk/objc/Framework/Native/api/video_encoder_factory.h b/sdk/objc/Framework/Native/api/video_encoder_factory.h index 865a707b00..35e1e6c99f 100644 --- a/sdk/objc/Framework/Native/api/video_encoder_factory.h +++ b/sdk/objc/Framework/Native/api/video_encoder_factory.h @@ -8,20 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_ENCODER_FACTORY_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_ENCODER_FACTORY_H_ - -#include - -#import "WebRTC/RTCVideoCodecFactory.h" - -#include "api/video_codecs/video_encoder_factory.h" - -namespace webrtc { - -std::unique_ptr ObjCToNativeVideoEncoderFactory( - id objc_video_encoder_factory); - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_ENCODER_FACTORY_H_ +#import "native/api/video_encoder_factory.h" diff --git a/sdk/objc/Framework/Native/api/video_frame_buffer.h b/sdk/objc/Framework/Native/api/video_frame_buffer.h index 1009c76bb7..0e862cfa07 100644 --- a/sdk/objc/Framework/Native/api/video_frame_buffer.h +++ b/sdk/objc/Framework/Native/api/video_frame_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright 2018 The WebRTC project authors. All Rights Reserved. + * 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 @@ -8,22 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_BUFFER_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_BUFFER_H_ - -#import "WebRTC/RTCVideoFrameBuffer.h" - -#include "common_video/include/video_frame_buffer.h" -#include "rtc_base/scoped_ref_ptr.h" - -namespace webrtc { - -rtc::scoped_refptr ObjCToNativeVideoFrameBuffer( - id objc_video_frame_buffer); - -id NativeToObjCVideoFrameBuffer( - const rtc::scoped_refptr& buffer); - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_BUFFER_H_ +#import "native/api/video_frame_buffer.h" diff --git a/sdk/objc/Framework/Native/src/objc_video_decoder_factory.h b/sdk/objc/Framework/Native/src/objc_video_decoder_factory.h index 3e2980896e..bd8513c342 100644 --- a/sdk/objc/Framework/Native/src/objc_video_decoder_factory.h +++ b/sdk/objc/Framework/Native/src/objc_video_decoder_factory.h @@ -8,31 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_DECODER_FACTORY_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_DECODER_FACTORY_H_ - -#include "api/video_codecs/video_decoder_factory.h" -#include "media/base/codec.h" - -@protocol RTCVideoDecoderFactory; - -namespace webrtc { - -class ObjCVideoDecoderFactory : public VideoDecoderFactory { - public: - explicit ObjCVideoDecoderFactory(id); - ~ObjCVideoDecoderFactory() override; - - id wrapped_decoder_factory() const; - - std::vector GetSupportedFormats() const override; - std::unique_ptr CreateVideoDecoder( - const SdpVideoFormat& format) override; - - private: - id decoder_factory_; -}; - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_DECODER_FACTORY_H_ +#import "native/src/objc_video_decoder_factory.h" diff --git a/sdk/objc/Framework/Native/src/objc_video_encoder_factory.h b/sdk/objc/Framework/Native/src/objc_video_encoder_factory.h index 43a3bf431e..b6bd650a4f 100644 --- a/sdk/objc/Framework/Native/src/objc_video_encoder_factory.h +++ b/sdk/objc/Framework/Native/src/objc_video_encoder_factory.h @@ -8,33 +8,4 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_ENCODER_FACTORY_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_ENCODER_FACTORY_H_ - -#import - -#include "api/video_codecs/video_encoder_factory.h" - -@protocol RTCVideoEncoderFactory; - -namespace webrtc { - -class ObjCVideoEncoderFactory : public VideoEncoderFactory { - public: - explicit ObjCVideoEncoderFactory(id); - ~ObjCVideoEncoderFactory() override; - - id wrapped_encoder_factory() const; - - std::vector GetSupportedFormats() const override; - std::unique_ptr CreateVideoEncoder( - const SdpVideoFormat& format) override; - CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override; - - private: - id encoder_factory_; -}; - -} // namespace webrtc - -#endif // SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_ENCODER_FACTORY_H_ +#import "native/src/objc_video_encoder_factory.h" diff --git a/sdk/objc/Framework/Info.plist b/sdk/objc/Info.plist similarity index 100% rename from sdk/objc/Framework/Info.plist rename to sdk/objc/Info.plist diff --git a/sdk/objc/README.md b/sdk/objc/README.md new file mode 100644 index 0000000000..ff294a266f --- /dev/null +++ b/sdk/objc/README.md @@ -0,0 +1,37 @@ +# WebRTC Obj-C SDK + +This directory contains the Obj-C SDK for WebRTC. This includes wrappers for the +C++ PeerConnection API and some platform specific components for iOS and macOS. + +## Organization + +- api/ + + Wrappers around classes and functions in the C++ API for creating and + configuring peer connections, etc. + +- base/ + + This directory contains some base protocols and classes that are used by both + the platform specific components and the SDK wrappers. + +- components/ + + These are the platform specific components. Contains components for handling + audio, capturing and rendering video, encoding and decoding using the + platform's hardware codec implementation and for representing video frames + in the platform's native format. + +- helpers/ + + These files are not WebRTC specific, but are general helper classes and + utilities for the Cocoa platforms. + +- native/ + + APIs for wrapping the platform specific components and using them with the + C++ API. + +- unittests/ + + This directory contains the tests. diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter+Private.h b/sdk/objc/api/RTCVideoRendererAdapter+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter+Private.h rename to sdk/objc/api/RTCVideoRendererAdapter+Private.h index 80a2140bfa..7cedba43f9 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter+Private.h +++ b/sdk/objc/api/RTCVideoRendererAdapter+Private.h @@ -10,7 +10,7 @@ #import "RTCVideoRendererAdapter.h" -#import "WebRTC/RTCVideoRenderer.h" +#import "base/RTCVideoRenderer.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.h b/sdk/objc/api/RTCVideoRendererAdapter.h similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.h rename to sdk/objc/api/RTCVideoRendererAdapter.h diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.mm b/sdk/objc/api/RTCVideoRendererAdapter.mm similarity index 91% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.mm rename to sdk/objc/api/RTCVideoRendererAdapter.mm index f5c4f011f5..d30c4e7255 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoRendererAdapter.mm +++ b/sdk/objc/api/RTCVideoRendererAdapter.mm @@ -8,14 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "RTCI420Buffer+Private.h" #import "RTCVideoRendererAdapter+Private.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "api/video_frame_buffer/RTCI420Buffer+Private.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" #include -#include "sdk/objc/Framework/Native/api/video_frame.h" +#include "sdk/objc/native/api/video_frame.h" namespace webrtc { diff --git a/sdk/objc/api/logging/RTCCallbackLogger.h b/sdk/objc/api/logging/RTCCallbackLogger.h new file mode 100644 index 0000000000..669f2a3e4a --- /dev/null +++ b/sdk/objc/api/logging/RTCCallbackLogger.h @@ -0,0 +1,35 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCLogging.h" +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +// This class intercepts WebRTC logs and forwards them to a registered block. +// This class is not threadsafe. +RTC_EXPORT +@interface RTCCallbackLogger : NSObject + +// The severity level to capture. The default is kRTCLoggingSeverityInfo. +@property(nonatomic, assign) RTCLoggingSeverity severity; + +// The callback will be called on the same thread that does the logging, so +// if the logging callback can be slow it may be a good idea to implement +// dispatching to some other queue. +- (void)start:(nullable void (^)(NSString*))callback; + +- (void)stop; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Common/RTCCallbackLogger.mm b/sdk/objc/api/logging/RTCCallbackLogger.mm similarity index 98% rename from sdk/objc/Framework/Classes/Common/RTCCallbackLogger.mm rename to sdk/objc/api/logging/RTCCallbackLogger.mm index 4802c12b74..8440d63791 100644 --- a/sdk/objc/Framework/Classes/Common/RTCCallbackLogger.mm +++ b/sdk/objc/api/logging/RTCCallbackLogger.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCCallbackLogger.h" +#import "RTCCallbackLogger.h" #include diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource+Private.h b/sdk/objc/api/peerconnection/RTCAudioSource+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource+Private.h rename to sdk/objc/api/peerconnection/RTCAudioSource+Private.h index 63fff68892..bf1ea62044 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource+Private.h +++ b/sdk/objc/api/peerconnection/RTCAudioSource+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCAudioSource.h" +#import "RTCAudioSource.h" #import "RTCMediaSource+Private.h" diff --git a/sdk/objc/api/peerconnection/RTCAudioSource.h b/sdk/objc/api/peerconnection/RTCAudioSource.h new file mode 100644 index 0000000000..f6bccc94d8 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCAudioSource.h @@ -0,0 +1,32 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCMediaSource.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCAudioSource : RTCMediaSource + +- (instancetype)init NS_UNAVAILABLE; + +// Sets the volume for the RTCMediaSource. |volume| is a gain value in the range +// [0, 10]. +// Temporary fix to be able to modify volume of remote audio tracks. +// TODO(kthelgason): Property stays here temporarily until a proper volume-api +// is available on the surface exposed by webrtc. +@property(nonatomic, assign) double volume; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource.mm b/sdk/objc/api/peerconnection/RTCAudioSource.mm similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource.mm rename to sdk/objc/api/peerconnection/RTCAudioSource.mm diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioTrack+Private.h b/sdk/objc/api/peerconnection/RTCAudioTrack+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCAudioTrack+Private.h rename to sdk/objc/api/peerconnection/RTCAudioTrack+Private.h index 7a2f2c82cd..fe30d65689 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioTrack+Private.h +++ b/sdk/objc/api/peerconnection/RTCAudioTrack+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCAudioTrack.h" +#import "RTCAudioTrack.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/api/peerconnection/RTCAudioTrack.h b/sdk/objc/api/peerconnection/RTCAudioTrack.h new file mode 100644 index 0000000000..4fb634fcab --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCAudioTrack.h @@ -0,0 +1,28 @@ +/* + * Copyright 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. + */ + +#import "RTCMacros.h" +#import "RTCMediaStreamTrack.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCAudioSource; + +RTC_EXPORT +@interface RTCAudioTrack : RTCMediaStreamTrack + +- (instancetype)init NS_UNAVAILABLE; + +/** The audio source for this audio track. */ +@property(nonatomic, readonly) RTCAudioSource *source; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioTrack.mm b/sdk/objc/api/peerconnection/RTCAudioTrack.mm similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCAudioTrack.mm rename to sdk/objc/api/peerconnection/RTCAudioTrack.mm index 73de401eeb..3389b7612c 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioTrack.mm +++ b/sdk/objc/api/peerconnection/RTCAudioTrack.mm @@ -10,10 +10,10 @@ #import "RTCAudioTrack+Private.h" -#import "NSString+StdString.h" #import "RTCAudioSource+Private.h" #import "RTCMediaStreamTrack+Private.h" #import "RTCPeerConnectionFactory+Private.h" +#import "helpers/NSString+StdString.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/api/peerconnection/RTCCertificate.h b/sdk/objc/api/peerconnection/RTCCertificate.h new file mode 100644 index 0000000000..f6e9d02511 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCCertificate.h @@ -0,0 +1,44 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCCertificate : NSObject + +/** Private key in PEM. */ +@property(nonatomic, readonly, copy) NSString *private_key; + +/** Public key in an x509 cert encoded in PEM. */ +@property(nonatomic, readonly, copy) NSString *certificate; + +/** + * Initialize an RTCCertificate with PEM strings for private_key and certificate. + */ +- (instancetype)initWithPrivateKey:(NSString *)private_key + certificate:(NSString *)certificate NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + +/** Generate a new certificate for 're' use. + * + * Optional dictionary of parameters. Defaults to KeyType ECDSA if none are + * provided. + * - name: "ECDSA" or "RSASSA-PKCS1-v1_5" + */ ++ (nullable RTCCertificate *)generateCertificateWithParams:(NSDictionary *)params; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCCertificate.mm b/sdk/objc/api/peerconnection/RTCCertificate.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCCertificate.mm rename to sdk/objc/api/peerconnection/RTCCertificate.mm index 34fa837bdc..bce4c3bd58 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCCertificate.mm +++ b/sdk/objc/api/peerconnection/RTCCertificate.mm @@ -8,8 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCCertificate.h" -#import "WebRTC/RTCLogging.h" +#import "RTCCertificate.h" + +#import "base/RTCLogging.h" #include "rtc_base/logging.h" #include "rtc_base/rtccertificategenerator.h" diff --git a/sdk/objc/api/peerconnection/RTCConfiguration+Native.h b/sdk/objc/api/peerconnection/RTCConfiguration+Native.h new file mode 100644 index 0000000000..e14e6d4d9d --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCConfiguration+Native.h @@ -0,0 +1,28 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCConfiguration.h" + +#include "api/peerconnectioninterface.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RTCConfiguration () + +/** Optional TurnCustomizer. + * With this class one can modify outgoing TURN messages. + * The object passed in must remain valid until PeerConnection::Close() is + * called. + */ +@property(nonatomic, nullable) webrtc::TurnCustomizer* turnCustomizer; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Private.h b/sdk/objc/api/peerconnection/RTCConfiguration+Private.h similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Private.h rename to sdk/objc/api/peerconnection/RTCConfiguration+Private.h index ad57336b70..cb45441a15 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration+Private.h +++ b/sdk/objc/api/peerconnection/RTCConfiguration+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCConfiguration.h" +#import "RTCConfiguration.h" #include "api/peerconnectioninterface.h" diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.h b/sdk/objc/api/peerconnection/RTCConfiguration.h new file mode 100644 index 0000000000..bc70f0f573 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCConfiguration.h @@ -0,0 +1,175 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCCertificate.h" +#import "RTCMacros.h" + +@class RTCIceServer; +@class RTCIntervalRange; + +/** + * Represents the ice transport policy. This exposes the same states in C++, + * which include one more state than what exists in the W3C spec. + */ +typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) { + RTCIceTransportPolicyNone, + RTCIceTransportPolicyRelay, + RTCIceTransportPolicyNoHost, + RTCIceTransportPolicyAll +}; + +/** Represents the bundle policy. */ +typedef NS_ENUM(NSInteger, RTCBundlePolicy) { + RTCBundlePolicyBalanced, + RTCBundlePolicyMaxCompat, + RTCBundlePolicyMaxBundle +}; + +/** Represents the rtcp mux policy. */ +typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire }; + +/** Represents the tcp candidate policy. */ +typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { + RTCTcpCandidatePolicyEnabled, + RTCTcpCandidatePolicyDisabled +}; + +/** Represents the candidate network policy. */ +typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) { + RTCCandidateNetworkPolicyAll, + RTCCandidateNetworkPolicyLowCost +}; + +/** Represents the continual gathering policy. */ +typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) { + RTCContinualGatheringPolicyGatherOnce, + RTCContinualGatheringPolicyGatherContinually +}; + +/** Represents the encryption key type. */ +typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) { + RTCEncryptionKeyTypeRSA, + RTCEncryptionKeyTypeECDSA, +}; + +/** Represents the chosen SDP semantics for the RTCPeerConnection. */ +typedef NS_ENUM(NSInteger, RTCSdpSemantics) { + RTCSdpSemanticsPlanB, + RTCSdpSemanticsUnifiedPlan, +}; + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCConfiguration : NSObject + +/** An array of Ice Servers available to be used by ICE. */ +@property(nonatomic, copy) NSArray *iceServers; + +/** An RTCCertificate for 're' use. */ +@property(nonatomic, nullable) RTCCertificate *certificate; + +/** Which candidates the ICE agent is allowed to use. The W3C calls it + * |iceTransportPolicy|, while in C++ it is called |type|. */ +@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; + +/** The media-bundling policy to use when gathering ICE candidates. */ +@property(nonatomic, assign) RTCBundlePolicy bundlePolicy; + +/** The rtcp-mux policy to use when gathering ICE candidates. */ +@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; +@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; +@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; +@property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; + +/** By default, the PeerConnection will use a limited number of IPv6 network + * interfaces, in order to avoid too many ICE candidate pairs being created + * and delaying ICE completion. + * + * Can be set to INT_MAX to effectively disable the limit. + */ +@property(nonatomic, assign) int maxIPv6Networks; + +/** Exclude link-local network interfaces + * from considertaion for gathering ICE candidates. + * Defaults to NO. + */ +@property(nonatomic, assign) BOOL disableLinkLocalNetworks; + +@property(nonatomic, assign) int audioJitterBufferMaxPackets; +@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate; +@property(nonatomic, assign) int iceConnectionReceivingTimeout; +@property(nonatomic, assign) int iceBackupCandidatePairPingInterval; + +/** Key type used to generate SSL identity. Default is ECDSA. */ +@property(nonatomic, assign) RTCEncryptionKeyType keyType; + +/** ICE candidate pool size as defined in JSEP. Default is 0. */ +@property(nonatomic, assign) int iceCandidatePoolSize; + +/** Prune turn ports on the same network to the same turn server. + * Default is NO. + */ +@property(nonatomic, assign) BOOL shouldPruneTurnPorts; + +/** If set to YES, this means the ICE transport should presume TURN-to-TURN + * candidate pairs will succeed, even before a binding response is received. + */ +@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed; + +/** If set to non-nil, controls the minimal interval between consecutive ICE + * check packets. + */ +@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; + +/** ICE Periodic Regathering + * If set, 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]. + */ +@property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange; + +/** Configure the SDP semantics used by this PeerConnection. Note that the + * WebRTC 1.0 specification requires UnifiedPlan semantics. The + * RTCRtpTransceiver API is only available with UnifiedPlan semantics. + * + * PlanB will cause RTCPeerConnection to create offers and answers with at + * most one audio and one video m= section with multiple RTCRtpSenders and + * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This + * will also cause RTCPeerConnection to ignore all but the first m= section of + * the same media type. + * + * UnifiedPlan will cause RTCPeerConnection to create offers and answers with + * multiple m= sections where each m= section maps to one RTCRtpSender and one + * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This + * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines + * that form a Plan B stream. + * + * For users who wish to send multiple audio/video streams and need to stay + * interoperable with legacy WebRTC implementations or use legacy APIs, + * specify PlanB. + * + * For all other users, specify UnifiedPlan. + */ +@property(nonatomic, assign) RTCSdpSemantics sdpSemantics; + +/** Actively reset the SRTP parameters when the DTLS transports underneath are + * changed after offer/answer negotiation. This is only intended to be a + * workaround for crbug.com/835958 + */ +@property(nonatomic, assign) BOOL activeResetSrtpParams; + +- (instancetype)init; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm b/sdk/objc/api/peerconnection/RTCConfiguration.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm rename to sdk/objc/api/peerconnection/RTCConfiguration.mm index 17483774fc..31805f1923 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCConfiguration.mm +++ b/sdk/objc/api/peerconnection/RTCConfiguration.mm @@ -12,10 +12,11 @@ #include +#import "RTCCertificate.h" #import "RTCConfiguration+Native.h" #import "RTCIceServer+Private.h" #import "RTCIntervalRange+Private.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" #include "rtc_base/rtccertificategenerator.h" #include "rtc_base/sslidentity.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannel+Private.h b/sdk/objc/api/peerconnection/RTCDataChannel+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDataChannel+Private.h rename to sdk/objc/api/peerconnection/RTCDataChannel+Private.h index 9849fd95c9..a88a316b10 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannel+Private.h +++ b/sdk/objc/api/peerconnection/RTCDataChannel+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCDataChannel.h" +#import "RTCDataChannel.h" #include "api/datachannelinterface.h" #include "rtc_base/scoped_ref_ptr.h" diff --git a/sdk/objc/api/peerconnection/RTCDataChannel.h b/sdk/objc/api/peerconnection/RTCDataChannel.h new file mode 100644 index 0000000000..8bde37239f --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCDataChannel.h @@ -0,0 +1,130 @@ +/* + * Copyright 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. + */ + +#import +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCDataBuffer : NSObject + +/** NSData representation of the underlying buffer. */ +@property(nonatomic, readonly) NSData *data; + +/** Indicates whether |data| contains UTF-8 or binary data. */ +@property(nonatomic, readonly) BOOL isBinary; + +- (instancetype)init NS_UNAVAILABLE; + +/** + * Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data| + * contains UTF-8 or binary data. + */ +- (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary; + +@end + +@class RTCDataChannel; +RTC_EXPORT +@protocol RTCDataChannelDelegate + +/** The data channel state changed. */ +- (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel; + +/** The data channel successfully received a data buffer. */ +- (void)dataChannel:(RTCDataChannel *)dataChannel + didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer; + +@optional +/** The data channel's |bufferedAmount| changed. */ +- (void)dataChannel:(RTCDataChannel *)dataChannel didChangeBufferedAmount:(uint64_t)amount; + +@end + +/** Represents the state of the data channel. */ +typedef NS_ENUM(NSInteger, RTCDataChannelState) { + RTCDataChannelStateConnecting, + RTCDataChannelStateOpen, + RTCDataChannelStateClosing, + RTCDataChannelStateClosed, +}; + +RTC_EXPORT +@interface RTCDataChannel : NSObject + +/** + * A label that can be used to distinguish this data channel from other data + * channel objects. + */ +@property(nonatomic, readonly) NSString *label; + +/** Whether the data channel can send messages in unreliable mode. */ +@property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE; + +/** Returns whether this data channel is ordered or not. */ +@property(nonatomic, readonly) BOOL isOrdered; + +/** Deprecated. Use maxPacketLifeTime. */ +@property(nonatomic, readonly) NSUInteger maxRetransmitTime DEPRECATED_ATTRIBUTE; + +/** + * The length of the time window (in milliseconds) during which transmissions + * and retransmissions may occur in unreliable mode. + */ +@property(nonatomic, readonly) uint16_t maxPacketLifeTime; + +/** + * The maximum number of retransmissions that are attempted in unreliable mode. + */ +@property(nonatomic, readonly) uint16_t maxRetransmits; + +/** + * The name of the sub-protocol used with this data channel, if any. Otherwise + * this returns an empty string. + */ +@property(nonatomic, readonly) NSString *protocol; + +/** + * Returns whether this data channel was negotiated by the application or not. + */ +@property(nonatomic, readonly) BOOL isNegotiated; + +/** Deprecated. Use channelId. */ +@property(nonatomic, readonly) NSInteger streamId DEPRECATED_ATTRIBUTE; + +/** The identifier for this data channel. */ +@property(nonatomic, readonly) int channelId; + +/** The state of the data channel. */ +@property(nonatomic, readonly) RTCDataChannelState readyState; + +/** + * The number of bytes of application data that have been queued using + * |sendData:| but that have not yet been transmitted to the network. + */ +@property(nonatomic, readonly) uint64_t bufferedAmount; + +/** The delegate for this data channel. */ +@property(nonatomic, weak) id delegate; + +- (instancetype)init NS_UNAVAILABLE; + +/** Closes the data channel. */ +- (void)close; + +/** Attempt to send |data| on this data channel's underlying data transport. */ +- (BOOL)sendData:(RTCDataBuffer *)data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannel.mm b/sdk/objc/api/peerconnection/RTCDataChannel.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDataChannel.mm rename to sdk/objc/api/peerconnection/RTCDataChannel.mm index 06ca453bd0..35c009eb96 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannel.mm +++ b/sdk/objc/api/peerconnection/RTCDataChannel.mm @@ -10,7 +10,7 @@ #import "RTCDataChannel+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" #include diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration+Private.h b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration+Private.h similarity index 93% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration+Private.h rename to sdk/objc/api/peerconnection/RTCDataChannelConfiguration+Private.h index 68d202280e..11be5a6c24 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration+Private.h +++ b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCDataChannelConfiguration.h" +#import "RTCDataChannelConfiguration.h" #include "api/datachannelinterface.h" diff --git a/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.h b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.h new file mode 100644 index 0000000000..de4b72a62d --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.h @@ -0,0 +1,52 @@ +/* + * Copyright 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. + */ + +#import +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCDataChannelConfiguration : NSObject + +/** Set to YES if ordered delivery is required. */ +@property(nonatomic, assign) BOOL isOrdered; + +/** Deprecated. Use maxPacketLifeTime. */ +@property(nonatomic, assign) NSInteger maxRetransmitTimeMs DEPRECATED_ATTRIBUTE; + +/** + * Max period in milliseconds in which retransmissions will be sent. After this + * time, no more retransmissions will be sent. -1 if unset. + */ +@property(nonatomic, assign) int maxPacketLifeTime; + +/** The max number of retransmissions. -1 if unset. */ +@property(nonatomic, assign) int maxRetransmits; + +/** Set to YES if the channel has been externally negotiated and we do not send + * an in-band signalling in the form of an "open" message. + */ +@property(nonatomic, assign) BOOL isNegotiated; + +/** Deprecated. Use channelId. */ +@property(nonatomic, assign) int streamId DEPRECATED_ATTRIBUTE; + +/** The id of the data channel. */ +@property(nonatomic, assign) int channelId; + +/** Set by the application and opaque to the WebRTC implementation. */ +@property(nonatomic) NSString* protocol; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration.mm b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration.mm rename to sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm index 89c56de786..1208b6dbed 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDataChannelConfiguration.mm +++ b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm @@ -10,7 +10,7 @@ #import "RTCDataChannelConfiguration+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" @implementation RTCDataChannelConfiguration diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDtmfSender+Private.h b/sdk/objc/api/peerconnection/RTCDtmfSender+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDtmfSender+Private.h rename to sdk/objc/api/peerconnection/RTCDtmfSender+Private.h index 197aeb83a4..cdcf62c8b5 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDtmfSender+Private.h +++ b/sdk/objc/api/peerconnection/RTCDtmfSender+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCDtmfSender.h" +#import "RTCDtmfSender.h" #include "api/dtmfsenderinterface.h" diff --git a/sdk/objc/api/peerconnection/RTCDtmfSender.h b/sdk/objc/api/peerconnection/RTCDtmfSender.h new file mode 100644 index 0000000000..1beed5c7a4 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCDtmfSender.h @@ -0,0 +1,70 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@protocol RTCDtmfSender + +/** + * Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise + * returns false. To be able to send DTMF, the associated RTCRtpSender must be + * able to send packets, and a "telephone-event" codec must be negotiated. + */ +@property(nonatomic, readonly) BOOL canInsertDtmf; + +/** + * Queues a task that sends the DTMF tones. The tones parameter is treated + * as a series of characters. The characters 0 through 9, A through D, #, and * + * generate the associated DTMF tones. The characters a to d are equivalent + * to A to D. The character ',' indicates a delay of 2 seconds before + * processing the next character in the tones parameter. + * + * Unrecognized characters are ignored. + * + * @param duration The parameter indicates the duration to use for each + * character passed in the tones parameter. The duration cannot be more + * than 6000 or less than 70 ms. + * + * @param interToneGap The parameter indicates the gap between tones. + * This parameter must be at least 50 ms but should be as short as + * possible. + * + * If InsertDtmf is called on the same object while an existing task for this + * object to generate DTMF is still running, the previous task is canceled. + * Returns true on success and false on failure. + */ +- (BOOL)insertDtmf:(nonnull NSString *)tones + duration:(NSTimeInterval)duration + interToneGap:(NSTimeInterval)interToneGap; + +/** The tones remaining to be played out */ +- (nonnull NSString *)remainingTones; + +/** + * The current tone duration value. This value will be the value last set via the + * insertDtmf method, or the default value of 100 ms if insertDtmf was never called. + */ +- (NSTimeInterval)duration; + +/** + * 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 50 ms if insertDtmf() was never + * called. + */ +- (NSTimeInterval)interToneGap; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDtmfSender.mm b/sdk/objc/api/peerconnection/RTCDtmfSender.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDtmfSender.mm rename to sdk/objc/api/peerconnection/RTCDtmfSender.mm index 7a5c97faeb..1513840013 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDtmfSender.mm +++ b/sdk/objc/api/peerconnection/RTCDtmfSender.mm @@ -10,8 +10,8 @@ #import "RTCDtmfSender+Private.h" -#import "NSString+StdString.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" #include "rtc_base/timeutils.h" diff --git a/sdk/objc/api/peerconnection/RTCEncodedImage+Private.h b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.h new file mode 100644 index 0000000000..1b125f1039 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import "base/RTCEncodedImage.h" + +#include "common_video/include/video_frame.h" + +NS_ASSUME_NONNULL_BEGIN + +/* Interfaces for converting to/from internal C++ formats. */ +@interface RTCEncodedImage (Private) + +- (instancetype)initWithNativeEncodedImage:(webrtc::EncodedImage)encodedImage; +- (webrtc::EncodedImage)nativeEncodedImage; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm new file mode 100644 index 0000000000..6f2d1f46d9 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm @@ -0,0 +1,66 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCEncodedImage+Private.h" + +#include "rtc_base/numerics/safe_conversions.h" + +@implementation RTCEncodedImage (Private) + +- (instancetype)initWithNativeEncodedImage:(webrtc::EncodedImage)encodedImage { + if (self = [super init]) { + // Wrap the buffer in NSData without copying, do not take ownership. + self.buffer = [NSData dataWithBytesNoCopy:encodedImage._buffer + length:encodedImage._length + freeWhenDone:NO]; + self.encodedWidth = rtc::dchecked_cast(encodedImage._encodedWidth); + self.encodedHeight = rtc::dchecked_cast(encodedImage._encodedHeight); + self.timeStamp = encodedImage.Timestamp(); + self.captureTimeMs = encodedImage.capture_time_ms_; + self.ntpTimeMs = encodedImage.ntp_time_ms_; + self.flags = encodedImage.timing_.flags; + self.encodeStartMs = encodedImage.timing_.encode_start_ms; + self.encodeFinishMs = encodedImage.timing_.encode_finish_ms; + self.frameType = static_cast(encodedImage._frameType); + self.rotation = static_cast(encodedImage.rotation_); + self.completeFrame = encodedImage._completeFrame; + self.qp = @(encodedImage.qp_); + self.contentType = (encodedImage.content_type_ == webrtc::VideoContentType::SCREENSHARE) ? + RTCVideoContentTypeScreenshare : + RTCVideoContentTypeUnspecified; + } + + return self; +} + +- (webrtc::EncodedImage)nativeEncodedImage { + // Return the pointer without copying. + webrtc::EncodedImage encodedImage( + (uint8_t *)self.buffer.bytes, (size_t)self.buffer.length, (size_t)self.buffer.length); + encodedImage._encodedWidth = rtc::dchecked_cast(self.encodedWidth); + encodedImage._encodedHeight = rtc::dchecked_cast(self.encodedHeight); + encodedImage.SetTimestamp(self.timeStamp); + encodedImage.capture_time_ms_ = self.captureTimeMs; + encodedImage.ntp_time_ms_ = self.ntpTimeMs; + encodedImage.timing_.flags = self.flags; + encodedImage.timing_.encode_start_ms = self.encodeStartMs; + encodedImage.timing_.encode_finish_ms = self.encodeFinishMs; + encodedImage._frameType = webrtc::FrameType(self.frameType); + encodedImage.rotation_ = webrtc::VideoRotation(self.rotation); + encodedImage._completeFrame = self.completeFrame; + encodedImage.qp_ = self.qp ? self.qp.intValue : -1; + encodedImage.content_type_ = (self.contentType == RTCVideoContentTypeScreenshare) ? + webrtc::VideoContentType::SCREENSHARE : + webrtc::VideoContentType::UNSPECIFIED; + + return encodedImage; +} + +@end diff --git a/sdk/objc/api/peerconnection/RTCFieldTrials.h b/sdk/objc/api/peerconnection/RTCFieldTrials.h new file mode 100644 index 0000000000..9b7f41c5bc --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCFieldTrials.h @@ -0,0 +1,46 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +/** The only valid value for the following if set is kRTCFieldTrialEnabledValue. */ +RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweKey; +RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweForVideoKey; +RTC_EXTERN NSString * const kRTCFieldTrialAudioForceNoTWCCKey; +RTC_EXTERN NSString * const kRTCFieldTrialAudioForceABWENoTWCCKey; +RTC_EXTERN NSString * const kRTCFieldTrialSendSideBweWithOverheadKey; +RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03AdvertisedKey; +RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03Key; +RTC_EXTERN NSString * const kRTCFieldTrialImprovedBitrateEstimateKey; +RTC_EXTERN NSString * const kRTCFieldTrialH264HighProfileKey; +RTC_EXTERN NSString * const kRTCFieldTrialMinimizeResamplingOnMobileKey; + +/** The valid value for field trials above. */ +RTC_EXTERN NSString * const kRTCFieldTrialEnabledValue; + +/** Use a string returned by RTCFieldTrialMedianSlopeFilterValue as the value. */ +RTC_EXTERN NSString * const kRTCFieldTrialMedianSlopeFilterKey; +RTC_EXTERN NSString *RTCFieldTrialMedianSlopeFilterValue( + size_t windowSize, double thresholdGain); + +/** Use a string returned by RTCFieldTrialTrendlineFilterValue as the value. */ +RTC_EXTERN NSString * const kRTCFieldTrialTrendlineFilterKey; +/** Returns a valid value for kRTCFieldTrialTrendlineFilterKey. */ +RTC_EXTERN NSString *RTCFieldTrialTrendlineFilterValue( + size_t windowSize, double smoothingCoeff, double thresholdGain); + +/** Initialize field trials using a dictionary mapping field trial keys to their values. See above + * for valid keys and values. + * Must be called before any other call into WebRTC. See: + * webrtc/system_wrappers/include/field_trial_default.h + */ +RTC_EXTERN void RTCInitFieldTrialDictionary(NSDictionary *fieldTrials); diff --git a/sdk/objc/Framework/Classes/Common/RTCFieldTrials.mm b/sdk/objc/api/peerconnection/RTCFieldTrials.mm similarity index 98% rename from sdk/objc/Framework/Classes/Common/RTCFieldTrials.mm rename to sdk/objc/api/peerconnection/RTCFieldTrials.mm index 9cbd640f0c..c81bc55a66 100644 --- a/sdk/objc/Framework/Classes/Common/RTCFieldTrials.mm +++ b/sdk/objc/api/peerconnection/RTCFieldTrials.mm @@ -8,11 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCFieldTrials.h" +#import "RTCFieldTrials.h" #include -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" // Adding 'nogncheck' to disable the gn include headers check. // We don't want to depend on 'system_wrappers:field_trial_default' because diff --git a/sdk/objc/api/peerconnection/RTCFileLogger.h b/sdk/objc/api/peerconnection/RTCFileLogger.h new file mode 100644 index 0000000000..36b0f75e84 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCFileLogger.h @@ -0,0 +1,74 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) { + RTCFileLoggerSeverityVerbose, + RTCFileLoggerSeverityInfo, + RTCFileLoggerSeverityWarning, + RTCFileLoggerSeverityError +}; + +typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) { + RTCFileLoggerTypeCall, + RTCFileLoggerTypeApp, +}; + +NS_ASSUME_NONNULL_BEGIN + +// This class intercepts WebRTC logs and saves them to a file. The file size +// will not exceed the given maximum bytesize. When the maximum bytesize is +// reached, logs are rotated according to the rotationType specified. +// For kRTCFileLoggerTypeCall, logs from the beginning and the end +// are preserved while the middle section is overwritten instead. +// For kRTCFileLoggerTypeApp, the oldest log is overwritten. +// This class is not threadsafe. +RTC_EXPORT +@interface RTCFileLogger : NSObject + +// The severity level to capture. The default is kRTCFileLoggerSeverityInfo. +@property(nonatomic, assign) RTCFileLoggerSeverity severity; + +// The rotation type for this file logger. The default is +// kRTCFileLoggerTypeCall. +@property(nonatomic, readonly) RTCFileLoggerRotationType rotationType; + +// Disables buffering disk writes. Should be set before |start|. Buffering +// is enabled by default for performance. +@property(nonatomic, assign) BOOL shouldDisableBuffering; + +// Default constructor provides default settings for dir path, file size and +// rotation type. +- (instancetype)init; + +// Create file logger with default rotation type. +- (instancetype)initWithDirPath:(NSString *)dirPath maxFileSize:(NSUInteger)maxFileSize; + +- (instancetype)initWithDirPath:(NSString *)dirPath + maxFileSize:(NSUInteger)maxFileSize + rotationType:(RTCFileLoggerRotationType)rotationType NS_DESIGNATED_INITIALIZER; + +// Starts writing WebRTC logs to disk if not already started. Overwrites any +// existing file(s). +- (void)start; + +// Stops writing WebRTC logs to disk. This method is also called on dealloc. +- (void)stop; + +// Returns the current contents of the logs, or nil if start has been called +// without a stop. +- (nullable NSData *)logData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Common/RTCFileLogger.mm b/sdk/objc/api/peerconnection/RTCFileLogger.mm similarity index 99% rename from sdk/objc/Framework/Classes/Common/RTCFileLogger.mm rename to sdk/objc/api/peerconnection/RTCFileLogger.mm index 6acb942a3a..3a7144af4c 100644 --- a/sdk/objc/Framework/Classes/Common/RTCFileLogger.mm +++ b/sdk/objc/api/peerconnection/RTCFileLogger.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCFileLogger.h" +#import "RTCFileLogger.h" #include diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCIceCandidate+Private.h b/sdk/objc/api/peerconnection/RTCIceCandidate+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCIceCandidate+Private.h rename to sdk/objc/api/peerconnection/RTCIceCandidate+Private.h index 47e934cbb3..8c9156c402 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCIceCandidate+Private.h +++ b/sdk/objc/api/peerconnection/RTCIceCandidate+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCIceCandidate.h" +#import "RTCIceCandidate.h" #include diff --git a/sdk/objc/api/peerconnection/RTCIceCandidate.h b/sdk/objc/api/peerconnection/RTCIceCandidate.h new file mode 100644 index 0000000000..7c72e56944 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCIceCandidate.h @@ -0,0 +1,49 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCIceCandidate : NSObject + +/** + * If present, the identifier of the "media stream identification" for the media + * component this candidate is associated with. + */ +@property(nonatomic, readonly, nullable) NSString *sdpMid; + +/** + * The index (starting at zero) of the media description this candidate is + * associated with in the SDP. + */ +@property(nonatomic, readonly) int sdpMLineIndex; + +/** The SDP string for this candidate. */ +@property(nonatomic, readonly) NSString *sdp; + +/** The URL of the ICE server which this candidate is gathered from. */ +@property(nonatomic, readonly, nullable) NSString *serverUrl; + +- (instancetype)init NS_UNAVAILABLE; + +/** + * Initialize an RTCIceCandidate from SDP. + */ +- (instancetype)initWithSdp:(NSString *)sdp + sdpMLineIndex:(int)sdpMLineIndex + sdpMid:(nullable NSString *)sdpMid NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCIceCandidate.mm b/sdk/objc/api/peerconnection/RTCIceCandidate.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCIceCandidate.mm rename to sdk/objc/api/peerconnection/RTCIceCandidate.mm index 0e2cc8abc8..cbae3f3ddf 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCIceCandidate.mm +++ b/sdk/objc/api/peerconnection/RTCIceCandidate.mm @@ -12,8 +12,8 @@ #include -#import "NSString+StdString.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" @implementation RTCIceCandidate diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCIceServer+Private.h b/sdk/objc/api/peerconnection/RTCIceServer+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCIceServer+Private.h rename to sdk/objc/api/peerconnection/RTCIceServer+Private.h index 0f6b7b7b83..8d16dfd625 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCIceServer+Private.h +++ b/sdk/objc/api/peerconnection/RTCIceServer+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCIceServer.h" +#import "RTCIceServer.h" #include "api/peerconnectioninterface.h" diff --git a/sdk/objc/api/peerconnection/RTCIceServer.h b/sdk/objc/api/peerconnection/RTCIceServer.h new file mode 100644 index 0000000000..c2def045a9 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCIceServer.h @@ -0,0 +1,114 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) { + RTCTlsCertPolicySecure, + RTCTlsCertPolicyInsecureNoCheck +}; + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCIceServer : NSObject + +/** URI(s) for this server represented as NSStrings. */ +@property(nonatomic, readonly) NSArray *urlStrings; + +/** Username to use if this RTCIceServer object is a TURN server. */ +@property(nonatomic, readonly, nullable) NSString *username; + +/** Credential to use if this RTCIceServer object is a TURN server. */ +@property(nonatomic, readonly, nullable) NSString *credential; + +/** + * TLS certificate policy to use if this RTCIceServer object is a TURN server. + */ +@property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy; + +/** + 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. + */ +@property(nonatomic, readonly, nullable) NSString *hostname; + +/** List of protocols to be used in the TLS ALPN extension. */ +@property(nonatomic, readonly) NSArray *tlsAlpnProtocols; + +/** + List elliptic curves to be used in the TLS elliptic curves extension. + Only curve names supported by OpenSSL should be used (eg. "P-256","X25519"). + */ +@property(nonatomic, readonly) NSArray *tlsEllipticCurves; + +- (nonnull instancetype)init NS_UNAVAILABLE; + +/** Convenience initializer for a server with no authentication (e.g. STUN). */ +- (instancetype)initWithURLStrings:(NSArray *)urlStrings; + +/** + * Initialize an RTCIceServer with its associated URLs, optional username, + * optional credential, and credentialType. + */ +- (instancetype)initWithURLStrings:(NSArray *)urlStrings + username:(nullable NSString *)username + credential:(nullable NSString *)credential; + +/** + * Initialize an RTCIceServer with its associated URLs, optional username, + * optional credential, and TLS cert policy. + */ +- (instancetype)initWithURLStrings:(NSArray *)urlStrings + username:(nullable NSString *)username + credential:(nullable NSString *)credential + tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy; + +/** + * Initialize an RTCIceServer with its associated URLs, optional username, + * optional credential, TLS cert policy and hostname. + */ +- (instancetype)initWithURLStrings:(NSArray *)urlStrings + username:(nullable NSString *)username + credential:(nullable NSString *)credential + tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy + hostname:(nullable NSString *)hostname; + +/** + * Initialize an RTCIceServer with its associated URLs, optional username, + * optional credential, TLS cert policy, hostname and ALPN protocols. + */ +- (instancetype)initWithURLStrings:(NSArray *)urlStrings + username:(nullable NSString *)username + credential:(nullable NSString *)credential + tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy + hostname:(nullable NSString *)hostname + tlsAlpnProtocols:(NSArray *)tlsAlpnProtocols; + +/** + * Initialize an RTCIceServer with its associated URLs, optional username, + * optional credential, TLS cert policy, hostname, ALPN protocols and + * elliptic curves. + */ +- (instancetype)initWithURLStrings:(NSArray *)urlStrings + username:(nullable NSString *)username + credential:(nullable NSString *)credential + tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy + hostname:(nullable NSString *)hostname + tlsAlpnProtocols:(nullable NSArray *)tlsAlpnProtocols + tlsEllipticCurves:(nullable NSArray *)tlsEllipticCurves + NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCIceServer.mm b/sdk/objc/api/peerconnection/RTCIceServer.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCIceServer.mm rename to sdk/objc/api/peerconnection/RTCIceServer.mm index eeb1177927..2138e4c16a 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCIceServer.mm +++ b/sdk/objc/api/peerconnection/RTCIceServer.mm @@ -10,7 +10,7 @@ #import "RTCIceServer+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" @implementation RTCIceServer diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCIntervalRange+Private.h b/sdk/objc/api/peerconnection/RTCIntervalRange+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCIntervalRange+Private.h rename to sdk/objc/api/peerconnection/RTCIntervalRange+Private.h index 690daf340e..a4e59cd8d0 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCIntervalRange+Private.h +++ b/sdk/objc/api/peerconnection/RTCIntervalRange+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCIntervalRange.h" +#import "RTCIntervalRange.h" #include "rtc_base/timeutils.h" diff --git a/sdk/objc/api/peerconnection/RTCIntervalRange.h b/sdk/objc/api/peerconnection/RTCIntervalRange.h new file mode 100644 index 0000000000..00508eba17 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCIntervalRange.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RTCIntervalRange : NSObject + +@property(nonatomic, readonly) NSInteger min; +@property(nonatomic, readonly) NSInteger max; + +- (instancetype)init; +- (instancetype)initWithMin:(NSInteger)min max:(NSInteger)max NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCIntervalRange.mm b/sdk/objc/api/peerconnection/RTCIntervalRange.mm similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCIntervalRange.mm rename to sdk/objc/api/peerconnection/RTCIntervalRange.mm diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport+Private.h b/sdk/objc/api/peerconnection/RTCLegacyStatsReport+Private.h similarity index 94% rename from sdk/objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport+Private.h rename to sdk/objc/api/peerconnection/RTCLegacyStatsReport+Private.h index 111fc2b45e..51888b6092 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport+Private.h +++ b/sdk/objc/api/peerconnection/RTCLegacyStatsReport+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCLegacyStatsReport.h" +#import "RTCLegacyStatsReport.h" #include "api/statstypes.h" diff --git a/sdk/objc/api/peerconnection/RTCLegacyStatsReport.h b/sdk/objc/api/peerconnection/RTCLegacyStatsReport.h new file mode 100644 index 0000000000..5ea9ff5367 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCLegacyStatsReport.h @@ -0,0 +1,37 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** This does not currently conform to the spec. */ +RTC_EXPORT +@interface RTCLegacyStatsReport : NSObject + +/** Time since 1970-01-01T00:00:00Z in milliseconds. */ +@property(nonatomic, readonly) CFTimeInterval timestamp; + +/** The type of stats held by this object. */ +@property(nonatomic, readonly) NSString *type; + +/** The identifier for this object. */ +@property(nonatomic, readonly) NSString *reportId; + +/** A dictionary holding the actual stats. */ +@property(nonatomic, readonly) NSDictionary *values; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport.mm b/sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport.mm rename to sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm index 89b205bf1c..89e1b85a69 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCLegacyStatsReport.mm +++ b/sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm @@ -10,8 +10,8 @@ #import "RTCLegacyStatsReport+Private.h" -#import "NSString+StdString.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaConstraints+Private.h b/sdk/objc/api/peerconnection/RTCMediaConstraints+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaConstraints+Private.h rename to sdk/objc/api/peerconnection/RTCMediaConstraints+Private.h index 1c8eb28895..68a9436974 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaConstraints+Private.h +++ b/sdk/objc/api/peerconnection/RTCMediaConstraints+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMediaConstraints.h" +#import "RTCMediaConstraints.h" #include diff --git a/sdk/objc/api/peerconnection/RTCMediaConstraints.h b/sdk/objc/api/peerconnection/RTCMediaConstraints.h new file mode 100644 index 0000000000..adde356fd3 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCMediaConstraints.h @@ -0,0 +1,54 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Constraint keys for media sources. */ +RTC_EXTERN NSString *const kRTCMediaConstraintsMinAspectRatio; +RTC_EXTERN NSString *const kRTCMediaConstraintsMaxAspectRatio; +RTC_EXTERN NSString *const kRTCMediaConstraintsMaxWidth; +RTC_EXTERN NSString *const kRTCMediaConstraintsMinWidth; +RTC_EXTERN NSString *const kRTCMediaConstraintsMaxHeight; +RTC_EXTERN NSString *const kRTCMediaConstraintsMinHeight; +RTC_EXTERN NSString *const kRTCMediaConstraintsMaxFrameRate; +RTC_EXTERN NSString *const kRTCMediaConstraintsMinFrameRate; +/** The value for this key should be a base64 encoded string containing + * the data from the serialized configuration proto. + */ +RTC_EXTERN NSString *const kRTCMediaConstraintsAudioNetworkAdaptorConfig; + +/** Constraint keys for generating offers and answers. */ +RTC_EXTERN NSString *const kRTCMediaConstraintsIceRestart; +RTC_EXTERN NSString *const kRTCMediaConstraintsOfferToReceiveAudio; +RTC_EXTERN NSString *const kRTCMediaConstraintsOfferToReceiveVideo; +RTC_EXTERN NSString *const kRTCMediaConstraintsVoiceActivityDetection; + +/** Constraint values for Boolean parameters. */ +RTC_EXTERN NSString *const kRTCMediaConstraintsValueTrue; +RTC_EXTERN NSString *const kRTCMediaConstraintsValueFalse; + +RTC_EXPORT +@interface RTCMediaConstraints : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** Initialize with mandatory and/or optional constraints. */ +- (instancetype) + initWithMandatoryConstraints:(nullable NSDictionary *)mandatory + optionalConstraints:(nullable NSDictionary *)optional + NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaConstraints.mm b/sdk/objc/api/peerconnection/RTCMediaConstraints.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaConstraints.mm rename to sdk/objc/api/peerconnection/RTCMediaConstraints.mm index 34e5899ad4..a45486feac 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaConstraints.mm +++ b/sdk/objc/api/peerconnection/RTCMediaConstraints.mm @@ -10,7 +10,7 @@ #import "RTCMediaConstraints+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" #include diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaSource+Private.h b/sdk/objc/api/peerconnection/RTCMediaSource+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaSource+Private.h rename to sdk/objc/api/peerconnection/RTCMediaSource+Private.h index 9883faf1c1..a34cbbd593 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaSource+Private.h +++ b/sdk/objc/api/peerconnection/RTCMediaSource+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMediaSource.h" +#import "RTCMediaSource.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/api/peerconnection/RTCMediaSource.h b/sdk/objc/api/peerconnection/RTCMediaSource.h new file mode 100644 index 0000000000..9a1137a322 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCMediaSource.h @@ -0,0 +1,34 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +typedef NS_ENUM(NSInteger, RTCSourceState) { + RTCSourceStateInitializing, + RTCSourceStateLive, + RTCSourceStateEnded, + RTCSourceStateMuted, +}; + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCMediaSource : NSObject + +/** The current state of the RTCMediaSource. */ +@property(nonatomic, readonly) RTCSourceState state; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaSource.mm b/sdk/objc/api/peerconnection/RTCMediaSource.mm similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaSource.mm rename to sdk/objc/api/peerconnection/RTCMediaSource.mm diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStream+Private.h b/sdk/objc/api/peerconnection/RTCMediaStream+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaStream+Private.h rename to sdk/objc/api/peerconnection/RTCMediaStream+Private.h index 3986066457..21d64ecbfa 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStream+Private.h +++ b/sdk/objc/api/peerconnection/RTCMediaStream+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMediaStream.h" +#import "RTCMediaStream.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/api/peerconnection/RTCMediaStream.h b/sdk/objc/api/peerconnection/RTCMediaStream.h new file mode 100644 index 0000000000..675e4b9bed --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCMediaStream.h @@ -0,0 +1,49 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCAudioTrack; +@class RTCPeerConnectionFactory; +@class RTCVideoTrack; + +RTC_EXPORT +@interface RTCMediaStream : NSObject + +/** The audio tracks in this stream. */ +@property(nonatomic, strong, readonly) NSArray *audioTracks; + +/** The video tracks in this stream. */ +@property(nonatomic, strong, readonly) NSArray *videoTracks; + +/** An identifier for this media stream. */ +@property(nonatomic, readonly) NSString *streamId; + +- (instancetype)init NS_UNAVAILABLE; + +/** Adds the given audio track to this media stream. */ +- (void)addAudioTrack:(RTCAudioTrack *)audioTrack; + +/** Adds the given video track to this media stream. */ +- (void)addVideoTrack:(RTCVideoTrack *)videoTrack; + +/** Removes the given audio track to this media stream. */ +- (void)removeAudioTrack:(RTCAudioTrack *)audioTrack; + +/** Removes the given video track to this media stream. */ +- (void)removeVideoTrack:(RTCVideoTrack *)videoTrack; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStream.mm b/sdk/objc/api/peerconnection/RTCMediaStream.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaStream.mm rename to sdk/objc/api/peerconnection/RTCMediaStream.mm index c8bcfd91a4..c1a402a648 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStream.mm +++ b/sdk/objc/api/peerconnection/RTCMediaStream.mm @@ -12,11 +12,11 @@ #include -#import "NSString+StdString.h" #import "RTCAudioTrack+Private.h" #import "RTCMediaStreamTrack+Private.h" #import "RTCPeerConnectionFactory+Private.h" #import "RTCVideoTrack+Private.h" +#import "helpers/NSString+StdString.h" @implementation RTCMediaStream { RTCPeerConnectionFactory *_factory; diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack+Private.h b/sdk/objc/api/peerconnection/RTCMediaStreamTrack+Private.h similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack+Private.h rename to sdk/objc/api/peerconnection/RTCMediaStreamTrack+Private.h index 6effeaac19..7f8810c650 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack+Private.h +++ b/sdk/objc/api/peerconnection/RTCMediaStreamTrack+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMediaStreamTrack.h" +#import "RTCMediaStreamTrack.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/api/peerconnection/RTCMediaStreamTrack.h b/sdk/objc/api/peerconnection/RTCMediaStreamTrack.h new file mode 100644 index 0000000000..60c9af46a0 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCMediaStreamTrack.h @@ -0,0 +1,50 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +/** + * Represents the state of the track. This exposes the same states in C++. + */ +typedef NS_ENUM(NSInteger, RTCMediaStreamTrackState) { + RTCMediaStreamTrackStateLive, + RTCMediaStreamTrackStateEnded +}; + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXTERN NSString *const kRTCMediaStreamTrackKindAudio; +RTC_EXTERN NSString *const kRTCMediaStreamTrackKindVideo; + +RTC_EXPORT +@interface RTCMediaStreamTrack : NSObject + +/** + * The kind of track. For example, "audio" if this track represents an audio + * track and "video" if this track represents a video track. + */ +@property(nonatomic, readonly) NSString *kind; + +/** An identifier string. */ +@property(nonatomic, readonly) NSString *trackId; + +/** The enabled state of the track. */ +@property(nonatomic, assign) BOOL isEnabled; + +/** The state of the track. */ +@property(nonatomic, readonly) RTCMediaStreamTrackState readyState; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack.mm b/sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack.mm rename to sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm index 07bb0094c1..07992a0202 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMediaStreamTrack.mm +++ b/sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm @@ -12,7 +12,7 @@ #import "RTCMediaStreamTrack+Private.h" #import "RTCVideoTrack+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" NSString * const kRTCMediaStreamTrackKindAudio = @(webrtc::MediaStreamTrackInterface::kAudioKind); diff --git a/sdk/objc/api/peerconnection/RTCMetrics.h b/sdk/objc/api/peerconnection/RTCMetrics.h new file mode 100644 index 0000000000..6629fdacec --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCMetrics.h @@ -0,0 +1,23 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCMetricsSampleInfo.h" + +/** + * Enables gathering of metrics (which can be fetched with + * RTCGetAndResetMetrics). Must be called before any other call into WebRTC. + */ +RTC_EXTERN void RTCEnableMetrics(void); + +/** Gets and clears native histograms. */ +RTC_EXTERN NSArray* RTCGetAndResetMetrics(void); diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMetrics.mm b/sdk/objc/api/peerconnection/RTCMetrics.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMetrics.mm rename to sdk/objc/api/peerconnection/RTCMetrics.mm index 2e80216dea..8ca9d965bd 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMetrics.mm +++ b/sdk/objc/api/peerconnection/RTCMetrics.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMetrics.h" +#import "RTCMetrics.h" #import "RTCMetricsSampleInfo+Private.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo+Private.h b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo+Private.h rename to sdk/objc/api/peerconnection/RTCMetricsSampleInfo+Private.h index ceaca8f53f..03eb8e7b8e 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo+Private.h +++ b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMetricsSampleInfo.h" +#import "RTCMetricsSampleInfo.h" // Adding 'nogncheck' to disable the gn include headers check. // We don't want to depend on 'system_wrappers:metrics_default' because diff --git a/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.h b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.h new file mode 100644 index 0000000000..707f866acd --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.h @@ -0,0 +1,48 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCMetricsSampleInfo : NSObject + +/** + * Example of RTCMetricsSampleInfo: + * name: "WebRTC.Video.InputFramesPerSecond" + * min: 1 + * max: 100 + * bucketCount: 50 + * samples: [29]:2 [30]:1 + */ + +/** The name of the histogram. */ +@property(nonatomic, readonly) NSString *name; + +/** The minimum bucket value. */ +@property(nonatomic, readonly) int min; + +/** The maximum bucket value. */ +@property(nonatomic, readonly) int max; + +/** The number of buckets. */ +@property(nonatomic, readonly) int bucketCount; + +/** A dictionary holding the samples . */ +@property(nonatomic, readonly) NSDictionary *samples; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo.mm b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo.mm rename to sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm index 628ba9e11c..a4937fbeac 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo.mm +++ b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm @@ -10,7 +10,7 @@ #import "RTCMetricsSampleInfo+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" @implementation RTCMetricsSampleInfo diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+DataChannel.mm b/sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+DataChannel.mm rename to sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm index c6f2b0bc9f..6c84fa3f61 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+DataChannel.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm @@ -10,9 +10,9 @@ #import "RTCPeerConnection+Private.h" -#import "NSString+StdString.h" #import "RTCDataChannel+Private.h" #import "RTCDataChannelConfiguration+Private.h" +#import "helpers/NSString+StdString.h" @implementation RTCPeerConnection (DataChannel) diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection+Native.h b/sdk/objc/api/peerconnection/RTCPeerConnection+Native.h new file mode 100644 index 0000000000..f0322a78f5 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCPeerConnection+Native.h @@ -0,0 +1,34 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCPeerConnection.h" + +#include + +namespace rtc { +class BitrateAllocationStrategy; +} // namespace rtc + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class extension exposes methods that work directly with injectable C++ components. + */ +@interface RTCPeerConnection () + +/** Sets current strategy. If not set default WebRTC allocator will be used. May be changed during + * an active session. + */ +- (void)setBitrateAllocationStrategy: + (std::unique_ptr)bitrateAllocationStrategy; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Private.h b/sdk/objc/api/peerconnection/RTCPeerConnection+Private.h similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Private.h rename to sdk/objc/api/peerconnection/RTCPeerConnection+Private.h index 5451a490bd..b6440cd434 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Private.h +++ b/sdk/objc/api/peerconnection/RTCPeerConnection+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCPeerConnection.h" +#import "RTCPeerConnection.h" #include "api/peerconnectioninterface.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Stats.mm b/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Stats.mm rename to sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm index e39972261b..72e8e5a522 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Stats.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm @@ -10,9 +10,9 @@ #import "RTCPeerConnection+Private.h" -#import "NSString+StdString.h" -#import "RTCMediaStreamTrack+Private.h" #import "RTCLegacyStatsReport+Private.h" +#import "RTCMediaStreamTrack+Private.h" +#import "helpers/NSString+StdString.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection.h b/sdk/objc/api/peerconnection/RTCPeerConnection.h new file mode 100644 index 0000000000..fa1e3c1e86 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCPeerConnection.h @@ -0,0 +1,316 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +@class RTCConfiguration; +@class RTCDataChannel; +@class RTCDataChannelConfiguration; +@class RTCIceCandidate; +@class RTCMediaConstraints; +@class RTCMediaStream; +@class RTCMediaStreamTrack; +@class RTCPeerConnectionFactory; +@class RTCRtpReceiver; +@class RTCRtpSender; +@class RTCRtpTransceiver; +@class RTCRtpTransceiverInit; +@class RTCSessionDescription; +@class RTCLegacyStatsReport; + +typedef NS_ENUM(NSInteger, RTCRtpMediaType); + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const kRTCPeerConnectionErrorDomain; +extern int const kRTCSessionDescriptionErrorCode; + +/** Represents the signaling state of the peer connection. */ +typedef NS_ENUM(NSInteger, RTCSignalingState) { + RTCSignalingStateStable, + RTCSignalingStateHaveLocalOffer, + RTCSignalingStateHaveLocalPrAnswer, + RTCSignalingStateHaveRemoteOffer, + RTCSignalingStateHaveRemotePrAnswer, + // Not an actual state, represents the total number of states. + RTCSignalingStateClosed, +}; + +/** Represents the ice connection state of the peer connection. */ +typedef NS_ENUM(NSInteger, RTCIceConnectionState) { + RTCIceConnectionStateNew, + RTCIceConnectionStateChecking, + RTCIceConnectionStateConnected, + RTCIceConnectionStateCompleted, + RTCIceConnectionStateFailed, + RTCIceConnectionStateDisconnected, + RTCIceConnectionStateClosed, + RTCIceConnectionStateCount, +}; + +/** Represents the ice gathering state of the peer connection. */ +typedef NS_ENUM(NSInteger, RTCIceGatheringState) { + RTCIceGatheringStateNew, + RTCIceGatheringStateGathering, + RTCIceGatheringStateComplete, +}; + +/** Represents the stats output level. */ +typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { + RTCStatsOutputLevelStandard, + RTCStatsOutputLevelDebug, +}; + +@class RTCPeerConnection; + +RTC_EXPORT +@protocol RTCPeerConnectionDelegate + +/** Called when the SignalingState changed. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didChangeSignalingState:(RTCSignalingState)stateChanged; + +/** Called when media is received on a new stream from remote peer. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection didAddStream:(RTCMediaStream *)stream; + +/** Called when a remote peer closes a stream. + * This is not called when RTCSdpSemanticsUnifiedPlan is specified. + */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection didRemoveStream:(RTCMediaStream *)stream; + +/** Called when negotiation is needed, for example ICE has restarted. */ +- (void)peerConnectionShouldNegotiate:(RTCPeerConnection *)peerConnection; + +/** Called any time the IceConnectionState changes. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didChangeIceConnectionState:(RTCIceConnectionState)newState; + +/** Called any time the IceGatheringState changes. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didChangeIceGatheringState:(RTCIceGatheringState)newState; + +/** New ice candidate has been found. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didGenerateIceCandidate:(RTCIceCandidate *)candidate; + +/** Called when a group of local Ice candidates have been removed. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didRemoveIceCandidates:(NSArray *)candidates; + +/** New data channel has been opened. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didOpenDataChannel:(RTCDataChannel *)dataChannel; + +/** Called when signaling indicates a transceiver will be receiving media from + * the remote endpoint. + * This is only called with RTCSdpSemanticsUnifiedPlan specified. + */ +@optional +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didStartReceivingOnTransceiver:(RTCRtpTransceiver *)transceiver; + +/** Called when a receiver and its track are created. */ +@optional +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didAddReceiver:(RTCRtpReceiver *)rtpReceiver + streams:(NSArray *)mediaStreams; + +/** Called when the receiver and its track are removed. */ +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didRemoveReceiver:(RTCRtpReceiver *)rtpReceiver; + +@end + +RTC_EXPORT +@interface RTCPeerConnection : NSObject + +/** The object that will be notifed about events such as state changes and + * streams being added or removed. + */ +@property(nonatomic, weak, nullable) id delegate; +/** This property is not available with RTCSdpSemanticsUnifiedPlan. Please use + * |senders| instead. + */ +@property(nonatomic, readonly) NSArray *localStreams; +@property(nonatomic, readonly, nullable) RTCSessionDescription *localDescription; +@property(nonatomic, readonly, nullable) RTCSessionDescription *remoteDescription; +@property(nonatomic, readonly) RTCSignalingState signalingState; +@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState; +@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState; +@property(nonatomic, readonly, copy) RTCConfiguration *configuration; + +/** Gets all RTCRtpSenders associated with this peer connection. + * Note: reading this property returns different instances of RTCRtpSender. + * Use isEqual: instead of == to compare RTCRtpSender instances. + */ +@property(nonatomic, readonly) NSArray *senders; + +/** Gets all RTCRtpReceivers associated with this peer connection. + * Note: reading this property returns different instances of RTCRtpReceiver. + * Use isEqual: instead of == to compare RTCRtpReceiver instances. + */ +@property(nonatomic, readonly) NSArray *receivers; + +/** Gets all RTCRtpTransceivers associated with this peer connection. + * Note: reading this property returns different instances of + * RTCRtpTransceiver. Use isEqual: instead of == to compare RTCRtpTransceiver + * instances. + * This is only available with RTCSdpSemanticsUnifiedPlan specified. + */ +@property(nonatomic, readonly) NSArray *transceivers; + +- (instancetype)init NS_UNAVAILABLE; + +/** Sets the PeerConnection's global configuration to |configuration|. + * Any changes to STUN/TURN servers or ICE candidate policy will affect the + * next gathering phase, and cause the next call to createOffer to generate + * new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies + * cannot be changed with this method. + */ +- (BOOL)setConfiguration:(RTCConfiguration *)configuration; + +/** Terminate all media and close the transport. */ +- (void)close; + +/** Provide a remote candidate to the ICE Agent. */ +- (void)addIceCandidate:(RTCIceCandidate *)candidate; + +/** Remove a group of remote candidates from the ICE Agent. */ +- (void)removeIceCandidates:(NSArray *)candidates; + +/** Add a new media stream to be sent on this peer connection. + * This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use + * addTrack instead. + */ +- (void)addStream:(RTCMediaStream *)stream; + +/** Remove the given media stream from this peer connection. + * This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use + * removeTrack instead. + */ +- (void)removeStream:(RTCMediaStream *)stream; + +/** Add a new media stream track to be sent on this peer connection, and return + * the newly created RTCRtpSender. The RTCRtpSender will be associated with + * the streams specified in the |streamIds| list. + * + * Errors: If an error occurs, returns nil. An error can occur if: + * - A sender already exists for the track. + * - The peer connection is closed. + */ +- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track streamIds:(NSArray *)streamIds; + +/** With PlanB semantics, removes an RTCRtpSender from this peer connection. + * + * With UnifiedPlan semantics, sets sender's track to null and removes the + * send component from the associated RTCRtpTransceiver's direction. + * + * Returns YES on success. + */ +- (BOOL)removeTrack:(RTCRtpSender *)sender; + +/** addTransceiver creates a new RTCRtpTransceiver and adds it to the set of + * transceivers. Adding a transceiver will cause future calls to CreateOffer + * to add a media description for the corresponding transceiver. + * + * The initial value of |mid| in the returned transceiver is nil. Setting a + * new session description may change it to a non-nil value. + * + * https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtransceiver + * + * Optionally, an RtpTransceiverInit structure can be specified to configure + * the transceiver from construction. If not specified, the transceiver will + * default to having a direction of kSendRecv and not be part of any streams. + * + * These methods are only available when Unified Plan is enabled (see + * RTCConfiguration). + */ + +/** Adds a transceiver with a sender set to transmit the given track. The kind + * of the transceiver (and sender/receiver) will be derived from the kind of + * the track. + */ +- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track; +- (RTCRtpTransceiver *)addTransceiverWithTrack:(RTCMediaStreamTrack *)track + init:(RTCRtpTransceiverInit *)init; + +/** Adds a transceiver with the given kind. Can either be RTCRtpMediaTypeAudio + * or RTCRtpMediaTypeVideo. + */ +- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType; +- (RTCRtpTransceiver *)addTransceiverOfType:(RTCRtpMediaType)mediaType + init:(RTCRtpTransceiverInit *)init; + +/** Generate an SDP offer. */ +- (void)offerForConstraints:(RTCMediaConstraints *)constraints + completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp, + NSError *_Nullable error))completionHandler; + +/** Generate an SDP answer. */ +- (void)answerForConstraints:(RTCMediaConstraints *)constraints + completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp, + NSError *_Nullable error))completionHandler; + +/** Apply the supplied RTCSessionDescription as the local description. */ +- (void)setLocalDescription:(RTCSessionDescription *)sdp + completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler; + +/** Apply the supplied RTCSessionDescription as the remote description. */ +- (void)setRemoteDescription:(RTCSessionDescription *)sdp + completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler; + +/** Limits the bandwidth allocated for all RTP streams sent by this + * PeerConnection. Nil parameters will be unchanged. Setting + * |currentBitrateBps| will force the available bitrate estimate to the given + * value. Returns YES if the parameters were successfully updated. + */ +- (BOOL)setBweMinBitrateBps:(nullable NSNumber *)minBitrateBps + currentBitrateBps:(nullable NSNumber *)currentBitrateBps + maxBitrateBps:(nullable NSNumber *)maxBitrateBps; + +/** Start or stop recording an Rtc EventLog. */ +- (BOOL)startRtcEventLogWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes; +- (void)stopRtcEventLog; + +@end + +@interface RTCPeerConnection (Media) + +/** Create an RTCRtpSender with the specified kind and media stream ID. + * See RTCMediaStreamTrack.h for available kinds. + * This method is not supported with RTCSdpSemanticsUnifiedPlan. Please use + * addTransceiver instead. + */ +- (RTCRtpSender *)senderWithKind:(NSString *)kind streamId:(NSString *)streamId; + +@end + +@interface RTCPeerConnection (DataChannel) + +/** Create a new data channel with the given label and configuration. */ +- (nullable RTCDataChannel *)dataChannelForLabel:(NSString *)label + configuration:(RTCDataChannelConfiguration *)configuration; + +@end + +@interface RTCPeerConnection (Stats) + +/** Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil + * statistics are gathered for all tracks. + */ +- (void)statsForTrack:(nullable RTCMediaStreamTrack *)mediaStreamTrack + statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel + completionHandler:(nullable void (^)(NSArray *stats))completionHandler; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm b/sdk/objc/api/peerconnection/RTCPeerConnection.mm similarity index 99% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm rename to sdk/objc/api/peerconnection/RTCPeerConnection.mm index 11c3a6d5e5..5277489747 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnection.mm @@ -10,7 +10,6 @@ #import "RTCPeerConnection+Private.h" -#import "NSString+StdString.h" #import "RTCConfiguration+Private.h" #import "RTCDataChannel+Private.h" #import "RTCIceCandidate+Private.h" @@ -24,7 +23,8 @@ #import "RTCRtpSender+Private.h" #import "RTCRtpTransceiver+Private.h" #import "RTCSessionDescription+Private.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" #include diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h new file mode 100644 index 0000000000..60aa08f7ca --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h @@ -0,0 +1,54 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCPeerConnectionFactory.h" + +#include "rtc_base/scoped_ref_ptr.h" + +namespace webrtc { + +class AudioDeviceModule; +class AudioEncoderFactory; +class AudioDecoderFactory; +class VideoEncoderFactory; +class VideoDecoderFactory; +class AudioProcessing; + +} // namespace webrtc + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class extension exposes methods that work directly with injectable C++ components. + */ +@interface RTCPeerConnectionFactory () + +- (instancetype)initNative NS_DESIGNATED_INITIALIZER; + +/* Initializer used when WebRTC is compiled with no media support */ +- (instancetype)initWithNoMedia; + +/* Initialize object with injectable native audio/video encoder/decoder factories */ +- (instancetype)initWithNativeAudioEncoderFactory: + (rtc::scoped_refptr)audioEncoderFactory + nativeAudioDecoderFactory: + (rtc::scoped_refptr)audioDecoderFactory + nativeVideoEncoderFactory: + (std::unique_ptr)videoEncoderFactory + nativeVideoDecoderFactory: + (std::unique_ptr)videoDecoderFactory + audioDeviceModule: + (nullable webrtc::AudioDeviceModule *)audioDeviceModule + audioProcessingModule: + (rtc::scoped_refptr)audioProcessingModule; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Private.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Private.h rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Private.h index 50944eecbb..4dc03cf0cc 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Private.h +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCPeerConnectionFactory.h" +#import "RTCPeerConnectionFactory.h" #include "api/peerconnectioninterface.h" #include "rtc_base/scoped_ref_ptr.h" diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.h new file mode 100644 index 0000000000..a5faeaee8f --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.h @@ -0,0 +1,81 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCAudioSource; +@class RTCAudioTrack; +@class RTCConfiguration; +@class RTCMediaConstraints; +@class RTCMediaStream; +@class RTCPeerConnection; +@class RTCVideoSource; +@class RTCVideoTrack; +@class RTCPeerConnectionFactoryOptions; +@protocol RTCPeerConnectionDelegate; +@protocol RTCVideoDecoderFactory; +@protocol RTCVideoEncoderFactory; + +RTC_EXPORT +@interface RTCPeerConnectionFactory : NSObject + +/* Initialize object with default H264 video encoder/decoder factories */ +- (instancetype)init; + +/* Initialize object with injectable video encoder/decoder factories */ +- (instancetype)initWithEncoderFactory:(nullable id)encoderFactory + decoderFactory:(nullable id)decoderFactory; + +/** Initialize an RTCAudioSource with constraints. */ +- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints; + +/** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source with no + * constraints. + */ +- (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId; + +/** Initialize an RTCAudioTrack with a source and an id. */ +- (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source trackId:(NSString *)trackId; + +/** Initialize a generic RTCVideoSource. The RTCVideoSource should be passed to a RTCVideoCapturer + * implementation, e.g. RTCCameraVideoCapturer, in order to produce frames. + */ +- (RTCVideoSource *)videoSource; + +/** Initialize an RTCVideoTrack with a source and an id. */ +- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source trackId:(NSString *)trackId; + +/** Initialize an RTCMediaStream with an id. */ +- (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId; + +/** Initialize an RTCPeerConnection with a configuration, constraints, and + * delegate. + */ +- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration + constraints:(RTCMediaConstraints *)constraints + delegate: + (nullable id)delegate; + +/** Set the options to be used for subsequently created RTCPeerConnections */ +- (void)setOptions:(nonnull RTCPeerConnectionFactoryOptions *)options; + +/** Start an AecDump recording. This API call will likely change in the future. */ +- (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes; + +/* Stop an active AecDump recording */ +- (void)stopAecDump; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm similarity index 94% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm index 4c801f05d6..403db040fb 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm @@ -12,7 +12,6 @@ #import "RTCPeerConnectionFactory+Private.h" #import "RTCPeerConnectionFactoryOptions+Private.h" -#import "NSString+StdString.h" #import "RTCAudioSource+Private.h" #import "RTCAudioTrack+Private.h" #import "RTCMediaConstraints+Private.h" @@ -20,10 +19,13 @@ #import "RTCPeerConnection+Private.h" #import "RTCVideoSource+Private.h" #import "RTCVideoTrack+Private.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoCodecFactory.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoDecoderFactory.h" +#import "base/RTCVideoEncoderFactory.h" +#import "helpers/NSString+StdString.h" #ifndef HAVE_NO_MEDIA -#import "WebRTC/RTCVideoCodecH264.h" +#import "components/video_codec/RTCVideoDecoderFactoryH264.h" +#import "components/video_codec/RTCVideoEncoderFactoryH264.h" // The no-media version PeerConnectionFactory doesn't depend on these files, but the gn check tool // is not smart enough to take the #ifdef into account. #include "api/audio_codecs/builtin_audio_decoder_factory.h" // nogncheck @@ -32,14 +34,14 @@ #include "modules/audio_device/include/audio_device.h" // nogncheck #include "modules/audio_processing/include/audio_processing.h" // nogncheck -#include "sdk/objc/Framework/Native/api/video_decoder_factory.h" -#include "sdk/objc/Framework/Native/api/video_encoder_factory.h" -#include "sdk/objc/Framework/Native/src/objc_video_decoder_factory.h" -#include "sdk/objc/Framework/Native/src/objc_video_encoder_factory.h" +#include "sdk/objc/native/api/video_decoder_factory.h" +#include "sdk/objc/native/api/video_encoder_factory.h" +#include "sdk/objc/native/src/objc_video_decoder_factory.h" +#include "sdk/objc/native/src/objc_video_encoder_factory.h" #endif #if defined(WEBRTC_IOS) -#import "sdk/objc/Framework/Native/api/audio_device_module.h" +#import "sdk/objc/native/api/audio_device_module.h" #endif // Adding the nogncheck to disable the including header check. diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm similarity index 85% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm index 9fb50de101..3bb75eec68 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.mm @@ -11,14 +11,15 @@ #import "RTCPeerConnectionFactory+Native.h" #import "RTCPeerConnectionFactoryBuilder+DefaultComponents.h" -#import "WebRTC/RTCVideoCodecH264.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "sdk/objc/Framework/Native/api/video_decoder_factory.h" -#include "sdk/objc/Framework/Native/api/video_encoder_factory.h" +#import "components/video_codec/RTCVideoDecoderFactoryH264.h" +#import "components/video_codec/RTCVideoEncoderFactoryH264.h" +#include "sdk/objc/native/api/video_decoder_factory.h" +#include "sdk/objc/native/api/video_encoder_factory.h" #if defined(WEBRTC_IOS) -#import "sdk/objc/Framework/Native/api/audio_device_module.h" +#import "sdk/objc/native/api/audio_device_module.h" #endif @implementation RTCPeerConnectionFactoryBuilder (DefaultComponents) diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.h rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h index 27bdcd9f56..cca54462b9 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.h +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCPeerConnectionFactory.h" +#import "RTCPeerConnectionFactory.h" #include "rtc_base/scoped_ref_ptr.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.mm similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.mm rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactoryBuilder.mm diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions+Private.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions+Private.h similarity index 93% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions+Private.h rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions+Private.h index 131e8ffda7..2ccbd1c294 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions+Private.h +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCPeerConnectionFactoryOptions.h" +#import "RTCPeerConnectionFactoryOptions.h" #include "api/peerconnectioninterface.h" diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h new file mode 100644 index 0000000000..26a743b3f4 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions.h @@ -0,0 +1,42 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCPeerConnectionFactoryOptions : NSObject + +@property(nonatomic, assign) BOOL disableEncryption; + +@property(nonatomic, assign) BOOL disableNetworkMonitor; + +@property(nonatomic, assign) BOOL ignoreLoopbackNetworkAdapter; + +@property(nonatomic, assign) BOOL ignoreVPNNetworkAdapter; + +@property(nonatomic, assign) BOOL ignoreCellularNetworkAdapter; + +@property(nonatomic, assign) BOOL ignoreWiFiNetworkAdapter; + +@property(nonatomic, assign) BOOL ignoreEthernetNetworkAdapter; + +@property(nonatomic, assign) BOOL enableAes128Sha1_32CryptoCipher; + +@property(nonatomic, assign) BOOL enableGcmCryptoSuites; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions.mm similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryOptions.mm rename to sdk/objc/api/peerconnection/RTCPeerConnectionFactoryOptions.mm diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtcpParameters+Private.h b/sdk/objc/api/peerconnection/RTCRtcpParameters+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtcpParameters+Private.h rename to sdk/objc/api/peerconnection/RTCRtcpParameters+Private.h index 4157ffe746..540601bdb9 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtcpParameters+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtcpParameters+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtcpParameters.h" +#import "RTCRtcpParameters.h" #include "api/rtpparameters.h" diff --git a/sdk/objc/api/peerconnection/RTCRtcpParameters.h b/sdk/objc/api/peerconnection/RTCRtcpParameters.h new file mode 100644 index 0000000000..2f4c43b879 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtcpParameters.h @@ -0,0 +1,30 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCRtcpParameters : NSObject + +/** The Canonical Name used by RTCP. */ +@property(nonatomic, readonly, copy) NSString *cname; + +/** Whether reduced size RTCP is configured or compound RTCP. */ +@property(nonatomic, assign) BOOL isReducedSize; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtcpParameters.mm b/sdk/objc/api/peerconnection/RTCRtcpParameters.mm similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtcpParameters.mm rename to sdk/objc/api/peerconnection/RTCRtcpParameters.mm index 1c8a31bf20..0c33dda961 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtcpParameters.mm +++ b/sdk/objc/api/peerconnection/RTCRtcpParameters.mm @@ -10,7 +10,7 @@ #import "RTCRtcpParameters+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" @implementation RTCRtcpParameters diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters+Private.h b/sdk/objc/api/peerconnection/RTCRtpCodecParameters+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters+Private.h rename to sdk/objc/api/peerconnection/RTCRtpCodecParameters+Private.h index c6ca462b1f..3759a27871 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpCodecParameters+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpCodecParameters.h" +#import "RTCRtpCodecParameters.h" #include "api/rtpparameters.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpCodecParameters.h b/sdk/objc/api/peerconnection/RTCRtpCodecParameters.h new file mode 100644 index 0000000000..cb69a37c95 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpCodecParameters.h @@ -0,0 +1,73 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXTERN const NSString *const kRTCRtxCodecName; +RTC_EXTERN const NSString *const kRTCRedCodecName; +RTC_EXTERN const NSString *const kRTCUlpfecCodecName; +RTC_EXTERN const NSString *const kRTCFlexfecCodecName; +RTC_EXTERN const NSString *const kRTCOpusCodecName; +RTC_EXTERN const NSString *const kRTCIsacCodecName; +RTC_EXTERN const NSString *const kRTCL16CodecName; +RTC_EXTERN const NSString *const kRTCG722CodecName; +RTC_EXTERN const NSString *const kRTCIlbcCodecName; +RTC_EXTERN const NSString *const kRTCPcmuCodecName; +RTC_EXTERN const NSString *const kRTCPcmaCodecName; +RTC_EXTERN const NSString *const kRTCDtmfCodecName; +RTC_EXTERN const NSString *const kRTCComfortNoiseCodecName; +RTC_EXTERN const NSString *const kRTCVp8CodecName; +RTC_EXTERN const NSString *const kRTCVp9CodecName; +RTC_EXTERN const NSString *const kRTCH264CodecName; + +/** Defined in http://w3c.github.io/webrtc-pc/#idl-def-RTCRtpCodecParameters */ +RTC_EXPORT +@interface RTCRtpCodecParameters : NSObject + +/** The RTP payload type. */ +@property(nonatomic, assign) int payloadType; + +/** + * The codec MIME subtype. Valid types are listed in: + * http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2 + * + * Several supported types are represented by the constants above. + */ +@property(nonatomic, readonly, nonnull) NSString *name; + +/** + * The media type of this codec. Equivalent to MIME top-level type. + * + * Valid values are kRTCMediaStreamTrackKindAudio and + * kRTCMediaStreamTrackKindVideo. + */ +@property(nonatomic, readonly, nonnull) NSString *kind; + +/** The codec clock rate expressed in Hertz. */ +@property(nonatomic, readonly, nullable) NSNumber *clockRate; + +/** + * The number of channels (mono=1, stereo=2). + * Set to null for video codecs. + **/ +@property(nonatomic, readonly, nullable) NSNumber *numChannels; + +/** The "format specific parameters" field from the "a=fmtp" line in the SDP */ +@property(nonatomic, readonly, nonnull) NSDictionary *parameters; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters.mm b/sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters.mm rename to sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm index 7951cee45d..d555beab43 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpCodecParameters.mm +++ b/sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm @@ -10,8 +10,8 @@ #import "RTCRtpCodecParameters+Private.h" -#import "NSString+StdString.h" -#import "WebRTC/RTCMediaStreamTrack.h" // For "kind" strings. +#import "RTCMediaStreamTrack.h" +#import "helpers/NSString+StdString.h" #include "media/base/mediaconstants.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters+Private.h b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters+Private.h rename to sdk/objc/api/peerconnection/RTCRtpEncodingParameters+Private.h index c64501f062..fe60948e0b 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpEncodingParameters.h" +#import "RTCRtpEncodingParameters.h" #include "api/rtpparameters.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.h b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.h new file mode 100644 index 0000000000..900b37918f --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.h @@ -0,0 +1,42 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCRtpEncodingParameters : NSObject + +/** Controls whether the encoding is currently transmitted. */ +@property(nonatomic, assign) BOOL isActive; + +/** The maximum bitrate to use for the encoding, or nil if there is no + * limit. + */ +@property(nonatomic, copy, nullable) NSNumber *maxBitrateBps; + +/** The minimum bitrate to use for the encoding, or nil if there is no + * limit. + * + * Not implemented. + */ +@property(nonatomic, copy, nullable) NSNumber *minBitrateBps; + +/** The SSRC being used by this encoding. */ +@property(nonatomic, readonly, nullable) NSNumber *ssrc; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters.mm b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm similarity index 100% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpEncodingParameters.mm rename to sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm diff --git a/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h b/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h new file mode 100644 index 0000000000..cfb7fb1145 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h @@ -0,0 +1,26 @@ +/* + * Copyright 2017 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. + */ + +#import "base/RTCRtpFragmentationHeader.h" + +#include "modules/include/module_common_types.h" + +NS_ASSUME_NONNULL_BEGIN + +/* Interfaces for converting to/from internal C++ formats. */ +@interface RTCRtpFragmentationHeader (Private) + +- (instancetype)initWithNativeFragmentationHeader: + (const webrtc::RTPFragmentationHeader *__nullable)fragmentationHeader; +- (std::unique_ptr)createNativeFragmentationHeader; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpFragmentationHeader.mm b/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm similarity index 61% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpFragmentationHeader.mm rename to sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm index 87c88a49ec..e2f4b1012d 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpFragmentationHeader.mm +++ b/sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.mm @@ -8,16 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCodec.h" +#import "RTCRtpFragmentationHeader+Private.h" #include "modules/include/module_common_types.h" -@implementation RTCRtpFragmentationHeader - -@synthesize fragmentationOffset = _fragmentationOffset; -@synthesize fragmentationLength = _fragmentationLength; -@synthesize fragmentationTimeDiff = _fragmentationTimeDiff; -@synthesize fragmentationPlType = _fragmentationPlType; +@implementation RTCRtpFragmentationHeader (Private) - (instancetype)initWithNativeFragmentationHeader: (const webrtc::RTPFragmentationHeader *)fragmentationHeader { @@ -34,10 +29,10 @@ [timeDiffs addObject:@(fragmentationHeader->fragmentationTimeDiff[i])]; [plTypes addObject:@(fragmentationHeader->fragmentationPlType[i])]; } - _fragmentationOffset = [offsets copy]; - _fragmentationLength = [lengths copy]; - _fragmentationTimeDiff = [timeDiffs copy]; - _fragmentationPlType = [plTypes copy]; + self.fragmentationOffset = [offsets copy]; + self.fragmentationLength = [lengths copy]; + self.fragmentationTimeDiff = [timeDiffs copy]; + self.fragmentationPlType = [plTypes copy]; } } @@ -47,13 +42,13 @@ - (std::unique_ptr)createNativeFragmentationHeader { auto fragmentationHeader = std::unique_ptr(new webrtc::RTPFragmentationHeader); - fragmentationHeader->VerifyAndAllocateFragmentationHeader(_fragmentationOffset.count); - for (NSUInteger i = 0; i < _fragmentationOffset.count; ++i) { - fragmentationHeader->fragmentationOffset[i] = (size_t)_fragmentationOffset[i].unsignedIntValue; - fragmentationHeader->fragmentationLength[i] = (size_t)_fragmentationLength[i].unsignedIntValue; + fragmentationHeader->VerifyAndAllocateFragmentationHeader(self.fragmentationOffset.count); + for (NSUInteger i = 0; i < self.fragmentationOffset.count; ++i) { + fragmentationHeader->fragmentationOffset[i] = (size_t)self.fragmentationOffset[i].unsignedIntValue; + fragmentationHeader->fragmentationLength[i] = (size_t)self.fragmentationLength[i].unsignedIntValue; fragmentationHeader->fragmentationTimeDiff[i] = - (uint16_t)_fragmentationOffset[i].unsignedIntValue; - fragmentationHeader->fragmentationPlType[i] = (uint8_t)_fragmentationOffset[i].unsignedIntValue; + (uint16_t)self.fragmentationOffset[i].unsignedIntValue; + fragmentationHeader->fragmentationPlType[i] = (uint8_t)self.fragmentationOffset[i].unsignedIntValue; } return fragmentationHeader; diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension+Private.h b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension+Private.h rename to sdk/objc/api/peerconnection/RTCRtpHeaderExtension+Private.h index 0bc236b594..3f1f547afc 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpHeaderExtension.h" +#import "RTCRtpHeaderExtension.h" #include "api/rtpparameters.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.h b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.h new file mode 100644 index 0000000000..8dd80ff46c --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.h @@ -0,0 +1,33 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCRtpHeaderExtension : NSObject + +/** The URI of the RTP header extension, as defined in RFC5285. */ +@property(nonatomic, readonly, copy) NSString *uri; + +/** The value put in the RTP packet to identify the header extension. */ +@property(nonatomic, readonly) int id; + +/** Whether the header extension is encrypted or not. */ +@property(nonatomic, readonly, getter=isEncrypted) BOOL encrypted; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension.mm b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension.mm rename to sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm index 3f448d73fb..afc47868fe 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpHeaderExtension.mm +++ b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm @@ -10,7 +10,7 @@ #import "RTCRtpHeaderExtension+Private.h" -#import "NSString+StdString.h" +#import "helpers/NSString+StdString.h" @implementation RTCRtpHeaderExtension diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpParameters+Private.h b/sdk/objc/api/peerconnection/RTCRtpParameters+Private.h similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpParameters+Private.h rename to sdk/objc/api/peerconnection/RTCRtpParameters+Private.h index 41d1b7c601..0b7aa2077e 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpParameters+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpParameters+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpParameters.h" +#import "RTCRtpParameters.h" #include "api/rtpparameters.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpParameters.h b/sdk/objc/api/peerconnection/RTCRtpParameters.h new file mode 100644 index 0000000000..a4acc9ba72 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpParameters.h @@ -0,0 +1,43 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCRtcpParameters.h" +#import "RTCRtpCodecParameters.h" +#import "RTCRtpEncodingParameters.h" +#import "RTCRtpHeaderExtension.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCRtpParameters : NSObject + +/** A unique identifier for the last set of parameters applied. */ +@property(nonatomic, copy) NSString *transactionId; + +/** Parameters used for RTCP. */ +@property(nonatomic, readonly, copy) RTCRtcpParameters *rtcp; + +/** An array containing parameters for RTP header extensions. */ +@property(nonatomic, readonly, copy) NSArray *headerExtensions; + +/** The currently active encodings in the order of preference. */ +@property(nonatomic, copy) NSArray *encodings; + +/** The negotiated set of send codecs in order of preference. */ +@property(nonatomic, copy) NSArray *codecs; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpParameters.mm b/sdk/objc/api/peerconnection/RTCRtpParameters.mm similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpParameters.mm rename to sdk/objc/api/peerconnection/RTCRtpParameters.mm index 97800ca639..9b76ac525f 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpParameters.mm +++ b/sdk/objc/api/peerconnection/RTCRtpParameters.mm @@ -10,11 +10,11 @@ #import "RTCRtpParameters+Private.h" -#import "NSString+StdString.h" #import "RTCRtcpParameters+Private.h" #import "RTCRtpCodecParameters+Private.h" #import "RTCRtpEncodingParameters+Private.h" #import "RTCRtpHeaderExtension+Private.h" +#import "helpers/NSString+StdString.h" @implementation RTCRtpParameters diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpReceiver+Private.h b/sdk/objc/api/peerconnection/RTCRtpReceiver+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpReceiver+Private.h rename to sdk/objc/api/peerconnection/RTCRtpReceiver+Private.h index 6ec49bede4..019b57641b 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpReceiver+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpReceiver+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpReceiver.h" +#import "RTCRtpReceiver.h" #include "api/rtpreceiverinterface.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpReceiver.h b/sdk/objc/api/peerconnection/RTCRtpReceiver.h new file mode 100644 index 0000000000..902347995b --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpReceiver.h @@ -0,0 +1,82 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCMediaStreamTrack.h" +#import "RTCRtpParameters.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Represents the media type of the RtpReceiver. */ +typedef NS_ENUM(NSInteger, RTCRtpMediaType) { + RTCRtpMediaTypeAudio, + RTCRtpMediaTypeVideo, + RTCRtpMediaTypeData, +}; + +@class RTCRtpReceiver; + +RTC_EXPORT +@protocol RTCRtpReceiverDelegate + +/** Called when the first RTP packet is received. + * + * Note: Currently if there are multiple RtpReceivers of the same media type, + * they will all call OnFirstPacketReceived at once. + * + * For example, if we create three audio receivers, A/B/C, they will listen to + * the same signal from the underneath network layer. Whenever the first audio packet + * is received, the underneath signal will be fired. All the receivers A/B/C will be + * notified and the callback of the receiver's delegate will be called. + * + * The process is the same for video receivers. + */ +- (void)rtpReceiver:(RTCRtpReceiver *)rtpReceiver + didReceiveFirstPacketForMediaType:(RTCRtpMediaType)mediaType; + +@end + +RTC_EXPORT +@protocol RTCRtpReceiver + +/** A unique identifier for this receiver. */ +@property(nonatomic, readonly) NSString *receiverId; + +/** The currently active RTCRtpParameters, as defined in + * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters. + * + * The WebRTC specification only defines RTCRtpParameters in terms of senders, + * but this API also applies them to receivers, similar to ORTC: + * http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*. + */ +@property(nonatomic, readonly) RTCRtpParameters *parameters; + +/** The RTCMediaStreamTrack associated with the receiver. + * Note: reading this property returns a new instance of + * RTCMediaStreamTrack. Use isEqual: instead of == to compare + * RTCMediaStreamTrack instances. + */ +@property(nonatomic, readonly, nullable) RTCMediaStreamTrack *track; + +/** The delegate for this RtpReceiver. */ +@property(nonatomic, weak) id delegate; + +@end + +RTC_EXPORT +@interface RTCRtpReceiver : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpReceiver.mm b/sdk/objc/api/peerconnection/RTCRtpReceiver.mm similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpReceiver.mm rename to sdk/objc/api/peerconnection/RTCRtpReceiver.mm index 895c451a04..6d2048d815 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpReceiver.mm +++ b/sdk/objc/api/peerconnection/RTCRtpReceiver.mm @@ -10,10 +10,10 @@ #import "RTCRtpReceiver+Private.h" -#import "NSString+StdString.h" #import "RTCMediaStreamTrack+Private.h" #import "RTCRtpParameters+Private.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpSender+Private.h b/sdk/objc/api/peerconnection/RTCRtpSender+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpSender+Private.h rename to sdk/objc/api/peerconnection/RTCRtpSender+Private.h index 5b671ae7c7..d0dcb2bbdb 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpSender+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpSender+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpSender.h" +#import "RTCRtpSender.h" #include "api/rtpsenderinterface.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpSender.h b/sdk/objc/api/peerconnection/RTCRtpSender.h new file mode 100644 index 0000000000..55ab383a6f --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpSender.h @@ -0,0 +1,50 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCDtmfSender.h" +#import "RTCMacros.h" +#import "RTCMediaStreamTrack.h" +#import "RTCRtpParameters.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@protocol RTCRtpSender + +/** A unique identifier for this sender. */ +@property(nonatomic, readonly) NSString *senderId; + +/** The currently active RTCRtpParameters, as defined in + * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters. + */ +@property(nonatomic, copy) RTCRtpParameters *parameters; + +/** The RTCMediaStreamTrack associated with the sender. + * Note: reading this property returns a new instance of + * RTCMediaStreamTrack. Use isEqual: instead of == to compare + * RTCMediaStreamTrack instances. + */ +@property(nonatomic, copy, nullable) RTCMediaStreamTrack *track; + +/** The RTCDtmfSender accociated with the RTP sender. */ +@property(nonatomic, readonly, nullable) id dtmfSender; + +@end + +RTC_EXPORT +@interface RTCRtpSender : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpSender.mm b/sdk/objc/api/peerconnection/RTCRtpSender.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpSender.mm rename to sdk/objc/api/peerconnection/RTCRtpSender.mm index 6a46edfef3..64e9204b32 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpSender.mm +++ b/sdk/objc/api/peerconnection/RTCRtpSender.mm @@ -10,11 +10,11 @@ #import "RTCRtpSender+Private.h" -#import "NSString+StdString.h" #import "RTCDtmfSender+Private.h" #import "RTCMediaStreamTrack+Private.h" #import "RTCRtpParameters+Private.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpTransceiver+Private.h b/sdk/objc/api/peerconnection/RTCRtpTransceiver+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpTransceiver+Private.h rename to sdk/objc/api/peerconnection/RTCRtpTransceiver+Private.h index ee361ea8bf..61cbcb3a26 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpTransceiver+Private.h +++ b/sdk/objc/api/peerconnection/RTCRtpTransceiver+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCRtpTransceiver.h" +#import "RTCRtpTransceiver.h" #include "api/rtptransceiverinterface.h" diff --git a/sdk/objc/api/peerconnection/RTCRtpTransceiver.h b/sdk/objc/api/peerconnection/RTCRtpTransceiver.h new file mode 100644 index 0000000000..402b04e0d7 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCRtpTransceiver.h @@ -0,0 +1,128 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCRtpReceiver.h" +#import "RTCRtpSender.h" + +NS_ASSUME_NONNULL_BEGIN + +/** https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverdirection */ +typedef NS_ENUM(NSInteger, RTCRtpTransceiverDirection) { + RTCRtpTransceiverDirectionSendRecv, + RTCRtpTransceiverDirectionSendOnly, + RTCRtpTransceiverDirectionRecvOnly, + RTCRtpTransceiverDirectionInactive, +}; + +/** Structure for initializing an RTCRtpTransceiver in a call to + * RTCPeerConnection.addTransceiver. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit + */ +@interface RTCRtpTransceiverInit : NSObject + +/** Direction of the RTCRtpTransceiver. See RTCRtpTransceiver.direction. */ +@property(nonatomic) RTCRtpTransceiverDirection direction; + +/** The added RTCRtpTransceiver will be added to these streams. */ +@property(nonatomic) NSArray *streamIds; + +/** TODO(bugs.webrtc.org/7600): Not implemented. */ +@property(nonatomic) NSArray *sendEncodings; + +@end + +@class RTCRtpTransceiver; + +/** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the WebRTC + * specification. A transceiver represents a combination of an RTCRtpSender + * and an RTCRtpReceiver that share a common mid. As defined in JSEP, an + * RTCRtpTransceiver is said to be associated with a media description if its + * mid property is non-nil; otherwise, it is said to be disassociated. + * JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24 + * + * Note that RTCRtpTransceivers are only supported when using + * RTCPeerConnection with Unified Plan SDP. + * + * WebRTC specification for RTCRtpTransceiver, the JavaScript analog: + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver + */ +RTC_EXPORT +@protocol RTCRtpTransceiver + +/** Media type of the transceiver. The sender and receiver will also have this + * type. + */ +@property(nonatomic, readonly) RTCRtpMediaType mediaType; + +/** The mid attribute is the mid negotiated and present in the local and + * remote descriptions. Before negotiation is complete, the mid value may be + * nil. After rollbacks, the value may change from a non-nil value to nil. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid + */ +@property(nonatomic, readonly) NSString *mid; + +/** The sender attribute exposes the RTCRtpSender corresponding to the RTP + * media that may be sent with the transceiver's mid. The sender is always + * present, regardless of the direction of media. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender + */ +@property(nonatomic, readonly) RTCRtpSender *sender; + +/** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP + * media that may be received with the transceiver's mid. The receiver is + * always present, regardless of the direction of media. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver + */ +@property(nonatomic, readonly) RTCRtpReceiver *receiver; + +/** The isStopped 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. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped + */ +@property(nonatomic, readonly) BOOL isStopped; + +/** 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 + * descriptions as sendrecv, sendonly, recvonly, or inactive. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction + */ +@property(nonatomic) RTCRtpTransceiverDirection direction; + +/** The currentDirection attribute indicates the current direction negotiated + * for this transceiver. If this transceiver has never been represented in an + * offer/answer exchange, or if the transceiver is stopped, the value is not + * present and this method returns NO. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection + */ +- (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut; + +/** The stop method irreversibly stops the RTCRtpTransceiver. The sender of + * this transceiver will no longer send, the receiver will no longer receive. + * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop + */ +- (void)stop; + +@end + +RTC_EXPORT +@interface RTCRtpTransceiver : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpTransceiver.mm b/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCRtpTransceiver.mm rename to sdk/objc/api/peerconnection/RTCRtpTransceiver.mm index cf39d5beff..fe1ebb5c5d 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCRtpTransceiver.mm +++ b/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm @@ -10,12 +10,12 @@ #import "RTCRtpTransceiver+Private.h" -#import "NSString+StdString.h" #import "RTCRtpEncodingParameters+Private.h" #import "RTCRtpParameters+Private.h" #import "RTCRtpReceiver+Private.h" #import "RTCRtpSender+Private.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" @implementation RTCRtpTransceiverInit diff --git a/sdk/objc/api/peerconnection/RTCSSLAdapter.h b/sdk/objc/api/peerconnection/RTCSSLAdapter.h new file mode 100644 index 0000000000..f68bc5e9e3 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCSSLAdapter.h @@ -0,0 +1,20 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +/** + * Initialize and clean up the SSL library. Failure is fatal. These call the + * corresponding functions in webrtc/rtc_base/ssladapter.h. + */ +RTC_EXTERN BOOL RTCInitializeSSL(void); +RTC_EXTERN BOOL RTCCleanupSSL(void); diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCSSLAdapter.mm b/sdk/objc/api/peerconnection/RTCSSLAdapter.mm similarity index 95% rename from sdk/objc/Framework/Classes/PeerConnection/RTCSSLAdapter.mm rename to sdk/objc/api/peerconnection/RTCSSLAdapter.mm index dfe54b5e20..18388f99d7 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCSSLAdapter.mm +++ b/sdk/objc/api/peerconnection/RTCSSLAdapter.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCSSLAdapter.h" +#import "RTCSSLAdapter.h" #include "rtc_base/checks.h" #include "rtc_base/ssladapter.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCSessionDescription+Private.h b/sdk/objc/api/peerconnection/RTCSessionDescription+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCSessionDescription+Private.h rename to sdk/objc/api/peerconnection/RTCSessionDescription+Private.h index 08a6f55c58..cc255cd582 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCSessionDescription+Private.h +++ b/sdk/objc/api/peerconnection/RTCSessionDescription+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCSessionDescription.h" +#import "RTCSessionDescription.h" #include "api/jsep.h" diff --git a/sdk/objc/api/peerconnection/RTCSessionDescription.h b/sdk/objc/api/peerconnection/RTCSessionDescription.h new file mode 100644 index 0000000000..bef3a4ce1c --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCSessionDescription.h @@ -0,0 +1,47 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +/** + * Represents the session description type. This exposes the same types that are + * in C++, which doesn't include the rollback type that is in the W3C spec. + */ +typedef NS_ENUM(NSInteger, RTCSdpType) { + RTCSdpTypeOffer, + RTCSdpTypePrAnswer, + RTCSdpTypeAnswer, +}; + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +@interface RTCSessionDescription : NSObject + +/** The type of session description. */ +@property(nonatomic, readonly) RTCSdpType type; + +/** The SDP string representation of this session description. */ +@property(nonatomic, readonly) NSString *sdp; + +- (instancetype)init NS_UNAVAILABLE; + +/** Initialize a session description with a type and SDP string. */ +- (instancetype)initWithType:(RTCSdpType)type sdp:(NSString *)sdp NS_DESIGNATED_INITIALIZER; + ++ (NSString *)stringForType:(RTCSdpType)type; + ++ (RTCSdpType)typeForString:(NSString *)string; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCSessionDescription.mm b/sdk/objc/api/peerconnection/RTCSessionDescription.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCSessionDescription.mm rename to sdk/objc/api/peerconnection/RTCSessionDescription.mm index 5748b65450..21e5e42f66 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCSessionDescription.mm +++ b/sdk/objc/api/peerconnection/RTCSessionDescription.mm @@ -10,8 +10,8 @@ #import "RTCSessionDescription+Private.h" -#import "NSString+StdString.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" +#import "helpers/NSString+StdString.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/api/peerconnection/RTCTracing.h b/sdk/objc/api/peerconnection/RTCTracing.h new file mode 100644 index 0000000000..5c66e5a63a --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCTracing.h @@ -0,0 +1,21 @@ +/* + * Copyright 2016 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. + */ + +#import + +#import "RTCMacros.h" + +RTC_EXTERN void RTCSetupInternalTracer(void); +/** Starts capture to specified file. Must be a valid writable path. + * Returns YES if capture starts. + */ +RTC_EXTERN BOOL RTCStartInternalCapture(NSString* filePath); +RTC_EXTERN void RTCStopInternalCapture(void); +RTC_EXTERN void RTCShutdownInternalTracer(void); diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCTracing.mm b/sdk/objc/api/peerconnection/RTCTracing.mm similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCTracing.mm rename to sdk/objc/api/peerconnection/RTCTracing.mm index 7bcd6496e3..72f9f4da13 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCTracing.mm +++ b/sdk/objc/api/peerconnection/RTCTracing.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCTracing.h" +#import "RTCTracing.h" #include "rtc_base/event_tracer.h" diff --git a/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h b/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h new file mode 100644 index 0000000000..9c2178fb6b --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import "base/RTCVideoCodecInfo.h" + +#include "api/video_codecs/sdp_video_format.h" + +NS_ASSUME_NONNULL_BEGIN + +/* Interface for converting to/from internal C++ formats. */ +@interface RTCVideoCodecInfo (Private) + +- (instancetype)initWithNativeSdpVideoFormat:(webrtc::SdpVideoFormat)format; +- (webrtc::SdpVideoFormat)nativeSdpVideoFormat; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm b/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm new file mode 100644 index 0000000000..21aacf6281 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm @@ -0,0 +1,37 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoCodecInfo+Private.h" + +#import "helpers/NSString+StdString.h" + +@implementation RTCVideoCodecInfo (Private) + +- (instancetype)initWithNativeSdpVideoFormat:(webrtc::SdpVideoFormat)format { + NSMutableDictionary *params = [NSMutableDictionary dictionary]; + for (auto it = format.parameters.begin(); it != format.parameters.end(); ++it) { + [params setObject:[NSString stringForStdString:it->second] + forKey:[NSString stringForStdString:it->first]]; + } + return [self initWithName:[NSString stringForStdString:format.name] parameters:params]; +} + +- (webrtc::SdpVideoFormat)nativeSdpVideoFormat { + std::map parameters; + for (NSString *paramKey in self.parameters.allKeys) { + std::string key = [NSString stdStringForString:paramKey]; + std::string value = [NSString stdStringForString:self.parameters[paramKey]]; + parameters[key] = value; + } + + return webrtc::SdpVideoFormat([NSString stdStringForString:self.name], parameters); +} + +@end diff --git a/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h b/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h new file mode 100644 index 0000000000..5b062455bc --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import "base/RTCVideoEncoderSettings.h" + +#include "modules/video_coding/include/video_codec_interface.h" + +NS_ASSUME_NONNULL_BEGIN + +/* Interfaces for converting to/from internal C++ formats. */ +@interface RTCVideoEncoderSettings (Private) + +- (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *__nullable)videoCodec; +- (webrtc::VideoCodec)nativeVideoCodec; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm b/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm new file mode 100644 index 0000000000..6fb81dbb8a --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm @@ -0,0 +1,53 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoEncoderSettings+Private.h" + +#import "helpers/NSString+StdString.h" + +@implementation RTCVideoEncoderSettings (Private) + +- (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec { + if (self = [super init]) { + if (videoCodec) { + const char *codecName = CodecTypeToPayloadString(videoCodec->codecType); + self.name = [NSString stringWithUTF8String:codecName]; + + self.width = videoCodec->width; + self.height = videoCodec->height; + self.startBitrate = videoCodec->startBitrate; + self.maxBitrate = videoCodec->maxBitrate; + self.minBitrate = videoCodec->minBitrate; + self.targetBitrate = videoCodec->targetBitrate; + self.maxFramerate = videoCodec->maxFramerate; + self.qpMax = videoCodec->qpMax; + self.mode = (RTCVideoCodecMode)videoCodec->mode; + } + } + + return self; +} + +- (webrtc::VideoCodec)nativeVideoCodec { + webrtc::VideoCodec videoCodec; + videoCodec.width = self.width; + videoCodec.height = self.height; + videoCodec.startBitrate = self.startBitrate; + videoCodec.maxBitrate = self.maxBitrate; + videoCodec.minBitrate = self.minBitrate; + videoCodec.targetBitrate = self.targetBitrate; + videoCodec.maxBitrate = self.maxBitrate; + videoCodec.qpMax = self.qpMax; + videoCodec.mode = (webrtc::VideoCodecMode)self.mode; + + return videoCodec; +} + +@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoSource+Private.h b/sdk/objc/api/peerconnection/RTCVideoSource+Private.h similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoSource+Private.h rename to sdk/objc/api/peerconnection/RTCVideoSource+Private.h index 5eea2f9896..2441e0cdbe 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoSource+Private.h +++ b/sdk/objc/api/peerconnection/RTCVideoSource+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoSource.h" +#import "RTCVideoSource.h" #import "RTCMediaSource+Private.h" diff --git a/sdk/objc/api/peerconnection/RTCVideoSource.h b/sdk/objc/api/peerconnection/RTCVideoSource.h new file mode 100644 index 0000000000..1ead394d6c --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCVideoSource.h @@ -0,0 +1,37 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCMediaSource.h" +#import "RTCVideoCapturer.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT + +@interface RTCVideoSource : RTCMediaSource + +- (instancetype)init NS_UNAVAILABLE; + +/** + * Calling this function will cause frames to be scaled down to the + * requested resolution. Also, frames will be cropped to match the + * requested aspect ratio, and frames will be dropped to match the + * requested fps. The requested aspect ratio is orientation agnostic and + * will be adjusted to maintain the input orientation, so it doesn't + * matter if e.g. 1280x720 or 720x1280 is requested. + */ +- (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoSource.mm b/sdk/objc/api/peerconnection/RTCVideoSource.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoSource.mm rename to sdk/objc/api/peerconnection/RTCVideoSource.mm index 63b80144cf..1cbeb0bbce 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoSource.mm +++ b/sdk/objc/api/peerconnection/RTCVideoSource.mm @@ -12,7 +12,7 @@ #include "api/videosourceproxy.h" #include "rtc_base/checks.h" -#include "sdk/objc/Framework/Native/src/objc_video_track_source.h" +#include "sdk/objc/native/src/objc_video_track_source.h" static webrtc::ObjCVideoTrackSource *getObjCVideoSource( const rtc::scoped_refptr nativeSource) { diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoTrack+Private.h b/sdk/objc/api/peerconnection/RTCVideoTrack+Private.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoTrack+Private.h rename to sdk/objc/api/peerconnection/RTCVideoTrack+Private.h index 14639be9fb..176366a04b 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoTrack+Private.h +++ b/sdk/objc/api/peerconnection/RTCVideoTrack+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoTrack.h" +#import "RTCVideoTrack.h" #include "api/mediastreaminterface.h" diff --git a/sdk/objc/api/peerconnection/RTCVideoTrack.h b/sdk/objc/api/peerconnection/RTCVideoTrack.h new file mode 100644 index 0000000000..547f4d4f13 --- /dev/null +++ b/sdk/objc/api/peerconnection/RTCVideoTrack.h @@ -0,0 +1,37 @@ +/* + * Copyright 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. + */ + +#import "RTCMediaStreamTrack.h" + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol RTCVideoRenderer; +@class RTCPeerConnectionFactory; +@class RTCVideoSource; + +RTC_EXPORT +@interface RTCVideoTrack : RTCMediaStreamTrack + +/** The video source for this video track. */ +@property(nonatomic, readonly) RTCVideoSource *source; + +- (instancetype)init NS_UNAVAILABLE; + +/** Register a renderer that will render all frames received on this track. */ +- (void)addRenderer:(id)renderer; + +/** Deregister a renderer. */ +- (void)removeRenderer:(id)renderer; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoTrack.mm b/sdk/objc/api/peerconnection/RTCVideoTrack.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoTrack.mm rename to sdk/objc/api/peerconnection/RTCVideoTrack.mm index c9eb35c875..77936a640b 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoTrack.mm +++ b/sdk/objc/api/peerconnection/RTCVideoTrack.mm @@ -10,11 +10,11 @@ #import "RTCVideoTrack+Private.h" -#import "NSString+StdString.h" #import "RTCMediaStreamTrack+Private.h" #import "RTCPeerConnectionFactory+Private.h" -#import "RTCVideoRendererAdapter+Private.h" #import "RTCVideoSource+Private.h" +#import "api/RTCVideoRendererAdapter+Private.h" +#import "helpers/NSString+StdString.h" @implementation RTCVideoTrack { NSMutableArray *_adapters; diff --git a/sdk/objc/api/video_codec/RTCVideoCodecConstants.h b/sdk/objc/api/video_codec/RTCVideoCodecConstants.h new file mode 100644 index 0000000000..1d03f599aa --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoCodecConstants.h @@ -0,0 +1,16 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "base/RTCMacros.h" + +RTC_EXPORT extern NSString *const kRTCVideoCodecVp8Name; +RTC_EXPORT extern NSString *const kRTCVideoCodecVp9Name; diff --git a/sdk/objc/api/video_codec/RTCVideoCodecConstants.mm b/sdk/objc/api/video_codec/RTCVideoCodecConstants.mm new file mode 100644 index 0000000000..acbf126170 --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoCodecConstants.mm @@ -0,0 +1,17 @@ +/* + * Copyright 2018 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. + * + */ + +#import "RTCVideoCodecConstants.h" + +#include "media/base/mediaconstants.h" + +NSString *const kRTCVideoCodecVp8Name = @(cricket::kVp8CodecName); +NSString *const kRTCVideoCodecVp9Name = @(cricket::kVp9CodecName); diff --git a/sdk/objc/api/video_codec/RTCVideoDecoderVP8.h b/sdk/objc/api/video_codec/RTCVideoDecoderVP8.h new file mode 100644 index 0000000000..e5050ff636 --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoDecoderVP8.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoDecoder.h" + +RTC_EXPORT +@interface RTCVideoDecoderVP8 : NSObject + +/* This returns a VP8 decoder that can be returned from a RTCVideoDecoderFactory injected into + * RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be + * used independently from the RTCPeerConnectionFactory. + */ ++ (id)vp8Decoder; + +@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecVP8.mm b/sdk/objc/api/video_codec/RTCVideoDecoderVP8.mm similarity index 66% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecVP8.mm rename to sdk/objc/api/video_codec/RTCVideoDecoderVP8.mm index fa785f4ca4..9750bd8bab 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecVP8.mm +++ b/sdk/objc/api/video_codec/RTCVideoDecoderVP8.mm @@ -11,26 +11,11 @@ #import +#import "RTCVideoDecoderVP8.h" #import "RTCWrappedNativeVideoDecoder.h" -#import "RTCWrappedNativeVideoEncoder.h" -#import "WebRTC/RTCVideoDecoderVP8.h" -#import "WebRTC/RTCVideoEncoderVP8.h" #include "modules/video_coding/codecs/vp8/include/vp8.h" -#pragma mark - Encoder - -@implementation RTCVideoEncoderVP8 - -+ (id)vp8Encoder { - return [[RTCWrappedNativeVideoEncoder alloc] - initWithNativeEncoder:std::unique_ptr(webrtc::VP8Encoder::Create())]; -} - -@end - -#pragma mark - Decoder - @implementation RTCVideoDecoderVP8 + (id)vp8Decoder { diff --git a/sdk/objc/api/video_codec/RTCVideoDecoderVP9.h b/sdk/objc/api/video_codec/RTCVideoDecoderVP9.h new file mode 100644 index 0000000000..06d0a03a42 --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoDecoderVP9.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoDecoder.h" + +RTC_EXPORT +@interface RTCVideoDecoderVP9 : NSObject + +/* This returns a VP9 decoder that can be returned from a RTCVideoDecoderFactory injected into + * RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be + * used independently from the RTCPeerConnectionFactory. + */ ++ (id)vp9Decoder; + +@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecVP9.mm b/sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm similarity index 66% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecVP9.mm rename to sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm index 60fe54f6cb..48582fedf9 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecVP9.mm +++ b/sdk/objc/api/video_codec/RTCVideoDecoderVP9.mm @@ -11,26 +11,11 @@ #import +#import "RTCVideoDecoderVP9.h" #import "RTCWrappedNativeVideoDecoder.h" -#import "RTCWrappedNativeVideoEncoder.h" -#import "WebRTC/RTCVideoDecoderVP9.h" -#import "WebRTC/RTCVideoEncoderVP9.h" #include "modules/video_coding/codecs/vp9/include/vp9.h" -#pragma mark - Encoder - -@implementation RTCVideoEncoderVP9 - -+ (id)vp9Encoder { - return [[RTCWrappedNativeVideoEncoder alloc] - initWithNativeEncoder:std::unique_ptr(webrtc::VP9Encoder::Create())]; -} - -@end - -#pragma mark - Decoder - @implementation RTCVideoDecoderVP9 + (id)vp9Decoder { diff --git a/sdk/objc/api/video_codec/RTCVideoEncoderVP8.h b/sdk/objc/api/video_codec/RTCVideoEncoderVP8.h new file mode 100644 index 0000000000..e3a50f233a --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoEncoderVP8.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoEncoder.h" + +RTC_EXPORT +@interface RTCVideoEncoderVP8 : NSObject + +/* This returns a VP8 encoder that can be returned from a RTCVideoEncoderFactory injected into + * RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be + * used independently from the RTCPeerConnectionFactory. + */ ++ (id)vp8Encoder; + +@end diff --git a/sdk/objc/api/video_codec/RTCVideoEncoderVP8.mm b/sdk/objc/api/video_codec/RTCVideoEncoderVP8.mm new file mode 100644 index 0000000000..677f6ddf5f --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoEncoderVP8.mm @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 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. + * + */ + +#import + +#import "RTCVideoEncoderVP8.h" +#import "RTCWrappedNativeVideoEncoder.h" + +#include "modules/video_coding/codecs/vp8/include/vp8.h" + +@implementation RTCVideoEncoderVP8 + ++ (id)vp8Encoder { + return [[RTCWrappedNativeVideoEncoder alloc] + initWithNativeEncoder:std::unique_ptr(webrtc::VP8Encoder::Create())]; +} + +@end diff --git a/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h b/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h new file mode 100644 index 0000000000..955f382a6c --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoEncoder.h" + +RTC_EXPORT +@interface RTCVideoEncoderVP9 : NSObject + +/* This returns a VP9 encoder that can be returned from a RTCVideoEncoderFactory injected into + * RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be + * used independently from the RTCPeerConnectionFactory. + */ ++ (id)vp9Encoder; + +@end diff --git a/sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm b/sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm new file mode 100644 index 0000000000..a5d84084d0 --- /dev/null +++ b/sdk/objc/api/video_codec/RTCVideoEncoderVP9.mm @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 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. + * + */ + +#import + +#import "RTCVideoEncoderVP9.h" +#import "RTCWrappedNativeVideoEncoder.h" + +#include "modules/video_coding/codecs/vp9/include/vp9.h" + +@implementation RTCVideoEncoderVP9 + ++ (id)vp9Encoder { + return [[RTCWrappedNativeVideoEncoder alloc] + initWithNativeEncoder:std::unique_ptr(webrtc::VP9Encoder::Create())]; +} + +@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.h b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.h rename to sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h index 74cfaeb861..b5694c7d94 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.h +++ b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h @@ -10,7 +10,8 @@ #import -#import "WebRTC/RTCVideoCodec.h" +#import "base/RTCVideoDecoder.h" + #include "api/video_codecs/video_decoder.h" #include "media/base/codec.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.mm b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.mm rename to sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm index 2d4d45e378..6423c7a8cb 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.mm +++ b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm @@ -10,8 +10,8 @@ #import -#import "NSString+StdString.h" #import "RTCWrappedNativeVideoDecoder.h" +#import "helpers/NSString+StdString.h" @implementation RTCWrappedNativeVideoDecoder { std::unique_ptr _wrappedDecoder; diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.h b/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.h similarity index 96% rename from sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.h rename to sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.h index 5b95d33eba..b4ef88264b 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.h +++ b/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.h @@ -10,7 +10,8 @@ #import -#import "WebRTC/RTCVideoCodec.h" +#import "base/RTCVideoEncoder.h" + #include "api/video_codecs/sdp_video_format.h" #include "api/video_codecs/video_encoder.h" #include "media/base/codec.h" diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.mm b/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.mm rename to sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm index 8988e6d76e..ebfba2c132 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.mm +++ b/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm @@ -10,8 +10,8 @@ #import -#import "NSString+StdString.h" #import "RTCWrappedNativeVideoEncoder.h" +#import "helpers/NSString+StdString.h" @implementation RTCWrappedNativeVideoEncoder { std::unique_ptr _wrappedEncoder; diff --git a/sdk/objc/Framework/Classes/Video/RTCI420Buffer+Private.h b/sdk/objc/api/video_frame_buffer/RTCI420Buffer+Private.h similarity index 84% rename from sdk/objc/Framework/Classes/Video/RTCI420Buffer+Private.h rename to sdk/objc/api/video_frame_buffer/RTCI420Buffer+Private.h index d874925889..97bc1418eb 100644 --- a/sdk/objc/Framework/Classes/Video/RTCI420Buffer+Private.h +++ b/sdk/objc/api/video_frame_buffer/RTCI420Buffer+Private.h @@ -8,13 +8,16 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "RTCI420Buffer.h" #include "api/video/i420_buffer.h" NS_ASSUME_NONNULL_BEGIN -@interface RTCI420Buffer () +@interface RTCI420Buffer () { + @protected + rtc::scoped_refptr _i420Buffer; +} /** Initialize an RTCI420Buffer with its backing I420BufferInterface. */ - (instancetype)initWithFrameBuffer:(rtc::scoped_refptr)i420Buffer; diff --git a/sdk/objc/api/video_frame_buffer/RTCI420Buffer.h b/sdk/objc/api/video_frame_buffer/RTCI420Buffer.h new file mode 100644 index 0000000000..dc2613470b --- /dev/null +++ b/sdk/objc/api/video_frame_buffer/RTCI420Buffer.h @@ -0,0 +1,23 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "base/RTCI420Buffer.h" +#import "base/RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** RTCI420Buffer implements the RTCI420Buffer protocol */ +RTC_EXPORT +@interface RTCI420Buffer : NSObject +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm b/sdk/objc/api/video_frame_buffer/RTCI420Buffer.mm similarity index 87% rename from sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm rename to sdk/objc/api/video_frame_buffer/RTCI420Buffer.mm index ae4092689f..babd93c80e 100644 --- a/sdk/objc/Framework/Classes/Video/RTCI420Buffer.mm +++ b/sdk/objc/api/video_frame_buffer/RTCI420Buffer.mm @@ -17,10 +17,7 @@ #include "third_party/libyuv/include/libyuv.h" #endif -@implementation RTCI420Buffer { - @protected - rtc::scoped_refptr _i420Buffer; -} +@implementation RTCI420Buffer - (instancetype)initWithWidth:(int)width height:(int)height { if (self = [super init]) { @@ -139,21 +136,3 @@ #endif @end - -#pragma mark - - -@implementation RTCMutableI420Buffer - -- (uint8_t *)mutableDataY { - return static_cast(_i420Buffer.get())->MutableDataY(); -} - -- (uint8_t *)mutableDataU { - return static_cast(_i420Buffer.get())->MutableDataU(); -} - -- (uint8_t *)mutableDataV { - return static_cast(_i420Buffer.get())->MutableDataV(); -} - -@end diff --git a/sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.h b/sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.h new file mode 100644 index 0000000000..aa91af2597 --- /dev/null +++ b/sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.h @@ -0,0 +1,24 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCI420Buffer.h" +#import "base/RTCMacros.h" +#import "base/RTCMutableI420Buffer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Mutable version of RTCI420Buffer */ +RTC_EXPORT +@interface RTCMutableI420Buffer : RTCI420Buffer +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.mm b/sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.mm new file mode 100644 index 0000000000..e326faced6 --- /dev/null +++ b/sdk/objc/api/video_frame_buffer/RTCMutableI420Buffer.mm @@ -0,0 +1,31 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCMutableI420Buffer.h" + +#import "RTCI420Buffer+Private.h" + +#include "api/video/i420_buffer.h" + +@implementation RTCMutableI420Buffer + +- (uint8_t *)mutableDataY { + return static_cast(_i420Buffer.get())->MutableDataY(); +} + +- (uint8_t *)mutableDataU { + return static_cast(_i420Buffer.get())->MutableDataU(); +} + +- (uint8_t *)mutableDataV { + return static_cast(_i420Buffer.get())->MutableDataV(); +} + +@end diff --git a/sdk/objc/base/RTCCodecSpecificInfo.h b/sdk/objc/base/RTCCodecSpecificInfo.h new file mode 100644 index 0000000000..18f06f4078 --- /dev/null +++ b/sdk/objc/base/RTCCodecSpecificInfo.h @@ -0,0 +1,24 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Implement this protocol to pass codec specific info from the encoder. + * Corresponds to webrtc::CodecSpecificInfo. + */ +RTC_EXPORT +@protocol RTCCodecSpecificInfo +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCEncodedImage.h b/sdk/objc/base/RTCEncodedImage.h new file mode 100644 index 0000000000..904e8ab62e --- /dev/null +++ b/sdk/objc/base/RTCEncodedImage.h @@ -0,0 +1,53 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoFrame.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Represents an encoded frame's type. */ +typedef NS_ENUM(NSUInteger, RTCFrameType) { + RTCFrameTypeEmptyFrame = 0, + RTCFrameTypeAudioFrameSpeech = 1, + RTCFrameTypeAudioFrameCN = 2, + RTCFrameTypeVideoFrameKey = 3, + RTCFrameTypeVideoFrameDelta = 4, +}; + +typedef NS_ENUM(NSUInteger, RTCVideoContentType) { + RTCVideoContentTypeUnspecified, + RTCVideoContentTypeScreenshare, +}; + +/** Represents an encoded frame. Corresponds to webrtc::EncodedImage. */ +RTC_EXPORT +@interface RTCEncodedImage : NSObject + +@property(nonatomic, strong) NSData *buffer; +@property(nonatomic, assign) int32_t encodedWidth; +@property(nonatomic, assign) int32_t encodedHeight; +@property(nonatomic, assign) uint32_t timeStamp; +@property(nonatomic, assign) int64_t captureTimeMs; +@property(nonatomic, assign) int64_t ntpTimeMs; +@property(nonatomic, assign) uint8_t flags; +@property(nonatomic, assign) int64_t encodeStartMs; +@property(nonatomic, assign) int64_t encodeFinishMs; +@property(nonatomic, assign) RTCFrameType frameType; +@property(nonatomic, assign) RTCVideoRotation rotation; +@property(nonatomic, assign) BOOL completeFrame; +@property(nonatomic, strong) NSNumber *qp; +@property(nonatomic, assign) RTCVideoContentType contentType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCEncodedImage.m b/sdk/objc/base/RTCEncodedImage.m new file mode 100644 index 0000000000..024a57c541 --- /dev/null +++ b/sdk/objc/base/RTCEncodedImage.m @@ -0,0 +1,30 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCEncodedImage.h" + +@implementation RTCEncodedImage + +@synthesize buffer = _buffer; +@synthesize encodedWidth = _encodedWidth; +@synthesize encodedHeight = _encodedHeight; +@synthesize timeStamp = _timeStamp; +@synthesize captureTimeMs = _captureTimeMs; +@synthesize ntpTimeMs = _ntpTimeMs; +@synthesize flags = _flags; +@synthesize encodeStartMs = _encodeStartMs; +@synthesize encodeFinishMs = _encodeFinishMs; +@synthesize frameType = _frameType; +@synthesize rotation = _rotation; +@synthesize completeFrame = _completeFrame; +@synthesize qp = _qp; +@synthesize contentType = _contentType; + +@end diff --git a/sdk/objc/base/RTCI420Buffer.h b/sdk/objc/base/RTCI420Buffer.h new file mode 100644 index 0000000000..dad69dc7e0 --- /dev/null +++ b/sdk/objc/base/RTCI420Buffer.h @@ -0,0 +1,21 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCYUVPlanarBuffer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Protocol for RTCYUVPlanarBuffers containing I420 data */ +@protocol RTCI420Buffer +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCLogging.h b/sdk/objc/base/RTCLogging.h new file mode 100644 index 0000000000..be62db25b5 --- /dev/null +++ b/sdk/objc/base/RTCLogging.h @@ -0,0 +1,66 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +// Subset of rtc::LoggingSeverity. +typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { + RTCLoggingSeverityVerbose, + RTCLoggingSeverityInfo, + RTCLoggingSeverityWarning, + RTCLoggingSeverityError, +}; + +// Wrapper for C++ RTC_LOG(sev) macros. +// Logs the log string to the webrtc logstream for the given severity. +RTC_EXTERN void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string); + +// Wrapper for rtc::LogMessage::LogToDebug. +// Sets the minimum severity to be logged to console. +RTC_EXTERN void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); + +// Returns the filename with the path prefix removed. +RTC_EXTERN NSString* RTCFileName(const char* filePath); + +// Some convenience macros. + +#define RTCLogString(format, ...) \ + [NSString stringWithFormat:@"(%@:%d %s): " format, RTCFileName(__FILE__), \ + __LINE__, __FUNCTION__, ##__VA_ARGS__] + +#define RTCLogFormat(severity, format, ...) \ + do { \ + NSString* log_string = RTCLogString(format, ##__VA_ARGS__); \ + RTCLogEx(severity, log_string); \ + } while (false) + +#define RTCLogVerbose(format, ...) \ + RTCLogFormat(RTCLoggingSeverityVerbose, format, ##__VA_ARGS__) + +#define RTCLogInfo(format, ...) \ + RTCLogFormat(RTCLoggingSeverityInfo, format, ##__VA_ARGS__) + +#define RTCLogWarning(format, ...) \ + RTCLogFormat(RTCLoggingSeverityWarning, format, ##__VA_ARGS__) + +#define RTCLogError(format, ...) \ + RTCLogFormat(RTCLoggingSeverityError, format, ##__VA_ARGS__) + +#if !defined(NDEBUG) +#define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__) +#else +#define RTCLogDebug(format, ...) \ + do { \ + } while (false) +#endif + +#define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__) diff --git a/sdk/objc/Framework/Classes/Common/RTCLogging.mm b/sdk/objc/base/RTCLogging.mm similarity index 98% rename from sdk/objc/Framework/Classes/Common/RTCLogging.mm rename to sdk/objc/base/RTCLogging.mm index ab76a1d6e9..5c8f9fb4f8 100644 --- a/sdk/objc/Framework/Classes/Common/RTCLogging.mm +++ b/sdk/objc/base/RTCLogging.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCLogging.h" +#import "RTCLogging.h" #include "rtc_base/logging.h" @@ -44,4 +44,3 @@ NSString* RTCFileName(const char* file_path) { freeWhenDone:NO]; return ns_file_path.lastPathComponent; } - diff --git a/sdk/objc/base/RTCMacros.h b/sdk/objc/base/RTCMacros.h new file mode 100644 index 0000000000..4379058188 --- /dev/null +++ b/sdk/objc/base/RTCMacros.h @@ -0,0 +1,28 @@ +/* + * Copyright 2016 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. + */ + +#ifndef SDK_OBJC_BASE_RTCMACROS_H_ +#define SDK_OBJC_BASE_RTCMACROS_H_ + +#define RTC_EXPORT __attribute__((visibility("default"))) + +#if defined(__cplusplus) +#define RTC_EXTERN extern "C" RTC_EXPORT +#else +#define RTC_EXTERN extern RTC_EXPORT +#endif + +#ifdef __OBJC__ +#define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname +#else +#define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname +#endif + +#endif // SDK_OBJC_BASE_RTCMACROS_H_ diff --git a/sdk/objc/base/RTCMutableI420Buffer.h b/sdk/objc/base/RTCMutableI420Buffer.h new file mode 100644 index 0000000000..312e28dbfb --- /dev/null +++ b/sdk/objc/base/RTCMutableI420Buffer.h @@ -0,0 +1,22 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCI420Buffer.h" +#import "RTCMutableYUVPlanarBuffer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Extension of the I420 buffer with mutable data access */ +@protocol RTCMutableI420Buffer +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCMutableYUVPlanarBuffer.h b/sdk/objc/base/RTCMutableYUVPlanarBuffer.h new file mode 100644 index 0000000000..58cd278722 --- /dev/null +++ b/sdk/objc/base/RTCMutableYUVPlanarBuffer.h @@ -0,0 +1,26 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCYUVPlanarBuffer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Extension of the YUV planar data buffer with mutable data access */ +@protocol RTCMutableYUVPlanarBuffer + +@property(nonatomic, readonly) uint8_t *mutableDataY; +@property(nonatomic, readonly) uint8_t *mutableDataU; +@property(nonatomic, readonly) uint8_t *mutableDataV; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCRtpFragmentationHeader.h b/sdk/objc/base/RTCRtpFragmentationHeader.h new file mode 100644 index 0000000000..2fed6f60d1 --- /dev/null +++ b/sdk/objc/base/RTCRtpFragmentationHeader.h @@ -0,0 +1,28 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Information for header. Corresponds to webrtc::RTPFragmentationHeader. */ +RTC_EXPORT +@interface RTCRtpFragmentationHeader : NSObject + +@property(nonatomic, strong) NSArray *fragmentationOffset; +@property(nonatomic, strong) NSArray *fragmentationLength; +@property(nonatomic, strong) NSArray *fragmentationTimeDiff; +@property(nonatomic, strong) NSArray *fragmentationPlType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCRtpFragmentationHeader.m b/sdk/objc/base/RTCRtpFragmentationHeader.m new file mode 100644 index 0000000000..8049abc411 --- /dev/null +++ b/sdk/objc/base/RTCRtpFragmentationHeader.m @@ -0,0 +1,20 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCRtpFragmentationHeader.h" + +@implementation RTCRtpFragmentationHeader + +@synthesize fragmentationOffset = _fragmentationOffset; +@synthesize fragmentationLength = _fragmentationLength; +@synthesize fragmentationTimeDiff = _fragmentationTimeDiff; +@synthesize fragmentationPlType = _fragmentationPlType; + +@end \ No newline at end of file diff --git a/sdk/objc/base/RTCVideoCapturer.h b/sdk/objc/base/RTCVideoCapturer.h new file mode 100644 index 0000000000..42e4b25ecc --- /dev/null +++ b/sdk/objc/base/RTCVideoCapturer.h @@ -0,0 +1,33 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoFrame.h" + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCVideoCapturer; + +RTC_EXPORT +@protocol RTCVideoCapturerDelegate +- (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame; +@end + +RTC_EXPORT +@interface RTCVideoCapturer : NSObject + +@property(nonatomic, weak) id delegate; + +- (instancetype)initWithDelegate:(id)delegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCapturer.m b/sdk/objc/base/RTCVideoCapturer.m similarity index 94% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoCapturer.m rename to sdk/objc/base/RTCVideoCapturer.m index 3639fa75ca..39cc377746 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCapturer.m +++ b/sdk/objc/base/RTCVideoCapturer.m @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCapturer.h" +#import "RTCVideoCapturer.h" @implementation RTCVideoCapturer diff --git a/sdk/objc/base/RTCVideoCodecInfo.h b/sdk/objc/base/RTCVideoCodecInfo.h new file mode 100644 index 0000000000..9a4e4ab5fc --- /dev/null +++ b/sdk/objc/base/RTCVideoCodecInfo.h @@ -0,0 +1,36 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Holds information to identify a codec. Corresponds to webrtc::SdpVideoFormat. */ +RTC_EXPORT +@interface RTCVideoCodecInfo : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +- (instancetype)initWithName:(NSString *)name; + +- (instancetype)initWithName:(NSString *)name + parameters:(nullable NSDictionary *)parameters + NS_DESIGNATED_INITIALIZER; + +- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info; + +@property(nonatomic, readonly) NSString *name; +@property(nonatomic, readonly) NSDictionary *parameters; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoCodecInfo.m b/sdk/objc/base/RTCVideoCodecInfo.m new file mode 100644 index 0000000000..7fb17ca7d2 --- /dev/null +++ b/sdk/objc/base/RTCVideoCodecInfo.m @@ -0,0 +1,65 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoCodecInfo.h" + +@implementation RTCVideoCodecInfo + +@synthesize name = _name; +@synthesize parameters = _parameters; + +- (instancetype)initWithName:(NSString *)name { + return [self initWithName:name parameters:nil]; +} + +- (instancetype)initWithName:(NSString *)name + parameters:(nullable NSDictionary *)parameters { + if (self = [super init]) { + _name = name; + _parameters = (parameters ? parameters : @{}); + } + + return self; +} + +- (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info { + if (!info || + ![self.name isEqualToString:info.name] || + ![self.parameters isEqualToDictionary:info.parameters]) { + return NO; + } + return YES; +} + +- (BOOL)isEqual:(id)object { + if (self == object) + return YES; + if (![object isKindOfClass:[self class]]) + return NO; + return [self isEqualToCodecInfo:object]; +} + +- (NSUInteger)hash { + return [self.name hash] ^ [self.parameters hash]; +} + +#pragma mark - NSCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + return [self initWithName:[decoder decodeObjectForKey:@"name"] + parameters:[decoder decodeObjectForKey:@"parameters"]]; +} + +- (void)encodeWithCoder:(NSCoder *)encoder { + [encoder encodeObject:_name forKey:@"name"]; + [encoder encodeObject:_parameters forKey:@"parameters"]; +} + +@end diff --git a/sdk/objc/base/RTCVideoDecoder.h b/sdk/objc/base/RTCVideoDecoder.h new file mode 100644 index 0000000000..21925f0c67 --- /dev/null +++ b/sdk/objc/base/RTCVideoDecoder.h @@ -0,0 +1,45 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCCodecSpecificInfo.h" +#import "RTCEncodedImage.h" +#import "RTCMacros.h" +#import "RTCVideoEncoderSettings.h" +#import "RTCVideoFrame.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Callback block for decoder. */ +typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame); + +/** Protocol for decoder implementations. */ +RTC_EXPORT +@protocol RTCVideoDecoder + +- (void)setCallback:(RTCVideoDecoderCallback)callback; +- (NSInteger)startDecodeWithSettings:(RTCVideoEncoderSettings *)settings + numberOfCores:(int)numberOfCores + DEPRECATED_MSG_ATTRIBUTE("use startDecodeWithNumberOfCores: instead"); +- (NSInteger)releaseDecoder; +- (NSInteger)decode:(RTCEncodedImage *)encodedImage + missingFrames:(BOOL)missingFrames + codecSpecificInfo:(nullable id)info + renderTimeMs:(int64_t)renderTimeMs; +- (NSString *)implementationName; + +// TODO(andersc): Make non-optional when `startDecodeWithSettings:numberOfCores:` is removed. +@optional +- (NSInteger)startDecodeWithNumberOfCores:(int)numberOfCores; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoDecoderFactory.h b/sdk/objc/base/RTCVideoDecoderFactory.h new file mode 100644 index 0000000000..a78228c06f --- /dev/null +++ b/sdk/objc/base/RTCVideoDecoderFactory.h @@ -0,0 +1,28 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoCodecInfo.h" +#import "RTCVideoDecoder.h" + +NS_ASSUME_NONNULL_BEGIN + +/** RTCVideoDecoderFactory is an Objective-C version of webrtc::VideoDecoderFactory. */ +RTC_EXPORT +@protocol RTCVideoDecoderFactory + +- (nullable id)createDecoder:(RTCVideoCodecInfo *)info; +- (NSArray *)supportedCodecs; // TODO(andersc): "supportedFormats" instead? + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoEncoder.h b/sdk/objc/base/RTCVideoEncoder.h new file mode 100644 index 0000000000..41e78badea --- /dev/null +++ b/sdk/objc/base/RTCVideoEncoder.h @@ -0,0 +1,49 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCCodecSpecificInfo.h" +#import "RTCEncodedImage.h" +#import "RTCMacros.h" +#import "RTCRtpFragmentationHeader.h" +#import "RTCVideoEncoderQpThresholds.h" +#import "RTCVideoEncoderSettings.h" +#import "RTCVideoFrame.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Callback block for encoder. */ +typedef BOOL (^RTCVideoEncoderCallback)(RTCEncodedImage *frame, + id info, + RTCRtpFragmentationHeader *header); + +/** Protocol for encoder implementations. */ +RTC_EXPORT +@protocol RTCVideoEncoder + +- (void)setCallback:(RTCVideoEncoderCallback)callback; +- (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings + numberOfCores:(int)numberOfCores; +- (NSInteger)releaseEncoder; +- (NSInteger)encode:(RTCVideoFrame *)frame + codecSpecificInfo:(nullable id)info + frameTypes:(NSArray *)frameTypes; +- (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate; +- (NSString *)implementationName; + +/** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to + * keep the QP from the encoded images within the given range. Returning nil from this function + * disables quality scaling. */ +- (RTCVideoEncoderQpThresholds *)scalingSettings; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoEncoderFactory.h b/sdk/objc/base/RTCVideoEncoderFactory.h new file mode 100644 index 0000000000..9a14390d7b --- /dev/null +++ b/sdk/objc/base/RTCVideoEncoderFactory.h @@ -0,0 +1,28 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoCodecInfo.h" +#import "RTCVideoEncoder.h" + +NS_ASSUME_NONNULL_BEGIN + +/** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory. */ +RTC_EXPORT +@protocol RTCVideoEncoderFactory + +- (nullable id)createEncoder:(RTCVideoCodecInfo *)info; +- (NSArray *)supportedCodecs; // TODO(andersc): "supportedFormats" instead? + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoEncoderQpThresholds.h b/sdk/objc/base/RTCVideoEncoderQpThresholds.h new file mode 100644 index 0000000000..de9b62e78a --- /dev/null +++ b/sdk/objc/base/RTCVideoEncoderQpThresholds.h @@ -0,0 +1,28 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** QP thresholds for encoder. Corresponds to webrtc::VideoEncoder::QpThresholds. */ +RTC_EXPORT +@interface RTCVideoEncoderQpThresholds : NSObject + +- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high; + +@property(nonatomic, readonly) NSInteger low; +@property(nonatomic, readonly) NSInteger high; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoEncoderQpThresholds.m b/sdk/objc/base/RTCVideoEncoderQpThresholds.m new file mode 100644 index 0000000000..5bd06ffd8d --- /dev/null +++ b/sdk/objc/base/RTCVideoEncoderQpThresholds.m @@ -0,0 +1,26 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoEncoderQpThresholds.h" + +@implementation RTCVideoEncoderQpThresholds + +@synthesize low = _low; +@synthesize high = _high; + +- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high { + if (self = [super init]) { + _low = low; + _high = high; + } + return self; +} + +@end diff --git a/sdk/objc/base/RTCVideoEncoderSettings.h b/sdk/objc/base/RTCVideoEncoderSettings.h new file mode 100644 index 0000000000..d0a4425fa1 --- /dev/null +++ b/sdk/objc/base/RTCVideoEncoderSettings.h @@ -0,0 +1,43 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, RTCVideoCodecMode) { + RTCVideoCodecModeRealtimeVideo, + RTCVideoCodecModeScreensharing, +}; + +/** Settings for encoder. Corresponds to webrtc::VideoCodec. */ +RTC_EXPORT +@interface RTCVideoEncoderSettings : NSObject + +@property(nonatomic, strong) NSString *name; + +@property(nonatomic, assign) unsigned short width; +@property(nonatomic, assign) unsigned short height; + +@property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec. +@property(nonatomic, assign) unsigned int maxBitrate; +@property(nonatomic, assign) unsigned int minBitrate; +@property(nonatomic, assign) unsigned int targetBitrate; + +@property(nonatomic, assign) uint32_t maxFramerate; + +@property(nonatomic, assign) unsigned int qpMax; +@property(nonatomic, assign) RTCVideoCodecMode mode; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoEncoderSettings.m b/sdk/objc/base/RTCVideoEncoderSettings.m new file mode 100644 index 0000000000..929f568dbd --- /dev/null +++ b/sdk/objc/base/RTCVideoEncoderSettings.m @@ -0,0 +1,26 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoEncoderSettings.h" + +@implementation RTCVideoEncoderSettings + +@synthesize name = _name; +@synthesize width = _width; +@synthesize height = _height; +@synthesize startBitrate = _startBitrate; +@synthesize maxBitrate = _maxBitrate; +@synthesize minBitrate = _minBitrate; +@synthesize targetBitrate = _targetBitrate; +@synthesize maxFramerate = _maxFramerate; +@synthesize qpMax = _qpMax; +@synthesize mode = _mode; + +@end diff --git a/sdk/objc/base/RTCVideoFrame.h b/sdk/objc/base/RTCVideoFrame.h new file mode 100644 index 0000000000..bc665d4038 --- /dev/null +++ b/sdk/objc/base/RTCVideoFrame.h @@ -0,0 +1,85 @@ +/* + * Copyright 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. + */ + +#import +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSInteger, RTCVideoRotation) { + RTCVideoRotation_0 = 0, + RTCVideoRotation_90 = 90, + RTCVideoRotation_180 = 180, + RTCVideoRotation_270 = 270, +}; + +@protocol RTCVideoFrameBuffer; + +// RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame. +RTC_EXPORT +@interface RTCVideoFrame : NSObject + +/** Width without rotation applied. */ +@property(nonatomic, readonly) int width; + +/** Height without rotation applied. */ +@property(nonatomic, readonly) int height; +@property(nonatomic, readonly) RTCVideoRotation rotation; + +/** Timestamp in nanoseconds. */ +@property(nonatomic, readonly) int64_t timeStampNs; + +/** Timestamp 90 kHz. */ +@property(nonatomic, assign) int32_t timeStamp; + +@property(nonatomic, readonly) id buffer; + +- (instancetype)init NS_UNAVAILABLE; +- (instancetype) new NS_UNAVAILABLE; + +/** Initialize an RTCVideoFrame from a pixel buffer, rotation, and timestamp. + * Deprecated - initialize with a RTCCVPixelBuffer instead + */ +- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer + rotation:(RTCVideoRotation)rotation + timeStampNs:(int64_t)timeStampNs + DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead"); + +/** Initialize an RTCVideoFrame from a pixel buffer combined with cropping and + * scaling. Cropping will be applied first on the pixel buffer, followed by + * scaling to the final resolution of scaledWidth x scaledHeight. + */ +- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer + scaledWidth:(int)scaledWidth + scaledHeight:(int)scaledHeight + cropWidth:(int)cropWidth + cropHeight:(int)cropHeight + cropX:(int)cropX + cropY:(int)cropY + rotation:(RTCVideoRotation)rotation + timeStampNs:(int64_t)timeStampNs + DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead"); + +/** Initialize an RTCVideoFrame from a frame buffer, rotation, and timestamp. + */ +- (instancetype)initWithBuffer:(id)frameBuffer + rotation:(RTCVideoRotation)rotation + timeStampNs:(int64_t)timeStampNs; + +/** Return a frame that is guaranteed to be I420, i.e. it is possible to access + * the YUV data on it. + */ +- (RTCVideoFrame *)newI420VideoFrame; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoFrame.mm b/sdk/objc/base/RTCVideoFrame.mm similarity index 66% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoFrame.mm rename to sdk/objc/base/RTCVideoFrame.mm index 9a5d3065d6..0a44b04e6b 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoFrame.mm +++ b/sdk/objc/base/RTCVideoFrame.mm @@ -8,9 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoFrame.h" +#import "RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "RTCI420Buffer.h" +#import "RTCVideoFrameBuffer.h" @implementation RTCVideoFrame { RTCVideoRotation _rotation; @@ -45,9 +46,8 @@ - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer rotation:(RTCVideoRotation)rotation timeStampNs:(int64_t)timeStampNs { - return [self initWithBuffer:[[RTCCVPixelBuffer alloc] initWithPixelBuffer:pixelBuffer] - rotation:rotation - timeStampNs:timeStampNs]; + // Deprecated. + return nil; } - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer @@ -59,14 +59,8 @@ cropY:(int)cropY rotation:(RTCVideoRotation)rotation timeStampNs:(int64_t)timeStampNs { - RTCCVPixelBuffer *rtcPixelBuffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer:pixelBuffer - adaptedWidth:scaledWidth - adaptedHeight:scaledHeight - cropWidth:cropWidth - cropHeight:cropHeight - cropX:cropX - cropY:cropY]; - return [self initWithBuffer:rtcPixelBuffer rotation:rotation timeStampNs:timeStampNs]; + // Deprecated. + return nil; } - (instancetype)initWithBuffer:(id)buffer diff --git a/sdk/objc/base/RTCVideoFrameBuffer.h b/sdk/objc/base/RTCVideoFrameBuffer.h new file mode 100644 index 0000000000..7f340e1a76 --- /dev/null +++ b/sdk/objc/base/RTCVideoFrameBuffer.h @@ -0,0 +1,30 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol RTCI420Buffer; + +// RTCVideoFrameBuffer is an ObjectiveC version of webrtc::VideoFrameBuffer. +RTC_EXPORT +@protocol RTCVideoFrameBuffer + +@property(nonatomic, readonly) int width; +@property(nonatomic, readonly) int height; + +- (id)toI420; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCVideoRenderer.h b/sdk/objc/base/RTCVideoRenderer.h new file mode 100644 index 0000000000..63a69ff2dd --- /dev/null +++ b/sdk/objc/base/RTCVideoRenderer.h @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ + +#import +#if TARGET_OS_IPHONE +#import +#endif + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCVideoFrame; + +RTC_EXPORT +@protocol RTCVideoRenderer + +/** The size of the frame. */ +- (void)setSize:(CGSize)size; + +/** The frame to be displayed. */ +- (void)renderFrame:(nullable RTCVideoFrame *)frame; + +@end + +RTC_EXPORT +@protocol RTCVideoViewDelegate + +- (void)videoView:(id)videoView didChangeVideoSize:(CGSize)size; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/base/RTCYUVPlanarBuffer.h b/sdk/objc/base/RTCYUVPlanarBuffer.h new file mode 100644 index 0000000000..c8314ffbed --- /dev/null +++ b/sdk/objc/base/RTCYUVPlanarBuffer.h @@ -0,0 +1,44 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoFrameBuffer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Protocol for RTCVideoFrameBuffers containing YUV planar data. */ +@protocol RTCYUVPlanarBuffer + +@property(nonatomic, readonly) int chromaWidth; +@property(nonatomic, readonly) int chromaHeight; +@property(nonatomic, readonly) const uint8_t *dataY; +@property(nonatomic, readonly) const uint8_t *dataU; +@property(nonatomic, readonly) const uint8_t *dataV; +@property(nonatomic, readonly) int strideY; +@property(nonatomic, readonly) int strideU; +@property(nonatomic, readonly) int strideV; + +- (instancetype)initWithWidth:(int)width + height:(int)height + dataY:(const uint8_t *)dataY + dataU:(const uint8_t *)dataU + dataV:(const uint8_t *)dataV; +- (instancetype)initWithWidth:(int)width height:(int)height; +- (instancetype)initWithWidth:(int)width + height:(int)height + strideY:(int)strideY + strideU:(int)strideU + strideV:(int)strideV; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Audio/RTCAudioSession+Configuration.mm b/sdk/objc/components/audio/RTCAudioSession+Configuration.mm similarity index 98% rename from sdk/objc/Framework/Classes/Audio/RTCAudioSession+Configuration.mm rename to sdk/objc/components/audio/RTCAudioSession+Configuration.mm index c4d0d0c54c..0ece5926a8 100644 --- a/sdk/objc/Framework/Classes/Audio/RTCAudioSession+Configuration.mm +++ b/sdk/objc/components/audio/RTCAudioSession+Configuration.mm @@ -1,4 +1,4 @@ - /* +/* * Copyright 2016 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license @@ -8,12 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCAudioSession.h" -#import "WebRTC/RTCAudioSessionConfiguration.h" - -#import "WebRTC/RTCLogging.h" #import "RTCAudioSession+Private.h" +#import "RTCAudioSessionConfiguration.h" +#import "base/RTCLogging.h" @implementation RTCAudioSession (Configuration) diff --git a/sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h b/sdk/objc/components/audio/RTCAudioSession+Private.h similarity index 98% rename from sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h rename to sdk/objc/components/audio/RTCAudioSession+Private.h index f163b5a133..8ad0c21105 100644 --- a/sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h +++ b/sdk/objc/components/audio/RTCAudioSession+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" +#import "RTCAudioSession.h" #include diff --git a/sdk/objc/components/audio/RTCAudioSession.h b/sdk/objc/components/audio/RTCAudioSession.h new file mode 100644 index 0000000000..a8325b65fd --- /dev/null +++ b/sdk/objc/components/audio/RTCAudioSession.h @@ -0,0 +1,249 @@ +/* + * Copyright 2016 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. + */ + +#import +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const kRTCAudioSessionErrorDomain; +/** Method that requires lock was called without lock. */ +extern NSInteger const kRTCAudioSessionErrorLockRequired; +/** Unknown configuration error occurred. */ +extern NSInteger const kRTCAudioSessionErrorConfiguration; + +@class RTCAudioSession; +@class RTCAudioSessionConfiguration; + +// Surfaces AVAudioSession events. WebRTC will listen directly for notifications +// from AVAudioSession and handle them before calling these delegate methods, +// at which point applications can perform additional processing if required. +RTC_EXPORT +@protocol RTCAudioSessionDelegate + +@optional +/** Called on a system notification thread when AVAudioSession starts an + * interruption event. + */ +- (void)audioSessionDidBeginInterruption:(RTCAudioSession *)session; + +/** Called on a system notification thread when AVAudioSession ends an + * interruption event. + */ +- (void)audioSessionDidEndInterruption:(RTCAudioSession *)session + shouldResumeSession:(BOOL)shouldResumeSession; + +/** Called on a system notification thread when AVAudioSession changes the + * route. + */ +- (void)audioSessionDidChangeRoute:(RTCAudioSession *)session + reason:(AVAudioSessionRouteChangeReason)reason + previousRoute:(AVAudioSessionRouteDescription *)previousRoute; + +/** Called on a system notification thread when AVAudioSession media server + * terminates. + */ +- (void)audioSessionMediaServerTerminated:(RTCAudioSession *)session; + +/** Called on a system notification thread when AVAudioSession media server + * restarts. + */ +- (void)audioSessionMediaServerReset:(RTCAudioSession *)session; + +// TODO(tkchin): Maybe handle SilenceSecondaryAudioHintNotification. + +- (void)audioSession:(RTCAudioSession *)session didChangeCanPlayOrRecord:(BOOL)canPlayOrRecord; + +/** Called on a WebRTC thread when the audio device is notified to begin + * playback or recording. + */ +- (void)audioSessionDidStartPlayOrRecord:(RTCAudioSession *)session; + +/** Called on a WebRTC thread when the audio device is notified to stop + * playback or recording. + */ +- (void)audioSessionDidStopPlayOrRecord:(RTCAudioSession *)session; + +/** Called when the AVAudioSession output volume value changes. */ +- (void)audioSession:(RTCAudioSession *)audioSession didChangeOutputVolume:(float)outputVolume; + +/** Called when the audio device detects a playout glitch. The argument is the + * number of glitches detected so far in the current audio playout session. + */ +- (void)audioSession:(RTCAudioSession *)audioSession + didDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches; + +/** Called when the audio session is about to change the active state. + */ +- (void)audioSession:(RTCAudioSession *)audioSession willSetActive:(BOOL)active; + +/** Called after the audio session sucessfully changed the active state. + */ +- (void)audioSession:(RTCAudioSession *)audioSession didSetActive:(BOOL)active; + +/** Called after the audio session failed to change the active state. + */ +- (void)audioSession:(RTCAudioSession *)audioSession + failedToSetActive:(BOOL)active + error:(NSError *)error; + +@end + +/** This is a protocol used to inform RTCAudioSession when the audio session + * activation state has changed outside of RTCAudioSession. The current known use + * case of this is when CallKit activates the audio session for the application + */ +RTC_EXPORT +@protocol RTCAudioSessionActivationDelegate + +/** Called when the audio session is activated outside of the app by iOS. */ +- (void)audioSessionDidActivate:(AVAudioSession *)session; + +/** Called when the audio session is deactivated outside of the app by iOS. */ +- (void)audioSessionDidDeactivate:(AVAudioSession *)session; + +@end + +/** Proxy class for AVAudioSession that adds a locking mechanism similar to + * AVCaptureDevice. This is used to that interleaving configurations between + * WebRTC and the application layer are avoided. + * + * RTCAudioSession also coordinates activation so that the audio session is + * activated only once. See |setActive:error:|. + */ +RTC_EXPORT +@interface RTCAudioSession : NSObject + +/** Convenience property to access the AVAudioSession singleton. Callers should + * not call setters on AVAudioSession directly, but other method invocations + * are fine. + */ +@property(nonatomic, readonly) AVAudioSession *session; + +/** Our best guess at whether the session is active based on results of calls to + * AVAudioSession. + */ +@property(nonatomic, readonly) BOOL isActive; +/** Whether RTCAudioSession is currently locked for configuration. */ +@property(nonatomic, readonly) BOOL isLocked; + +/** If YES, WebRTC will not initialize the audio unit automatically when an + * audio track is ready for playout or recording. Instead, applications should + * call setIsAudioEnabled. If NO, WebRTC will initialize the audio unit + * as soon as an audio track is ready for playout or recording. + */ +@property(nonatomic, assign) BOOL useManualAudio; + +/** This property is only effective if useManualAudio is YES. + * Represents permission for WebRTC to initialize the VoIP audio unit. + * When set to NO, if the VoIP audio unit used by WebRTC is active, it will be + * stopped and uninitialized. This will stop incoming and outgoing audio. + * When set to YES, WebRTC will initialize and start the audio unit when it is + * needed (e.g. due to establishing an audio connection). + * This property was introduced to work around an issue where if an AVPlayer is + * playing audio while the VoIP audio unit is initialized, its audio would be + * either cut off completely or played at a reduced volume. By preventing + * the audio unit from being initialized until after the audio has completed, + * we are able to prevent the abrupt cutoff. + */ +@property(nonatomic, assign) BOOL isAudioEnabled; + +// Proxy properties. +@property(readonly) NSString *category; +@property(readonly) AVAudioSessionCategoryOptions categoryOptions; +@property(readonly) NSString *mode; +@property(readonly) BOOL secondaryAudioShouldBeSilencedHint; +@property(readonly) AVAudioSessionRouteDescription *currentRoute; +@property(readonly) NSInteger maximumInputNumberOfChannels; +@property(readonly) NSInteger maximumOutputNumberOfChannels; +@property(readonly) float inputGain; +@property(readonly) BOOL inputGainSettable; +@property(readonly) BOOL inputAvailable; +@property(readonly, nullable) NSArray *inputDataSources; +@property(readonly, nullable) AVAudioSessionDataSourceDescription *inputDataSource; +@property(readonly, nullable) NSArray *outputDataSources; +@property(readonly, nullable) AVAudioSessionDataSourceDescription *outputDataSource; +@property(readonly) double sampleRate; +@property(readonly) double preferredSampleRate; +@property(readonly) NSInteger inputNumberOfChannels; +@property(readonly) NSInteger outputNumberOfChannels; +@property(readonly) float outputVolume; +@property(readonly) NSTimeInterval inputLatency; +@property(readonly) NSTimeInterval outputLatency; +@property(readonly) NSTimeInterval IOBufferDuration; +@property(readonly) NSTimeInterval preferredIOBufferDuration; + +/** Default constructor. */ ++ (instancetype)sharedInstance; +- (instancetype)init NS_UNAVAILABLE; + +/** Adds a delegate, which is held weakly. */ +- (void)addDelegate:(id)delegate; +/** Removes an added delegate. */ +- (void)removeDelegate:(id)delegate; + +/** Request exclusive access to the audio session for configuration. This call + * will block if the lock is held by another object. + */ +- (void)lockForConfiguration; +/** Relinquishes exclusive access to the audio session. */ +- (void)unlockForConfiguration; + +/** If |active|, activates the audio session if it isn't already active. + * Successful calls must be balanced with a setActive:NO when activation is no + * longer required. If not |active|, deactivates the audio session if one is + * active and this is the last balanced call. When deactivating, the + * AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation option is passed to + * AVAudioSession. + */ +- (BOOL)setActive:(BOOL)active error:(NSError **)outError; + +// The following methods are proxies for the associated methods on +// AVAudioSession. |lockForConfiguration| must be called before using them +// otherwise they will fail with kRTCAudioSessionErrorLockRequired. + +- (BOOL)setCategory:(NSString *)category + withOptions:(AVAudioSessionCategoryOptions)options + error:(NSError **)outError; +- (BOOL)setMode:(NSString *)mode error:(NSError **)outError; +- (BOOL)setInputGain:(float)gain error:(NSError **)outError; +- (BOOL)setPreferredSampleRate:(double)sampleRate error:(NSError **)outError; +- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError **)outError; +- (BOOL)setPreferredInputNumberOfChannels:(NSInteger)count error:(NSError **)outError; +- (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count error:(NSError **)outError; +- (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride error:(NSError **)outError; +- (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort error:(NSError **)outError; +- (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource + error:(NSError **)outError; +- (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource + error:(NSError **)outError; +@end + +@interface RTCAudioSession (Configuration) + +/** Applies the configuration to the current session. Attempts to set all + * properties even if previous ones fail. Only the last error will be + * returned. + * |lockForConfiguration| must be called first. + */ +- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration error:(NSError **)outError; + +/** Convenience method that calls both setConfiguration and setActive. + * |lockForConfiguration| must be called first. + */ +- (BOOL)setConfiguration:(RTCAudioSessionConfiguration *)configuration + active:(BOOL)active + error:(NSError **)outError; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Audio/RTCAudioSession.mm b/sdk/objc/components/audio/RTCAudioSession.mm similarity index 99% rename from sdk/objc/Framework/Classes/Audio/RTCAudioSession.mm rename to sdk/objc/components/audio/RTCAudioSession.mm index 307b97959e..b4d759b189 100644 --- a/sdk/objc/Framework/Classes/Audio/RTCAudioSession.mm +++ b/sdk/objc/components/audio/RTCAudioSession.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCAudioSession.h" +#import "RTCAudioSession+Private.h" #import @@ -16,10 +16,8 @@ #include "rtc_base/checks.h" #include "rtc_base/criticalsection.h" -#import "WebRTC/RTCAudioSessionConfiguration.h" -#import "WebRTC/RTCLogging.h" - -#import "RTCAudioSession+Private.h" +#import "RTCAudioSessionConfiguration.h" +#import "base/RTCLogging.h" NSString * const kRTCAudioSessionErrorDomain = @"org.webrtc.RTCAudioSession"; diff --git a/sdk/objc/components/audio/RTCAudioSessionConfiguration.h b/sdk/objc/components/audio/RTCAudioSessionConfiguration.h new file mode 100644 index 0000000000..3eb5e3ad79 --- /dev/null +++ b/sdk/objc/components/audio/RTCAudioSessionConfiguration.h @@ -0,0 +1,48 @@ +/* + * Copyright 2016 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. + */ + +#import +#import + +#import "RTCMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXTERN const int kRTCAudioSessionPreferredNumberOfChannels; +RTC_EXTERN const double kRTCAudioSessionHighPerformanceSampleRate; +RTC_EXTERN const double kRTCAudioSessionLowComplexitySampleRate; +RTC_EXTERN const double kRTCAudioSessionHighPerformanceIOBufferDuration; +RTC_EXTERN const double kRTCAudioSessionLowComplexityIOBufferDuration; + +// Struct to hold configuration values. +RTC_EXPORT +@interface RTCAudioSessionConfiguration : NSObject + +@property(nonatomic, strong) NSString *category; +@property(nonatomic, assign) AVAudioSessionCategoryOptions categoryOptions; +@property(nonatomic, strong) NSString *mode; +@property(nonatomic, assign) double sampleRate; +@property(nonatomic, assign) NSTimeInterval ioBufferDuration; +@property(nonatomic, assign) NSInteger inputNumberOfChannels; +@property(nonatomic, assign) NSInteger outputNumberOfChannels; + +/** Initializes configuration to defaults. */ +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +/** Returns the current configuration of the audio session. */ ++ (instancetype)currentConfiguration; +/** Returns the configuration that WebRTC needs. */ ++ (instancetype)webRTCConfiguration; +/** Provide a way to override the default configuration. */ ++ (void)setWebRTCConfiguration:(RTCAudioSessionConfiguration *)configuration; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Audio/RTCAudioSessionConfiguration.m b/sdk/objc/components/audio/RTCAudioSessionConfiguration.m similarity index 97% rename from sdk/objc/Framework/Classes/Audio/RTCAudioSessionConfiguration.m rename to sdk/objc/components/audio/RTCAudioSessionConfiguration.m index 3bcb03473c..2247e65ab5 100644 --- a/sdk/objc/Framework/Classes/Audio/RTCAudioSessionConfiguration.m +++ b/sdk/objc/components/audio/RTCAudioSessionConfiguration.m @@ -8,12 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCAudioSession.h" -#import "WebRTC/RTCAudioSessionConfiguration.h" - -#import "WebRTC/RTCDispatcher.h" -#import "WebRTC/UIDevice+RTCDevice.h" +#import "RTCAudioSessionConfiguration.h" +#import "RTCAudioSession.h" +#import "helpers/RTCDispatcher.h" +#import "helpers/UIDevice+RTCDevice.h" // Try to use mono to save resources. Also avoids channel format conversion // in the I/O audio unit. Initial tests have shown that it is possible to use diff --git a/sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.h b/sdk/objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h similarity index 93% rename from sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.h rename to sdk/objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h index 7fb2184260..7ca2d757eb 100644 --- a/sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.h +++ b/sdk/objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" +#import "RTCAudioSession.h" NS_ASSUME_NONNULL_BEGIN diff --git a/sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.mm b/sdk/objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm similarity index 96% rename from sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.mm rename to sdk/objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm index a443e51e38..aef97b9fe5 100644 --- a/sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.mm +++ b/sdk/objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm @@ -10,9 +10,9 @@ #import "RTCNativeAudioSessionDelegateAdapter.h" -#include "sdk/objc/Framework/Native/src/audio/audio_session_observer.h" +#include "sdk/objc/native/src/audio/audio_session_observer.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" @implementation RTCNativeAudioSessionDelegateAdapter { webrtc::AudioSessionObserver *_observer; diff --git a/sdk/objc/components/capturer/RTCCameraVideoCapturer.h b/sdk/objc/components/capturer/RTCCameraVideoCapturer.h new file mode 100644 index 0000000000..4333baf3b9 --- /dev/null +++ b/sdk/objc/components/capturer/RTCCameraVideoCapturer.h @@ -0,0 +1,56 @@ +/* + * Copyright 2017 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. + */ + +#import +#import + +#import "RTCMacros.h" +#import "RTCVideoCapturer.h" + +NS_ASSUME_NONNULL_BEGIN + +RTC_EXPORT +// Camera capture that implements RTCVideoCapturer. Delivers frames to a RTCVideoCapturerDelegate +// (usually RTCVideoSource). +NS_EXTENSION_UNAVAILABLE_IOS("Camera not available in app extensions.") +@interface RTCCameraVideoCapturer : RTCVideoCapturer + +// Capture session that is used for capturing. Valid from initialization to dealloc. +@property(readonly, nonatomic) AVCaptureSession *captureSession; + +// Returns list of available capture devices that support video capture. ++ (NSArray *)captureDevices; +// Returns list of formats that are supported by this class for this device. ++ (NSArray *)supportedFormatsForDevice:(AVCaptureDevice *)device; + +// Returns the most efficient supported output pixel format for this capturer. +- (FourCharCode)preferredOutputPixelFormat; + +// Starts the capture session asynchronously and notifies callback on completion. +// The device will capture video in the format given in the `format` parameter. If the pixel format +// in `format` is supported by the WebRTC pipeline, the same pixel format will be used for the +// output. Otherwise, the format returned by `preferredOutputPixelFormat` will be used. +- (void)startCaptureWithDevice:(AVCaptureDevice *)device + format:(AVCaptureDeviceFormat *)format + fps:(NSInteger)fps + completionHandler:(nullable void (^)(NSError *))completionHandler; +// Stops the capture session asynchronously and notifies callback on completion. +- (void)stopCaptureWithCompletionHandler:(nullable void (^)(void))completionHandler; + +// Starts the capture session asynchronously. +- (void)startCaptureWithDevice:(AVCaptureDevice *)device + format:(AVCaptureDeviceFormat *)format + fps:(NSInteger)fps; +// Stops the capture session asynchronously. +- (void)stopCapture; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m b/sdk/objc/components/capturer/RTCCameraVideoCapturer.m similarity index 98% rename from sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m rename to sdk/objc/components/capturer/RTCCameraVideoCapturer.m index 8f93937c75..2909405e7d 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m +++ b/sdk/objc/components/capturer/RTCCameraVideoCapturer.m @@ -10,16 +10,17 @@ #import -#import "WebRTC/RTCCameraVideoCapturer.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "RTCCameraVideoCapturer.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" #if TARGET_OS_IPHONE -#import "WebRTC/UIDevice+RTCDevice.h" +#import "helpers/UIDevice+RTCDevice.h" #endif -#import "AVCaptureSession+DevicePosition.h" -#import "RTCDispatcher+Private.h" +#import "helpers/AVCaptureSession+DevicePosition.h" +#import "helpers/RTCDispatcher+Private.h" const int64_t kNanosecondsPerSecond = 1000000000; diff --git a/sdk/objc/components/capturer/RTCFileVideoCapturer.h b/sdk/objc/components/capturer/RTCFileVideoCapturer.h new file mode 100644 index 0000000000..60a9afa485 --- /dev/null +++ b/sdk/objc/components/capturer/RTCFileVideoCapturer.h @@ -0,0 +1,51 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCVideoCapturer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Error passing block. + */ +typedef void (^RTCFileVideoCapturerErrorBlock)(NSError *error); + +/** + * Captures buffers from bundled video file. + * + * See @c RTCVideoCapturer for more info on capturers. + */ +RTC_EXPORT + +NS_CLASS_AVAILABLE_IOS(10) +@interface RTCFileVideoCapturer : RTCVideoCapturer + +/** + * Starts asynchronous capture of frames from video file. + * + * Capturing is not started if error occurs. Underlying error will be + * relayed in the errorBlock if one is provided. + * Successfully captured video frames will be passed to the delegate. + * + * @param nameOfFile The name of the bundled video file to be read. + * @errorBlock block to be executed upon error. + */ +- (void)startCapturingFromFileNamed:(NSString *)nameOfFile + onError:(__nullable RTCFileVideoCapturerErrorBlock)errorBlock; + +/** + * Immediately stops capture. + */ +- (void)stopCapture; +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCFileVideoCapturer.m b/sdk/objc/components/capturer/RTCFileVideoCapturer.m similarity index 97% rename from sdk/objc/Framework/Classes/PeerConnection/RTCFileVideoCapturer.m rename to sdk/objc/components/capturer/RTCFileVideoCapturer.m index 7e27bf2df3..00143e909f 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCFileVideoCapturer.m +++ b/sdk/objc/components/capturer/RTCFileVideoCapturer.m @@ -8,10 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCFileVideoCapturer.h" +#import "RTCFileVideoCapturer.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" NSString *const kRTCFileVideoCapturerErrorDomain = @"org.webrtc.RTCFileVideoCapturer"; diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.h b/sdk/objc/components/renderer/metal/RTCMTLI420Renderer.h similarity index 100% rename from sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.h rename to sdk/objc/components/renderer/metal/RTCMTLI420Renderer.h diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.mm b/sdk/objc/components/renderer/metal/RTCMTLI420Renderer.mm similarity index 97% rename from sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.mm rename to sdk/objc/components/renderer/metal/RTCMTLI420Renderer.mm index f7a75d8056..668b9aed13 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLI420Renderer.mm +++ b/sdk/objc/components/renderer/metal/RTCMTLI420Renderer.mm @@ -9,13 +9,14 @@ */ #import "RTCMTLI420Renderer.h" -#import "WebRTC/RTCVideoFrameBuffer.h" #import #import -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCI420Buffer.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" #import "RTCMTLRenderer+Private.h" diff --git a/sdk/objc/components/renderer/metal/RTCMTLNSVideoView.h b/sdk/objc/components/renderer/metal/RTCMTLNSVideoView.h new file mode 100644 index 0000000000..8d377e26da --- /dev/null +++ b/sdk/objc/components/renderer/metal/RTCMTLNSVideoView.h @@ -0,0 +1,24 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "base/RTCVideoRenderer.h" + +NS_AVAILABLE_MAC(10.11) + +RTC_EXPORT +@interface RTCMTLNSVideoView : NSView + +@property(nonatomic, weak) id delegate; + ++ (BOOL)isMetalAvailable; + +@end diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLNSVideoView.m b/sdk/objc/components/renderer/metal/RTCMTLNSVideoView.m similarity index 97% rename from sdk/objc/Framework/Classes/Metal/RTCMTLNSVideoView.m rename to sdk/objc/components/renderer/metal/RTCMTLNSVideoView.m index 869858e6b4..ac5294e4c0 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLNSVideoView.m +++ b/sdk/objc/components/renderer/metal/RTCMTLNSVideoView.m @@ -8,12 +8,12 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMTLNSVideoView.h" +#import "RTCMTLNSVideoView.h" #import #import -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCVideoFrame.h" #import "RTCMTLI420Renderer.h" diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLNV12Renderer.h b/sdk/objc/components/renderer/metal/RTCMTLNV12Renderer.h similarity index 100% rename from sdk/objc/Framework/Classes/Metal/RTCMTLNV12Renderer.h rename to sdk/objc/components/renderer/metal/RTCMTLNV12Renderer.h diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLNV12Renderer.mm b/sdk/objc/components/renderer/metal/RTCMTLNV12Renderer.mm similarity index 96% rename from sdk/objc/Framework/Classes/Metal/RTCMTLNV12Renderer.mm rename to sdk/objc/components/renderer/metal/RTCMTLNV12Renderer.mm index a968014c35..bc5e982dbd 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLNV12Renderer.mm +++ b/sdk/objc/components/renderer/metal/RTCMTLNV12Renderer.mm @@ -13,11 +13,12 @@ #import #import -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" - #import "RTCMTLRenderer+Private.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" + #include "rtc_base/checks.h" static NSString *const shaderSource = MTL_STRINGIFY( diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLRGBRenderer.h b/sdk/objc/components/renderer/metal/RTCMTLRGBRenderer.h similarity index 100% rename from sdk/objc/Framework/Classes/Metal/RTCMTLRGBRenderer.h rename to sdk/objc/components/renderer/metal/RTCMTLRGBRenderer.h diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLRGBRenderer.mm b/sdk/objc/components/renderer/metal/RTCMTLRGBRenderer.mm similarity index 96% rename from sdk/objc/Framework/Classes/Metal/RTCMTLRGBRenderer.mm rename to sdk/objc/components/renderer/metal/RTCMTLRGBRenderer.mm index e5a370421a..d03d71f884 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLRGBRenderer.mm +++ b/sdk/objc/components/renderer/metal/RTCMTLRGBRenderer.mm @@ -13,11 +13,12 @@ #import #import -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" - #import "RTCMTLRenderer+Private.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" + #include "rtc_base/checks.h" static NSString *const shaderSource = MTL_STRINGIFY( diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLRenderer+Private.h b/sdk/objc/components/renderer/metal/RTCMTLRenderer+Private.h similarity index 99% rename from sdk/objc/Framework/Classes/Metal/RTCMTLRenderer+Private.h rename to sdk/objc/components/renderer/metal/RTCMTLRenderer+Private.h index e50ae77dde..f442886b79 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLRenderer+Private.h +++ b/sdk/objc/components/renderer/metal/RTCMTLRenderer+Private.h @@ -9,11 +9,13 @@ */ #import + #import "RTCMTLRenderer.h" #define MTL_STRINGIFY(s) @ #s NS_ASSUME_NONNULL_BEGIN + @interface RTCMTLRenderer (Private) - (nullable id)currentMetalDevice; - (NSString *)shaderSource; @@ -27,4 +29,5 @@ NS_ASSUME_NONNULL_BEGIN cropY:(nonnull int *)cropY ofFrame:(nonnull RTCVideoFrame *)frame; @end + NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLRenderer.h b/sdk/objc/components/renderer/metal/RTCMTLRenderer.h similarity index 97% rename from sdk/objc/Framework/Classes/Metal/RTCMTLRenderer.h rename to sdk/objc/components/renderer/metal/RTCMTLRenderer.h index f4a293b5c0..9c1f3719b3 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLRenderer.h +++ b/sdk/objc/components/renderer/metal/RTCMTLRenderer.h @@ -15,7 +15,7 @@ #import #endif -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCVideoFrame.h" NS_ASSUME_NONNULL_BEGIN /** diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLRenderer.mm b/sdk/objc/components/renderer/metal/RTCMTLRenderer.mm similarity index 99% rename from sdk/objc/Framework/Classes/Metal/RTCMTLRenderer.mm rename to sdk/objc/components/renderer/metal/RTCMTLRenderer.mm index 5363aaeda2..8f372bcdbd 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLRenderer.mm +++ b/sdk/objc/components/renderer/metal/RTCMTLRenderer.mm @@ -13,9 +13,9 @@ #import #import -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" #include "api/video/video_rotation.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/components/renderer/metal/RTCMTLVideoView.h b/sdk/objc/components/renderer/metal/RTCMTLVideoView.h new file mode 100644 index 0000000000..ff64ba3243 --- /dev/null +++ b/sdk/objc/components/renderer/metal/RTCMTLVideoView.h @@ -0,0 +1,46 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoFrame.h" +#import "RTCVideoRenderer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * RTCMTLVideoView is thin wrapper around MTKView. + * + * It has id property that renders video frames in the view's + * bounds using Metal. + * NOTE: always check if metal is available on the running device via + * RTC_SUPPORTS_METAL macro before initializing this class. + */ +NS_CLASS_AVAILABLE_IOS(9) + +RTC_EXPORT +@interface RTCMTLVideoView : UIView + +@property(nonatomic, weak) id delegate; + +@property(nonatomic) UIViewContentMode videoContentMode; + +/** @abstract Enables/disables rendering. + */ +@property(nonatomic, getter=isEnabled) BOOL enabled; + +/** @abstract Wrapped RTCVideoRotation, or nil. + */ +@property(nonatomic, nullable) NSValue* rotationOverride; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Metal/RTCMTLVideoView.m b/sdk/objc/components/renderer/metal/RTCMTLVideoView.m similarity index 97% rename from sdk/objc/Framework/Classes/Metal/RTCMTLVideoView.m rename to sdk/objc/components/renderer/metal/RTCMTLVideoView.m index e0fd524177..7ad1d79d3e 100644 --- a/sdk/objc/Framework/Classes/Metal/RTCMTLVideoView.m +++ b/sdk/objc/components/renderer/metal/RTCMTLVideoView.m @@ -8,14 +8,15 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCMTLVideoView.h" +#import "RTCMTLVideoView.h" #import #import -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" #import "RTCMTLI420Renderer.h" #import "RTCMTLNV12Renderer.h" diff --git a/sdk/objc/components/renderer/opengl/RTCDefaultShader.h b/sdk/objc/components/renderer/opengl/RTCDefaultShader.h new file mode 100644 index 0000000000..034a22bdd0 --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCDefaultShader.h @@ -0,0 +1,23 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoViewShading.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Default RTCVideoViewShading that will be used in RTCNSGLVideoView and + * RTCEAGLVideoView if no external shader is specified. This shader will render + * the video in a rectangle without any color or geometric transformations. + */ +@interface RTCDefaultShader : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Video/RTCDefaultShader.mm b/sdk/objc/components/renderer/opengl/RTCDefaultShader.mm similarity index 99% rename from sdk/objc/Framework/Classes/Video/RTCDefaultShader.mm rename to sdk/objc/components/renderer/opengl/RTCDefaultShader.mm index c5fbde12c8..51dca3223d 100644 --- a/sdk/objc/Framework/Classes/Video/RTCDefaultShader.mm +++ b/sdk/objc/components/renderer/opengl/RTCDefaultShader.mm @@ -18,7 +18,7 @@ #import "RTCOpenGLDefines.h" #import "RTCShader.h" -#import "WebRTC/RTCLogging.h" +#import "base/RTCLogging.h" #include "absl/types/optional.h" diff --git a/sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.h b/sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.h new file mode 100644 index 0000000000..b78501e9e6 --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.h @@ -0,0 +1,24 @@ +/* + * Copyright 2018 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. + */ + +#import + +// RTCDisplayLinkTimer wraps a CADisplayLink and is set to fire every two screen +// refreshes, which should be 30fps. We wrap the display link in order to avoid +// a retain cycle since CADisplayLink takes a strong reference onto its target. +// The timer is paused by default. +@interface RTCDisplayLinkTimer : NSObject + +@property(nonatomic) BOOL isPaused; + +- (instancetype)initWithTimerHandler:(void (^)(void))timerHandler; +- (void)invalidate; + +@end diff --git a/sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.m b/sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.m new file mode 100644 index 0000000000..906bb898d6 --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCDisplayLinkTimer.m @@ -0,0 +1,59 @@ +/* + * Copyright 2018 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. + */ + +#import "RTCDisplayLinkTimer.h" + +#import + +@implementation RTCDisplayLinkTimer { + CADisplayLink *_displayLink; + void (^_timerHandler)(void); +} + +- (instancetype)initWithTimerHandler:(void (^)(void))timerHandler { + NSParameterAssert(timerHandler); + if (self = [super init]) { + _timerHandler = timerHandler; + _displayLink = + [CADisplayLink displayLinkWithTarget:self + selector:@selector(displayLinkDidFire:)]; + _displayLink.paused = YES; +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0 + _displayLink.preferredFramesPerSecond = 30; +#else + [_displayLink setFrameInterval:2]; +#endif + [_displayLink addToRunLoop:[NSRunLoop currentRunLoop] + forMode:NSRunLoopCommonModes]; + } + return self; +} + +- (void)dealloc { + [self invalidate]; +} + +- (BOOL)isPaused { + return _displayLink.paused; +} + +- (void)setIsPaused:(BOOL)isPaused { + _displayLink.paused = isPaused; +} + +- (void)invalidate { + [_displayLink invalidate]; +} + +- (void)displayLinkDidFire:(CADisplayLink *)displayLink { + _timerHandler(); +} + +@end diff --git a/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h new file mode 100644 index 0000000000..50bbf2eb06 --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.h @@ -0,0 +1,44 @@ +/* + * Copyright 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. + */ + +#import +#import + +#import "RTCMacros.h" +#import "RTCVideoRenderer.h" +#import "RTCVideoViewShading.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCEAGLVideoView; + +RTC_EXPORT +@protocol RTCEAGLVideoViewDelegate +@end + +/** + * RTCEAGLVideoView is an RTCVideoRenderer which renders video frames in its + * bounds using OpenGLES 2.0 or OpenGLES 3.0. + */ +RTC_EXPORT +NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.") +@interface RTCEAGLVideoView : UIView + +@property(nonatomic, weak) id delegate; + +- (instancetype)initWithFrame:(CGRect)frame + shader:(id)shader NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithCoder:(NSCoder *)aDecoder + shader:(id)shader NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m similarity index 84% rename from sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m rename to sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m index a26741479f..662e4c61ee 100644 --- a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m +++ b/sdk/objc/components/renderer/opengl/RTCEAGLVideoView.m @@ -8,75 +8,18 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCEAGLVideoView.h" +#import "RTCEAGLVideoView.h" #import #import "RTCDefaultShader.h" +#import "RTCDisplayLinkTimer.h" #import "RTCI420TextureCache.h" #import "RTCNV12TextureCache.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" - -// RTCDisplayLinkTimer wraps a CADisplayLink and is set to fire every two screen -// refreshes, which should be 30fps. We wrap the display link in order to avoid -// a retain cycle since CADisplayLink takes a strong reference onto its target. -// The timer is paused by default. -@interface RTCDisplayLinkTimer : NSObject - -@property(nonatomic) BOOL isPaused; - -- (instancetype)initWithTimerHandler:(void (^)(void))timerHandler; -- (void)invalidate; - -@end - -@implementation RTCDisplayLinkTimer { - CADisplayLink *_displayLink; - void (^_timerHandler)(void); -} - -- (instancetype)initWithTimerHandler:(void (^)(void))timerHandler { - NSParameterAssert(timerHandler); - if (self = [super init]) { - _timerHandler = timerHandler; - _displayLink = - [CADisplayLink displayLinkWithTarget:self - selector:@selector(displayLinkDidFire:)]; - _displayLink.paused = YES; -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0 - _displayLink.preferredFramesPerSecond = 30; -#else - [_displayLink setFrameInterval:2]; -#endif - [_displayLink addToRunLoop:[NSRunLoop currentRunLoop] - forMode:NSRunLoopCommonModes]; - } - return self; -} - -- (void)dealloc { - [self invalidate]; -} - -- (BOOL)isPaused { - return _displayLink.paused; -} - -- (void)setIsPaused:(BOOL)isPaused { - _displayLink.paused = isPaused; -} - -- (void)invalidate { - [_displayLink invalidate]; -} - -- (void)displayLinkDidFire:(CADisplayLink *)displayLink { - _timerHandler(); -} - -@end +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" // RTCEAGLVideoView wraps a GLKView which is setup with // enableSetNeedsDisplay = NO for the purpose of gaining control of diff --git a/sdk/objc/Framework/Classes/Video/RTCI420TextureCache.h b/sdk/objc/components/renderer/opengl/RTCI420TextureCache.h similarity index 96% rename from sdk/objc/Framework/Classes/Video/RTCI420TextureCache.h rename to sdk/objc/components/renderer/opengl/RTCI420TextureCache.h index 19f1bc9993..07172e713a 100644 --- a/sdk/objc/Framework/Classes/Video/RTCI420TextureCache.h +++ b/sdk/objc/components/renderer/opengl/RTCI420TextureCache.h @@ -9,7 +9,7 @@ */ #import "RTCOpenGLDefines.h" -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCVideoFrame.h" @interface RTCI420TextureCache : NSObject diff --git a/sdk/objc/Framework/Classes/Video/RTCI420TextureCache.mm b/sdk/objc/components/renderer/opengl/RTCI420TextureCache.mm similarity index 98% rename from sdk/objc/Framework/Classes/Video/RTCI420TextureCache.mm rename to sdk/objc/components/renderer/opengl/RTCI420TextureCache.mm index b603130ea7..865f3a258a 100644 --- a/sdk/objc/Framework/Classes/Video/RTCI420TextureCache.mm +++ b/sdk/objc/components/renderer/opengl/RTCI420TextureCache.mm @@ -9,7 +9,6 @@ */ #import "RTCI420TextureCache.h" -#import "WebRTC/RTCVideoFrameBuffer.h" #if TARGET_OS_IPHONE #import @@ -17,6 +16,9 @@ #import #endif +#import "base/RTCI420Buffer.h" +#import "base/RTCVideoFrameBuffer.h" + #include // Two sets of 3 textures are used here, one for each of the Y, U and V planes. Having two sets diff --git a/sdk/objc/components/renderer/opengl/RTCNSGLVideoView.h b/sdk/objc/components/renderer/opengl/RTCNSGLVideoView.h new file mode 100644 index 0000000000..14c64b470e --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCNSGLVideoView.h @@ -0,0 +1,41 @@ +/* + * Copyright 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. + */ + +#import + +#if !TARGET_OS_IPHONE + +#import + +#import "RTCVideoViewShading.h" +#import "base/RTCVideoRenderer.h" + +NS_ASSUME_NONNULL_BEGIN + +@class RTCNSGLVideoView; + +RTC_EXPORT +@protocol RTCNSGLVideoViewDelegate +@end + +RTC_EXPORT +@interface RTCNSGLVideoView : NSOpenGLView + +@property(nonatomic, weak) id delegate; + +- (instancetype)initWithFrame:(NSRect)frameRect + pixelFormat:(NSOpenGLPixelFormat *)format + shader:(id)shader NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/sdk/objc/Framework/Classes/UI/RTCNSGLVideoView.m b/sdk/objc/components/renderer/opengl/RTCNSGLVideoView.m similarity index 98% rename from sdk/objc/Framework/Classes/UI/RTCNSGLVideoView.m rename to sdk/objc/components/renderer/opengl/RTCNSGLVideoView.m index 9578f820a3..714cae79c6 100644 --- a/sdk/objc/Framework/Classes/UI/RTCNSGLVideoView.m +++ b/sdk/objc/components/renderer/opengl/RTCNSGLVideoView.m @@ -12,7 +12,7 @@ #if !TARGET_OS_IPHONE -#import "WebRTC/RTCNSGLVideoView.h" +#import "RTCNSGLVideoView.h" #import #import @@ -20,8 +20,8 @@ #import "RTCDefaultShader.h" #import "RTCI420TextureCache.h" -#import "WebRTC/RTCLogging.h" -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCLogging.h" +#import "base/RTCVideoFrame.h" @interface RTCNSGLVideoView () // |videoFrame| is set when we receive a frame from a worker thread and is read diff --git a/sdk/objc/components/renderer/opengl/RTCNV12TextureCache.h b/sdk/objc/components/renderer/opengl/RTCNV12TextureCache.h new file mode 100644 index 0000000000..9cba823271 --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCNV12TextureCache.h @@ -0,0 +1,31 @@ +/* + * Copyright 2017 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. + */ + +#import + +@class RTCVideoFrame; + +NS_ASSUME_NONNULL_BEGIN + +@interface RTCNV12TextureCache : NSObject + +@property(nonatomic, readonly) GLuint yTexture; +@property(nonatomic, readonly) GLuint uvTexture; + +- (instancetype)init NS_UNAVAILABLE; +- (nullable instancetype)initWithContext:(EAGLContext *)context NS_DESIGNATED_INITIALIZER; + +- (BOOL)uploadFrameToTextures:(RTCVideoFrame *)frame; + +- (void)releaseTextures; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.m b/sdk/objc/components/renderer/opengl/RTCNV12TextureCache.m similarity index 96% rename from sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.m rename to sdk/objc/components/renderer/opengl/RTCNV12TextureCache.m index 20a6082a78..19213e548e 100644 --- a/sdk/objc/Framework/Classes/Video/RTCNV12TextureCache.m +++ b/sdk/objc/components/renderer/opengl/RTCNV12TextureCache.m @@ -10,8 +10,9 @@ #import "RTCNV12TextureCache.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" @implementation RTCNV12TextureCache { CVOpenGLESTextureCacheRef _textureCache; @@ -108,4 +109,3 @@ } @end - diff --git a/sdk/objc/Framework/Classes/Video/RTCOpenGLDefines.h b/sdk/objc/components/renderer/opengl/RTCOpenGLDefines.h similarity index 100% rename from sdk/objc/Framework/Classes/Video/RTCOpenGLDefines.h rename to sdk/objc/components/renderer/opengl/RTCOpenGLDefines.h diff --git a/sdk/objc/Framework/Classes/Video/RTCShader.h b/sdk/objc/components/renderer/opengl/RTCShader.h similarity index 96% rename from sdk/objc/Framework/Classes/Video/RTCShader.h rename to sdk/objc/components/renderer/opengl/RTCShader.h index 67afabb1d8..d1b91fb643 100644 --- a/sdk/objc/Framework/Classes/Video/RTCShader.h +++ b/sdk/objc/components/renderer/opengl/RTCShader.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCVideoFrame.h" RTC_EXTERN const char kRTCVertexShaderSource[]; diff --git a/sdk/objc/Framework/Classes/Video/RTCShader.mm b/sdk/objc/components/renderer/opengl/RTCShader.mm similarity index 100% rename from sdk/objc/Framework/Classes/Video/RTCShader.mm rename to sdk/objc/components/renderer/opengl/RTCShader.mm diff --git a/sdk/objc/components/renderer/opengl/RTCVideoViewShading.h b/sdk/objc/components/renderer/opengl/RTCVideoViewShading.h new file mode 100644 index 0000000000..a570129a82 --- /dev/null +++ b/sdk/objc/components/renderer/opengl/RTCVideoViewShading.h @@ -0,0 +1,41 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCVideoFrame.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * RTCVideoViewShading provides a way for apps to customize the OpenGL(ES) shaders used in + * rendering for the RTCEAGLVideoView/RTCNSGLVideoView. + */ +RTC_EXPORT +@protocol RTCVideoViewShading + +/** Callback for I420 frames. Each plane is given as a texture. */ +- (void)applyShadingForFrameWithWidth:(int)width + height:(int)height + rotation:(RTCVideoRotation)rotation + yPlane:(GLuint)yPlane + uPlane:(GLuint)uPlane + vPlane:(GLuint)vPlane; + +/** Callback for NV12 frames. Each plane is given as a texture. */ +- (void)applyShadingForFrameWithWidth:(int)width + height:(int)height + rotation:(RTCVideoRotation)rotation + yPlane:(GLuint)yPlane + uvPlane:(GLuint)uvPlane; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h b/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h new file mode 100644 index 0000000000..f67fa94ca8 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264+Private.h @@ -0,0 +1,24 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCCodecSpecificInfoH264.h" + +#include "modules/video_coding/include/video_codec_interface.h" + +NS_ASSUME_NONNULL_BEGIN + +/* Interfaces for converting to/from internal C++ formats. */ +@interface RTCCodecSpecificInfoH264 () + +- (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.h b/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.h new file mode 100644 index 0000000000..e9af571487 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.h @@ -0,0 +1,27 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCCodecSpecificInfo.h" +#import "RTCMacros.h" + +/** Class for H264 specific config. */ +typedef NS_ENUM(NSUInteger, RTCH264PacketizationMode) { + RTCH264PacketizationModeNonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed + RTCH264PacketizationModeSingleNalUnit // Mode 0 - only single NALU allowed +}; + +RTC_EXPORT +@interface RTCCodecSpecificInfoH264 : NSObject + +@property(nonatomic, assign) RTCH264PacketizationMode packetizationMode; + +@end diff --git a/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.mm b/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.mm new file mode 100644 index 0000000000..63e8bd7f42 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCCodecSpecificInfoH264.mm @@ -0,0 +1,30 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCCodecSpecificInfoH264+Private.h" + +#import "RTCH264ProfileLevelId.h" + +// H264 specific settings. +@implementation RTCCodecSpecificInfoH264 + +@synthesize packetizationMode = _packetizationMode; + +- (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo { + webrtc::CodecSpecificInfo codecSpecificInfo; + codecSpecificInfo.codecType = webrtc::kVideoCodecH264; + codecSpecificInfo.codec_name = [kRTCVideoCodecH264Name cStringUsingEncoding:NSUTF8StringEncoding]; + codecSpecificInfo.codecSpecific.H264.packetization_mode = + (webrtc::H264PacketizationMode)_packetizationMode; + + return codecSpecificInfo; +} + +@end diff --git a/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h b/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h new file mode 100644 index 0000000000..1ad9c43e64 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoDecoderFactory.h" + +NS_ASSUME_NONNULL_BEGIN + +/** This decoder factory include support for all codecs bundled with WebRTC. If using custom + * codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory. + */ +RTC_EXPORT +@interface RTCDefaultVideoDecoderFactory : NSObject +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoDecoderFactory.m b/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m similarity index 81% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoDecoderFactory.m rename to sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m index 5f292c9c38..c7d08caa9c 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoDecoderFactory.m +++ b/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m @@ -8,12 +8,15 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCodecFactory.h" +#import "RTCDefaultVideoDecoderFactory.h" -#import "WebRTC/RTCVideoCodecH264.h" -#import "WebRTC/RTCVideoDecoderVP8.h" +#import "RTCH264ProfileLevelId.h" +#import "RTCVideoDecoderH264.h" +#import "api/video_codec/RTCVideoCodecConstants.h" +#import "api/video_codec/RTCVideoDecoderVP8.h" +#import "base/RTCVideoCodecInfo.h" #if !defined(RTC_DISABLE_VP9) -#import "WebRTC/RTCVideoDecoderVP9.h" +#import "api/video_codec/RTCVideoDecoderVP9.h" #endif @implementation RTCDefaultVideoDecoderFactory diff --git a/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h new file mode 100644 index 0000000000..b0e0af6bc4 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h @@ -0,0 +1,30 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoEncoderFactory.h" + +NS_ASSUME_NONNULL_BEGIN + +/** This encoder factory include support for all codecs bundled with WebRTC. If using custom + * codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory. + */ +RTC_EXPORT +@interface RTCDefaultVideoEncoderFactory : NSObject + +@property(nonatomic, retain) RTCVideoCodecInfo *preferredCodec; + ++ (NSArray *)supportedCodecs; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoEncoderFactory.m b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m similarity index 90% rename from sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoEncoderFactory.m rename to sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m index a4b8d710f4..b01c074679 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCDefaultVideoEncoderFactory.m +++ b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m @@ -8,13 +8,15 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCodecFactory.h" +#import "RTCDefaultVideoEncoderFactory.h" -#import "WebRTC/RTCVideoCodec.h" -#import "WebRTC/RTCVideoCodecH264.h" -#import "WebRTC/RTCVideoEncoderVP8.h" +#import "RTCH264ProfileLevelId.h" +#import "RTCVideoEncoderH264.h" +#import "api/video_codec/RTCVideoCodecConstants.h" +#import "api/video_codec/RTCVideoEncoderVP8.h" +#import "base/RTCVideoCodecInfo.h" #if !defined(RTC_DISABLE_VP9) -#import "WebRTC/RTCVideoEncoderVP9.h" +#import "api/video_codec/RTCVideoEncoderVP9.h" #endif @implementation RTCDefaultVideoEncoderFactory diff --git a/sdk/objc/components/video_codec/RTCH264ProfileLevelId.h b/sdk/objc/components/video_codec/RTCH264ProfileLevelId.h new file mode 100644 index 0000000000..7b4e788e2b --- /dev/null +++ b/sdk/objc/components/video_codec/RTCH264ProfileLevelId.h @@ -0,0 +1,60 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" + +RTC_EXPORT extern NSString *const kRTCVideoCodecH264Name; +RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedHigh; +RTC_EXPORT extern NSString *const kRTCLevel31ConstrainedBaseline; +RTC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh; +RTC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline; + +/** H264 Profiles and levels. */ +typedef NS_ENUM(NSUInteger, RTCH264Profile) { + RTCH264ProfileConstrainedBaseline, + RTCH264ProfileBaseline, + RTCH264ProfileMain, + RTCH264ProfileConstrainedHigh, + RTCH264ProfileHigh, +}; + +typedef NS_ENUM(NSUInteger, RTCH264Level) { + RTCH264Level1_b = 0, + RTCH264Level1 = 10, + RTCH264Level1_1 = 11, + RTCH264Level1_2 = 12, + RTCH264Level1_3 = 13, + RTCH264Level2 = 20, + RTCH264Level2_1 = 21, + RTCH264Level2_2 = 22, + RTCH264Level3 = 30, + RTCH264Level3_1 = 31, + RTCH264Level3_2 = 32, + RTCH264Level4 = 40, + RTCH264Level4_1 = 41, + RTCH264Level4_2 = 42, + RTCH264Level5 = 50, + RTCH264Level5_1 = 51, + RTCH264Level5_2 = 52 +}; + +RTC_EXPORT +@interface RTCH264ProfileLevelId : NSObject + +@property(nonatomic, readonly) RTCH264Profile profile; +@property(nonatomic, readonly) RTCH264Level level; +@property(nonatomic, readonly) NSString *hexString; + +- (instancetype)initWithHexString:(NSString *)hexString; +- (instancetype)initWithProfile:(RTCH264Profile)profile level:(RTCH264Level)level; + +@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCH264ProfileLevelId.mm b/sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm similarity index 50% rename from sdk/objc/Framework/Classes/PeerConnection/RTCH264ProfileLevelId.mm rename to sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm index 04a5689417..359656cb97 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCH264ProfileLevelId.mm +++ b/sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm @@ -9,9 +9,71 @@ * */ -#import "WebRTC/RTCVideoCodecH264.h" +#import "RTCH264ProfileLevelId.h" + +#import "helpers/NSString+StdString.h" +#if defined(WEBRTC_IOS) +#import "UIDevice+H264Profile.h" +#endif #include "media/base/h264_profile_level_id.h" +#include "media/base/mediaconstants.h" + +namespace { + +NSString *MaxSupportedProfileLevelConstrainedHigh(); +NSString *MaxSupportedProfileLevelConstrainedBaseline(); + +} // namespace + +NSString *const kRTCVideoCodecH264Name = @(cricket::kH264CodecName); +NSString *const kRTCLevel31ConstrainedHigh = @"640c1f"; +NSString *const kRTCLevel31ConstrainedBaseline = @"42e01f"; +NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh = + MaxSupportedProfileLevelConstrainedHigh(); +NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline = + MaxSupportedProfileLevelConstrainedBaseline(); + +namespace { + +#if defined(WEBRTC_IOS) + +using namespace webrtc::H264; + +NSString *MaxSupportedLevelForProfile(Profile profile) { + const absl::optional profileLevelId = [UIDevice maxSupportedH264Profile]; + if (profileLevelId && profileLevelId->profile >= profile) { + const absl::optional profileString = + ProfileLevelIdToString(ProfileLevelId(profile, profileLevelId->level)); + if (profileString) { + return [NSString stringForStdString:*profileString]; + } + } + return nil; +} +#endif + +NSString *MaxSupportedProfileLevelConstrainedBaseline() { +#if defined(WEBRTC_IOS) + NSString *profile = MaxSupportedLevelForProfile(webrtc::H264::kProfileConstrainedBaseline); + if (profile != nil) { + return profile; + } +#endif + return kRTCLevel31ConstrainedBaseline; +} + +NSString *MaxSupportedProfileLevelConstrainedHigh() { +#if defined(WEBRTC_IOS) + NSString *profile = MaxSupportedLevelForProfile(webrtc::H264::kProfileConstrainedHigh); + if (profile != nil) { + return profile; + } +#endif + return kRTCLevel31ConstrainedHigh; +} + +} // namespace @interface RTCH264ProfileLevelId () diff --git a/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.h b/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.h new file mode 100644 index 0000000000..850ba7e317 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.h @@ -0,0 +1,18 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoDecoderFactory.h" + +RTC_EXPORT +@interface RTCVideoDecoderFactoryH264 : NSObject +@end diff --git a/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m b/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m new file mode 100644 index 0000000000..b9b9aa72c6 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCVideoDecoderFactoryH264.m @@ -0,0 +1,27 @@ +/* + * Copyright 2017 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. + */ + +#import "RTCVideoDecoderFactoryH264.h" + +#import "RTCH264ProfileLevelId.h" +#import "RTCVideoDecoderH264.h" + +@implementation RTCVideoDecoderFactoryH264 + +- (id)createDecoder:(RTCVideoCodecInfo *)info { + return [[RTCVideoDecoderH264 alloc] init]; +} + +- (NSArray *)supportedCodecs { + NSString *codecName = kRTCVideoCodecH264Name; + return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ]; +} + +@end diff --git a/sdk/objc/components/video_codec/RTCVideoDecoderH264.h b/sdk/objc/components/video_codec/RTCVideoDecoderH264.h new file mode 100644 index 0000000000..227200fee0 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCVideoDecoderH264.h @@ -0,0 +1,18 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoDecoder.h" + +RTC_EXPORT +@interface RTCVideoDecoderH264 : NSObject +@end diff --git a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm b/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm similarity index 91% rename from sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm rename to sdk/objc/components/video_codec/RTCVideoDecoderH264.mm index 2871b8a5ef..2fa123b769 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm +++ b/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm @@ -9,25 +9,25 @@ * */ -#import "WebRTC/RTCVideoCodecH264.h" +#import "RTCVideoDecoderH264.h" #import +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" +#import "helpers.h" +#import "helpers/scoped_cftyperef.h" + +#if defined(WEBRTC_IOS) +#import "helpers/UIDevice+RTCDevice.h" +#endif + #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/timeutils.h" -#include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h" - -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" -#import "helpers.h" -#import "scoped_cftyperef.h" - -#if defined(WEBRTC_IOS) -#import "Common/RTCUIApplicationStatusObserver.h" -#import "WebRTC/UIDevice+RTCDevice.h" -#endif +#include "sdk/objc/components/video_codec/nalu_rewriter.h" // Struct that we pass to the decoder per frame to decode. We receive it again // in the decoder callback. @@ -78,10 +78,6 @@ void decompressionOutputCallback(void *decoderRef, - (instancetype)init { if (self = [super init]) { -#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION) - [RTCUIApplicationStatusObserver prepareForUse]; - _error = noErr; -#endif } return self; @@ -113,16 +109,6 @@ void decompressionOutputCallback(void *decoderRef, return WEBRTC_VIDEO_CODEC_ERROR; } -#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION) - if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) { - // Ignore all decode requests when app isn't active. In this state, the - // hardware decoder has been invalidated by the OS. - // Reset video format so that we won't process frames until the next - // keyframe. - [self setVideoFormat:nullptr]; - return WEBRTC_VIDEO_CODEC_NO_OUTPUT; - } -#endif rtc::ScopedCFTypeRef inputFormat = rtc::ScopedCF(webrtc::CreateVideoFormatDescription((uint8_t *)inputImage.buffer.bytes, inputImage.buffer.length)); diff --git a/sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.h b/sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.h new file mode 100644 index 0000000000..d185656b42 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.h @@ -0,0 +1,18 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoEncoderFactory.h" + +RTC_EXPORT +@interface RTCVideoEncoderFactoryH264 : NSObject +@end diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm b/sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.m similarity index 59% rename from sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm rename to sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.m index 51583d09eb..bbc15e9d5d 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm +++ b/sdk/objc/components/video_codec/RTCVideoEncoderFactoryH264.m @@ -8,33 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCodecH264.h" +#import "RTCVideoEncoderFactoryH264.h" -#include +#import "RTCH264ProfileLevelId.h" +#import "RTCVideoEncoderH264.h" -#import "RTCVideoCodec+Private.h" -#import "WebRTC/RTCVideoCodec.h" - -#include "rtc_base/timeutils.h" - -// H264 specific settings. -@implementation RTCCodecSpecificInfoH264 - -@synthesize packetizationMode = _packetizationMode; - -- (webrtc::CodecSpecificInfo)nativeCodecSpecificInfo { - webrtc::CodecSpecificInfo codecSpecificInfo; - codecSpecificInfo.codecType = webrtc::kVideoCodecH264; - codecSpecificInfo.codec_name = [kRTCVideoCodecH264Name cStringUsingEncoding:NSUTF8StringEncoding]; - codecSpecificInfo.codecSpecific.H264.packetization_mode = - (webrtc::H264PacketizationMode)_packetizationMode; - - return codecSpecificInfo; -} - -@end - -// Encoder factory. @implementation RTCVideoEncoderFactoryH264 - (NSArray *)supportedCodecs { @@ -67,17 +45,3 @@ } @end - -// Decoder factory. -@implementation RTCVideoDecoderFactoryH264 - -- (id)createDecoder:(RTCVideoCodecInfo *)info { - return [[RTCVideoDecoderH264 alloc] init]; -} - -- (NSArray *)supportedCodecs { - NSString *codecName = kRTCVideoCodecH264Name; - return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ]; -} - -@end diff --git a/sdk/objc/components/video_codec/RTCVideoEncoderH264.h b/sdk/objc/components/video_codec/RTCVideoEncoderH264.h new file mode 100644 index 0000000000..d57713eb86 --- /dev/null +++ b/sdk/objc/components/video_codec/RTCVideoEncoderH264.h @@ -0,0 +1,22 @@ +/* + * Copyright 2017 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoCodecInfo.h" +#import "RTCVideoEncoder.h" + +RTC_EXPORT +@interface RTCVideoEncoderH264 : NSObject + +- (instancetype)initWithCodecInfo:(RTCVideoCodecInfo *)codecInfo; + +@end diff --git a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm b/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm similarity index 97% rename from sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm rename to sdk/objc/components/video_codec/RTCVideoEncoderH264.mm index c167e54757..6cd56debc8 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm +++ b/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm @@ -9,29 +9,35 @@ * */ -#import "WebRTC/RTCVideoCodecH264.h" +#import "RTCVideoEncoderH264.h" #import #include #if defined(WEBRTC_IOS) -#import "Common/RTCUIApplicationStatusObserver.h" -#import "WebRTC/UIDevice+RTCDevice.h" +#import "helpers/UIDevice+RTCDevice.h" #endif -#import "PeerConnection/RTCVideoCodec+Private.h" -#import "WebRTC/RTCVideoCodec.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "RTCCodecSpecificInfoH264.h" +#import "RTCH264ProfileLevelId.h" +#import "api/peerconnection/RTCRtpFragmentationHeader+Private.h" +#import "api/peerconnection/RTCVideoCodecInfo+Private.h" +#import "base/RTCCodecSpecificInfo.h" +#import "base/RTCI420Buffer.h" +#import "base/RTCVideoEncoder.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" +#import "helpers.h" + #include "common_video/h264/h264_bitstream_parser.h" #include "common_video/h264/profile_level_id.h" #include "common_video/include/bitrate_adjuster.h" -#import "helpers.h" #include "modules/include/module_common_types.h" #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/buffer.h" #include "rtc_base/logging.h" #include "rtc_base/timeutils.h" -#include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h" +#include "sdk/objc/components/video_codec/nalu_rewriter.h" #include "third_party/libyuv/include/libyuv/convert_from.h" @interface RTCVideoEncoderH264 () @@ -307,10 +313,6 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) { _profile = ExtractProfile([codecInfo nativeSdpVideoFormat]); RTC_LOG(LS_INFO) << "Using profile " << CFStringToString(_profile); RTC_CHECK([codecInfo.name isEqualToString:kRTCVideoCodecH264Name]); - -#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION) - [RTCUIApplicationStatusObserver prepareForUse]; -#endif } return self; } @@ -346,13 +348,6 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) { if (!_callback || !_compressionSession) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } -#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION) - if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) { - // Ignore all encode requests when app isn't active. In this state, the - // hardware encoder has been invalidated by the OS. - return WEBRTC_VIDEO_CODEC_OK; - } -#endif BOOL isKeyframeRequired = NO; // Get a pixel buffer from the pool and copy frame data over. diff --git a/sdk/objc/Framework/Classes/Video/UIDevice+H264Profile.h b/sdk/objc/components/video_codec/UIDevice+H264Profile.h similarity index 100% rename from sdk/objc/Framework/Classes/Video/UIDevice+H264Profile.h rename to sdk/objc/components/video_codec/UIDevice+H264Profile.h diff --git a/sdk/objc/Framework/Classes/Video/UIDevice+H264Profile.mm b/sdk/objc/components/video_codec/UIDevice+H264Profile.mm similarity index 99% rename from sdk/objc/Framework/Classes/Video/UIDevice+H264Profile.mm rename to sdk/objc/components/video_codec/UIDevice+H264Profile.mm index 196e34e4ef..a015f7ca15 100644 --- a/sdk/objc/Framework/Classes/Video/UIDevice+H264Profile.mm +++ b/sdk/objc/components/video_codec/UIDevice+H264Profile.mm @@ -9,7 +9,7 @@ */ #import "UIDevice+H264Profile.h" -#import "WebRTC/UIDevice+RTCDevice.h" +#import "helpers/UIDevice+RTCDevice.h" #include diff --git a/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc b/sdk/objc/components/video_codec/helpers.cc similarity index 100% rename from sdk/objc/Framework/Classes/VideoToolbox/helpers.cc rename to sdk/objc/components/video_codec/helpers.cc diff --git a/sdk/objc/Framework/Classes/VideoToolbox/helpers.h b/sdk/objc/components/video_codec/helpers.h similarity index 100% rename from sdk/objc/Framework/Classes/VideoToolbox/helpers.h rename to sdk/objc/components/video_codec/helpers.h diff --git a/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.cc b/sdk/objc/components/video_codec/nalu_rewriter.cc similarity index 99% rename from sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.cc rename to sdk/objc/components/video_codec/nalu_rewriter.cc index 479ef3c6bb..a849d3f053 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.cc +++ b/sdk/objc/components/video_codec/nalu_rewriter.cc @@ -9,7 +9,7 @@ * */ -#include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h" +#include "sdk/objc/components/video_codec/nalu_rewriter.h" #include #include diff --git a/sdk/objc/components/video_codec/nalu_rewriter.h b/sdk/objc/components/video_codec/nalu_rewriter.h new file mode 100644 index 0000000000..cd5a51079a --- /dev/null +++ b/sdk/objc/components/video_codec/nalu_rewriter.h @@ -0,0 +1,116 @@ +/* + * 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. + * + */ + +#ifndef SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_NALU_REWRITER_H_ +#define SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_NALU_REWRITER_H_ + +#include "modules/video_coding/codecs/h264/include/h264.h" + +#include +#include + +#include "common_video/h264/h264_common.h" +#include "modules/include/module_common_types.h" +#include "rtc_base/buffer.h" + +using webrtc::H264::NaluIndex; + +namespace webrtc { + +// Converts a sample buffer emitted from the VideoToolbox encoder into a buffer +// suitable for RTP. The sample buffer is in avcc format whereas the rtp buffer +// needs to be in Annex B format. Data is written directly to |annexb_buffer| +// and a new RTPFragmentationHeader is returned in |out_header|. +bool H264CMSampleBufferToAnnexBBuffer( + CMSampleBufferRef avcc_sample_buffer, + bool is_keyframe, + rtc::Buffer* annexb_buffer, + std::unique_ptr* out_header); + +// Converts a buffer received from RTP into a sample buffer suitable for the +// VideoToolbox decoder. The RTP buffer is in annex b format whereas the sample +// buffer is in avcc format. +// If |is_keyframe| is true then |video_format| is ignored since the format will +// be read from the buffer. Otherwise |video_format| must be provided. +// Caller is responsible for releasing the created sample buffer. +bool H264AnnexBBufferToCMSampleBuffer(const uint8_t* annexb_buffer, + size_t annexb_buffer_size, + CMVideoFormatDescriptionRef video_format, + CMSampleBufferRef* out_sample_buffer); + +// Returns a video format description created from the sps/pps information in +// the Annex B buffer. If there is no such information, nullptr is returned. +// The caller is responsible for releasing the description. +CMVideoFormatDescriptionRef CreateVideoFormatDescription( + const uint8_t* annexb_buffer, + size_t annexb_buffer_size); + +// Helper class for reading NALUs from an RTP Annex B buffer. +class AnnexBBufferReader final { + public: + AnnexBBufferReader(const uint8_t* annexb_buffer, size_t length); + ~AnnexBBufferReader(); + AnnexBBufferReader(const AnnexBBufferReader& other) = delete; + void operator=(const AnnexBBufferReader& other) = delete; + + // Returns a pointer to the beginning of the next NALU slice without the + // header bytes and its length. Returns false if no more slices remain. + bool ReadNalu(const uint8_t** out_nalu, size_t* out_length); + + // Returns the number of unread NALU bytes, including the size of the header. + // If the buffer has no remaining NALUs this will return zero. + size_t BytesRemaining() const; + + // Reset the reader to start reading from the first NALU + void SeekToStart(); + + // Seek to the next position that holds a NALU of the desired type, + // or the end if no such NALU is found. + // Return true if a NALU of the desired type is found, false if we + // reached the end instead + bool SeekToNextNaluOfType(H264::NaluType type); + + private: + // Returns the the next offset that contains NALU data. + size_t FindNextNaluHeader(const uint8_t* start, + size_t length, + size_t offset) const; + + const uint8_t* const start_; + std::vector offsets_; + std::vector::iterator offset_; + const size_t length_; +}; + +// Helper class for writing NALUs using avcc format into a buffer. +class AvccBufferWriter final { + public: + AvccBufferWriter(uint8_t* const avcc_buffer, size_t length); + ~AvccBufferWriter() {} + AvccBufferWriter(const AvccBufferWriter& other) = delete; + void operator=(const AvccBufferWriter& other) = delete; + + // Writes the data slice into the buffer. Returns false if there isn't + // enough space left. + bool WriteNalu(const uint8_t* data, size_t data_size); + + // Returns the unused bytes in the buffer. + size_t BytesRemaining() const; + + private: + uint8_t* const start_; + size_t offset_; + const size_t length_; +}; + +} // namespace webrtc + +#endif // SDK_OBJC_FRAMEWORK_CLASSES_VIDEOTOOLBOX_NALU_REWRITER_H_ diff --git a/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter_unittest.cc b/sdk/objc/components/video_codec/nalu_rewriter_unittest.cc similarity index 99% rename from sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter_unittest.cc rename to sdk/objc/components/video_codec/nalu_rewriter_unittest.cc index d907ef8487..4dc00c9231 100644 --- a/sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter_unittest.cc +++ b/sdk/objc/components/video_codec/nalu_rewriter_unittest.cc @@ -13,7 +13,7 @@ #include "common_video/h264/h264_common.h" #include "rtc_base/arraysize.h" -#include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h" +#include "sdk/objc/components/video_codec/nalu_rewriter.h" #include "test/gtest.h" namespace webrtc { diff --git a/sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.h b/sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.h new file mode 100644 index 0000000000..a12bd7a86d --- /dev/null +++ b/sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.h @@ -0,0 +1,52 @@ +/* + * Copyright 2018 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. + */ + +#import + +#import "RTCMacros.h" +#import "RTCVideoFrameBuffer.h" + +NS_ASSUME_NONNULL_BEGIN + +/** RTCVideoFrameBuffer containing a CVPixelBufferRef */ +RTC_EXPORT +@interface RTCCVPixelBuffer : NSObject + +@property(nonatomic, readonly) CVPixelBufferRef pixelBuffer; +@property(nonatomic, readonly) int cropX; +@property(nonatomic, readonly) int cropY; +@property(nonatomic, readonly) int cropWidth; +@property(nonatomic, readonly) int cropHeight; + ++ (NSSet *)supportedPixelFormats; + +- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer; +- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer + adaptedWidth:(int)adaptedWidth + adaptedHeight:(int)adaptedHeight + cropWidth:(int)cropWidth + cropHeight:(int)cropHeight + cropX:(int)cropX + cropY:(int)cropY; + +- (BOOL)requiresCropping; +- (BOOL)requiresScalingToWidth:(int)width height:(int)height; +- (int)bufferSizeForCroppingAndScalingToWidth:(int)width height:(int)height; + +/** The minimum size of the |tmpBuffer| must be the number of bytes returned from the + * bufferSizeForCroppingAndScalingToWidth:height: method. + * If that size is 0, the |tmpBuffer| may be nil. + */ +- (BOOL)cropAndScaleTo:(CVPixelBufferRef)outputPixelBuffer + withTempBuffer:(nullable uint8_t *)tmpBuffer; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Video/RTCCVPixelBuffer.mm b/sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.mm similarity index 99% rename from sdk/objc/Framework/Classes/Video/RTCCVPixelBuffer.mm rename to sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.mm index 9e5ac7320b..f0291f5966 100644 --- a/sdk/objc/Framework/Classes/Video/RTCCVPixelBuffer.mm +++ b/sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.mm @@ -8,7 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "RTCCVPixelBuffer.h" + +#import "api/video_frame_buffer/RTCMutableI420Buffer.h" #include "common_video/libyuv/include/webrtc_libyuv.h" #include "rtc_base/checks.h" diff --git a/sdk/objc/Framework/Classes/Video/AVCaptureSession+DevicePosition.h b/sdk/objc/helpers/AVCaptureSession+DevicePosition.h similarity index 100% rename from sdk/objc/Framework/Classes/Video/AVCaptureSession+DevicePosition.h rename to sdk/objc/helpers/AVCaptureSession+DevicePosition.h diff --git a/sdk/objc/Framework/Classes/Video/AVCaptureSession+DevicePosition.mm b/sdk/objc/helpers/AVCaptureSession+DevicePosition.mm similarity index 100% rename from sdk/objc/Framework/Classes/Video/AVCaptureSession+DevicePosition.mm rename to sdk/objc/helpers/AVCaptureSession+DevicePosition.mm diff --git a/sdk/objc/helpers/NSString+StdString.h b/sdk/objc/helpers/NSString+StdString.h new file mode 100644 index 0000000000..7f51a9f3c6 --- /dev/null +++ b/sdk/objc/helpers/NSString+StdString.h @@ -0,0 +1,26 @@ +/* + * Copyright 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. + */ + +#import + +#include + +NS_ASSUME_NONNULL_BEGIN + +@interface NSString (StdString) + +@property(nonatomic, readonly) std::string stdString; + ++ (std::string)stdStringForString:(NSString *)nsString; ++ (NSString *)stringForStdString:(const std::string &)stdString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/Common/NSString+StdString.mm b/sdk/objc/helpers/NSString+StdString.mm similarity index 100% rename from sdk/objc/Framework/Classes/Common/NSString+StdString.mm rename to sdk/objc/helpers/NSString+StdString.mm diff --git a/sdk/objc/helpers/RTCCameraPreviewView.h b/sdk/objc/helpers/RTCCameraPreviewView.h new file mode 100644 index 0000000000..3942811357 --- /dev/null +++ b/sdk/objc/helpers/RTCCameraPreviewView.h @@ -0,0 +1,30 @@ +/* + * Copyright 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. + */ + +#import +#import + +#import "RTCMacros.h" + +@class AVCaptureSession; + +/** RTCCameraPreviewView is a view that renders local video from an + * AVCaptureSession. + */ +RTC_EXPORT +@interface RTCCameraPreviewView : UIView + +/** The capture session being rendered in the view. Capture session + * is assigned to AVCaptureVideoPreviewLayer async in the same + * queue that the AVCaptureSession is started/stopped. + */ +@property(nonatomic, strong) AVCaptureSession* captureSession; + +@end diff --git a/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m b/sdk/objc/helpers/RTCCameraPreviewView.m similarity index 98% rename from sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m rename to sdk/objc/helpers/RTCCameraPreviewView.m index 492c210af0..2add46cf71 100644 --- a/sdk/objc/Framework/Classes/UI/RTCCameraPreviewView.m +++ b/sdk/objc/helpers/RTCCameraPreviewView.m @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCCameraPreviewView.h" +#import "RTCCameraPreviewView.h" #import #import diff --git a/sdk/objc/Framework/Classes/Common/RTCDispatcher+Private.h b/sdk/objc/helpers/RTCDispatcher+Private.h similarity index 94% rename from sdk/objc/Framework/Classes/Common/RTCDispatcher+Private.h rename to sdk/objc/helpers/RTCDispatcher+Private.h index 3c114e553d..aa741f4db9 100644 --- a/sdk/objc/Framework/Classes/Common/RTCDispatcher+Private.h +++ b/sdk/objc/helpers/RTCDispatcher+Private.h @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCDispatcher.h" +#import "RTCDispatcher.h" @interface RTCDispatcher () diff --git a/sdk/objc/helpers/RTCDispatcher.h b/sdk/objc/helpers/RTCDispatcher.h new file mode 100644 index 0000000000..e3e606f956 --- /dev/null +++ b/sdk/objc/helpers/RTCDispatcher.h @@ -0,0 +1,44 @@ +/* + * Copyright 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. + */ + +#import + +#import "RTCMacros.h" + +typedef NS_ENUM(NSInteger, RTCDispatcherQueueType) { + // Main dispatcher queue. + RTCDispatcherTypeMain, + // Used for starting/stopping AVCaptureSession, and assigning + // capture session to AVCaptureVideoPreviewLayer. + RTCDispatcherTypeCaptureSession, + // Used for operations on AVAudioSession. + RTCDispatcherTypeAudioSession, +}; + +/** Dispatcher that asynchronously dispatches blocks to a specific + * shared dispatch queue. + */ +RTC_EXPORT +@interface RTCDispatcher : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** Dispatch the block asynchronously on the queue for dispatchType. + * @param dispatchType The queue type to dispatch on. + * @param block The block to dispatch asynchronously. + */ ++ (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType block:(dispatch_block_t)block; + +/** Returns YES if run on queue for the dispatchType otherwise NO. + * Useful for asserting that a method is run on a correct queue. + */ ++ (BOOL)isOnQueueForType:(RTCDispatcherQueueType)dispatchType; + +@end diff --git a/sdk/objc/Framework/Classes/Common/RTCDispatcher.m b/sdk/objc/helpers/RTCDispatcher.m similarity index 99% rename from sdk/objc/Framework/Classes/Common/RTCDispatcher.m rename to sdk/objc/helpers/RTCDispatcher.m index 530e51a3c9..b9d64a4c54 100644 --- a/sdk/objc/Framework/Classes/Common/RTCDispatcher.m +++ b/sdk/objc/helpers/RTCDispatcher.m @@ -58,4 +58,3 @@ static dispatch_queue_t kCaptureSessionQueue = nil; } @end - diff --git a/sdk/objc/helpers/RTCUIApplicationStatusObserver.h b/sdk/objc/helpers/RTCUIApplicationStatusObserver.h new file mode 100644 index 0000000000..0c032953be --- /dev/null +++ b/sdk/objc/helpers/RTCUIApplicationStatusObserver.h @@ -0,0 +1,25 @@ +/* + * Copyright 2016 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. + */ + +#if defined(WEBRTC_IOS) + +#import + +NS_EXTENSION_UNAVAILABLE_IOS("Application status not available in app extensions.") +@interface RTCUIApplicationStatusObserver : NSObject + ++ (instancetype)sharedInstance; ++ (void)prepareForUse; + +- (BOOL)isApplicationActive; + +@end + +#endif // WEBRTC_IOS diff --git a/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.m b/sdk/objc/helpers/RTCUIApplicationStatusObserver.m similarity index 100% rename from sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.m rename to sdk/objc/helpers/RTCUIApplicationStatusObserver.m diff --git a/sdk/objc/helpers/UIDevice+RTCDevice.h b/sdk/objc/helpers/UIDevice+RTCDevice.h new file mode 100644 index 0000000000..eb39ea9cc4 --- /dev/null +++ b/sdk/objc/helpers/UIDevice+RTCDevice.h @@ -0,0 +1,81 @@ +/* + * Copyright 2016 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. + */ + +#import + +typedef NS_ENUM(NSInteger, RTCDeviceType) { + RTCDeviceTypeUnknown, + RTCDeviceTypeIPhone1G, + RTCDeviceTypeIPhone3G, + RTCDeviceTypeIPhone3GS, + RTCDeviceTypeIPhone4, + RTCDeviceTypeIPhone4Verizon, + RTCDeviceTypeIPhone4S, + RTCDeviceTypeIPhone5GSM, + RTCDeviceTypeIPhone5GSM_CDMA, + RTCDeviceTypeIPhone5CGSM, + RTCDeviceTypeIPhone5CGSM_CDMA, + RTCDeviceTypeIPhone5SGSM, + RTCDeviceTypeIPhone5SGSM_CDMA, + RTCDeviceTypeIPhone6Plus, + RTCDeviceTypeIPhone6, + RTCDeviceTypeIPhone6S, + RTCDeviceTypeIPhone6SPlus, + RTCDeviceTypeIPhone7, + RTCDeviceTypeIPhone7Plus, + RTCDeviceTypeIPhoneSE, + RTCDeviceTypeIPhone8, + RTCDeviceTypeIPhone8Plus, + RTCDeviceTypeIPhoneX, + RTCDeviceTypeIPodTouch1G, + RTCDeviceTypeIPodTouch2G, + RTCDeviceTypeIPodTouch3G, + RTCDeviceTypeIPodTouch4G, + RTCDeviceTypeIPodTouch5G, + RTCDeviceTypeIPodTouch6G, + RTCDeviceTypeIPad, + RTCDeviceTypeIPad2Wifi, + RTCDeviceTypeIPad2GSM, + RTCDeviceTypeIPad2CDMA, + RTCDeviceTypeIPad2Wifi2, + RTCDeviceTypeIPadMiniWifi, + RTCDeviceTypeIPadMiniGSM, + RTCDeviceTypeIPadMiniGSM_CDMA, + RTCDeviceTypeIPad3Wifi, + RTCDeviceTypeIPad3GSM_CDMA, + RTCDeviceTypeIPad3GSM, + RTCDeviceTypeIPad4Wifi, + RTCDeviceTypeIPad4GSM, + RTCDeviceTypeIPad4GSM_CDMA, + RTCDeviceTypeIPad5, + RTCDeviceTypeIPad6, + RTCDeviceTypeIPadAirWifi, + RTCDeviceTypeIPadAirCellular, + RTCDeviceTypeIPadAirWifiCellular, + RTCDeviceTypeIPadAir2, + RTCDeviceTypeIPadMini2GWifi, + RTCDeviceTypeIPadMini2GCellular, + RTCDeviceTypeIPadMini2GWifiCellular, + RTCDeviceTypeIPadMini3, + RTCDeviceTypeIPadMini4, + RTCDeviceTypeIPadPro9Inch, + RTCDeviceTypeIPadPro12Inch, + RTCDeviceTypeIPadPro12Inch2, + RTCDeviceTypeIPadPro10Inch, + RTCDeviceTypeSimulatori386, + RTCDeviceTypeSimulatorx86_64, +}; + +@interface UIDevice (RTCDevice) + ++ (RTCDeviceType)deviceType; ++ (BOOL)isIOS11OrLater; + +@end diff --git a/sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm b/sdk/objc/helpers/UIDevice+RTCDevice.mm similarity index 99% rename from sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm rename to sdk/objc/helpers/UIDevice+RTCDevice.mm index 997666d503..96adb9af78 100644 --- a/sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm +++ b/sdk/objc/helpers/UIDevice+RTCDevice.mm @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/UIDevice+RTCDevice.h" +#import "UIDevice+RTCDevice.h" -#include #import +#include @implementation UIDevice (RTCDevice) diff --git a/sdk/objc/Framework/Classes/Common/noop.mm b/sdk/objc/helpers/noop.mm similarity index 100% rename from sdk/objc/Framework/Classes/Common/noop.mm rename to sdk/objc/helpers/noop.mm diff --git a/sdk/objc/helpers/scoped_cftyperef.h b/sdk/objc/helpers/scoped_cftyperef.h new file mode 100644 index 0000000000..092f02b3af --- /dev/null +++ b/sdk/objc/helpers/scoped_cftyperef.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017 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. + * + */ + +#ifndef SDK_OBJC_HELPERS_SCOPED_CFTYPEREF_H_ +#define SDK_OBJC_HELPERS_SCOPED_CFTYPEREF_H_ + +#include +namespace rtc { + +// RETAIN: ScopedTypeRef should retain the object when it takes +// ownership. +// ASSUME: Assume the object already has already been retained. +// ScopedTypeRef takes over ownership. +enum class RetainPolicy { RETAIN, ASSUME }; + +namespace internal { +template +struct CFTypeRefTraits { + static T InvalidValue() { return nullptr; } + static void Release(T ref) { CFRelease(ref); } + static T Retain(T ref) { + CFRetain(ref); + return ref; + } +}; + +template +class ScopedTypeRef { + public: + ScopedTypeRef() : ptr_(Traits::InvalidValue()) {} + explicit ScopedTypeRef(T ptr) : ptr_(ptr) {} + ScopedTypeRef(T ptr, RetainPolicy policy) : ScopedTypeRef(ptr) { + if (ptr_ && policy == RetainPolicy::RETAIN) + Traits::Retain(ptr_); + } + + ScopedTypeRef(const ScopedTypeRef& rhs) : ptr_(rhs.ptr_) { + if (ptr_) + ptr_ = Traits::Retain(ptr_); + } + + ~ScopedTypeRef() { + if (ptr_) { + Traits::Release(ptr_); + } + } + + T get() const { return ptr_; } + T operator->() const { return ptr_; } + explicit operator bool() const { return ptr_; } + + bool operator!() const { return !ptr_; } + + ScopedTypeRef& operator=(const T& rhs) { + if (ptr_) + Traits::Release(ptr_); + ptr_ = rhs; + return *this; + } + + ScopedTypeRef& operator=(const ScopedTypeRef& rhs) { + reset(rhs.get(), RetainPolicy::RETAIN); + return *this; + } + + // This is intended to take ownership of objects that are + // created by pass-by-pointer initializers. + T* InitializeInto() { + RTC_DCHECK(!ptr_); + return &ptr_; + } + + void reset(T ptr, RetainPolicy policy = RetainPolicy::ASSUME) { + if (ptr && policy == RetainPolicy::RETAIN) + Traits::Retain(ptr); + if (ptr_) + Traits::Release(ptr_); + ptr_ = ptr; + } + + T release() { + T temp = ptr_; + ptr_ = Traits::InvalidValue(); + return temp; + } + + private: + T ptr_; +}; +} // namespace internal + +template +using ScopedCFTypeRef = + internal::ScopedTypeRef>; + +template +static ScopedCFTypeRef AdoptCF(T cftype) { + return ScopedCFTypeRef(cftype, RetainPolicy::RETAIN); +} + +template +static ScopedCFTypeRef ScopedCF(T cftype) { + return ScopedCFTypeRef(cftype); +} + +} // namespace rtc + +#endif // SDK_OBJC_HELPERS_SCOPED_CFTYPEREF_H_ diff --git a/sdk/objc/native/api/audio_device_module.h b/sdk/objc/native/api/audio_device_module.h new file mode 100644 index 0000000000..08e48ff392 --- /dev/null +++ b/sdk/objc/native/api/audio_device_module.h @@ -0,0 +1,24 @@ +/* + * Copyright 2018 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. + */ + +#ifndef SDK_OBJC_NATIVE_API_AUDIO_DEVICE_MODULE_H_ +#define SDK_OBJC_NATIVE_API_AUDIO_DEVICE_MODULE_H_ + +#include + +#include "modules/audio_device/include/audio_device.h" + +namespace webrtc { + +rtc::scoped_refptr CreateAudioDeviceModule(); + +} // namespace webrtc + +#endif // SDK_OBJC_NATIVE_API_AUDIO_DEVICE_MODULE_H_ diff --git a/sdk/objc/Framework/Native/api/audio_device_module.mm b/sdk/objc/native/api/audio_device_module.mm similarity index 92% rename from sdk/objc/Framework/Native/api/audio_device_module.mm rename to sdk/objc/native/api/audio_device_module.mm index 2afa6dfc21..893aaecb4b 100644 --- a/sdk/objc/Framework/Native/api/audio_device_module.mm +++ b/sdk/objc/native/api/audio_device_module.mm @@ -13,7 +13,7 @@ #include "rtc_base/logging.h" #include "rtc_base/refcountedobject.h" -#include "sdk/objc/Framework/Native/src/audio/audio_device_module_ios.h" +#include "sdk/objc/native/src/audio/audio_device_module_ios.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/api/video_capturer.h b/sdk/objc/native/api/video_capturer.h similarity index 77% rename from sdk/objc/Framework/Native/api/video_capturer.h rename to sdk/objc/native/api/video_capturer.h index f601f1840d..5b6f3f939b 100644 --- a/sdk/objc/Framework/Native/api/video_capturer.h +++ b/sdk/objc/native/api/video_capturer.h @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_CAPTURER_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_CAPTURER_H_ +#ifndef SDK_OBJC_NATIVE_API_VIDEO_CAPTURER_H_ +#define SDK_OBJC_NATIVE_API_VIDEO_CAPTURER_H_ -#import "WebRTC/RTCVideoCapturer.h" +#import "base/RTCVideoCapturer.h" #include "api/mediastreaminterface.h" #include "rtc_base/scoped_ref_ptr.h" @@ -25,4 +25,4 @@ rtc::scoped_refptr ObjCToNativeVideoCapturer( } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_CAPTURER_H_ +#endif // SDK_OBJC_NATIVE_API_VIDEO_CAPTURER_H_ diff --git a/sdk/objc/Framework/Native/api/video_capturer.mm b/sdk/objc/native/api/video_capturer.mm similarity index 90% rename from sdk/objc/Framework/Native/api/video_capturer.mm rename to sdk/objc/native/api/video_capturer.mm index 4868c2e21b..3bad9985a1 100644 --- a/sdk/objc/Framework/Native/api/video_capturer.mm +++ b/sdk/objc/native/api/video_capturer.mm @@ -8,11 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/api/video_capturer.h" +#include "sdk/objc/native/api/video_capturer.h" #include "absl/memory/memory.h" #include "api/videosourceproxy.h" -#include "sdk/objc/Framework/Native/src/objc_video_track_source.h" +#include "sdk/objc/native/src/objc_video_track_source.h" namespace webrtc { diff --git a/sdk/objc/native/api/video_decoder_factory.h b/sdk/objc/native/api/video_decoder_factory.h new file mode 100644 index 0000000000..710bb6eba5 --- /dev/null +++ b/sdk/objc/native/api/video_decoder_factory.h @@ -0,0 +1,27 @@ +/* + * Copyright 2018 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. + */ + +#ifndef SDK_OBJC_NATIVE_API_VIDEO_DECODER_FACTORY_H_ +#define SDK_OBJC_NATIVE_API_VIDEO_DECODER_FACTORY_H_ + +#include + +#import "base/RTCVideoDecoderFactory.h" + +#include "api/video_codecs/video_decoder_factory.h" + +namespace webrtc { + +std::unique_ptr ObjCToNativeVideoDecoderFactory( + id objc_video_decoder_factory); + +} // namespace webrtc + +#endif // SDK_OBJC_NATIVE_API_VIDEO_DECODER_FACTORY_H_ diff --git a/sdk/objc/Framework/Native/api/video_decoder_factory.mm b/sdk/objc/native/api/video_decoder_factory.mm similarity index 83% rename from sdk/objc/Framework/Native/api/video_decoder_factory.mm rename to sdk/objc/native/api/video_decoder_factory.mm index 32d286a78a..a4f9a20ebc 100644 --- a/sdk/objc/Framework/Native/api/video_decoder_factory.mm +++ b/sdk/objc/native/api/video_decoder_factory.mm @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/api/video_decoder_factory.h" +#include "sdk/objc/native/api/video_decoder_factory.h" #include "absl/memory/memory.h" -#include "sdk/objc/Framework/Native/src/objc_video_decoder_factory.h" +#include "sdk/objc/native/src/objc_video_decoder_factory.h" namespace webrtc { diff --git a/sdk/objc/native/api/video_encoder_factory.h b/sdk/objc/native/api/video_encoder_factory.h new file mode 100644 index 0000000000..8dab48c48d --- /dev/null +++ b/sdk/objc/native/api/video_encoder_factory.h @@ -0,0 +1,27 @@ +/* + * Copyright 2018 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. + */ + +#ifndef SDK_OBJC_NATIVE_API_VIDEO_ENCODER_FACTORY_H_ +#define SDK_OBJC_NATIVE_API_VIDEO_ENCODER_FACTORY_H_ + +#include + +#import "base/RTCVideoEncoderFactory.h" + +#include "api/video_codecs/video_encoder_factory.h" + +namespace webrtc { + +std::unique_ptr ObjCToNativeVideoEncoderFactory( + id objc_video_encoder_factory); + +} // namespace webrtc + +#endif // SDK_OBJC_NATIVE_API_VIDEO_ENCODER_FACTORY_H_ diff --git a/sdk/objc/Framework/Native/api/video_encoder_factory.mm b/sdk/objc/native/api/video_encoder_factory.mm similarity index 83% rename from sdk/objc/Framework/Native/api/video_encoder_factory.mm rename to sdk/objc/native/api/video_encoder_factory.mm index f94c41a562..0f4a57ce1c 100644 --- a/sdk/objc/Framework/Native/api/video_encoder_factory.mm +++ b/sdk/objc/native/api/video_encoder_factory.mm @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/api/video_encoder_factory.h" +#include "sdk/objc/native/api/video_encoder_factory.h" #include "absl/memory/memory.h" -#include "sdk/objc/Framework/Native/src/objc_video_encoder_factory.h" +#include "sdk/objc/native/src/objc_video_encoder_factory.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/api/video_frame.h b/sdk/objc/native/api/video_frame.h similarity index 74% rename from sdk/objc/Framework/Native/api/video_frame.h rename to sdk/objc/native/api/video_frame.h index c64d6fc28a..f8dd568b87 100644 --- a/sdk/objc/Framework/Native/api/video_frame.h +++ b/sdk/objc/native/api/video_frame.h @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_H_ +#ifndef SDK_OBJC_NATIVE_API_VIDEO_FRAME_H_ +#define SDK_OBJC_NATIVE_API_VIDEO_FRAME_H_ -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCVideoFrame.h" #include "api/video/video_frame.h" @@ -21,4 +21,4 @@ RTCVideoFrame* NativeToObjCVideoFrame(const VideoFrame& frame); } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_FRAME_H_ +#endif // SDK_OBJC_NATIVE_API_VIDEO_FRAME_H_ diff --git a/sdk/objc/Framework/Native/api/video_frame.mm b/sdk/objc/native/api/video_frame.mm similarity index 82% rename from sdk/objc/Framework/Native/api/video_frame.mm rename to sdk/objc/native/api/video_frame.mm index 7fe9124bee..02dd830dce 100644 --- a/sdk/objc/Framework/Native/api/video_frame.mm +++ b/sdk/objc/native/api/video_frame.mm @@ -8,9 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/api/video_frame.h" +#include "sdk/objc/native/api/video_frame.h" -#include "sdk/objc/Framework/Native/src/objc_video_frame.h" +#include "sdk/objc/native/src/objc_video_frame.h" namespace webrtc { diff --git a/sdk/objc/native/api/video_frame_buffer.h b/sdk/objc/native/api/video_frame_buffer.h new file mode 100644 index 0000000000..232e00ab6d --- /dev/null +++ b/sdk/objc/native/api/video_frame_buffer.h @@ -0,0 +1,29 @@ +/* + * Copyright 2018 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. + */ + +#ifndef SDK_OBJC_NATIVE_API_VIDEO_FRAME_BUFFER_H_ +#define SDK_OBJC_NATIVE_API_VIDEO_FRAME_BUFFER_H_ + +#import "base/RTCVideoFrameBuffer.h" + +#include "common_video/include/video_frame_buffer.h" +#include "rtc_base/scoped_ref_ptr.h" + +namespace webrtc { + +rtc::scoped_refptr ObjCToNativeVideoFrameBuffer( + id objc_video_frame_buffer); + +id NativeToObjCVideoFrameBuffer( + const rtc::scoped_refptr& buffer); + +} // namespace webrtc + +#endif // SDK_OBJC_NATIVE_API_VIDEO_FRAME_BUFFER_H_ diff --git a/sdk/objc/Framework/Native/api/video_frame_buffer.mm b/sdk/objc/native/api/video_frame_buffer.mm similarity index 86% rename from sdk/objc/Framework/Native/api/video_frame_buffer.mm rename to sdk/objc/native/api/video_frame_buffer.mm index 149c22a01e..2abda42871 100644 --- a/sdk/objc/Framework/Native/api/video_frame_buffer.mm +++ b/sdk/objc/native/api/video_frame_buffer.mm @@ -8,9 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/api/video_frame_buffer.h" +#include "sdk/objc/native/api/video_frame_buffer.h" -#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h" +#include "sdk/objc/native/src/objc_frame_buffer.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/api/video_renderer.h b/sdk/objc/native/api/video_renderer.h similarity index 76% rename from sdk/objc/Framework/Native/api/video_renderer.h rename to sdk/objc/native/api/video_renderer.h index ffba02b3be..afa65430cb 100644 --- a/sdk/objc/Framework/Native/api/video_renderer.h +++ b/sdk/objc/native/api/video_renderer.h @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_RENDERER_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_RENDERER_H_ +#ifndef SDK_OBJC_NATIVE_API_VIDEO_RENDERER_H_ +#define SDK_OBJC_NATIVE_API_VIDEO_RENDERER_H_ -#import "WebRTC/RTCVideoRenderer.h" +#import "base/RTCVideoRenderer.h" #include @@ -25,4 +25,4 @@ std::unique_ptr> ObjCToNativeVideoRenderer( } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_NATIVE_API_VIDEO_RENDERER_H_ +#endif // SDK_OBJC_NATIVE_API_VIDEO_RENDERER_H_ diff --git a/sdk/objc/Framework/Native/api/video_renderer.mm b/sdk/objc/native/api/video_renderer.mm similarity index 85% rename from sdk/objc/Framework/Native/api/video_renderer.mm rename to sdk/objc/native/api/video_renderer.mm index 963e474835..ce36c34dd7 100644 --- a/sdk/objc/Framework/Native/api/video_renderer.mm +++ b/sdk/objc/native/api/video_renderer.mm @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/api/video_renderer.h" +#include "sdk/objc/native/api/video_renderer.h" #include "absl/memory/memory.h" -#include "sdk/objc/Framework/Native/src/objc_video_renderer.h" +#include "sdk/objc/native/src/objc_video_renderer.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/src/audio/audio_device_ios.h b/sdk/objc/native/src/audio/audio_device_ios.h similarity index 98% rename from sdk/objc/Framework/Native/src/audio/audio_device_ios.h rename to sdk/objc/native/src/audio/audio_device_ios.h index 23e54b1409..64fcf2c9e0 100644 --- a/sdk/objc/Framework/Native/src/audio/audio_device_ios.h +++ b/sdk/objc/native/src/audio/audio_device_ios.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_ -#define MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_ +#ifndef SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_DEVICE_IOS_H_ +#define SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_DEVICE_IOS_H_ #include @@ -19,7 +19,7 @@ #include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/thread_checker.h" -#include "sdk/objc/Framework/Headers/WebRTC/RTCMacros.h" +#include "sdk/objc/base/RTCMacros.h" #include "voice_processing_audio_unit.h" RTC_FWD_DECL_OBJC_CLASS(RTCNativeAudioSessionDelegateAdapter); @@ -293,4 +293,4 @@ class AudioDeviceIOS : public AudioDeviceGeneric, } // namespace ios_adm } // namespace webrtc -#endif // MODULES_AUDIO_DEVICE_IOS_AUDIO_DEVICE_IOS_H_ +#endif // SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_DEVICE_IOS_H_ diff --git a/sdk/objc/Framework/Native/src/audio/audio_device_ios.mm b/sdk/objc/native/src/audio/audio_device_ios.mm similarity index 99% rename from sdk/objc/Framework/Native/src/audio/audio_device_ios.mm rename to sdk/objc/native/src/audio/audio_device_ios.mm index bb0a352f7d..cd29cf5ba6 100644 --- a/sdk/objc/Framework/Native/src/audio/audio_device_ios.mm +++ b/sdk/objc/native/src/audio/audio_device_ios.mm @@ -16,6 +16,7 @@ #include #include "api/array_view.h" +#include "helpers.h" #include "modules/audio_device/fine_audio_buffer.h" #include "rtc_base/atomicops.h" #include "rtc_base/bind.h" @@ -25,14 +26,13 @@ #include "rtc_base/thread.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/timeutils.h" -#include "sdk/objc/Framework/Classes/Common/helpers.h" #include "system_wrappers/include/metrics.h" -#import "WebRTC/RTCLogging.h" -#import "sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h" -#import "sdk/objc/Framework/Classes/Audio/RTCNativeAudioSessionDelegateAdapter.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSession.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h" +#import "base/RTCLogging.h" +#import "components/audio/RTCAudioSession+Private.h" +#import "components/audio/RTCAudioSession.h" +#import "components/audio/RTCAudioSessionConfiguration.h" +#import "components/audio/RTCNativeAudioSessionDelegateAdapter.h" namespace webrtc { namespace ios_adm { diff --git a/sdk/objc/Framework/Native/src/audio/audio_device_module_ios.h b/sdk/objc/native/src/audio/audio_device_module_ios.h similarity index 96% rename from sdk/objc/Framework/Native/src/audio/audio_device_module_ios.h rename to sdk/objc/native/src/audio/audio_device_module_ios.h index 8e1ace44fd..59730b6862 100644 --- a/sdk/objc/Framework/Native/src/audio/audio_device_module_ios.h +++ b/sdk/objc/native/src/audio/audio_device_module_ios.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_IOS_NATIVE_API_AUDIO_DEVICE_MODULE_AUDIO_DEVICE_IOS_H_ -#define SDK_IOS_NATIVE_API_AUDIO_DEVICE_MODULE_AUDIO_DEVICE_IOS_H_ +#ifndef SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_DEVICE_MODULE_IOS_H_ +#define SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_DEVICE_MODULE_IOS_H_ #include @@ -136,4 +136,4 @@ class AudioDeviceModuleIOS : public AudioDeviceModule { } // namespace ios_adm } // namespace webrtc -#endif // SDK_IOS_NATIVE_API_AUDIO_DEVICE_MODULE_AUDIO_DEVICE_IOS_H_ +#endif // SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_DEVICE_MODULE_IOS_H_ diff --git a/sdk/objc/Framework/Native/src/audio/audio_device_module_ios.mm b/sdk/objc/native/src/audio/audio_device_module_ios.mm similarity index 99% rename from sdk/objc/Framework/Native/src/audio/audio_device_module_ios.mm rename to sdk/objc/native/src/audio/audio_device_module_ios.mm index 3e918a25d4..176b51aa99 100644 --- a/sdk/objc/Framework/Native/src/audio/audio_device_module_ios.mm +++ b/sdk/objc/native/src/audio/audio_device_module_ios.mm @@ -36,7 +36,6 @@ }; \ } - namespace webrtc { namespace ios_adm { @@ -668,6 +667,5 @@ namespace ios_adm { return r; } #endif // WEBRTC_IOS - } } diff --git a/sdk/objc/Framework/Native/src/audio/audio_session_observer.h b/sdk/objc/native/src/audio/audio_session_observer.h similarity index 85% rename from sdk/objc/Framework/Native/src/audio/audio_session_observer.h rename to sdk/objc/native/src/audio/audio_session_observer.h index 13a979bd4e..2f8bd0cde6 100644 --- a/sdk/objc/Framework/Native/src/audio/audio_session_observer.h +++ b/sdk/objc/native/src/audio/audio_session_observer.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef MODULES_AUDIO_DEVICE_IOS_AUDIO_SESSION_OBSERVER_H_ -#define MODULES_AUDIO_DEVICE_IOS_AUDIO_SESSION_OBSERVER_H_ +#ifndef SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_SESSION_OBSERVER_H_ +#define SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_SESSION_OBSERVER_H_ #include "rtc_base/asyncinvoker.h" #include "rtc_base/thread.h" @@ -39,4 +39,4 @@ class AudioSessionObserver { } // namespace webrtc -#endif // MODULES_AUDIO_DEVICE_IOS_AUDIO_SESSION_OBSERVER_H_ +#endif // SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_SESSION_OBSERVER_H_ diff --git a/sdk/objc/Framework/Classes/Common/helpers.h b/sdk/objc/native/src/audio/helpers.h similarity index 93% rename from sdk/objc/Framework/Classes/Common/helpers.h rename to sdk/objc/native/src/audio/helpers.h index 7fd9b34a99..ac86258a5e 100644 --- a/sdk/objc/Framework/Classes/Common/helpers.h +++ b/sdk/objc/native/src/audio/helpers.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_CLASSES_COMMON_HELPERS_H_ -#define SDK_OBJC_FRAMEWORK_CLASSES_COMMON_HELPERS_H_ +#ifndef SDK_OBJC_NATIVE_SRC_AUDIO_HELPERS_H_ +#define SDK_OBJC_NATIVE_SRC_AUDIO_HELPERS_H_ #include @@ -73,4 +73,4 @@ bool GetLowPowerModeEnabled(); } // namespace ios } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_CLASSES_COMMON_HELPERS_H_ +#endif // SDK_OBJC_NATIVE_SRC_AUDIO_HELPERS_H_ diff --git a/sdk/objc/Framework/Classes/Common/helpers.mm b/sdk/objc/native/src/audio/helpers.mm similarity index 98% rename from sdk/objc/Framework/Classes/Common/helpers.mm rename to sdk/objc/native/src/audio/helpers.mm index 657a4a22b6..cd0469656a 100644 --- a/sdk/objc/Framework/Classes/Common/helpers.mm +++ b/sdk/objc/native/src/audio/helpers.mm @@ -8,7 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ - #import #import #if defined(WEBRTC_IOS) @@ -17,9 +16,9 @@ #include +#include "helpers.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" -#include "sdk/objc/Framework/Classes/Common/helpers.h" namespace webrtc { namespace ios { @@ -108,4 +107,3 @@ int GetProcessorCount() { } // namespace ios } // namespace webrtc - diff --git a/sdk/objc/Framework/Native/src/audio/voice_processing_audio_unit.h b/sdk/objc/native/src/audio/voice_processing_audio_unit.h similarity index 96% rename from sdk/objc/Framework/Native/src/audio/voice_processing_audio_unit.h rename to sdk/objc/native/src/audio/voice_processing_audio_unit.h index ae5e1a90d0..7293032f6f 100644 --- a/sdk/objc/Framework/Native/src/audio/voice_processing_audio_unit.h +++ b/sdk/objc/native/src/audio/voice_processing_audio_unit.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_ -#define MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_ +#ifndef SDK_OBJC_NATIVE_SRC_AUDIO_VOICE_PROCESSING_AUDIO_UNIT_H_ +#define SDK_OBJC_NATIVE_SRC_AUDIO_VOICE_PROCESSING_AUDIO_UNIT_H_ #include @@ -136,4 +136,4 @@ class VoiceProcessingAudioUnit { } // namespace ios_adm } // namespace webrtc -#endif // MODULES_AUDIO_DEVICE_IOS_VOICE_PROCESSING_AUDIO_UNIT_H_ +#endif // SDK_OBJC_NATIVE_SRC_AUDIO_VOICE_PROCESSING_AUDIO_UNIT_H_ diff --git a/sdk/objc/Framework/Native/src/audio/voice_processing_audio_unit.mm b/sdk/objc/native/src/audio/voice_processing_audio_unit.mm similarity index 99% rename from sdk/objc/Framework/Native/src/audio/voice_processing_audio_unit.mm rename to sdk/objc/native/src/audio/voice_processing_audio_unit.mm index eddb1397c1..15a09b31e2 100644 --- a/sdk/objc/Framework/Native/src/audio/voice_processing_audio_unit.mm +++ b/sdk/objc/native/src/audio/voice_processing_audio_unit.mm @@ -14,8 +14,8 @@ #include "rtc_base/system/fallthrough.h" #include "system_wrappers/include/metrics.h" -#import "WebRTC/RTCLogging.h" -#import "sdk/objc/Framework/Headers/WebRTC/RTCAudioSessionConfiguration.h" +#import "base/RTCLogging.h" +#import "sdk/objc/components/audio/RTCAudioSessionConfiguration.h" #if !defined(NDEBUG) static void LogStreamDescription(AudioStreamBasicDescription description) { diff --git a/sdk/objc/Framework/Native/src/objc_frame_buffer.h b/sdk/objc/native/src/objc_frame_buffer.h similarity index 86% rename from sdk/objc/Framework/Native/src/objc_frame_buffer.h rename to sdk/objc/native/src/objc_frame_buffer.h index dc9784a17d..f941dad6e4 100644 --- a/sdk/objc/Framework/Native/src/objc_frame_buffer.h +++ b/sdk/objc/native/src/objc_frame_buffer.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ +#ifndef SDK_OBJC_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ +#define SDK_OBJC_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ #import @@ -44,4 +44,4 @@ id ToObjCVideoFrameBuffer( } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ +#endif // SDK_OBJC_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ diff --git a/sdk/objc/Framework/Native/src/objc_frame_buffer.mm b/sdk/objc/native/src/objc_frame_buffer.mm similarity index 93% rename from sdk/objc/Framework/Native/src/objc_frame_buffer.mm rename to sdk/objc/native/src/objc_frame_buffer.mm index b943414046..12198d86b3 100644 --- a/sdk/objc/Framework/Native/src/objc_frame_buffer.mm +++ b/sdk/objc/native/src/objc_frame_buffer.mm @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h" +#include "sdk/objc/native/src/objc_frame_buffer.h" -#import "WebRTC/RTCVideoFrameBuffer.h" -#import "sdk/objc/Framework/Classes/Video/RTCI420Buffer+Private.h" +#import "base/RTCVideoFrameBuffer.h" +#import "sdk/objc/api/video_frame_buffer/RTCI420Buffer+Private.h" namespace webrtc { diff --git a/sdk/objc/native/src/objc_video_decoder_factory.h b/sdk/objc/native/src/objc_video_decoder_factory.h new file mode 100644 index 0000000000..9911bbfe01 --- /dev/null +++ b/sdk/objc/native/src/objc_video_decoder_factory.h @@ -0,0 +1,38 @@ +/* + * Copyright 2017 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. + */ + +#ifndef SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_DECODER_FACTORY_H_ +#define SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_DECODER_FACTORY_H_ + +#include "api/video_codecs/video_decoder_factory.h" +#include "media/base/codec.h" + +@protocol RTCVideoDecoderFactory; + +namespace webrtc { + +class ObjCVideoDecoderFactory : public VideoDecoderFactory { + public: + explicit ObjCVideoDecoderFactory(id); + ~ObjCVideoDecoderFactory() override; + + id wrapped_decoder_factory() const; + + std::vector GetSupportedFormats() const override; + std::unique_ptr CreateVideoDecoder( + const SdpVideoFormat& format) override; + + private: + id decoder_factory_; +}; + +} // namespace webrtc + +#endif // SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_DECODER_FACTORY_H_ diff --git a/sdk/objc/Framework/Native/src/objc_video_decoder_factory.mm b/sdk/objc/native/src/objc_video_decoder_factory.mm similarity index 89% rename from sdk/objc/Framework/Native/src/objc_video_decoder_factory.mm rename to sdk/objc/native/src/objc_video_decoder_factory.mm index 13956cfe19..0af3582338 100644 --- a/sdk/objc/Framework/Native/src/objc_video_decoder_factory.mm +++ b/sdk/objc/native/src/objc_video_decoder_factory.mm @@ -8,16 +8,17 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/src/objc_video_decoder_factory.h" +#include "sdk/objc/native/src/objc_video_decoder_factory.h" -#import "WebRTC/RTCVideoCodec.h" -#import "WebRTC/RTCVideoCodecFactory.h" -#import "WebRTC/RTCVideoCodecH264.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" -#import "sdk/objc/Framework/Classes/Common/NSString+StdString.h" -#import "sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h" -#import "sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoDecoder.h" +#import "base/RTCVideoDecoder.h" +#import "base/RTCVideoDecoderFactory.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_codec/RTCCodecSpecificInfoH264.h" +#import "sdk/objc/api/peerconnection/RTCEncodedImage+Private.h" +#import "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h" +#import "sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h" +#import "sdk/objc/helpers/NSString+StdString.h" #include "api/video_codecs/sdp_video_format.h" #include "api/video_codecs/video_decoder.h" @@ -26,7 +27,7 @@ #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/logging.h" #include "rtc_base/timeutils.h" -#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h" +#include "sdk/objc/native/src/objc_frame_buffer.h" namespace webrtc { diff --git a/sdk/objc/native/src/objc_video_encoder_factory.h b/sdk/objc/native/src/objc_video_encoder_factory.h new file mode 100644 index 0000000000..7bf56bd081 --- /dev/null +++ b/sdk/objc/native/src/objc_video_encoder_factory.h @@ -0,0 +1,40 @@ +/* + * Copyright 2017 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. + */ + +#ifndef SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_ENCODER_FACTORY_H_ +#define SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_ENCODER_FACTORY_H_ + +#import + +#include "api/video_codecs/video_encoder_factory.h" + +@protocol RTCVideoEncoderFactory; + +namespace webrtc { + +class ObjCVideoEncoderFactory : public VideoEncoderFactory { + public: + explicit ObjCVideoEncoderFactory(id); + ~ObjCVideoEncoderFactory() override; + + id wrapped_encoder_factory() const; + + std::vector GetSupportedFormats() const override; + std::unique_ptr CreateVideoEncoder( + const SdpVideoFormat& format) override; + CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override; + + private: + id encoder_factory_; +}; + +} // namespace webrtc + +#endif // SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_ENCODER_FACTORY_H_ diff --git a/sdk/objc/Framework/Native/src/objc_video_encoder_factory.mm b/sdk/objc/native/src/objc_video_encoder_factory.mm similarity index 87% rename from sdk/objc/Framework/Native/src/objc_video_encoder_factory.mm rename to sdk/objc/native/src/objc_video_encoder_factory.mm index 3794da67b9..fda02030bc 100644 --- a/sdk/objc/Framework/Native/src/objc_video_encoder_factory.mm +++ b/sdk/objc/native/src/objc_video_encoder_factory.mm @@ -8,17 +8,21 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/src/objc_video_encoder_factory.h" +#include "sdk/objc/native/src/objc_video_encoder_factory.h" #include -#import "WebRTC/RTCVideoCodec.h" -#import "WebRTC/RTCVideoCodecFactory.h" -#import "WebRTC/RTCVideoCodecH264.h" -#import "sdk/objc/Framework/Classes/Common/NSString+StdString.h" -#import "sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h" -#import "sdk/objc/Framework/Classes/PeerConnection/RTCWrappedNativeVideoEncoder.h" -#import "sdk/objc/Framework/Classes/Video/RTCI420Buffer+Private.h" +#import "base/RTCVideoEncoder.h" +#import "base/RTCVideoEncoderFactory.h" +#import "components/video_codec/RTCCodecSpecificInfoH264+Private.h" +#import "sdk/objc/api/peerconnection/RTCEncodedImage+Private.h" +#import "sdk/objc/api/peerconnection/RTCRtpFragmentationHeader+Private.h" +#import "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h" +#import "sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h" +#import "sdk/objc/api/video_codec/RTCVideoCodecConstants.h" +#import "sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.h" +#import "sdk/objc/api/video_frame_buffer/RTCI420Buffer+Private.h" +#import "sdk/objc/helpers/NSString+StdString.h" #include "api/video/video_frame.h" #include "api/video_codecs/sdp_video_format.h" @@ -27,8 +31,7 @@ #include "modules/video_coding/include/video_codec_interface.h" #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/logging.h" -#include "sdk/objc/Framework/Classes/Common/helpers.h" -#include "sdk/objc/Framework/Native/src/objc_video_frame.h" +#include "sdk/objc/native/src/objc_video_frame.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/src/objc_video_frame.h b/sdk/objc/native/src/objc_video_frame.h similarity index 72% rename from sdk/objc/Framework/Native/src/objc_video_frame.h rename to sdk/objc/native/src/objc_video_frame.h index e3ef3df8af..fd74aca8a1 100644 --- a/sdk/objc/Framework/Native/src/objc_video_frame.h +++ b/sdk/objc/native/src/objc_video_frame.h @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_FRAME_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_FRAME_H_ +#ifndef SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_FRAME_H_ +#define SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_FRAME_H_ -#import "WebRTC/RTCVideoFrame.h" +#import "base/RTCVideoFrame.h" #include "api/video/video_frame.h" @@ -21,4 +21,4 @@ RTCVideoFrame* ToObjCVideoFrame(const VideoFrame& frame); } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_FRAME_H_ +#endif // SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_FRAME_H_ diff --git a/sdk/objc/Framework/Native/src/objc_video_frame.mm b/sdk/objc/native/src/objc_video_frame.mm similarity index 88% rename from sdk/objc/Framework/Native/src/objc_video_frame.mm rename to sdk/objc/native/src/objc_video_frame.mm index f0eee193dc..bf60824bee 100644 --- a/sdk/objc/Framework/Native/src/objc_video_frame.mm +++ b/sdk/objc/native/src/objc_video_frame.mm @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/src/objc_video_frame.h" +#include "sdk/objc/native/src/objc_video_frame.h" #include "rtc_base/timeutils.h" -#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h" +#include "sdk/objc/native/src/objc_frame_buffer.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/src/objc_video_renderer.h b/sdk/objc/native/src/objc_video_renderer.h similarity index 82% rename from sdk/objc/Framework/Native/src/objc_video_renderer.h rename to sdk/objc/native/src/objc_video_renderer.h index 9b7c9b00fd..9396ab6025 100644 --- a/sdk/objc/Framework/Native/src/objc_video_renderer.h +++ b/sdk/objc/native/src/objc_video_renderer.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_RENDERER_H_ -#define SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_RENDERER_H_ +#ifndef SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_RENDERER_H_ +#define SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_RENDERER_H_ #import #import @@ -33,4 +33,4 @@ class ObjCVideoRenderer : public rtc::VideoSinkInterface { } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_NATIVE_SRC_OBJC_VIDEO_RENDERER_H_ +#endif // SDK_OBJC_NATIVE_SRC_OBJC_VIDEO_RENDERER_H_ diff --git a/sdk/objc/Framework/Native/src/objc_video_renderer.mm b/sdk/objc/native/src/objc_video_renderer.mm similarity index 84% rename from sdk/objc/Framework/Native/src/objc_video_renderer.mm rename to sdk/objc/native/src/objc_video_renderer.mm index aa8f023068..486b7e3b00 100644 --- a/sdk/objc/Framework/Native/src/objc_video_renderer.mm +++ b/sdk/objc/native/src/objc_video_renderer.mm @@ -8,12 +8,12 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/src/objc_video_renderer.h" +#include "sdk/objc/native/src/objc_video_renderer.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoRenderer.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoRenderer.h" -#include "sdk/objc/Framework/Native/src/objc_video_frame.h" +#include "sdk/objc/native/src/objc_video_frame.h" namespace webrtc { diff --git a/sdk/objc/Framework/Native/src/objc_video_track_source.h b/sdk/objc/native/src/objc_video_track_source.h similarity index 85% rename from sdk/objc/Framework/Native/src/objc_video_track_source.h rename to sdk/objc/native/src/objc_video_track_source.h index e26b281571..7956014809 100644 --- a/sdk/objc/Framework/Native/src/objc_video_track_source.h +++ b/sdk/objc/native/src/objc_video_track_source.h @@ -8,12 +8,12 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SDK_OBJC_FRAMEWORK_CLASSES_VIDEO_OBJCVIDEOTRACKSOURCE_H_ -#define SDK_OBJC_FRAMEWORK_CLASSES_VIDEO_OBJCVIDEOTRACKSOURCE_H_ +#ifndef SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_ +#define SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_ -#import "WebRTC/RTCVideoCapturer.h" +#import "base/RTCVideoCapturer.h" -#include "WebRTC/RTCMacros.h" +#include "base/RTCMacros.h" #include "media/base/adaptedvideotracksource.h" #include "rtc_base/timestampaligner.h" @@ -56,4 +56,4 @@ class ObjCVideoTrackSource : public rtc::AdaptedVideoTrackSource { } // namespace webrtc -#endif // SDK_OBJC_FRAMEWORK_CLASSES_VIDEO_OBJCVIDEOTRACKSOURCE_H_ +#endif // SDK_OBJC_CLASSES_VIDEO_OBJC_VIDEO_TRACK_SOURCE_H_ diff --git a/sdk/objc/Framework/Native/src/objc_video_track_source.mm b/sdk/objc/native/src/objc_video_track_source.mm similarity index 94% rename from sdk/objc/Framework/Native/src/objc_video_track_source.mm rename to sdk/objc/native/src/objc_video_track_source.mm index abb03781bf..49736fe11c 100644 --- a/sdk/objc/Framework/Native/src/objc_video_track_source.mm +++ b/sdk/objc/native/src/objc_video_track_source.mm @@ -8,13 +8,14 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Native/src/objc_video_track_source.h" +#include "sdk/objc/native/src/objc_video_track_source.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" #include "api/video/i420_buffer.h" -#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h" +#include "sdk/objc/native/src/objc_frame_buffer.h" @interface RTCObjCVideoSourceAdapter () @property(nonatomic) webrtc::ObjCVideoTrackSource *objCVideoTrackSource; diff --git a/sdk/objc/Framework/UnitTests/ObjCVideoTrackSource_xctest.mm b/sdk/objc/unittests/ObjCVideoTrackSource_xctest.mm similarity index 98% rename from sdk/objc/Framework/UnitTests/ObjCVideoTrackSource_xctest.mm rename to sdk/objc/unittests/ObjCVideoTrackSource_xctest.mm index a32ccce314..cb187e2ed5 100644 --- a/sdk/objc/Framework/UnitTests/ObjCVideoTrackSource_xctest.mm +++ b/sdk/objc/unittests/ObjCVideoTrackSource_xctest.mm @@ -11,17 +11,19 @@ #import #import -#include "sdk/objc/Framework/Native/src/objc_video_track_source.h" +#include "sdk/objc/native/src/objc_video_track_source.h" + +#import "api/video_frame_buffer/RTCI420Buffer+Private.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" +#import "frame_buffer_helpers.h" -#import "Video/RTCI420Buffer+Private.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" #include "common_video/libyuv/include/webrtc_libyuv.h" #include "media/base/fakevideorenderer.h" #include "rtc_base/refcountedobject.h" #include "rtc_base/scoped_ref_ptr.h" -#include "sdk/objc/Framework/Native/api/video_frame.h" -#import "sdk/objc/Framework/UnitTests/frame_buffer_helpers.h" +#include "sdk/objc/native/api/video_frame.h" typedef void (^VideoSinkCallback)(RTCVideoFrame *); diff --git a/sdk/objc/Framework/UnitTests/RTCAudioDeviceModule_xctest.mm b/sdk/objc/unittests/RTCAudioDeviceModule_xctest.mm similarity index 99% rename from sdk/objc/Framework/UnitTests/RTCAudioDeviceModule_xctest.mm rename to sdk/objc/unittests/RTCAudioDeviceModule_xctest.mm index 739ec6af8c..2d13a9454a 100644 --- a/sdk/objc/Framework/UnitTests/RTCAudioDeviceModule_xctest.mm +++ b/sdk/objc/unittests/RTCAudioDeviceModule_xctest.mm @@ -11,7 +11,7 @@ #import #if defined(WEBRTC_IOS) -#import "sdk/objc/Framework/Native/api/audio_device_module.h" +#import "sdk/objc/native/api/audio_device_module.h" #endif #include "system_wrappers/include/event_wrapper.h" diff --git a/sdk/objc/Framework/UnitTests/RTCAudioDevice_xctest.mm b/sdk/objc/unittests/RTCAudioDevice_xctest.mm similarity index 95% rename from sdk/objc/Framework/UnitTests/RTCAudioDevice_xctest.mm rename to sdk/objc/unittests/RTCAudioDevice_xctest.mm index fa99d9038d..7c6f9a7901 100644 --- a/sdk/objc/Framework/UnitTests/RTCAudioDevice_xctest.mm +++ b/sdk/objc/unittests/RTCAudioDevice_xctest.mm @@ -9,9 +9,9 @@ */ #import -#import "sdk/objc/Framework/Native/src/audio/audio_device_ios.h" -#import "sdk/objc/Framework/Native/api/audio_device_module.h" -#import "sdk/objc/Framework/Classes/Audio/RTCAudioSession+Private.h" +#import "sdk/objc/components/audio/RTCAudioSession+Private.h" +#import "sdk/objc/native/api/audio_device_module.h" +#import "sdk/objc/native/src/audio/audio_device_ios.h" @interface RTCAudioDeviceTests: XCTestCase { rtc::scoped_refptr _audioDeviceModule; diff --git a/sdk/objc/Framework/UnitTests/RTCAudioSessionTest.mm b/sdk/objc/unittests/RTCAudioSessionTest.mm similarity index 98% rename from sdk/objc/Framework/UnitTests/RTCAudioSessionTest.mm rename to sdk/objc/unittests/RTCAudioSessionTest.mm index ee52242ecf..6bb46ae7c7 100644 --- a/sdk/objc/Framework/UnitTests/RTCAudioSessionTest.mm +++ b/sdk/objc/unittests/RTCAudioSessionTest.mm @@ -13,10 +13,10 @@ #include "rtc_base/gunit.h" -#import "RTCAudioSession+Private.h" +#import "components/audio/RTCAudioSession+Private.h" -#import "WebRTC/RTCAudioSession.h" -#import "WebRTC/RTCAudioSessionConfiguration.h" +#import "components/audio/RTCAudioSession.h" +#import "components/audio/RTCAudioSessionConfiguration.h" @interface RTCAudioSession (UnitTesting) diff --git a/sdk/objc/Framework/UnitTests/RTCCVPixelBuffer_xctest.mm b/sdk/objc/unittests/RTCCVPixelBuffer_xctest.mm similarity index 98% rename from sdk/objc/Framework/UnitTests/RTCCVPixelBuffer_xctest.mm rename to sdk/objc/unittests/RTCCVPixelBuffer_xctest.mm index 834bb222b9..135b94468b 100644 --- a/sdk/objc/Framework/UnitTests/RTCCVPixelBuffer_xctest.mm +++ b/sdk/objc/unittests/RTCCVPixelBuffer_xctest.mm @@ -11,11 +11,14 @@ #import #import -#import "Video/RTCI420Buffer+Private.h" -#import "WebRTC/RTCVideoFrame.h" -#import "WebRTC/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" + +#import "api/video_frame_buffer/RTCI420Buffer+Private.h" +#import "base/RTCVideoFrame.h" +#import "base/RTCVideoFrameBuffer.h" +#import "frame_buffer_helpers.h" + #include "common_video/libyuv/include/webrtc_libyuv.h" -#import "sdk/objc/Framework/UnitTests/frame_buffer_helpers.h" #include "third_party/libyuv/include/libyuv.h" @interface RTCCVPixelBufferTests : XCTestCase diff --git a/sdk/objc/Framework/UnitTests/RTCCallbackLogger_xctest.m b/sdk/objc/unittests/RTCCallbackLogger_xctest.m similarity index 98% rename from sdk/objc/Framework/UnitTests/RTCCallbackLogger_xctest.m rename to sdk/objc/unittests/RTCCallbackLogger_xctest.m index 4cc9f15745..4a0a2b3e6d 100644 --- a/sdk/objc/Framework/UnitTests/RTCCallbackLogger_xctest.m +++ b/sdk/objc/unittests/RTCCallbackLogger_xctest.m @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCCallbackLogger.h" +#import "api/logging/RTCCallbackLogger.h" #import diff --git a/sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm b/sdk/objc/unittests/RTCCameraVideoCapturerTests.mm similarity index 99% rename from sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm rename to sdk/objc/unittests/RTCCameraVideoCapturerTests.mm index 0af17c4414..bd74fc7d6a 100644 --- a/sdk/objc/Framework/UnitTests/RTCCameraVideoCapturerTests.mm +++ b/sdk/objc/unittests/RTCCameraVideoCapturerTests.mm @@ -16,10 +16,10 @@ #include "rtc_base/gunit.h" -#import -#import -#import -#import "AVCaptureSession+DevicePosition.h" +#import "base/RTCVideoFrame.h" +#import "components/capturer/RTCCameraVideoCapturer.h" +#import "helpers/AVCaptureSession+DevicePosition.h" +#import "helpers/RTCDispatcher.h" #if TARGET_OS_IPHONE // Helper method. diff --git a/sdk/objc/Framework/UnitTests/RTCCertificateTest.mm b/sdk/objc/unittests/RTCCertificateTest.mm similarity index 88% rename from sdk/objc/Framework/UnitTests/RTCCertificateTest.mm rename to sdk/objc/unittests/RTCCertificateTest.mm index 64269f7b8c..2585a27811 100644 --- a/sdk/objc/Framework/UnitTests/RTCCertificateTest.mm +++ b/sdk/objc/unittests/RTCCertificateTest.mm @@ -14,13 +14,13 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCConfiguration+Private.h" -#import "WebRTC/RTCConfiguration.h" -#import "WebRTC/RTCIceServer.h" -#import "WebRTC/RTCMediaConstraints.h" -#import "WebRTC/RTCPeerConnection.h" -#import "WebRTC/RTCPeerConnectionFactory.h" +#import "api/peerconnection/RTCConfiguration+Private.h" +#import "api/peerconnection/RTCConfiguration.h" +#import "api/peerconnection/RTCIceServer.h" +#import "api/peerconnection/RTCMediaConstraints.h" +#import "api/peerconnection/RTCPeerConnection.h" +#import "api/peerconnection/RTCPeerConnectionFactory.h" +#import "helpers/NSString+StdString.h" @interface RTCCertificateTest : NSObject - (void)testCertificateIsUsedInConfig; diff --git a/sdk/objc/Framework/UnitTests/RTCConfigurationTest.mm b/sdk/objc/unittests/RTCConfigurationTest.mm similarity index 96% rename from sdk/objc/Framework/UnitTests/RTCConfigurationTest.mm rename to sdk/objc/unittests/RTCConfigurationTest.mm index 90de644c09..1ef718ad49 100644 --- a/sdk/objc/Framework/UnitTests/RTCConfigurationTest.mm +++ b/sdk/objc/unittests/RTCConfigurationTest.mm @@ -14,11 +14,11 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCConfiguration+Private.h" -#import "WebRTC/RTCConfiguration.h" -#import "WebRTC/RTCIceServer.h" -#import "WebRTC/RTCIntervalRange.h" +#import "api/peerconnection/RTCConfiguration+Private.h" +#import "api/peerconnection/RTCConfiguration.h" +#import "api/peerconnection/RTCIceServer.h" +#import "api/peerconnection/RTCIntervalRange.h" +#import "helpers/NSString+StdString.h" @interface RTCConfigurationTest : NSObject - (void)testConversionToNativeConfiguration; @@ -141,4 +141,3 @@ TEST(RTCConfigurationTest, NativeConfigurationConversionTest) { [test testNativeConversionToConfiguration]; } } - diff --git a/sdk/objc/Framework/UnitTests/RTCDataChannelConfigurationTest.mm b/sdk/objc/unittests/RTCDataChannelConfigurationTest.mm similarity index 91% rename from sdk/objc/Framework/UnitTests/RTCDataChannelConfigurationTest.mm rename to sdk/objc/unittests/RTCDataChannelConfigurationTest.mm index fa9f131fdf..a96ae51707 100644 --- a/sdk/objc/Framework/UnitTests/RTCDataChannelConfigurationTest.mm +++ b/sdk/objc/unittests/RTCDataChannelConfigurationTest.mm @@ -12,9 +12,9 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCDataChannelConfiguration+Private.h" -#import "WebRTC/RTCDataChannelConfiguration.h" +#import "api/peerconnection/RTCDataChannelConfiguration+Private.h" +#import "api/peerconnection/RTCDataChannelConfiguration.h" +#import "helpers/NSString+StdString.h" @interface RTCDataChannelConfigurationTest : NSObject - (void)testConversionToNativeDataChannelInit; diff --git a/sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m b/sdk/objc/unittests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m similarity index 97% rename from sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m rename to sdk/objc/unittests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m index 754810199f..02bef9bfb7 100644 --- a/sdk/objc/Framework/UnitTests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m +++ b/sdk/objc/unittests/RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m @@ -12,7 +12,7 @@ #import -#import +#import @interface RTCDoNotPutCPlusPlusInFrameworkHeaders : XCTestCase @end diff --git a/sdk/objc/Framework/UnitTests/RTCFileVideoCapturer_xctest.mm b/sdk/objc/unittests/RTCFileVideoCapturer_xctest.mm similarity index 98% rename from sdk/objc/Framework/UnitTests/RTCFileVideoCapturer_xctest.mm rename to sdk/objc/unittests/RTCFileVideoCapturer_xctest.mm index f0c173973f..01deb68a32 100644 --- a/sdk/objc/Framework/UnitTests/RTCFileVideoCapturer_xctest.mm +++ b/sdk/objc/unittests/RTCFileVideoCapturer_xctest.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCFileVideoCapturer.h" +#import "components/capturer/RTCFileVideoCapturer.h" #import diff --git a/sdk/objc/Framework/UnitTests/RTCH264ProfileLevelId_xctest.m b/sdk/objc/unittests/RTCH264ProfileLevelId_xctest.m similarity index 96% rename from sdk/objc/Framework/UnitTests/RTCH264ProfileLevelId_xctest.m rename to sdk/objc/unittests/RTCH264ProfileLevelId_xctest.m index 4f0c7c7a27..066958692f 100644 --- a/sdk/objc/Framework/UnitTests/RTCH264ProfileLevelId_xctest.m +++ b/sdk/objc/unittests/RTCH264ProfileLevelId_xctest.m @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import "WebRTC/RTCVideoCodecH264.h" +#import "components/video_codec/RTCH264ProfileLevelId.h" #import diff --git a/sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm b/sdk/objc/unittests/RTCIceCandidateTest.mm similarity index 94% rename from sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm rename to sdk/objc/unittests/RTCIceCandidateTest.mm index 0c4c51cb90..18dcdad8b4 100644 --- a/sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm +++ b/sdk/objc/unittests/RTCIceCandidateTest.mm @@ -14,9 +14,9 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCIceCandidate+Private.h" -#import "WebRTC/RTCIceCandidate.h" +#import "api/peerconnection/RTCIceCandidate+Private.h" +#import "api/peerconnection/RTCIceCandidate.h" +#import "helpers/NSString+StdString.h" @interface RTCIceCandidateTest : NSObject - (void)testCandidate; diff --git a/sdk/objc/Framework/UnitTests/RTCIceServerTest.mm b/sdk/objc/unittests/RTCIceServerTest.mm similarity index 98% rename from sdk/objc/Framework/UnitTests/RTCIceServerTest.mm rename to sdk/objc/unittests/RTCIceServerTest.mm index 497aedb39a..8ef5195b95 100644 --- a/sdk/objc/Framework/UnitTests/RTCIceServerTest.mm +++ b/sdk/objc/unittests/RTCIceServerTest.mm @@ -14,9 +14,9 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCIceServer+Private.h" -#import "WebRTC/RTCIceServer.h" +#import "api/peerconnection/RTCIceServer+Private.h" +#import "api/peerconnection/RTCIceServer.h" +#import "helpers/NSString+StdString.h" @interface RTCIceServerTest : NSObject - (void)testOneURLServer; diff --git a/sdk/objc/Framework/UnitTests/RTCIntervalRangeTests.mm b/sdk/objc/unittests/RTCIntervalRangeTests.mm similarity index 93% rename from sdk/objc/Framework/UnitTests/RTCIntervalRangeTests.mm rename to sdk/objc/unittests/RTCIntervalRangeTests.mm index 1c44b2d8dc..9244c5ba29 100644 --- a/sdk/objc/Framework/UnitTests/RTCIntervalRangeTests.mm +++ b/sdk/objc/unittests/RTCIntervalRangeTests.mm @@ -12,8 +12,8 @@ #include "rtc_base/gunit.h" -#import "RTCIntervalRange+Private.h" -#import "WebRTC/RTCIntervalRange.h" +#import "api/peerconnection/RTCIntervalRange+Private.h" +#import "api/peerconnection/RTCIntervalRange.h" @interface RTCIntervalRangeTest : NSObject - (void)testConversionToNativeConfiguration; diff --git a/sdk/objc/Framework/UnitTests/RTCMTLVideoView_xctest.m b/sdk/objc/unittests/RTCMTLVideoView_xctest.m similarity index 97% rename from sdk/objc/Framework/UnitTests/RTCMTLVideoView_xctest.m rename to sdk/objc/unittests/RTCMTLVideoView_xctest.m index 8f157f1d99..1bb2a36bf6 100644 --- a/sdk/objc/Framework/UnitTests/RTCMTLVideoView_xctest.m +++ b/sdk/objc/unittests/RTCMTLVideoView_xctest.m @@ -14,10 +14,12 @@ #import #import -#include -#include +#import "components/renderer/metal/RTCMTLVideoView.h" -#include "Metal/RTCMTLNV12Renderer.h" +#import "api/video_frame_buffer/RTCI420Buffer.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/renderer/metal/RTCMTLNV12Renderer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" // Extension of RTCMTLVideoView for testing purposes. @interface RTCMTLVideoView (Testing) diff --git a/sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm b/sdk/objc/unittests/RTCMediaConstraintsTest.mm similarity index 93% rename from sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm rename to sdk/objc/unittests/RTCMediaConstraintsTest.mm index 5f9026c29d..f50149d7e0 100644 --- a/sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm +++ b/sdk/objc/unittests/RTCMediaConstraintsTest.mm @@ -14,9 +14,9 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCMediaConstraints+Private.h" -#import "WebRTC/RTCMediaConstraints.h" +#import "api/peerconnection/RTCMediaConstraints+Private.h" +#import "api/peerconnection/RTCMediaConstraints.h" +#import "helpers/NSString+StdString.h" @interface RTCMediaConstraintsTest : NSObject - (void)testMediaConstraints; diff --git a/sdk/objc/Framework/UnitTests/RTCPeerConnectionFactoryBuilderTest.mm b/sdk/objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm similarity index 92% rename from sdk/objc/Framework/UnitTests/RTCPeerConnectionFactoryBuilderTest.mm rename to sdk/objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm index b09cc12d2d..9bb5179521 100644 --- a/sdk/objc/Framework/UnitTests/RTCPeerConnectionFactoryBuilderTest.mm +++ b/sdk/objc/unittests/RTCPeerConnectionFactoryBuilderTest.mm @@ -16,9 +16,9 @@ extern "C" { #ifdef __cplusplus } #endif -#import "sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory+Native.h" -#import "sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h" -#import "sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactoryBuilder.h" +#import "api/peerconnection/RTCPeerConnectionFactory+Native.h" +#import "api/peerconnection/RTCPeerConnectionFactoryBuilder+DefaultComponents.h" +#import "api/peerconnection/RTCPeerConnectionFactoryBuilder.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" diff --git a/sdk/objc/Framework/UnitTests/RTCPeerConnectionFactory_xctest.m b/sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m similarity index 94% rename from sdk/objc/Framework/UnitTests/RTCPeerConnectionFactory_xctest.m rename to sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m index 5608c69dbc..477b541276 100644 --- a/sdk/objc/Framework/UnitTests/RTCPeerConnectionFactory_xctest.m +++ b/sdk/objc/unittests/RTCPeerConnectionFactory_xctest.m @@ -8,18 +8,18 @@ * be found in the AUTHORS file in the root of the source tree. */ -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import +#import "api/peerconnection/RTCAudioSource.h" +#import "api/peerconnection/RTCConfiguration.h" +#import "api/peerconnection/RTCDataChannel.h" +#import "api/peerconnection/RTCDataChannelConfiguration.h" +#import "api/peerconnection/RTCMediaConstraints.h" +#import "api/peerconnection/RTCMediaStreamTrack.h" +#import "api/peerconnection/RTCPeerConnection.h" +#import "api/peerconnection/RTCPeerConnectionFactory.h" +#import "api/peerconnection/RTCRtpReceiver.h" +#import "api/peerconnection/RTCRtpSender.h" +#import "api/peerconnection/RTCRtpTransceiver.h" +#import "api/peerconnection/RTCVideoSource.h" #import diff --git a/sdk/objc/Framework/UnitTests/RTCPeerConnectionTest.mm b/sdk/objc/unittests/RTCPeerConnectionTest.mm similarity index 92% rename from sdk/objc/Framework/UnitTests/RTCPeerConnectionTest.mm rename to sdk/objc/unittests/RTCPeerConnectionTest.mm index 63617cbe5a..28fdee6a2b 100644 --- a/sdk/objc/Framework/UnitTests/RTCPeerConnectionTest.mm +++ b/sdk/objc/unittests/RTCPeerConnectionTest.mm @@ -14,13 +14,13 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCConfiguration+Private.h" -#import "WebRTC/RTCConfiguration.h" -#import "WebRTC/RTCPeerConnection.h" -#import "WebRTC/RTCPeerConnectionFactory.h" -#import "WebRTC/RTCIceServer.h" -#import "WebRTC/RTCMediaConstraints.h" +#import "api/peerconnection/RTCConfiguration+Private.h" +#import "api/peerconnection/RTCConfiguration.h" +#import "api/peerconnection/RTCIceServer.h" +#import "api/peerconnection/RTCMediaConstraints.h" +#import "api/peerconnection/RTCPeerConnection.h" +#import "api/peerconnection/RTCPeerConnectionFactory.h" +#import "helpers/NSString+StdString.h" @interface RTCPeerConnectionTest : NSObject - (void)testConfigurationGetter; @@ -99,5 +99,3 @@ TEST(RTCPeerConnectionTest, ConfigurationGetterTest) { [test testConfigurationGetter]; } } - - diff --git a/sdk/objc/Framework/UnitTests/RTCSessionDescriptionTest.mm b/sdk/objc/unittests/RTCSessionDescriptionTest.mm similarity index 97% rename from sdk/objc/Framework/UnitTests/RTCSessionDescriptionTest.mm rename to sdk/objc/unittests/RTCSessionDescriptionTest.mm index 442815385e..8a04a42589 100644 --- a/sdk/objc/Framework/UnitTests/RTCSessionDescriptionTest.mm +++ b/sdk/objc/unittests/RTCSessionDescriptionTest.mm @@ -12,9 +12,9 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "RTCSessionDescription+Private.h" -#import "WebRTC/RTCSessionDescription.h" +#import "api/peerconnection/RTCSessionDescription+Private.h" +#import "api/peerconnection/RTCSessionDescription.h" +#import "helpers/NSString+StdString.h" @interface RTCSessionDescriptionTest : NSObject - (void)testSessionDescriptionConversion; diff --git a/sdk/objc/Framework/UnitTests/RTCTracingTest.mm b/sdk/objc/unittests/RTCTracingTest.mm similarity index 94% rename from sdk/objc/Framework/UnitTests/RTCTracingTest.mm rename to sdk/objc/unittests/RTCTracingTest.mm index e21ba99a96..d39e019108 100644 --- a/sdk/objc/Framework/UnitTests/RTCTracingTest.mm +++ b/sdk/objc/unittests/RTCTracingTest.mm @@ -14,8 +14,8 @@ #include "rtc_base/gunit.h" -#import "NSString+StdString.h" -#import "WebRTC/RTCTracing.h" +#import "api/peerconnection/RTCTracing.h" +#import "helpers/NSString+StdString.h" @interface RTCTracingTest : NSObject - (void)tracingTestNoInitialization; @@ -40,11 +40,9 @@ @end - TEST(RTCTracingTest, TracingTestNoInitialization) { @autoreleasepool { RTCTracingTest *test = [[RTCTracingTest alloc] init]; [test tracingTestNoInitialization]; } } - diff --git a/sdk/objc/Framework/UnitTests/audio_short16.pcm b/sdk/objc/unittests/audio_short16.pcm similarity index 100% rename from sdk/objc/Framework/UnitTests/audio_short16.pcm rename to sdk/objc/unittests/audio_short16.pcm diff --git a/sdk/objc/Framework/UnitTests/audio_short44.pcm b/sdk/objc/unittests/audio_short44.pcm similarity index 100% rename from sdk/objc/Framework/UnitTests/audio_short44.pcm rename to sdk/objc/unittests/audio_short44.pcm diff --git a/sdk/objc/Framework/UnitTests/audio_short48.pcm b/sdk/objc/unittests/audio_short48.pcm similarity index 100% rename from sdk/objc/Framework/UnitTests/audio_short48.pcm rename to sdk/objc/unittests/audio_short48.pcm diff --git a/sdk/objc/Framework/UnitTests/avformatmappertests.mm b/sdk/objc/unittests/avformatmappertests.mm similarity index 99% rename from sdk/objc/Framework/UnitTests/avformatmappertests.mm rename to sdk/objc/unittests/avformatmappertests.mm index ba1935b294..35e95a8c22 100644 --- a/sdk/objc/Framework/UnitTests/avformatmappertests.mm +++ b/sdk/objc/unittests/avformatmappertests.mm @@ -13,9 +13,6 @@ #include "rtc_base/gunit.h" -#include "Video/avfoundationformatmapper.h" - - // Width and height don't play any role so lets use predefined values throughout // the tests. static const int kFormatWidth = 789; diff --git a/sdk/objc/Framework/UnitTests/foreman.mp4 b/sdk/objc/unittests/foreman.mp4 similarity index 100% rename from sdk/objc/Framework/UnitTests/foreman.mp4 rename to sdk/objc/unittests/foreman.mp4 diff --git a/sdk/objc/Framework/UnitTests/frame_buffer_helpers.h b/sdk/objc/unittests/frame_buffer_helpers.h similarity index 100% rename from sdk/objc/Framework/UnitTests/frame_buffer_helpers.h rename to sdk/objc/unittests/frame_buffer_helpers.h diff --git a/sdk/objc/Framework/UnitTests/frame_buffer_helpers.mm b/sdk/objc/unittests/frame_buffer_helpers.mm similarity index 98% rename from sdk/objc/Framework/UnitTests/frame_buffer_helpers.mm rename to sdk/objc/unittests/frame_buffer_helpers.mm index c6a7550fac..98b86c54c0 100644 --- a/sdk/objc/Framework/UnitTests/frame_buffer_helpers.mm +++ b/sdk/objc/unittests/frame_buffer_helpers.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/UnitTests/frame_buffer_helpers.h" +#include "sdk/objc/unittests/frame_buffer_helpers.h" #include "third_party/libyuv/include/libyuv.h" diff --git a/sdk/objc/Framework/UnitTests/main.m b/sdk/objc/unittests/main.m similarity index 100% rename from sdk/objc/Framework/UnitTests/main.m rename to sdk/objc/unittests/main.m diff --git a/sdk/objc/Framework/UnitTests/objc_video_decoder_factory_tests.mm b/sdk/objc/unittests/objc_video_decoder_factory_tests.mm similarity index 96% rename from sdk/objc/Framework/UnitTests/objc_video_decoder_factory_tests.mm rename to sdk/objc/unittests/objc_video_decoder_factory_tests.mm index a8ea43cdf0..9d2d4848c0 100644 --- a/sdk/objc/Framework/UnitTests/objc_video_decoder_factory_tests.mm +++ b/sdk/objc/unittests/objc_video_decoder_factory_tests.mm @@ -11,10 +11,10 @@ #import #import -#include "sdk/objc/Framework/Native/src/objc_video_decoder_factory.h" +#include "sdk/objc/native/src/objc_video_decoder_factory.h" -#import "WebRTC/RTCVideoCodec.h" -#import "WebRTC/RTCVideoCodecFactory.h" +#import "base/RTCVideoDecoder.h" +#import "base/RTCVideoDecoderFactory.h" #include "media/base/codec.h" #include "modules/include/module_common_types.h" #include "modules/video_coding/include/video_codec_interface.h" diff --git a/sdk/objc/Framework/UnitTests/objc_video_encoder_factory_tests.mm b/sdk/objc/unittests/objc_video_encoder_factory_tests.mm similarity index 95% rename from sdk/objc/Framework/UnitTests/objc_video_encoder_factory_tests.mm rename to sdk/objc/unittests/objc_video_encoder_factory_tests.mm index 9377751d05..d009d51bba 100644 --- a/sdk/objc/Framework/UnitTests/objc_video_encoder_factory_tests.mm +++ b/sdk/objc/unittests/objc_video_encoder_factory_tests.mm @@ -11,17 +11,19 @@ #import #import -#include "sdk/objc/Framework/Native/src/objc_video_encoder_factory.h" +#include "sdk/objc/native/src/objc_video_encoder_factory.h" + +#import "base/RTCVideoEncoder.h" +#import "base/RTCVideoEncoderFactory.h" +#import "base/RTCVideoFrameBuffer.h" +#import "components/video_frame_buffer/RTCCVPixelBuffer.h" -#import "WebRTC/RTCVideoCodec.h" -#import "WebRTC/RTCVideoCodecFactory.h" -#import "WebRTC/RTCVideoFrameBuffer.h" #include "api/video_codecs/sdp_video_format.h" #include "modules/include/module_common_types.h" #include "modules/video_coding/include/video_codec_interface.h" #include "modules/video_coding/include/video_error_codes.h" #include "rtc_base/gunit.h" -#include "sdk/objc/Framework/Native/src/objc_frame_buffer.h" +#include "sdk/objc/native/src/objc_frame_buffer.h" id CreateEncoderFactoryReturning(int return_code) { id encoderMock = OCMProtocolMock(@protocol(RTCVideoEncoder)); diff --git a/sdk/objc/Framework/UnitTests/scoped_cftyperef_tests.mm b/sdk/objc/unittests/scoped_cftyperef_tests.mm similarity index 97% rename from sdk/objc/Framework/UnitTests/scoped_cftyperef_tests.mm rename to sdk/objc/unittests/scoped_cftyperef_tests.mm index 2832884884..2aa85182a6 100644 --- a/sdk/objc/Framework/UnitTests/scoped_cftyperef_tests.mm +++ b/sdk/objc/unittests/scoped_cftyperef_tests.mm @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/objc/Framework/Classes/Common/scoped_cftyperef.h" +#include "sdk/objc/helpers/scoped_cftyperef.h" #include "test/gtest.h" diff --git a/test/BUILD.gn b/test/BUILD.gn index ada60e2ce3..054af655d6 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -141,7 +141,7 @@ if (is_ios) { ] deps = [ ":perf_test", - "../sdk:common_objc", + "../sdk:helpers_objc", ] } } @@ -192,10 +192,6 @@ rtc_source_set("test_support") { # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] } - - if (is_ios && !build_with_chromium) { - deps += [ "../sdk:common_objc" ] - } } if (rtc_include_tests) { @@ -263,10 +259,6 @@ if (rtc_include_tests) { if (is_android) { deps += [ "//base:base" ] } - - if (is_ios) { - deps += [ "../sdk:common_objc" ] - } } rtc_source_set("test_support_test_artifacts") { @@ -375,7 +367,7 @@ if (is_ios) { "..:webrtc_common", "../rtc_base:checks", "../rtc_base:rtc_base_approved", - "../sdk:common_objc", + "../sdk:helpers_objc", ] } } diff --git a/test/ios/test_support.mm b/test/ios/test_support.mm index 5b7f2f9350..b471d137d0 100644 --- a/test/ios/test_support.mm +++ b/test/ios/test_support.mm @@ -13,8 +13,8 @@ #include "test/ios/test_support.h" #include "test/testsupport/perf_test.h" -#import "sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h" -#include "sdk/objc/Framework/Classes/Common/helpers.h" +#import "sdk/objc/helpers/NSString+StdString.h" +#import "sdk/objc/helpers/RTCUIApplicationStatusObserver.h" // Springboard will kill any iOS app that fails to check in after launch within // a given time. Starting a UIApplication before invoking TestSuite::Run @@ -88,7 +88,7 @@ static bool g_save_chartjson_result; [outputDirectories[0] stringByAppendingPathComponent:fileName]; webrtc::test::WritePerfResults( - webrtc::ios::StdStringFromNSString(outputPath)); + [NSString stdStringForString:outputPath]); } } diff --git a/test/testsupport/iosfileutils.mm b/test/testsupport/iosfileutils.mm index 5e9f71c8b7..887885d2bc 100644 --- a/test/testsupport/iosfileutils.mm +++ b/test/testsupport/iosfileutils.mm @@ -13,34 +13,32 @@ #import #include +#import "sdk/objc/helpers/NSString+StdString.h" + #include "rtc_base/checks.h" -#include "sdk/objc/Framework/Classes/Common/helpers.h" namespace webrtc { namespace test { -using webrtc::ios::NSStringFromStdString; -using webrtc::ios::StdStringFromNSString; - // For iOS, resource files are added to the application bundle in the root // and not in separate folders as is the case for other platforms. This method // therefore removes any prepended folders and uses only the actual file name. std::string IOSResourcePath(std::string name, std::string extension) { @autoreleasepool { - NSString* path = NSStringFromStdString(name); + NSString* path = [NSString stringForStdString:name]; NSString* fileName = path.lastPathComponent; - NSString* fileType = NSStringFromStdString(extension); + NSString* fileType = [NSString stringForStdString:extension]; // Get full pathname for the resource identified by the name and extension. NSString* pathString = [[NSBundle mainBundle] pathForResource:fileName ofType:fileType]; - return StdStringFromNSString(pathString); + return [NSString stdStringForString:pathString]; } } std::string IOSRootPath() { @autoreleasepool { NSBundle* mainBundle = [NSBundle mainBundle]; - return StdStringFromNSString(mainBundle.bundlePath) + "/"; + return [NSString stdStringForString:mainBundle.bundlePath] + "/"; } } @@ -52,7 +50,7 @@ std::string IOSOutputPath() { NSString* tempDir = NSTemporaryDirectory(); if (tempDir == nil) tempDir = @"/tmp"; - return StdStringFromNSString(tempDir); + return [NSString stdStringForString:tempDir]; } } diff --git a/tools_webrtc/ios/generate_umbrella_header.py b/tools_webrtc/ios/generate_umbrella_header.py index d8a87bf72a..3549735eb6 100644 --- a/tools_webrtc/ios/generate_umbrella_header.py +++ b/tools_webrtc/ios/generate_umbrella_header.py @@ -8,7 +8,9 @@ import argparse import datetime +import os import sys +import textwrap def GenerateUmbrellaHeader(): @@ -20,7 +22,8 @@ def GenerateUmbrellaHeader(): args = parser.parse_args() with open(args.out, "w") as outfile: - outfile.write("""/* + outfile.write(textwrap.dedent("""\ + /* * Copyright %d The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license @@ -28,10 +31,10 @@ def GenerateUmbrellaHeader(): * 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. - */\n\n""" % datetime.datetime.now().year) + */\n\n""" % datetime.datetime.now().year)) for s in args.sources: - outfile.write("#import <{}>\n".format(s)) + outfile.write("#import \n".format(os.path.basename(s))) return 0 diff --git a/tools_webrtc/ios/tests/common_tests.json b/tools_webrtc/ios/tests/common_tests.json index de23231bd6..5eeb408387 100644 --- a/tools_webrtc/ios/tests/common_tests.json +++ b/tools_webrtc/ios/tests/common_tests.json @@ -8,6 +8,10 @@ "app": "sdk_unittests", "xctest": true }, + { + "app": "sdk_framework_unittests", + "xctest": true + }, { "app": "audio_decoder_unittests" }, diff --git a/webrtc.gni b/webrtc.gni index 8cd1c1df34..133f86ce05 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -160,6 +160,9 @@ declare_args() { # binary only running on iOS 11+, which is why it is disabled by default. rtc_apprtcmobile_broadcast_extension = false } + + # Determines whether Metal is available on iOS/macOS. + rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64") } if (!build_with_mozilla) { @@ -649,7 +652,7 @@ if (is_ios) { "--out", rebase_path(umbrella_header_path, root_build_dir), "--sources", - ] + rebase_path(public_headers, "objc/Framework/Headers/") + ] + public_headers } copy("copy_umbrella_header_$target_name") {