feat: frameProcessorFps="auto"
and automatic performance suggestions (throttle or increase FPS) (#393)
* Add `onFrameProcessorPerformanceSuggestionAvailable` and make `frameProcessorFps` support `auto` * Implement performance suggestion and auto-adjusting * Fix FPS setting, evaluate correctly * Floor suggested FPS * Remove `console.log` for frame drop warnings. * Swift format * Use `30` magic number * only call if FPS is different * Update CameraView.swift * Implement Android 1/2 * Cleanup * Update `frameProcessorFps` if available * Optimize `FrameProcessorPerformanceDataCollector` initialization * Cache call * Set frameProcessorFps directly (Kotlin setter) * Don't suggest if same value * Call suggestion every second * reset time on set * Always store 15 last samples * reset counter too * Update FrameProcessorPerformanceDataCollector.swift * Update CameraView+RecordVideo.swift * Update CameraView.kt * iOS: Redesign evaluation * Update CameraView+RecordVideo.swift * Android: Redesign evaluation * Update CameraView.kt * Update REA to latest alpha and install RNScreens * Fix frameProcessorFps updating
This commit is contained in:
@@ -321,6 +321,9 @@ PODS:
|
||||
- React-RCTVibration
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- RNScreens (3.6.0):
|
||||
- React-Core
|
||||
- React-RCTImage
|
||||
- RNStaticSafeAreaInsets (2.1.1):
|
||||
- React
|
||||
- RNVectorIcons (8.1.0):
|
||||
@@ -368,6 +371,7 @@ DEPENDENCIES:
|
||||
- ReactNativeNavigation (from `../node_modules/react-native-navigation`)
|
||||
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
|
||||
- RNReanimated (from `../node_modules/react-native-reanimated`)
|
||||
- RNScreens (from `../node_modules/react-native-screens`)
|
||||
- RNStaticSafeAreaInsets (from `../node_modules/react-native-static-safe-area-insets`)
|
||||
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
|
||||
- VisionCamera (from `../..`)
|
||||
@@ -447,6 +451,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/react-native-gesture-handler"
|
||||
RNReanimated:
|
||||
:path: "../node_modules/react-native-reanimated"
|
||||
RNScreens:
|
||||
:path: "../node_modules/react-native-screens"
|
||||
RNStaticSafeAreaInsets:
|
||||
:path: "../node_modules/react-native-static-safe-area-insets"
|
||||
RNVectorIcons:
|
||||
@@ -493,6 +499,7 @@ SPEC CHECKSUMS:
|
||||
ReactNativeNavigation: 87aa2e3a749a9b338057e8d53af54d865241b843
|
||||
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
|
||||
RNReanimated: 48e578538b2fad573d3d5ce2e80ad375e1534d87
|
||||
RNScreens: eb0dfb2d6b21d2d7f980ad46b14eb306d2f1062e
|
||||
RNStaticSafeAreaInsets: 6103cf09647fa427186d30f67b0f5163c1ae8252
|
||||
RNVectorIcons: 31cebfcf94e8cf8686eb5303ae0357da64d7a5a4
|
||||
VisionCamera: dc481620431e31c1d6bbbc438d8a1d9c56f3d304
|
||||
|
@@ -23,7 +23,8 @@
|
||||
"react-native-gesture-handler": "^1.10.3",
|
||||
"react-native-navigation": "^7.19.0",
|
||||
"react-native-pressable-opacity": "^1.0.4",
|
||||
"react-native-reanimated": "^2.3.0-alpha.2",
|
||||
"react-native-reanimated": "^2.3.0-alpha.3",
|
||||
"react-native-screens": "^3.6.0",
|
||||
"react-native-static-safe-area-insets": "^2.1.1",
|
||||
"react-native-vector-icons": "^8.0.0",
|
||||
"react-native-video": "^5.1.1"
|
||||
|
@@ -6,6 +6,7 @@ import { Navigation, NavigationFunctionComponent } from 'react-native-navigation
|
||||
import {
|
||||
CameraDeviceFormat,
|
||||
CameraRuntimeError,
|
||||
FrameProcessorPerformanceSuggestion,
|
||||
PhotoFile,
|
||||
sortFormats,
|
||||
useCameraDevices,
|
||||
@@ -197,6 +198,10 @@ export const CameraPage: NavigationFunctionComponent = ({ componentId }) => {
|
||||
console.log(`Return Values: ${JSON.stringify(values)}`);
|
||||
}, []);
|
||||
|
||||
const onFrameProcessorSuggestionAvailable = useCallback((suggestion: FrameProcessorPerformanceSuggestion) => {
|
||||
console.log(`Suggestion available! ${suggestion.type}: Can do ${suggestion.suggestedFrameProcessorFps} FPS`);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{device != null && (
|
||||
@@ -221,6 +226,7 @@ export const CameraPage: NavigationFunctionComponent = ({ componentId }) => {
|
||||
audio={true}
|
||||
frameProcessor={device.supportsParallelVideoProcessing ? frameProcessor : undefined}
|
||||
frameProcessorFps={1}
|
||||
onFrameProcessorPerformanceSuggestionAvailable={onFrameProcessorSuggestionAvailable}
|
||||
/>
|
||||
</TapGestureHandler>
|
||||
</Reanimated.View>
|
||||
|
@@ -4401,7 +4401,7 @@ react-native-pressable-opacity@^1.0.4:
|
||||
resolved "https://registry.yarnpkg.com/react-native-pressable-opacity/-/react-native-pressable-opacity-1.0.4.tgz#391f33fdc25cb84551f2743a25eced892b9f30f7"
|
||||
integrity sha512-DBIg7UoRiuBYiFEvx+XNMqH0OEx64WrSksXhT6Kq9XuyyKsThMNDqZ9G5QV7vfu7dU2/IctwIz5c0Xwkp4K3tA==
|
||||
|
||||
react-native-reanimated@^2.3.0-alpha.2:
|
||||
react-native-reanimated@^2.3.0-alpha.3:
|
||||
version "2.3.0-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-2.3.0-alpha.3.tgz#022f5b4eaa847304a155942165a77125c86428bc"
|
||||
integrity sha512-Ln+edkTrepKUETKKmGl+GxL8RiB7awBDQFcRJIK39m5ggiLfksOAfqzclpKPLWbAfOvB4cSg+QdowzRN570FXA==
|
||||
@@ -4413,7 +4413,7 @@ react-native-reanimated@^2.3.0-alpha.2:
|
||||
react-native-screens "^3.4.0"
|
||||
string-hash-64 "^1.0.3"
|
||||
|
||||
react-native-screens@^3.4.0:
|
||||
react-native-screens@^3.4.0, react-native-screens@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.6.0.tgz#054af728e50c06bff6b3b4fa7b4b656b70f247cd"
|
||||
integrity sha512-emQmSu+B6cOIjJH2OIgpuxd9zCD6xz7/oo5GCetyjsM5qR3sMnVgOxqtK99xPu9XJH/8k7MplXbtJgtk/PHXwA==
|
||||
|
Reference in New Issue
Block a user