diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-05-24 15:11:46 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-05-24 15:11:46 +0100 |
commit | 0fc44d319fbc0e5865e0ca76b51b2f436b72ad87 (patch) | |
tree | 7afc2730257120763c4c70822d079e04e0bc6a40 /indra/newview | |
parent | 6bcac50f64a00b2bf6eaea13813276bf7c78af81 (diff) |
EXT-7335 WIP Clean up warnings when parsing Vivox timestamps.
Tidied up initialization of voice font expiry timers.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 6 |
2 files changed, 27 insertions, 20 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index c8402af5d1..070e4f0d2d 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6488,6 +6488,8 @@ LLVivoxVoiceClient::voiceFontEntry::voiceFontEntry(LLUUID& id) : mFontStatus(VOICE_FONT_STATUS_NONE), mIsNew(false) { + mExpiryTimer.stop(); + mExpiryWarningTimer.stop(); } LLVivoxVoiceClient::voiceFontEntry::~voiceFontEntry() @@ -6589,21 +6591,17 @@ void LLVivoxVoiceClient::addVoiceFont(const S32 font_index, font->mFontType = font_type; font->mFontStatus = font_status; - F64 expiry_time = 0.f; - // Set the expiry timer to trigger a notification when the voice font can no longer be used. font->mExpiryTimer.start(); - expiry_time = expiration_date.secondsSinceEpoch() - LLTimer::getTotalSeconds(); - font->mExpiryTimer.setTimerExpirySec(expiry_time); + font->mExpiryTimer.setExpiryAt(expiration_date.secondsSinceEpoch()); // Set the warning timer to some interval before actual expiry. S32 warning_time = gSavedSettings.getS32("VoiceEffectExpiryWarningTime"); - if (warning_time > 0) + if (warning_time != 0) { font->mExpiryWarningTimer.start(); - expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time) - - LLTimer::getTotalSeconds(); - font->mExpiryWarningTimer.setTimerExpirySec(expiry_time); + F64 expiry_time = (expiration_date.secondsSinceEpoch() - (F64)warning_time); + font->mExpiryWarningTimer.setExpiryAt(expiry_time); } else { @@ -6657,8 +6655,8 @@ void LLVivoxVoiceClient::expireVoiceFonts() for (iter = mVoiceFontMap.begin(); iter != mVoiceFontMap.end(); ++iter) { voiceFontEntry* voice_font = iter->second; - LLTimer& expiry_timer = voice_font->mExpiryTimer; - LLTimer& warning_timer = voice_font->mExpiryWarningTimer; + LLFrameTimer& expiry_timer = voice_font->mExpiryTimer; + LLFrameTimer& warning_timer = voice_font->mExpiryWarningTimer; // Check for expired voice fonts if (expiry_timer.getStarted() && expiry_timer.hasExpired()) @@ -7497,10 +7495,11 @@ void LLVivoxProtocolParser::CharData(const char *buffer, int length) LLDate LLVivoxProtocolParser::vivoxTimeStampToLLDate(const std::string& vivox_ts) { - // First check to see if it actually already is a proper ISO8601 date, + LLDate ts; + + // First check to see if it actually already is a parseable ISO8601 date, // in case the format miraculously changes in future ;) - LLDate ts(vivox_ts); - if (ts.notNull()) + if (ts.fromString(vivox_ts)) { return ts; } @@ -7511,14 +7510,22 @@ LLDate LLVivoxProtocolParser::vivoxTimeStampToLLDate(const std::string& vivox_ts // so add it. It is the only space in their result. LLStringUtil::replaceChar(time_stamp, ' ', 'T'); - //also need to remove the hours away from GMT to be compatible - //with LLDate as well as the fractions of seconds + // Also need to remove the hours away from GMT to be compatible + // with LLDate, as well as the fractions of seconds. time_stamp = time_stamp.substr(0, time_stamp.length() - 5); - //it also needs a 'Z' at the end + // It also needs a 'Z' at the end time_stamp += "Z"; - return LLDate(time_stamp); + ts.fromString(time_stamp); + if(!ts.fromString(time_stamp)) + { + LL_WARNS_ONCE("Voice") << "Failed to parse Vivox timestamp: " << vivox_ts + << " to ISO 8601 date: " << time_stamp << LL_ENDL; + return LLDate(); + } + + return ts; } // -------------------------------------------------------------------------------- diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index d71fe132c5..debc03377f 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -900,8 +900,8 @@ private: S32 mFontStatus; bool mIsNew; - LLTimer mExpiryTimer; - LLTimer mExpiryWarningTimer; + LLFrameTimer mExpiryTimer; + LLFrameTimer mExpiryWarningTimer; }; bool mVoiceFontsReceived; @@ -916,7 +916,7 @@ private: typedef std::set<LLVoiceEffectObserver*> voice_font_observer_set_t; voice_font_observer_set_t mVoiceFontObservers; - LLTimer mVoiceFontExpiryTimer; + LLFrameTimer mVoiceFontExpiryTimer; // Audio capture buffer |