diff --git a/COPYING b/COPYING deleted file mode 100644 index fba26f457a..0000000000 --- a/COPYING +++ /dev/null @@ -1 +0,0 @@ -Refer to talk/COPYING. \ No newline at end of file diff --git a/LICENSE_THIRD_PARTY b/LICENSE_THIRD_PARTY index dfcf6e45f8..2281c656dd 100644 --- a/LICENSE_THIRD_PARTY +++ b/LICENSE_THIRD_PARTY @@ -1 +1 @@ -Refer to webrtc/LICENSE_THIRD_PARTY and talk/LICENSE_THIRD_PARTY. +Refer to webrtc/LICENSE_THIRD_PARTY. diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 00bcc3e545..f07f49b9c8 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -63,7 +63,6 @@ NATIVE_API_DIRS = ( # These directories should not be used but are maintained only to avoid breaking # some legacy downstream code. LEGACY_API_DIRS = ( - 'talk/app/webrtc', 'webrtc/base', 'webrtc/common_audio/include', 'webrtc/modules/audio_coding/include', @@ -459,6 +458,7 @@ def _CommonChecks(input_api, output_api): ], pylintrc='pylintrc')) + # TODO(nisse): talk/ is no more, so make below checks simpler? # WebRTC can't use the presubmit_canned_checks.PanProjectChecks function since # we need to have different license checks in talk/ and webrtc/ directories. # Instead, hand-picked checks are included below. diff --git a/all.gyp b/all.gyp index da54e724d4..be267fbff5 100644 --- a/all.gyp +++ b/all.gyp @@ -63,18 +63,6 @@ 'webrtc/sdk/sdk.gyp:*', ], }], - ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', { - 'dependencies': [ - 'talk/app/webrtc/legacy_objc_api.gyp:*', - ], - 'conditions': [ - ['include_tests==1', { - 'dependencies': [ - 'talk/app/webrtc/legacy_objc_api_tests.gyp:*', - ], - }], - ], - }], ], }, ], diff --git a/talk/COPYING b/talk/COPYING deleted file mode 100644 index ba0bffa0c5..0000000000 --- a/talk/COPYING +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2013, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. \ No newline at end of file diff --git a/talk/LICENSE_THIRD_PARTY b/talk/LICENSE_THIRD_PARTY deleted file mode 100644 index 5a2760664e..0000000000 --- a/talk/LICENSE_THIRD_PARTY +++ /dev/null @@ -1,27 +0,0 @@ -This source tree contains third party source code which is governed by third -party licenses. This file contains references to files which are under other -licenses than the one provided in the COPYING file in the root of the source -tree. - -Files governed by third party licenses: - -Governed by license within files (Public domain): -Exact origin unknown -base/base64.c -base/base64.h - -Governed by http://www.fourmilab.ch/md5/ (Public domain): -base/md5.c -base/md5.h - -Governed by license within files (Public domain): -Originally downloaded from http://svn.ghostscript.com/jbig2dec/tags/release_0_02/sha1.* -base/sha1.c -base/sha1.h - -Governed by http://sigslot.sourceforge.net/#license (Public domain): -base/sigslot.cc -base/sigslot.h - -Governed by http://www.freedesktop.org/wiki/Software/systemd (LGPL 2.1+): -third_party/libudev/libudev.h \ No newline at end of file diff --git a/talk/OWNERS b/talk/OWNERS deleted file mode 100644 index 112040c300..0000000000 --- a/talk/OWNERS +++ /dev/null @@ -1,13 +0,0 @@ -hta@webrtc.org -jiayl@webrtc.org -juberti@webrtc.org -perkj@webrtc.org -pthatcher@webrtc.org -sergeyu@chromium.org -tommi@webrtc.org -per-file *.isolate=kjellander@webrtc.org - -# These are for the common case of adding or renaming files. If you're doing -# structural changes, please get a review from a reviewer in this file. -per-file *.gyp=* -per-file *.gypi=* diff --git a/talk/PRESUBMIT.py b/talk/PRESUBMIT.py deleted file mode 100644 index 3e121f5bc5..0000000000 --- a/talk/PRESUBMIT.py +++ /dev/null @@ -1,94 +0,0 @@ -# libjingle -# Copyright 2013 Google Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -def _LicenseHeader(input_api): - """Returns the license header regexp.""" - # Accept any year number from start of project to the current year - current_year = int(input_api.time.strftime('%Y')) - allowed_years = (str(s) for s in reversed(xrange(2004, current_year + 1))) - years_re = '(' + '|'.join(allowed_years) + ')' - years_re = '%s(--%s)?' % (years_re, years_re) - license_header = ( - r'.*? libjingle\n' - r'.*? Copyright %(year)s Google Inc\..*\n' - r'.*?\n' - r'.*? Redistribution and use in source and binary forms, with or without' - r'\n' - r'.*? modification, are permitted provided that the following conditions ' - r'are met:\n' - r'.*?\n' - r'.*? 1\. Redistributions of source code must retain the above copyright ' - r'notice,\n' - r'.*? this list of conditions and the following disclaimer\.\n' - r'.*? 2\. Redistributions in binary form must reproduce the above ' - r'copyright notice,\n' - r'.*? this list of conditions and the following disclaimer in the ' - r'documentation\n' - r'.*? and/or other materials provided with the distribution\.\n' - r'.*? 3\. The name of the author may not be used to endorse or promote ' - r'products\n' - r'.*? derived from this software without specific prior written ' - r'permission\.\n' - r'.*?\n' - r'.*? THIS SOFTWARE IS PROVIDED BY THE AUTHOR \`\`AS IS\'\' AND ANY ' - r'EXPRESS OR IMPLIED\n' - r'.*? WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ' - r'OF\n' - r'.*? MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ' - r'DISCLAIMED\. IN NO\n' - r'.*? EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ' - r'INCIDENTAL,\n' - r'.*? SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \(INCLUDING, ' - r'BUT NOT LIMITED TO,\n' - r'.*? PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ' - r'PROFITS;\n' - r'.*? OR BUSINESS INTERRUPTION\) HOWEVER CAUSED AND ON ANY THEORY OF ' - r'LIABILITY,\n' - r'.*? WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \(INCLUDING ' - r'NEGLIGENCE OR\n' - r'.*? OTHERWISE\) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ' - r'EVEN IF\n' - r'.*? ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\.\n' - ) % { - 'year': years_re, - } - return license_header - -def _CommonChecks(input_api, output_api): - """Checks common to both upload and commit.""" - results = [] - results.extend(input_api.canned_checks.CheckLicense( - input_api, output_api, _LicenseHeader(input_api))) - return results - -def CheckChangeOnUpload(input_api, output_api): - results = [] - results.extend(_CommonChecks(input_api, output_api)) - return results - -def CheckChangeOnCommit(input_api, output_api): - results = [] - results.extend(_CommonChecks(input_api, output_api)) - return results diff --git a/talk/app/webrtc/DEPS b/talk/app/webrtc/DEPS deleted file mode 100644 index 69ecd0279e..0000000000 --- a/talk/app/webrtc/DEPS +++ /dev/null @@ -1,7 +0,0 @@ -include_rules = [ - "+talk/app/webrtc/objc", - "+webrtc/video_frame.h", - "+webrtc/api", - "+webrtc/base", - "+webrtc/media", -] diff --git a/talk/app/webrtc/legacy_objc_api.gyp b/talk/app/webrtc/legacy_objc_api.gyp deleted file mode 100755 index c55e74c29d..0000000000 --- a/talk/app/webrtc/legacy_objc_api.gyp +++ /dev/null @@ -1,193 +0,0 @@ -# -# libjingle -# Copyright 2012 Google Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -{ - 'includes': ['../../build/common.gypi'], - 'conditions': [ - ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', { - # The >= 10.7 above is required for ARC. - 'targets': [ - { - 'target_name': 'libjingle_peerconnection_objc', - 'type': 'static_library', - 'dependencies': [ - '<(webrtc_root)/api/api.gyp:libjingle_peerconnection', - ], - 'sources': [ - 'objc/RTCAudioTrack+Internal.h', - 'objc/RTCAudioTrack.mm', - 'objc/RTCDataChannel+Internal.h', - 'objc/RTCDataChannel.mm', - 'objc/RTCEnumConverter.h', - 'objc/RTCEnumConverter.mm', - 'objc/RTCI420Frame+Internal.h', - 'objc/RTCI420Frame.mm', - 'objc/RTCICECandidate+Internal.h', - 'objc/RTCICECandidate.mm', - 'objc/RTCICEServer+Internal.h', - 'objc/RTCICEServer.mm', - 'objc/RTCLogging.mm', - 'objc/RTCMediaConstraints+Internal.h', - 'objc/RTCMediaConstraints.mm', - 'objc/RTCMediaConstraintsNative.cc', - 'objc/RTCMediaConstraintsNative.h', - 'objc/RTCMediaSource+Internal.h', - 'objc/RTCMediaSource.mm', - 'objc/RTCMediaStream+Internal.h', - 'objc/RTCMediaStream.mm', - 'objc/RTCMediaStreamTrack+Internal.h', - 'objc/RTCMediaStreamTrack.mm', - 'objc/RTCOpenGLVideoRenderer.mm', - 'objc/RTCPair.m', - 'objc/RTCPeerConnection+Internal.h', - 'objc/RTCPeerConnection.mm', - 'objc/RTCPeerConnectionFactory.mm', - 'objc/RTCPeerConnectionInterface+Internal.h', - 'objc/RTCPeerConnectionInterface.mm', - 'objc/RTCPeerConnectionObserver.h', - 'objc/RTCPeerConnectionObserver.mm', - 'objc/RTCSessionDescription+Internal.h', - 'objc/RTCSessionDescription.mm', - 'objc/RTCStatsReport+Internal.h', - 'objc/RTCStatsReport.mm', - 'objc/RTCVideoCapturer+Internal.h', - 'objc/RTCVideoCapturer.mm', - 'objc/RTCVideoRendererAdapter.h', - 'objc/RTCVideoRendererAdapter.mm', - 'objc/RTCVideoSource+Internal.h', - 'objc/RTCVideoSource.mm', - 'objc/RTCVideoTrack+Internal.h', - 'objc/RTCVideoTrack.mm', - 'objc/public/RTCAudioSource.h', - 'objc/public/RTCAudioTrack.h', - 'objc/public/RTCDataChannel.h', - 'objc/public/RTCFileLogger.h', - 'objc/public/RTCI420Frame.h', - 'objc/public/RTCICECandidate.h', - 'objc/public/RTCICEServer.h', - 'objc/public/RTCLogging.h', - 'objc/public/RTCMediaConstraints.h', - 'objc/public/RTCMediaSource.h', - 'objc/public/RTCMediaStream.h', - 'objc/public/RTCMediaStreamTrack.h', - 'objc/public/RTCOpenGLVideoRenderer.h', - 'objc/public/RTCPair.h', - 'objc/public/RTCPeerConnection.h', - 'objc/public/RTCPeerConnectionDelegate.h', - 'objc/public/RTCPeerConnectionFactory.h', - 'objc/public/RTCPeerConnectionInterface.h', - 'objc/public/RTCSessionDescription.h', - 'objc/public/RTCSessionDescriptionDelegate.h', - 'objc/public/RTCStatsDelegate.h', - 'objc/public/RTCStatsReport.h', - 'objc/public/RTCTypes.h', - 'objc/public/RTCVideoCapturer.h', - 'objc/public/RTCVideoRenderer.h', - 'objc/public/RTCVideoSource.h', - 'objc/public/RTCVideoTrack.h', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(DEPTH)/talk/app/webrtc/objc/public', - ], - }, - 'include_dirs': [ - '<(webrtc_root)/webrtc/api', - '<(DEPTH)/talk/app/webrtc/objc', - '<(DEPTH)/talk/app/webrtc/objc/public', - ], - 'link_settings': { - 'libraries': [ - '-lstdc++', - ], - }, - 'all_dependent_settings': { - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - }, - }, - 'xcode_settings': { - 'CLANG_ENABLE_OBJC_ARC': 'YES', - # common.gypi enables this for mac but we want this to be disabled - # like it is for ios. - 'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO', - # Disabled due to failing when compiled with -Wall, see - # https://bugs.chromium.org/p/webrtc/issues/detail?id=5397 - 'WARNING_CFLAGS': ['-Wno-unused-property-ivar'], - }, - 'conditions': [ - ['OS=="ios"', { - 'sources': [ - 'objc/avfoundationvideocapturer.h', - 'objc/avfoundationvideocapturer.mm', - 'objc/RTCAVFoundationVideoSource+Internal.h', - 'objc/RTCAVFoundationVideoSource.mm', - 'objc/RTCEAGLVideoView.m', - 'objc/public/RTCEAGLVideoView.h', - 'objc/public/RTCAVFoundationVideoSource.h', - ], - 'dependencies': [ - '<(webrtc_root)/sdk/sdk.gyp:rtc_sdk_common_objc', - ], - 'link_settings': { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-framework CoreGraphics', - '-framework GLKit', - '-framework OpenGLES', - '-framework QuartzCore', - ], - }, - }, - }], - ['OS=="mac"', { - 'sources': [ - 'objc/RTCNSGLVideoView.m', - 'objc/public/RTCNSGLVideoView.h', - ], - 'xcode_settings': { - # Need to build against 10.7 framework for full ARC support - # on OSX. - 'MACOSX_DEPLOYMENT_TARGET' : '10.7', - # RTCVideoTrack.mm uses code with partial availability. - # https://code.google.com/p/webrtc/issues/detail?id=4695 - 'WARNING_CFLAGS!': ['-Wpartial-availability'], - }, - 'link_settings': { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-framework Cocoa', - '-framework OpenGL', - ], - }, - }, - }], - ], - }, # target libjingle_peerconnection_objc - ], - }], - ], -} diff --git a/talk/app/webrtc/legacy_objc_api_tests.gyp b/talk/app/webrtc/legacy_objc_api_tests.gyp deleted file mode 100755 index 462488a66e..0000000000 --- a/talk/app/webrtc/legacy_objc_api_tests.gyp +++ /dev/null @@ -1,94 +0,0 @@ -# -# libjingle -# Copyright 2012 Google Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -{ - 'includes': ['../../build/common.gypi'], - 'conditions': [ - ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', { - # The >=10.7 above is required to make ARC link cleanly (e.g. as - # opposed to _compile_ cleanly, which the library under test - # does just fine on 10.6 too). - 'targets': [ - { - 'target_name': 'libjingle_peerconnection_objc_test', - 'type': 'executable', - 'includes': [ '../../../webrtc/build/ios/objc_app.gypi' ], - 'dependencies': [ - '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', - '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default', - '<(webrtc_root)/system_wrappers/system_wrappers.gyp:metrics_default', - 'legacy_objc_api.gyp:libjingle_peerconnection_objc', - ], - 'sources': [ - 'objctests/RTCPeerConnectionSyncObserver.h', - 'objctests/RTCPeerConnectionSyncObserver.m', - 'objctests/RTCPeerConnectionTest.mm', - 'objctests/RTCSessionDescriptionSyncObserver.h', - 'objctests/RTCSessionDescriptionSyncObserver.m', - # TODO(fischman): figure out if this works for ios or if it - # needs a GUI driver. - 'objctests/mac/main.mm', - ], - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - # Need to build against 10.7 framework for full ARC support - # on OSX. - 'MACOSX_DEPLOYMENT_TARGET' : '10.7', - # common.gypi enables this for mac but we want this to be - # disabled like it is for ios. - 'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO', - }, - }], - ], - }, # target libjingle_peerconnection_objc_test - { - 'target_name': 'apprtc_signaling_gunit_test', - 'type': 'executable', - 'includes': [ '../../../webrtc/build/ios/objc_app.gypi' ], - 'dependencies': [ - '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', - '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default', - '<(webrtc_root)/system_wrappers/system_wrappers.gyp:metrics_default', - '<(webrtc_root)/webrtc_examples.gyp:apprtc_signaling', - '<(DEPTH)/third_party/ocmock/ocmock.gyp:ocmock', - ], - 'sources': [ - 'objctests/mac/main.mm', - '<(webrtc_root)/examples/objc/AppRTCDemo/tests/ARDAppClientTest.mm', - ], - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'MACOSX_DEPLOYMENT_TARGET' : '10.8', - }, - }], - ], - }, # target apprtc_signaling_gunit_test - ], - }], - ], -} diff --git a/talk/app/webrtc/objc/.clang-format b/talk/app/webrtc/objc/.clang-format deleted file mode 100644 index 34694e57dc..0000000000 --- a/talk/app/webrtc/objc/.clang-format +++ /dev/null @@ -1,10 +0,0 @@ -BasedOnStyle: Chromium -ColumnLimit: 100 -BinPackParameters: false -AllowAllParametersOfDeclarationOnNextLine: true -DerivePointerAlignment: false -PointerAlignment: Right -SpacesBeforeTrailingComments: 1 -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true diff --git a/talk/app/webrtc/objc/OWNERS b/talk/app/webrtc/objc/OWNERS deleted file mode 100644 index cd06158b7f..0000000000 --- a/talk/app/webrtc/objc/OWNERS +++ /dev/null @@ -1 +0,0 @@ -tkchin@webrtc.org diff --git a/talk/app/webrtc/objc/README b/talk/app/webrtc/objc/README deleted file mode 100644 index f24ca24808..0000000000 --- a/talk/app/webrtc/objc/README +++ /dev/null @@ -1,68 +0,0 @@ -This directory contains the ObjectiveC implementation of the -webrtc::PeerConnection API. This can be built for Mac or iOS. This -file describes building the API, unit test, and AppRTCDemo sample app. - -Prerequisites: -- Make sure gclient is checking out tools necessary to target iOS: your - .gclient file should contain a line like: - target_os = ['ios', 'mac'] - Make sure to re-run gclient sync after adding this to download the tools. - -- Set up webrtc-related $GYP_DEFINES; example shell functions that set - up for building for iOS-device, iOS-simulator, and Mac (resp) are: -function wrbase() { - cd /path/to/webrtc/src -} - -function wrios() { - wrbase - export GYP_DEFINES="$GYP_DEFINES OS=ios" - export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_ios" - export GYP_CROSSCOMPILE=1 -} - -function wrios32() { - wrios - export GYP_DEFINES="$GYP_DEFINES target_arch=arm" -} - -function wrios64() { - wrios - export GYP_DEFINES="$GYP_DEFINES target_arch=arm64" -} - -function wrsim() { - wrbase - export GYP_DEFINES="$GYP_DEFINES OS=ios target_subarch=arm32 target_arch=ia32" - export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_sim" - export GYP_CROSSCOMPILE=1 -} - -function wrmac() { - wrbase - export GYP_DEFINES="$GYP_DEFINES OS=mac target_subarch=arm64 target_arch=x64" - export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_mac" -} - -- Finally, run "webrtc/build/gyp_webrtc.py" to generate ninja files. - -Example of building & using the unittest & app: - -- To build & run the unittest (must target mac): - wrmac && ./webrtc/build/gyp_webrtc.py && \ - ninja -C out_mac/Debug libjingle_peerconnection_objc_test && \ - ./out_mac/Debug/libjingle_peerconnection_objc_test.app/Contents/MacOS/libjingle_peerconnection_objc_test - -- To build & launch the sample app on OSX: - wrmac && ./webrtc/build/gyp_webrtc.py && ninja -C out_mac/Debug AppRTCDemo && \ - ./out_mac/Debug/AppRTCDemo.app/Contents/MacOS/AppRTCDemo - -- To build & launch the sample app on the iOS simulator: - wrsim && ./webrtc/build/gyp_webrtc.py && ninja -C out_sim/Debug iossim AppRTCDemo && \ - ./out_sim/Debug/iossim out_sim/Debug/AppRTCDemo.app - -- To build & sign the sample app for an iOS device (32 bit): - wrios32 && ./webrtc/build/gyp_webrtc.py && ninja -C out_ios/Debug-iphoneos AppRTCDemo - -- To build & sign the sample app for an iOS device (64 bit): - wrios64 && ./webrtc/build/gyp_webrtc.py && ninja -C out_ios/Debug-iphoneos AppRTCDemo diff --git a/talk/app/webrtc/objc/RTCAVFoundationVideoSource+Internal.h b/talk/app/webrtc/objc/RTCAVFoundationVideoSource+Internal.h deleted file mode 100644 index ffa6629c41..0000000000 --- a/talk/app/webrtc/objc/RTCAVFoundationVideoSource+Internal.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCAVFoundationVideoSource.h" - -#include "avfoundationvideocapturer.h" - -@interface RTCAVFoundationVideoSource () - -@property(nonatomic, readonly) webrtc::AVFoundationVideoCapturer* capturer; - -@end diff --git a/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm b/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm deleted file mode 100644 index 8dc0fe900c..0000000000 --- a/talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm +++ /dev/null @@ -1,74 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCAVFoundationVideoSource+Internal.h" - -#import "RTCMediaConstraints+Internal.h" -#import "RTCMediaSource+Internal.h" -#import "RTCPeerConnectionFactory+Internal.h" -#import "RTCVideoSource+Internal.h" - -#include - -@implementation RTCAVFoundationVideoSource { - webrtc::AVFoundationVideoCapturer *_capturer; -} - -- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory - constraints:(RTCMediaConstraints*)constraints { - NSParameterAssert(factory); - // We pass ownership of the capturer to the source, but since we own - // the source, it should be ok to keep a raw pointer to the - // capturer. - _capturer = new webrtc::AVFoundationVideoCapturer(); - rtc::scoped_refptr source = - factory.nativeFactory->CreateVideoSource(_capturer, - constraints.constraints); - return [super initWithMediaSource:source]; -} - -- (BOOL)canUseBackCamera { - return self.capturer->CanUseBackCamera(); -} - -- (BOOL)useBackCamera { - return self.capturer->GetUseBackCamera(); -} - -- (void)setUseBackCamera:(BOOL)useBackCamera { - self.capturer->SetUseBackCamera(useBackCamera); -} - -- (AVCaptureSession*)captureSession { - return self.capturer->GetCaptureSession(); -} - -- (webrtc::AVFoundationVideoCapturer*)capturer { - return _capturer; -} - -@end diff --git a/talk/app/webrtc/objc/RTCAudioTrack+Internal.h b/talk/app/webrtc/objc/RTCAudioTrack+Internal.h deleted file mode 100644 index 1ca2b8ff9d..0000000000 --- a/talk/app/webrtc/objc/RTCAudioTrack+Internal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCAudioTrack.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCAudioTrack (Internal) - -@property(nonatomic, assign, readonly) - rtc::scoped_refptr audioTrack; - -@end diff --git a/talk/app/webrtc/objc/RTCAudioTrack.mm b/talk/app/webrtc/objc/RTCAudioTrack.mm deleted file mode 100644 index 78635b6b8f..0000000000 --- a/talk/app/webrtc/objc/RTCAudioTrack.mm +++ /dev/null @@ -1,45 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCAudioTrack+Internal.h" - -#import "RTCMediaStreamTrack+Internal.h" - -@implementation RTCAudioTrack -@end - -@implementation RTCAudioTrack (Internal) - -- (rtc::scoped_refptr)audioTrack { - return static_cast(self.mediaTrack.get()); -} - -@end diff --git a/talk/app/webrtc/objc/RTCDataChannel+Internal.h b/talk/app/webrtc/objc/RTCDataChannel+Internal.h deleted file mode 100644 index 9e23b7bd34..0000000000 --- a/talk/app/webrtc/objc/RTCDataChannel+Internal.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCDataChannel.h" - -#include "webrtc/api/datachannelinterface.h" -#include "webrtc/base/scoped_ref_ptr.h" - -@interface RTCDataBuffer (Internal) - -@property(nonatomic, readonly) const webrtc::DataBuffer* dataBuffer; - -- (instancetype)initWithDataBuffer:(const webrtc::DataBuffer&)buffer; - -@end - -@interface RTCDataChannelInit (Internal) - -@property(nonatomic, readonly) const webrtc::DataChannelInit* dataChannelInit; - -@end - -@interface RTCDataChannel (Internal) - -@property(nonatomic, readonly) - rtc::scoped_refptr dataChannel; - -- (instancetype)initWithDataChannel: - (rtc::scoped_refptr)dataChannel; - -@end diff --git a/talk/app/webrtc/objc/RTCDataChannel.mm b/talk/app/webrtc/objc/RTCDataChannel.mm deleted file mode 100644 index 6cfa5623c4..0000000000 --- a/talk/app/webrtc/objc/RTCDataChannel.mm +++ /dev/null @@ -1,292 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCDataChannel+Internal.h" - -#include - -#include "webrtc/api/datachannelinterface.h" - -namespace webrtc { - -class RTCDataChannelObserver : public DataChannelObserver { - public: - RTCDataChannelObserver(RTCDataChannel* channel) { _channel = channel; } - - void OnStateChange() override { - [_channel.delegate channelDidChangeState:_channel]; - } - - void OnBufferedAmountChange(uint64_t previousAmount) override { - RTCDataChannel* channel = _channel; - id delegate = channel.delegate; - if ([delegate - respondsToSelector:@selector(channel:didChangeBufferedAmount:)]) { - [delegate channel:channel didChangeBufferedAmount:previousAmount]; - } - } - - void OnMessage(const DataBuffer& buffer) override { - if (!_channel.delegate) { - return; - } - RTCDataBuffer* dataBuffer = - [[RTCDataBuffer alloc] initWithDataBuffer:buffer]; - [_channel.delegate channel:_channel didReceiveMessageWithBuffer:dataBuffer]; - } - - private: - __weak RTCDataChannel* _channel; -}; -} - -// TODO(henrika): move to shared location. -// See https://code.google.com/p/webrtc/issues/detail?id=4773 for details. -NSString* NSStringFromStdString(const std::string& stdString) { - // std::string may contain null termination character so we construct - // using length. - return [[NSString alloc] initWithBytes:stdString.data() - length:stdString.length() - encoding:NSUTF8StringEncoding]; -} - -std::string StdStringFromNSString(NSString* nsString) { - NSData* charData = [nsString dataUsingEncoding:NSUTF8StringEncoding]; - return std::string(reinterpret_cast([charData bytes]), - [charData length]); -} - -@implementation RTCDataChannelInit { - webrtc::DataChannelInit _dataChannelInit; -} - -- (BOOL)isOrdered { - return _dataChannelInit.ordered; -} - -- (void)setIsOrdered:(BOOL)isOrdered { - _dataChannelInit.ordered = isOrdered; -} - -- (NSInteger)maxRetransmitTime { - return _dataChannelInit.maxRetransmitTime; -} - -- (void)setMaxRetransmitTime:(NSInteger)maxRetransmitTime { - _dataChannelInit.maxRetransmitTime = maxRetransmitTime; -} - -- (NSInteger)maxRetransmits { - return _dataChannelInit.maxRetransmits; -} - -- (void)setMaxRetransmits:(NSInteger)maxRetransmits { - _dataChannelInit.maxRetransmits = maxRetransmits; -} - -- (NSString*)protocol { - return NSStringFromStdString(_dataChannelInit.protocol); -} - -- (void)setProtocol:(NSString*)protocol { - _dataChannelInit.protocol = StdStringFromNSString(protocol); -} - -- (BOOL)isNegotiated { - return _dataChannelInit.negotiated; -} - -- (void)setIsNegotiated:(BOOL)isNegotiated { - _dataChannelInit.negotiated = isNegotiated; -} - -- (NSInteger)streamId { - return _dataChannelInit.id; -} - -- (void)setStreamId:(NSInteger)streamId { - _dataChannelInit.id = streamId; -} - -@end - -@implementation RTCDataChannelInit (Internal) - -- (const webrtc::DataChannelInit*)dataChannelInit { - return &_dataChannelInit; -} - -@end - -@implementation RTCDataBuffer { - std::unique_ptr _dataBuffer; -} - -- (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary { - NSAssert(data, @"data cannot be nil"); - if (self = [super init]) { - rtc::CopyOnWriteBuffer buffer( - reinterpret_cast([data bytes]), [data length]); - _dataBuffer.reset(new webrtc::DataBuffer(buffer, isBinary)); - } - return self; -} - -- (NSData*)data { - return [NSData dataWithBytes:_dataBuffer->data.data() - length:_dataBuffer->data.size()]; -} - -- (BOOL)isBinary { - return _dataBuffer->binary; -} - -@end - -@implementation RTCDataBuffer (Internal) - -- (instancetype)initWithDataBuffer:(const webrtc::DataBuffer&)buffer { - if (self = [super init]) { - _dataBuffer.reset(new webrtc::DataBuffer(buffer)); - } - return self; -} - -- (const webrtc::DataBuffer*)dataBuffer { - return _dataBuffer.get(); -} - -@end - -@implementation RTCDataChannel { - rtc::scoped_refptr _dataChannel; - std::unique_ptr _observer; - BOOL _isObserverRegistered; -} - -- (void)dealloc { - // Handles unregistering the observer properly. We need to do this because - // there may still be other references to the underlying data channel. - self.delegate = nil; -} - -- (NSString*)label { - return NSStringFromStdString(_dataChannel->label()); -} - -- (BOOL)isReliable { - return _dataChannel->reliable(); -} - -- (BOOL)isOrdered { - return _dataChannel->ordered(); -} - -- (NSUInteger)maxRetransmitTimeMs { - return _dataChannel->maxRetransmitTime(); -} - -- (NSUInteger)maxRetransmits { - return _dataChannel->maxRetransmits(); -} - -- (NSString*)protocol { - return NSStringFromStdString(_dataChannel->protocol()); -} - -- (BOOL)isNegotiated { - return _dataChannel->negotiated(); -} - -- (NSInteger)streamId { - return _dataChannel->id(); -} - -- (RTCDataChannelState)state { - switch (_dataChannel->state()) { - case webrtc::DataChannelInterface::DataState::kConnecting: - return kRTCDataChannelStateConnecting; - case webrtc::DataChannelInterface::DataState::kOpen: - return kRTCDataChannelStateOpen; - case webrtc::DataChannelInterface::DataState::kClosing: - return kRTCDataChannelStateClosing; - case webrtc::DataChannelInterface::DataState::kClosed: - return kRTCDataChannelStateClosed; - } -} - -- (NSUInteger)bufferedAmount { - return _dataChannel->buffered_amount(); -} - -- (void)setDelegate:(id)delegate { - if (_delegate == delegate) { - return; - } - if (_isObserverRegistered) { - _dataChannel->UnregisterObserver(); - _isObserverRegistered = NO; - } - _delegate = delegate; - if (_delegate) { - _dataChannel->RegisterObserver(_observer.get()); - _isObserverRegistered = YES; - } -} - -- (void)close { - _dataChannel->Close(); -} - -- (BOOL)sendData:(RTCDataBuffer*)data { - return _dataChannel->Send(*data.dataBuffer); -} - -@end - -@implementation RTCDataChannel (Internal) - -- (instancetype)initWithDataChannel: - (rtc::scoped_refptr) - dataChannel { - NSAssert(dataChannel != NULL, @"dataChannel cannot be NULL"); - if (self = [super init]) { - _dataChannel = dataChannel; - _observer.reset(new webrtc::RTCDataChannelObserver(self)); - } - return self; -} - -- (rtc::scoped_refptr)dataChannel { - return _dataChannel; -} - -@end diff --git a/talk/app/webrtc/objc/RTCEAGLVideoView.m b/talk/app/webrtc/objc/RTCEAGLVideoView.m deleted file mode 100644 index d19462c9d9..0000000000 --- a/talk/app/webrtc/objc/RTCEAGLVideoView.m +++ /dev/null @@ -1,277 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCEAGLVideoView.h" - -#import - -#import "RTCI420Frame.h" -#import "RTCOpenGLVideoRenderer.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; - // Set to half of screen refresh, which should be 30fps. - [_displayLink setFrameInterval:2]; - [_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 - -// RTCEAGLVideoView wraps a GLKView which is setup with -// enableSetNeedsDisplay = NO for the purpose of gaining control of -// exactly when to call -[GLKView display]. This need for extra -// control is required to avoid triggering method calls on GLKView -// that results in attempting to bind the underlying render buffer -// when the drawable size would be empty which would result in the -// error GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT. -[GLKView display] is -// the method that will trigger the binding of the render -// buffer. Because the standard behaviour of -[UIView setNeedsDisplay] -// is disabled for the reasons above, the RTCEAGLVideoView maintains -// its own |isDirty| flag. - -@interface RTCEAGLVideoView () -// |i420Frame| is set when we receive a frame from a worker thread and is read -// from the display link callback so atomicity is required. -@property(atomic, strong) RTCI420Frame* i420Frame; -@property(nonatomic, readonly) GLKView* glkView; -@property(nonatomic, readonly) RTCOpenGLVideoRenderer* glRenderer; -@end - -@implementation RTCEAGLVideoView { - RTCDisplayLinkTimer* _timer; - GLKView* _glkView; - RTCOpenGLVideoRenderer* _glRenderer; - // This flag should only be set and read on the main thread (e.g. by - // setNeedsDisplay) - BOOL _isDirty; -} - -- (instancetype)initWithFrame:(CGRect)frame { - if (self = [super initWithFrame:frame]) { - [self configure]; - } - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - if (self = [super initWithCoder:aDecoder]) { - [self configure]; - } - return self; -} - -- (void)configure { - EAGLContext* glContext = - [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; - if (!glContext) { - glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - } - _glRenderer = [[RTCOpenGLVideoRenderer alloc] initWithContext:glContext]; - - // GLKView manages a framebuffer for us. - _glkView = [[GLKView alloc] initWithFrame:CGRectZero - context:glContext]; - _glkView.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888; - _glkView.drawableDepthFormat = GLKViewDrawableDepthFormatNone; - _glkView.drawableStencilFormat = GLKViewDrawableStencilFormatNone; - _glkView.drawableMultisample = GLKViewDrawableMultisampleNone; - _glkView.delegate = self; - _glkView.layer.masksToBounds = YES; - _glkView.enableSetNeedsDisplay = NO; - [self addSubview:_glkView]; - - // Listen to application state in order to clean up OpenGL before app goes - // away. - NSNotificationCenter* notificationCenter = - [NSNotificationCenter defaultCenter]; - [notificationCenter addObserver:self - selector:@selector(willResignActive) - name:UIApplicationWillResignActiveNotification - object:nil]; - [notificationCenter addObserver:self - selector:@selector(didBecomeActive) - name:UIApplicationDidBecomeActiveNotification - object:nil]; - - // Frames are received on a separate thread, so we poll for current frame - // using a refresh rate proportional to screen refresh frequency. This - // occurs on the main thread. - __weak RTCEAGLVideoView* weakSelf = self; - _timer = [[RTCDisplayLinkTimer alloc] initWithTimerHandler:^{ - RTCEAGLVideoView* strongSelf = weakSelf; - [strongSelf displayLinkTimerDidFire]; - }]; - [self setupGL]; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - UIApplicationState appState = - [UIApplication sharedApplication].applicationState; - if (appState == UIApplicationStateActive) { - [self teardownGL]; - } - [_timer invalidate]; -} - -#pragma mark - UIView - -- (void)setNeedsDisplay { - [super setNeedsDisplay]; - _isDirty = YES; -} - -- (void)setNeedsDisplayInRect:(CGRect)rect { - [super setNeedsDisplayInRect:rect]; - _isDirty = YES; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - _glkView.frame = self.bounds; -} - -#pragma mark - GLKViewDelegate - -// This method is called when the GLKView's content is dirty and needs to be -// redrawn. This occurs on main thread. -- (void)glkView:(GLKView*)view drawInRect:(CGRect)rect { - // The renderer will draw the frame to the framebuffer corresponding to the - // one used by |view|. - [_glRenderer drawFrame:self.i420Frame]; -} - -#pragma mark - RTCVideoRenderer - -// These methods may be called on non-main thread. -- (void)setSize:(CGSize)size { - __weak RTCEAGLVideoView* weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - RTCEAGLVideoView* strongSelf = weakSelf; - [strongSelf.delegate videoView:strongSelf didChangeVideoSize:size]; - }); -} - -- (void)renderFrame:(RTCI420Frame*)frame { - self.i420Frame = frame; -} - -#pragma mark - Private - -- (void)displayLinkTimerDidFire { - // Don't render unless video frame have changed or the view content - // has explicitly been marked dirty. - if (!_isDirty && _glRenderer.lastDrawnFrame == self.i420Frame) { - return; - } - - // Always reset isDirty at this point, even if -[GLKView display] - // won't be called in the case the drawable size is empty. - _isDirty = NO; - - // Only call -[GLKView display] if the drawable size is - // non-empty. Calling display will make the GLKView setup its - // render buffer if necessary, but that will fail with error - // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT if size is empty. - if (self.bounds.size.width > 0 && self.bounds.size.height > 0) { - [_glkView display]; - } -} - -- (void)setupGL { - self.i420Frame = nil; - [_glRenderer setupGL]; - _timer.isPaused = NO; -} - -- (void)teardownGL { - self.i420Frame = nil; - _timer.isPaused = YES; - [_glkView deleteDrawable]; - [_glRenderer teardownGL]; -} - -- (void)didBecomeActive { - [self setupGL]; -} - -- (void)willResignActive { - [self teardownGL]; -} - -@end diff --git a/talk/app/webrtc/objc/RTCEnumConverter.h b/talk/app/webrtc/objc/RTCEnumConverter.h deleted file mode 100644 index eb06c18645..0000000000 --- a/talk/app/webrtc/objc/RTCEnumConverter.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// TODO(tkchin): remove this in favor of having objc headers mirror their C++ counterparts. -// TODO(tkchin): see if we can move C++ enums into their own file so we can avoid all this -// conversion code. -#import "RTCTypes.h" - -#import "talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h" - -@interface RTCEnumConverter : NSObject - -// TODO(tkchin): rename these. -+ (RTCICEConnectionState)convertIceConnectionStateToObjC: - (webrtc::PeerConnectionInterface::IceConnectionState)nativeState; - -+ (RTCICEGatheringState)convertIceGatheringStateToObjC: - (webrtc::PeerConnectionInterface::IceGatheringState)nativeState; - -+ (RTCSignalingState)convertSignalingStateToObjC: - (webrtc::PeerConnectionInterface::SignalingState)nativeState; - -+ (webrtc::PeerConnectionInterface::StatsOutputLevel) - convertStatsOutputLevelToNative:(RTCStatsOutputLevel)statsOutputLevel; - -+ (RTCSourceState)convertSourceStateToObjC: - (webrtc::MediaSourceInterface::SourceState)nativeState; - -+ (webrtc::MediaStreamTrackInterface::TrackState)convertTrackStateToNative: - (RTCTrackState)state; - -+ (RTCTrackState)convertTrackStateToObjC: - (webrtc::MediaStreamTrackInterface::TrackState)nativeState; - -+ (RTCIceTransportsType)iceTransportsTypeForNativeEnum: - (webrtc::PeerConnectionInterface::IceTransportsType)nativeEnum; - -+ (webrtc::PeerConnectionInterface::IceTransportsType)nativeEnumForIceTransportsType: - (RTCIceTransportsType)iceTransportsType; - -+ (RTCBundlePolicy)bundlePolicyForNativeEnum: - (webrtc::PeerConnectionInterface::BundlePolicy)nativeEnum; - -+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeEnumForBundlePolicy: - (RTCBundlePolicy)bundlePolicy; - -+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativeEnum: - (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnum; - -+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnumForRtcpMuxPolicy: - (RTCRtcpMuxPolicy)rtcpMuxPolicy; - -+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativeEnum: - (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnum; - -+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnumForTcpCandidatePolicy: - (RTCTcpCandidatePolicy)tcpCandidatePolicy; - -@end diff --git a/talk/app/webrtc/objc/RTCEnumConverter.mm b/talk/app/webrtc/objc/RTCEnumConverter.mm deleted file mode 100644 index 03b249c3a7..0000000000 --- a/talk/app/webrtc/objc/RTCEnumConverter.mm +++ /dev/null @@ -1,223 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCEnumConverter.h" - -#include "webrtc/api/peerconnectioninterface.h" - -@implementation RTCEnumConverter - -+ (RTCICEConnectionState)convertIceConnectionStateToObjC: - (webrtc::PeerConnectionInterface::IceConnectionState)nativeState { - switch (nativeState) { - case webrtc::PeerConnectionInterface::kIceConnectionNew: - return RTCICEConnectionNew; - case webrtc::PeerConnectionInterface::kIceConnectionChecking: - return RTCICEConnectionChecking; - case webrtc::PeerConnectionInterface::kIceConnectionConnected: - return RTCICEConnectionConnected; - case webrtc::PeerConnectionInterface::kIceConnectionCompleted: - return RTCICEConnectionCompleted; - case webrtc::PeerConnectionInterface::kIceConnectionFailed: - return RTCICEConnectionFailed; - case webrtc::PeerConnectionInterface::kIceConnectionDisconnected: - return RTCICEConnectionDisconnected; - case webrtc::PeerConnectionInterface::kIceConnectionClosed: - return RTCICEConnectionClosed; - case webrtc::PeerConnectionInterface::kIceConnectionMax: - NSAssert(NO, @"kIceConnectionMax not allowed"); - return RTCICEConnectionMax; - } -} - -+ (RTCICEGatheringState)convertIceGatheringStateToObjC: - (webrtc::PeerConnectionInterface::IceGatheringState)nativeState { - switch (nativeState) { - case webrtc::PeerConnectionInterface::kIceGatheringNew: - return RTCICEGatheringNew; - case webrtc::PeerConnectionInterface::kIceGatheringGathering: - return RTCICEGatheringGathering; - case webrtc::PeerConnectionInterface::kIceGatheringComplete: - return RTCICEGatheringComplete; - } -} - -+ (RTCSignalingState)convertSignalingStateToObjC: - (webrtc::PeerConnectionInterface::SignalingState)nativeState { - switch (nativeState) { - case webrtc::PeerConnectionInterface::kStable: - return RTCSignalingStable; - case webrtc::PeerConnectionInterface::kHaveLocalOffer: - return RTCSignalingHaveLocalOffer; - case webrtc::PeerConnectionInterface::kHaveLocalPrAnswer: - return RTCSignalingHaveLocalPrAnswer; - case webrtc::PeerConnectionInterface::kHaveRemoteOffer: - return RTCSignalingHaveRemoteOffer; - case webrtc::PeerConnectionInterface::kHaveRemotePrAnswer: - return RTCSignalingHaveRemotePrAnswer; - case webrtc::PeerConnectionInterface::kClosed: - return RTCSignalingClosed; - } -} - -+ (webrtc::PeerConnectionInterface::StatsOutputLevel) - convertStatsOutputLevelToNative:(RTCStatsOutputLevel)statsOutputLevel { - switch (statsOutputLevel) { - case RTCStatsOutputLevelStandard: - return webrtc::PeerConnectionInterface::kStatsOutputLevelStandard; - case RTCStatsOutputLevelDebug: - return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; - } -} - -+ (RTCSourceState)convertSourceStateToObjC: - (webrtc::MediaSourceInterface::SourceState)nativeState { - switch (nativeState) { - case webrtc::MediaSourceInterface::kInitializing: - return RTCSourceStateInitializing; - case webrtc::MediaSourceInterface::kLive: - return RTCSourceStateLive; - case webrtc::MediaSourceInterface::kEnded: - return RTCSourceStateEnded; - case webrtc::MediaSourceInterface::kMuted: - return RTCSourceStateMuted; - } -} - -+ (webrtc::MediaStreamTrackInterface::TrackState) - convertTrackStateToNative:(RTCTrackState)state { - switch (state) { - case RTCTrackStateLive: - return webrtc::MediaStreamTrackInterface::kLive; - case RTCTrackStateEnded: - return webrtc::MediaStreamTrackInterface::kEnded; - } -} - -+ (RTCTrackState)convertTrackStateToObjC: - (webrtc::MediaStreamTrackInterface::TrackState)nativeState { - switch (nativeState) { - case webrtc::MediaStreamTrackInterface::kLive: - return RTCTrackStateLive; - case webrtc::MediaStreamTrackInterface::kEnded: - return RTCTrackStateEnded; - } -} - -+ (RTCIceTransportsType)iceTransportsTypeForNativeEnum: - (webrtc::PeerConnectionInterface::IceTransportsType)nativeEnum { - switch (nativeEnum) { - case webrtc::PeerConnectionInterface::kNone: - return kRTCIceTransportsTypeNone; - case webrtc::PeerConnectionInterface::kRelay: - return kRTCIceTransportsTypeRelay; - case webrtc::PeerConnectionInterface::kNoHost: - return kRTCIceTransportsTypeNoHost; - case webrtc::PeerConnectionInterface::kAll: - return kRTCIceTransportsTypeAll; - } -} - -+ (webrtc::PeerConnectionInterface::IceTransportsType)nativeEnumForIceTransportsType: - (RTCIceTransportsType)iceTransportsType { - switch (iceTransportsType) { - case kRTCIceTransportsTypeNone: - return webrtc::PeerConnectionInterface::kNone; - case kRTCIceTransportsTypeRelay: - return webrtc::PeerConnectionInterface::kRelay; - case kRTCIceTransportsTypeNoHost: - return webrtc::PeerConnectionInterface::kNoHost; - case kRTCIceTransportsTypeAll: - return webrtc::PeerConnectionInterface::kAll; - } -} - -+ (RTCBundlePolicy)bundlePolicyForNativeEnum: - (webrtc::PeerConnectionInterface::BundlePolicy)nativeEnum { - switch (nativeEnum) { - case webrtc::PeerConnectionInterface::kBundlePolicyBalanced: - return kRTCBundlePolicyBalanced; - case webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle: - return kRTCBundlePolicyMaxBundle; - case webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat: - return kRTCBundlePolicyMaxCompat; - } -} - -+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeEnumForBundlePolicy: - (RTCBundlePolicy)bundlePolicy { - switch (bundlePolicy) { - case kRTCBundlePolicyBalanced: - return webrtc::PeerConnectionInterface::kBundlePolicyBalanced; - case kRTCBundlePolicyMaxBundle: - return webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle; - case kRTCBundlePolicyMaxCompat: - return webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat; - } -} - -+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativeEnum: - (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnum { - switch (nativeEnum) { - case webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate: - return kRTCRtcpMuxPolicyNegotiate; - case webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire: - return kRTCRtcpMuxPolicyRequire; - } -} - -+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnumForRtcpMuxPolicy: - (RTCRtcpMuxPolicy)rtcpMuxPolicy { - switch (rtcpMuxPolicy) { - case kRTCRtcpMuxPolicyNegotiate: - return webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate; - case kRTCRtcpMuxPolicyRequire: - return webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire; - } -} - -+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativeEnum: - (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnum { - switch (nativeEnum) { - case webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled: - return kRTCTcpCandidatePolicyEnabled; - case webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled: - return kRTCTcpCandidatePolicyDisabled; - } -} - -+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnumForTcpCandidatePolicy: - (RTCTcpCandidatePolicy)tcpCandidatePolicy { - switch (tcpCandidatePolicy) { - case kRTCTcpCandidatePolicyEnabled: - return webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled; - case kRTCTcpCandidatePolicyDisabled: - return webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled; - } -} - -@end diff --git a/talk/app/webrtc/objc/RTCI420Frame+Internal.h b/talk/app/webrtc/objc/RTCI420Frame+Internal.h deleted file mode 100644 index b910ae367d..0000000000 --- a/talk/app/webrtc/objc/RTCI420Frame+Internal.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCI420Frame.h" - -#include "webrtc/media/base/videoframe.h" - -@interface RTCI420Frame (Internal) - -- (instancetype)initWithVideoFrame:(const cricket::VideoFrame*)videoFrame; - -@end diff --git a/talk/app/webrtc/objc/RTCI420Frame.mm b/talk/app/webrtc/objc/RTCI420Frame.mm deleted file mode 100644 index 1646510b37..0000000000 --- a/talk/app/webrtc/objc/RTCI420Frame.mm +++ /dev/null @@ -1,109 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCI420Frame.h" - -#include - -#include "webrtc/media/engine/webrtcvideoframe.h" - -@implementation RTCI420Frame { - std::unique_ptr _videoFrame; -} - -- (NSUInteger)width { - return _videoFrame->width(); -} - -- (NSUInteger)height { - return _videoFrame->height(); -} - -// TODO(nisse): chromaWidth and chromaHeight are used only in -// RTCOpenGLVideoRenderer.mm. Update, and then delete these -// properties. -- (NSUInteger)chromaWidth { - return (self.width + 1) / 2; -} - -- (NSUInteger)chromaHeight { - return (self.height + 1) / 2; -} - -- (const uint8_t*)yPlane { - const rtc::scoped_refptr& buffer = - _videoFrame->video_frame_buffer(); - return buffer ? buffer->DataY() : nullptr; -} - -- (const uint8_t*)uPlane { - const rtc::scoped_refptr& buffer = - _videoFrame->video_frame_buffer(); - return buffer ? buffer->DataU() : nullptr; -} - -- (const uint8_t*)vPlane { - const rtc::scoped_refptr& buffer = - _videoFrame->video_frame_buffer(); - return buffer ? buffer->DataV() : nullptr; -} - -- (NSInteger)yPitch { - const rtc::scoped_refptr& buffer = - _videoFrame->video_frame_buffer(); - return buffer ? buffer->StrideY() : 0; -} - -- (NSInteger)uPitch { - const rtc::scoped_refptr& buffer = - _videoFrame->video_frame_buffer(); - return buffer ? buffer->StrideU() : 0; -} - -- (NSInteger)vPitch { - const rtc::scoped_refptr& buffer = - _videoFrame->video_frame_buffer(); - return buffer ? buffer->StrideV() : 0; -} - -@end - -@implementation RTCI420Frame (Internal) - -- (instancetype)initWithVideoFrame:(cricket::VideoFrame*)videoFrame { - if (self = [super init]) { - // Keep a shallow copy of the video frame. The underlying frame buffer is - // not copied. - _videoFrame.reset(new cricket::WebRtcVideoFrame( - videoFrame->video_frame_buffer(), - videoFrame->rotation(), - videoFrame->timestamp_us())); - } - return self; -} - -@end diff --git a/talk/app/webrtc/objc/RTCICECandidate+Internal.h b/talk/app/webrtc/objc/RTCICECandidate+Internal.h deleted file mode 100644 index f5b226f836..0000000000 --- a/talk/app/webrtc/objc/RTCICECandidate+Internal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCICECandidate.h" - -#include "webrtc/api/peerconnectioninterface.h" - -@interface RTCICECandidate (Internal) - -@property(nonatomic, assign, readonly) const - webrtc::IceCandidateInterface* candidate; - -- (id)initWithCandidate:(const webrtc::IceCandidateInterface*)candidate; - -@end diff --git a/talk/app/webrtc/objc/RTCICECandidate.mm b/talk/app/webrtc/objc/RTCICECandidate.mm deleted file mode 100644 index 1510946bac..0000000000 --- a/talk/app/webrtc/objc/RTCICECandidate.mm +++ /dev/null @@ -1,87 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCICECandidate+Internal.h" - -@implementation RTCICECandidate - -@synthesize sdpMid = _sdpMid; -@synthesize sdpMLineIndex = _sdpMLineIndex; -@synthesize sdp = _sdp; - -- (id)initWithMid:(NSString*)sdpMid - index:(NSInteger)sdpMLineIndex - sdp:(NSString*)sdp { - if (!sdpMid || !sdp) { - NSAssert(NO, @"nil arguments not allowed"); - return nil; - } - if ((self = [super init])) { - _sdpMid = [sdpMid copy]; - _sdpMLineIndex = sdpMLineIndex; - _sdp = [sdp copy]; - } - return self; -} - -- (NSString*)description { - return [NSString stringWithFormat:@"%@:%ld:%@", - self.sdpMid, - (long)self.sdpMLineIndex, - self.sdp]; -} - -@end - -@implementation RTCICECandidate (Internal) - -- (id)initWithCandidate:(const webrtc::IceCandidateInterface*)candidate { - if ((self = [super init])) { - std::string sdp; - if (candidate->ToString(&sdp)) { - _sdpMid = @(candidate->sdp_mid().c_str()); - _sdpMLineIndex = candidate->sdp_mline_index(); - _sdp = @(sdp.c_str()); - } else { - self = nil; - NSAssert(NO, @"ICECandidateInterface->ToString failed"); - } - } - return self; -} - -- (const webrtc::IceCandidateInterface*)candidate { - return webrtc::CreateIceCandidate( - [self.sdpMid UTF8String], self.sdpMLineIndex, [self.sdp UTF8String], - nullptr); -} - -@end diff --git a/talk/app/webrtc/objc/RTCICEServer+Internal.h b/talk/app/webrtc/objc/RTCICEServer+Internal.h deleted file mode 100644 index 92c4816968..0000000000 --- a/talk/app/webrtc/objc/RTCICEServer+Internal.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCICEServer.h" - -#include "webrtc/api/peerconnectioninterface.h" - -@interface RTCICEServer (Internal) - -@property(nonatomic, - assign, - readonly) webrtc::PeerConnectionInterface::IceServer iceServer; - -@end diff --git a/talk/app/webrtc/objc/RTCICEServer.mm b/talk/app/webrtc/objc/RTCICEServer.mm deleted file mode 100644 index dc1eb2d090..0000000000 --- a/talk/app/webrtc/objc/RTCICEServer.mm +++ /dev/null @@ -1,75 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCICEServer+Internal.h" - -@implementation RTCICEServer - -@synthesize URI = _URI; -@synthesize username = _username; -@synthesize password = _password; - -- (id)initWithURI:(NSURL*)URI - username:(NSString*)username - password:(NSString*)password { - if (!URI || !username || !password) { - NSAssert(NO, @"nil arguments not allowed"); - self = nil; - return nil; - } - if ((self = [super init])) { - _URI = URI; - _username = [username copy]; - _password = [password copy]; - } - return self; -} - -- (NSString*)description { - return [NSString stringWithFormat:@"RTCICEServer: [%@:%@:%@]", - [self.URI absoluteString], - self.username, - self.password]; -} - -@end - -@implementation RTCICEServer (Internal) - -- (webrtc::PeerConnectionInterface::IceServer)iceServer { - webrtc::PeerConnectionInterface::IceServer iceServer; - iceServer.uri = [[self.URI absoluteString] UTF8String]; - iceServer.username = [self.username UTF8String]; - iceServer.password = [self.password UTF8String]; - return iceServer; -} - -@end diff --git a/talk/app/webrtc/objc/RTCLogging.mm b/talk/app/webrtc/objc/RTCLogging.mm deleted file mode 100644 index fab358422c..0000000000 --- a/talk/app/webrtc/objc/RTCLogging.mm +++ /dev/null @@ -1,64 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCLogging.h" - -#include "webrtc/base/logging.h" - -rtc::LoggingSeverity RTCGetNativeLoggingSeverity(RTCLoggingSeverity severity) { - switch (severity) { - case kRTCLoggingSeverityVerbose: - return rtc::LS_VERBOSE; - case kRTCLoggingSeverityInfo: - return rtc::LS_INFO; - case kRTCLoggingSeverityWarning: - return rtc::LS_WARNING; - case kRTCLoggingSeverityError: - return rtc::LS_ERROR; - } -} - -void RTCLogEx(RTCLoggingSeverity severity, NSString* logString) { - if (logString.length) { - const char* utf8String = logString.UTF8String; - LOG_V(RTCGetNativeLoggingSeverity(severity)) << utf8String; - } -} - -void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity) { - rtc::LogMessage::LogToDebug(RTCGetNativeLoggingSeverity(severity)); -} - -NSString* RTCFileName(const char* filePath) { - NSString* nsFilePath = - [[NSString alloc] initWithBytesNoCopy:const_cast(filePath) - length:strlen(filePath) - encoding:NSUTF8StringEncoding - freeWhenDone:NO]; - return nsFilePath.lastPathComponent; -} - diff --git a/talk/app/webrtc/objc/RTCMediaConstraints+Internal.h b/talk/app/webrtc/objc/RTCMediaConstraints+Internal.h deleted file mode 100644 index 8b03d8926c..0000000000 --- a/talk/app/webrtc/objc/RTCMediaConstraints+Internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaConstraints.h" - -#import "RTCMediaConstraintsNative.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCMediaConstraints (Internal) - -// Ownership is retained for the lifetime of this object. -@property(nonatomic, assign, readonly) const - webrtc::RTCMediaConstraintsNative *constraints; - -@end diff --git a/talk/app/webrtc/objc/RTCMediaConstraints.mm b/talk/app/webrtc/objc/RTCMediaConstraints.mm deleted file mode 100644 index a79afb1794..0000000000 --- a/talk/app/webrtc/objc/RTCMediaConstraints.mm +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCMediaConstraints+Internal.h" - -#import "RTCPair.h" - -#include - -// TODO(hughv): Add accessors for mandatory and optional constraints. -// TODO(hughv): Add description. - -@implementation RTCMediaConstraints { - std::unique_ptr _constraints; - webrtc::MediaConstraintsInterface::Constraints _mandatory; - webrtc::MediaConstraintsInterface::Constraints _optional; -} - -- (id)initWithMandatoryConstraints:(NSArray*)mandatory - optionalConstraints:(NSArray*)optional { - if ((self = [super init])) { - _mandatory = [[self class] constraintsFromArray:mandatory]; - _optional = [[self class] constraintsFromArray:optional]; - _constraints.reset( - new webrtc::RTCMediaConstraintsNative(_mandatory, _optional)); - } - return self; -} - -+ (webrtc::MediaConstraintsInterface::Constraints)constraintsFromArray: - (NSArray*)array { - webrtc::MediaConstraintsInterface::Constraints constraints; - for (RTCPair* pair in array) { - constraints.push_back(webrtc::MediaConstraintsInterface::Constraint( - [pair.key UTF8String], [pair.value UTF8String])); - } - return constraints; -} - -@end - -@implementation RTCMediaConstraints (internal) - -- (const webrtc::RTCMediaConstraintsNative*)constraints { - return _constraints.get(); -} - -@end diff --git a/talk/app/webrtc/objc/RTCMediaConstraintsNative.cc b/talk/app/webrtc/objc/RTCMediaConstraintsNative.cc deleted file mode 100644 index e502639521..0000000000 --- a/talk/app/webrtc/objc/RTCMediaConstraintsNative.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "talk/app/webrtc/objc/RTCMediaConstraintsNative.h" - -namespace webrtc { - -RTCMediaConstraintsNative::~RTCMediaConstraintsNative() {} - -RTCMediaConstraintsNative::RTCMediaConstraintsNative() {} - -RTCMediaConstraintsNative::RTCMediaConstraintsNative( - const MediaConstraintsInterface::Constraints& mandatory, - const MediaConstraintsInterface::Constraints& optional) - : mandatory_(mandatory), optional_(optional) {} - -const MediaConstraintsInterface::Constraints& -RTCMediaConstraintsNative::GetMandatory() const { - return mandatory_; -} - -const MediaConstraintsInterface::Constraints& -RTCMediaConstraintsNative::GetOptional() const { - return optional_; -} - -} // namespace webrtc diff --git a/talk/app/webrtc/objc/RTCMediaConstraintsNative.h b/talk/app/webrtc/objc/RTCMediaConstraintsNative.h deleted file mode 100644 index 6948465807..0000000000 --- a/talk/app/webrtc/objc/RTCMediaConstraintsNative.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_OBJC_RTCMEDIACONSTRAINTSNATIVE_H_ -#define TALK_APP_WEBRTC_OBJC_RTCMEDIACONSTRAINTSNATIVE_H_ - -#include "webrtc/api/mediaconstraintsinterface.h" - -namespace webrtc { -class RTCMediaConstraintsNative : public MediaConstraintsInterface { - public: - virtual ~RTCMediaConstraintsNative(); - RTCMediaConstraintsNative(); - RTCMediaConstraintsNative( - const MediaConstraintsInterface::Constraints& mandatory, - const MediaConstraintsInterface::Constraints& optional); - virtual const Constraints& GetMandatory() const; - virtual const Constraints& GetOptional() const; - - private: - MediaConstraintsInterface::Constraints mandatory_; - MediaConstraintsInterface::Constraints optional_; -}; -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_OBJC_RTCMEDIACONSTRAINTSNATIVE_H_ diff --git a/talk/app/webrtc/objc/RTCMediaSource+Internal.h b/talk/app/webrtc/objc/RTCMediaSource+Internal.h deleted file mode 100644 index 2620cfd1b9..0000000000 --- a/talk/app/webrtc/objc/RTCMediaSource+Internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaSource.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCMediaSource (Internal) - -@property(nonatomic, assign, readonly) - rtc::scoped_refptr mediaSource; - -- (id)initWithMediaSource: - (rtc::scoped_refptr)mediaSource; - -@end diff --git a/talk/app/webrtc/objc/RTCMediaSource.mm b/talk/app/webrtc/objc/RTCMediaSource.mm deleted file mode 100644 index 8d2bb1f417..0000000000 --- a/talk/app/webrtc/objc/RTCMediaSource.mm +++ /dev/null @@ -1,65 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCMediaSource+Internal.h" - -#import "RTCEnumConverter.h" - -@implementation RTCMediaSource { - rtc::scoped_refptr _mediaSource; -} - -- (RTCSourceState)state { - return [RTCEnumConverter convertSourceStateToObjC:self.mediaSource->state()]; -} - -@end - -@implementation RTCMediaSource (Internal) - -- (id)initWithMediaSource: - (rtc::scoped_refptr)mediaSource { - if (!mediaSource) { - NSAssert(NO, @"nil arguments not allowed"); - self = nil; - return nil; - } - if ((self = [super init])) { - _mediaSource = mediaSource; - } - return self; -} - -- (rtc::scoped_refptr)mediaSource { - return _mediaSource; -} - -@end diff --git a/talk/app/webrtc/objc/RTCMediaStream+Internal.h b/talk/app/webrtc/objc/RTCMediaStream+Internal.h deleted file mode 100644 index 2f17a17dd9..0000000000 --- a/talk/app/webrtc/objc/RTCMediaStream+Internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaStream.h" - -#include "webrtc/api/mediastreamtrack.h" - -@interface RTCMediaStream (Internal) - -@property(nonatomic, assign, readonly) - rtc::scoped_refptr mediaStream; - -- (id)initWithMediaStream: - (rtc::scoped_refptr)mediaStream; - -@end diff --git a/talk/app/webrtc/objc/RTCMediaStream.mm b/talk/app/webrtc/objc/RTCMediaStream.mm deleted file mode 100644 index 543a569930..0000000000 --- a/talk/app/webrtc/objc/RTCMediaStream.mm +++ /dev/null @@ -1,146 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCMediaStream+Internal.h" - -#import "RTCAudioTrack+Internal.h" -#import "RTCMediaStreamTrack+Internal.h" -#import "RTCVideoTrack+Internal.h" - -#include "webrtc/api/mediastreaminterface.h" - -@implementation RTCMediaStream { - NSMutableArray* _audioTracks; - NSMutableArray* _videoTracks; - rtc::scoped_refptr _mediaStream; -} - -- (NSString*)description { - return [NSString stringWithFormat:@"[%@:A=%lu:V=%lu]", - [self label], - (unsigned long)[self.audioTracks count], - (unsigned long)[self.videoTracks count]]; -} - -- (NSArray*)audioTracks { - return [_audioTracks copy]; -} - -- (NSArray*)videoTracks { - return [_videoTracks copy]; -} - -- (NSString*)label { - return @(self.mediaStream->label().c_str()); -} - -- (BOOL)addAudioTrack:(RTCAudioTrack*)track { - if (self.mediaStream->AddTrack(track.audioTrack)) { - [_audioTracks addObject:track]; - return YES; - } - return NO; -} - -- (BOOL)addVideoTrack:(RTCVideoTrack*)track { - if (self.mediaStream->AddTrack(track.nativeVideoTrack)) { - [_videoTracks addObject:track]; - return YES; - } - return NO; -} - -- (BOOL)removeAudioTrack:(RTCAudioTrack*)track { - NSUInteger index = [_audioTracks indexOfObjectIdenticalTo:track]; - NSAssert(index != NSNotFound, - @"|removeAudioTrack| called on unexpected RTCAudioTrack"); - if (index != NSNotFound && self.mediaStream->RemoveTrack(track.audioTrack)) { - [_audioTracks removeObjectAtIndex:index]; - return YES; - } - return NO; -} - -- (BOOL)removeVideoTrack:(RTCVideoTrack*)track { - NSUInteger index = [_videoTracks indexOfObjectIdenticalTo:track]; - NSAssert(index != NSNotFound, - @"|removeAudioTrack| called on unexpected RTCVideoTrack"); - if (index != NSNotFound && - self.mediaStream->RemoveTrack(track.nativeVideoTrack)) { - [_videoTracks removeObjectAtIndex:index]; - return YES; - } - return NO; -} - -@end - -@implementation RTCMediaStream (Internal) - -- (id)initWithMediaStream: - (rtc::scoped_refptr)mediaStream { - if (!mediaStream) { - NSAssert(NO, @"nil arguments not allowed"); - self = nil; - return nil; - } - if ((self = [super init])) { - webrtc::AudioTrackVector audio_tracks = mediaStream->GetAudioTracks(); - webrtc::VideoTrackVector video_tracks = mediaStream->GetVideoTracks(); - - _audioTracks = [NSMutableArray arrayWithCapacity:audio_tracks.size()]; - _videoTracks = [NSMutableArray arrayWithCapacity:video_tracks.size()]; - _mediaStream = mediaStream; - - for (size_t i = 0; i < audio_tracks.size(); ++i) { - rtc::scoped_refptr track = - audio_tracks[i]; - RTCAudioTrack* audioTrack = - [[RTCAudioTrack alloc] initWithMediaTrack:track]; - [_audioTracks addObject:audioTrack]; - } - - for (size_t i = 0; i < video_tracks.size(); ++i) { - rtc::scoped_refptr track = - video_tracks[i]; - RTCVideoTrack* videoTrack = - [[RTCVideoTrack alloc] initWithMediaTrack:track]; - [_videoTracks addObject:videoTrack]; - } - } - return self; -} - -- (rtc::scoped_refptr)mediaStream { - return _mediaStream; -} - -@end diff --git a/talk/app/webrtc/objc/RTCMediaStreamTrack+Internal.h b/talk/app/webrtc/objc/RTCMediaStreamTrack+Internal.h deleted file mode 100644 index 88c83fff3c..0000000000 --- a/talk/app/webrtc/objc/RTCMediaStreamTrack+Internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaStreamTrack.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCMediaStreamTrack (Internal) - -@property(nonatomic, assign, readonly) - rtc::scoped_refptr mediaTrack; - -- (id)initWithMediaTrack: - (rtc::scoped_refptr)mediaTrack; - -@end diff --git a/talk/app/webrtc/objc/RTCMediaStreamTrack.mm b/talk/app/webrtc/objc/RTCMediaStreamTrack.mm deleted file mode 100644 index 616bd36ce1..0000000000 --- a/talk/app/webrtc/objc/RTCMediaStreamTrack.mm +++ /dev/null @@ -1,124 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCEnumConverter.h" -#import "RTCMediaStreamTrack+Internal.h" - -#include - -namespace webrtc { - -class RTCMediaStreamTrackObserver : public ObserverInterface { - public: - RTCMediaStreamTrackObserver(RTCMediaStreamTrack* track) { _track = track; } - - void OnChanged() override { - [_track.delegate mediaStreamTrackDidChange:_track]; - } - - private: - __weak RTCMediaStreamTrack* _track; -}; -} - -@implementation RTCMediaStreamTrack { - rtc::scoped_refptr _mediaTrack; - std::unique_ptr _observer; -} - -@synthesize label; - -- (BOOL)isEqual:(id)other { - // Equality is purely based on the label just like the C++ implementation. - if (self == other) - return YES; - if (![other isKindOfClass:[self class]] || - ![self isKindOfClass:[other class]]) { - return NO; - } - RTCMediaStreamTrack* otherMediaStream = (RTCMediaStreamTrack*)other; - return [self.label isEqual:otherMediaStream.label]; -} - -- (NSUInteger)hash { - return [self.label hash]; -} - -- (NSString*)kind { - return @(self.mediaTrack->kind().c_str()); -} - -- (NSString*)label { - return @(self.mediaTrack->id().c_str()); -} - -- (BOOL)isEnabled { - return self.mediaTrack->enabled(); -} - -- (BOOL)setEnabled:(BOOL)enabled { - return self.mediaTrack->set_enabled(enabled); -} - -- (RTCTrackState)state { - return [RTCEnumConverter convertTrackStateToObjC:self.mediaTrack->state()]; -} - -@end - -@implementation RTCMediaStreamTrack (Internal) - -- (id)initWithMediaTrack: - (rtc::scoped_refptr) - mediaTrack { - if (!mediaTrack) { - NSAssert(NO, @"nil arguments not allowed"); - self = nil; - return nil; - } - if (self = [super init]) { - _mediaTrack = mediaTrack; - label = @(mediaTrack->id().c_str()); - _observer.reset(new webrtc::RTCMediaStreamTrackObserver(self)); - _mediaTrack->RegisterObserver(_observer.get()); - } - return self; -} - -- (void)dealloc { - _mediaTrack->UnregisterObserver(_observer.get()); -} - -- (rtc::scoped_refptr)mediaTrack { - return _mediaTrack; -} - -@end diff --git a/talk/app/webrtc/objc/RTCNSGLVideoView.m b/talk/app/webrtc/objc/RTCNSGLVideoView.m deleted file mode 100644 index 34a866bd06..0000000000 --- a/talk/app/webrtc/objc/RTCNSGLVideoView.m +++ /dev/null @@ -1,158 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCNSGLVideoView.h" - -#import -#import -#import "RTCI420Frame.h" -#import "RTCOpenGLVideoRenderer.h" - -@interface RTCNSGLVideoView () -// |i420Frame| is set when we receive a frame from a worker thread and is read -// from the display link callback so atomicity is required. -@property(atomic, strong) RTCI420Frame* i420Frame; -@property(atomic, strong) RTCOpenGLVideoRenderer* glRenderer; -- (void)drawFrame; -@end - -static CVReturn OnDisplayLinkFired(CVDisplayLinkRef displayLink, - const CVTimeStamp* now, - const CVTimeStamp* outputTime, - CVOptionFlags flagsIn, - CVOptionFlags* flagsOut, - void* displayLinkContext) { - RTCNSGLVideoView* view = (__bridge RTCNSGLVideoView*)displayLinkContext; - [view drawFrame]; - return kCVReturnSuccess; -} - -@implementation RTCNSGLVideoView { - CVDisplayLinkRef _displayLink; -} - -- (void)dealloc { - [self teardownDisplayLink]; -} - -- (void)drawRect:(NSRect)rect { - [self drawFrame]; -} - -- (void)reshape { - [super reshape]; - NSRect frame = [self frame]; - CGLLockContext([[self openGLContext] CGLContextObj]); - glViewport(0, 0, frame.size.width, frame.size.height); - CGLUnlockContext([[self openGLContext] CGLContextObj]); -} - -- (void)lockFocus { - NSOpenGLContext* context = [self openGLContext]; - [super lockFocus]; - if ([context view] != self) { - [context setView:self]; - } - [context makeCurrentContext]; -} - -- (void)prepareOpenGL { - [super prepareOpenGL]; - if (!self.glRenderer) { - self.glRenderer = - [[RTCOpenGLVideoRenderer alloc] initWithContext:[self openGLContext]]; - } - [self.glRenderer setupGL]; - [self setupDisplayLink]; -} - -- (void)clearGLContext { - [self.glRenderer teardownGL]; - self.glRenderer = nil; - [super clearGLContext]; -} - -#pragma mark - RTCVideoRenderer - -// These methods may be called on non-main thread. -- (void)setSize:(CGSize)size { - dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate videoView:self didChangeVideoSize:size]; - }); -} - -- (void)renderFrame:(RTCI420Frame*)frame { - self.i420Frame = frame; -} - -#pragma mark - Private - -- (void)drawFrame { - RTCI420Frame* i420Frame = self.i420Frame; - if (self.glRenderer.lastDrawnFrame != i420Frame) { - // This method may be called from CVDisplayLink callback which isn't on the - // main thread so we have to lock the GL context before drawing. - CGLLockContext([[self openGLContext] CGLContextObj]); - [self.glRenderer drawFrame:i420Frame]; - CGLUnlockContext([[self openGLContext] CGLContextObj]); - } -} - -- (void)setupDisplayLink { - if (_displayLink) { - return; - } - // Synchronize buffer swaps with vertical refresh rate. - GLint swapInt = 1; - [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; - - // Create display link. - CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink); - CVDisplayLinkSetOutputCallback(_displayLink, - &OnDisplayLinkFired, - (__bridge void*)self); - // Set the display link for the current renderer. - CGLContextObj cglContext = [[self openGLContext] CGLContextObj]; - CGLPixelFormatObj cglPixelFormat = [[self pixelFormat] CGLPixelFormatObj]; - CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext( - _displayLink, cglContext, cglPixelFormat); - CVDisplayLinkStart(_displayLink); -} - -- (void)teardownDisplayLink { - if (!_displayLink) { - return; - } - CVDisplayLinkRelease(_displayLink); - _displayLink = NULL; -} - -@end diff --git a/talk/app/webrtc/objc/RTCOpenGLVideoRenderer.mm b/talk/app/webrtc/objc/RTCOpenGLVideoRenderer.mm deleted file mode 100644 index b0f1b80cc0..0000000000 --- a/talk/app/webrtc/objc/RTCOpenGLVideoRenderer.mm +++ /dev/null @@ -1,503 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCOpenGLVideoRenderer.h" - -#include - -#include - -#if TARGET_OS_IPHONE -#import -#else -#import -#endif - -#import "RTCI420Frame.h" - -// TODO(tkchin): check and log openGL errors. Methods here return BOOLs in -// anticipation of that happening in the future. - -#if TARGET_OS_IPHONE -#define RTC_PIXEL_FORMAT GL_LUMINANCE -#define SHADER_VERSION -#define VERTEX_SHADER_IN "attribute" -#define VERTEX_SHADER_OUT "varying" -#define FRAGMENT_SHADER_IN "varying" -#define FRAGMENT_SHADER_OUT -#define FRAGMENT_SHADER_COLOR "gl_FragColor" -#define FRAGMENT_SHADER_TEXTURE "texture2D" -#else -#define RTC_PIXEL_FORMAT GL_RED -#define SHADER_VERSION "#version 150\n" -#define VERTEX_SHADER_IN "in" -#define VERTEX_SHADER_OUT "out" -#define FRAGMENT_SHADER_IN "in" -#define FRAGMENT_SHADER_OUT "out vec4 fragColor;\n" -#define FRAGMENT_SHADER_COLOR "fragColor" -#define FRAGMENT_SHADER_TEXTURE "texture" -#endif - -// Vertex shader doesn't do anything except pass coordinates through. -static const char kVertexShaderSource[] = - SHADER_VERSION - VERTEX_SHADER_IN " vec2 position;\n" - VERTEX_SHADER_IN " vec2 texcoord;\n" - VERTEX_SHADER_OUT " vec2 v_texcoord;\n" - "void main() {\n" - " gl_Position = vec4(position.x, position.y, 0.0, 1.0);\n" - " v_texcoord = texcoord;\n" - "}\n"; - -// Fragment shader converts YUV values from input textures into a final RGB -// pixel. The conversion formula is from http://www.fourcc.org/fccyvrgb.php. -static const char kFragmentShaderSource[] = - SHADER_VERSION - "precision highp float;" - FRAGMENT_SHADER_IN " vec2 v_texcoord;\n" - "uniform lowp sampler2D s_textureY;\n" - "uniform lowp sampler2D s_textureU;\n" - "uniform lowp sampler2D s_textureV;\n" - FRAGMENT_SHADER_OUT - "void main() {\n" - " float y, u, v, r, g, b;\n" - " y = " FRAGMENT_SHADER_TEXTURE "(s_textureY, v_texcoord).r;\n" - " u = " FRAGMENT_SHADER_TEXTURE "(s_textureU, v_texcoord).r;\n" - " v = " FRAGMENT_SHADER_TEXTURE "(s_textureV, v_texcoord).r;\n" - " u = u - 0.5;\n" - " v = v - 0.5;\n" - " r = y + 1.403 * v;\n" - " g = y - 0.344 * u - 0.714 * v;\n" - " b = y + 1.770 * u;\n" - " " FRAGMENT_SHADER_COLOR " = vec4(r, g, b, 1.0);\n" - " }\n"; - -// Compiles a shader of the given |type| with GLSL source |source| and returns -// the shader handle or 0 on error. -GLuint CreateShader(GLenum type, const GLchar* source) { - GLuint shader = glCreateShader(type); - if (!shader) { - return 0; - } - glShaderSource(shader, 1, &source, NULL); - glCompileShader(shader); - GLint compileStatus = GL_FALSE; - glGetShaderiv(shader, GL_COMPILE_STATUS, &compileStatus); - if (compileStatus == GL_FALSE) { - glDeleteShader(shader); - shader = 0; - } - return shader; -} - -// Links a shader program with the given vertex and fragment shaders and -// returns the program handle or 0 on error. -GLuint CreateProgram(GLuint vertexShader, GLuint fragmentShader) { - if (vertexShader == 0 || fragmentShader == 0) { - return 0; - } - GLuint program = glCreateProgram(); - if (!program) { - return 0; - } - glAttachShader(program, vertexShader); - glAttachShader(program, fragmentShader); - glLinkProgram(program); - GLint linkStatus = GL_FALSE; - glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); - if (linkStatus == GL_FALSE) { - glDeleteProgram(program); - program = 0; - } - return program; -} - -// When modelview and projection matrices are identity (default) the world is -// contained in the square around origin with unit size 2. Drawing to these -// coordinates is equivalent to drawing to the entire screen. The texture is -// stretched over that square using texture coordinates (u, v) that range -// from (0, 0) to (1, 1) inclusive. Texture coordinates are flipped vertically -// here because the incoming frame has origin in upper left hand corner but -// OpenGL expects origin in bottom left corner. -const GLfloat gVertices[] = { - // X, Y, U, V. - -1, -1, 0, 1, // Bottom left. - 1, -1, 1, 1, // Bottom right. - 1, 1, 1, 0, // Top right. - -1, 1, 0, 0, // Top left. -}; - -// |kNumTextures| must not exceed 8, which is the limit in OpenGLES2. Two sets -// of 3 textures are used here, one for each of the Y, U and V planes. Having -// two sets alleviates CPU blockage in the event that the GPU is asked to render -// to a texture that is already in use. -static const GLsizei kNumTextureSets = 2; -static const GLsizei kNumTextures = 3 * kNumTextureSets; - -@implementation RTCOpenGLVideoRenderer { -#if TARGET_OS_IPHONE - EAGLContext* _context; -#else - NSOpenGLContext* _context; -#endif - BOOL _isInitialized; - NSUInteger _currentTextureSet; - // Handles for OpenGL constructs. - GLuint _textures[kNumTextures]; - GLuint _program; -#if !TARGET_OS_IPHONE - GLuint _vertexArray; -#endif - GLuint _vertexBuffer; - GLint _position; - GLint _texcoord; - GLint _ySampler; - GLint _uSampler; - GLint _vSampler; - // Used to create a non-padded plane for GPU upload when we receive padded - // frames. - std::unique_ptr _planeBuffer; -} - -+ (void)initialize { - // Disable dithering for performance. - glDisable(GL_DITHER); -} - -#if TARGET_OS_IPHONE -- (instancetype)initWithContext:(EAGLContext*)context { -#else -- (instancetype)initWithContext:(NSOpenGLContext*)context { -#endif - NSAssert(context != nil, @"context cannot be nil"); - if (self = [super init]) { - _context = context; - } - return self; -} - -- (BOOL)drawFrame:(RTCI420Frame*)frame { - if (!_isInitialized) { - return NO; - } - if (_lastDrawnFrame == frame) { - return NO; - } - [self ensureGLContext]; - glClear(GL_COLOR_BUFFER_BIT); - if (frame) { - if (![self updateTextureSizesForFrame:frame] || - ![self updateTextureDataForFrame:frame]) { - return NO; - } -#if !TARGET_OS_IPHONE - glBindVertexArray(_vertexArray); -#endif - glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - } -#if !TARGET_OS_IPHONE - [_context flushBuffer]; -#endif - _lastDrawnFrame = frame; - return YES; -} - -- (void)setupGL { - if (_isInitialized) { - return; - } - [self ensureGLContext]; - if (![self setupProgram]) { - return; - } - if (![self setupTextures]) { - return; - } - if (![self setupVertices]) { - return; - } - glUseProgram(_program); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - _isInitialized = YES; -} - -- (void)teardownGL { - if (!_isInitialized) { - return; - } - [self ensureGLContext]; - glDeleteProgram(_program); - _program = 0; - glDeleteTextures(kNumTextures, _textures); - glDeleteBuffers(1, &_vertexBuffer); - _vertexBuffer = 0; -#if !TARGET_OS_IPHONE - glDeleteVertexArrays(1, &_vertexArray); -#endif - _isInitialized = NO; -} - -#pragma mark - Private - -- (void)ensureGLContext { - NSAssert(_context, @"context shouldn't be nil"); -#if TARGET_OS_IPHONE - if ([EAGLContext currentContext] != _context) { - [EAGLContext setCurrentContext:_context]; - } -#else - if ([NSOpenGLContext currentContext] != _context) { - [_context makeCurrentContext]; - } -#endif -} - -- (BOOL)setupProgram { - NSAssert(!_program, @"program already set up"); - GLuint vertexShader = CreateShader(GL_VERTEX_SHADER, kVertexShaderSource); - NSAssert(vertexShader, @"failed to create vertex shader"); - GLuint fragmentShader = - CreateShader(GL_FRAGMENT_SHADER, kFragmentShaderSource); - NSAssert(fragmentShader, @"failed to create fragment shader"); - _program = CreateProgram(vertexShader, fragmentShader); - // Shaders are created only to generate program. - if (vertexShader) { - glDeleteShader(vertexShader); - } - if (fragmentShader) { - glDeleteShader(fragmentShader); - } - if (!_program) { - return NO; - } - _position = glGetAttribLocation(_program, "position"); - _texcoord = glGetAttribLocation(_program, "texcoord"); - _ySampler = glGetUniformLocation(_program, "s_textureY"); - _uSampler = glGetUniformLocation(_program, "s_textureU"); - _vSampler = glGetUniformLocation(_program, "s_textureV"); - if (_position < 0 || _texcoord < 0 || _ySampler < 0 || _uSampler < 0 || - _vSampler < 0) { - return NO; - } - return YES; -} - -- (BOOL)setupTextures { - glGenTextures(kNumTextures, _textures); - // Set parameters for each of the textures we created. - for (GLsizei i = 0; i < kNumTextures; i++) { - glActiveTexture(GL_TEXTURE0 + i); - glBindTexture(GL_TEXTURE_2D, _textures[i]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } - return YES; -} - -- (BOOL)updateTextureSizesForFrame:(RTCI420Frame*)frame { - if (frame.height == _lastDrawnFrame.height && - frame.width == _lastDrawnFrame.width && - frame.chromaWidth == _lastDrawnFrame.chromaWidth && - frame.chromaHeight == _lastDrawnFrame.chromaHeight) { - return YES; - } - GLsizei lumaWidth = frame.width; - GLsizei lumaHeight = frame.height; - GLsizei chromaWidth = frame.chromaWidth; - GLsizei chromaHeight = frame.chromaHeight; - for (GLint i = 0; i < kNumTextureSets; i++) { - glActiveTexture(GL_TEXTURE0 + i * 3); - glTexImage2D(GL_TEXTURE_2D, - 0, - RTC_PIXEL_FORMAT, - lumaWidth, - lumaHeight, - 0, - RTC_PIXEL_FORMAT, - GL_UNSIGNED_BYTE, - 0); - glActiveTexture(GL_TEXTURE0 + i * 3 + 1); - glTexImage2D(GL_TEXTURE_2D, - 0, - RTC_PIXEL_FORMAT, - chromaWidth, - chromaHeight, - 0, - RTC_PIXEL_FORMAT, - GL_UNSIGNED_BYTE, - 0); - glActiveTexture(GL_TEXTURE0 + i * 3 + 2); - glTexImage2D(GL_TEXTURE_2D, - 0, - RTC_PIXEL_FORMAT, - chromaWidth, - chromaHeight, - 0, - RTC_PIXEL_FORMAT, - GL_UNSIGNED_BYTE, - 0); - } - if (frame.yPitch != frame.width || frame.uPitch != frame.chromaWidth || - frame.vPitch != frame.chromaWidth) { - _planeBuffer.reset(new uint8_t[frame.width * frame.height]); - } else { - _planeBuffer.reset(); - } - return YES; -} - -- (void)uploadPlane:(const uint8_t*)plane - sampler:(GLint)sampler - offset:(NSUInteger)offset - width:(NSUInteger)width - height:(NSUInteger)height - stride:(NSInteger)stride { - glActiveTexture(GL_TEXTURE0 + offset); - // When setting texture sampler uniforms, the texture index is used not - // the texture handle. - glUniform1i(sampler, offset); -#if TARGET_OS_IPHONE - BOOL hasUnpackRowLength = _context.API == kEAGLRenderingAPIOpenGLES3; -#else - BOOL hasUnpackRowLength = YES; -#endif - const uint8_t* uploadPlane = plane; - if (stride != width) { - if (hasUnpackRowLength) { - // GLES3 allows us to specify stride. - glPixelStorei(GL_UNPACK_ROW_LENGTH, stride); - glTexImage2D(GL_TEXTURE_2D, - 0, - RTC_PIXEL_FORMAT, - width, - height, - 0, - RTC_PIXEL_FORMAT, - GL_UNSIGNED_BYTE, - uploadPlane); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - return; - } else { - // Make an unpadded copy and upload that instead. Quick profiling showed - // that this is faster than uploading row by row using glTexSubImage2D. - uint8_t* unpaddedPlane = _planeBuffer.get(); - for (NSUInteger y = 0; y < height; ++y) { - memcpy(unpaddedPlane + y * width, plane + y * stride, width); - } - uploadPlane = unpaddedPlane; - } - } - glTexImage2D(GL_TEXTURE_2D, - 0, - RTC_PIXEL_FORMAT, - width, - height, - 0, - RTC_PIXEL_FORMAT, - GL_UNSIGNED_BYTE, - uploadPlane); -} - -- (BOOL)updateTextureDataForFrame:(RTCI420Frame*)frame { - NSUInteger textureOffset = _currentTextureSet * 3; - NSAssert(textureOffset + 3 <= kNumTextures, @"invalid offset"); - - [self uploadPlane:frame.yPlane - sampler:_ySampler - offset:textureOffset - width:frame.width - height:frame.height - stride:frame.yPitch]; - - [self uploadPlane:frame.uPlane - sampler:_uSampler - offset:textureOffset + 1 - width:frame.chromaWidth - height:frame.chromaHeight - stride:frame.uPitch]; - - [self uploadPlane:frame.vPlane - sampler:_vSampler - offset:textureOffset + 2 - width:frame.chromaWidth - height:frame.chromaHeight - stride:frame.vPitch]; - - _currentTextureSet = (_currentTextureSet + 1) % kNumTextureSets; - return YES; -} - -- (BOOL)setupVertices { -#if !TARGET_OS_IPHONE - NSAssert(!_vertexArray, @"vertex array already set up"); - glGenVertexArrays(1, &_vertexArray); - if (!_vertexArray) { - return NO; - } - glBindVertexArray(_vertexArray); -#endif - NSAssert(!_vertexBuffer, @"vertex buffer already set up"); - glGenBuffers(1, &_vertexBuffer); - if (!_vertexBuffer) { -#if !TARGET_OS_IPHONE - glDeleteVertexArrays(1, &_vertexArray); - _vertexArray = 0; -#endif - return NO; - } - glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); - glBufferData(GL_ARRAY_BUFFER, sizeof(gVertices), gVertices, GL_DYNAMIC_DRAW); - - // Read position attribute from |gVertices| with size of 2 and stride of 4 - // beginning at the start of the array. The last argument indicates offset - // of data within |gVertices| as supplied to the vertex buffer. - glVertexAttribPointer( - _position, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (void*)0); - glEnableVertexAttribArray(_position); - - // Read texcoord attribute from |gVertices| with size of 2 and stride of 4 - // beginning at the first texcoord in the array. The last argument indicates - // offset of data within |gVertices| as supplied to the vertex buffer. - glVertexAttribPointer(_texcoord, - 2, - GL_FLOAT, - GL_FALSE, - 4 * sizeof(GLfloat), - (void*)(2 * sizeof(GLfloat))); - glEnableVertexAttribArray(_texcoord); - - return YES; -} - -@end diff --git a/talk/app/webrtc/objc/RTCPair.m b/talk/app/webrtc/objc/RTCPair.m deleted file mode 100644 index 2171c9ecd5..0000000000 --- a/talk/app/webrtc/objc/RTCPair.m +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCPair.h" - -@implementation RTCPair - -@synthesize key = _key; -@synthesize value = _value; - -- (id)initWithKey:(NSString*)key value:(NSString*)value { - if ((self = [super init])) { - _key = [key copy]; - _value = [value copy]; - } - return self; -} - -- (NSString*)description { - return [NSString stringWithFormat:@"%@: %@", _key, _value]; -} - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnection+Internal.h b/talk/app/webrtc/objc/RTCPeerConnection+Internal.h deleted file mode 100644 index 136fdf5840..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnection+Internal.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCPeerConnection.h" - -#import "RTCPeerConnectionDelegate.h" - -#include "webrtc/api/peerconnectioninterface.h" - -@interface RTCPeerConnection (Internal) - -@property(nonatomic, assign, readonly) - rtc::scoped_refptr peerConnection; - -- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface *)factory - iceServers:(const webrtc::PeerConnectionInterface::IceServers &)iceServers - constraints:(const webrtc::MediaConstraintsInterface *)constraints; - -- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface *)factory - config:(const webrtc::PeerConnectionInterface::RTCConfiguration &)config - constraints:(const webrtc::MediaConstraintsInterface *)constraints - delegate:(id)delegate; - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnection.mm b/talk/app/webrtc/objc/RTCPeerConnection.mm deleted file mode 100644 index 2491cf7c97..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnection.mm +++ /dev/null @@ -1,311 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCPeerConnection+Internal.h" - -#import "RTCDataChannel+Internal.h" -#import "RTCEnumConverter.h" -#import "RTCICECandidate+Internal.h" -#import "RTCICEServer+Internal.h" -#import "RTCMediaConstraints+Internal.h" -#import "RTCMediaStream+Internal.h" -#import "RTCMediaStreamTrack+Internal.h" -#import "RTCPeerConnectionObserver.h" -#import "RTCSessionDescription+Internal.h" -#import "RTCSessionDescription.h" -#import "RTCSessionDescriptionDelegate.h" -#import "RTCStatsDelegate.h" -#import "RTCStatsReport+Internal.h" - -#include - -#include "webrtc/api/jsep.h" - -NSString* const kRTCSessionDescriptionDelegateErrorDomain = @"RTCSDPError"; -int const kRTCSessionDescriptionDelegateErrorCode = -1; - -namespace webrtc { - -class RTCCreateSessionDescriptionObserver - : public CreateSessionDescriptionObserver { - public: - RTCCreateSessionDescriptionObserver( - id delegate, - RTCPeerConnection* peerConnection) { - _delegate = delegate; - _peerConnection = peerConnection; - } - - void OnSuccess(SessionDescriptionInterface* desc) override { - RTCSessionDescription* session = - [[RTCSessionDescription alloc] initWithSessionDescription:desc]; - [_delegate peerConnection:_peerConnection - didCreateSessionDescription:session - error:nil]; - delete desc; - } - - void OnFailure(const std::string& error) override { - NSString* str = @(error.c_str()); - NSError* err = - [NSError errorWithDomain:kRTCSessionDescriptionDelegateErrorDomain - code:kRTCSessionDescriptionDelegateErrorCode - userInfo:@{@"error" : str}]; - [_delegate peerConnection:_peerConnection - didCreateSessionDescription:nil - error:err]; - } - - private: - id _delegate; - RTCPeerConnection* _peerConnection; -}; - -class RTCSetSessionDescriptionObserver : public SetSessionDescriptionObserver { - public: - RTCSetSessionDescriptionObserver(id delegate, - RTCPeerConnection* peerConnection) { - _delegate = delegate; - _peerConnection = peerConnection; - } - - void OnSuccess() override { - [_delegate peerConnection:_peerConnection - didSetSessionDescriptionWithError:nil]; - } - - void OnFailure(const std::string& error) override { - NSString* str = @(error.c_str()); - NSError* err = - [NSError errorWithDomain:kRTCSessionDescriptionDelegateErrorDomain - code:kRTCSessionDescriptionDelegateErrorCode - userInfo:@{@"error" : str}]; - [_delegate peerConnection:_peerConnection - didSetSessionDescriptionWithError:err]; - } - - private: - id _delegate; - RTCPeerConnection* _peerConnection; -}; - -class RTCStatsObserver : public StatsObserver { - public: - RTCStatsObserver(id delegate, - RTCPeerConnection* peerConnection) { - _delegate = delegate; - _peerConnection = peerConnection; - } - - void OnComplete(const StatsReports& reports) override { - NSMutableArray* stats = [NSMutableArray arrayWithCapacity:reports.size()]; - for (const auto* report : reports) { - RTCStatsReport* statsReport = - [[RTCStatsReport alloc] initWithStatsReport:*report]; - [stats addObject:statsReport]; - } - [_delegate peerConnection:_peerConnection didGetStats:stats]; - } - - private: - id _delegate; - RTCPeerConnection* _peerConnection; -}; -} - -@implementation RTCPeerConnection { - NSMutableArray* _localStreams; - std::unique_ptr _observer; - rtc::scoped_refptr _peerConnection; -} - -- (BOOL)addICECandidate:(RTCICECandidate*)candidate { - std::unique_ptr iceCandidate( - candidate.candidate); - return self.peerConnection->AddIceCandidate(iceCandidate.get()); -} - -- (BOOL)addStream:(RTCMediaStream*)stream { - BOOL ret = self.peerConnection->AddStream(stream.mediaStream); - if (!ret) { - return NO; - } - [_localStreams addObject:stream]; - return YES; -} - -- (RTCDataChannel*)createDataChannelWithLabel:(NSString*)label - config:(RTCDataChannelInit*)config { - std::string labelString([label UTF8String]); - rtc::scoped_refptr dataChannel = - self.peerConnection->CreateDataChannel(labelString, - config.dataChannelInit); - return [[RTCDataChannel alloc] initWithDataChannel:dataChannel]; -} - -- (void)createAnswerWithDelegate:(id)delegate - constraints:(RTCMediaConstraints*)constraints { - rtc::scoped_refptr - observer(new rtc::RefCountedObject< - webrtc::RTCCreateSessionDescriptionObserver>(delegate, self)); - self.peerConnection->CreateAnswer(observer, constraints.constraints); -} - -- (void)createOfferWithDelegate:(id)delegate - constraints:(RTCMediaConstraints*)constraints { - rtc::scoped_refptr - observer(new rtc::RefCountedObject< - webrtc::RTCCreateSessionDescriptionObserver>(delegate, self)); - self.peerConnection->CreateOffer(observer, constraints.constraints); -} - -- (void)removeStream:(RTCMediaStream*)stream { - self.peerConnection->RemoveStream(stream.mediaStream); - [_localStreams removeObject:stream]; -} - -- (void)setLocalDescriptionWithDelegate: - (id)delegate - sessionDescription:(RTCSessionDescription*)sdp { - rtc::scoped_refptr observer( - new rtc::RefCountedObject( - delegate, self)); - self.peerConnection->SetLocalDescription(observer, sdp.sessionDescription); -} - -- (void)setRemoteDescriptionWithDelegate: - (id)delegate - sessionDescription:(RTCSessionDescription*)sdp { - rtc::scoped_refptr observer( - new rtc::RefCountedObject( - delegate, self)); - self.peerConnection->SetRemoteDescription(observer, sdp.sessionDescription); -} - -- (BOOL)setConfiguration:(RTCConfiguration *)configuration { - std::unique_ptr config( - [configuration createNativeConfiguration]); - if (!config) { - return NO; - } - return self.peerConnection->SetConfiguration(*config); -} - -- (RTCSessionDescription*)localDescription { - const webrtc::SessionDescriptionInterface* sdi = - self.peerConnection->local_description(); - return sdi ? [[RTCSessionDescription alloc] initWithSessionDescription:sdi] - : nil; -} - -- (NSArray*)localStreams { - return [_localStreams copy]; -} - -- (RTCSessionDescription*)remoteDescription { - const webrtc::SessionDescriptionInterface* sdi = - self.peerConnection->remote_description(); - return sdi ? [[RTCSessionDescription alloc] initWithSessionDescription:sdi] - : nil; -} - -- (RTCICEConnectionState)iceConnectionState { - return [RTCEnumConverter - convertIceConnectionStateToObjC:self.peerConnection - ->ice_connection_state()]; -} - -- (RTCICEGatheringState)iceGatheringState { - return [RTCEnumConverter - convertIceGatheringStateToObjC:self.peerConnection - ->ice_gathering_state()]; -} - -- (RTCSignalingState)signalingState { - return [RTCEnumConverter - convertSignalingStateToObjC:self.peerConnection->signaling_state()]; -} - -- (void)close { - self.peerConnection->Close(); -} - -- (BOOL)getStatsWithDelegate:(id)delegate - mediaStreamTrack:(RTCMediaStreamTrack*)mediaStreamTrack - statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel { - rtc::scoped_refptr observer( - new rtc::RefCountedObject(delegate, - self)); - webrtc::PeerConnectionInterface::StatsOutputLevel nativeOutputLevel = - [RTCEnumConverter convertStatsOutputLevelToNative:statsOutputLevel]; - return self.peerConnection->GetStats( - observer, mediaStreamTrack.mediaTrack, nativeOutputLevel); -} - -@end - -@implementation RTCPeerConnection (Internal) - -- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface*)factory - iceServers:(const webrtc::PeerConnectionInterface::IceServers&)iceServers - constraints:(const webrtc::MediaConstraintsInterface*)constraints { - NSParameterAssert(factory != nullptr); - if (self = [super init]) { - webrtc::PeerConnectionInterface::RTCConfiguration config; - config.servers = iceServers; - _observer.reset(new webrtc::RTCPeerConnectionObserver(self)); - _peerConnection = factory->CreatePeerConnection( - config, constraints, nullptr, nullptr, _observer.get()); - _localStreams = [[NSMutableArray alloc] init]; - } - return self; -} - -- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface *)factory - config:(const webrtc::PeerConnectionInterface::RTCConfiguration &)config - constraints:(const webrtc::MediaConstraintsInterface *)constraints - delegate:(id)delegate { - NSParameterAssert(factory); - if (self = [super init]) { - _observer.reset(new webrtc::RTCPeerConnectionObserver(self)); - _peerConnection = - factory->CreatePeerConnection(config, constraints, nullptr, nullptr, _observer.get()); - _localStreams = [[NSMutableArray alloc] init]; - _delegate = delegate; - } - return self; -} - -- (rtc::scoped_refptr)peerConnection { - return _peerConnection; -} - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnectionFactory+Internal.h b/talk/app/webrtc/objc/RTCPeerConnectionFactory+Internal.h deleted file mode 100644 index 113327b7a4..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnectionFactory+Internal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCPeerConnectionFactory.h" - -#include "webrtc/api/peerconnectionfactory.h" - -@interface RTCPeerConnectionFactory () - -@property(nonatomic, assign) rtc::scoped_refptr< - webrtc::PeerConnectionFactoryInterface> nativeFactory; - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnectionFactory.mm b/talk/app/webrtc/objc/RTCPeerConnectionFactory.mm deleted file mode 100644 index 13afa8da23..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnectionFactory.mm +++ /dev/null @@ -1,159 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCPeerConnectionFactory+Internal.h" - -#include -#include - -#import "RTCAudioTrack+Internal.h" -#import "RTCICEServer+Internal.h" -#import "RTCMediaConstraints+Internal.h" -#import "RTCMediaSource+Internal.h" -#import "RTCMediaStream+Internal.h" -#import "RTCMediaStreamTrack+Internal.h" -#import "RTCPeerConnection+Internal.h" -#import "RTCPeerConnectionDelegate.h" -#import "RTCPeerConnectionInterface+Internal.h" -#import "RTCVideoCapturer+Internal.h" -#import "RTCVideoSource+Internal.h" -#import "RTCVideoTrack+Internal.h" - -#include "webrtc/api/audiotrack.h" -#include "webrtc/api/mediastreaminterface.h" -#include "webrtc/api/peerconnectioninterface.h" -#include "webrtc/api/videotrack.h" -#include "webrtc/base/logging.h" -#include "webrtc/base/ssladapter.h" - -@implementation RTCPeerConnectionFactory { - std::unique_ptr _networkThread; - std::unique_ptr _workerThread; - std::unique_ptr _signalingThread; -} - -@synthesize nativeFactory = _nativeFactory; - -+ (void)initializeSSL { - BOOL initialized = rtc::InitializeSSL(); - NSAssert(initialized, @"Failed to initialize SSL library"); -} - -+ (void)deinitializeSSL { - BOOL deinitialized = rtc::CleanupSSL(); - NSAssert(deinitialized, @"Failed to deinitialize SSL library"); -} - -- (id)init { - if ((self = [super init])) { - _networkThread = rtc::Thread::CreateWithSocketServer(); - BOOL result = _networkThread->Start(); - NSAssert(result, @"Failed to start network thread."); - - _workerThread = rtc::Thread::Create(); - result = _workerThread->Start(); - NSAssert(result, @"Failed to start worker thread."); - - _signalingThread = rtc::Thread::Create(); - result = _signalingThread->Start(); - NSAssert(result, @"Failed to start signaling thread."); - - _nativeFactory = webrtc::CreatePeerConnectionFactory( - _networkThread.get(), _workerThread.get(), _signalingThread.get(), - nullptr, nullptr, nullptr); - NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); - // Uncomment to get sensitive logs emitted (to stderr or logcat). - // rtc::LogMessage::LogToDebug(rtc::LS_SENSITIVE); - } - return self; -} - -- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration - constraints:(RTCMediaConstraints *)constraints - delegate:(id)delegate { - std::unique_ptr config( - [configuration createNativeConfiguration]); - if (!config) { - return nil; - } - return [[RTCPeerConnection alloc] initWithFactory:self.nativeFactory.get() - config:*config - constraints:constraints.constraints - delegate:delegate]; -} - -- (RTCPeerConnection*) - peerConnectionWithICEServers:(NSArray*)servers - constraints:(RTCMediaConstraints*)constraints - delegate:(id)delegate { - webrtc::PeerConnectionInterface::IceServers iceServers; - for (RTCICEServer* server in servers) { - iceServers.push_back(server.iceServer); - } - RTCPeerConnection* pc = - [[RTCPeerConnection alloc] initWithFactory:self.nativeFactory.get() - iceServers:iceServers - constraints:constraints.constraints]; - pc.delegate = delegate; - return pc; -} - -- (RTCMediaStream*)mediaStreamWithLabel:(NSString*)label { - rtc::scoped_refptr nativeMediaStream = - self.nativeFactory->CreateLocalMediaStream([label UTF8String]); - return [[RTCMediaStream alloc] initWithMediaStream:nativeMediaStream]; -} - -- (RTCVideoSource*)videoSourceWithCapturer:(RTCVideoCapturer*)capturer - constraints:(RTCMediaConstraints*)constraints { - if (!capturer) { - return nil; - } - rtc::scoped_refptr source = - self.nativeFactory->CreateVideoSource([capturer takeNativeCapturer], constraints.constraints); - return [[RTCVideoSource alloc] initWithMediaSource:source]; -} - -- (RTCVideoTrack*)videoTrackWithID:(NSString*)videoId - source:(RTCVideoSource*)source { - rtc::scoped_refptr track = - self.nativeFactory->CreateVideoTrack([videoId UTF8String], - source.videoSource); - return [[RTCVideoTrack alloc] initWithMediaTrack:track]; -} - -- (RTCAudioTrack*)audioTrackWithID:(NSString*)audioId { - rtc::scoped_refptr track = - self.nativeFactory->CreateAudioTrack([audioId UTF8String], NULL); - return [[RTCAudioTrack alloc] initWithMediaTrack:track]; -} - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h b/talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h deleted file mode 100644 index ecd236d971..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h" - -#include "webrtc/api/peerconnectioninterface.h" - -@interface RTCConfiguration () - -+ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:(RTCEncryptionKeyType)keyType; - -- (webrtc::PeerConnectionInterface::RTCConfiguration *) - createNativeConfiguration; - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm b/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm deleted file mode 100644 index 1ab9c56429..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm +++ /dev/null @@ -1,133 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h" - -#import "talk/app/webrtc/objc/RTCEnumConverter.h" -#import "talk/app/webrtc/objc/RTCICEServer+Internal.h" -#import "talk/app/webrtc/objc/public/RTCLogging.h" - -#include - -#include "webrtc/base/rtccertificategenerator.h" - -@implementation RTCConfiguration - -@synthesize iceTransportsType = _iceTransportsType; -@synthesize iceServers = _iceServers; -@synthesize bundlePolicy = _bundlePolicy; -@synthesize rtcpMuxPolicy = _rtcpMuxPolicy; -@synthesize tcpCandidatePolicy = _tcpCandidatePolicy; -@synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; -@synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; -@synthesize iceBackupCandidatePairPingInterval = _iceBackupCandidatePairPingInterval; -@synthesize keyType = _keyType; - -- (instancetype)init { - if (self = [super init]) { - // Copy defaults. - webrtc::PeerConnectionInterface::RTCConfiguration config; - _iceTransportsType = [RTCEnumConverter iceTransportsTypeForNativeEnum:config.type]; - _bundlePolicy = [RTCEnumConverter bundlePolicyForNativeEnum:config.bundle_policy]; - _rtcpMuxPolicy = [RTCEnumConverter rtcpMuxPolicyForNativeEnum:config.rtcp_mux_policy]; - _tcpCandidatePolicy = - [RTCEnumConverter tcpCandidatePolicyForNativeEnum:config.tcp_candidate_policy]; - _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; - _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; - _iceBackupCandidatePairPingInterval = config.ice_backup_candidate_pair_ping_interval; - _keyType = kRTCEncryptionKeyTypeECDSA; - } - return self; -} - -- (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsType - bundlePolicy:(RTCBundlePolicy)bundlePolicy - rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy - tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy - audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets - iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout - iceBackupCandidatePairPingInterval:(int)iceBackupCandidatePairPingInterval { - if (self = [super init]) { - _iceTransportsType = iceTransportsType; - _bundlePolicy = bundlePolicy; - _rtcpMuxPolicy = rtcpMuxPolicy; - _tcpCandidatePolicy = tcpCandidatePolicy; - _audioJitterBufferMaxPackets = audioJitterBufferMaxPackets; - _iceConnectionReceivingTimeout = iceConnectionReceivingTimeout; - _iceBackupCandidatePairPingInterval = iceBackupCandidatePairPingInterval; - } - return self; -} - -#pragma mark - Private - -- (webrtc::PeerConnectionInterface::RTCConfiguration *) - createNativeConfiguration { - std::unique_ptr - nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration()); - nativeConfig->type = - [RTCEnumConverter nativeEnumForIceTransportsType:_iceTransportsType]; - for (RTCICEServer *iceServer : _iceServers) { - nativeConfig->servers.push_back(iceServer.iceServer); - } - nativeConfig->bundle_policy = - [RTCEnumConverter nativeEnumForBundlePolicy:_bundlePolicy]; - nativeConfig->rtcp_mux_policy = - [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_rtcpMuxPolicy]; - nativeConfig->tcp_candidate_policy = - [RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy]; - nativeConfig->audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; - nativeConfig->ice_connection_receiving_timeout = - _iceConnectionReceivingTimeout; - nativeConfig->ice_backup_candidate_pair_ping_interval = - _iceBackupCandidatePairPingInterval; - rtc::KeyType keyType = - [[self class] nativeEncryptionKeyTypeForKeyType:_keyType]; - if (keyType != rtc::KT_DEFAULT) { - rtc::scoped_refptr certificate = - rtc::RTCCertificateGenerator::GenerateCertificate( - rtc::KeyParams(keyType), rtc::Optional()); - if (!certificate) { - RTCLogError(@"Failed to generate certificate."); - return nullptr; - } - nativeConfig->certificates.push_back(certificate); - } - return nativeConfig.release(); -} - -+ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType: - (RTCEncryptionKeyType)keyType { - switch (keyType) { - case kRTCEncryptionKeyTypeRSA: - return rtc::KT_RSA; - case kRTCEncryptionKeyTypeECDSA: - return rtc::KT_ECDSA; - } -} - -@end diff --git a/talk/app/webrtc/objc/RTCPeerConnectionObserver.h b/talk/app/webrtc/objc/RTCPeerConnectionObserver.h deleted file mode 100644 index 0ac37b9ac2..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnectionObserver.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "webrtc/api/peerconnectioninterface.h" - -#import "RTCPeerConnection.h" -#import "RTCPeerConnectionDelegate.h" - -// These objects are created by RTCPeerConnectionFactory to wrap an -// id and call methods on that interface. - -namespace webrtc { - -class RTCPeerConnectionObserver : public PeerConnectionObserver { - - public: - RTCPeerConnectionObserver(RTCPeerConnection* peerConnection); - virtual ~RTCPeerConnectionObserver(); - - // Triggered when the SignalingState changed. - void OnSignalingChange( - PeerConnectionInterface::SignalingState new_state) override; - - // Triggered when media is received on a new stream from remote peer. - void OnAddStream(MediaStreamInterface* stream) override; - - // Triggered when a remote peer close a stream. - void OnRemoveStream(MediaStreamInterface* stream) override; - - // Triggered when a remote peer open a data channel. - void OnDataChannel(DataChannelInterface* data_channel) override; - - // Triggered when renegotiation is needed, for example the ICE has restarted. - void OnRenegotiationNeeded() override; - - // Called any time the ICEConnectionState changes - void OnIceConnectionChange( - PeerConnectionInterface::IceConnectionState new_state) override; - - // Called any time the ICEGatheringState changes - void OnIceGatheringChange( - PeerConnectionInterface::IceGatheringState new_state) override; - - // New Ice candidate have been found. - void OnIceCandidate(const IceCandidateInterface* candidate) override; - - private: - __weak RTCPeerConnection* _peerConnection; -}; - -} // namespace webrtc diff --git a/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm b/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm deleted file mode 100644 index 411cd6cb89..0000000000 --- a/talk/app/webrtc/objc/RTCPeerConnectionObserver.mm +++ /dev/null @@ -1,108 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCPeerConnectionObserver.h" - -#import "RTCDataChannel+Internal.h" -#import "RTCEnumConverter.h" -#import "RTCICECandidate+Internal.h" -#import "RTCMediaStream+Internal.h" - -namespace webrtc { - -RTCPeerConnectionObserver::RTCPeerConnectionObserver( - RTCPeerConnection* peerConnection) { - _peerConnection = peerConnection; -} - -RTCPeerConnectionObserver::~RTCPeerConnectionObserver() { -} - -void RTCPeerConnectionObserver::OnSignalingChange( - PeerConnectionInterface::SignalingState new_state) { - RTCSignalingState state = - [RTCEnumConverter convertSignalingStateToObjC:new_state]; - [_peerConnection.delegate peerConnection:_peerConnection - signalingStateChanged:state]; -} - -void RTCPeerConnectionObserver::OnAddStream(MediaStreamInterface* stream) { - RTCMediaStream* mediaStream = - [[RTCMediaStream alloc] initWithMediaStream:stream]; - [_peerConnection.delegate peerConnection:_peerConnection - addedStream:mediaStream]; -} - -void RTCPeerConnectionObserver::OnRemoveStream(MediaStreamInterface* stream) { - RTCMediaStream* mediaStream = - [[RTCMediaStream alloc] initWithMediaStream:stream]; - [_peerConnection.delegate peerConnection:_peerConnection - removedStream:mediaStream]; -} - -void RTCPeerConnectionObserver::OnDataChannel( - DataChannelInterface* data_channel) { - RTCDataChannel* dataChannel = - [[RTCDataChannel alloc] initWithDataChannel:data_channel]; - [_peerConnection.delegate peerConnection:_peerConnection - didOpenDataChannel:dataChannel]; -} - -void RTCPeerConnectionObserver::OnRenegotiationNeeded() { - id delegate = _peerConnection.delegate; - [delegate peerConnectionOnRenegotiationNeeded:_peerConnection]; -} - -void RTCPeerConnectionObserver::OnIceConnectionChange( - PeerConnectionInterface::IceConnectionState new_state) { - RTCICEConnectionState state = - [RTCEnumConverter convertIceConnectionStateToObjC:new_state]; - [_peerConnection.delegate peerConnection:_peerConnection - iceConnectionChanged:state]; -} - -void RTCPeerConnectionObserver::OnIceGatheringChange( - PeerConnectionInterface::IceGatheringState new_state) { - RTCICEGatheringState state = - [RTCEnumConverter convertIceGatheringStateToObjC:new_state]; - [_peerConnection.delegate peerConnection:_peerConnection - iceGatheringChanged:state]; -} - -void RTCPeerConnectionObserver::OnIceCandidate( - const IceCandidateInterface* candidate) { - RTCICECandidate* iceCandidate = - [[RTCICECandidate alloc] initWithCandidate:candidate]; - [_peerConnection.delegate peerConnection:_peerConnection - gotICECandidate:iceCandidate]; -} - -} // namespace webrtc diff --git a/talk/app/webrtc/objc/RTCSessionDescription+Internal.h b/talk/app/webrtc/objc/RTCSessionDescription+Internal.h deleted file mode 100644 index d552af1676..0000000000 --- a/talk/app/webrtc/objc/RTCSessionDescription+Internal.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCSessionDescription.h" - -#include "webrtc/api/jsep.h" -#include "webrtc/api/webrtcsession.h" - -@interface RTCSessionDescription (Internal) - -// Caller assumes ownership of this object! -- (webrtc::SessionDescriptionInterface *)sessionDescription; - -- (id)initWithSessionDescription: - (const webrtc::SessionDescriptionInterface*)sessionDescription; - -@end diff --git a/talk/app/webrtc/objc/RTCSessionDescription.mm b/talk/app/webrtc/objc/RTCSessionDescription.mm deleted file mode 100644 index 5d62511925..0000000000 --- a/talk/app/webrtc/objc/RTCSessionDescription.mm +++ /dev/null @@ -1,81 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCSessionDescription+Internal.h" - -@implementation RTCSessionDescription - -@synthesize description = _description; -@synthesize type = _type; - -- (id)initWithType:(NSString*)type sdp:(NSString*)sdp { - if (!type || !sdp) { - NSAssert(NO, @"nil arguments not allowed"); - return nil; - } - if ((self = [super init])) { - _description = sdp; - _type = type; - } - return self; -} - -@end - -@implementation RTCSessionDescription (Internal) - -- (id)initWithSessionDescription: - (const webrtc::SessionDescriptionInterface*)sessionDescription { - if (!sessionDescription) { - NSAssert(NO, @"nil arguments not allowed"); - self = nil; - return nil; - } - if ((self = [super init])) { - const std::string& type = sessionDescription->type(); - std::string sdp; - if (!sessionDescription->ToString(&sdp)) { - NSAssert(NO, @"Invalid SessionDescriptionInterface."); - self = nil; - } else { - _description = @(sdp.c_str()); - _type = @(type.c_str()); - } - } - return self; -} - -- (webrtc::SessionDescriptionInterface*)sessionDescription { - return webrtc::CreateSessionDescription( - [self.type UTF8String], [self.description UTF8String], NULL); -} - -@end diff --git a/talk/app/webrtc/objc/RTCStatsReport+Internal.h b/talk/app/webrtc/objc/RTCStatsReport+Internal.h deleted file mode 100644 index a595cfd962..0000000000 --- a/talk/app/webrtc/objc/RTCStatsReport+Internal.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCStatsReport.h" - -#include "webrtc/api/statstypes.h" - -@interface RTCStatsReport (Internal) - -- (instancetype)initWithStatsReport:(const webrtc::StatsReport&)statsReport; - -@end diff --git a/talk/app/webrtc/objc/RTCStatsReport.mm b/talk/app/webrtc/objc/RTCStatsReport.mm deleted file mode 100644 index 04a3d274d1..0000000000 --- a/talk/app/webrtc/objc/RTCStatsReport.mm +++ /dev/null @@ -1,69 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCStatsReport+Internal.h" - -#import "RTCPair.h" - -@implementation RTCStatsReport - -- (NSString*)description { - NSString* format = @"id: %@, type: %@, timestamp: %f, values: %@"; - return [NSString stringWithFormat:format, - self.reportId, - self.type, - self.timestamp, - self.values]; -} - -@end - -@implementation RTCStatsReport (Internal) - -- (instancetype)initWithStatsReport:(const webrtc::StatsReport&)statsReport { - if (self = [super init]) { - _reportId = @(statsReport.id()->ToString().c_str()); - _type = @(statsReport.TypeToString()); - _timestamp = statsReport.timestamp(); - NSMutableArray* values = - [NSMutableArray arrayWithCapacity:statsReport.values().size()]; - for (const auto& it : statsReport.values()) { - RTCPair* pair = - [[RTCPair alloc] initWithKey:@(it.second->display_name()) - value:@(it.second->ToString().c_str())]; - [values addObject:pair]; - } - _values = values; - } - return self; -} - -@end diff --git a/talk/app/webrtc/objc/RTCVideoCapturer+Internal.h b/talk/app/webrtc/objc/RTCVideoCapturer+Internal.h deleted file mode 100644 index 799a0274c3..0000000000 --- a/talk/app/webrtc/objc/RTCVideoCapturer+Internal.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCVideoCapturer.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCVideoCapturer (Internal) - -- (cricket::VideoCapturer*)takeNativeCapturer; - -- (id)initWithCapturer:(cricket::VideoCapturer*)capturer; - -@end diff --git a/talk/app/webrtc/objc/RTCVideoCapturer.mm b/talk/app/webrtc/objc/RTCVideoCapturer.mm deleted file mode 100644 index 39f06934e7..0000000000 --- a/talk/app/webrtc/objc/RTCVideoCapturer.mm +++ /dev/null @@ -1,67 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCVideoCapturer+Internal.h" - -#include - -#include "webrtc/media/base/videocapturer.h" -#include "webrtc/media/engine/webrtcvideocapturerfactory.h" - -@implementation RTCVideoCapturer { - std::unique_ptr _capturer; -} - -+ (RTCVideoCapturer*)capturerWithDeviceName:(NSString*)deviceName { - cricket::WebRtcVideoDeviceCapturerFactory factory; - cricket::Device device(std::string(deviceName.UTF8String), 0); - std::unique_ptr capturer(factory.Create(device)); - RTCVideoCapturer* rtcCapturer = - [[RTCVideoCapturer alloc] initWithCapturer:capturer.release()]; - return rtcCapturer; -} - -@end - -@implementation RTCVideoCapturer (Internal) - -- (id)initWithCapturer:(cricket::VideoCapturer*)capturer { - if ((self = [super init])) { - _capturer.reset(capturer); - } - return self; -} - -- (cricket::VideoCapturer*)takeNativeCapturer { - return _capturer.release(); -} - -@end diff --git a/talk/app/webrtc/objc/RTCVideoRendererAdapter.h b/talk/app/webrtc/objc/RTCVideoRendererAdapter.h deleted file mode 100644 index 117347ff9a..0000000000 --- a/talk/app/webrtc/objc/RTCVideoRendererAdapter.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCVideoRenderer.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCVideoRendererAdapter : NSObject - -@property(nonatomic, readonly) id videoRenderer; -@property(nonatomic, readonly) - rtc::VideoSinkInterface *nativeVideoRenderer; - -- (instancetype)initWithVideoRenderer:(id)videoRenderer; - -@end diff --git a/talk/app/webrtc/objc/RTCVideoRendererAdapter.mm b/talk/app/webrtc/objc/RTCVideoRendererAdapter.mm deleted file mode 100644 index 97876e7914..0000000000 --- a/talk/app/webrtc/objc/RTCVideoRendererAdapter.mm +++ /dev/null @@ -1,82 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCI420Frame+Internal.h" -#import "RTCVideoRendererAdapter.h" - -#include - -namespace webrtc { - -class RTCVideoRendererNativeAdapter - : public rtc::VideoSinkInterface { - public: - RTCVideoRendererNativeAdapter(RTCVideoRendererAdapter* adapter) { - _adapter = adapter; - _size = CGSizeZero; - } - - void OnFrame(const cricket::VideoFrame& videoFrame) override { - const cricket::VideoFrame* frame = videoFrame.GetCopyWithRotationApplied(); - CGSize currentSize = CGSizeMake(frame->width(), frame->height()); - if (!CGSizeEqualToSize(_size, currentSize)) { - _size = currentSize; - [_adapter.videoRenderer setSize:_size]; - } - RTCI420Frame* i420Frame = [[RTCI420Frame alloc] initWithVideoFrame:frame]; - [_adapter.videoRenderer renderFrame:i420Frame]; - } - - private: - __weak RTCVideoRendererAdapter* _adapter; - CGSize _size; -}; -} - -@implementation RTCVideoRendererAdapter { - id _videoRenderer; - std::unique_ptr _adapter; -} - -- (instancetype)initWithVideoRenderer:(id)videoRenderer { - NSParameterAssert(videoRenderer); - if (self = [super init]) { - _videoRenderer = videoRenderer; - _adapter.reset(new webrtc::RTCVideoRendererNativeAdapter(self)); - } - return self; -} - -- (rtc::VideoSinkInterface *)nativeVideoRenderer { - return _adapter.get(); -} - -@end diff --git a/talk/app/webrtc/objc/RTCVideoSource+Internal.h b/talk/app/webrtc/objc/RTCVideoSource+Internal.h deleted file mode 100644 index a9f9defd6e..0000000000 --- a/talk/app/webrtc/objc/RTCVideoSource+Internal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCVideoSource.h" - -#include "webrtc/api/mediastreaminterface.h" - -@interface RTCVideoSource (Internal) - -@property(nonatomic, assign, readonly) rtc::scoped_refptr - videoSource; - -@end diff --git a/talk/app/webrtc/objc/RTCVideoSource.mm b/talk/app/webrtc/objc/RTCVideoSource.mm deleted file mode 100644 index d106fe1e95..0000000000 --- a/talk/app/webrtc/objc/RTCVideoSource.mm +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCMediaSource+Internal.h" -#import "RTCVideoSource+Internal.h" - -@implementation RTCVideoSource -@end - -@implementation RTCVideoSource (Internal) - -- (rtc::scoped_refptr)videoSource { - return static_cast(self.mediaSource.get()); -} - -@end diff --git a/talk/app/webrtc/objc/RTCVideoTrack+Internal.h b/talk/app/webrtc/objc/RTCVideoTrack+Internal.h deleted file mode 100644 index 84259ea839..0000000000 --- a/talk/app/webrtc/objc/RTCVideoTrack+Internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCVideoTrack.h" - -#include "webrtc/api/mediastreaminterface.h" -#include "webrtc/api/peerconnectioninterface.h" - -@class RTCVideoRenderer; - -@interface RTCVideoTrack (Internal) - -@property(nonatomic, readonly) - rtc::scoped_refptr nativeVideoTrack; - -@end diff --git a/talk/app/webrtc/objc/RTCVideoTrack.mm b/talk/app/webrtc/objc/RTCVideoTrack.mm deleted file mode 100644 index 877e92eb02..0000000000 --- a/talk/app/webrtc/objc/RTCVideoTrack.mm +++ /dev/null @@ -1,123 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCVideoTrack+Internal.h" - -#import "RTCMediaSource+Internal.h" -#import "RTCMediaStreamTrack+Internal.h" -#import "RTCPeerConnectionFactory+Internal.h" -#import "RTCVideoRendererAdapter.h" -#import "RTCVideoSource+Internal.h" - -@implementation RTCVideoTrack { - NSMutableArray* _adapters; -} - -@synthesize source = _source; - -- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory - source:(RTCVideoSource*)source - trackId:(NSString*)trackId { - NSParameterAssert(factory); - NSParameterAssert(source); - NSParameterAssert(trackId.length); - rtc::scoped_refptr track = - factory.nativeFactory->CreateVideoTrack([trackId UTF8String], - source.videoSource); - if (self = [super initWithMediaTrack:track]) { - [self configure]; - _source = source; - } - return self; -} - -- (instancetype)initWithMediaTrack: - (rtc::scoped_refptr)mediaTrack { - if (self = [super initWithMediaTrack:mediaTrack]) { - [self configure]; - rtc::scoped_refptr source = - self.nativeVideoTrack->GetSource(); - if (source) { - _source = [[RTCVideoSource alloc] initWithMediaSource:source.get()]; - } - } - return self; -} - -- (void)configure { - _adapters = [NSMutableArray array]; -} - -- (void)dealloc { - for (RTCVideoRendererAdapter *adapter in _adapters) { - self.nativeVideoTrack->RemoveSink(adapter.nativeVideoRenderer); - } -} - -- (void)addRenderer:(id)renderer { - // Make sure we don't have this renderer yet. - for (RTCVideoRendererAdapter* adapter in _adapters) { - NSParameterAssert(adapter.videoRenderer != renderer); - } - // Create a wrapper that provides a native pointer for us. - RTCVideoRendererAdapter* adapter = - [[RTCVideoRendererAdapter alloc] initWithVideoRenderer:renderer]; - [_adapters addObject:adapter]; - self.nativeVideoTrack->AddOrUpdateSink(adapter.nativeVideoRenderer, - rtc::VideoSinkWants()); -} - -- (void)removeRenderer:(id)renderer { - RTCVideoRendererAdapter* adapter = nil; - NSUInteger indexToRemove = NSNotFound; - for (NSUInteger i = 0; i < _adapters.count; i++) { - adapter = _adapters[i]; - if (adapter.videoRenderer == renderer) { - indexToRemove = i; - break; - } - } - if (indexToRemove == NSNotFound) { - return; - } - self.nativeVideoTrack->RemoveSink(adapter.nativeVideoRenderer); - [_adapters removeObjectAtIndex:indexToRemove]; -} - -@end - -@implementation RTCVideoTrack (Internal) - -- (rtc::scoped_refptr)nativeVideoTrack { - return static_cast(self.mediaTrack.get()); -} - -@end diff --git a/talk/app/webrtc/objc/avfoundationvideocapturer.h b/talk/app/webrtc/objc/avfoundationvideocapturer.h deleted file mode 100644 index 8bc128dd42..0000000000 --- a/talk/app/webrtc/objc/avfoundationvideocapturer.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_ -#define TALK_APP_WEBRTC_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_ - -#include "webrtc/media/base/videocapturer.h" -#include "webrtc/video_frame.h" - -#import - -@class RTCAVFoundationVideoCapturerInternal; - -namespace rtc { -class Thread; -} // namespace rtc - -namespace webrtc { - -class AVFoundationVideoCapturer : public cricket::VideoCapturer, - public rtc::MessageHandler { - public: - AVFoundationVideoCapturer(); - ~AVFoundationVideoCapturer(); - - cricket::CaptureState Start(const cricket::VideoFormat& format) override; - void Stop() override; - bool IsRunning() override; - bool IsScreencast() const override { - return false; - } - bool GetPreferredFourccs(std::vector* fourccs) override { - fourccs->push_back(cricket::FOURCC_NV12); - return true; - } - - // Returns the active capture session. Calls to the capture session should - // occur on the RTCDispatcherTypeCaptureSession queue in RTCDispatcher. - AVCaptureSession* GetCaptureSession(); - - // Returns whether the rear-facing camera can be used. - // e.g. It can't be used because it doesn't exist. - bool CanUseBackCamera() const; - - // Switches the camera being used (either front or back). - void SetUseBackCamera(bool useBackCamera); - bool GetUseBackCamera() const; - - // Converts the sample buffer into a cricket::CapturedFrame and signals the - // frame for capture. - void CaptureSampleBuffer(CMSampleBufferRef sampleBuffer); - - // Handles messages from posts. - void OnMessage(rtc::Message *msg) override; - - private: - void OnFrameMessage(CVImageBufferRef image_buffer, int64_t capture_time); - - RTCAVFoundationVideoCapturerInternal* _capturer; - rtc::Thread* _startThread; // Set in Start(), unset in Stop(). -}; // AVFoundationVideoCapturer - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_OBJC_AVFOUNDATION_CAPTURER_H_ diff --git a/talk/app/webrtc/objc/avfoundationvideocapturer.mm b/talk/app/webrtc/objc/avfoundationvideocapturer.mm deleted file mode 100644 index d5252177dd..0000000000 --- a/talk/app/webrtc/objc/avfoundationvideocapturer.mm +++ /dev/null @@ -1,562 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "talk/app/webrtc/objc/avfoundationvideocapturer.h" - -#include "webrtc/base/bind.h" -#include "webrtc/base/checks.h" -#include "webrtc/base/thread.h" - -#import -#import -#import - -#import "RTCDispatcher+Private.h" -#import "RTCLogging.h" - -// TODO(tkchin): support other formats. -static NSString *const kDefaultPreset = AVCaptureSessionPreset640x480; -static cricket::VideoFormat const kDefaultFormat = - cricket::VideoFormat(640, - 480, - cricket::VideoFormat::FpsToInterval(30), - cricket::FOURCC_NV12); - -// This class used to capture frames using AVFoundation APIs on iOS. It is meant -// to be owned by an instance of AVFoundationVideoCapturer. The reason for this -// because other webrtc objects own cricket::VideoCapturer, which is not -// ref counted. To prevent bad behavior we do not expose this class directly. -@interface RTCAVFoundationVideoCapturerInternal : NSObject - - -@property(nonatomic, readonly) AVCaptureSession *captureSession; -@property(nonatomic, readonly) BOOL isRunning; -@property(nonatomic, readonly) BOOL canUseBackCamera; -@property(nonatomic, assign) BOOL useBackCamera; // Defaults to NO. - -// We keep a pointer back to AVFoundationVideoCapturer to make callbacks on it -// when we receive frames. This is safe because this object should be owned by -// it. -- (instancetype)initWithCapturer:(webrtc::AVFoundationVideoCapturer *)capturer; - -// Starts and stops the capture session asynchronously. We cannot do this -// synchronously without blocking a WebRTC thread. -- (void)start; -- (void)stop; - -@end - -@implementation RTCAVFoundationVideoCapturerInternal { - // Keep pointers to inputs for convenience. - AVCaptureDeviceInput *_frontCameraInput; - AVCaptureDeviceInput *_backCameraInput; - AVCaptureVideoDataOutput *_videoDataOutput; - // The cricket::VideoCapturer that owns this class. Should never be NULL. - webrtc::AVFoundationVideoCapturer *_capturer; - BOOL _orientationHasChanged; -} - -@synthesize captureSession = _captureSession; -@synthesize isRunning = _isRunning; -@synthesize useBackCamera = _useBackCamera; - -// This is called from the thread that creates the video source, which is likely -// the main thread. -- (instancetype)initWithCapturer:(webrtc::AVFoundationVideoCapturer *)capturer { - RTC_DCHECK(capturer); - if (self = [super init]) { - _capturer = capturer; - // Create the capture session and all relevant inputs and outputs. We need - // to do this in init because the application may want the capture session - // before we start the capturer for e.g. AVCapturePreviewLayer. All objects - // created here are retained until dealloc and never recreated. - if (![self setupCaptureSession]) { - return nil; - } - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - [center addObserver:self - selector:@selector(deviceOrientationDidChange:) - name:UIDeviceOrientationDidChangeNotification - object:nil]; - [center addObserverForName:AVCaptureSessionRuntimeErrorNotification - object:nil - queue:nil - usingBlock:^(NSNotification *notification) { - RTCLogError(@"Capture session error: %@", notification.userInfo); - }]; - } - return self; -} - -- (void)dealloc { - RTC_DCHECK(!_isRunning); - [[NSNotificationCenter defaultCenter] removeObserver:self]; - _capturer = nullptr; -} - -- (AVCaptureSession *)captureSession { - return _captureSession; -} - -// Called from any thread (likely main thread). -- (BOOL)canUseBackCamera { - return _backCameraInput != nil; -} - -// Called from any thread (likely main thread). -- (BOOL)useBackCamera { - @synchronized(self) { - return _useBackCamera; - } -} - -// Called from any thread (likely main thread). -- (void)setUseBackCamera:(BOOL)useBackCamera { - if (!self.canUseBackCamera) { - if (useBackCamera) { - RTCLogWarning(@"No rear-facing camera exists or it cannot be used;" - "not switching."); - } - return; - } - @synchronized(self) { - if (_useBackCamera == useBackCamera) { - return; - } - _useBackCamera = useBackCamera; - [self updateSessionInputForUseBackCamera:useBackCamera]; - } -} - -// Called from WebRTC thread. -- (void)start { - if (_isRunning) { - return; - } - _isRunning = YES; - [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession - block:^{ - _orientationHasChanged = NO; - [self updateOrientation]; - [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; - AVCaptureSession *captureSession = self.captureSession; - [captureSession startRunning]; - }]; -} - -// Called from same thread as start. -- (void)stop { - if (!_isRunning) { - return; - } - _isRunning = NO; - [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession - block:^{ - [_videoDataOutput setSampleBufferDelegate:nil queue:nullptr]; - [_captureSession stopRunning]; - [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; - }]; -} - -#pragma mark AVCaptureVideoDataOutputSampleBufferDelegate - -- (void)captureOutput:(AVCaptureOutput *)captureOutput - didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer - fromConnection:(AVCaptureConnection *)connection { - NSParameterAssert(captureOutput == _videoDataOutput); - if (!_isRunning) { - return; - } - _capturer->CaptureSampleBuffer(sampleBuffer); -} - -- (void)captureOutput:(AVCaptureOutput *)captureOutput - didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer - fromConnection:(AVCaptureConnection *)connection { - RTCLogError(@"Dropped sample buffer."); -} - -#pragma mark - Private - -- (BOOL)setupCaptureSession { - AVCaptureSession *captureSession = [[AVCaptureSession alloc] init]; -#if defined(__IPHONE_7_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0 - NSString *version = [[UIDevice currentDevice] systemVersion]; - if ([version integerValue] >= 7) { - captureSession.usesApplicationAudioSession = NO; - } -#endif - if (![captureSession canSetSessionPreset:kDefaultPreset]) { - RTCLogError(@"Session preset unsupported."); - return NO; - } - captureSession.sessionPreset = kDefaultPreset; - - // Add the output. - AVCaptureVideoDataOutput *videoDataOutput = [self videoDataOutput]; - if (![captureSession canAddOutput:videoDataOutput]) { - RTCLogError(@"Video data output unsupported."); - return NO; - } - [captureSession addOutput:videoDataOutput]; - - // Get the front and back cameras. If there isn't a front camera - // give up. - AVCaptureDeviceInput *frontCameraInput = [self frontCameraInput]; - AVCaptureDeviceInput *backCameraInput = [self backCameraInput]; - if (!frontCameraInput) { - RTCLogError(@"No front camera for capture session."); - return NO; - } - - // Add the inputs. - if (![captureSession canAddInput:frontCameraInput] || - (backCameraInput && ![captureSession canAddInput:backCameraInput])) { - RTCLogError(@"Session does not support capture inputs."); - return NO; - } - AVCaptureDeviceInput *input = self.useBackCamera ? - backCameraInput : frontCameraInput; - [captureSession addInput:input]; - _captureSession = captureSession; - return YES; -} - -- (AVCaptureVideoDataOutput *)videoDataOutput { - if (!_videoDataOutput) { - // Make the capturer output NV12. Ideally we want I420 but that's not - // currently supported on iPhone / iPad. - AVCaptureVideoDataOutput *videoDataOutput = - [[AVCaptureVideoDataOutput alloc] init]; - videoDataOutput = [[AVCaptureVideoDataOutput alloc] init]; - videoDataOutput.videoSettings = @{ - (NSString *)kCVPixelBufferPixelFormatTypeKey : - @(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) - }; - videoDataOutput.alwaysDiscardsLateVideoFrames = NO; - dispatch_queue_t queue = - [RTCDispatcher dispatchQueueForType:RTCDispatcherTypeCaptureSession]; - [videoDataOutput setSampleBufferDelegate:self queue:queue]; - _videoDataOutput = videoDataOutput; - } - return _videoDataOutput; -} - -- (AVCaptureDevice *)videoCaptureDeviceForPosition: - (AVCaptureDevicePosition)position { - for (AVCaptureDevice *captureDevice in - [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) { - if (captureDevice.position == position) { - return captureDevice; - } - } - return nil; -} - -- (AVCaptureDeviceInput *)frontCameraInput { - if (!_frontCameraInput) { - AVCaptureDevice *frontCameraDevice = - [self videoCaptureDeviceForPosition:AVCaptureDevicePositionFront]; - if (!frontCameraDevice) { - RTCLogWarning(@"Failed to find front capture device."); - return nil; - } - NSError *error = nil; - AVCaptureDeviceInput *frontCameraInput = - [AVCaptureDeviceInput deviceInputWithDevice:frontCameraDevice - error:&error]; - if (!frontCameraInput) { - RTCLogError(@"Failed to create front camera input: %@", - error.localizedDescription); - return nil; - } - _frontCameraInput = frontCameraInput; - } - return _frontCameraInput; -} - -- (AVCaptureDeviceInput *)backCameraInput { - if (!_backCameraInput) { - AVCaptureDevice *backCameraDevice = - [self videoCaptureDeviceForPosition:AVCaptureDevicePositionBack]; - if (!backCameraDevice) { - RTCLogWarning(@"Failed to find front capture device."); - return nil; - } - NSError *error = nil; - AVCaptureDeviceInput *backCameraInput = - [AVCaptureDeviceInput deviceInputWithDevice:backCameraDevice - error:&error]; - if (!backCameraInput) { - RTCLogError(@"Failed to create front camera input: %@", - error.localizedDescription); - return nil; - } - _backCameraInput = backCameraInput; - } - return _backCameraInput; -} - -- (void)deviceOrientationDidChange:(NSNotification *)notification { - [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession - block:^{ - _orientationHasChanged = YES; - [self updateOrientation]; - }]; -} - -// Called from capture session queue. -- (void)updateOrientation { - AVCaptureConnection *connection = - [_videoDataOutput connectionWithMediaType:AVMediaTypeVideo]; - if (!connection.supportsVideoOrientation) { - // TODO(tkchin): set rotation bit on frames. - return; - } - AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationPortrait; - switch ([UIDevice currentDevice].orientation) { - case UIDeviceOrientationPortrait: - orientation = AVCaptureVideoOrientationPortrait; - break; - case UIDeviceOrientationPortraitUpsideDown: - orientation = AVCaptureVideoOrientationPortraitUpsideDown; - break; - case UIDeviceOrientationLandscapeLeft: - orientation = AVCaptureVideoOrientationLandscapeRight; - break; - case UIDeviceOrientationLandscapeRight: - orientation = AVCaptureVideoOrientationLandscapeLeft; - break; - case UIDeviceOrientationFaceUp: - case UIDeviceOrientationFaceDown: - case UIDeviceOrientationUnknown: - if (!_orientationHasChanged) { - connection.videoOrientation = orientation; - } - return; - } - connection.videoOrientation = orientation; -} - -// Update the current session input to match what's stored in _useBackCamera. -- (void)updateSessionInputForUseBackCamera:(BOOL)useBackCamera { - [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeCaptureSession - block:^{ - [_captureSession beginConfiguration]; - AVCaptureDeviceInput *oldInput = _backCameraInput; - AVCaptureDeviceInput *newInput = _frontCameraInput; - if (useBackCamera) { - oldInput = _frontCameraInput; - newInput = _backCameraInput; - } - if (oldInput) { - // Ok to remove this even if it's not attached. Will be no-op. - [_captureSession removeInput:oldInput]; - } - if (newInput) { - [_captureSession addInput:newInput]; - } - [self updateOrientation]; - [_captureSession commitConfiguration]; - }]; -} - -@end - -namespace webrtc { - -enum AVFoundationVideoCapturerMessageType : uint32_t { - kMessageTypeFrame, -}; - -struct AVFoundationFrame { - AVFoundationFrame(CVImageBufferRef buffer, int64_t time) - : image_buffer(buffer), capture_time(time) {} - CVImageBufferRef image_buffer; - int64_t capture_time; -}; - -AVFoundationVideoCapturer::AVFoundationVideoCapturer() - : _capturer(nil), _startThread(nullptr) { - // Set our supported formats. This matches kDefaultPreset. - std::vector supportedFormats; - supportedFormats.push_back(cricket::VideoFormat(kDefaultFormat)); - SetSupportedFormats(supportedFormats); - _capturer = - [[RTCAVFoundationVideoCapturerInternal alloc] initWithCapturer:this]; -} - -AVFoundationVideoCapturer::~AVFoundationVideoCapturer() { - _capturer = nil; -} - -cricket::CaptureState AVFoundationVideoCapturer::Start( - const cricket::VideoFormat& format) { - if (!_capturer) { - LOG(LS_ERROR) << "Failed to create AVFoundation capturer."; - return cricket::CaptureState::CS_FAILED; - } - if (_capturer.isRunning) { - LOG(LS_ERROR) << "The capturer is already running."; - return cricket::CaptureState::CS_FAILED; - } - if (format != kDefaultFormat) { - LOG(LS_ERROR) << "Unsupported format provided."; - return cricket::CaptureState::CS_FAILED; - } - - // Keep track of which thread capture started on. This is the thread that - // frames need to be sent to. - RTC_DCHECK(!_startThread); - _startThread = rtc::Thread::Current(); - - SetCaptureFormat(&format); - // This isn't super accurate because it takes a while for the AVCaptureSession - // to spin up, and this call returns async. - // TODO(tkchin): make this better. - [_capturer start]; - SetCaptureState(cricket::CaptureState::CS_RUNNING); - - return cricket::CaptureState::CS_STARTING; -} - -void AVFoundationVideoCapturer::Stop() { - [_capturer stop]; - SetCaptureFormat(NULL); - _startThread = nullptr; -} - -bool AVFoundationVideoCapturer::IsRunning() { - return _capturer.isRunning; -} - -AVCaptureSession* AVFoundationVideoCapturer::GetCaptureSession() { - return _capturer.captureSession; -} - -bool AVFoundationVideoCapturer::CanUseBackCamera() const { - return _capturer.canUseBackCamera; -} - -void AVFoundationVideoCapturer::SetUseBackCamera(bool useBackCamera) { - _capturer.useBackCamera = useBackCamera; -} - -bool AVFoundationVideoCapturer::GetUseBackCamera() const { - return _capturer.useBackCamera; -} - -void AVFoundationVideoCapturer::CaptureSampleBuffer( - CMSampleBufferRef sampleBuffer) { - if (CMSampleBufferGetNumSamples(sampleBuffer) != 1 || - !CMSampleBufferIsValid(sampleBuffer) || - !CMSampleBufferDataIsReady(sampleBuffer)) { - return; - } - - CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sampleBuffer); - if (image_buffer == NULL) { - return; - } - - // Retain the buffer and post it to the webrtc thread. It will be released - // after it has successfully been signaled. - CVBufferRetain(image_buffer); - AVFoundationFrame frame(image_buffer, rtc::TimeNanos()); - _startThread->Post(RTC_FROM_HERE, this, kMessageTypeFrame, - new rtc::TypedMessageData(frame)); -} - -void AVFoundationVideoCapturer::OnMessage(rtc::Message *msg) { - switch (msg->message_id) { - case kMessageTypeFrame: { - rtc::TypedMessageData* data = - static_cast*>(msg->pdata); - const AVFoundationFrame& frame = data->data(); - OnFrameMessage(frame.image_buffer, frame.capture_time); - delete data; - break; - } - } -} - -void AVFoundationVideoCapturer::OnFrameMessage(CVImageBufferRef image_buffer, - int64_t capture_time) { - RTC_DCHECK(_startThread->IsCurrent()); - - // Base address must be unlocked to access frame data. - CVOptionFlags lock_flags = kCVPixelBufferLock_ReadOnly; - CVReturn ret = CVPixelBufferLockBaseAddress(image_buffer, lock_flags); - if (ret != kCVReturnSuccess) { - return; - } - - static size_t const kYPlaneIndex = 0; - static size_t const kUVPlaneIndex = 1; - uint8_t* y_plane_address = - static_cast(CVPixelBufferGetBaseAddressOfPlane(image_buffer, - kYPlaneIndex)); - size_t y_plane_height = - CVPixelBufferGetHeightOfPlane(image_buffer, kYPlaneIndex); - size_t y_plane_width = - CVPixelBufferGetWidthOfPlane(image_buffer, kYPlaneIndex); - size_t y_plane_bytes_per_row = - CVPixelBufferGetBytesPerRowOfPlane(image_buffer, kYPlaneIndex); - size_t uv_plane_height = - CVPixelBufferGetHeightOfPlane(image_buffer, kUVPlaneIndex); - size_t uv_plane_bytes_per_row = - CVPixelBufferGetBytesPerRowOfPlane(image_buffer, kUVPlaneIndex); - size_t frame_size = y_plane_bytes_per_row * y_plane_height + - uv_plane_bytes_per_row * uv_plane_height; - - // Sanity check assumption that planar bytes are contiguous. - uint8_t* uv_plane_address = - static_cast(CVPixelBufferGetBaseAddressOfPlane(image_buffer, - kUVPlaneIndex)); - RTC_DCHECK(uv_plane_address == - y_plane_address + y_plane_height * y_plane_bytes_per_row); - - // Stuff data into a cricket::CapturedFrame. - cricket::CapturedFrame frame; - frame.width = y_plane_width; - frame.height = y_plane_height; - frame.pixel_width = 1; - frame.pixel_height = 1; - frame.fourcc = static_cast(cricket::FOURCC_NV12); - frame.time_stamp = capture_time; - frame.data = y_plane_address; - frame.data_size = frame_size; - - // This will call a superclass method that will perform the frame conversion - // to I420. - SignalFrameCaptured(this, &frame); - - CVPixelBufferUnlockBaseAddress(image_buffer, lock_flags); - CVBufferRelease(image_buffer); -} - -} // namespace webrtc diff --git a/talk/app/webrtc/objc/public/RTCAVFoundationVideoSource.h b/talk/app/webrtc/objc/public/RTCAVFoundationVideoSource.h deleted file mode 100644 index fcc8f1f2c0..0000000000 --- a/talk/app/webrtc/objc/public/RTCAVFoundationVideoSource.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCVideoSource.h" - -@class AVCaptureSession; -@class RTCMediaConstraints; -@class RTCPeerConnectionFactory; - -// RTCAVFoundationVideoSource is a video source that uses -// webrtc::AVFoundationVideoCapturer. We do not currently provide a wrapper for -// that capturer because cricket::VideoCapturer is not ref counted and we cannot -// guarantee its lifetime. Instead, we expose its properties through the ref -// counted video source interface. -@interface RTCAVFoundationVideoSource : RTCVideoSource - -- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory - constraints:(RTCMediaConstraints*)constraints; - -// Returns whether rear-facing camera is available for use. -@property(nonatomic, readonly) BOOL canUseBackCamera; -// Switches the camera being used (either front or back). -@property(nonatomic, assign) BOOL useBackCamera; -// Returns the active capture session. -@property(nonatomic, readonly) AVCaptureSession* captureSession; - -@end diff --git a/talk/app/webrtc/objc/public/RTCAudioSource.h b/talk/app/webrtc/objc/public/RTCAudioSource.h deleted file mode 100644 index c0d38fe7ed..0000000000 --- a/talk/app/webrtc/objc/public/RTCAudioSource.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaSource.h" - -// RTCAudioSource is an ObjectiveC wrapper for AudioSourceInterface. It is -// used as the source for one or more RTCAudioTrack objects. -@interface RTCAudioSource : RTCMediaSource - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCAudioTrack.h b/talk/app/webrtc/objc/public/RTCAudioTrack.h deleted file mode 100644 index 48c2783173..0000000000 --- a/talk/app/webrtc/objc/public/RTCAudioTrack.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaStreamTrack.h" - -// RTCAudioTrack is an ObjectiveC wrapper for AudioTrackInterface. -@interface RTCAudioTrack : RTCMediaStreamTrack - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCDataChannel.h b/talk/app/webrtc/objc/public/RTCDataChannel.h deleted file mode 100644 index 24a46f655c..0000000000 --- a/talk/app/webrtc/objc/public/RTCDataChannel.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// ObjectiveC wrapper for a DataChannelInit object. -@interface RTCDataChannelInit : NSObject - -// Set to YES if ordered delivery is required -@property(nonatomic) BOOL isOrdered; -// Max period in milliseconds in which retransmissions will be sent. After this -// time, no more retransmissions will be sent. -1 if unset. -@property(nonatomic) NSInteger maxRetransmitTimeMs; -// The max number of retransmissions. -1 if unset. -@property(nonatomic) NSInteger 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) BOOL isNegotiated; -// The stream id, or SID, for SCTP data channels. -1 if unset. -@property(nonatomic) NSInteger streamId; -// Set by the application and opaque to the WebRTC implementation. -@property(nonatomic) NSString* protocol; - -@end - -// ObjectiveC wrapper for a DataBuffer object. -@interface RTCDataBuffer : NSObject - -@property(nonatomic, readonly) NSData* data; -@property(nonatomic, readonly) BOOL isBinary; - -- (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end - -// Keep in sync with webrtc::DataChannelInterface::DataState -typedef enum { - kRTCDataChannelStateConnecting, - kRTCDataChannelStateOpen, - kRTCDataChannelStateClosing, - kRTCDataChannelStateClosed -} RTCDataChannelState; - -@class RTCDataChannel; -// Protocol for receving data channel state and message events. -@protocol RTCDataChannelDelegate - -// Called when the data channel state has changed. -- (void)channelDidChangeState:(RTCDataChannel*)channel; - -// Called when a data buffer was successfully received. -- (void)channel:(RTCDataChannel*)channel - didReceiveMessageWithBuffer:(RTCDataBuffer*)buffer; - -@optional - -// Called when the buffered amount has changed. -- (void)channel:(RTCDataChannel*)channel - didChangeBufferedAmount:(NSUInteger)amount; - -@end - -// ObjectiveC wrapper for a DataChannel object. -// See talk/app/webrtc/datachannelinterface.h -@interface RTCDataChannel : NSObject - -@property(nonatomic, readonly) NSString* label; -@property(nonatomic, readonly) BOOL isReliable; -@property(nonatomic, readonly) BOOL isOrdered; -@property(nonatomic, readonly) NSUInteger maxRetransmitTime; -@property(nonatomic, readonly) NSUInteger maxRetransmits; -@property(nonatomic, readonly) NSString* protocol; -@property(nonatomic, readonly) BOOL isNegotiated; -@property(nonatomic, readonly) NSInteger streamId; -@property(nonatomic, readonly) RTCDataChannelState state; -@property(nonatomic, readonly) NSUInteger bufferedAmount; -@property(nonatomic, weak) id delegate; - -- (void)close; -- (BOOL)sendData:(RTCDataBuffer*)data; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCEAGLVideoView.h b/talk/app/webrtc/objc/public/RTCEAGLVideoView.h deleted file mode 100644 index 32c834acf8..0000000000 --- a/talk/app/webrtc/objc/public/RTCEAGLVideoView.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import -#import - -#import "RTCVideoRenderer.h" - -@class RTCEAGLVideoView; -@protocol RTCEAGLVideoViewDelegate - -- (void)videoView:(RTCEAGLVideoView*)videoView didChangeVideoSize:(CGSize)size; - -@end - -// RTCEAGLVideoView is an RTCVideoRenderer which renders i420 frames in its -// bounds using OpenGLES 2.0. -@interface RTCEAGLVideoView : UIView - -@property(nonatomic, weak) id delegate; - -@end diff --git a/talk/app/webrtc/objc/public/RTCFileLogger.h b/talk/app/webrtc/objc/public/RTCFileLogger.h deleted file mode 100644 index af43f8ad27..0000000000 --- a/talk/app/webrtc/objc/public/RTCFileLogger.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// TODO(tkchin): Move this to a common location. -#ifndef NS_DESIGNATED_INITIALIZER -#define NS_DESIGNATED_INITIALIZER -#endif - -typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) { - kRTCFileLoggerSeverityVerbose, - kRTCFileLoggerSeverityInfo, - kRTCFileLoggerSeverityWarning, - kRTCFileLoggerSeverityError -}; - -typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) { - kRTCFileLoggerTypeCall, - kRTCFileLoggerTypeApp, -}; - -// 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. -@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. -- (NSData *)logData; - -@end diff --git a/talk/app/webrtc/objc/public/RTCI420Frame.h b/talk/app/webrtc/objc/public/RTCI420Frame.h deleted file mode 100644 index 1d145ee72a..0000000000 --- a/talk/app/webrtc/objc/public/RTCI420Frame.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// RTCI420Frame is an ObjectiveC version of cricket::VideoFrame. -// TODO(nisse): It appears it doesn't support any VideoFrame methods, -// so let it wrap an webrtc::VideoFrameBuffer instead? -@interface RTCI420Frame : NSObject - -@property(nonatomic, readonly) NSUInteger width; -@property(nonatomic, readonly) NSUInteger height; -@property(nonatomic, readonly) NSUInteger chromaWidth; -@property(nonatomic, readonly) NSUInteger chromaHeight; -// These can return NULL if the object is not backed by a buffer. -@property(nonatomic, readonly) const uint8_t* yPlane; -@property(nonatomic, readonly) const uint8_t* uPlane; -@property(nonatomic, readonly) const uint8_t* vPlane; -@property(nonatomic, readonly) NSInteger yPitch; -@property(nonatomic, readonly) NSInteger uPitch; -@property(nonatomic, readonly) NSInteger vPitch; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCICECandidate.h b/talk/app/webrtc/objc/public/RTCICECandidate.h deleted file mode 100644 index 25e4fe2aee..0000000000 --- a/talk/app/webrtc/objc/public/RTCICECandidate.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// RTCICECandidate contains an instance of ICECandidateInterface. -@interface RTCICECandidate : NSObject - -// If present, this contains the identifier of the "media stream -// identification" as defined in [RFC 3388] for m-line this candidate is -// associated with. -@property(nonatomic, copy, readonly) NSString* sdpMid; - -// This indicates the index (starting at zero) of m-line in the SDP this -// candidate is associated with. -@property(nonatomic, assign, readonly) NSInteger sdpMLineIndex; - -// Creates an SDP-ized form of this candidate. -@property(nonatomic, copy, readonly) NSString* sdp; - -// Creates an ICECandidateInterface based on SDP string. -- (id)initWithMid:(NSString*)sdpMid - index:(NSInteger)sdpMLineIndex - sdp:(NSString*)sdp; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCICEServer.h b/talk/app/webrtc/objc/public/RTCICEServer.h deleted file mode 100644 index 35acf0db5b..0000000000 --- a/talk/app/webrtc/objc/public/RTCICEServer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// RTCICEServer allows for the creation of ICEServer structs. -@interface RTCICEServer : NSObject - -// The server URI, username, and password. -@property(nonatomic, strong, readonly) NSURL* URI; -@property(nonatomic, copy, readonly) NSString* username; -@property(nonatomic, copy, readonly) NSString* password; - -// Initializer for RTCICEServer taking uri, username, and password. -- (id)initWithURI:(NSURL*)URI - username:(NSString*)username - password:(NSString*)password; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCLogging.h b/talk/app/webrtc/objc/public/RTCLogging.h deleted file mode 100644 index bcd160d921..0000000000 --- a/talk/app/webrtc/objc/public/RTCLogging.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// Subset of rtc::LoggingSeverity. -typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { - kRTCLoggingSeverityVerbose, - kRTCLoggingSeverityInfo, - kRTCLoggingSeverityWarning, - kRTCLoggingSeverityError, -}; - -#if defined(__cplusplus) -extern "C" void RTCLogEx(RTCLoggingSeverity severity, NSString* logString); -extern "C" void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); -extern "C" NSString* RTCFileName(const char* filePath); -#else - -// Wrapper for C++ LOG(sev) macros. -// Logs the log string to the webrtc logstream for the given severity. -extern void RTCLogEx(RTCLoggingSeverity severity, NSString* logString); - -// Wrapper for rtc::LogMessage::LogToDebug. -// Sets the minimum severity to be logged to console. -extern void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); - -// Returns the filename with the path prefix removed. -extern NSString* RTCFileName(const char* filePath); - -#endif - -// Some convenience macros. - -#define RTCLogString(format, ...) \ - [NSString stringWithFormat:@"(%@:%d %s): " format, \ - RTCFileName(__FILE__), \ - __LINE__, \ - __FUNCTION__, \ - ##__VA_ARGS__] - -#define RTCLogFormat(severity, format, ...) \ - do { \ - NSString *logString = RTCLogString(format, ##__VA_ARGS__); \ - RTCLogEx(severity, logString); \ - } while (false) - -#define RTCLogVerbose(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityVerbose, format, ##__VA_ARGS__) \ - -#define RTCLogInfo(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityInfo, format, ##__VA_ARGS__) \ - -#define RTCLogWarning(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityWarning, format, ##__VA_ARGS__) \ - -#define RTCLogError(format, ...) \ - RTCLogFormat(kRTCLoggingSeverityError, 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/talk/app/webrtc/objc/public/RTCMediaConstraints.h b/talk/app/webrtc/objc/public/RTCMediaConstraints.h deleted file mode 100644 index 425150a804..0000000000 --- a/talk/app/webrtc/objc/public/RTCMediaConstraints.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// RTCMediaConstraints contains the media constraints to be used in -// RTCPeerConnection and RTCMediaStream. -@interface RTCMediaConstraints : NSObject - -// Initializer for RTCMediaConstraints. The parameters mandatory and optional -// contain RTCPair objects with key/value for each constrant. -- (id)initWithMandatoryConstraints:(NSArray *)mandatory - optionalConstraints:(NSArray *)optional; - -@end diff --git a/talk/app/webrtc/objc/public/RTCMediaSource.h b/talk/app/webrtc/objc/public/RTCMediaSource.h deleted file mode 100644 index 164d85de71..0000000000 --- a/talk/app/webrtc/objc/public/RTCMediaSource.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "RTCTypes.h" - -// RTCMediaSource is an ObjectiveC wrapper for MediaSourceInterface -@interface RTCMediaSource : NSObject - -// The current state of the RTCMediaSource. -@property(nonatomic, assign, readonly) RTCSourceState state; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCMediaStream.h b/talk/app/webrtc/objc/public/RTCMediaStream.h deleted file mode 100644 index 40a63ee378..0000000000 --- a/talk/app/webrtc/objc/public/RTCMediaStream.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class RTCAudioTrack; -@class RTCVideoTrack; - -// RTCMediaStream is an ObjectiveC wrapper for MediaStreamInterface. -@interface RTCMediaStream : NSObject - -@property(nonatomic, strong, readonly) NSArray *audioTracks; -@property(nonatomic, strong, readonly) NSArray *videoTracks; -@property(nonatomic, strong, readonly) NSString *label; - -- (BOOL)addAudioTrack:(RTCAudioTrack *)track; -- (BOOL)addVideoTrack:(RTCVideoTrack *)track; -- (BOOL)removeAudioTrack:(RTCAudioTrack *)track; -- (BOOL)removeVideoTrack:(RTCVideoTrack *)track; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCMediaStreamTrack.h b/talk/app/webrtc/objc/public/RTCMediaStreamTrack.h deleted file mode 100644 index 052389f128..0000000000 --- a/talk/app/webrtc/objc/public/RTCMediaStreamTrack.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "RTCTypes.h" - -@class RTCMediaStreamTrack; -@protocol RTCMediaStreamTrackDelegate - -- (void)mediaStreamTrackDidChange:(RTCMediaStreamTrack*)mediaStreamTrack; - -@end - -// RTCMediaStreamTrack implements the interface common to RTCAudioTrack and -// RTCVideoTrack. Do not create an instance of this class, rather create one -// of the derived classes. -@interface RTCMediaStreamTrack : NSObject - -@property(nonatomic, readonly) NSString* kind; -@property(nonatomic, readonly) NSString* label; -@property(nonatomic, weak) id delegate; - -- (BOOL)isEnabled; -- (BOOL)setEnabled:(BOOL)enabled; -- (RTCTrackState)state; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCNSGLVideoView.h b/talk/app/webrtc/objc/public/RTCNSGLVideoView.h deleted file mode 100644 index 2f07239ddd..0000000000 --- a/talk/app/webrtc/objc/public/RTCNSGLVideoView.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if TARGET_OS_IPHONE -#error "This file targets OSX." -#endif - -#import - -#import "RTCVideoRenderer.h" - -@class RTCNSGLVideoView; -@protocol RTCNSGLVideoViewDelegate - -- (void)videoView:(RTCNSGLVideoView*)videoView didChangeVideoSize:(CGSize)size; - -@end - -@interface RTCNSGLVideoView : NSOpenGLView - -@property(nonatomic, weak) id delegate; - -@end diff --git a/talk/app/webrtc/objc/public/RTCOpenGLVideoRenderer.h b/talk/app/webrtc/objc/public/RTCOpenGLVideoRenderer.h deleted file mode 100644 index 778930488e..0000000000 --- a/talk/app/webrtc/objc/public/RTCOpenGLVideoRenderer.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import -#if TARGET_OS_IPHONE -#import -#else -#import -#endif - -@class RTCI420Frame; - -// RTCOpenGLVideoRenderer issues appropriate OpenGL commands to draw a frame to -// the currently bound framebuffer. Supports OpenGL 3.2 and OpenGLES 2.0. OpenGL -// framebuffer creation and management should be handled elsewhere using the -// same context used to initialize this class. -@interface RTCOpenGLVideoRenderer : NSObject - -// The last successfully drawn frame. Used to avoid drawing frames unnecessarily -// hence saving battery life by reducing load. -@property(nonatomic, readonly) RTCI420Frame* lastDrawnFrame; - -#if TARGET_OS_IPHONE -- (instancetype)initWithContext:(EAGLContext*)context; -#else -- (instancetype)initWithContext:(NSOpenGLContext*)context; -#endif - -// Draws |frame| onto the currently bound OpenGL framebuffer. |setupGL| must be -// called before this function will succeed. -- (BOOL)drawFrame:(RTCI420Frame*)frame; - -// The following methods are used to manage OpenGL resources. On iOS -// applications should release resources when placed in background for use in -// the foreground application. In fact, attempting to call OpenGLES commands -// while in background will result in application termination. - -// Sets up the OpenGL state needed for rendering. -- (void)setupGL; -// Tears down the OpenGL state created by |setupGL|. -- (void)teardownGL; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCPair.h b/talk/app/webrtc/objc/public/RTCPair.h deleted file mode 100644 index 51d20e721e..0000000000 --- a/talk/app/webrtc/objc/public/RTCPair.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// A class to hold a key and value. -@interface RTCPair : NSObject - -@property(nonatomic, strong, readonly) NSString *key; -@property(nonatomic, strong, readonly) NSString *value; - -// Initialize a RTCPair object with a key and value. -- (id)initWithKey:(NSString *)key value:(NSString *)value; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnection.h b/talk/app/webrtc/objc/public/RTCPeerConnection.h deleted file mode 100644 index a13ed3ecc3..0000000000 --- a/talk/app/webrtc/objc/public/RTCPeerConnection.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCPeerConnectionDelegate.h" - -@class RTCConfiguration; -@class RTCDataChannel; -@class RTCDataChannelInit; -@class RTCICECandidate; -@class RTCICEServers; -@class RTCMediaConstraints; -@class RTCMediaStream; -@class RTCMediaStreamTrack; -@class RTCSessionDescription; -@protocol RTCSessionDescriptionDelegate; -@protocol RTCStatsDelegate; - -// RTCPeerConnection is an ObjectiveC friendly wrapper around a PeerConnection -// object. See the documentation in talk/app/webrtc/peerconnectioninterface.h. -// or http://www.webrtc.org/reference/native-apis, which in turn is inspired by -// the JS APIs: http://dev.w3.org/2011/webrtc/editor/webrtc.html and -// http://www.w3.org/TR/mediacapture-streams/ -@interface RTCPeerConnection : NSObject - -@property(nonatomic, weak) id delegate; - -// Accessor methods to active local streams. -@property(nonatomic, strong, readonly) NSArray *localStreams; - -// The local description. -@property(nonatomic, assign, readonly) RTCSessionDescription *localDescription; - -// The remote description. -@property(nonatomic, assign, readonly) RTCSessionDescription *remoteDescription; - -// The current signaling state. -@property(nonatomic, assign, readonly) RTCSignalingState signalingState; -@property(nonatomic, assign, readonly) RTCICEConnectionState iceConnectionState; -@property(nonatomic, assign, readonly) RTCICEGatheringState iceGatheringState; - -// Add a new MediaStream to be sent on this PeerConnection. -// Note that a SessionDescription negotiation is needed before the -// remote peer can receive the stream. -- (BOOL)addStream:(RTCMediaStream *)stream; - -// Remove a MediaStream from this PeerConnection. -// Note that a SessionDescription negotiation is need before the -// remote peer is notified. -- (void)removeStream:(RTCMediaStream *)stream; - -// Create a data channel. -- (RTCDataChannel*)createDataChannelWithLabel:(NSString*)label - config:(RTCDataChannelInit*)config; - -// Create a new offer. -// Success or failure will be reported via RTCSessionDescriptionDelegate. -- (void)createOfferWithDelegate:(id)delegate - constraints:(RTCMediaConstraints *)constraints; - -// Create an answer to an offer. -// Success or failure will be reported via RTCSessionDescriptionDelegate. -- (void)createAnswerWithDelegate:(id)delegate - constraints:(RTCMediaConstraints *)constraints; - -// Sets the local session description. -// Success or failure will be reported via RTCSessionDescriptionDelegate. -- (void) - setLocalDescriptionWithDelegate:(id)delegate - sessionDescription:(RTCSessionDescription *)sdp; - -// Sets the remote session description. -// Success or failure will be reported via RTCSessionDescriptionDelegate. -- (void) - setRemoteDescriptionWithDelegate:(id)delegate - sessionDescription:(RTCSessionDescription *)sdp; - -// 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; - -// Provides a remote candidate to the ICE Agent. -- (BOOL)addICECandidate:(RTCICECandidate *)candidate; - -// Terminates all media and closes the transport. -- (void)close; - -// Gets statistics for the media track. If |mediaStreamTrack| is nil statistics -// are gathered for all tracks. -// Statistics information will be reported via RTCStatsDelegate. -- (BOOL)getStatsWithDelegate:(id)delegate - mediaStreamTrack:(RTCMediaStreamTrack*)mediaStreamTrack - statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h b/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h deleted file mode 100644 index bf0c23104a..0000000000 --- a/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "RTCTypes.h" - -@class RTCDataChannel; -@class RTCICECandidate; -@class RTCMediaStream; -@class RTCPeerConnection; - -// RTCPeerConnectionDelegate is a protocol for an object that must be -// implemented to get messages from PeerConnection. -@protocol RTCPeerConnectionDelegate - -// Triggered when the SignalingState changed. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - signalingStateChanged:(RTCSignalingState)stateChanged; - -// Triggered when media is received on a new stream from remote peer. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - addedStream:(RTCMediaStream *)stream; - -// Triggered when a remote peer close a stream. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - removedStream:(RTCMediaStream *)stream; - -// Triggered when renegotiation is needed, for example the ICE has restarted. -- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection *)peerConnection; - -// Called any time the ICEConnectionState changes. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - iceConnectionChanged:(RTCICEConnectionState)newState; - -// Called any time the ICEGatheringState changes. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - iceGatheringChanged:(RTCICEGatheringState)newState; - -// New Ice candidate have been found. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - gotICECandidate:(RTCICECandidate *)candidate; - -// New data channel has been opened. -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didOpenDataChannel:(RTCDataChannel*)dataChannel; - -@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionFactory.h b/talk/app/webrtc/objc/public/RTCPeerConnectionFactory.h deleted file mode 100644 index e1e69b4b7f..0000000000 --- a/talk/app/webrtc/objc/public/RTCPeerConnectionFactory.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class RTCAudioTrack; -@class RTCConfiguration; -@class RTCMediaConstraints; -@class RTCMediaStream; -@class RTCPeerConnection; -@class RTCVideoCapturer; -@class RTCVideoSource; -@class RTCVideoTrack; -@protocol RTCPeerConnectionDelegate; - -// RTCPeerConnectionFactory is an ObjectiveC wrapper for PeerConnectionFactory. -// It is the main entry point to the PeerConnection API for clients. -@interface RTCPeerConnectionFactory : NSObject - -// Initialize & de-initialize the SSL subsystem. Failure is fatal. -+ (void)initializeSSL; -+ (void)deinitializeSSL; - -// Create an RTCPeerConnection object. RTCPeerConnectionFactory will create -// required libjingle threads, socket and network manager factory classes for -// networking. -- (RTCPeerConnection *) - peerConnectionWithICEServers:(NSArray *)servers - constraints:(RTCMediaConstraints *)constraints - delegate:(id)delegate; - -// Creates a peer connection using the default port allocator factory and identity service. -- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration - constraints:(RTCMediaConstraints *)constraints - delegate:(id)delegate; - -// Create an RTCMediaStream named |label|. -- (RTCMediaStream *)mediaStreamWithLabel:(NSString *)label; - -// Creates a RTCVideoSource. The new source takes ownership of |capturer|. -// |constraints| decides video resolution and frame rate but can be NULL. -- (RTCVideoSource *)videoSourceWithCapturer:(RTCVideoCapturer *)capturer - constraints:(RTCMediaConstraints *)constraints; - -// Creates a new local VideoTrack. The same |source| can be used in several -// tracks. -- (RTCVideoTrack *)videoTrackWithID:(NSString *)videoId - source:(RTCVideoSource *)source; - -// Creates an new AudioTrack. -- (RTCAudioTrack *)audioTrackWithID:(NSString *)audioId; - -@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h b/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h deleted file mode 100644 index 1bab99ab37..0000000000 --- a/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * libjingle - * Copyright 2015 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// See talk/app/webrtc/peerconnectioninterface.h. - -#import - -typedef NS_ENUM(NSInteger, RTCIceTransportsType) { - kRTCIceTransportsTypeNone, - kRTCIceTransportsTypeRelay, - kRTCIceTransportsTypeNoHost, - kRTCIceTransportsTypeAll, -}; - -// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1 -typedef NS_ENUM(NSInteger, RTCBundlePolicy) { - kRTCBundlePolicyBalanced, - kRTCBundlePolicyMaxBundle, - kRTCBundlePolicyMaxCompat, -}; - -// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1 -typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { - kRTCRtcpMuxPolicyNegotiate, - kRTCRtcpMuxPolicyRequire, -}; - -typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { - kRTCTcpCandidatePolicyEnabled, - kRTCTcpCandidatePolicyDisabled, -}; - -typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) { - kRTCEncryptionKeyTypeRSA, - kRTCEncryptionKeyTypeECDSA, -}; - -// Configuration object used for creating a peer connection. -@interface RTCConfiguration : NSObject - -@property(nonatomic, assign) RTCIceTransportsType iceTransportsType; -@property(nonatomic, copy) NSArray *iceServers; -@property(nonatomic, assign) RTCBundlePolicy bundlePolicy; -@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; -@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; -@property(nonatomic, assign) int audioJitterBufferMaxPackets; -@property(nonatomic, assign) int iceConnectionReceivingTimeout; -@property(nonatomic, assign) int iceBackupCandidatePairPingInterval; -@property(nonatomic, assign) RTCEncryptionKeyType keyType; - -- (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsType - bundlePolicy:(RTCBundlePolicy)bundlePolicy - rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy - tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy - audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets - iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout - iceBackupCandidatePairPingInterval:(int)iceBackupCandidatePairPingInterval; - -@end diff --git a/talk/app/webrtc/objc/public/RTCSessionDescription.h b/talk/app/webrtc/objc/public/RTCSessionDescription.h deleted file mode 100644 index e3db21cb60..0000000000 --- a/talk/app/webrtc/objc/public/RTCSessionDescription.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// Description of an RFC 4566 Session. -// RTCSessionDescription is an ObjectiveC wrapper for -// SessionDescriptionInterface. -@interface RTCSessionDescription : NSObject - -// The SDP description. -@property(nonatomic, copy, readonly) NSString *description; - -// The session type. -@property(nonatomic, copy, readonly) NSString *type; - -- (id)initWithType:(NSString *)type sdp:(NSString *)sdp; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end - diff --git a/talk/app/webrtc/objc/public/RTCSessionDescriptionDelegate.h b/talk/app/webrtc/objc/public/RTCSessionDescriptionDelegate.h deleted file mode 100644 index 2fb0af91f0..0000000000 --- a/talk/app/webrtc/objc/public/RTCSessionDescriptionDelegate.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class RTCPeerConnection; -@class RTCSessionDescription; - -extern NSString* const kRTCSessionDescriptionDelegateErrorDomain; -extern int const kRTCSessionDescriptionDelegateErrorCode; - -// RTCSessionDescriptionDelegate is a protocol for listening to callback -// messages when RTCSessionDescriptions are created or set. -@protocol RTCSessionDescriptionDelegate - -// Called when creating a session. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didCreateSessionDescription:(RTCSessionDescription *)sdp - error:(NSError *)error; - -// Called when setting a local or remote description. -- (void)peerConnection:(RTCPeerConnection *)peerConnection - didSetSessionDescriptionWithError:(NSError *)error; - -@end diff --git a/talk/app/webrtc/objc/public/RTCStatsDelegate.h b/talk/app/webrtc/objc/public/RTCStatsDelegate.h deleted file mode 100644 index 54e8e569a1..0000000000 --- a/talk/app/webrtc/objc/public/RTCStatsDelegate.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class RTCPeerConnection; - -// RTCSessionDescriptionDelegate is a protocol for receiving statistic -// reports from RTCPeerConnection. -@protocol RTCStatsDelegate - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didGetStats:(NSArray*)stats; // NSArray of RTCStatsReport*. - -@end diff --git a/talk/app/webrtc/objc/public/RTCStatsReport.h b/talk/app/webrtc/objc/public/RTCStatsReport.h deleted file mode 100644 index 691c1aa600..0000000000 --- a/talk/app/webrtc/objc/public/RTCStatsReport.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * libjingle - * Copyright 2014 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// ObjectiveC friendly wrapper around a StatsReport object. -// See talk/app/webrtc/statsypes.h -@interface RTCStatsReport : NSObject - -@property(nonatomic, readonly) NSString* reportId; -@property(nonatomic, readonly) NSString* type; -@property(nonatomic, readonly) CFTimeInterval timestamp; -@property(nonatomic, readonly) NSArray* values; // NSArray of RTCPair*. - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCTypes.h b/talk/app/webrtc/objc/public/RTCTypes.h deleted file mode 100644 index 1baa4b5067..0000000000 --- a/talk/app/webrtc/objc/public/RTCTypes.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Enums that are common to the ObjectiveC version of the PeerConnection API. - -// RTCICEConnectionState correspond to the states in webrtc::ICEConnectionState. -typedef enum { - RTCICEConnectionNew, - RTCICEConnectionChecking, - RTCICEConnectionConnected, - RTCICEConnectionCompleted, - RTCICEConnectionFailed, - RTCICEConnectionDisconnected, - RTCICEConnectionClosed, - RTCICEConnectionMax, -} RTCICEConnectionState; - -// RTCICEGatheringState the states in webrtc::ICEGatheringState. -typedef enum { - RTCICEGatheringNew, - RTCICEGatheringGathering, - RTCICEGatheringComplete, -} RTCICEGatheringState; - -// RTCSignalingState correspond to the states in webrtc::SignalingState. -typedef enum { - RTCSignalingStable, - RTCSignalingHaveLocalOffer, - RTCSignalingHaveLocalPrAnswer, - RTCSignalingHaveRemoteOffer, - RTCSignalingHaveRemotePrAnswer, - RTCSignalingClosed, -} RTCSignalingState; - -// RTCStatsOutputLevel correspond to webrtc::StatsOutputLevel -typedef enum { - RTCStatsOutputLevelStandard, - RTCStatsOutputLevelDebug, -} RTCStatsOutputLevel; - -// RTCSourceState corresponds to the states in webrtc::SourceState. -typedef enum { - RTCSourceStateInitializing, - RTCSourceStateLive, - RTCSourceStateEnded, - RTCSourceStateMuted, -} RTCSourceState; - -// RTCTrackState corresponds to the states in webrtc::TrackState. -typedef enum { - RTCTrackStateLive, - RTCTrackStateEnded, -} RTCTrackState; diff --git a/talk/app/webrtc/objc/public/RTCVideoCapturer.h b/talk/app/webrtc/objc/public/RTCVideoCapturer.h deleted file mode 100644 index d07c091fad..0000000000 --- a/talk/app/webrtc/objc/public/RTCVideoCapturer.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -// RTCVideoCapturer is an ObjectiveC wrapper for VideoCapturerInterface. -@interface RTCVideoCapturer : NSObject - -// Create a new video capturer using the specified device. -+ (RTCVideoCapturer *)capturerWithDeviceName:(NSString *)deviceName; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCVideoRenderer.h b/talk/app/webrtc/objc/public/RTCVideoRenderer.h deleted file mode 100644 index c837b1c5ac..0000000000 --- a/talk/app/webrtc/objc/public/RTCVideoRenderer.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import -#if TARGET_OS_IPHONE -#import -#endif - -@class RTCI420Frame; - -@protocol RTCVideoRenderer - -// The size of the frame. -- (void)setSize:(CGSize)size; - -// The frame to be displayed. -- (void)renderFrame:(RTCI420Frame*)frame; - -@end diff --git a/talk/app/webrtc/objc/public/RTCVideoSource.h b/talk/app/webrtc/objc/public/RTCVideoSource.h deleted file mode 100644 index 15a9262b29..0000000000 --- a/talk/app/webrtc/objc/public/RTCVideoSource.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaSource.h" - -// RTCVideoSource is an ObjectiveC wrapper for VideoSourceInterface. -@interface RTCVideoSource : RTCMediaSource - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objc/public/RTCVideoTrack.h b/talk/app/webrtc/objc/public/RTCVideoTrack.h deleted file mode 100644 index 332c3ea80d..0000000000 --- a/talk/app/webrtc/objc/public/RTCVideoTrack.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "RTCMediaStreamTrack.h" - -@protocol RTCVideoRenderer; -@class RTCPeerConnectionFactory; -@class RTCVideoSource; - -// RTCVideoTrack is an ObjectiveC wrapper for VideoTrackInterface. -@interface RTCVideoTrack : RTCMediaStreamTrack - -@property(nonatomic, readonly) RTCVideoSource* source; - -- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory - source:(RTCVideoSource*)source - trackId:(NSString*)trackId; - -// Register a renderer that will render all frames received on this track. -- (void)addRenderer:(id)renderer; - -// Deregister a renderer. -- (void)removeRenderer:(id)renderer; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__( - (unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/talk/app/webrtc/objctests/Info.plist b/talk/app/webrtc/objctests/Info.plist deleted file mode 100644 index c2fb0617f3..0000000000 --- a/talk/app/webrtc/objctests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.Google.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - - diff --git a/talk/app/webrtc/objctests/OWNERS b/talk/app/webrtc/objctests/OWNERS deleted file mode 100644 index cd06158b7f..0000000000 --- a/talk/app/webrtc/objctests/OWNERS +++ /dev/null @@ -1 +0,0 @@ -tkchin@webrtc.org diff --git a/talk/app/webrtc/objctests/README b/talk/app/webrtc/objctests/README deleted file mode 100644 index ebbb2c2603..0000000000 --- a/talk/app/webrtc/objctests/README +++ /dev/null @@ -1 +0,0 @@ -See ../objc/README for information on what this is and how to use it. diff --git a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.h b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.h deleted file mode 100644 index 7c49e1d768..0000000000 --- a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "RTCDataChannel.h" -#import "RTCPeerConnectionDelegate.h" - -// Observer of PeerConnection events, used by RTCPeerConnectionTest to check -// expectations. -@interface RTCPeerConnectionSyncObserver - : NSObject -@property(nonatomic) RTCDataChannel* dataChannel; -// TODO(hughv): Add support for RTCVideoRendererDelegate when Video is enabled. - -// Transfer received ICE candidates to the caller. -- (NSArray*)releaseReceivedICECandidates; - -// Register expectations for events that this observer should see before it can -// be considered satisfied (see below). -- (void)expectError; -- (void)expectSignalingChange:(RTCSignalingState)state; -- (void)expectAddStream:(NSString *)label; -- (void)expectRemoveStream:(NSString *)label; -- (void)expectICECandidates:(int)count; -- (void)expectICEConnectionChange:(RTCICEConnectionState)state; -- (void)expectICEGatheringChange:(RTCICEGatheringState)state; -- (void)expectDataChannel:(NSString*)label; -- (void)expectStateChange:(RTCDataChannelState)state; -- (void)expectMessage:(NSData*)message isBinary:(BOOL)isBinary; - -// Wait until all registered expectations above have been observed. -// Return false if expectations aren't met within |timeoutSeconds|. -- (BOOL)waitForAllExpectationsToBeSatisfiedWithTimeout:(NSTimeInterval)timeout; - -@end diff --git a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m b/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m deleted file mode 100644 index 892c461980..0000000000 --- a/talk/app/webrtc/objctests/RTCPeerConnectionSyncObserver.m +++ /dev/null @@ -1,263 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCPeerConnectionSyncObserver.h" - -#import "RTCMediaStream.h" - -@implementation RTCPeerConnectionSyncObserver { - int _expectedErrors; - NSMutableArray* _expectedSignalingChanges; - NSMutableArray* _expectedAddStreamLabels; - NSMutableArray* _expectedRemoveStreamLabels; - int _expectedICECandidates; - NSMutableArray* _receivedICECandidates; - NSMutableArray* _expectedICEConnectionChanges; - NSMutableArray* _expectedICEGatheringChanges; - NSMutableArray* _expectedDataChannels; - NSMutableArray* _expectedStateChanges; - NSMutableArray* _expectedMessages; -} - -- (id)init { - self = [super init]; - if (self) { - _expectedSignalingChanges = [NSMutableArray array]; - _expectedSignalingChanges = [NSMutableArray array]; - _expectedAddStreamLabels = [NSMutableArray array]; - _expectedRemoveStreamLabels = [NSMutableArray array]; - _receivedICECandidates = [NSMutableArray array]; - _expectedICEConnectionChanges = [NSMutableArray array]; - _expectedICEGatheringChanges = [NSMutableArray array]; - _expectedDataChannels = [NSMutableArray array]; - _expectedMessages = [NSMutableArray array]; - _expectedStateChanges = [NSMutableArray array]; - } - return self; -} - -- (int)popFirstElementAsInt:(NSMutableArray*)array { - NSAssert([array count] > 0, @"Empty array"); - NSNumber* boxedState = [array objectAtIndex:0]; - [array removeObjectAtIndex:0]; - return [boxedState intValue]; -} - -- (NSString*)popFirstElementAsNSString:(NSMutableArray*)array { - NSAssert([array count] > 0, @"Empty expectation array"); - NSString* string = [array objectAtIndex:0]; - [array removeObjectAtIndex:0]; - return string; -} - -- (BOOL)areAllExpectationsSatisfied { - return _expectedICECandidates <= 0 && // See comment in gotICECandidate. - _expectedErrors == 0 && [_expectedSignalingChanges count] == 0 && - [_expectedICEConnectionChanges count] == 0 && - [_expectedICEGatheringChanges count] == 0 && - [_expectedAddStreamLabels count] == 0 && - [_expectedRemoveStreamLabels count] == 0 && - [_expectedDataChannels count] == 0 && - [_expectedStateChanges count] == 0 && - [_expectedMessages count] == 0; - // TODO(hughv): Test video state here too. -} - -- (NSArray*)releaseReceivedICECandidates { - NSArray* ret = _receivedICECandidates; - _receivedICECandidates = [NSMutableArray array]; - return ret; -} - -- (void)expectError { - ++_expectedErrors; -} - -- (void)expectSignalingChange:(RTCSignalingState)state { - [_expectedSignalingChanges addObject:@((int)state)]; -} - -- (void)expectAddStream:(NSString*)label { - [_expectedAddStreamLabels addObject:label]; -} - -- (void)expectRemoveStream:(NSString*)label { - [_expectedRemoveStreamLabels addObject:label]; -} - -- (void)expectICECandidates:(int)count { - _expectedICECandidates += count; -} - -- (void)expectICEConnectionChange:(RTCICEConnectionState)state { - [_expectedICEConnectionChanges addObject:@((int)state)]; -} - -- (void)expectICEGatheringChange:(RTCICEGatheringState)state { - [_expectedICEGatheringChanges addObject:@((int)state)]; -} - -- (void)expectDataChannel:(NSString*)label { - [_expectedDataChannels addObject:label]; -} - -- (void)expectStateChange:(RTCDataChannelState)state { - [_expectedStateChanges addObject:@(state)]; -} - -- (void)expectMessage:(NSData*)message isBinary:(BOOL)isBinary { - RTCDataBuffer* buffer = [[RTCDataBuffer alloc] initWithData:message - isBinary:isBinary]; - [_expectedMessages addObject:buffer]; -} - -- (BOOL)waitForAllExpectationsToBeSatisfiedWithTimeout:(NSTimeInterval)timeout { - NSParameterAssert(timeout >= 0); - // TODO (fischman): Revisit. Keeping in sync with the Java version, but - // polling is not optimal. - // https://code.google.com/p/libjingle/source/browse/trunk/talk/app/webrtc/javatests/src/org/webrtc/PeerConnectionTest.java?line=212#212 - NSDate *startTime = [NSDate date]; - while (![self areAllExpectationsSatisfied]) { - if (startTime.timeIntervalSinceNow < -timeout) { - return NO; - } - [[NSRunLoop currentRunLoop] - runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; - } - return YES; -} - -#pragma mark - RTCPeerConnectionDelegate methods - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - signalingStateChanged:(RTCSignalingState)stateChanged { - int expectedState = [self popFirstElementAsInt:_expectedSignalingChanges]; - NSString* message = - [NSString stringWithFormat:@"RTCPeerConnectionDelegate::" - @"onSignalingStateChange [%d] expected[%d]", - stateChanged, - expectedState]; - NSAssert(expectedState == (int)stateChanged, message); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - addedStream:(RTCMediaStream*)stream { - NSString* expectedLabel = - [self popFirstElementAsNSString:_expectedAddStreamLabels]; - NSAssert([expectedLabel isEqual:stream.label], @"Stream not expected"); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - removedStream:(RTCMediaStream*)stream { - NSString* expectedLabel = - [self popFirstElementAsNSString:_expectedRemoveStreamLabels]; - NSAssert([expectedLabel isEqual:stream.label], @"Stream not expected"); -} - -- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection*)peerConnection { -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - gotICECandidate:(RTCICECandidate*)candidate { - --_expectedICECandidates; - // We don't assert expectedICECandidates >= 0 because it's hard to know - // how many to expect, in general. We only use expectICECandidates to - // assert a minimal count. - [_receivedICECandidates addObject:candidate]; -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - iceGatheringChanged:(RTCICEGatheringState)newState { - // It's fine to get a variable number of GATHERING messages before - // COMPLETE fires (depending on how long the test runs) so we don't assert - // any particular count. - if (newState == RTCICEGatheringGathering) { - return; - } - NSAssert([_expectedICEGatheringChanges count] > 0, - @"Unexpected ICE gathering state change"); - int expectedState = [self popFirstElementAsInt:_expectedICEGatheringChanges]; - NSAssert(expectedState == (int)newState, - @"ICE gathering state should match expectation"); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - iceConnectionChanged:(RTCICEConnectionState)newState { - // See TODO(fischman) in RTCPeerConnectionTest.mm about Completed. - if (newState == RTCICEConnectionCompleted) - return; - NSAssert([_expectedICEConnectionChanges count] > 0, - @"Unexpected ICE connection state change"); - int expectedState = [self popFirstElementAsInt:_expectedICEConnectionChanges]; - NSAssert(expectedState == (int)newState, - @"ICE connection state should match expectation"); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didOpenDataChannel:(RTCDataChannel*)dataChannel { - NSString* expectedLabel = - [self popFirstElementAsNSString:_expectedDataChannels]; - NSAssert([expectedLabel isEqual:dataChannel.label], - @"Data channel not expected"); - self.dataChannel = dataChannel; - dataChannel.delegate = self; - NSAssert(kRTCDataChannelStateConnecting == dataChannel.state, - @"Unexpected state"); -} - -#pragma mark - RTCDataChannelDelegate - -- (void)channelDidChangeState:(RTCDataChannel*)channel { - NSAssert([_expectedStateChanges count] > 0, - @"Unexpected state change"); - int expectedState = [self popFirstElementAsInt:_expectedStateChanges]; - NSAssert(expectedState == channel.state, @"Channel state should match"); -} - -- (void)channel:(RTCDataChannel*)channel - didChangeBufferedAmount:(NSUInteger)previousAmount { - NSAssert(channel.bufferedAmount != previousAmount, - @"Invalid bufferedAmount change"); -} - -- (void)channel:(RTCDataChannel*)channel - didReceiveMessageWithBuffer:(RTCDataBuffer*)buffer { - NSAssert([_expectedMessages count] > 0, - @"Unexpected message received"); - RTCDataBuffer* expectedBuffer = [_expectedMessages objectAtIndex:0]; - NSAssert(expectedBuffer.isBinary == buffer.isBinary, - @"Buffer isBinary should match"); - NSAssert([expectedBuffer.data isEqual:buffer.data], - @"Buffer data should match"); - [_expectedMessages removeObjectAtIndex:0]; -} - -@end diff --git a/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm b/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm deleted file mode 100644 index f447ae9ba8..0000000000 --- a/talk/app/webrtc/objctests/RTCPeerConnectionTest.mm +++ /dev/null @@ -1,350 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "RTCICEServer.h" -#import "RTCMediaConstraints.h" -#import "RTCMediaStream.h" -#import "RTCPair.h" -#import "RTCPeerConnection.h" -#import "RTCPeerConnectionFactory.h" -#import "RTCPeerConnectionSyncObserver.h" -#import "RTCSessionDescription.h" -#import "RTCSessionDescriptionSyncObserver.h" -#import "RTCVideoRenderer.h" -#import "RTCVideoTrack.h" - -#include "webrtc/base/gunit.h" -#include "webrtc/base/ssladapter.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -const NSTimeInterval kRTCPeerConnectionTestTimeout = 20; - -@interface RTCFakeRenderer : NSObject -@end - -@implementation RTCFakeRenderer - -- (void)setSize:(CGSize)size {} -- (void)renderFrame:(RTCI420Frame*)frame {} - -@end - -@interface RTCPeerConnectionTest : NSObject - -// Returns whether the two sessions are of the same type. -+ (BOOL)isSession:(RTCSessionDescription*)session1 - ofSameTypeAsSession:(RTCSessionDescription*)session2; - -// Create and add tracks to pc, with the given source, label, and IDs -- (RTCMediaStream*)addTracksToPeerConnection:(RTCPeerConnection*)pc - withFactory:(RTCPeerConnectionFactory*)factory - videoSource:(RTCVideoSource*)videoSource - streamLabel:(NSString*)streamLabel - videoTrackID:(NSString*)videoTrackID - audioTrackID:(NSString*)audioTrackID; - -- (void)testCompleteSessionWithFactory:(RTCPeerConnectionFactory*)factory; - -@end - -@implementation RTCPeerConnectionTest - -+ (BOOL)isSession:(RTCSessionDescription*)session1 - ofSameTypeAsSession:(RTCSessionDescription*)session2 { - return [session1.type isEqual:session2.type]; -} - -- (RTCMediaStream*)addTracksToPeerConnection:(RTCPeerConnection*)pc - withFactory:(RTCPeerConnectionFactory*)factory - videoSource:(RTCVideoSource*)videoSource - streamLabel:(NSString*)streamLabel - videoTrackID:(NSString*)videoTrackID - audioTrackID:(NSString*)audioTrackID { - RTCMediaStream* localMediaStream = [factory mediaStreamWithLabel:streamLabel]; - // TODO(zeke): Fix this test to create a fake video capturer so that a track - // can be created. - if (videoSource) { - RTCVideoTrack* videoTrack = - [factory videoTrackWithID:videoTrackID source:videoSource]; - RTCFakeRenderer* videoRenderer = [[RTCFakeRenderer alloc] init]; - [videoTrack addRenderer:videoRenderer]; - [localMediaStream addVideoTrack:videoTrack]; - // Test that removal/re-add works. - [localMediaStream removeVideoTrack:videoTrack]; - [localMediaStream addVideoTrack:videoTrack]; - } - RTCAudioTrack* audioTrack = [factory audioTrackWithID:audioTrackID]; - [localMediaStream addAudioTrack:audioTrack]; - [pc addStream:localMediaStream]; - return localMediaStream; -} - -- (void)testCompleteSessionWithFactory:(RTCPeerConnectionFactory*)factory { - NSArray* mandatory = @[ - [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" value:@"true"], - [[RTCPair alloc] initWithKey:@"internalSctpDataChannels" value:@"true"], - ]; - RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] init]; - RTCMediaConstraints* pcConstraints = - [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatory - optionalConstraints:nil]; - - RTCPeerConnectionSyncObserver* offeringExpectations = - [[RTCPeerConnectionSyncObserver alloc] init]; - RTCPeerConnection* pcOffer = - [factory peerConnectionWithICEServers:nil - constraints:pcConstraints - delegate:offeringExpectations]; - - RTCPeerConnectionSyncObserver* answeringExpectations = - [[RTCPeerConnectionSyncObserver alloc] init]; - - RTCPeerConnection* pcAnswer = - [factory peerConnectionWithICEServers:nil - constraints:pcConstraints - delegate:answeringExpectations]; - // TODO(hughv): Create video capturer - RTCVideoCapturer* capturer = nil; - RTCVideoSource* videoSource = - [factory videoSourceWithCapturer:capturer constraints:constraints]; - - // Here and below, "oLMS" refers to offerer's local media stream, and "aLMS" - // refers to the answerer's local media stream, with suffixes of "a0" and "v0" - // for audio and video tracks, resp. These mirror chrome historical naming. - RTCMediaStream* oLMSUnused = [self addTracksToPeerConnection:pcOffer - withFactory:factory - videoSource:videoSource - streamLabel:@"oLMS" - videoTrackID:@"oLMSv0" - audioTrackID:@"oLMSa0"]; - - RTCDataChannel* offerDC = - [pcOffer createDataChannelWithLabel:@"offerDC" - config:[[RTCDataChannelInit alloc] init]]; - EXPECT_TRUE([offerDC.label isEqual:@"offerDC"]); - offerDC.delegate = offeringExpectations; - offeringExpectations.dataChannel = offerDC; - - RTCSessionDescriptionSyncObserver* sdpObserver = - [[RTCSessionDescriptionSyncObserver alloc] init]; - [pcOffer createOfferWithDelegate:sdpObserver constraints:constraints]; - [sdpObserver wait]; - EXPECT_TRUE(sdpObserver.success); - RTCSessionDescription* offerSDP = sdpObserver.sessionDescription; - EXPECT_EQ([@"offer" compare:offerSDP.type options:NSCaseInsensitiveSearch], - NSOrderedSame); - EXPECT_GT([offerSDP.description length], 0); - - sdpObserver = [[RTCSessionDescriptionSyncObserver alloc] init]; - [answeringExpectations expectSignalingChange:RTCSignalingHaveRemoteOffer]; - [answeringExpectations expectAddStream:@"oLMS"]; - [pcAnswer setRemoteDescriptionWithDelegate:sdpObserver - sessionDescription:offerSDP]; - [sdpObserver wait]; - - RTCMediaStream* aLMSUnused = [self addTracksToPeerConnection:pcAnswer - withFactory:factory - videoSource:videoSource - streamLabel:@"aLMS" - videoTrackID:@"aLMSv0" - audioTrackID:@"aLMSa0"]; - - sdpObserver = [[RTCSessionDescriptionSyncObserver alloc] init]; - [pcAnswer createAnswerWithDelegate:sdpObserver constraints:constraints]; - [sdpObserver wait]; - EXPECT_TRUE(sdpObserver.success); - RTCSessionDescription* answerSDP = sdpObserver.sessionDescription; - EXPECT_EQ([@"answer" compare:answerSDP.type options:NSCaseInsensitiveSearch], - NSOrderedSame); - EXPECT_GT([answerSDP.description length], 0); - - [offeringExpectations expectICECandidates:2]; - // It's possible to only have 1 ICE candidate for the answerer, since we use - // BUNDLE and rtcp-mux by default, and don't provide any ICE servers in this - // test. - [answeringExpectations expectICECandidates:1]; - - sdpObserver = [[RTCSessionDescriptionSyncObserver alloc] init]; - [answeringExpectations expectSignalingChange:RTCSignalingStable]; - [pcAnswer setLocalDescriptionWithDelegate:sdpObserver - sessionDescription:answerSDP]; - [sdpObserver wait]; - EXPECT_TRUE(sdpObserver.sessionDescription == NULL); - - sdpObserver = [[RTCSessionDescriptionSyncObserver alloc] init]; - [offeringExpectations expectSignalingChange:RTCSignalingHaveLocalOffer]; - [pcOffer setLocalDescriptionWithDelegate:sdpObserver - sessionDescription:offerSDP]; - [sdpObserver wait]; - EXPECT_TRUE(sdpObserver.sessionDescription == NULL); - - [offeringExpectations expectICEConnectionChange:RTCICEConnectionChecking]; - [offeringExpectations expectICEConnectionChange:RTCICEConnectionConnected]; - // TODO(fischman): figure out why this is flaky and re-introduce (and remove - // special-casing from the observer!). - // [offeringExpectations expectICEConnectionChange:RTCICEConnectionCompleted]; - [answeringExpectations expectICEConnectionChange:RTCICEConnectionChecking]; - [answeringExpectations expectICEConnectionChange:RTCICEConnectionConnected]; - - [offeringExpectations expectStateChange:kRTCDataChannelStateOpen]; - [answeringExpectations expectDataChannel:@"offerDC"]; - [answeringExpectations expectStateChange:kRTCDataChannelStateOpen]; - - [offeringExpectations expectICEGatheringChange:RTCICEGatheringComplete]; - [answeringExpectations expectICEGatheringChange:RTCICEGatheringComplete]; - - sdpObserver = [[RTCSessionDescriptionSyncObserver alloc] init]; - [offeringExpectations expectSignalingChange:RTCSignalingStable]; - [offeringExpectations expectAddStream:@"aLMS"]; - [pcOffer setRemoteDescriptionWithDelegate:sdpObserver - sessionDescription:answerSDP]; - [sdpObserver wait]; - EXPECT_TRUE(sdpObserver.sessionDescription == NULL); - - EXPECT_TRUE([offerSDP.type isEqual:pcOffer.localDescription.type]); - EXPECT_TRUE([answerSDP.type isEqual:pcOffer.remoteDescription.type]); - EXPECT_TRUE([offerSDP.type isEqual:pcAnswer.remoteDescription.type]); - EXPECT_TRUE([answerSDP.type isEqual:pcAnswer.localDescription.type]); - - for (RTCICECandidate* candidate in offeringExpectations - .releaseReceivedICECandidates) { - [pcAnswer addICECandidate:candidate]; - } - for (RTCICECandidate* candidate in answeringExpectations - .releaseReceivedICECandidates) { - [pcOffer addICECandidate:candidate]; - } - - EXPECT_TRUE( - [offeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - EXPECT_TRUE( - [answeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - - EXPECT_EQ(pcOffer.signalingState, RTCSignalingStable); - EXPECT_EQ(pcAnswer.signalingState, RTCSignalingStable); - - // Test send and receive UTF-8 text - NSString* text = @"你好"; - NSData* textData = [text dataUsingEncoding:NSUTF8StringEncoding]; - RTCDataBuffer* buffer = - [[RTCDataBuffer alloc] initWithData:textData isBinary:NO]; - [answeringExpectations expectMessage:[textData copy] isBinary:NO]; - EXPECT_TRUE([offeringExpectations.dataChannel sendData:buffer]); - EXPECT_TRUE( - [answeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - - // Test send and receive binary data - const size_t byteLength = 5; - char bytes[byteLength] = {1, 2, 3, 4, 5}; - NSData* byteData = [NSData dataWithBytes:bytes length:byteLength]; - buffer = [[RTCDataBuffer alloc] initWithData:byteData isBinary:YES]; - [answeringExpectations expectMessage:[byteData copy] isBinary:YES]; - EXPECT_TRUE([offeringExpectations.dataChannel sendData:buffer]); - EXPECT_TRUE( - [answeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - - [offeringExpectations expectStateChange:kRTCDataChannelStateClosing]; - [answeringExpectations expectStateChange:kRTCDataChannelStateClosing]; - [offeringExpectations expectStateChange:kRTCDataChannelStateClosed]; - [answeringExpectations expectStateChange:kRTCDataChannelStateClosed]; - - [answeringExpectations.dataChannel close]; - [offeringExpectations.dataChannel close]; - - EXPECT_TRUE( - [offeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - EXPECT_TRUE( - [answeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - // Don't need to listen to further state changes. - // TODO(tkchin): figure out why Closed->Closing without this. - offeringExpectations.dataChannel.delegate = nil; - answeringExpectations.dataChannel.delegate = nil; - - // Let the audio feedback run for 2s to allow human testing and to ensure - // things stabilize. TODO(fischman): replace seconds with # of video frames, - // when we have video flowing. - [[NSRunLoop currentRunLoop] - runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2]]; - - [offeringExpectations expectICEConnectionChange:RTCICEConnectionClosed]; - [answeringExpectations expectICEConnectionChange:RTCICEConnectionClosed]; - [offeringExpectations expectSignalingChange:RTCSignalingClosed]; - [answeringExpectations expectSignalingChange:RTCSignalingClosed]; - - [pcOffer close]; - [pcAnswer close]; - - EXPECT_TRUE( - [offeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - EXPECT_TRUE( - [answeringExpectations waitForAllExpectationsToBeSatisfiedWithTimeout: - kRTCPeerConnectionTestTimeout]); - - capturer = nil; - videoSource = nil; - pcOffer = nil; - pcAnswer = nil; - // TODO(fischman): be stricter about shutdown checks; ensure thread - // counts return to where they were before the test kicked off, and - // that all objects have in fact shut down. -} - -@end - -// TODO(fischman): move {Initialize,Cleanup}SSL into alloc/dealloc of -// RTCPeerConnectionTest and avoid the appearance of RTCPeerConnectionTest being -// a TestBase since it's not. -TEST(RTCPeerConnectionTest, SessionTest) { - @autoreleasepool { - rtc::InitializeSSL(); - // Since |factory| will own the signaling & worker threads, it's important - // that it outlive the created PeerConnections since they self-delete on the - // signaling thread, and if |factory| is freed first then a last refcount on - // the factory will expire during this teardown, causing the signaling - // thread to try to Join() with itself. This is a hack to ensure that the - // factory outlives RTCPeerConnection:dealloc. - // See https://code.google.com/p/webrtc/issues/detail?id=3100. - RTCPeerConnectionFactory* factory = [[RTCPeerConnectionFactory alloc] init]; - @autoreleasepool { - RTCPeerConnectionTest* pcTest = [[RTCPeerConnectionTest alloc] init]; - [pcTest testCompleteSessionWithFactory:factory]; - } - rtc::CleanupSSL(); - } -} diff --git a/talk/app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h b/talk/app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h deleted file mode 100644 index bc83eaf950..0000000000 --- a/talk/app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#import "RTCSessionDescriptionDelegate.h" - -@class RTCSessionDescription; - -// Observer of SDP-related events, used by RTCPeerConnectionTest to check -// expectations. -@interface RTCSessionDescriptionSyncObserver : NSObject< - RTCSessionDescriptionDelegate> - -// Error string. May be nil. -@property(atomic, copy) NSString *error; -// Created session description. May be nil. -@property(atomic, strong) RTCSessionDescription *sessionDescription; -// Whether an SDP-related callback reported success. -@property(atomic, assign) BOOL success; - -// Wait for an SDP-related callback to fire. -- (void)wait; - -@end diff --git a/talk/app/webrtc/objctests/RTCSessionDescriptionSyncObserver.m b/talk/app/webrtc/objctests/RTCSessionDescriptionSyncObserver.m deleted file mode 100644 index 31b0efe0d5..0000000000 --- a/talk/app/webrtc/objctests/RTCSessionDescriptionSyncObserver.m +++ /dev/null @@ -1,103 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -#import "RTCSessionDescriptionSyncObserver.h" - -#import "RTCSessionDescription.h" - -@interface RTCSessionDescriptionSyncObserver () - -// CondVar used to wait for, and signal arrival of, an SDP-related callback. -@property(nonatomic, strong) NSCondition* condition; -// Whether an SDP-related callback has fired; cleared before wait returns. -@property(atomic, assign) BOOL signaled; - -@end - -@implementation RTCSessionDescriptionSyncObserver - -@synthesize error = _error; -@synthesize sessionDescription = _sessionDescription; -@synthesize success = _success; -@synthesize condition = _condition; -@synthesize signaled = _signaled; - -- (id)init { - if ((self = [super init])) { - if (!(_condition = [[NSCondition alloc] init])) - self = nil; - } - return self; -} - -- (void)signal { - self.signaled = YES; - [self.condition signal]; -} - -- (void)wait { - [self.condition lock]; - if (!self.signaled) - [self.condition wait]; - self.signaled = NO; - [self.condition unlock]; -} - -#pragma mark - RTCSessionDescriptionDelegate methods -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didCreateSessionDescription:(RTCSessionDescription*)sdp - error:(NSError*)error { - [self.condition lock]; - if (error) { - self.success = NO; - self.error = error.description; - } else { - self.success = YES; - self.sessionDescription = sdp; - } - [self signal]; - [self.condition unlock]; -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didSetSessionDescriptionWithError:(NSError*)error { - [self.condition lock]; - if (error) { - self.success = NO; - self.error = error.description; - } else { - self.success = YES; - } - [self signal]; - [self.condition unlock]; -} - -@end diff --git a/talk/app/webrtc/objctests/mac/main.mm b/talk/app/webrtc/objctests/mac/main.mm deleted file mode 100644 index 78ccf32afc..0000000000 --- a/talk/app/webrtc/objctests/mac/main.mm +++ /dev/null @@ -1,37 +0,0 @@ -/* - * libjingle - * Copyright 2013 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "webrtc/base/gunit.h" - -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - -int main(int argc, char* argv[]) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/talk/build/common.gypi b/talk/build/common.gypi deleted file mode 100644 index 4ee78f1c47..0000000000 --- a/talk/build/common.gypi +++ /dev/null @@ -1,127 +0,0 @@ -# -# libjingle -# Copyright 2012 Google Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# This file contains common settings for building libjingle components. - -{ - 'variables': { - 'webrtc_root%': '<(DEPTH)/webrtc', - # TODO(ronghuawu): For now, disable the Chrome plugins, which causes a - # flood of chromium-style warnings. - 'clang_use_chrome_plugins%': 0, - # Disable these to not build components which can be externally provided. - 'build_json%': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '<(DEPTH)', - '../..', - '../../third_party', - '../../third_party/webrtc', - '../../webrtc', - ], - 'conditions': [ - ['OS=="linux"', { - 'defines': [ - 'WEBRTC_LINUX', - ], - # Remove Chromium's disabling of the -Wformat warning. - 'cflags!': [ - '-Wno-format', - ], - 'conditions': [ - ['clang==1', { - 'cflags': [ - '-Wall', - '-Wextra', - '-Wformat', - '-Wformat-security', - '-Wimplicit-fallthrough', - '-Wmissing-braces', - '-Wreorder', - '-Wunused-variable', - # TODO(ronghuawu): Fix the warning caused by - # LateBindingSymbolTable::TableInfo from - # latebindingsymboltable.cc.def and remove below flag. - '-Wno-address-of-array-temporary', - '-Wthread-safety', - ], - 'cflags_cc': [ - '-Wunused-private-field', - ], - }], - ], - }], - ['OS=="mac"', { - 'defines': [ - 'WEBRTC_MAC', - ], - }], - ['OS=="win"', { - 'defines': [ - 'WEBRTC_WIN', - ], - 'msvs_disabled_warnings': [ - # https://code.google.com/p/chromium/issues/detail?id=372451#c20 - # Warning 4702 ("Unreachable code") should be re-enabled once - # users are updated to VS2013 Update 2. - 4702, - ], - }], - ['OS=="ios"', { - 'defines': [ - 'WEBRTC_MAC', - 'WEBRTC_IOS', - ], - }], - ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', { - 'defines': [ - 'CARBON_DEPRECATED=YES', - ], - }], - ['os_posix==1', { - 'configurations': { - 'Debug_Base': { - 'defines': [ - # Chromium's build/common.gypi defines this for all posix _except_ - # for ios & mac. We want it there as well, e.g. because ASSERT - # and friends trigger off of it. - '_DEBUG', - ], - }, - }, - 'defines': [ - 'HASH_NAMESPACE=__gnu_cxx', - 'WEBRTC_POSIX', - 'DISABLE_DYNAMIC_CAST', - # The POSIX standard says we have to define this. - '_REENTRANT', - ], - }], - ], - }, # target_defaults -} diff --git a/talk/codereview.settings b/talk/codereview.settings deleted file mode 100644 index c441cc61bc..0000000000 --- a/talk/codereview.settings +++ /dev/null @@ -1,5 +0,0 @@ - -Creating CLs from this location is not supported! Please make sure the current -working directory is the parent directory of this directory. -If you're working with a Chromium checkout, you'll have to create a full WebRTC -checkout and upload a CL from that. See http://www.webrtc.org for instructions. diff --git a/webrtc/LICENSE_THIRD_PARTY b/webrtc/LICENSE_THIRD_PARTY index b64dbbab46..c7adbd310b 100644 --- a/webrtc/LICENSE_THIRD_PARTY +++ b/webrtc/LICENSE_THIRD_PARTY @@ -2,6 +2,14 @@ This source tree contains third party source code which is governed by third party licenses. Paths to the files and associated licenses are collected here. Files governed by third party licenses: +base/base64.cc +base/base64.h +base/md5.cc +base/md5.h +base/sha1.cc +base/sha1.h +base/sigslot.cc +base/sigslot.h common_audio/fft4g.c common_audio/signal_processing/spl_sqrt_floor.c common_audio/signal_processing/spl_sqrt_floor_arm.S @@ -23,6 +31,67 @@ system_wrappers/source/spreadsortlib/spreadsort.hpp Individual licenses for each file: ------------------------------------------------------------------------------- Files: +base/base64.cc +base/base64.h + +License: +//********************************************************************* +//* Base64 - a simple base64 encoder and decoder. +//* +//* Copyright (c) 1999, Bob Withers - bwit@pobox.com +//* +//* This code may be freely used for any purpose, either personal +//* or commercial, provided the authors copyright notice remains +//* intact. +//* +//* Enhancements by Stanley Yamane: +//* o reverse lookup table for the decode function +//* o reserve string buffer space in advance +//* +//********************************************************************* +------------------------------------------------------------------------------- +Files: +base/md5.cc +base/md5.h + +License: +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * +------------------------------------------------------------------------------- +Files: +base/sha1.cc +base/sha1.h + +License: +/* + * SHA-1 in C + * By Steve Reid + * 100% Public Domain + * + * ----------------- + * Modified 7/98 + * By James H. Brown + * Still 100% Public Domain + * +------------------------------------------------------------------------------- +Files: +base/sigslot.cc +base/sigslot.h + +License: +// sigslot.h: Signal/Slot classes +// +// Written by Sarah Thompson (sarah@telergy.com) 2002. +// +// License: Public domain. You are free to use this code however you like, with +// the proviso that the author takes on no responsibility or liability for any +// use. +------------------------------------------------------------------------------- +Files: common_audio/signal_processing/spl_sqrt_floor.c common_audio/signal_processing/spl_sqrt_floor_arm.S diff --git a/webrtc/build/ios/build_ios_libs.sh b/webrtc/build/ios/build_ios_libs.sh index 9c3e4fc4c5..25aed6306a 100755 --- a/webrtc/build/ios/build_ios_libs.sh +++ b/webrtc/build/ios/build_ios_libs.sh @@ -72,10 +72,8 @@ function build_webrtc { # generating static libs. local override_visibility=0 if [[ ${build_type} = "legacy" ]]; then - echo "Building legacy." - gyp_file=webrtc/build/ios/merge_ios_libs.gyp - gyp_target=libjingle_peerconnection_objc_no_op - override_visibility=1 + echo "Building objc legacy libraries no longer supported." + exit 1 elif [[ ${build_type} = "static_only" ]]; then echo "Building static only." gyp_file=webrtc/build/ios/merge_ios_libs.gyp @@ -131,7 +129,7 @@ function usage { echo "The headers will be copied to out_ios_libs/include." echo "Usage: $0 [-h] [-b build_type] [-c] [-o output_dir]" echo " -h Print this help." - echo " -b The build type. Can be framework, static_only or legacy." + echo " -b The build type. Can be framework or static_only." echo " Defaults to framework." echo " -c Removes generated build output." echo " -o Specifies a directory to output build artifacts to." @@ -145,8 +143,7 @@ check_preconditions # Set default arguments. # Output directory for build artifacts. OUTPUT_DIR=${WEBRTC_BASE_DIR}/out_ios_libs -# The type of build to perform. Valid arguments are framework, static_only and -# legacy. +# The type of build to perform. Valid arguments are framework and static_only. BUILD_TYPE="framework" PERFORM_CLEAN=0 FLAVOR="Profile" @@ -230,16 +227,13 @@ if [[ ${BUILD_TYPE} = "framework" ]]; then FORMAT_STRING=s/\${FRAMEWORK_VERSION_NUMBER}/${VERSION_NUMBER}/g sed -e ${FORMAT_STRING} ${WEBRTC_BASE_DIR}/webrtc/sdk/objc/WebRTC.podspec > \ ${OUTPUT_DIR}/WebRTC.podspec -else +elif [[ ${BUILD_TYPE} = "static_only" ]]; then echo "Merging static library slices." # Merge the static libraries together into individual FAT archives. ${MERGE_SCRIPT} ${OUTPUT_DIR} # Merge the dSYM files together. TARGET_NAME="rtc_sdk_peerconnection_objc_no_op" - if [[ ${BUILD_TYPE} = "legacy" ]]; then - TARGET_NAME="libjingle_peerconnection_objc_no_op" - fi DSYM_PATH="${TARGET_NAME}.app.dSYM/Contents/Resources/DWARF/${TARGET_NAME}" cp -R ${ARM_NINJA_DIR}/${TARGET_NAME}.app.dSYM ${OUTPUT_DIR} echo "Merging dSYM slices." @@ -262,13 +256,11 @@ else if [[ -d ${OUTPUT_HEADER_DIR} ]]; then rm -rf ${OUTPUT_HEADER_DIR} fi - if [[ ${BUILD_TYPE} = "legacy" ]]; then - INPUT_HEADER_DIR="${WEBRTC_BASE_DIR}/talk/app/webrtc/objc/public" - ln -sf ${INPUT_HEADER_DIR} ${OUTPUT_HEADER_DIR} - else - mkdir -p ${OUTPUT_HEADER_DIR} - ln -sf ${INPUT_HEADER_DIR} ${OUTPUT_HEADER_DIR}/WebRTC - fi + mkdir -p ${OUTPUT_HEADER_DIR} + ln -sf ${INPUT_HEADER_DIR} ${OUTPUT_HEADER_DIR}/WebRTC +else + echo "BUILD_TYPE ${BUILD_TYPE} not supported." + exit 1 fi echo "Generating LICENSE.html." diff --git a/webrtc/build/ios/merge_ios_libs.gyp b/webrtc/build/ios/merge_ios_libs.gyp index 5b0a9cbbb0..d28b6221db 100644 --- a/webrtc/build/ios/merge_ios_libs.gyp +++ b/webrtc/build/ios/merge_ios_libs.gyp @@ -11,15 +11,6 @@ 'conditions': [ ['OS=="ios" or OS=="mac"', { 'targets': [ - { - 'target_name': 'libjingle_peerconnection_objc_no_op', - 'includes': [ 'objc_app.gypi' ], - 'type': 'executable', - 'dependencies': [ - '../../../talk/app/webrtc/legacy_objc_api.gyp:libjingle_peerconnection_objc', - ], - 'sources': ['no_op.cc',], - }, { 'target_name': 'rtc_sdk_peerconnection_objc_no_op', 'includes': [ 'objc_app.gypi' ], diff --git a/webrtc/webrtc_examples.gyp b/webrtc/webrtc_examples.gyp index 347810bea4..02854626c8 100755 --- a/webrtc/webrtc_examples.gyp +++ b/webrtc/webrtc_examples.gyp @@ -6,10 +6,6 @@ # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. { - 'includes': [ - '../talk/build/common.gypi', - ], - 'conditions': [ ['OS=="linux" or OS=="win"', { 'targets': [