3021643236
ok aja@
160 lines
7.4 KiB
Plaintext
160 lines
7.4 KiB
Plaintext
$OpenBSD: patch-src_common_jingle_rtp_py,v 1.1 2012/04/05 16:08:56 jasper Exp $
|
|
|
|
port Gajim to use Farstream instead of Farsight2.
|
|
from upstream changeset dfd58bb1ad06.
|
|
|
|
--- src/common/jingle_rtp.py.orig Thu Apr 5 11:35:38 2012
|
|
+++ src/common/jingle_rtp.py Thu Apr 5 11:36:08 2012
|
|
@@ -21,7 +21,7 @@ import gobject
|
|
import socket
|
|
|
|
import xmpp
|
|
-import farsight, gst
|
|
+import farstream, gst
|
|
from glib import GError
|
|
|
|
import gajim
|
|
@@ -42,8 +42,8 @@ class JingleRTPContent(JingleContent):
|
|
JingleContent.__init__(self, session, transport)
|
|
self.media = media
|
|
self._dtmf_running = False
|
|
- self.farsight_media = {'audio': farsight.MEDIA_TYPE_AUDIO,
|
|
- 'video': farsight.MEDIA_TYPE_VIDEO}[media]
|
|
+ self.farstream_media = {'audio': farstream.MEDIA_TYPE_AUDIO,
|
|
+ 'video': farstream.MEDIA_TYPE_VIDEO}[media]
|
|
|
|
self.pipeline = None
|
|
self.src_bin = None
|
|
@@ -72,7 +72,7 @@ class JingleRTPContent(JingleContent):
|
|
self.pipeline.add(self.conference)
|
|
self.funnel = None
|
|
|
|
- self.p2psession = self.conference.new_session(self.farsight_media)
|
|
+ self.p2psession = self.conference.new_session(self.farstream_media)
|
|
|
|
participant = self.conference.new_participant(self.session.peerjid)
|
|
# FIXME: Consider a workaround, here...
|
|
@@ -93,7 +93,7 @@ class JingleRTPContent(JingleContent):
|
|
params['stun-ip'] = ip
|
|
|
|
self.p2pstream = self.p2psession.new_stream(participant,
|
|
- farsight.DIRECTION_RECV, 'nice', params)
|
|
+ farstream.DIRECTION_RECV, 'nice', params)
|
|
|
|
def is_ready(self):
|
|
return (JingleContent.is_ready(self) and self.candidates_ready)
|
|
@@ -140,15 +140,15 @@ class JingleRTPContent(JingleContent):
|
|
|
|
def _start_dtmf(self, event):
|
|
if event in ('*', '#'):
|
|
- event = {'*': farsight.DTMF_EVENT_STAR,
|
|
- '#': farsight.DTMF_EVENT_POUND}[event]
|
|
+ event = {'*': farstream.DTMF_EVENT_STAR,
|
|
+ '#': farstream.DTMF_EVENT_POUND}[event]
|
|
else:
|
|
event = int(event)
|
|
self.p2psession.start_telephony_event(event, 2,
|
|
- farsight.DTMF_METHOD_RTP_RFC4733)
|
|
+ farstream.DTMF_METHOD_RTP_RFC4733)
|
|
|
|
def _stop_dtmf(self):
|
|
- self.p2psession.stop_telephony_event(farsight.DTMF_METHOD_RTP_RFC4733)
|
|
+ self.p2psession.stop_telephony_event(farstream.DTMF_METHOD_RTP_RFC4733)
|
|
|
|
def _fill_content(self, content):
|
|
content.addChild(xmpp.NS_JINGLE_RTP + ' description',
|
|
@@ -170,30 +170,30 @@ class JingleRTPContent(JingleContent):
|
|
if message.type == gst.MESSAGE_ELEMENT:
|
|
name = message.structure.get_name()
|
|
log.debug('gst element message: %s: %s' % (name, message))
|
|
- if name == 'farsight-new-active-candidate-pair':
|
|
+ if name == 'farstream-new-active-candidate-pair':
|
|
pass
|
|
- elif name == 'farsight-recv-codecs-changed':
|
|
+ elif name == 'farstream-recv-codecs-changed':
|
|
pass
|
|
- elif name == 'farsight-codecs-changed':
|
|
+ elif name == 'farstream-codecs-changed':
|
|
if self.sent and self.p2psession.get_property('codecs-ready'):
|
|
self.send_description_info()
|
|
- elif name == 'farsight-local-candidates-prepared':
|
|
+ elif name == 'farstream-local-candidates-prepared':
|
|
self.candidates_ready = True
|
|
if self.is_ready():
|
|
self.session.on_session_state_changed(self)
|
|
- elif name == 'farsight-new-local-candidate':
|
|
+ elif name == 'farstream-new-local-candidate':
|
|
candidate = message.structure['candidate']
|
|
self.transport.candidates.append(candidate)
|
|
if self.sent:
|
|
# FIXME: Is this case even possible?
|
|
self.send_candidate(candidate)
|
|
- elif name == 'farsight-component-state-changed':
|
|
+ elif name == 'farstream-component-state-changed':
|
|
state = message.structure['state']
|
|
- if state == farsight.STREAM_STATE_FAILED:
|
|
+ if state == farstream.STREAM_STATE_FAILED:
|
|
reason = xmpp.Node('reason')
|
|
reason.setTag('failed-transport')
|
|
self.session.remove_content(self.creator, self.name, reason)
|
|
- elif name == 'farsight-error':
|
|
+ elif name == 'farstream-error':
|
|
log.error('Farsight error #%d!\nMessage: %s\nDebug: %s' % (
|
|
message.structure['error-no'],
|
|
message.structure['error-msg'],
|
|
@@ -238,8 +238,8 @@ class JingleRTPContent(JingleContent):
|
|
if self.transport.remote_candidates:
|
|
self.p2pstream.set_remote_candidates(self.transport.remote_candidates)
|
|
self.transport.remote_candidates = []
|
|
- # TODO: farsight.DIRECTION_BOTH only if senders='both'
|
|
- self.p2pstream.set_property('direction', farsight.DIRECTION_BOTH)
|
|
+ # TODO: farstream.DIRECTION_BOTH only if senders='both'
|
|
+ self.p2pstream.set_property('direction', farstream.DIRECTION_BOTH)
|
|
JingleContent.on_negotiated(self)
|
|
|
|
def __on_remote_codecs(self, stanza, content, error, action):
|
|
@@ -252,8 +252,8 @@ class JingleRTPContent(JingleContent):
|
|
if not codec['id'] or not codec['name'] or not codec['clockrate']:
|
|
# ignore invalid payload-types
|
|
continue
|
|
- c = farsight.Codec(int(codec['id']), codec['name'],
|
|
- self.farsight_media, int(codec['clockrate']))
|
|
+ c = farstream.Codec(int(codec['id']), codec['name'],
|
|
+ self.farstream_media, int(codec['clockrate']))
|
|
if 'channels' in codec:
|
|
c.channels = int(codec['channels'])
|
|
else:
|
|
@@ -326,10 +326,10 @@ class JingleAudio(JingleRTPContent):
|
|
# place 16kHz before 8kHz, as buggy psi versions will take in
|
|
# account only the first codec
|
|
|
|
- codecs = [farsight.Codec(farsight.CODEC_ID_ANY, 'SPEEX',
|
|
- farsight.MEDIA_TYPE_AUDIO, 16000),
|
|
- farsight.Codec(farsight.CODEC_ID_ANY, 'SPEEX',
|
|
- farsight.MEDIA_TYPE_AUDIO, 8000)]
|
|
+ codecs = [farstream.Codec(farstream.CODEC_ID_ANY, 'SPEEX',
|
|
+ farstream.MEDIA_TYPE_AUDIO, 16000),
|
|
+ farstream.Codec(farstream.CODEC_ID_ANY, 'SPEEX',
|
|
+ farstream.MEDIA_TYPE_AUDIO, 8000)]
|
|
self.p2psession.set_codec_preferences(codecs)
|
|
|
|
# the local parts
|
|
@@ -350,7 +350,7 @@ class JingleAudio(JingleRTPContent):
|
|
'sink-pad'))
|
|
self.p2pstream.connect('src-pad-added', self._on_src_pad_added)
|
|
|
|
- # The following is needed for farsight to process ICE requests:
|
|
+ # The following is needed for farstream to process ICE requests:
|
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
|
|
|
|
|
@@ -397,7 +397,7 @@ class JingleVideo(JingleRTPContent):
|
|
'sink-pad'))
|
|
self.p2pstream.connect('src-pad-added', self._on_src_pad_added)
|
|
|
|
- # The following is needed for farsight to process ICE requests:
|
|
+ # The following is needed for farstream to process ICE requests:
|
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
|
|
|
def get_fallback_src(self):
|