-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FCE-748: support for protobufs #246
base: main
Are you sure you want to change the base?
Conversation
…ocal-peer-metadata
1f26504
to
f2abce9
Compare
@@ -230,3 +236,13 @@ public struct AnyJson: Codable { | |||
var stringValue: String { return key } | |||
} | |||
} | |||
|
|||
extension String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those really better than just using AnyJson(from: )
? Seems a little bit like an overkill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, I just thought it looks better but you're right.
} | ||
|
||
func toAnyJson() -> AnyJson? { | ||
return try? AnyJson(from: self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if they are better then this could be try? toAnyJson()
extension Encodable { | ||
|
||
public func toJsonString() throws -> String { | ||
if let json = String(data: try JSONEncoder().encode(self), encoding: .utf8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's controversial but what about guard
and throw
in else
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK MAN, NO PROBLEM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO SHOUTING IN THE CHAT PLEASE, PEOPLE ARE TRYING TO WORK HERE
|
||
var toJsonStringOrEmpty: String { | ||
do { | ||
return try self.toJsonString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove self
here
|
||
extension [String: Metadata] { | ||
public func toDictionaryJson() -> [String: String] { | ||
return mapValues { val in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think mapValues(\.toJsonStringOrEmpty)
should work here
})), | ||
})); | ||
return peers.map((peer) => { | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove return
s
@@ -69,7 +69,7 @@ compile_ios: $(PROTOC) $(PROTOC_GEN_SWIFT) sync | |||
@echo "Compiling proto files for iOS" | |||
@for proto in $(PROTO_FILES); do \ | |||
echo "Compiling iOS: $$proto"; \ | |||
$(PROTOC) -I=$(PROTOS_PATH) -I=$(PROTOC_BASE_PATH)/include --plugin=$(PROTOC_GEN_SWIFT) --swift_out=$(IOS_OUT) $$proto; \ | |||
$(PROTOC) -I=$(PROTOS_PATH) -I=$(PROTOC_BASE_PATH)/include --plugin=$(PROTOC_GEN_SWIFT) --swift_out=$(IOS_OUT) --swift_opt=Visibility=public $$proto; \ | |||
done | |||
@echo "DONE for iOS" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line please
I left some comments. But other than that great job! 🎉 |
6c233ab
to
bd0c300
Compare
…etadata' into mfilimowski/fce-837-local-peer-metadata
@@ -176,11 +176,9 @@ internal class PeerConnectionManager: NSObject, RTCPeerConnectionDelegate { | |||
config.candidateNetworkPolicy = .all | |||
config.tcpCandidatePolicy = .disabled | |||
|
|||
// if ice servers are not empty that probably means we are using turn servers | |||
// if ice servers are not empty that probably means we are using turn servers, which are not handled at the moment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
We might actually start using turn servers, that will be passed in the connected
message. They will be handled out of the box
// if ice servers are not empty that probably means we are using turn servers, which are not handled at the moment |
@@ -176,11 +176,9 @@ internal class PeerConnectionManager: NSObject, RTCPeerConnectionDelegate { | |||
config.candidateNetworkPolicy = .all | |||
config.tcpCandidatePolicy = .disabled | |||
|
|||
// if ice servers are not empty that probably means we are using turn servers | |||
// if ice servers are not empty that probably means we are using turn servers, which are not handled at the moment | |||
if iceServers.count > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
If they are empty, then we can just pass this empty list from protobuf message
if iceServers.count > 0 { |
guard let trackId: String = transceiver.sender.track?.trackId else { | ||
return | ||
} | ||
mapping[trackId] = 500 // TODO: Change with simulcast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: more appropriate value would be 1500000
as this value is in bit\s
var trackBitrates = Fishjam_MediaEvents_Peer_MediaEvent.TrackBitrates() | ||
trackBitrates.trackID = key | ||
var bitrate = Fishjam_MediaEvents_Peer_MediaEvent.VariantBitrate() | ||
bitrate.variant = .unspecified // TODO: Add with simulcast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this will remain .unspecified for non-simulcast tracks
var candidate = Fishjam_MediaEvents_Candidate() | ||
candidate.candidate = sdp | ||
candidate.sdpMLineIndex = sdpMLineIndex | ||
candidate.sdpMid = String(sdpMid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: 👍🏽
if (needsRestart) { | ||
pc.restartIce() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: In web-sdk we removed this completely. We assume ice restarts are not needed during negotiation. In fact in web-sdk the restarts introduced failures. Try removing this and checking if everything works OK
if (needsRestart) { | |
pc.restartIce() | |
} |
…etadata' into mfilimowski/fce-837-local-peer-metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two general comments:
- can we read package version from configuration file, so releasing app will require less work with updating?
- I would consider adding link to linear item for simulcast - it might help in future, to understand todo in code
podfileContent = podfileContent.replace(targetRegex, (match) => { | ||
return match.replace(podToReplace, replacementPod); | ||
}); | ||
podfileContent = podfileContent.replace(targetRegex, (match) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this new rule could be decoupled from this PR... Bet let it be as is.
@@ -162,6 +161,7 @@ internal class FishjamClientInternal( | |||
PeerNotifications.PeerMessage.AuthRequest | |||
.newBuilder() | |||
.setToken(connectConfig.token) | |||
.setSdkVersion("mobile-0.6.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we read this value from config files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tracksTypes, | ||
localEndpoint.tracks.values.toList() | ||
) | ||
|
||
rtcEngineCommunication.sdpOffer( | ||
offer.description, | ||
localEndpoint.tracks.map { (_, track) -> track.webrtcId() to track.metadata }.toMap(), | ||
offer.midToTrackIdMapping | ||
offer.midToTrackIdMapping, | ||
localEndpoint.tracks.map { (_, track) -> track.webrtcId() to 1500000 }.toMap() // TODO: Update with simulcast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about adding link to simulcast project in linear?
localEndpoint.tracks.map { (_, track) -> track.webrtcId() to 1500000 }.toMap() // TODO: Update with simulcast | |
localEndpoint.tracks.map { (_, track) -> track.webrtcId() to 1500000 }.toMap() // TODO(FCE-XXX): Update with simulcast |
encoding.rid | ||
) | ||
) | ||
// TODO: This will be useful after simulcast is enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO: This will be useful after simulcast is enabled | |
// TODO(FCE-XXX): This will be useful after simulcast is enabled |
@@ -0,0 +1,106 @@ | |||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idea for future: would it be possible to keep this generated files in folder called generated
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it looks like it's not possible, as the package name comes from the protofile and protoc
does not provide the ability to modify it. So although we could change the file location it won't work on Android as it expects certain folder structure.
We could modify the protos file, but this might destroy code generation for others...
} | ||
|
||
func websocketDidConnect() { | ||
let authRequest = Fishjam_PeerMessage.with({ | ||
$0.authRequest = Fishjam_PeerMessage.AuthRequest.with({ | ||
$0.token = self.config?.token ?? "" | ||
$0.sdkVersion = "mobile-0.6.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be read from config file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a381061
to
5083e24
Compare
5083e24
to
c8579ba
Compare
…ocal-peer-metadata
Description
Motivation and Context
New version of fishjam added protobufs for media events.
How has this been tested?
Types of changes
not work as expected)