Fix Meet visual: reject solid avatar tiles + screen-share OCR

Root cause of the "4 people → 2 speakers" Meet call: the colored-border detector
read solid camera-off avatar tiles (orange "J", magenta "G") as active speakers
for the ENTIRE call. Those whole-call phantom spans dominated backend name
attribution, collapsing every remote voice onto one name — and the giant filled
bbox also swallowed screen-share text (WERUNBTC.COM ×49) as a speaker.

Validated against 9 real fixtures (harness over the real MeetAdapter):

Detection:
- FrameSampler.thinColoredPoints: coloured counterpart of thinWhitePoints — keeps
  thin border/ring/pill edges, drops solid colour fills.
- GridCallAnalyzer.isHollow: reject a highlight component whose interior is filled
  (a solid tile) vs a hollow ring (a real border). Config.maxInteriorFill (0.2 default).
- MeetAdapter: detect thin BLUE edges only (hue 180–240°, measured from the
  fixtures), maxInteriorFill 0.3 (real Meet rings ≈0.2–0.3, solid tiles ≈0.36).
- Result on fixtures: John Arnold/Grant Gilliam (solid tiles) now NEVER detected;
  Matt Odell/Mark detected when their blue cue is present. Sparse but never wrong —
  correct for a naming hint over audio diarization.

OCR name hygiene:
- isLikelyName rejects domain-like screen-share text ("WERUNBTC.COM", OCR'd ".GOM").
- cleaned() strips trailing punctuation ("Mark." → "Mark").
- TimelineBuilder.canonicalizeByFrequency folds rare OCR misspellings into a
  dominant near-twin name ("Matt Odel"/"MattOdell" → "Matt Odell", "Mare" → "Mark").

Tests: hollow-ring, extended OCR filter, fuzzy-merge. 65 pass.
This commit is contained in:
Grant Gilliam
2026-06-08 16:18:52 -05:00
parent 5c80e827a1
commit 39beccf7f4
6 changed files with 182 additions and 6 deletions
@@ -138,16 +138,37 @@ final class GridCallAnalyzerTests: XCTestCase {
func testNameFilterAgainstRealMeetOCR() {
// The exact strings OCR pulled from a real Meet session only the first
// group are participants; the rest are UI chrome that must NOT become speakers.
let names = ["Grant Gilliam", "Caitlyn Viggiano", "Cait's Phone", "Grant", "Me"]
let names = ["Grant Gilliam", "Caitlyn Viggiano", "Cait's Phone", "Grant", "Me", "Matt Odell"]
let junk = ["11:43 AM | rvo-rmjg-rdq", "@ Embassy Er", "Admit 1 guest",
"Joined as grant.gilliam@gmail.com", "Others may see your video differently",
"Others might still see your full video.", "Your meeting's ready", "efforot",
"g* Add others", "g+ Add others", "meet.google.com/rvo-rmjg-rdq",
"permission before they can join.", "the meeting", "G"]
"permission before they can join.", "the meeting", "G",
// Screen-share domain text OCR'd as a name (incl. OCR'd TLDs).
"WERUNBTC.COM", "WERUNBTG.COM", "WERUNBTC.GOM"]
for n in names { XCTAssertTrue(GridCallAnalyzer.isLikelyName(n), "should keep name: \(n)") }
for j in junk { XCTAssertFalse(GridCallAnalyzer.isLikelyName(j), "should drop junk: \(j)") }
}
func testHollowRingKeptFilledTileRejected() {
// A thin ring (border): points only on the perimeter of a 120×120 box.
var ring: [CGPoint] = []
for t in stride(from: 0.0, through: 120, by: 4) {
ring.append(.init(x: t, y: 0)); ring.append(.init(x: t, y: 120))
ring.append(.init(x: 0, y: t)); ring.append(.init(x: 120, y: t))
}
let rbb = GridCallAnalyzer.boundingBox(ring)
XCTAssertTrue(GridCallAnalyzer.isHollow(ring, bbox: rbb, maxInteriorFill: 0.2))
// A solid fill (camera-off avatar tile): points across the whole box.
var blob: [CGPoint] = []
for x in stride(from: 0.0, through: 120, by: 4) {
for y in stride(from: 0.0, through: 120, by: 4) { blob.append(.init(x: x, y: y)) }
}
let bbb = GridCallAnalyzer.boundingBox(blob)
XCTAssertFalse(GridCallAnalyzer.isHollow(blob, bbox: bbb, maxInteriorFill: 0.2))
}
func testWhiteBorderDetectorIgnoresColouredBorder() {
// Signal looks only for the white border, so a coloured (Meet) border must
// not register as a Signal speaker.