mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +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
|
||||
|
||||
def _deepcopy_session_description(self, desc):
|
||||
# XXX: passing 'offer' to both a promise and an action signal without
|
||||
# a deepcopy will segfault...
|
||||
new_sdp = GstSdp.SDPMessage.new()[1]
|
||||
GstSdp.sdp_message_parse_buffer(bytes(desc.sdp.as_text().encode()), new_sdp)
|
||||
_, new_sdp = GstSdp.SDPMessage.new_from_text(desc.sdp.as_text())
|
||||
return GstWebRTC.WebRTCSessionDescription.new(desc.type, new_sdp)
|
||||
|
||||
def _on_offer_created(self, promise, element):
|
||||
|
|
|
@ -170,8 +170,7 @@ class WebRTCApplication(object):
|
|||
def have_json(msg):
|
||||
if 'sdp' in msg:
|
||||
sdp = msg['sdp']
|
||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
||||
GstSdp.sdp_message_parse_buffer(bytes(sdp['sdp'].encode()), sdpmsg)
|
||||
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp['sdp'])
|
||||
sdptype = GstWebRTC.WebRTCSDPType.ANSWER if sdp['type'] == 'answer' else GstWebRTC.WebRTCSDPType.OFFER
|
||||
desc = GstWebRTC.WebRTCSessionDescription.new(sdptype, sdpmsg)
|
||||
self.client.set_remote_description(desc)
|
||||
|
|
|
@ -358,9 +358,7 @@ class WebRTCClient:
|
|||
sdp = msg['sdp']
|
||||
assert(msg['type'] == 'answer')
|
||||
print ('Received answer:\n%s' % sdp)
|
||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
||||
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
|
||||
|
||||
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
|
||||
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
|
||||
promise = Gst.Promise.new()
|
||||
self.webrtc.emit('set-remote-description', answer, promise)
|
||||
|
|
|
@ -224,16 +224,14 @@ class WebRTCClient:
|
|||
sdp = msg['sdp']['sdp']
|
||||
if msg['sdp']['type'] == 'answer':
|
||||
print_status('Received answer:\n%s' % sdp)
|
||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
||||
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
|
||||
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
|
||||
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
|
||||
promise = Gst.Promise.new()
|
||||
self.webrtc.emit('set-remote-description', answer, promise)
|
||||
promise.interrupt() # we don't care about the result, discard it
|
||||
else:
|
||||
print_status('Received offer:\n%s' % sdp)
|
||||
res, sdpmsg = GstSdp.SDPMessage.new()
|
||||
GstSdp.sdp_message_parse_buffer(bytes(sdp.encode()), sdpmsg)
|
||||
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
|
||||
|
||||
if not self.webrtc:
|
||||
print_status('Incoming call: received an offer, creating pipeline')
|
||||
|
|
Loading…
Reference in a new issue