Skip to content

Commit 15c5f8d

Browse files
committed
chore: add new supports for multisegmented sensor formats
1 parent b605415 commit 15c5f8d

5 files changed

Lines changed: 48 additions & 8 deletions

File tree

AllSpark-ios/AppConstants.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ enum AppConstants {
9292
}
9393

9494
enum Video {
95-
static let defaultChunkDurationMs: Int = 10000
9695
static let dimensionHigh: Int = 1920
9796
static let dimensionLow: Int = 1080
98-
static let defaultFPS: Double = 30.0
9997
}
10098

10199
enum Audio {
@@ -109,7 +107,17 @@ enum AppConstants {
109107
}
110108

111109
enum Storage {
112-
static let defaultVideoBufferMaxMB: Int = 16000
113110
static let bytesPerMB: Int64 = 1024 * 1024
114111
}
112+
113+
enum ClientConfig {
114+
static let defaultChunkDurationMs: Int = 10000
115+
static let defaultFPS: Double = 30.0
116+
static let defaultVideoBufferMaxMB: Int = 16000
117+
static let defaultVideoFormat: String = "mp4"
118+
static let defaultAudioFormat: String = "wav"
119+
static let defaultDepthFormat: String = "png"
120+
static let defaultPoseFormat: String = "json"
121+
static let defaultTimestampFormat: String = "txt"
122+
}
115123
}

AllSpark-ios/CameraViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CameraViewController: UIViewController, UINavigationControllerDelegate {
5151
private var sessionAtSourceTime: CMTime?
5252
private var videoURL: URL?
5353
private var videoFormat: AVFileType = .mp4 // Default format
54-
private var recordingDurationMs: Int = AppConstants.Video.defaultChunkDurationMs
54+
private var recordingDurationMs: Int = AppConstants.ClientConfig.defaultChunkDurationMs
5555
private var autoStopTimer: Timer?
5656
private var shouldUploadAfterRecording = false
5757
private let recordingStateLock = NSLock()
@@ -335,7 +335,7 @@ class CameraViewController: UIViewController, UINavigationControllerDelegate {
335335
// We upload if there is ANY overlap.
336336

337337
// Get current chunk duration from config
338-
var chunkDuration = Double(AppConstants.Video.defaultChunkDurationMs) / 1000.0
338+
var chunkDuration = Double(AppConstants.ClientConfig.defaultChunkDurationMs) / 1000.0
339339
if let config = ConnectionManager.shared.clientConfig,
340340
let durationMs = config["videoChunkDurationMs"] as? Int {
341341
chunkDuration = Double(durationMs) / 1000.0
@@ -545,7 +545,7 @@ class CameraViewController: UIViewController, UINavigationControllerDelegate {
545545
}
546546

547547
// Chunk Timer
548-
var chunkMs = AppConstants.Video.defaultChunkDurationMs
548+
var chunkMs = AppConstants.ClientConfig.defaultChunkDurationMs
549549
if let config = ConnectionManager.shared.clientConfig,
550550
let ms = config["videoChunkDurationMs"] as? Int {
551551
chunkMs = ms
@@ -689,7 +689,7 @@ class CameraViewController: UIViewController, UINavigationControllerDelegate {
689689
}
690690

691691
let asset = AVURLAsset(url: urlToProcess)
692-
var fps: Double = AppConstants.Video.defaultFPS
692+
var fps: Double = AppConstants.ClientConfig.defaultFPS
693693
var width: Double = 0
694694
var height: Double = 0
695695

AllSpark-ios/ConnectionManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class ConnectionManager: NSObject, ObservableObject {
525525
let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
526526

527527
// Get limit from config
528-
var limitMB = AppConstants.Storage.defaultVideoBufferMaxMB
528+
var limitMB = AppConstants.ClientConfig.defaultVideoBufferMaxMB
529529
if let config = self?.clientConfig,
530530
let configLimit = config["videoBufferMaxMB"] as? Int {
531531
limitMB = configLimit

AllSpark-ios/SettingsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct SettingsView: View {
129129
Picker("Mode", selection: $privacyMode) {
130130
Text("Person Segmentation (Default)").tag("segmentation")
131131
Text("Body Pose Detection (Limbs)").tag("pose")
132+
Text("No Privacy Filter").tag("none")
132133
}
133134
}
134135
}

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,37 @@ See also: **[CHANGELOG.md](CHANGELOG.md)** · **[RELEASE.md](RELEASE.md)**
2020
- Server-managed communications policy with app-level enforcement
2121
- Configurable video format (MP4/MOV) synced from server
2222

23+
## Client Configuration
24+
25+
The iOS application receives a `clientConfig` JSON object from the Edge Server to remotely configure capture formats and sensor streams. The new architecture separates sensor streams to allow for multimodal VLM/LLM analysis on the edge server.
26+
27+
### Default Sensor Streams
28+
29+
Here are the default expectations and supported formats:
30+
31+
```json
32+
"clientConfig": {
33+
"fps": 30,
34+
"videoChunkDurationMs": 10000,
35+
"videoBufferMaxMB": 16000,
36+
"videoFormat": "mp4",
37+
"audioFormat": "wav",
38+
"depthFormat": "png",
39+
"poseFormat": "json",
40+
"timestampFormat": "txt"
41+
}
42+
```
43+
44+
### Format Options
45+
- **`videoFormat`** (rgb only, no audio): `"mp4"`, `"mov"`, `"none"`
46+
- **`audioFormat`**: `"wav"`, `"m4a"`, `"none"`
47+
- **`depthFormat`**: `"png"`, `"exr"`, `"none"`
48+
- **`poseFormat`**: `"json"`, `"none"`
49+
- **`timestampFormat`**: `"txt"`, `"none"`
50+
51+
> [!NOTE]
52+
> Setting any format to `"none"` will remotely disable collection from that specific sensor. This allows operators to save bandwidth and compute resources when certain streams are not needed for their agentic pipelines.
53+
2354
## API & WebSocket Communication
2455

2556
See the **[Endpoints Documentation](https://github.com/WiseLabCMU/AllSpark-edge-server/blob/master/docs/endpoints.md)** in the AllSpark Edge Server repository.

0 commit comments

Comments
 (0)