mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
Change GstSdp.sdp_message_parse_buffer to GstSdp.SDPMessage.new_from_text in examples
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3477>
This commit is contained in:
parent
412eaf3526
commit
0db1ff532d
4 changed files with 5 additions and 13 deletions
|
@ -88,10 +88,7 @@ class WebRTCBinObserver(WebRTCObserver):
|
||||||
return new_state
|
return new_state
|
||||||
|
|
||||||
def _deepcopy_session_description(self, desc):
|
def _deepcopy_session_description(self, desc):
|
||||||
# XXX: passing 'offer' to both a promise and an action signal without
|
_, new_sdp = GstSdp.SDPMessage.new_from_text(desc.sdp.as_text())
|
||||||
# a deepcopy will segfault...
|
|
||||||
new_sdp = GstSdp.SDPMessage.new()[1]
|
|
||||||
GstSdp.sdp_message_parse_buffer(bytes(desc.sdp.as_text().encode()), new_sdp)
|
|
||||||
return GstWebRTC.WebRTCSessionDescription.new(desc.type, new_sdp)
|
return GstWebRTC.WebRTCSessionDescription.new(desc.type, new_sdp)
|
||||||
|
|
||||||
def _on_offer_created(self, promise, element):
|
def _on_offer_created(self, promise, element):
|
||||||
|
|
|
@ -170,8 +170,7 @@ class WebRTCApplication(object):
|
||||||
def have_json(msg):
|
def have_json(msg):
|
||||||
if 'sdp' in msg:
|
if 'sdp' in msg:
|
||||||
sdp = msg['sdp']
|
sdp = msg['sdp']
|
||||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp['sdp'])
|
||||||
GstSdp.sdp_message_parse_buffer(bytes(sdp['sdp'].encode()), sdpmsg)
|
|
||||||
sdptype = GstWebRTC.WebRTCSDPType.ANSWER if sdp['type'] == 'answer' else GstWebRTC.WebRTCSDPType.OFFER
|
sdptype = GstWebRTC.WebRTCSDPType.ANSWER if sdp['type'] == 'answer' else GstWebRTC.WebRTCSDPType.OFFER
|
||||||
desc = GstWebRTC.WebRTCSessionDescription.new(sdptype, sdpmsg)
|
desc = GstWebRTC.WebRTCSessionDescription.new(sdptype, sdpmsg)
|
||||||
self.client.set_remote_description(desc)
|
self.client.set_remote_description(desc)
|
||||||
|
|
|
@ -358,9 +358,7 @@ class WebRTCClient:
|
||||||
sdp = msg['sdp']
|
sdp = msg['sdp']
|
||||||
assert(msg['type'] == 'answer')
|
assert(msg['type'] == 'answer')
|
||||||
print ('Received answer:\n%s' % sdp)
|
print ('Received answer:\n%s' % sdp)
|
||||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
|
||||||
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
|
|
||||||
|
|
||||||
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
|
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
|
||||||
promise = Gst.Promise.new()
|
promise = Gst.Promise.new()
|
||||||
self.webrtc.emit('set-remote-description', answer, promise)
|
self.webrtc.emit('set-remote-description', answer, promise)
|
||||||
|
|
|
@ -224,16 +224,14 @@ class WebRTCClient:
|
||||||
sdp = msg['sdp']['sdp']
|
sdp = msg['sdp']['sdp']
|
||||||
if msg['sdp']['type'] == 'answer':
|
if msg['sdp']['type'] == 'answer':
|
||||||
print_status('Received answer:\n%s' % sdp)
|
print_status('Received answer:\n%s' % sdp)
|
||||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
|
||||||
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
|
|
||||||
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
|
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
|
||||||
promise = Gst.Promise.new()
|
promise = Gst.Promise.new()
|
||||||
self.webrtc.emit('set-remote-description', answer, promise)
|
self.webrtc.emit('set-remote-description', answer, promise)
|
||||||
promise.interrupt() # we don't care about the result, discard it
|
promise.interrupt() # we don't care about the result, discard it
|
||||||
else:
|
else:
|
||||||
print_status('Received offer:\n%s' % sdp)
|
print_status('Received offer:\n%s' % sdp)
|
||||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
|
||||||
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
|
|
||||||
|
|
||||||
if not self.webrtc:
|
if not self.webrtc:
|
||||||
print_status('Incoming call: received an offer, creating pipeline')
|
print_status('Incoming call: received an offer, creating pipeline')
|
||||||
|
|
Loading…
Reference in a new issue