ilabs-flir 2.2.24 → 2.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -255,9 +255,9 @@ object FlirManager {
255
255
  return
256
256
  }
257
257
 
258
- // THROTTLE: Limit to ~15 FPS to prevent UI thread flooding
258
+ // THROTTLE: Limit to ~30 FPS for smoother streaming
259
259
  val now = System.currentTimeMillis()
260
- if (now - lastEmitMs.get() < 66) { // 66ms ~= 15 FPS
260
+ if (now - lastEmitMs.get() < 33) { // 33ms ~= 30 FPS
261
261
  return
262
262
  }
263
263
  lastEmitMs.set(now)
@@ -25,6 +25,7 @@ import java.util.Collections;
25
25
  import java.util.List;
26
26
  import java.util.concurrent.Executor;
27
27
  import java.util.concurrent.Executors;
28
+ import java.util.concurrent.atomic.AtomicBoolean;
28
29
 
29
30
  /**
30
31
  * Simplified FLIR SDK Manager - matches sample app pattern
@@ -45,6 +46,8 @@ public class FlirSdkManager {
45
46
  private Stream activeStream;
46
47
  private final List<Identity> discoveredDevices = Collections.synchronizedList(new ArrayList<>());
47
48
  private volatile Bitmap latestBitmap;
49
+ private final AtomicBoolean isProcessingFrame = new AtomicBoolean(false);
50
+ private boolean useHalfScale = false;
48
51
 
49
52
  // Listener
50
53
  private Listener listener;
@@ -221,6 +224,15 @@ public class FlirSdkManager {
221
224
  executor.execute(this::startStreamInternal);
222
225
  }
223
226
 
227
+ public void setUseHalfScale(boolean useHalfScale) {
228
+ this.useHalfScale = useHalfScale;
229
+ executor.execute(() -> {
230
+ if (streamer != null) {
231
+ // We'll apply this when the streamer is created or updated
232
+ }
233
+ });
234
+ }
235
+
224
236
  private void startStreamInternal() {
225
237
  if (camera == null) {
226
238
  notifyError("Not connected");
@@ -258,22 +270,27 @@ public class FlirSdkManager {
258
270
  // Start stream with simple callback (matches sample app)
259
271
  thermalStream.start(
260
272
  unused -> {
261
- executor.execute(() -> {
262
- try {
263
- if (streamer != null && activeStream != null) {
264
- streamer.update();
265
- Bitmap bitmap = BitmapAndroid.createBitmap(streamer.getImage()).getBitMap();
266
- if (bitmap != null) {
267
- latestBitmap = bitmap;
268
- if (listener != null) {
269
- listener.onFrame(bitmap);
273
+ // Skip if previous frame still processing
274
+ if (isProcessingFrame.compareAndSet(false, true)) {
275
+ executor.execute(() -> {
276
+ try {
277
+ if (streamer != null && activeStream != null) {
278
+ streamer.update();
279
+ Bitmap bitmap = BitmapAndroid.createBitmap(streamer.getImage()).getBitMap();
280
+ if (bitmap != null) {
281
+ latestBitmap = bitmap;
282
+ if (listener != null) {
283
+ listener.onFrame(bitmap);
284
+ }
270
285
  }
271
286
  }
287
+ } catch (Exception e) {
288
+ Log.e(TAG, "Frame error", e);
289
+ } finally {
290
+ isProcessingFrame.set(false);
272
291
  }
273
- } catch (Exception e) {
274
- Log.e(TAG, "Frame error", e);
275
- }
276
- });
292
+ });
293
+ }
277
294
  },
278
295
  error -> {
279
296
  executor.execute(() -> {
@@ -59,6 +59,7 @@ import ThermalSDK
59
59
 
60
60
  private var _isConnected = false
61
61
  private var _isStreaming = false
62
+ private var _isProcessingFrame = false
62
63
  private var connectedDeviceId: String?
63
64
  private var connectedDeviceName: String?
64
65
 
@@ -530,7 +531,15 @@ extension FlirManager: FLIRStreamDelegate {
530
531
 
531
532
  // Process frame on dedicated render queue (matches sample app pattern)
532
533
  // This prevents blocking the SDK callback thread and main thread
534
+ // Guard to skip frame if already processing (prevents backpressure/latency)
535
+ guard !_isProcessingFrame else {
536
+ NSLog("[FLIR-TRACE ⏩] Skipping frame (already processing)")
537
+ return
538
+ }
539
+
540
+ _isProcessingFrame = true
533
541
  renderQueue.async { [weak self] in
542
+ defer { self?._isProcessingFrame = false }
534
543
  guard let self = self, let streamer = self.streamer else {
535
544
  NSLog("[FLIR-TRACE ❌] No self or streamer in renderQueue")
536
545
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ilabs-flir",
3
- "version": "2.2.24",
3
+ "version": "2.2.25",
4
4
  "description": "FLIR Thermal SDK for React Native - iOS & Android (bundled at compile time via postinstall)",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",