webrtc/athena: revert addIceCandidate changes (#38180)

* revert addIceCandidate changes

* remove accidental file
This commit is contained in:
stef
2026-06-15 19:50:07 -04:00
committed by GitHub
parent 15fb1a809d
commit 37390743c1
2 changed files with 2 additions and 41 deletions
-8
View File
@@ -607,14 +607,6 @@ def startStream(sdp: str) -> dict:
except requests.ConnectionError as e:
raise Exception("webrtc is not running. turn on comma body ignition.") from e
@dispatcher.add_method
def addIceCandidate(session_id: str, candidate: dict | None) -> dict:
if session_id is None:
return Exception("cannot add ice candidate without session_id")
resp = WEBRTCD_SESS.post(f"http://localhost:{WEBRTCD_PORT}/candidate",
json={"session_id": session_id, "candidate": candidate}, timeout=10)
return resp.json()
@dispatcher.add_method
def takeSnapshot() -> str | dict[str, str] | None:
from openpilot.system.camerad.snapshot import jpeg_write, snapshot
+2 -33
View File
@@ -278,23 +278,6 @@ class StreamSession:
async def get_answer(self):
return await self.stream.start()
async def add_ice_candidate(self, candidate_init: dict | None):
from aiortc.sdp import candidate_from_sdp
pc = self.stream.peer_connection
if pc.iceConnectionState not in ("new", "checking"):
return
# a null/empty candidate signals end-of-candidates per the WebRTC convention
if not candidate_init or not candidate_init.get("candidate"):
await pc.addIceCandidate(None)
return
candidate = candidate_from_sdp(candidate_init["candidate"].split(":", 1)[1])
candidate.sdpMid = candidate_init.get("sdpMid")
candidate.sdpMLineIndex = candidate_init.get("sdpMLineIndex")
await pc.addIceCandidate(candidate)
def message_handler(self, message: bytes):
assert self.incoming_bridge is not None
try:
@@ -401,24 +384,11 @@ async def get_stream(request: 'web.Request'):
stream_dict[session.identifier] = session
session.start()
session_id = session.identifier
def remove_finished_session(_: asyncio.Task) -> None:
stream_dict.pop(session_id, None)
stream_dict.pop(session.identifier, None)
session.run_task.add_done_callback(remove_finished_session)
return web.json_response({"sdp": answer.sdp, "type": answer.type, "session_id": session.identifier})
async def post_candidate(request: 'web.Request'):
body = await request.json()
session = request.app.get('streams', {}).get(body.get("session_id"))
try:
await session.add_ice_candidate(body.get("candidate"))
except Exception as e:
raise web.HTTPBadRequest(text=json.dumps({"error": "invalid_candidate", "message": str(e)}), content_type="application/json") from e
return web.Response(status=200, text="OK")
return web.json_response({"sdp": answer.sdp, "type": answer.type})
async def get_schema(request: 'web.Request'):
@@ -464,7 +434,6 @@ def webrtcd_thread(host: str, port: int, debug: bool):
app['debug'] = debug
app.on_shutdown.append(on_shutdown)
app.router.add_post("/stream", get_stream)
app.router.add_post("/candidate", post_candidate)
app.router.add_post("/notify", post_notify)
app.router.add_get("/schema", get_schema)