From ec0f2b831eab0694e333f8defb795a986f921a55 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 18 Oct 2010 15:33:08 -0700
Subject: STORM-406: Fix for fmod inclusion in llaudio cmake

---
 indra/llaudio/CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt
index e869b9717c..21ec622819 100644
--- a/indra/llaudio/CMakeLists.txt
+++ b/indra/llaudio/CMakeLists.txt
@@ -14,7 +14,6 @@ include(LLVFS)
 
 include_directories(
     ${LLAUDIO_INCLUDE_DIRS}
-    ${FMOD_INCLUDE_DIR}
     ${LLCOMMON_INCLUDE_DIRS}
     ${LLMATH_INCLUDE_DIRS}
     ${LLMESSAGE_INCLUDE_DIRS}
@@ -45,6 +44,10 @@ set(llaudio_HEADER_FILES
     )
 
 if (FMOD)
+    include_directories(
+        ${FMOD_INCLUDE_DIR}
+        )
+
     list(APPEND llaudio_SOURCE_FILES
          llaudioengine_fmod.cpp
          lllistener_fmod.cpp
-- 
cgit v1.2.3


From 158bfc563b018ba4e0068ff4202f6d2ad1001aa1 Mon Sep 17 00:00:00 2001
From: Andrew Productengine <adyukov@productengine.com>
Date: Mon, 25 Oct 2010 18:56:04 +0300
Subject: STORM-95 FIXED Fixed hanging of client when incorrect WAV file was
 passed.

As Aimee has found: "The data chunk of nexfire.wav has an incorrect length specified in its header which we blindly trust when reading
the file in check_for_invalid_wav_formats() in llvorbisencode.cpp. It causes an overflow of the file position pointer when reading the file which makes
it start over from the beginning, hanging it in an infinite loop."

- To avoid this situation in future, check for chunk size was added, and if it is declared bigger then it may be, function is interrupted and returns error.
---
 indra/llaudio/llvorbisencode.cpp | 7 +++++++
 indra/llaudio/llvorbisencode.h   | 1 +
 2 files changed, 8 insertions(+)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp
index 9f479189d7..0e0c80a456 100644
--- a/indra/llaudio/llvorbisencode.cpp
+++ b/indra/llaudio/llvorbisencode.cpp
@@ -120,6 +120,13 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
 			+ ((U32) wav_header[5] << 8) 
 			+ wav_header[4];
 
+		if (chunk_length > physical_file_size - file_pos - 4)
+		{
+			infile.close();
+			error_msg = "SoundFileInvalidChunkSize";
+			return(LLVORBISENC_CHUNK_SIZE_ERR);
+		}
+
 //		llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl;
 
 		if (!(strncmp((char *)&(wav_header[0]),"fmt ",4)))
diff --git a/indra/llaudio/llvorbisencode.h b/indra/llaudio/llvorbisencode.h
index d33aacf1ea..6b22a2cb59 100644
--- a/indra/llaudio/llvorbisencode.h
+++ b/indra/llaudio/llvorbisencode.h
@@ -38,6 +38,7 @@ const S32 LLVORBISENC_MULTICHANNEL_ERR             = 7; // can't do stereo
 const S32 LLVORBISENC_UNSUPPORTED_SAMPLE_RATE      = 8; // unsupported sample rate
 const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE        = 9; // unsupported word size
 const S32 LLVORBISENC_CLIP_TOO_LONG                = 10; // source file is too long
+const S32 LLVORBISENC_CHUNK_SIZE_ERR               = 11; // chunk size is wrong
 
 const F32 LLVORBIS_CLIP_MAX_TIME                               = 10.0f;
 const U8  LLVORBIS_CLIP_MAX_CHANNELS                   = 2;
-- 
cgit v1.2.3


From 44a6e5da2c76b16bb70a93ba9952bc338dce2e89 Mon Sep 17 00:00:00 2001
From: Andrew Productengine <adyukov@productengine.com>
Date: Mon, 22 Nov 2010 17:26:39 +0200
Subject: STORM-521 FIXED Made defensive fix for crash in
 LLAudioSource::hasPendingPreloads().

Couldn't reproduce the crash, but made defensive fix. Added check for NULL into for loop that iterates through mPreloadMap in LLAudioSource::hasPendingPreloads(). Such check is already present in similar situation in LLAudioEngine::startNextTransfer().
---
 indra/llaudio/llaudioengine.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 1cc03bddb8..c9cb1cd6e7 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -1557,6 +1557,10 @@ bool LLAudioSource::hasPendingPreloads() const
 		LLAudioData *adp = iter->second;
 		// note: a bad UUID will forever be !hasDecodedData()
 		// but also !hasValidData(), hence the check for hasValidData()
+		if (!adp)
+		{
+			continue;
+		}
 		if (!adp->hasDecodedData() && adp->hasValidData())
 		{
 			// This source is still waiting for a preload
-- 
cgit v1.2.3


From c53ce73469a1cbb25e72511a8a2e23b7bfe4dfb8 Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Thu, 6 Jan 2011 16:53:31 -0500
Subject: STORM-830 Volume slider isn't properly remembered if set to zero
 There is an edge case in setMasterGain during startup which prevents
 setInternalGain from being called if the master volume setting and
 mInternalGain both equal 0. In llaudioengine.cpp setting mInternalGain to a
 very low but non-zero value fixes this issue.

---
 indra/llaudio/llaudioengine.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index c9cb1cd6e7..8baba79f59 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -97,7 +97,10 @@ void LLAudioEngine::setDefaults()
 	}
 
 	mMasterGain = 1.f;
-	mInternalGain = 0.f;
+	// Setting mInternalGain to a very low but non-zero value fixes the issue reported in STORM-830.
+	// There is an edge case in setMasterGain during startup which prevents setInternalGain from 
+	// being called if the master volume setting and mInternalGain both equal 0.
+	mInternalGain = 0.0000000001f;
 	mNextWindUpdate = 0.f;
 
 	mStreamingAudioImpl = NULL;
-- 
cgit v1.2.3


From d67f04da83c11707f2c4214b94c24d9cd12a16b6 Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Mon, 10 Jan 2011 17:24:34 -0500
Subject: STORM-830 Per Aleric's and Q's suggestion set initial value of
 mInternalGain to -1

---
 indra/llaudio/llaudioengine.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 8baba79f59..5e540ad8c5 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -97,10 +97,11 @@ void LLAudioEngine::setDefaults()
 	}
 
 	mMasterGain = 1.f;
-	// Setting mInternalGain to a very low but non-zero value fixes the issue reported in STORM-830.
+	// Setting mInternalGain to an out of range value fixes the issue reported in STORM-830.
 	// There is an edge case in setMasterGain during startup which prevents setInternalGain from 
-	// being called if the master volume setting and mInternalGain both equal 0.
-	mInternalGain = 0.0000000001f;
+	// being called if the master volume setting and mInternalGain both equal 0, so using -1 forces
+	// the if statement in setMasterGain to execute when the viewer starts up.
+	mInternalGain = -1.f;
 	mNextWindUpdate = 0.f;
 
 	mStreamingAudioImpl = NULL;
-- 
cgit v1.2.3


From 738c7546087b5c5fa049be0563623221ef5716c6 Mon Sep 17 00:00:00 2001
From: Alain Linden <alain@lindenlab.com>
Date: Fri, 14 Jan 2011 09:03:22 -0800
Subject: windows autobuildibatized (bye bye install.py...)

---
 indra/llaudio/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt
index 21ec622819..632e5d46e3 100644
--- a/indra/llaudio/CMakeLists.txt
+++ b/indra/llaudio/CMakeLists.txt
@@ -24,6 +24,7 @@ include_directories(
     ${VORBIS_INCLUDE_DIRS}
     ${OPENAL_LIB_INCLUDE_DIRS}
     ${FREEAULT_LIB_INCLUDE_DIRS}
+    ${FMOD_INCLUDE_DIR}
     )
 
 set(llaudio_SOURCE_FILES
-- 
cgit v1.2.3


From 88f507f9ccae33a3fa9b3706a96af5c87db804b5 Mon Sep 17 00:00:00 2001
From: Alain Linden <alain@lindenlab.com>
Date: Tue, 1 Mar 2011 15:32:35 -0800
Subject: fixes to get openal working on windows.

---
 indra/llaudio/llaudioengine_openal.cpp | 2 ++
 indra/llaudio/llaudioengine_openal.h   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp
index e352045291..34a057dcc0 100644
--- a/indra/llaudio/llaudioengine_openal.cpp
+++ b/indra/llaudio/llaudioengine_openal.cpp
@@ -32,6 +32,8 @@
 #include "lllistener_openal.h"
 
 
+const float LLAudioEngine_OpenAL::WIND_BUFFER_SIZE_SEC = 0.05f;
+
 LLAudioEngine_OpenAL::LLAudioEngine_OpenAL()
 	:
 	mWindGen(NULL),
diff --git a/indra/llaudio/llaudioengine_openal.h b/indra/llaudio/llaudioengine_openal.h
index 258febb1a8..6639d9dfe6 100644
--- a/indra/llaudio/llaudioengine_openal.h
+++ b/indra/llaudio/llaudioengine_openal.h
@@ -67,7 +67,7 @@ class LLAudioEngine_OpenAL : public LLAudioEngine
         int mNumEmptyWindALBuffers;
 
     	static const int MAX_NUM_WIND_BUFFERS = 80;
-    	static const float WIND_BUFFER_SIZE_SEC = 0.05f; // 1/20th sec
+    	static const float WIND_BUFFER_SIZE_SEC; // 1/20th sec
 };
 
 class LLAudioChannelOpenAL : public LLAudioChannel
-- 
cgit v1.2.3


From 12c2fd2ef051ca922f0d3076bc8160820980b6e2 Mon Sep 17 00:00:00 2001
From: "Andrew A. de Laix" <alain@lindenlab.com>
Date: Mon, 7 Mar 2011 14:23:09 -0800
Subject: update ogg-vorbis archive usage for darwin.

---
 indra/llaudio/llaudiodecodemgr.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 01dfd03c18..84105ddfca 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -680,4 +680,10 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
 	return FALSE;
 }
 
