Commit 2bd85313 authored by Saul Ibarra's avatar Saul Ibarra

Fix processing SIPSessionProposalAccepted/Rejected


Don't rely on the originator parameter, because it's not that
obvious, checking our own state is.
parent 84d835d5
...@@ -857,16 +857,16 @@ class BlinkSession(QObject): ...@@ -857,16 +857,16 @@ class BlinkSession(QObject):
def _NH_SIPSessionProposalAccepted(self, notification): def _NH_SIPSessionProposalAccepted(self, notification):
accepted_streams = notification.data.accepted_streams accepted_streams = notification.data.accepted_streams
proposed_streams = notification.data.proposed_streams proposed_streams = notification.data.proposed_streams
if self.state not in ('ending', 'ended', 'deleted'):
self.state = 'connected'
for stream in proposed_streams: for stream in proposed_streams:
if stream in accepted_streams: if stream in accepted_streams:
self.streams.set_active(stream) self.streams.set_active(stream)
notification.center.post_notification('BlinkSessionDidAddStream', sender=self, data=NotificationData(stream=stream)) notification.center.post_notification('BlinkSessionDidAddStream', sender=self, data=NotificationData(stream=stream))
else: else:
self.streams.remove(stream) self.streams.remove(stream)
if notification.data.originator == 'local': if self.state == 'connected/sent_proposal':
notification.center.post_notification('BlinkSessionDidNotAddStream', sender=self, data=NotificationData(stream=stream)) notification.center.post_notification('BlinkSessionDidNotAddStream', sender=self, data=NotificationData(stream=stream))
if self.state not in ('ending', 'ended', 'deleted'):
self.state = 'connected'
if accepted_streams: if accepted_streams:
self.info.streams._update(self.streams) self.info.streams._update(self.streams)
notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'})) notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'}))
...@@ -874,7 +874,7 @@ class BlinkSession(QObject): ...@@ -874,7 +874,7 @@ class BlinkSession(QObject):
def _NH_SIPSessionProposalRejected(self, notification): def _NH_SIPSessionProposalRejected(self, notification):
for stream in set(notification.data.proposed_streams).intersection(self.streams): for stream in set(notification.data.proposed_streams).intersection(self.streams):
self.streams.remove(stream) self.streams.remove(stream)
if notification.data.originator == 'local': if self.state == 'connected/sent_proposal':
notification.center.post_notification('BlinkSessionDidNotAddStream', sender=self, data=NotificationData(stream=stream)) notification.center.post_notification('BlinkSessionDidNotAddStream', sender=self, data=NotificationData(stream=stream))
if self.state not in ('ending', 'ended', 'deleted'): if self.state not in ('ending', 'ended', 'deleted'):
self.state = 'connected' self.state = 'connected'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment