Browse Source

small fixes

main
Hendrik Langer 4 years ago
parent
commit
e9f510d001
  1. 6
      raspberry/roberto/camera/camera_gstreamer_webrtc.py
  2. 6
      raspberry/roberto/views/websocket/routes.py

6
raspberry/roberto/camera/camera_gstreamer_webrtc.py

@ -164,6 +164,9 @@ class WebRTCCamera(Thread):
self._queue.put({'job':'connect_client', 'sid':sid})
def disconnect_client(self, sid, room):
if sid == self.sid:
print("CAMERA DISCONNECTED")
return
self._queue.put({'job':'disconnect_client', 'sid':sid})
def start_global_pipeline(self):
@ -186,6 +189,7 @@ class WebRTCCamera(Thread):
bus = self.pipe.get_bus()
self.pipe.set_state(Gst.State.PLAYING)
print("GLOBAL PIPELINE RUNNING")
def close_global_pipeline(self):
self.pipe.set_state(Gst.State.NULL)
@ -234,6 +238,7 @@ class WebRTCCamera(Thread):
#webrtc.sync_children_states()
def close_client_pipeline(self, client_sid):
print("closing client pipeline")
webrtcbin = self._peers[client_sid]['webrtcbin']
peer_bin = self._peers[client_sid]['bin']
@ -247,6 +252,7 @@ class WebRTCCamera(Thread):
self._peers[client_sid]['bin'] = None
self._peers[client_sid]['webrtcbin'] = None
del self._peers[client_sid]
def handle_sdp_answer(self, sdp, client_sid):
print("handle_sdp_answer")

6
raspberry/roberto/views/websocket/routes.py

@ -98,7 +98,8 @@ def disconnect():
leave_room(ROOM)
webrtccamera.disconnect_client(sid, ROOM)
from roberto import serial
serial.del_callback('B', display_battery)
if sid != webrtccamera.sid:
serial.del_callback('B', display_battery)
@socketio.on('connect', namespace='/webrtc')
def connect():
@ -107,7 +108,8 @@ def connect():
join_room(ROOM)
webrtccamera.connect_client(sid, ROOM)
from roberto import serial
serial.add_callback('B', display_battery)
if sid != webrtccamera.sid:
serial.add_callback('B', display_battery)
@socketio.on_error_default
def default_error_handler(e):

Loading…
Cancel
Save