Commit Graph

221 Commits (574dc5b65ac72da28e2ef931598073a11e164f05)

Author SHA1 Message Date
Ansariel 574dc5b65a Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm 2025-10-31 19:25:58 +01:00
minerjr 9ee2595ac1 Reduced the time_mutx lock to 1 second from 3 seconds
Originally setup with 3 second as a was not sure how long it would take to recover, but 1 second should be good to recover and enumerate devices.
2025-10-29 21:39:57 -03:00
minerjr b37a210e38 Fixed up the i prefix to g to follow coding standards
Changed iWebRTCUpdateDevices and iAudioDeviceMutex to gWebRTCUpdateDevicesand gAudioDeviceMutex to follow Firestorm coding standards.

They are global static variables.
2025-10-29 15:37:55 -03:00
minerjr f6ce46c726 Fixed up not python operator to proper C++ operator
Fixed up the follow Firestorm coding standards.
2025-10-29 15:21:51 -03:00
Ansariel 1002a28e39 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm 2025-10-29 19:16:44 +01:00
minerjr 6ad9a57c39 FIRE-36022 - Removing my USB headset crashes entire viewer - audio device mutex
As with the previous change, this is to address the issue FIRE-36022 where users who remove their USB headsets with microphones are having the viewer lock up.

This introduces a new inline mutex called iAudioDeviceMutex. This is stored in a shared header file located on llcommon. iAudioDeviceMutex is a timed_mutex which allows for a time limit to be placed on a wait for a lock. Once the time runs out or the lock is achiveved the code moves on. With a check after the lock, if the owner is the current thread, then the lock was successful, otherwise it's still being used by another thread and the function should exit to try again later on.

This logic is wrapping WebRTC, FMOD and Vinvox calls to the audio hardware by the Viewer. OpenAL does not currently support changing of audio hardware and always defaults to the default audio hardware.

Added exceptions handling for the new unique_lock with the timed_mutex as they can throw 2 exceptions if the thread is already locked by the current thread and if the mutex is invalid.

Further testing may reveal other areas which would need the timed_mutex added to protect from threads locking up.
2025-10-28 23:22:13 -03:00
minerjr 0cdae450d8 FIRE-36022- Removing my USB headset crashes entire viewer - WebRTC fix
This is created to address the issue of USB headsets being removed or Bluetooth headsets with bad connections causing the viewer to lock up.

First Part: WebRTC

WebRTC now has an added inline atomic bool used to track when the worker thread is accessing the audio hardware. If the coroutine that is always running detects 10 consecutive true flag values, it will set WebRTC to exit and exit itself.

This coroutine was what was locking up the viewer as it spammed the mMainQueue with messages every update, but the worker thread was locked up and unable to receive the messages. Once the queue reached 1024 messages, it would lock up.

