63cf3026ff
Cross-platform research (Grant) flagged that the colour-border cue differs by app; checking the real brand colours against the detector found a concrete bug: the global 0.5 saturation threshold MISSES Teams' violet ring (#6264A7 ≈ 0.41, light variants ~0.27) entirely and Meet's lighter blue glow (#8ab4f8 ≈ 0.44). Those adapters would have detected nothing. - FrameSampler.saturatedPoints: add a tunable threshold + optional hue-band gate (degrees) so a lowered threshold doesn't pick up warm video. - GridCallAnalyzer.Config: colorSaturation / colorMinBrightness / colorHueRange, plumbed to the colour-border path (defaults preserve prior behaviour). - MeetAdapter sat→0.35 (catch the glow); TeamsAdapter sat→0.22 + hue 215–275° (catch the faint violet, reject other colours); ZoomAdapter sat 0.45 + hue 40–150° (vivid green/yellow). Values are first-pass pending real-fixture calibration; the hue gate is the main calibration lever. Tests: Teams now detects the faint violet ring and rejects a green one; Meet/Zoom vivid cases still pass. 27/27 XCTest.
49 lines
2.1 KiB
Swift
49 lines
2.1 KiB
Swift
import Foundation
|
|
import CoreVideo
|
|
|
|
/// Google Meet adapter (browser tab — capture is at the browser-window level).
|
|
///
|
|
/// Meet's active-speaker cue is a **coloured (Google-blue) ring/glow** around the
|
|
/// speaking participant's tile, plus animated audio bars in the tile's mic chip.
|
|
/// The participant **name sits in the tile's bottom-LEFT corner**, so the tile is
|
|
/// estimated extending up and to the right of the name.
|
|
///
|
|
/// Detection *logic* is validated on synthetic frames; the geometry constants are a
|
|
/// first pass and will be calibrated against real Meet screenshots. Meet runs in a
|
|
/// browser, so there's no Accessibility name source we rely on — OCR only.
|
|
struct MeetAdapter: AppAdapter {
|
|
// Browsers that can host a Meet tab. The window, not the app, is what we capture;
|
|
// CallDetector decides a browser window is a Meet call by its title.
|
|
static let bundleIDs = [
|
|
"com.google.Chrome", "org.mozilla.firefox", "com.apple.Safari",
|
|
"company.thebrowser.Browser", "com.brave.Browser", "com.microsoft.edgemac",
|
|
"com.google.Chrome.canary", "org.chromium.Chromium",
|
|
]
|
|
let adapterVersion = "meet-0.1.0"
|
|
let preferredFPS = 3
|
|
|
|
private let analyzer: GridCallAnalyzer
|
|
|
|
init() {
|
|
var config = GridCallAnalyzer.Config()
|
|
config.nameAnchor = .bottomLeft
|
|
config.detectColoredBorder = true // Google-blue speaking ring/glow
|
|
config.detectWhiteBorder = false
|
|
// The bright ring (#1a73e8) is ~0.89 sat but the lighter glow (#8ab4f8) is
|
|
// ~0.44, below the 0.5 default — lower the threshold so the glow registers.
|
|
config.colorSaturation = 0.35
|
|
config.tileExpandX = 3.0
|
|
config.tileExpandY = 5.0
|
|
self.analyzer = GridCallAnalyzer(config: config)
|
|
}
|
|
|
|
func analyze(frame: CVPixelBuffer, at t: TimeInterval) -> [SpeakerObservation] {
|
|
analyzer.analyze(pixelBuffer: frame, at: t)
|
|
}
|
|
|
|
// Exposed for fixture/synthetic tests.
|
|
func analyze(cgImage: CGImage, at t: TimeInterval) -> [SpeakerObservation] {
|
|
analyzer.analyze(cgImage: cgImage, at: t)
|
|
}
|
|
}
|