Commit Graph

104 Commits (ced6a2469671d3847b2ec2b9d231d6cb1dc31b2b)

Author SHA1 Message Date
Ansariel ced6a24696 Merge branch 'release/2025.08' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/llviewermedia.cpp
#	indra/newview/llviewerwindow.cpp
2025-10-29 19:11:13 +01:00
Ansariel 3620dfdd35 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm 2025-10-29 18:40:12 +01:00
Roxanne Skelly 164912418c
Fix issue where mac was crashing during an attempt to unplug or replug microphone. (#4897)
The mac audio device manager was being "helpful" by restarting
playout and recording if the Default device was changed, assuming
the application wouldn't care.
However, we received an update of device change, and attempted to
stop and start playout anyway, causing a conflict.
The fix was simply to not deploy new devices when the device id didn't
change.
2025-10-28 13:03:25 -04:00
Ansariel 3410a182c5 initWebRTC() can get multiple times - make sure to unset previous observers before re-adding 2025-10-18 13:32:44 +02:00
Ansariel eadf33f100 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm-ll-master 2025-10-18 13:02:10 +02:00
Ansariel d733bef269 Restore original indentation 2025-10-18 12:42:20 +02:00
Ansariel 36217e7cb3 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm
# Conflicts:
#	autobuild.xml
#	indra/llwebrtc/llwebrtc.cpp
#	indra/llwebrtc/llwebrtc_impl.h
#	indra/newview/llvoicewebrtc.cpp
#	indra/newview/llvoicewebrtc.h
2025-10-18 12:33:24 +02:00
Ansariel 9fe6e65aed Continue keeping built-in audio effects disabled - only disable duplicate call to updateDevices() which is already called via
LLWebRTCVoiceClient::initWebRTC() -> LLWebRTCVoiceClient::refreshDeviceLists() -> LLWebRTCImpl::refreshDevices()

and duplicate to

LLWebRTCVoiceClient::initWebRTC() -> llwebrtc::init() -> LLWebRTCImpl::init()
2025-10-18 12:26:47 +02:00
minerjr 4a6975a944 FIRE-36022 - Removing my USB headset crashes entire viewer
Commented out a block of new code recently added which was also being called by one of the callback functions.
This had the side effect of having 2 LLWebRTCDevicesObserver listening to the hardware removal events and cause both to trigger events at the same time, which may be the source of the queue being locked up in a race condition.

Was able to reproduce issue 2x without code change by moving mouse around a lot while on  rezing and then pulling USB headset out of the USB port. Direct motherboard USB port seemed to work the best as could not trigger while headset was in USB hub.
2025-10-17 22:01:17 -03:00
Jonathan "Geenz" Goodman bbc2ad8fc5 Merge remote-tracking branch 'origin/main' into geenz/main-to-develop 2025-10-17 17:06:39 -04:00
Andrey Kleshchev dc54661b3a #4819 WebRTC crashes after a failed login 2025-10-14 10:04:56 +02:00
Andrey Kleshchev 57a9e51360 #4819 WebRTC crashes after a failed login 2025-10-13 21:19:24 +03:00
Andrey Kleshchev 0dcade5e1d #4695 Fix missing voice cleanup
Cleanup is in LLVoiceClient::terminate()
gWebRTCImpl was never deleted
Added mDeviceModule security
2025-10-12 16:34:56 +10:00
Roxanne Skelly 81c01ab5bc Fix indexing problem with mac devices (#4676)
* Fix indexing problem with mac devices

This resulted in the wrong device being selected.

Also, fix a shutdown crash where recording was not being stopped, hence the recording
thread was still running on shutdown and crashed because it lost access to resources.

Fix an issue with p2p calls where they're coming up muted even though the button indicates
they are unmuted.

* Always refresh device list on notification of device changes

Even when the selected device doesn't change, we need to
re-deploy it as it might have had characteristics (sampling rate, etc.) changed.

Also, we need to redeploy when the Default device has changed
2025-10-12 16:34:22 +10:00
Roxanne Skelly d070b996bd [WebRTC] Rework device handling sequence so that we can handle unplugging/re-plugging devices (#4593)
* [WebRTC] Rework device handling sequence so that we can handle unplugging/re-plugging devices

The device handling was not processing device updates in the proper sequence as
things like AEC use both input and output devices.  Devices like headsets are both
so unplugging them resulted in various mute conditions and sometimes even a crash.

Now, we update both capture and render devices at once in the proper sequence.

Test Guidance:
* Bring two users in the same place in webrtc regions.
* The 'listening' one should have a headset or something set oas 'Default'
* Press 'talk' on one, and verify the other can hear.
* Unplug the headset from the listening one.
* Validate that audio changes from the headset to the speakers.
* Plug the headset back in.
* Validate that audio changes from speakers to headset.
* Do the same type of test with the headset viewer talking.
* The microphone used should switch from the headset to the computer (it should have one)

Do other various device tests, such as setting devices explicitly, messing with the device selector, etc.

* Fix race condition when multiple change device requests might come in at once

* Update to m137

The primary feature of this commit is to update libwebrtc from m114
to m137.  This is needed to make webrtc buildable, as m114 is not buildable
by the current toolset.

m137 had some changes to the API, which required renaming or changing namespace
of some of the calls.

Additionally, this PR moves from a callback mechanism for gathering the energy
levels for tuning to a wrapper AudioDeviceModule, which gives us more control
over the audio stream.

Finally, the new m137-based webrtc has been updated to allow for 192khz audio
streams.

* Properly pass the observer setting into the inner audio device module

* Update to m137 and get rid of some noise

    This change updates to m137 from m114, which required a few API changes.

    Additionally, this fixes the hiss that happens shortly after someone unmutes: https://github.com/secondlife/server/issues/2094

    There was also an issue with a slight amount of repeated after unmuting if there was audio right before unmuting.  This is because
    the audio processing and buffering still had audio from the previous speaking session.  Now, we inject nearly a half second of
    silence into the audio buffers/processor after unmuting to flush things.

* Install nsis on windows

* Use the newer digital AGC pipeline

m137 improved the AGC pipeline and the existing analog style is going away
so move to the new digital pipeline.

Also, some tweaking for audio levels so that we don't see inworld bars when tuning,
so one's own bars seem a reasonable size, etc.

* Install NSIS during windows sisgning and package build step

* Try pinning the packaging to windows 2022 to deal with missing nsis

* Adjust gain calculation and audio level calculations for tuning and peer connections

* Update with mac universal webrtc build

* Tuning of voice indicators for both tuning mode and inworld for self.

* Redo device deployment to handle cases where multiple deploy requests pile up

Also, mute when leaving webrtc-enabled regions or parcels,
and unmute when voice comes back.

* pre commit issue
2025-10-12 16:32:18 +10:00
Andrey Kleshchev 400351f3b8 #4777 Fix crash on missing factory 2025-10-09 23:59:51 +03:00
Andrey Kleshchev d76d0c239c #4796 Preferences' mic volume slider had no effect. 2025-10-08 17:33:48 +03:00
Andrey Kleshchev f846861f04 #4777 Fix webrtc crashing in worker threads on shutdown 2025-10-03 19:07:00 +03:00
Andrey Kleshchev 3ff163887d #4695 Fix missing voice cleanup
Cleanup is in LLVoiceClient::terminate()
gWebRTCImpl was never deleted
Added mDeviceModule security
2025-09-20 00:32:04 +03:00
Roxanne Skelly c743ea2b6d
Fix indexing problem with mac devices (#4676)
* Fix indexing problem with mac devices

This resulted in the wrong device being selected.

Also, fix a shutdown crash where recording was not being stopped, hence the recording
thread was still running on shutdown and crashed because it lost access to resources.

Fix an issue with p2p calls where they're coming up muted even though the button indicates
they are unmuted.

* Always refresh device list on notification of device changes

Even when the selected device doesn't change, we need to
re-deploy it as it might have had characteristics (sampling rate, etc.) changed.

Also, we need to redeploy when the Default device has changed
2025-09-16 13:36:26 -04:00
Roxanne Skelly a6d4c1d394
[WebRTC] Rework device handling sequence so that we can handle unplugging/re-plugging devices (#4593)
* [WebRTC] Rework device handling sequence so that we can handle unplugging/re-plugging devices

The device handling was not processing device updates in the proper sequence as
things like AEC use both input and output devices.  Devices like headsets are both
so unplugging them resulted in various mute conditions and sometimes even a crash.

Now, we update both capture and render devices at once in the proper sequence.

Test Guidance:
* Bring two users in the same place in webrtc regions.
* The 'listening' one should have a headset or something set oas 'Default'
* Press 'talk' on one, and verify the other can hear.
* Unplug the headset from the listening one.
* Validate that audio changes from the headset to the speakers.
* Plug the headset back in.
* Validate that audio changes from speakers to headset.
* Do the same type of test with the headset viewer talking.
* The microphone used should switch from the headset to the computer (it should have one)

Do other various device tests, such as setting devices explicitly, messing with the device selector, etc.

* Fix race condition when multiple change device requests might come in at once

* Update to m137

The primary feature of this commit is to update libwebrtc from m114
to m137.  This is needed to make webrtc buildable, as m114 is not buildable
by the current toolset.

m137 had some changes to the API, which required renaming or changing namespace
of some of the calls.

Additionally, this PR moves from a callback mechanism for gathering the energy
levels for tuning to a wrapper AudioDeviceModule, which gives us more control
over the audio stream.

Finally, the new m137-based webrtc has been updated to allow for 192khz audio
streams.

* Properly pass the observer setting into the inner audio device module

* Update to m137 and get rid of some noise

    This change updates to m137 from m114, which required a few API changes.

    Additionally, this fixes the hiss that happens shortly after someone unmutes: https://github.com/secondlife/server/issues/2094

    There was also an issue with a slight amount of repeated after unmuting if there was audio right before unmuting.  This is because
    the audio processing and buffering still had audio from the previous speaking session.  Now, we inject nearly a half second of
    silence into the audio buffers/processor after unmuting to flush things.

* Install nsis on windows

* Use the newer digital AGC pipeline

m137 improved the AGC pipeline and the existing analog style is going away
so move to the new digital pipeline.

Also, some tweaking for audio levels so that we don't see inworld bars when tuning,
so one's own bars seem a reasonable size, etc.

* Install NSIS during windows sisgning and package build step

* Try pinning the packaging to windows 2022 to deal with missing nsis

* Adjust gain calculation and audio level calculations for tuning and peer connections

* Update with mac universal webrtc build

* Tuning of voice indicators for both tuning mode and inworld for self.

* Redo device deployment to handle cases where multiple deploy requests pile up

Also, mute when leaving webrtc-enabled regions or parcels,
and unmute when voice comes back.

* pre commit issue
2025-09-12 20:07:51 -04:00
Ansariel 478a51f8e3 Merge branch 'release/2025.06' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/llxml/llcontrol.cpp
#	indra/newview/llfloaterpreference.cpp
#	indra/newview/lllogchat.cpp
#	indra/newview/llreflectionmap.h
2025-08-13 20:52:47 +02:00
Roxie Linden bab2c12d04 Straighten out muting to prevent echo when crossing from vivox to webrtc regions.
Muting was a bit random in the code, so it's now been straightened out and should
prevent echo.

Also, code was added to not attempt connection to non-webrtc regions in the webrtc code.
2025-08-08 14:37:46 -07:00
Ansariel a4e8af0dce Merge branch 'develop' of https://github.com/secondlife/viewer
# Conflicts:
#	.github/pull_request_template.md
#	CONTRIBUTING.md
#	indra/newview/CMakeLists.txt
#	indra/newview/app_settings/settings.xml
#	indra/newview/llappviewer.cpp
#	indra/newview/llfloaterimagepreview.cpp
#	indra/newview/llfloatersettingsdebug.cpp
#	indra/newview/llfloatersettingsdebug.h
#	indra/newview/llstatusbar.cpp
#	indra/newview/llstatusbar.h
#	indra/newview/res/viewerRes.rc
#	indra/newview/skins/default/xui/de/panel_login_first.xml
#	indra/newview/skins/default/xui/en/notifications.xml
#	indra/newview/skins/default/xui/en/panel_login_first.xml
#	indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
#	indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
#	indra/newview/skins/default/xui/en/panel_status_bar.xml
#	indra/newview/skins/default/xui/es/panel_login_first.xml
#	indra/newview/skins/default/xui/fr/panel_login_first.xml
#	indra/newview/skins/default/xui/it/panel_login_first.xml
#	indra/newview/skins/default/xui/ja/panel_login_first.xml
#	indra/newview/skins/default/xui/pl/panel_login_first.xml
#	indra/newview/skins/default/xui/pt/panel_login_first.xml
#	indra/newview/skins/default/xui/ru/panel_login_first.xml
#	indra/newview/skins/default/xui/tr/panel_login_first.xml
#	indra/newview/skins/default/xui/zh/panel_login_first.xml
#	indra/newview/viewer_manifest.py
2025-07-30 10:52:39 +02:00
Andrey Kleshchev be04175579 #4358 Fix 'Microphone in use' task bar icon
1. set_enabled(false) failed to apply, force set it to trigger observers
and remove the icon
2. Don't set audio devices if voice was disabled
2025-07-16 20:05:23 +03:00
Ansariel 469795979f Merge branch 'release/2025.04' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/llinventorybridge.cpp
#	indra/newview/llmodelpreview.cpp
#	indra/newview/llpanelface.cpp
#	indra/newview/llviewercamera.cpp
#	indra/newview/llviewerregion.cpp
#	indra/newview/skins/default/colors.xml
2025-05-14 21:56:38 +02:00
Andrey Kleshchev edb0032c95 #3542 Microphone doesn't switch after plugging in an audio device 2025-05-10 10:11:53 +03:00
Beq 549dc802a8 Tentative fix for Linux WebRTC hang from Roxie. 2024-10-28 15:48:59 +00:00
Roxie Linden 28fdd6e786 Update webrtc to fix loss of stereo in bluetooth issue.
When transitioning from mic-on hands-free mode to mic off,
it's expected that the audio stream would return to stereo.
Inproper logic in the mac device code in webrtc was preventing
that.
2024-08-18 00:30:16 -07:00
Roxie Linden 63d17b395b Microphone was being prematurely enabled on login for a short period.
The microphone issue was causing a short moment of sound, and was
causing bluetooth headsets to switch to hands-free/one channel mode
which is disruptive.

Also, update webrtc to deal with issue where airpods were garbled
after coming out of hands-free mode.
2024-08-17 20:11:46 -07:00
Roxie Linden 2efad2182a Fixes to managing device start/stop playout/recording.
Fixes prevent attempting to start playout/recording before the devices
are set up, to prevent restarting playout/recording, to prevent
attempts to stop when not playing/recording, and so on...

This should address the case where audio device changes can cause
an assert.  It should also address the case where audio was unnecessarily played
or transmitted when connecting.

And, when voice is disabled, the audio devices are not set up to play/record
so there should be no disruption of bluetooth music from other apps.
2024-08-17 00:26:07 -07:00
Roxie Linden b9c222dfae Implement a Logging Sink for WebRTC
WebRTC logs now pass out of the webrtc library into a logging sink,
which converts them into SecondLife.log compatable logging calls.

This includes fatal errors and asserts, which are now logged into
SecondLife.log, and should be available in the crash logger.
2024-07-31 21:23:30 -06:00
Andrey Lihatskiy b746e78c78 Fix trailing whitespaces in webrtc code to pass pre-commit 2024-07-29 12:28:33 +03:00
Roxie Linden 34a2fd525f [WebRTC] control microphone gain via custom audio processor.
Previously, there were two places audio gain could be controlled:
- the device manager
- the audio track

The device manager audio gain control sets the system gain for all applications,
not just the webrtc application.

The audio track gain happens well after the audio processing where we want it to happen.

So, gain control was added to the existing custom audio processor, which previously only
handled calculating and retrieving the audio levels.

After these changes, the microphone gain slider does impact the audio volume heard by peers.
2024-06-24 14:42:30 -07:00
Roxie Linden ddbd1ab47e More session shutdown cleanup 2024-05-19 02:30:45 -07:00
Roxie Linden 2b275d43fb Clean up some shutdown code. 2024-05-17 13:27:45 -07:00
Roxie Linden c6e147ff22 Race condition resulted in close causing removal of peer connection while other jobs might be using it. 2024-05-16 12:00:45 -07:00
Roxie Linden 07c3095a78 Unregister requested data channel when using the negotiated one.
When creating a new connection, the viewer builds a data channel interface.
It then gets a new one, which is a proxy.  The viewer uses the new one,
and therefore must unregister the callbacks from the old one.

Also, update the position data before sending it after the join is sent.
2024-05-02 11:07:36 -07:00
Roxie Linden cf13866da9 Don't default the tracks to unmuted 2024-04-28 18:43:48 -07:00
Roxie Linden d4fce4990a Reconnects to the voice server weren't happening. 2024-04-28 17:43:15 -07:00
Roxie Linden 98322d5f07 Reconnect when parcel voice params change.
When parcel voice permissions and region/parcel-only voice
settings change, a callback will be made to the viewer with
new voice credential information.  For webrtc, this means
either just the uuid of the voice channel, or nothing if
voice is disabled.

This change looks at that callback and the channel id,
and sets the appropriate flags on the parcel/region as needed
which will cause voice to be renegotiated.

Also, there was a race condition if the voice connect attempt
was made before caps were retrieved, which would have resulted
in full renegotiate attempts.  Now, just wait until the cap
comes in and continue.
2024-04-21 21:12:06 -07:00
Roxie Linden 648741470f CR suggestions 2024-04-07 19:23:00 -07:00
Roxie Linden 34ed990fa3 Show 'decline' when peer declines p2p voice
The simulator will send a chatterbox notification that
voice is no longer in use for a given channel, and
the viewer should take that as a case where the peer
does not want voice, hence it's a decline.
2024-04-07 14:13:00 -07:00
Roxie Linden fdf0fbce5b oopse 2024-04-01 22:39:59 -07:00
Roxie Linden c826aea079 Fix "default" audio device handling.
Windows and Mac/Linux behave slightly differently with respect
to Default devices, in that mac/linux (I think) simply assumes
the device at index 0 is the default one, and windows has a
separate API for enabling the default device.
2024-04-01 21:39:17 -07:00
Roxie Linden c6e673cda1 Fix windows crashes
* sampling rate was set to 8khz for audio processing, which was
  causing a 'bands' mismatch with the echo cancler.

* Some funnybusiness with lambdas and captures and such was causing
  a heap crash with respect to function parameters.
2024-03-30 23:19:38 -07:00
Roxie Linden 567180508f Merge branch 'roxie/webrtc-voice' of https://github.com/secondlife/viewer into roxie/webrtc-voice 2024-03-30 22:03:59 -07:00
Roxie Linden b3bb3d2d51 Renegotiate on remote description error 2024-03-30 22:03:30 -07:00
Roxie Linden cdae5ebc16 Add UI for managing echo cancellation, AGC, and noise control.
Plumb audio settings through from webrtc to the sound preferences
UI (still needs some tweaking, of course.)

Also, choose stun servers based on grid.  Ultimately, the stun
stun servers will be passed up via login or something.
2024-03-30 21:58:00 -07:00
Roxie Linden e242c129f9 Add Tracy categories for WebRTC Voice
Also:
* Fix a few crashes.
* Only send position data when it changes.
2024-03-22 16:21:02 -07:00