Fix a regression introduced by my last patch

This commit is contained in:
Thibaut GIRKA 2009-11-15 21:21:10 +01:00
parent b2c5810869
commit b1173a2e87
3 changed files with 23 additions and 13 deletions

View File

@ -70,6 +70,10 @@ class JingleContent(object):
def is_ready(self):
return (self.accepted and not self.sent)
def add_remote_candidates(self, candidates):
''' Add a list of candidates to the list of remote candidates. '''
pass
def stanzaCB(self, stanza, content, error, action):
''' Called when something related to our content was sent by peer. '''
if action in self.callbacks:
@ -78,7 +82,10 @@ class JingleContent(object):
def __transportInfoCB(self, stanza, content, error, action):
''' Got a new transport candidate. '''
self.transport.transportInfoCB(content.getTag('transport'))
candidates = self.transport.parse_transport_stanza(
content.getTag('transport'))
if candidates:
self.add_remote_candidates(candidates)
def __content(self, payload=[]):
''' Build a XML content-wrapper for our data. '''

View File

@ -83,6 +83,13 @@ class JingleRTPContent(JingleContent):
return (JingleContent.is_ready(self) and self.candidates_ready
and self.p2psession.get_property('codecs-ready'))
def add_remote_candidates(self, candidates):
JingleContent.add_remote_candidates(self, candidates)
#FIXME: connectivity should not be etablished yet
# Instead, it should be etablished after session-accept!
if self.sent:
self.p2pstream.set_remote_candidates(candidates)
def batch_dtmf(self, events):
if self._dtmf_running:
raise Exception #TODO: Proper exception

View File

@ -46,13 +46,17 @@ class JingleTransport(object):
pass
def make_transport(self, candidates=None):
''' Build a transport stanza with the given candidates (or self.candidates
if candidates is None). '''
''' Build a transport stanza with the given candidates (or
self.candidates if candidates is None). '''
if not candidates:
candidates = self._iter_candidates()
transport = xmpp.Node('transport', payload=candidates)
return transport
def parse_transport_stanza(self, transport):
''' Returns the list of transport candidates from a transport stanza. '''
return []
import farsight
@ -93,7 +97,7 @@ class JingleTransportICEUDP(JingleTransport):
transport.setAttr('pwd', self.candidates[0].password)
return transport
def transportInfoCB(self, transport):
def parse_transport_stanza(self, transport):
candidates = []
for candidate in transport.iterTags('candidate'):
cand = farsight.Candidate()
@ -124,16 +128,8 @@ class JingleTransportICEUDP(JingleTransport):
else:
print 'Unknown type %s', candidate['type']
candidates.append(cand)
#FIXME: connectivity should not be etablished yet
# Instead, it should be etablished after session-accept!
#FIXME:
#if len(candidates) > 0:
# if self.sent:
# self.p2pstream.set_remote_candidates(candidates)
# else:
self.remote_candidates.extend(candidates)
#self.p2pstream.set_remote_candidates(candidates)
#print self.media, self.creator, self.name, candidates
return candidates
transports[xmpp.NS_JINGLE_ICE_UDP] = JingleTransportICEUDP