Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

44 sctp failed send event #45

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/gst_signalling/gst_abstract_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ async def on_end_session(session_id: str) -> None:
Gst.init(None)

self._pipeline = Gst.Pipeline.new()
# pipeline will only contain dynamically added webrtcbins
self._pipeline.set_state(Gst.State.PLAYING)

def __del__(self) -> None:
self._pipeline.set_state(Gst.State.NULL)
Gst.deinit()

def make_send_sdp(self, sdp: Any, type: str, session_id: str) -> None: # sdp is GstWebRTC.WebRTCSessionDescription
Expand All @@ -87,12 +90,8 @@ def init_webrtc(self, session_id: str) -> Gst.Element:
assert webrtc

webrtc.set_property("bundle-policy", "max-bundle")
# webrtc.set_property("stun-server", None)
# webrtc.set_property("turn-server", None)

webrtc.connect("on-ice-candidate", self.send_ice_candidate_message, session_id)

self._pipeline.set_state(Gst.State.READY)
self._pipeline.add(webrtc)

return webrtc
Expand Down Expand Up @@ -131,13 +130,12 @@ def handle_ice_message(self, webrtc: Gst.Element, ice_msg: Dict[str, Any]) -> No

async def close_session(self, session_id: str) -> None:
self.logger.info("close session")
"""
session = self.sessions.pop(session_id)

self.emit("close_session", session)

await session.pc.close()
"""
session = self.sessions.pop(session_id)
self._pipeline.remove(session.pc)
session.pc.set_state(Gst.State.NULL)
# self.emit("close_session", session)
# await session.pc.close()

async def send_sdp(self, session_id: str, sdp: Dict[str, Dict[str, str]]) -> None:
await self.signalling.send_peer_message(session_id, "sdp", sdp)
Expand Down
3 changes: 1 addition & 2 deletions src/gst_signalling/gst_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ async def setup_session(self, session_id: str, peer_id: str) -> GstSession:
pc = session.pc
pc.connect("on-negotiation-needed", self.on_negotiation_needed, session_id)

self._pipeline.set_state(Gst.State.PLAYING)

pc.sync_state_with_parent()
self.emit("new_session", session)

return session
Expand Down
Loading