aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-07-14 01:59:21 -0700
committerMcCabe Maxsted2010-07-15 02:10:28 -0700
commit63209fe123241072961ef0344c11e5241be8f0ca (patch)
treedbc5dbcb62a7da4dfe097f0b820c955f1fe04b04 /linden/indra/llaudio
parentApplied SNOW-629 Fix: Leading zero missing from hour portion of timestamp fie... (diff)
downloadmeta-impy-63209fe123241072961ef0344c11e5241be8f0ca.zip
meta-impy-63209fe123241072961ef0344c11e5241be8f0ca.tar.gz
meta-impy-63209fe123241072961ef0344c11e5241be8f0ca.tar.bz2
meta-impy-63209fe123241072961ef0344c11e5241be8f0ca.tar.xz
Applied slviewer-0-v12350-StutteringAndLagInAudioEngine_v2.patch from Cool Viewer by Henri Beauchamp
Diffstat (limited to 'linden/indra/llaudio')
-rw-r--r--linden/indra/llaudio/audioengine.cpp34
-rw-r--r--linden/indra/llaudio/audioengine.h3
2 files changed, 31 insertions, 6 deletions
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp
index 5f1c060..7cec920 100644
--- a/linden/indra/llaudio/audioengine.cpp
+++ b/linden/indra/llaudio/audioengine.cpp
@@ -31,6 +31,8 @@
31 * $/LicenseInfo$ 31 * $/LicenseInfo$
32 */ 32 */
33 33
34#include <time.h>
35
34#include "linden_common.h" 36#include "linden_common.h"
35 37
36#include "audioengine.h" 38#include "audioengine.h"
@@ -430,7 +432,10 @@ void LLAudioEngine::idle(F32 max_decode_time)
430 else 432 else
431 { 433 {
432 channelp->setWaiting(false); 434 channelp->setWaiting(false);
433 channelp->play(); 435 if (channelp->mCurrentBufferp)
436 {
437 channelp->play();
438 }
434 } 439 }
435 } 440 }
436 } 441 }
@@ -632,7 +637,7 @@ bool LLAudioEngine::updateBufferForData(LLAudioData *adp, const LLUUID &audio_uu
632 { 637 {
633 if (adp->hasDecodedData()) 638 if (adp->hasDecodedData())
634 { 639 {
635 adp->load(); 640 return adp->load();
636 } 641 }
637 else if (adp->hasLocalData()) 642 else if (adp->hasLocalData())
638 { 643 {
@@ -667,6 +672,9 @@ void LLAudioEngine::enableWind(bool enable)
667 672
668LLAudioBuffer *LLAudioEngine::getFreeBuffer() 673LLAudioBuffer *LLAudioEngine::getFreeBuffer()
669{ 674{
675 static clock_t last_info = 0;
676 static bool spamming = FALSE;
677
670 S32 i; 678 S32 i;
671 for (i = 0; i < MAX_BUFFERS; i++) 679 for (i = 0; i < MAX_BUFFERS; i++)
672 { 680 {
@@ -698,8 +706,18 @@ LLAudioBuffer *LLAudioEngine::getFreeBuffer()
698 706
699 if (buffer_id >= 0) 707 if (buffer_id >= 0)
700 { 708 {
701 LL_INFOS("AudioEngine") << "Taking over unused buffer " << buffer_id << llendl; 709 if (clock() - last_info > CLOCKS_PER_SEC)
702 //LL_INFOS("AudioEngine") << "Flushing unused buffer!" << llendl; 710 {
711 // Do not spam us with such messages...
712 llinfos << "Taking over unused buffer " << buffer_id << llendl;
713 last_info = clock();
714 }
715 else if (!spamming)
716 {
717 // ... but warn us *once* when the buffer freeing frequency is abnormal.
718 llwarns << "Excessive buffer freeing frequency, info messages throttled." << llendl;
719 spamming = true;
720 }
703 mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL; 721 mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL;
704 delete mBuffers[buffer_id]; 722 delete mBuffers[buffer_id];
705 mBuffers[buffer_id] = createBuffer(); 723 mBuffers[buffer_id] = createBuffer();
@@ -1841,6 +1859,8 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
1841 1859
1842bool LLAudioData::load() 1860bool LLAudioData::load()
1843{ 1861{
1862 static clock_t last_info = 0;
1863
1844 // For now, just assume we're going to use one buffer per audiodata. 1864 // For now, just assume we're going to use one buffer per audiodata.
1845 if (mBufferp) 1865 if (mBufferp)
1846 { 1866 {
@@ -1853,7 +1873,11 @@ bool LLAudioData::load()
1853 if (!mBufferp) 1873 if (!mBufferp)
1854 { 1874 {
1855 // No free buffers, abort. 1875 // No free buffers, abort.
1856 llinfos << "Not able to allocate a new audio buffer, aborting." << llendl; 1876 if (clock() - last_info > CLOCKS_PER_SEC) // Do not spam us with such messages
1877 {
1878 llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
1879 last_info = clock();
1880 }
1857 return false; 1881 return false;
1858 } 1882 }
1859 1883
diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h
index 574ed95..e990eb7 100644
--- a/linden/indra/llaudio/audioengine.h
+++ b/linden/indra/llaudio/audioengine.h
@@ -58,7 +58,8 @@ const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;
58const F32 DEFAULT_MIN_DISTANCE = 2.0f; 58const F32 DEFAULT_MIN_DISTANCE = 2.0f;
59 59
60#define MAX_CHANNELS 30 60#define MAX_CHANNELS 30
61#define MAX_BUFFERS 40 // Some extra for preloading, maybe? 61// Number of maximum rezzed objects with sounds + sounds without an object + UI sounds.
62#define MAX_BUFFERS 100
62 63
63// This define is intended to allow us to switch from os based wav 64// This define is intended to allow us to switch from os based wav
64// file loading to vfs based wav file loading. The problem is that I 65// file loading to vfs based wav file loading. The problem is that I