security-union / security-union/remote-shutter

Verify: camera may wedge in .cameraTransmittingVideo when 'send media to remote' is on

Open
#159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
19
Forks
3
Avg merge
28m
Merged PRs (30d)
6

Description

Unresolved contradiction — needs an experiment, not a fix. Do not change the code until this is decided; the reading and the observed behaviour disagree.

The reading

RemoteCam/SessionCoordinator.swift:936

case is UICmd.VideoResourceTransferCompleted, is UICmd.VideoResourceTransferFailed:
    ctrl?.cameraViewModel.finishVideoTransfer()

This shadows handleRoot:1058-1066 — the only code that emits StopRecordingVideoResp after a successful resource transfer:

case let completed as UICmd.VideoResourceTransferCompleted:
    monitor?.videoTransferFinished()
    if completed.success {
        await sendOrGoToScanning(RemoteCmd.StopRecordingVideoResp(sender: nil, pic: nil, error: nil))
    }

The camera can only leave .cameraTransmittingVideo via :939-945 (on StopRecordingVideoResp). On the send-video path the pipeline never produces one itself — RecordingPipeline.swift:185-190 only sends it in the else (don't-send-to-peer) branch; the send branch calls sendVideoAsResource. So by this reading the camera wedges after every send-video recording, in both directions, and the next StartRecordingVideo gets an error ack from handleRoot:1034-1035.

The contradiction

Recording twice in a row with the iPhone as camera reportedly works fine. The monitor hides a camera-side wedge because it rescues itself locally via didFinishReceivingResource (:2076-2096) — but the second recording should still fail, and it doesn't.

Most likely explanation: "send media to remote" is off, so RecordingPipeline.swift:189 answers directly and :936 is never exercised.

The deciding experiment

Coordinator test: seed .cameraTransmittingVideo, deliver UICmd.VideoResourceTransferCompleted(success: true), assert the camera sends RemoteCmd.StopRecordingVideoResp and returns to .camera.

  • Fails → real bug; :936 must fall through to handleRoot (or emit the response itself).
  • Passes → the reading is wrong and the model needs revisiting.

Manual counterpart: enable "send media to remote", record → stop → record again.

Context: RemoteCamTests/RemoteCamSessionTests.swift already seeds .cameraTransmittingVideo for the keyframe tests, so the harness exists.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RemoteCam/SessionCoordinator.swift:936-945 and handleRoot:1034-1066, then inspect RecordingPipeline.swift:185-190. Add the described coordinator test in RemoteCamTests/RemoteCamSessionTests.swift, seeding .cameraTransmittingVideo and delivering VideoResourceTransferCompleted(success: true). Done means the test establishes whether StopRecordingVideoResp is sent and the state returns to .camera; optionally verify the manual two-recording path with sending enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.