diff options
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 82 |
1 files changed, 77 insertions, 5 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 9671b9e5dc..d712446d83 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -56,7 +56,7 @@ #include "lluuid.h" #include "llkeyboard.h" #include "llmutelist.h" -#include "llfirstuse.h" +//#include "llfirstuse.h" #include <boost/bind.hpp> // for SkinFolder listener #include <boost/signals2.hpp> @@ -752,6 +752,11 @@ void LLViewerMedia::updateMedia(void *dummy_arg) new_priority = LLPluginClassMedia::PRIORITY_NORMAL; impl_count_interest_normal++; } + else if(pimpl->isParcelMedia()) + { + new_priority = LLPluginClassMedia::PRIORITY_NORMAL; + impl_count_interest_normal++; + } else { // Look at interest and CPU usage for instances that aren't in any of the above states. @@ -1005,6 +1010,9 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mMediaAutoPlay(false), mInNearbyMediaList(false), mClearCache(false), + mBackgroundColor(LLColor4::white), + mNavigateSuspended(false), + mNavigateSuspendedDeferred(false), mIsUpdated(false) { @@ -1217,6 +1225,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) media_source->setAutoScale(mMediaAutoScale); media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent()); media_source->focus(mHasFocus); + media_source->setBackgroundColor(mBackgroundColor); if(mClearCache) { @@ -1242,7 +1251,24 @@ void LLViewerMediaImpl::loadURI() { if(mMediaSource) { - mMediaSource->loadURI( mMediaURL ); + // *HACK: we don't know if the URI coming in is properly escaped + // (the contract doesn't specify whether it is escaped or not. + // but LLQtWebKit expects it to be, so we do our best to encode + // special characters) + // The strings below were taken right from http://www.ietf.org/rfc/rfc1738.txt + // Note especially that '%' and '/' are there. + std::string uri = LLURI::escape(mMediaURL, + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789" + "$-_.+" + "!*'()," + "{}|\\^~[]`" + "<>#%" + ";/?:@&=", + false); + llinfos << "Asking media source to load URI: " << uri << llendl; + + mMediaSource->loadURI( uri ); if(mPreviousMediaState == MEDIA_PLAYING) { @@ -1694,6 +1720,13 @@ void LLViewerMediaImpl::navigateInternal() // Helpful to have media urls in log file. Shouldn't be spammy. llinfos << "media id= " << mTextureId << " url=" << mMediaURL << " mime_type=" << mMimeType << llendl; + if(mNavigateSuspended) + { + llwarns << "Deferring navigate." << llendl; + mNavigateSuspendedDeferred = true; + return; + } + if(mMimeTypeProbe != NULL) { llwarns << "MIME type probe already in progress -- bailing out." << llendl; @@ -1900,7 +1933,17 @@ void LLViewerMediaImpl::update() return; } + // Make sure a navigate doesn't happen during the idle -- it can cause mMediaSource to get destroyed, which can cause a crash. + setNavigateSuspended(true); + mMediaSource->idle(); + + setNavigateSuspended(false); + + if(mMediaSource == NULL) + { + return; + } if(mMediaSource->isPluginExited()) { @@ -1983,8 +2026,8 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() || placeholder_image->getUseMipMaps() || (placeholder_image->getWidth() != mMediaSource->getTextureWidth()) || (placeholder_image->getHeight() != mMediaSource->getTextureHeight()) - || (mTextureUsedWidth > mMediaSource->getWidth()) - || (mTextureUsedHeight > mMediaSource->getHeight()) + || (mTextureUsedWidth != mMediaSource->getWidth()) + || (mTextureUsedHeight != mMediaSource->getHeight()) ) { LL_DEBUGS("Media") << "initializing media placeholder" << LL_ENDL; @@ -2002,7 +2045,9 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() // MEDIAOPT: seems insane that we actually have to make an imageraw then // immediately discard it LLPointer<LLImageRaw> raw = new LLImageRaw(texture_width, texture_height, texture_depth); - raw->clear(0x00, 0x00, 0x00, 0xff); + // Clear the texture to the background color, ignoring alpha. + // convert background color channels from [0.0, 1.0] to [0, 255]; + raw->clear(int(mBackgroundColor.mV[VX] * 255.0f), int(mBackgroundColor.mV[VY] * 255.0f), int(mBackgroundColor.mV[VZ] * 255.0f), 0xff); int discard_level = 0; // ask media source for correct GL image format constants @@ -2473,6 +2518,16 @@ void LLViewerMediaImpl::setUsedInUI(bool used_in_ui) } }; +void LLViewerMediaImpl::setBackgroundColor(LLColor4 color) +{ + mBackgroundColor = color; + + if(mMediaSource) + { + mMediaSource->setBackgroundColor(mBackgroundColor); + } +}; + F64 LLViewerMediaImpl::getCPUUsage() const { F64 result = 0.0f; @@ -2545,6 +2600,23 @@ void LLViewerMediaImpl::setNavState(EMediaNavState state) } } +void LLViewerMediaImpl::setNavigateSuspended(bool suspend) +{ + if(mNavigateSuspended != suspend) + { + mNavigateSuspended = suspend; + if(!suspend) + { + // We're coming out of suspend. If someone tried to do a navigate while suspended, do one now instead. + if(mNavigateSuspendedDeferred) + { + mNavigateSuspendedDeferred = false; + navigateInternal(); + } + } + } +} + void LLViewerMediaImpl::cancelMimeTypeProbe() { if(mMimeTypeProbe != NULL) |