Commit db133a5a authored by Saul Ibarra's avatar Saul Ibarra

Simplified code

parent eab9fc19
...@@ -629,16 +629,7 @@ class BlinkSession(QObject): ...@@ -629,16 +629,7 @@ class BlinkSession(QObject):
self.lookup.lookup_sip_proxy(uri, settings.sip.transport_list) self.lookup.lookup_sip_proxy(uri, settings.sip.transport_list)
def add_stream(self, stream_description): def add_stream(self, stream_description):
assert self.state == 'connected' self.add_streams([stream_description])
if stream_description.type in self.streams:
raise RuntimeError('session already has a stream of type %s' % stream_description.type)
self.info.streams[stream_description.type]._reset()
stream = stream_description.create_stream()
self.sip_session.add_stream(stream)
self.streams.add(stream)
notification_center = NotificationCenter()
notification_center.post_notification('BlinkSessionWillAddStream', sender=self, data=NotificationData(stream=stream))
notification_center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media', 'statistics'}))
def add_streams(self, stream_descriptions): def add_streams(self, stream_descriptions):
assert self.state == 'connected' assert self.state == 'connected'
...@@ -655,12 +646,7 @@ class BlinkSession(QObject): ...@@ -655,12 +646,7 @@ class BlinkSession(QObject):
notification_center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media', 'statistics'})) notification_center.post_notification('BlinkSessionInfoUpdated', sender=self, data=NotificationData(elements={'media', 'statistics'}))
def remove_stream(self, stream): def remove_stream(self, stream):
assert self.state == 'connected' self.remove_streams([stream])
if stream not in self.streams:
raise RuntimeError('stream is not part of the current session')
self.sip_session.remove_stream(stream)
notification_center = NotificationCenter()
notification_center.post_notification('BlinkSessionWillRemoveStream', sender=self, data=NotificationData(stream=stream))
def remove_streams(self, streams): def remove_streams(self, streams):
assert self.state == 'connected' assert 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