Commit Graph

79 Commits (e935a8aebca4ae014b5f6b438612ac5674678fe6)

Author SHA1 Message Date
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
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
Andrey Kleshchev edb0032c95 #3542 Microphone doesn't switch after plugging in an audio device 2025-05-10 10:11:53 +03: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
Roxie Linden 4b709e7944 Turn procesIceUpdates into a coroutine to chop up the work a bit. 2024-03-20 11:15:12 -07:00
Roxie Linden 0e2fc4d35e Clear out observers when terminating a connection 2024-03-19 17:05:56 -07:00
Roxie Linden 5bc92b8031 Simplify workqueue calls. Fix issue with webrtc blocking on destruction. 2024-03-19 15:23:43 -07:00
Roxie Linden e4dee511ca Use LL::WorkQueue to handle transitions from llwebrtc threads to the main thread 2024-03-18 17:47:56 -07:00
Roxie Linden dbbbbc55af Refactor device selection logic
This refactor fixed a few bugs.  There is an annoying 'click' when
changing devices, however.  This will be addressed in the future.
2024-03-14 20:04:39 -07:00
Roxie Linden fc462b2b0f Remove trailing spaces. Other code cleanup. 2024-03-10 00:11:43 -08:00
Roxie Linden 7714850fbe code beautification/comments 2024-03-09 23:00:00 -08:00
Roxie Linden 70044b9d2b The response from the provision account call was being called twice for some reason 2024-03-05 18:57:22 -08:00
Roxie Linden 4057d38e96 coding cleanup 2024-02-22 23:25:27 -08:00
Roxie Linden 29b317db51 another rebase merge issue 2024-02-08 19:02:13 -08:00
Roxie Linden d8ebab0221 fix rebase issue 2024-02-08 18:48:36 -08:00
Roxie Linden 90efc71ef9 race between session established and data channel ready 2024-02-08 18:37:09 -08:00
Roxie Linden 49a1b4038f mac build fix 2024-02-08 18:37:09 -08:00
Roxie Linden dc1858a32a put observer-based tuning audio level calculation back 2024-02-08 18:37:09 -08:00
Roxie Linden 65b5a6e12d Use a custom audio processor to pull data for level determinations, which will happen after AGC 2024-02-08 18:37:09 -08:00
Roxie Linden 73b00bfe94 Handle 'device changed' callback 2024-02-08 18:35:55 -08:00
Roxie Linden 8ab0bb9a41 fix locking race condition 2024-02-08 18:35:55 -08:00
Roxie Linden 7246f55290 New WebRTC with echo cancellation fix.
Also, start/stop recording depending on whether WebRTC has negotiated.
2024-02-08 18:35:21 -08:00
Roxie Linden 23b065b0f1 Enable AEC 2024-02-08 18:34:02 -08:00
Roxie Linden a7509747b2 Touch up parcel voice enable/disable. 2024-02-08 18:34:02 -08:00
Roxie Linden a60593164e Better renegotiation support for parcel voice
Better handle starting up and shutting down WebRTC connections
simultaneously.
2024-02-08 18:34:02 -08:00
Roxie Linden e3b719f41e fix device selection (hopefully) 2024-02-08 18:34:02 -08:00
Roxie Linden c51309ac72 Rework VU meter level processing to be closer to Vivox 2024-02-08 18:34:02 -08:00
Roxie Linden e92e4d762e Mute using enable.
Muting using the device module microphone mute was muting other
applications, speakers, and so on.  Instead, we mute by enabling/disabling
the input and output streams.
2024-02-08 18:34:01 -08:00
Roxie Linden b10731f6f9 Setting volume for remote stream needs to happen in signaling thread 2024-02-08 18:34:01 -08:00