Browse Source

comment debug print statements

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

27
raspberry/roberto/camera/camera_gstreamer_webrtc.py

@ -199,7 +199,7 @@ class WebRTCCamera(Thread):
self._queue.put({'job':'emit', 'event':event, 'data':data})
def send_battery(self, val, arg):
print("sending battery value %s" % val)
#print("sending battery value %s" % val)
self.emit_async('battery', val)
def start_global_pipeline(self):
@ -332,7 +332,7 @@ class WebRTCCamera(Thread):
del self._peers[client_sid]
def handle_sdp_answer(self, sdp, client_sid):
print("handle_sdp_answer")
#print("handle_sdp_answer")
#print ('Received answer:\n%s' % sdp)
res, sdpmsg = GstSdp.SDPMessage.new()
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
@ -345,7 +345,7 @@ class WebRTCCamera(Thread):
pass
def handle_ice(self, ice, client_sid):
print("handle_ice")
#print("handle_ice")
candidate = ice['candidate']
if not candidate or candidate == '':
print("candidate string is empty")
@ -354,18 +354,18 @@ class WebRTCCamera(Thread):
self._peers[client_sid]['webrtcbin'].emit('add-ice-candidate', sdpmlineindex, candidate)
def on_negotiation_needed(self, receiver_entry, client_sid):
print("on_negotiation_needed [%s]" % client_sid)
#print("on_negotiation_needed [%s]" % client_sid)
promise = Gst.Promise.new_with_change_func(self.on_offer_created, receiver_entry, client_sid, None)
receiver_entry.emit('create-offer', None, promise)
def on_ice_candidate(self, _, mlineindex, candidate, client_sid):
print("on_ice_candidate [%s]" % client_sid)
#print("on_ice_candidate [%s]" % client_sid)
icemsg = json.dumps({'type': 'ice', 'data': {'candidate': candidate, 'sdpMLineIndex': mlineindex}, 'sid': client_sid})
sio.emit('message', data=icemsg)
# Offer created by our pipeline, to be sent to the peer
def on_offer_created(self, promise, _, client_sid, __):
print("on_offer_created [%s]" % client_sid)
#print("on_offer_created [%s]" % client_sid)
promise.wait()
reply = promise.get_reply()
offer = reply['offer']
@ -373,10 +373,9 @@ class WebRTCCamera(Thread):
self._peers[client_sid]['webrtcbin'].emit('set-local-description', offer, promise)
promise.interrupt()
text = offer.sdp.as_text()
print ('Sending offer:\n%s' % text)
#print ('Sending offer:\n%s' % text)
msg = json.dumps({'type': 'sdp', 'data': {'type': 'offer', 'sdp': text}, 'sid': client_sid})
sio.emit('message', data=msg)
print("test")
@sio.on('message')
def webrtc_message(data):
@ -407,12 +406,12 @@ class WebRTCCamera(Thread):
print("Received SDP message without SDP string")
return
if data['data']['type'] == 'answer':
print("Received SDP answer:")
print(data['data']['sdp'])
#print("Received SDP answer:")
#print(data['data']['sdp'])
webrtccamera.handle_sdp_answer(data['data']['sdp'], client_sid)
elif data['data']['type'] == 'offer':
print("Received SDP offer:")
print(data['data']['sdp'])
#print("Received SDP offer:")
#print(data['data']['sdp'])
webrtccamera.handle_sdp_offer(data['data']['sdp'], client_sid)
else:
print("Expected SDP message type \"answer\", got \"%s\"" % data['data']['type'])
@ -422,8 +421,8 @@ class WebRTCCamera(Thread):
print("Received ICE message without mline index")
return
if 'candidate' in data['data']:
print("Received ICE candidate with mline index %u" % data['data']['sdpMLineIndex'])
print(data['data']['candidate'])
#print("Received ICE candidate with mline index %u" % data['data']['sdpMLineIndex'])
#print(data['data']['candidate'])
webrtccamera.handle_ice(data['data'], client_sid)
else:
print("Received ICE message without ICE candidate string")

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

@ -12,8 +12,8 @@ from roberto import socketio
@socketio.on('axes')
def gamepad_axes(axes_data):
print('GAMEPAD axes')
print(axes_data)
#print('GAMEPAD axes')
#print(axes_data)
from roberto import serial
x = applyDeadZone( axes_data['0'], 0.15 )
y = applyDeadZone( axes_data['1'], 0.15 )
@ -60,7 +60,7 @@ def camera():
@socketio.on('message') # ok
def webrtc_message(data):
sid = request.sid
print('Message from {}: {}'.format(sid, data))
#print('Message from {}: {}'.format(sid, data))
if isinstance(data, str):
try:
jsonData = json.loads(data)

Loading…
Cancel
Save