Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidliu committed May 3, 2024
2 parents f1bc9ff + 495658d commit dab657f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ public void receiverGetStats(String receiverId, Promise promise) {

public void senderGetStats(String senderId, Promise promise) {
RtpSender targetSender = null;
for (RtpSender r : peerConnection.getSenders()) {
if (r.id().equals(senderId)) {
targetSender = r;
for (RtpSender s : peerConnection.getSenders()) {
if (s.id().equals(senderId)) {
targetSender = s;
break;
}
}
Expand Down Expand Up @@ -483,8 +483,6 @@ public void onRemoveTrack(RtpReceiver receiver) {
params.putInt("pcId", this.id);
params.putString("receiverId", receiver.id());

remoteTracks.remove(receiver.id());

webRTCModule.sendEvent("peerConnectionOnRemoveTrack", params);
});
};
Expand Down
6 changes: 3 additions & 3 deletions android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ public void receiverGetStats(int pcId, String receiverId, Promise promise) {
PeerConnectionObserver pco = mPeerConnectionObservers.get(pcId);
if (pco == null || pco.getPeerConnection() == null) {
Log.d(TAG, "receiverGetStats() peerConnection is null");
promise.reject(new Exception("PeerConnection ID not found"));
promise.resolve(StringUtils.statsToJSON(new RTCStatsReport(0, new HashMap<>())));
} else {
pco.receiverGetStats(receiverId, promise);
}
Expand All @@ -1258,7 +1258,7 @@ public void senderGetStats(int pcId, String senderId, Promise promise) {
PeerConnectionObserver pco = mPeerConnectionObservers.get(pcId);
if (pco == null || pco.getPeerConnection() == null) {
Log.d(TAG, "senderGetStats() peerConnection is null");
promise.reject(new Exception("PeerConnection ID not found"));
promise.resolve(StringUtils.statsToJSON(new RTCStatsReport(0, new HashMap<>())));
} else {
pco.senderGetStats(senderId, promise);
}
Expand Down Expand Up @@ -1311,7 +1311,7 @@ public void peerConnectionGetStats(int peerConnectionId, Promise promise) {
PeerConnectionObserver pco = mPeerConnectionObservers.get(peerConnectionId);
if (pco == null || pco.getPeerConnection() == null) {
Log.d(TAG, "peerConnectionGetStats() peerConnection is null");
promise.reject(new Exception("PeerConnection ID not found"));
promise.resolve(StringUtils.statsToJSON(new RTCStatsReport(0, new HashMap<>())));
} else {
pco.getStats(promise);
}
Expand Down
22 changes: 21 additions & 1 deletion examples/GumTestApp/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,25 @@ target 'GumTestApp' do
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)

# NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
end
end

installer.pods_project.build_configurations.each do |config|
installer.pods_project.targets.each do |target|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end

# Set the preprocessing macro for the whole Pods project
existing_flags = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
existing_flags << '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = existing_flags
end
end
end
end
17 changes: 10 additions & 7 deletions ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ @implementation WebRTCModule (RTCPeerConnection)
: (RCTPromiseRejectBlock)reject) {
RTCPeerConnection *peerConnection = self.peerConnections[objectID];
if (!peerConnection) {
reject(@"invalid_id", @"PeerConnection ID not found", nil);
RCTLogWarn(@"PeerConnection %@ not found in peerConnectionGetStats()", objectID);
resolve(@"[]");
return;
}

Expand All @@ -370,7 +371,8 @@ @implementation WebRTCModule (RTCPeerConnection)
: (RCTPromiseRejectBlock)reject) {
RTCPeerConnection *peerConnection = self.peerConnections[pcId];
if (!peerConnection) {
reject(@"invalid_id", @"PeerConnection ID not found", nil);
RCTLogWarn(@"PeerConnection %@ not found in receiverGetStats()", pcId);
resolve(@"[]");
return;
}

Expand All @@ -383,7 +385,8 @@ @implementation WebRTCModule (RTCPeerConnection)
}

if (!receiver) {
reject(@"invalid_id", @"Receiver ID not found", nil);
RCTLogWarn(@"RTCRtpReceiver %@ not found in receiverGetStats()", receiverId);
resolve(@"[]");
return;
}

Expand All @@ -400,7 +403,8 @@ @implementation WebRTCModule (RTCPeerConnection)
: (RCTPromiseRejectBlock)reject) {
RTCPeerConnection *peerConnection = self.peerConnections[pcId];
if (!peerConnection) {
reject(@"invalid_id", @"PeerConnection ID not found", nil);
RCTLogWarn(@"PeerConnection %@ not found in senderGetStats()", pcId);
resolve(@"[]");
return;
}

Expand All @@ -413,7 +417,8 @@ @implementation WebRTCModule (RTCPeerConnection)
}

if (!sender) {
reject(@"invalid_id", @"Sender ID not found", nil);
RCTLogWarn(@"RTCRtpSender %@ not found in senderGetStats()", senderId);
resolve(@"[]");
return;
}

Expand Down Expand Up @@ -922,8 +927,6 @@ - (void)peerConnection:(RTC_OBJC_TYPE(RTCPeerConnection) *)peerConnection
params[@"pcId"] = peerConnection.reactTag;
params[@"receiverId"] = rtpReceiver.receiverId;

[peerConnection.remoteTracks removeObjectForKey:rtpReceiver.receiverId];

[self sendEventWithName:kEventPeerConnectionOnRemoveTrack body:params];
});
}
Expand Down
2 changes: 1 addition & 1 deletion ios/RCTWebRTC/WebRTCModule+Transceivers.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ - (RTCRtpParameters *)updateParametersWithOptions:(NSDictionary *)options params
NSDictionary *encodingUpdate = encodingsArray[i];
RTCRtpEncodingParameters *encoding = encodings[i];

encoding.isActive = encodingUpdate[@"active"];
encoding.isActive = [encodingUpdate[@"active"] boolValue];
encoding.rid = encodingUpdate[@"rid"];
encoding.maxBitrateBps = encodingUpdate[@"maxBitrate"];
encoding.maxFramerate = encodingUpdate[@"maxFramerate"];
Expand Down
2 changes: 1 addition & 1 deletion src/RTCRtpEncodingParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class RTCRtpEncodingParameters {

toJSON(): RTCRtpEncodingParametersInit {
const obj = {
active: this.active,
active: Boolean(this.active),
};

if (this._rid !== null) {
Expand Down

0 comments on commit dab657f

Please sign in to comment.