[Jingle] Volume levels are saved, audio UI shows up even if there are errors, until the session ends
This commit is contained in:
parent
a9d9196050
commit
e3f16c6371
|
@ -1550,9 +1550,17 @@ class ChatControl(ChatControlBase):
|
||||||
self._update_jingle('audio')
|
self._update_jingle('audio')
|
||||||
vbox = self.xml.get_widget('audio_vbox')
|
vbox = self.xml.get_widget('audio_vbox')
|
||||||
if self.audio_state == self.JINGLE_STATE_CONNECTED:
|
if self.audio_state == self.JINGLE_STATE_CONNECTED:
|
||||||
|
# Set volume from config
|
||||||
|
input_vol = gajim.config.get('audio_input_volume')
|
||||||
|
output_vol = gajim.config.get('audio_output_volume')
|
||||||
|
input_vol = max(min(input_vol, 100), 0)
|
||||||
|
output_vol = max(min(output_vol, 100), 0)
|
||||||
|
self.xml.get_widget('mic_hscale').set_value(input_vol)
|
||||||
|
self.xml.get_widget('sound_hscale').set_value(output_vol)
|
||||||
|
# Show vbox
|
||||||
vbox.set_no_show_all(False)
|
vbox.set_no_show_all(False)
|
||||||
vbox.show_all()
|
vbox.show_all()
|
||||||
else:
|
elif not self.audio_sid:
|
||||||
vbox.set_no_show_all(True)
|
vbox.set_no_show_all(True)
|
||||||
vbox.hide()
|
vbox.hide()
|
||||||
|
|
||||||
|
@ -1632,9 +1640,17 @@ class ChatControl(ChatControlBase):
|
||||||
def on_mic_hscale_value_changed(self, widget):
|
def on_mic_hscale_value_changed(self, widget):
|
||||||
value = widget.get_value()
|
value = widget.get_value()
|
||||||
self._get_audio_content().set_mic_volume(value / 100)
|
self._get_audio_content().set_mic_volume(value / 100)
|
||||||
|
# Save volume to config
|
||||||
|
# FIXME: Putting it here is maybe not the right thing to do?
|
||||||
|
gajim.config.set('audio_input_volume', value)
|
||||||
|
|
||||||
|
|
||||||
def on_sound_hscale_value_changed(self, widget):
|
def on_sound_hscale_value_changed(self, widget):
|
||||||
pass
|
value = widget.get_value()
|
||||||
|
self._get_audio_content().set_out_volume(value / 100)
|
||||||
|
# Save volume to config
|
||||||
|
# FIXME: Putting it here is maybe not the right thing to do?
|
||||||
|
gajim.config.set('audio_output_volume', value)
|
||||||
|
|
||||||
def on_avatar_eventbox_enter_notify_event(self, widget, event):
|
def on_avatar_eventbox_enter_notify_event(self, widget, event):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -277,6 +277,8 @@ class Config:
|
||||||
'audio_output_device': [opt_str, 'autoaudiosink'],
|
'audio_output_device': [opt_str, 'autoaudiosink'],
|
||||||
'video_input_device': [opt_str, 'autovideosrc ! videoscale ! ffmpegcolorspace'],
|
'video_input_device': [opt_str, 'autovideosrc ! videoscale ! ffmpegcolorspace'],
|
||||||
'video_output_device': [opt_str, 'autovideosink'],
|
'video_output_device': [opt_str, 'autovideosink'],
|
||||||
|
'audio_input_volume': [opt_int, 50],
|
||||||
|
'audio_output_volume': [opt_int, 50],
|
||||||
'use_stun_server': [opt_bool, True, _('If True, Gajim will try to use a STUN server when using jingle. The one in "stun_server" option, or the one given by the jabber server.')],
|
'use_stun_server': [opt_bool, True, _('If True, Gajim will try to use a STUN server when using jingle. The one in "stun_server" option, or the one given by the jabber server.')],
|
||||||
'stun_server': [opt_str, '', _('STUN server to use when using jingle')],
|
'stun_server': [opt_str, '', _('STUN server to use when using jingle')],
|
||||||
'show_affiliation_in_groupchat': [opt_bool, True, _('If True, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')],
|
'show_affiliation_in_groupchat': [opt_bool, True, _('If True, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')],
|
||||||
|
|
|
@ -268,6 +268,12 @@ class JingleAudio(JingleRTPContent):
|
||||||
"""
|
"""
|
||||||
self.mic_volume.set_property('volume', vol)
|
self.mic_volume.set_property('volume', vol)
|
||||||
|
|
||||||
|
def set_out_volume(self, vol):
|
||||||
|
"""
|
||||||
|
vol must be between 0 ans 1
|
||||||
|
"""
|
||||||
|
self.out_volume.set_property('volume', vol)
|
||||||
|
|
||||||
def setup_stream(self):
|
def setup_stream(self):
|
||||||
JingleRTPContent.setup_stream(self)
|
JingleRTPContent.setup_stream(self)
|
||||||
|
|
||||||
|
@ -289,10 +295,10 @@ class JingleAudio(JingleRTPContent):
|
||||||
'%s ! audioconvert', _("audio input"))
|
'%s ! audioconvert', _("audio input"))
|
||||||
|
|
||||||
self.sink = self.make_bin_from_config('audio_output_device',
|
self.sink = self.make_bin_from_config('audio_output_device',
|
||||||
'audioconvert ! %s', _("audio output"))
|
'audioconvert ! volume name=gajim_out_vol ! %s', _("audio output"))
|
||||||
|
|
||||||
self.mic_volume = src_bin.get_by_name('gajim_vol')
|
self.mic_volume = src_bin.get_by_name('gajim_vol')
|
||||||
self.set_mic_volume(0)
|
self.out_volume = self.sink.get_by_name('gajim_out_vol')
|
||||||
|
|
||||||
# link gst elements
|
# link gst elements
|
||||||
self.pipeline.add(self.sink, src_bin)
|
self.pipeline.add(self.sink, src_bin)
|
||||||
|
|
|
@ -100,7 +100,7 @@ class JingleSession(object):
|
||||||
'security-info': [self.__ack], #TODO
|
'security-info': [self.__ack], #TODO
|
||||||
'session-accept': [self.__on_session_accept, self.__on_content_accept,
|
'session-accept': [self.__on_session_accept, self.__on_content_accept,
|
||||||
self.__broadcast, self.__ack],
|
self.__broadcast, self.__ack],
|
||||||
'session-info': [self.__on_session_info, self.__broadcast, self.__ack],
|
'session-info': [self.__broadcast, self.__on_session_info, self.__ack],
|
||||||
'session-initiate': [self.__on_session_initiate, self.__broadcast,
|
'session-initiate': [self.__on_session_initiate, self.__broadcast,
|
||||||
self.__ack],
|
self.__ack],
|
||||||
'session-terminate': [self.__on_session_terminate, self.__broadcast_all,
|
'session-terminate': [self.__on_session_terminate, self.__broadcast_all,
|
||||||
|
|
Loading…
Reference in New Issue