Commit e623a19b authored by Dan Pascu's avatar Dan Pascu

Simplified notification handlers

parent 045fd5e2
...@@ -963,43 +963,21 @@ class BlinkSession(QObject): ...@@ -963,43 +963,21 @@ class BlinkSession(QObject):
self.unhold() self.unhold()
def _NH_RTPStreamICENegotiationStateDidChange(self, notification): def _NH_RTPStreamICENegotiationStateDidChange(self, notification):
if notification.sender.type == 'audio': if notification.data.state in {'GATHERING', 'GATHERING_COMPLETE', 'NEGOTIATING'}:
info = self.info.streams.audio stream_info = self.info.streams[notification.sender.type]
elif notification.sender.type == 'video': stream_info.ice_status = notification.data.state.lower()
info = self.info.streams.video
else:
raise RuntimeError('Unexpected stream type: %s' % notification.sender.type)
state = notification.data.state
if state == 'GATHERING':
info.ice_status = 'gathering'
notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'}))
if state == 'GATHERING_COMPLETE':
info.ice_status = 'gathering_complete'
notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'}))
elif state == 'NEGOTIATING':
info.ice_status = 'negotiating'
notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'})) notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'}))
def _NH_RTPStreamICENegotiationDidSucceed(self, notification): def _NH_RTPStreamICENegotiationDidSucceed(self, notification):
if notification.sender.type == 'audio': stream_info = self.info.streams[notification.sender.type]
info = self.info.streams.audio stream_info.ice_status = 'succeeded'
elif notification.sender.type == 'video': stream_info.local_rtp_candidate = notification.sender.local_rtp_candidate
info = self.info.streams.video stream_info.remote_rtp_candidate = notification.sender.remote_rtp_candidate
else:
raise RuntimeError('Unexpected stream type: %s' % notification.sender.type)
info.ice_status = 'succeeded'
info.local_rtp_candidate = notification.sender.local_rtp_candidate
info.remote_rtp_candidate = notification.sender.remote_rtp_candidate
notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'})) notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'}))
def _NH_RTPStreamICENegotiationDidFail(self, notification): def _NH_RTPStreamICENegotiationDidFail(self, notification):
if notification.sender.type == 'audio': stream_info = self.info.streams[notification.sender.type]
info = self.info.streams.audio stream_info.ice_status = 'failed'
elif notification.sender.type == 'video':
info = self.info.streams.video
else:
raise RuntimeError('Unexpected stream type: %s' % notification.sender.type)
info.ice_status = 'failed'
notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'})) notification.center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media'}))
def _NH_AudioStreamGotDTMF(self, notification): def _NH_AudioStreamGotDTMF(self, notification):
......
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