diff --git a/example/viam_robot_example_app/macos/Podfile b/example/viam_robot_example_app/macos/Podfile index 049abe2954..9ec46f8cd5 100644 --- a/example/viam_robot_example_app/macos/Podfile +++ b/example/viam_robot_example_app/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.14' +platform :osx, '10.15' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/viam_robot_example_app/macos/Runner.xcodeproj/project.pbxproj b/example/viam_robot_example_app/macos/Runner.xcodeproj/project.pbxproj index 1a636d755b..d3c5d61f9b 100644 --- a/example/viam_robot_example_app/macos/Runner.xcodeproj/project.pbxproj +++ b/example/viam_robot_example_app/macos/Runner.xcodeproj/project.pbxproj @@ -56,7 +56,7 @@ 15242523DB1FCDEE32F203C2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* viam_example_app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = viam_example_app.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* Viam Example App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Viam Example App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -112,7 +112,7 @@ 33CC10EE2044A3C60003C045 /* Products */ = { isa = PBXGroup; children = ( - 33CC10ED2044A3C60003C045 /* viam_example_app.app */, + 33CC10ED2044A3C60003C045 /* Viam Example App.app */, ); name = Products; sourceTree = ""; @@ -159,7 +159,6 @@ 670B361EC221A983BEC9B00C /* Pods-Runner.release.xcconfig */, CD7EFC0D75004BBCC6F28023 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -193,7 +192,7 @@ ); name = Runner; productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* viam_example_app.app */; + productReference = 33CC10ED2044A3C60003C045 /* Viam Example App.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -203,7 +202,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -405,7 +404,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -427,6 +426,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 10.15; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; @@ -484,7 +484,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -531,7 +531,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.14; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -553,6 +553,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 10.15; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -573,6 +574,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 10.15; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/example/viam_robot_example_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/viam_robot_example_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 880af5120f..a93c695dd8 100644 --- a/example/viam_robot_example_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/viam_robot_example_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ @@ -31,7 +31,7 @@ @@ -54,7 +54,7 @@ @@ -71,7 +71,7 @@ diff --git a/lib/src/rpc/dial.dart b/lib/src/rpc/dial.dart index c587145e08..86f2af6ed2 100644 --- a/lib/src/rpc/dial.dart +++ b/lib/src/rpc/dial.dart @@ -120,10 +120,10 @@ Future dial(String address, DialOptions? options, String Func // when determining if we want to use the external auth credentials for the signaling // in cases where the external signaling is the same as the external auth. For mdns // this isn't the case. - final dialOptsCopy = opts - .._usingMdns = true - ..authEntity = address; - return await _dialWebRtc(mdnsUri, dialOptsCopy, sessionCallback); + final dialOptsCopy = opts.._usingMdns = true; + dialOptsCopy.webRtcOptions ??= DialWebRtcOptions(); + dialOptsCopy.webRtcOptions?.signalingServerAddress = mdnsUri; + return await _dialWebRtc(address, dialOptsCopy, sessionCallback); } on NotLocalAddressException catch (e) { _logger.d(e.toString()); } catch (e) { @@ -204,8 +204,7 @@ Future _dialWebRtc(String address, DialOptions options, Strin _logger.d('Connecting to signaling server: $signalingServer'); final signalingChannel = await _dialDirectGrpc(signalingServer, options, sessionCallback); _logger.d('Connected to signaling server: $signalingServer'); - final signalingClient = SignalingServiceClient(signalingChannel, - options: CallOptions(metadata: {'rpc-host': ((options._usingMdns) ? options.authEntity : address)!})); + final signalingClient = SignalingServiceClient(signalingChannel, options: CallOptions(metadata: {'rpc-host': address})); WebRTCConfig config; try { config = (await signalingClient.optionalWebRTCConfig(OptionalWebRTCConfigRequest())).config; diff --git a/lib/src/rpc/web_rtc/web_rtc_transport_stream.dart b/lib/src/rpc/web_rtc/web_rtc_transport_stream.dart index 4c46d8c064..f1e547e8b8 100644 --- a/lib/src/rpc/web_rtc/web_rtc_transport_stream.dart +++ b/lib/src/rpc/web_rtc/web_rtc_transport_stream.dart @@ -49,15 +49,6 @@ class WebRtcTransportStream extends GrpcTransportStream { void _listenToOutgoingMessages() { _outgoingMessages.stream.listen((List data) { - final payloadRequest = grpc.Request() - ..stream = headersRequest.stream - ..message = (grpc.RequestMessage() - ..hasMessage = true - ..eos = true - ..packetMessage = (grpc.PacketMessage() - ..data = data - ..eom = true)); - final connectionState = webRtcClientChannel.rtcPeerConnection.connectionState; if (connectionState == RTCPeerConnectionState.RTCPeerConnectionStateFailed || @@ -73,7 +64,33 @@ class WebRtcTransportStream extends GrpcTransportStream { headersSent = true; webRtcClientChannel.dataChannel.send(RTCDataChannelMessage.fromBinary(headersRequest.writeToBuffer())); } - webRtcClientChannel.dataChannel.send(RTCDataChannelMessage.fromBinary(payloadRequest.writeToBuffer())); + const maxMessageLength = 32 * 1024; + final chunks = data.slices(maxMessageLength).toList(); + Iterable requests; + if (chunks.isEmpty) { + requests = [ + grpc.Request() + ..stream = headersRequest.stream + ..message = (grpc.RequestMessage() + ..hasMessage = true + ..eos = false + ..packetMessage = (grpc.PacketMessage() + ..data = data + ..eom = true)) + ]; + } else { + requests = chunks.mapIndexed((index, chunk) => grpc.Request() + ..stream = headersRequest.stream + ..message = (grpc.RequestMessage() + ..hasMessage = true + ..eos = false + ..packetMessage = (grpc.PacketMessage() + ..data = chunk + ..eom = index == chunks.length - 1))); + } + requests.forEach((payloadRequest) { + webRtcClientChannel.dataChannel.send(RTCDataChannelMessage.fromBinary(payloadRequest.writeToBuffer())); + }); }); }