-
+#ifdef LL_DARWIN
+// HACK: to fool the compiler into not emitting unused warnings.
+namespace {
+	const ov_callbacks callback_array[4] = {OV_CALLBACKS_DEFAULT, OV_CALLBACKS_NOCLOSE, OV_CALLBACKS_STREAMONLY, 
+		OV_CALLBACKS_STREAMONLY_NOCLOSE};
+}
+#endif
-- 
cgit v1.2.3


From ec0c28ad8383dd6b342a317d15d44015fde15416 Mon Sep 17 00:00:00 2001
From: Andrew de Laix <alain@lindenlab.com>
Date: Mon, 14 Mar 2011 20:24:55 +0000
Subject: update ogg-vorbis archive for linux.

---
 indra/llaudio/llaudiodecodemgr.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/llaudio')

diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 84105ddfca..f0b44f97d2 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -680,7 +680,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
 	return FALSE;
 }
 
-#ifdef LL_DARWIN
+#if LL_DARWIN || LL_LINUX
 // HACK: to fool the compiler into not emitting unused warnings.
 namespace {
 	const ov_callbacks callback_array[4] = {OV_CALLBACKS_DEFAULT, OV_CALLBACKS_NOCLOSE, OV_CALLBACKS_STREAMONLY, 
-- 
cgit v1.2.3