forked from react-native-webrtc/react-native-webrtc
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge upstream 124.0.4 into master (#16)
* ios: add support for external cameras on iPad * ci: remove flipper from gumtestapp (react-native-webrtc#1608) These were causing build errors recently, and were generally unneeded anyways. * pc: align createDataChannel with standard - Throw TypeError if no argument passed - Stringify the label Fixes: react-native-webrtc#1605 * android: report actual size in camera MediaStreamTrack settings (react-native-webrtc#1598) * ios: fix exception in iOS 17+ w/ Xcode 15.4 * android: remove no longer used replace rule from manifest (react-native-webrtc#1609) * sender: fix serializing RTCRtpSendParameters It's possible for user code to replace encodings entirely. Thus, the resulting array will not have RTCRtpEncodingParameters object instances, but plain objects. Handle it by deep-cloning the objects with JSON.parse(JSON.stringify(x)) since that will take care of appropriately serializing them, no matter the type. * misc: make serialization more resilient Don't directly call toJSON, but rather rely on JSON serialization to do it when cloning. * release 124.0.4 89557ca misc: make serialization more resilient ( Saúl Ibarra Corretgé 2024-08-14 11:53:32 +0200) 6cfedd7 sender: fix serializing RTCRtpSendParameters ( Saúl Ibarra Corretgé 2024-08-14 11:11:08 +0200) ac7f578 android: remove no longer used replace rule from manifest (react-native-webrtc#1609) ( Saúl Ibarra Corretgé 2024-08-07 17:17:03 +0200) f6667c8 ios: fix exception in iOS 17+ w/ Xcode 15.4 ( mtdxc 2024-08-07 17:22:10 +0800) 4c34ae1 android: report actual size in camera MediaStreamTrack settings (react-native-webrtc#1598) ( davidliu 2024-08-07 17:56:57 +0900) fb02a5b pc: align createDataChannel with standard ( Saúl Ibarra Corretgé 2024-08-06 15:28:24 +0200) c0ddefd ci: remove flipper from gumtestapp (react-native-webrtc#1608) ( davidliu 2024-08-07 16:00:01 +0900) a1bb18a ios: add support for external cameras on iPad ( mtdxc 2024-07-10 20:25:23 +0800) * ios: Add RTCAudioSession helper methods needed for CallKit (react-native-webrtc#1614) * Fix package name references --------- Co-authored-by: mtdxc <[email protected]> Co-authored-by: Saúl Ibarra Corretgé <[email protected]> Co-authored-by: Saúl Ibarra Corretgé <[email protected]>
- Loading branch information
1 parent
1121257
commit c10087e
Showing
19 changed files
with
276 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2023-2024 LiveKit, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.webrtc; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* A helper to access package-protected methods used in [Camera2Session] | ||
* <p> | ||
* Note: cameraId as used in the Camera1XXX classes refers to the index within the list of cameras. | ||
* | ||
* @suppress | ||
*/ | ||
|
||
public class Camera1Helper { | ||
|
||
public static int getCameraId(String deviceName) { | ||
return Camera1Enumerator.getCameraIndex(deviceName); | ||
} | ||
|
||
@Nullable | ||
public static List<CameraEnumerationAndroid.CaptureFormat> getSupportedFormats(int cameraId) { | ||
return Camera1Enumerator.getSupportedFormats(cameraId); | ||
} | ||
|
||
public static Size findClosestCaptureFormat(int cameraId, int width, int height) { | ||
List<CameraEnumerationAndroid.CaptureFormat> formats = getSupportedFormats(cameraId); | ||
|
||
List<Size> sizes = new ArrayList<>(); | ||
if (formats != null) { | ||
for (CameraEnumerationAndroid.CaptureFormat format : formats) { | ||
sizes.add(new Size(format.width, format.height)); | ||
} | ||
} | ||
|
||
return CameraEnumerationAndroid.getClosestSupportedSize(sizes, width, height); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright 2023-2024 LiveKit, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.webrtc; | ||
|
||
import android.hardware.camera2.CameraManager; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* A helper to access package-protected methods used in [Camera2Session] | ||
* <p> | ||
* Note: cameraId as used in the Camera2XXX classes refers to the id returned | ||
* by [CameraManager.getCameraIdList]. | ||
*/ | ||
public class Camera2Helper { | ||
|
||
@Nullable | ||
public static List<CameraEnumerationAndroid.CaptureFormat> getSupportedFormats(CameraManager cameraManager, @Nullable String cameraId) { | ||
return Camera2Enumerator.getSupportedFormats(cameraManager, cameraId); | ||
} | ||
|
||
public static Size findClosestCaptureFormat(CameraManager cameraManager, @Nullable String cameraId, int width, int height) { | ||
List<CameraEnumerationAndroid.CaptureFormat> formats = getSupportedFormats(cameraManager, cameraId); | ||
|
||
List<Size> sizes = new ArrayList<>(); | ||
if (formats != null) { | ||
for (CameraEnumerationAndroid.CaptureFormat format : formats) { | ||
sizes.add(new Size(format.width, format.height)); | ||
} | ||
} | ||
|
||
return CameraEnumerationAndroid.getClosestSupportedSize(sizes, width, height); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.