[Jingle] Fix a minor bug that showed incorrect states when adding a content to a session
This commit is contained in:
parent
a393b36a3f
commit
600b433296
|
@ -46,6 +46,7 @@ class JingleContent(object):
|
||||||
#self.name = None
|
#self.name = None
|
||||||
self.accepted = False
|
self.accepted = False
|
||||||
self.sent = False
|
self.sent = False
|
||||||
|
self.negotiated = False
|
||||||
|
|
||||||
self.media = None
|
self.media = None
|
||||||
|
|
||||||
|
@ -82,6 +83,11 @@ class JingleContent(object):
|
||||||
def is_ready(self):
|
def is_ready(self):
|
||||||
return self.accepted and not self.sent
|
return self.accepted and not self.sent
|
||||||
|
|
||||||
|
def on_negotiated(self):
|
||||||
|
if self.accepted:
|
||||||
|
self.negotiated = True
|
||||||
|
self.session.content_negotiated(self.media)
|
||||||
|
|
||||||
def add_remote_candidates(self, candidates):
|
def add_remote_candidates(self, candidates):
|
||||||
"""
|
"""
|
||||||
Add a list of candidates to the list of remote candidates
|
Add a list of candidates to the list of remote candidates
|
||||||
|
|
|
@ -200,7 +200,7 @@ class JingleRTPContent(JingleContent):
|
||||||
self.transport.remote_candidates = []
|
self.transport.remote_candidates = []
|
||||||
# TODO: farsight.DIRECTION_BOTH only if senders='both'
|
# TODO: farsight.DIRECTION_BOTH only if senders='both'
|
||||||
self.p2pstream.set_property('direction', farsight.DIRECTION_BOTH)
|
self.p2pstream.set_property('direction', farsight.DIRECTION_BOTH)
|
||||||
self.session.content_negociated(self.media)
|
self.on_negotiated()
|
||||||
|
|
||||||
def __on_remote_codecs(self, stanza, content, error, action):
|
def __on_remote_codecs(self, stanza, content, error, action):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -649,7 +649,7 @@ class JingleSession(object):
|
||||||
self.connection.dispatch('JINGLE_DISCONNECTED',
|
self.connection.dispatch('JINGLE_DISCONNECTED',
|
||||||
(self.peerjid, self.sid, content.media, 'removed'))
|
(self.peerjid, self.sid, content.media, 'removed'))
|
||||||
|
|
||||||
def content_negociated(self, media):
|
def content_negotiated(self, media):
|
||||||
self.connection.dispatch('JINGLE_CONNECTED', (self.peerjid, self.sid,
|
self.connection.dispatch('JINGLE_CONNECTED', (self.peerjid, self.sid,
|
||||||
media))
|
media))
|
||||||
|
|
||||||
|
|
|
@ -4793,9 +4793,11 @@ class VoIPCallReceivedDialog(object):
|
||||||
return
|
return
|
||||||
ctrl = gajim.interface.new_chat(contact, self.account, resource)
|
ctrl = gajim.interface.new_chat(contact, self.account, resource)
|
||||||
# Chat control opened, update content's status
|
# Chat control opened, update content's status
|
||||||
if session.get_content('audio'):
|
audio = session.get_content('audio')
|
||||||
|
video = session.get_content('video')
|
||||||
|
if audio and not audio.negotiated:
|
||||||
ctrl.set_audio_state('connecting', self.sid)
|
ctrl.set_audio_state('connecting', self.sid)
|
||||||
if session.get_content('video'):
|
if video and not video.negotiated:
|
||||||
ctrl.set_video_state('connecting', self.sid)
|
ctrl.set_video_state('connecting', self.sid)
|
||||||
# Now, accept the content/sessions.
|
# Now, accept the content/sessions.
|
||||||
# This should be done after the chat control is running
|
# This should be done after the chat control is running
|
||||||
|
|
Loading…
Reference in New Issue