diff options
-rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 4 | ||||
-rw-r--r-- | indra/llplugin/llpluginprocesschild.cpp | 5 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 10 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 5 |
5 files changed, 80 insertions, 19 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 42d5ec49cd..c3d8a5aa23 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -593,10 +593,10 @@ void LLPluginClassMedia::setPriority(EPriority priority) mSleepTime = 1.0f; break; case PRIORITY_LOW: - mSleepTime = 1.0f / 50.0f; + mSleepTime = 1.0f / 25.0f; break; case PRIORITY_NORMAL: - mSleepTime = 1.0f / 100.0f; + mSleepTime = 1.0f / 50.0f; break; case PRIORITY_HIGH: mSleepTime = 1.0f / 100.0f; diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index 450dcb3c78..fc95136d9e 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -37,12 +37,13 @@ #include "llpluginmessageclasses.h" static const F32 HEARTBEAT_SECONDS = 1.0f; +static const F32 PLUGIN_IDLE_SECONDS = 1.0f / 100.0f; // Each call to idle will give the plugin this much time. LLPluginProcessChild::LLPluginProcessChild() { mInstance = NULL; mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); - mSleepTime = 1.0f / 100.0f; // default: send idle messages at 100Hz + mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz mCPUElapsed = 0.0f; } @@ -155,7 +156,7 @@ void LLPluginProcessChild::idle(void) { // Provide some time to the plugin LLPluginMessage message("base", "idle"); - message.setValueReal("time", mSleepTime); + message.setValueReal("time", PLUGIN_IDLE_SECONDS); sendMessageToPlugin(message); mInstance->idle(); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8ad52784d3..52de17bff5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5369,7 +5369,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>0.0</real> + <real>1.0</real> </map> <key>PluginInstancesLow</key> <map> @@ -5385,24 +5385,24 @@ <key>PluginInstancesNormal</key> <map> <key>Comment</key> - <string>Limit on the number of inworld media plugins that will run at "normal" priority</string> + <string>Limit on the number of inworld media plugins that will run at "normal" or higher priority</string> <key>Persist</key> <integer>1</integer> <key>Type</key> <string>U32</string> <key>Value</key> - <integer>4</integer> + <integer>2</integer> </map> <key>PluginInstancesTotal</key> <map> <key>Comment</key> - <string>Hard limit on the number of plugins that will be instantiated at once</string> + <string>Hard limit on the number of plugins that will be instantiated at once for inworld media</string> <key>Persist</key> <integer>1</integer> <key>Type</key> <string>U32</string> <key>Value</key> - <integer>16</integer> + <integer>8</integer> </map> <key>PrecachingDelay</key> <map> diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 251d7d4a13..70490d3a6e 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -541,6 +541,16 @@ bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLView // The item with user focus always comes to the front of the list, period. return false; } + else if(i1->isParcelMedia()) + { + // The parcel media impl sorts above all other inworld media, unless one has focus. + return true; + } + else if(i2->isParcelMedia()) + { + // The parcel media impl sorts above all other inworld media, unless one has focus. + return false; + } else if(i1->getUsedInUI() && !i2->getUsedInUI()) { // i1 is a UI element, i2 is not. This makes i1 "less than" i2, so it sorts earlier in our list. @@ -551,14 +561,14 @@ bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLView // i2 is a UI element, i1 is not. This makes i2 "less than" i1, so it sorts earlier in our list. return false; } - else if(i1->isParcelMedia()) + else if(i1->isPlayable() && !i2->isPlayable()) { - // The parcel media impl sorts above all other inworld media, unless one has focus. + // Playable items sort above ones that wouldn't play even if they got high enough priority return true; } - else if(i2->isParcelMedia()) + else if(!i1->isPlayable() && i2->isPlayable()) { - // The parcel media impl sorts above all other inworld media, unless one has focus. + // Playable items sort above ones that wouldn't play even if they got high enough priority return false; } else @@ -629,10 +639,12 @@ void LLViewerMedia::updateMedia() else if(pimpl->hasFocus()) { new_priority = LLPluginClassMedia::PRIORITY_HIGH; + impl_count_interest_normal++; // count this against the count of "normal" instances for priority purposes } else if(pimpl->getUsedInUI()) { new_priority = LLPluginClassMedia::PRIORITY_NORMAL; + impl_count_interest_normal++; } else { @@ -640,7 +652,17 @@ void LLViewerMedia::updateMedia() // Heuristic -- if the media texture's approximate screen area is less than 1/4 of the native area of the texture, // turn it down to low instead of normal. This may downsample for plugins that support it. - bool media_is_small = pimpl->getInterest() < (pimpl->getApproximateTextureInterest() / 4); + bool media_is_small = false; + F64 approximate_interest = pimpl->getApproximateTextureInterest(); + if(approximate_interest == 0.0f) + { + // this media has no current size, which probably means it's not loaded. + media_is_small = true; + } + else if(pimpl->getInterest() < (approximate_interest / 4)) + { + media_is_small = true; + } if(pimpl->getInterest() == 0.0f) { @@ -678,7 +700,7 @@ void LLViewerMedia::updateMedia() } } - if(new_priority != LLPluginClassMedia::PRIORITY_UNLOADED) + if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED)) { impl_count_total++; } @@ -1588,6 +1610,10 @@ void LLViewerMediaImpl::update() { // This media source should not be loaded. } + else if(mPriority <= LLPluginClassMedia::PRIORITY_SLIDESHOW) + { + // Don't load new instances that are at PRIORITY_SLIDESHOW or below. They're just kept around to preserve state. + } else if(mMimeTypeProbe != NULL) { // this media source is doing a MIME type probe -- don't try loading it again. @@ -1816,7 +1842,7 @@ bool LLViewerMediaImpl::isMediaPaused() ////////////////////////////////////////////////////////////////////////////////////////// // -bool LLViewerMediaImpl::hasMedia() +bool LLViewerMediaImpl::hasMedia() const { return mMediaSource != NULL; } @@ -1851,6 +1877,31 @@ bool LLViewerMediaImpl::isForcedUnloaded() const } ////////////////////////////////////////////////////////////////////////////////////////// +// +bool LLViewerMediaImpl::isPlayable() const +{ + if(isForcedUnloaded()) + { + // All of the forced-unloaded criteria also imply not playable. + return false; + } + + if(hasMedia()) + { + // Anything that's already playing is, by definition, playable. + return true; + } + + if(!mMediaURL.empty()) + { + // If something has navigated the instance, it's ready to be played. + return true; + } + + return false; +} + +////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent event) { switch(event) @@ -2094,7 +2145,13 @@ F64 LLViewerMediaImpl::getApproximateTextureInterest() result = mMediaSource->getFullWidth(); result *= mMediaSource->getFullHeight(); } - + else + { + // No media source is loaded -- all we have to go on is the texture size that has been set on the impl, if any. + result = mMediaWidth; + result *= mMediaHeight; + } + return result; } @@ -2135,7 +2192,7 @@ void LLViewerMediaImpl::setPriority(LLPluginClassMedia::EPriority priority) { if(mPriority != priority) { - LL_INFOS("PluginPriority") + LL_DEBUGS("PluginPriority") << "changing priority of media id " << mTextureId << " from " << LLPluginClassMedia::priorityToString(mPriority) << " to " << LLPluginClassMedia::priorityToString(priority) diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 639aed4b8a..a06079786e 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -194,7 +194,7 @@ public: bool isMediaPlaying(); bool isMediaPaused(); - bool hasMedia(); + bool hasMedia() const; bool isMediaFailed() const { return mMediaSourceFailed; }; void resetPreviousMediaState(); @@ -204,6 +204,9 @@ public: // returns true if this instance should not be loaded (disabled, muted object, crashed, etc.) bool isForcedUnloaded() const; + // returns true if this instance could be playable based on autoplay setting, current load state, etc. + bool isPlayable() const; + void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; }; bool isParcelMedia() const { return mIsParcelMedia; }; |