Browse Source

v4l2 pipeline

split-pipe
Hendrik Langer 4 years ago
parent
commit
1649ea29be
  1. 24
      raspberry/roberto/camera/camera_gstreamer_webrtc.py

24
raspberry/roberto/camera/camera_gstreamer_webrtc.py

@ -18,13 +18,13 @@ from gi.repository import GstSdp
import json
PIPELINE_DESC = '''
webrtcbin name=sendrecv bundle-policy=max-bundle stun-server=stun://stun.l.google.com:19302
videotestsrc is-live=true pattern=ball ! videoconvert ! queue ! vp8enc deadline=1 ! rtpvp8pay !
queue ! application/x-rtp,media=video,encoding-name=VP8,payload=97 ! sendrecv.
audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc !rtpopuspay !
queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=96 ! sendrecv.
'''
#PIPELINE_DESC = '''
#webrtcbin name=sendrecv bundle-policy=max-bundle stun-server=stun://stun.l.google.com:19302
# videotestsrc is-live=true pattern=ball ! videoconvert ! queue ! vp8enc deadline=1 ! rtpvp8pay !
# queue ! application/x-rtp,media=video,encoding-name=VP8,payload=97 ! sendrecv.
# audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc !rtpopuspay !
# queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=96 ! sendrecv.
#'''
#PIPELINE_DESC = '''
#webrtcbin name=webrtcbin stun-server=stun://stun://stun.l.google.com:19302
@ -39,6 +39,13 @@ webrtcbin name=sendrecv bundle-policy=max-bundle stun-server=stun://stun.l.googl
# webrtcbin name=sendrecv
#'''
PIPELINE_DESC = '''
webrtcbin name=sendrecv bundle-policy=max-bundle stun-server=stun://stun.l.google.com:19302
v4l2src device=/dev/video0 ! videoconvert ! queue ! vp8enc deadline=1 ! rtpvp8pay !
queue ! application/x-rtp,media=video,encoding-name=VP8,payload=97 ! sendrecv.
audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample ! queue ! opusenc !rtpopuspay !
queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=96 ! sendrecv.
'''
class WebRTCCamera(Thread):
def __init__(self):
@ -91,12 +98,15 @@ class WebRTCCamera(Thread):
def connect_client(self, sid, room):
if not self.is_alive():
self.start()
if sid == self.sid:
return
self._queue.put({'job':'connect_client', 'sid':sid})
def disconnect_client(self, sid, room):
self._queue.put({'job':'disconnect_client', 'sid':sid})
def start_pipeline(self, client_sid): # ok
print("STARTING PIPELINE")
self.pipe = Gst.parse_launch(PIPELINE_DESC)
self.webrtc = self.pipe.get_by_name('sendrecv')
self.webrtc.connect('on-negotiation-needed', self.on_negotiation_needed)

Loading…
Cancel
Save