summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2023-04-03 22:19:33 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2023-04-04 19:44:07 +0200
commitba8bcf6520eb4cbcdf93393ecdeda4e6c0bc5846 (patch)
tree68b904783dfe614186903ac400f575f533d02d6a /indra/newview
parentc7053a6928fd5eafdc935453742e92951ae4e0c1 (diff)
SL-19042: Replace FMOD with VLC for parcel audio
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/cmd_line.xml6
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llstartup.cpp27
-rw-r--r--indra/newview/llvieweraudio.cpp38
4 files changed, 50 insertions, 32 deletions
diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml
index e16a5c7e76..340334aee8 100644
--- a/indra/newview/app_settings/cmd_line.xml
+++ b/indra/newview/app_settings/cmd_line.xml
@@ -209,6 +209,12 @@
<string>NoAudio</string>
</map>
+ <key>nofmod</key>
+ <map>
+ <key>map-to</key>
+ <string>UseMediaPluginsForStreamingAudio</string>
+ </map>
+
<key>noninteractive</key>
<map>
<key>desc</key>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 411f77e6a7..c6dca39c99 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7077,6 +7077,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>UseMediaPluginsForStreamingAudio</key>
+ <map>
+ <key>Comment</key>
+ <string>Use media plugins (VLC) for streaming audio.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>NoHardwareProbe</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 6883ead5ee..9cebce2609 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -660,9 +660,22 @@ bool idle_startup()
#else
void* window_handle = NULL;
#endif
- bool init = gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle());
- if(init)
+ if (gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle()))
{
+ if (FALSE == gSavedSettings.getBOOL("UseMediaPluginsForStreamingAudio"))
+ {
+ LL_INFOS("AppInit") << "Using default impl to render streaming audio" << LL_ENDL;
+ gAudiop->setStreamingAudioImpl(gAudiop->createDefaultStreamingAudioImpl());
+ }
+
+ // if the audio engine hasn't set up its own preferred handler for streaming audio
+ // then set up the generic streaming audio implementation which uses media plugins
+ if (NULL == gAudiop->getStreamingAudioImpl())
+ {
+ LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
+ gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
+ }
+
gAudiop->setMuted(TRUE);
}
else
@@ -671,16 +684,6 @@ bool idle_startup()
delete gAudiop;
gAudiop = NULL;
}
-
- if (gAudiop)
- {
- // if the audio engine hasn't set up its own preferred handler for streaming audio then set up the generic streaming audio implementation which uses media plugins
- if (NULL == gAudiop->getStreamingAudioImpl())
- {
- LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
- gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
- }
- }
}
}
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index cc73f7ca80..6a0edbecb1 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -91,17 +91,18 @@ void LLViewerAudio::startInternetStreamWithAutoFade(const std::string &streamURI
return;
}
- // Record the URI we are going to be switching to
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
+ // Record the URI we are going to be switching to
mNextStreamURI = streamURI;
switch (mFadeState)
{
case FADE_IDLE:
- if (!gAudiop)
- {
- LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
- break;
- }
// If a stream is playing fade it out first
if (!gAudiop->getInternetStreamURL().empty())
{
@@ -114,28 +115,28 @@ void LLViewerAudio::startInternetStreamWithAutoFade(const std::string &streamURI
mFadeState = FADE_IN;
LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
- if(stream && stream->supportsAdjustableBufferSizes())
- stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize"));
+ if (stream && stream->supportsAdjustableBufferSizes())
+ stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"), gSavedSettings.getU32("FMODExDecodeBufferSize"));
gAudiop->startInternetStream(mNextStreamURI);
- startFading();
- registerIdleListener();
- break;
}
+ startFading();
+ break;
+
case FADE_OUT:
startFading();
- registerIdleListener();
break;
case FADE_IN:
- registerIdleListener();
break;
default:
LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
- break;
+ return;
}
+
+ registerIdleListener();
}
// A return of false from onIdleUpdate means it will be called again next idle update.
@@ -236,15 +237,12 @@ void LLViewerAudio::startFading()
// This minimum fade time prevents divide by zero and negative times
const F32 AUDIO_MUSIC_MINIMUM_FADE_TIME = 0.01f;
- if(mDone)
+ if (mDone)
{
// The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not,
// rather than check for both states assume a fade in and check for the fade out case.
- mFadeTime = AUDIO_MUSIC_FADE_IN_TIME;
- if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
- {
- mFadeTime = AUDIO_MUSIC_FADE_OUT_TIME;
- }
+ mFadeTime = LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT ?
+ AUDIO_MUSIC_FADE_OUT_TIME : AUDIO_MUSIC_FADE_IN_TIME;
// Prevent invalid fade time
mFadeTime = llmax(mFadeTime, AUDIO_MUSIC_MINIMUM_FADE_TIME);