Underlying issue is the Windows Core Audio driver system crashes if too many threads have requests to get audio updates upon hardware changes. And with a USB headset having 2 devices in 1, it multiples the updates by 2x. The WebRTC audio system itself locks a mutex as it calls the core audio system to get set the input, but if it is already being processed by another thread, it then gets an exception to try again. The audio driver is not handling the message and crashes and does not return leaving the WebRTC worker thread locked.
2025-10-28 23:05:53 -03: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 06e8393846 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm 2025-10-16 22:48:43 +02:00
Andrey Kleshchev dc54661b3a #4819 WebRTC crashes after a failed login 2025-10-14 10:04:56 +02:00
Andrey Kleshchev ee43165bad #4695 Fix device update causing a crash 2025-10-12 16:35:11 +10:00
Andrey Kleshchev 5a8dfe2d19 #4691 Log WebRTC termination
for diagnostic purposes
2025-10-12 16:34:35 +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
Ansariel 3717122cb9 Merge branch 'release/2025.07' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/llappviewer.cpp
2025-09-23 10:01:04 +02:00
Andrey Kleshchev 1d9f87df4f #4695 Fix device update causing a crash 2025-09-22 22:02:45 +03:00
Andrey Kleshchev bf0f60039b #4691 Log WebRTC termination
for diagnostic purposes
2025-09-17 17:54:35 +03:00
Ansariel 5fdef7863e Merge branch 'release/2025.07' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/skins/default/xui/en/menu_inventory.xml
2025-09-16 18:33:02 +02: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 efe97b9940 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm
# Conflicts:
#	indra/cmake/00-Common.cmake
#	scripts/packages-formatter.py
2025-09-09 19:52:09 +02:00
PanteraPolnocy 7766a98d11 Add a switch to not connect to neighbouring regions
- An experimental and not officially supported function (therefore not exposed in preferences), may or may not stay in the source; Potentially addresses FIRE-2325 and its duplicates
- Prevents the viewer from connecting to neighbouring regions. When enabled, only the current region (login/teleport destination) is connected, while adjacent simulators are ignored. This effectively isolates the region, similar to how private estates behave.
- This may improve performance for users with weaker computers or slower connections, reduce unintended neighbour interactions, and assist multi-region event setups by lowering client overhead. It can also be useful for residents who prefer not to see or interact with neighbouring land.
- Limitations: region crossings will not function normally, as neighbouring regions are not visible or connected. Only direct teleports and logins to regions will work reliably. The sense of world scale and continuity is reduced, and travellers or explorers may find it unsuitable.
- TO-DO: Detect when avatar is crossing by foot/vehicle and load only that one region?
- I was not able to find an equivalent of WebRTC's updateNeighboringRegions() in Vivox code; updatePosition() is not that helpful, and channelFromRegion() seems to be detached?
2025-09-06 14:46:38 +02:00
Ansariel b99cf9fb86 Merge branch 'project/mac_universal' of https://github.com/secondlife/viewer
# Conflicts:
#	autobuild.xml
#	indra/cmake/00-Common.cmake
#	indra/cmake/APR.cmake
#	indra/cmake/Audio.cmake
#	indra/cmake/Boost.cmake
#	indra/cmake/Copy3rdPartyLibs.cmake
#	indra/cmake/LLKDU.cmake
#	indra/cmake/LLPrimitive.cmake
#	indra/cmake/Meshoptimizer.cmake
#	indra/cmake/NGHTTP2.cmake
#	indra/cmake/OPENAL.cmake
#	indra/llaudio/llvorbisencode.cpp
#	indra/llcommon/linden_common.h
#	indra/llcommon/llcommon.cpp
#	indra/llcommon/llfasttimer.cpp
#	indra/llcommon/llfasttimer.h
#	indra/llcommon/llfile.cpp
#	indra/llcommon/llmemory.h
#	indra/llcommon/llprofiler.h
#	indra/llcommon/llthreadsafequeue.h
#	indra/llfilesystem/lldir_win32.cpp
#	indra/llkdu/llimagej2ckdu.cpp
#	indra/llkdu/llimagej2ckdu.h
#	indra/llkdu/llkdumem.h
#	indra/llplugin/slplugin/CMakeLists.txt
#	indra/llrender/llfontfreetype.cpp
#	indra/llrender/llfontfreetype.h
#	indra/llwindow/CMakeLists.txt
#	indra/llwindow/llopenglview-objc.mm
#	indra/llwindow/llwindowmacosx-objc.h
#	indra/llwindow/llwindowwin32.cpp
#	indra/media_plugins/cef/CMakeLists.txt
#	indra/newview/CMakeLists.txt
#	indra/newview/llappviewer.cpp
#	indra/newview/llface.cpp
#	indra/newview/pipeline.cpp
#	indra/newview/viewer_manifest.py
2025-09-05 14:55:37 +02:00
Rye ba30737d8f Merge branch 'develop' of github.com:secondlife/viewer into rye/infinitemac 2025-08-20 18:04:55 -04:00
Ansariel 6491cb0307 Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm-202506 2025-08-14 20:08:01 +02:00
Andrey Kleshchev 6f072c2121
Merge 2025.06 into develop
Merge 2025.06 into develop
2025-08-14 11:17:35 +03: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
Ansariel 440c7f214e Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm 2025-08-13 20:31:56 +02:00
Ansariel b0b8328c5c Merge branch 'develop' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/llrender/llrendertarget.cpp
#	indra/newview/gltf/asset.cpp
#	indra/newview/llagentcamera.cpp
#	indra/newview/lldrawpoolwater.cpp
#	indra/newview/llstartup.cpp
#	indra/newview/llviewertexture.cpp
#	indra/newview/llvoavatar.cpp
#	indra/newview/llvoicewebrtc.cpp
#	indra/newview/viewer_manifest.py
2025-08-12 22:50:51 +02:00
Roxie Linden f7f06063c7 Fix issue where p2p calls were coming up muted even thought the UI said they were not. 2025-08-12 20:32:09 +03:00
Ansariel b9559762bc Merge branch 'master' of https://github.com/FirestormViewer/phoenix-firestorm 2025-08-12 18:31:29 +02:00
Ansariel f03cd219a9 Fix clang compiler issues due to unused variables 2025-08-12 14:09:53 +00:00
Beq ebc2679892 More set but not used avoidance 2025-08-10 16:37:04 +01: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 355a80ab91 Merge branch 'develop' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/llimagej2coj/llimagej2coj.cpp
#	indra/newview/llfloaterworldmap.cpp
#	indra/newview/llfloaterworldmap.h
#	indra/newview/llviewertexturelist.cpp
#	indra/newview/skins/default/xui/en/floater_world_map.xml
2025-05-23 13:13:24 +02:00
Seth Alves 4cff6997a1 reuse region variable instead of multiple calls to gAgent.getRegion() 2025-05-09 09:54:47 -07:00
Seth Alves be0fff8121 adjust which webrtc tracks are enabled when the avatar crosses a region border 2025-05-09 09:14:46 -07:00
Jonathan "Geenz" Goodman 52cca995cc Merge branch 'release/2025.04' into rye/forevermac 2025-04-15 13:55:01 -04:00
Ansariel 1243de5d84 Merge branch 'release/2025.03' of https://github.com/secondlife/viewer 2025-04-03 23:08:03 +02:00
Andrey Kleshchev 6ac1d4f3e3 #3829 WebRTC crash OnDataReceivedImpl 2025-03-27 21:29:31 +02:00
minerjr b47d3c3ef5 Fix float typos
There were five files which had float values assigned which were missing the "f" on them so they are in fact a doubles.
These get treated as errors when you change the floating point compile options from Fast to Precise or Strict as the fast path turns them from doubles to floats and suppresses the warnings.
2025-03-22 19:15:03 -03:00
Ansariel 5bf1f485f3 Merge branch 'release/2024.12-ForeverFPS' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/llcommon/llqueuedthread.cpp
2025-02-13 21:24:29 +01:00
Andrey Lihatskiy ddbe1ff981 Fix xcode16 build errors 2025-02-13 17:30:08 +02:00
Rye 635c34a17b Fix build with C++20 including nat's changes to fsyspath 2025-02-11 05:04:04 -05:00
Ansariel 7e7e19ee35 Merge branch 'release/2024.12-ForeverFPS' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/llinventorymodel.h
#	indra/newview/llviewertexturelist.cpp
#	indra/newview/llvoiceclient.cpp
#	indra/newview/pipeline.cpp
2025-02-07 19:38:29 +01:00
Maxim Nikolenko 1924241f04
viewer-private#375 add more logging in attempt to get more info 2025-02-07 19:00:20 +02:00
Ansariel 8ed4989c34 Merge branch 'release/2024.09-ExtraFPS' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/llvoicevivox.cpp
2024-11-07 18:02:38 +01:00
Andrey Kleshchev 0114be2c15 viewer#2985 Odd crash when notifying voice observers
Crash points at enableDisableCallBtn, but button's floater was cleaned
earlier and has a removeObserver call so an observer record should be
long gone. Likely something else is going on.
Went over various callbacks and made sure they are cleaned. But in case
floater somehow remained, added mSession = nullptr.
2024-11-01 17:54:05 +02:00
Ansariel 193fb1627f Merge branch 'develop' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/newview/llappviewer.cpp
#	indra/newview/llviewerdisplay.cpp
#	indra/newview/llviewermedia.cpp
2024-09-19 23:04:19 +02:00
Roxie Linden 743a1a6d8e fix trailing whitespace 2024-09-18 14:14:26 -07:00