Skip to content

Commit

Permalink
Merge pull request react-native-webrtc#645 from jitsi/master
Browse files Browse the repository at this point in the history
Jitsi sync (bitcode and Metal crash fixes)
  • Loading branch information
saghul authored Jun 18, 2019
2 parents 3ea1487 + 223b3f6 commit b2e207d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ android {

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation fileTree(dir: 'libs', include: ['*.jar'])
api fileTree(dir: 'libs', include: ['*.jar'])
}
15 changes: 10 additions & 5 deletions ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,17 @@ - (void)peerConnection:(RTCPeerConnection *)peerConnection didAddStream:(RTCMedi
}

- (void)peerConnection:(RTCPeerConnection *)peerConnection didRemoveStream:(RTCMediaStream *)stream {
NSArray *keysArray = [peerConnection.remoteStreams allKeysForObject:stream];
// We assume there can be only one object for 1 key
if (keysArray.count > 1) {
NSLog(@"didRemoveStream - more than one stream entry found for stream instance with id: %@", stream.streamId);
// XXX Find the stream by comparing the 'streamId' values. It turns out that WebRTC (as of M69) creates new wrapper
// instance for the native media stream before invoking the 'didRemoveStream' callback. This means it's a different
// RTCMediaStream instance passed to 'didAddStream' and 'didRemoveStream'.
NSString *streamReactTag = nil;
for (NSString *aReactTag in peerConnection.remoteStreams) {
RTCMediaStream *aStream = peerConnection.remoteStreams[aReactTag];
if ([aStream.streamId isEqualToString:stream.streamId]) {
streamReactTag = aReactTag;
break;
}
}
NSString *streamReactTag = keysArray.count ? keysArray[0] : nil;
if (!streamReactTag) {
NSLog(@"didRemoveStream - stream not found, id: %@", stream.streamId);
return;
Expand Down
2 changes: 1 addition & 1 deletion ios/WebRTC.framework/Headers/WebRTC.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
Expand Down
Binary file modified ios/WebRTC.framework/Info.plist
Binary file not shown.
Binary file modified ios/WebRTC.framework/WebRTC
Binary file not shown.
9 changes: 5 additions & 4 deletions tools/build-webrtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def build_gn_args(platform_args):

_GN_IOS_ARGS = [
'enable_dsyms=true',
'enable_ios_bitcode=false',
'enable_ios_bitcode=%s',
'ios_deployment_target="9.0"',
'ios_enable_code_signing=false',
'target_os="ios"',
Expand Down Expand Up @@ -105,7 +105,7 @@ def setup(target_dir, platform):
sh('./build/install-build-deps.sh')


def build(target_dir, platform, debug):
def build(target_dir, platform, debug, bitcode):
build_dir = os.path.join(target_dir, 'build', platform)
build_type = 'Debug' if debug else 'Release'
depot_tools_dir = os.path.join(target_dir, 'depot_tools')
Expand Down Expand Up @@ -138,7 +138,7 @@ def build(target_dir, platform, debug):
if platform == 'ios':
for arch in IOS_BUILD_ARCHS:
gn_out_dir = 'out/%s-%s' % (build_type, arch)
gn_args = GN_IOS_ARGS % (str(debug).lower(), arch)
gn_args = GN_IOS_ARGS % (str(debug).lower(), arch, str(bitcode).lower())
gn_cmd = 'gn gen %s %s' % (gn_out_dir, gn_args)
sh(gn_cmd, env)
else:
Expand Down Expand Up @@ -202,6 +202,7 @@ def build(target_dir, platform, debug):
parser.add_argument('--ios', help='Use iOS as the target platform', action='store_true')
parser.add_argument('--android', help='Use Android as the target platform', action='store_true')
parser.add_argument('--debug', help='Make a Debug build (defaults to false)', action='store_true')
parser.add_argument('--bitcode', help='Enable bitcode (defaults to false)', action='store_true')

args = parser.parse_args()

Expand Down Expand Up @@ -234,7 +235,7 @@ def build(target_dir, platform, debug):
sys.exit(0)

if args.build:
build(target_dir, platform, args.debug)
build(target_dir, platform, args.debug, args.bitcode)
print('WebRTC build for %s completed in %s' % (platform, target_dir))
sys.exit(0)

24 changes: 24 additions & 0 deletions tools/downloadBitcode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -euo pipefail

# Files to be downloaded
WEBRTC_FRAMEWORK="https://dl.bintray.com/webrtc-builds/webrtc-builds/M69-1/WebRTC.framework.tar.xz"
WEBRTC_DSYM="https://dl.bintray.com/webrtc-builds/webrtc-builds/M69-1/WebRTC.dSYM.tar.xz"


THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)

pushd ${THIS_DIR}/../ios

# Cleanup
rm -rf WebRTC.framework WebRTC.dSYM

# Download
echo "Downloading files..."
curl -L -s ${WEBRTC_FRAMEWORK} | tar Jxf -
curl -L -s ${WEBRTC_DSYM} | tar Jxf -
echo "Done!"

popd

0 comments on commit b2e207d

Please sign in to comment.