summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r--indra/newview/llviewermedia.cpp474
1 files changed, 296 insertions, 178 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 1be58eae45..98f4ce58fe 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -50,6 +50,7 @@
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llviewerregion.h"
+#include "llwebprofile.h"
#include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this!
#include "llfilepicker.h"
#include "llnotifications.h"
@@ -68,7 +69,6 @@
#include "llwindow.h"
-#include "llfloatermediabrowser.h" // for handling window close requests and geometry change requests in media browser windows.
#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows.
#include <boost/bind.hpp> // for SkinFolder listener
@@ -319,6 +319,10 @@ public:
std::string cookie = content["set-cookie"].asString();
LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, mHost);
+
+ // Set cookie for snapshot publishing.
+ std::string auth_cookie = cookie.substr(0, cookie.find(";")); // strip path
+ LLWebProfile::setAuthCookie(auth_cookie);
}
void completedRaw(
@@ -344,6 +348,8 @@ static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap;
static LLTimer sMediaCreateTimer;
static const F32 LLVIEWERMEDIA_CREATE_DELAY = 1.0f;
static F32 sGlobalVolume = 1.0f;
+static bool sForceUpdate = false;
+static LLUUID sOnlyAudibleTextureID = LLUUID::null;
static F64 sLowestLoadableImplInterest = 0.0f;
static bool sAnyMediaShowing = false;
static boost::signals2::connection sTeleportFinishConnection;
@@ -606,7 +612,7 @@ bool LLViewerMedia::textureHasMedia(const LLUUID& texture_id)
// static
void LLViewerMedia::setVolume(F32 volume)
{
- if(volume != sGlobalVolume)
+ if(volume != sGlobalVolume || sForceUpdate)
{
sGlobalVolume = volume;
impl_list::iterator iter = sViewerMediaImplList.begin();
@@ -617,6 +623,8 @@ void LLViewerMedia::setVolume(F32 volume)
LLViewerMediaImpl* pimpl = *iter;
pimpl->updateVolume();
}
+
+ sForceUpdate = false;
}
}
@@ -778,6 +786,12 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
}
static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE("Update Media");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SPARE_IDLE("Spare Idle");
+static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE_INTEREST("Update/Interest");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SORT("Sort");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SORT2("Sort 2");
+static LLFastTimer::DeclareTimer FTM_MEDIA_MISC("Misc");
+
//////////////////////////////////////////////////////////////////////////////////////////
// static
@@ -802,21 +816,28 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
- for(; iter != end;)
{
- LLViewerMediaImpl* pimpl = *iter++;
- pimpl->update();
- pimpl->calculateInterest();
+ LLFastTimer t(FTM_MEDIA_UPDATE_INTEREST);
+ for(; iter != end;)
+ {
+ LLViewerMediaImpl* pimpl = *iter++;
+ pimpl->update();
+ pimpl->calculateInterest();
+ }
}
// Let the spare media source actually launch
if(sSpareBrowserMediaSource)
{
+ LLFastTimer t(FTM_MEDIA_SPARE_IDLE);
sSpareBrowserMediaSource->idle();
}
- // Sort the static instance list using our interest criteria
- sViewerMediaImplList.sort(priorityComparitor);
+ {
+ LLFastTimer t(FTM_MEDIA_SORT);
+ // Sort the static instance list using our interest criteria
+ sViewerMediaImplList.sort(priorityComparitor);
+ }
// Go through the list again and adjust according to priority.
iter = sViewerMediaImplList.begin();
@@ -844,147 +865,150 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
// max_instances must be set high enough to allow the various instances used in the UI (for the help browser, search, etc.) to be loaded.
// If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow.
- for(; iter != end; iter++)
{
- LLViewerMediaImpl* pimpl = *iter;
+ LLFastTimer t(FTM_MEDIA_MISC);
+ for(; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
- LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+ LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
- if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
- {
- // Never load muted or failed impls.
- // Hard limit on the number of instances that will be loaded at one time
- new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
- }
- else if(!pimpl->getVisible())
- {
- new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
- }
- 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 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.
-
- // 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 = false;
- F64 approximate_interest = pimpl->getApproximateTextureInterest();
- if(approximate_interest == 0.0f)
+ if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
{
- // this media has no current size, which probably means it's not loaded.
- media_is_small = true;
+ // Never load muted or failed impls.
+ // Hard limit on the number of instances that will be loaded at one time
+ new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
}
- else if(pimpl->getInterest() < (approximate_interest / 4))
+ else if(!pimpl->getVisible())
{
- media_is_small = true;
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
}
-
- if(pimpl->getInterest() == 0.0f)
+ else if(pimpl->hasFocus())
{
- // This media is completely invisible, due to being outside the view frustrum or out of range.
- new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ new_priority = LLPluginClassMedia::PRIORITY_HIGH;
+ impl_count_interest_normal++; // count this against the count of "normal" instances for priority purposes
}
- else if(check_cpu_usage && (total_cpu > max_cpu))
+ else if(pimpl->getUsedInUI())
{
- // Higher priority plugins have already used up the CPU budget. Set remaining ones to slideshow priority.
- new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
+ new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+ impl_count_interest_normal++;
}
- else if((impl_count_interest_normal < (int)max_normal) && !media_is_small)
+ else if(pimpl->isParcelMedia())
{
- // Up to max_normal inworld get normal priority
new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
impl_count_interest_normal++;
}
- else if (impl_count_interest_low + impl_count_interest_normal < (int)max_low + (int)max_normal)
+ else
{
- // The next max_low inworld get turned down
- new_priority = LLPluginClassMedia::PRIORITY_LOW;
- impl_count_interest_low++;
-
- // Set the low priority size for downsampling to approximately the size the texture is displayed at.
+ // Look at interest and CPU usage for instances that aren't in any of the above states.
+
+ // 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 = 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)
+ {
+ // This media is completely invisible, due to being outside the view frustrum or out of range.
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if(check_cpu_usage && (total_cpu > max_cpu))
+ {
+ // Higher priority plugins have already used up the CPU budget. Set remaining ones to slideshow priority.
+ new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
+ }
+ else if((impl_count_interest_normal < (int)max_normal) && !media_is_small)
{
- F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
+ // Up to max_normal inworld get normal priority
+ new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
+ impl_count_interest_normal++;
+ }
+ else if (impl_count_interest_low + impl_count_interest_normal < (int)max_low + (int)max_normal)
+ {
+ // The next max_low inworld get turned down
+ new_priority = LLPluginClassMedia::PRIORITY_LOW;
+ impl_count_interest_low++;
+
+ // Set the low priority size for downsampling to approximately the size the texture is displayed at.
+ {
+ F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
- pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension));
+ pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension));
+ }
+ }
+ else
+ {
+ // Any additional impls (up to max_instances) get very infrequent time
+ new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
}
}
- else
- {
- // Any additional impls (up to max_instances) get very infrequent time
- new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
- }
- }
- if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
- {
- // This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
- lowest_interest_loadable = pimpl;
+ if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
+ {
+ // This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
+ lowest_interest_loadable = pimpl;
- impl_count_total++;
- }
+ impl_count_total++;
+ }
- // Overrides if the window is minimized or we lost focus (taking care
- // not to accidentally "raise" the priority either)
- if (!gViewerWindow->getActive() /* viewer window minimized? */
- && new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
- {
- new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
- }
- else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
- && new_priority > LLPluginClassMedia::PRIORITY_LOW)
- {
- new_priority = LLPluginClassMedia::PRIORITY_LOW;
- }
+ // Overrides if the window is minimized or we lost focus (taking care
+ // not to accidentally "raise" the priority either)
+ if (!gViewerWindow->getActive() /* viewer window minimized? */
+ && new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
+ && new_priority > LLPluginClassMedia::PRIORITY_LOW)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_LOW;
+ }
- if(!inworld_media_enabled)
- {
- // If inworld media is locked out, force all inworld media to stay unloaded.
- if(!pimpl->getUsedInUI())
+ if(!inworld_media_enabled)
{
- new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
+ // If inworld media is locked out, force all inworld media to stay unloaded.
+ if(!pimpl->getUsedInUI())
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
+ }
}
- }
- // update the audio stream here as well
- if( !inworld_audio_enabled)
- {
- if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
+ // update the audio stream here as well
+ if( !inworld_audio_enabled)
{
- gAudiop->stopInternetStream();
+ if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio())
+ {
+ gAudiop->stopInternetStream();
+ }
}
- }
- pimpl->setPriority(new_priority);
+ pimpl->setPriority(new_priority);
- if(pimpl->getUsedInUI())
- {
- // Any impls used in the UI should not be in the proximity list.
- pimpl->mProximity = -1;
- }
- else
- {
- proximity_order.push_back(pimpl);
- }
+ if(pimpl->getUsedInUI())
+ {
+ // Any impls used in the UI should not be in the proximity list.
+ pimpl->mProximity = -1;
+ }
+ else
+ {
+ proximity_order.push_back(pimpl);
+ }
- total_cpu += pimpl->getCPUUsage();
+ total_cpu += pimpl->getCPUUsage();
- if (!pimpl->getUsedInUI() && pimpl->hasMedia())
- {
- sAnyMediaShowing = true;
- }
+ if (!pimpl->getUsedInUI() && pimpl->hasMedia())
+ {
+ sAnyMediaShowing = true;
+ }
+ }
}
// Re-calculate this every time.
@@ -1010,6 +1034,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
else
{
+ LLFastTimer t(FTM_MEDIA_SORT2);
// Use a distance-based sort for proximity values.
std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor);
}
@@ -1362,6 +1387,10 @@ void LLViewerMedia::removeCookie(const std::string &name, const std::string &dom
}
+// This is defined in two files but I don't want to create a dependence between this and llsidepanelinventory
+// just to be able to temporarily disable the outbox.
+#define ENABLE_INVENTORY_DISPLAY_OUTBOX 0 // keep in sync with ENABLE_MERCHANT_OUTBOX_PANEL, ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU
+
class LLInventoryUserStatusResponder : public LLHTTPClient::Responder
{
public:
@@ -1374,8 +1403,18 @@ public:
{
if (isGoodStatus(status))
{
+ std::string merchantStatus = content[gAgent.getID().getString()].asString();
+ llinfos << "Marketplace merchant status: " << merchantStatus << llendl;
+
+ // Save the merchant status before turning on the display
+ gSavedSettings.setString("InventoryMarketplaceUserStatus", merchantStatus);
+
// Complete success
gSavedSettings.setBOOL("InventoryDisplayInbox", true);
+
+#if ENABLE_INVENTORY_DISPLAY_OUTBOX
+ gSavedSettings.setBOOL("InventoryDisplayOutbox", true);
+#endif
}
else if (status == 401)
{
@@ -1390,6 +1429,39 @@ public:
}
};
+
+void doOnetimeEarlyHTTPRequests()
+{
+ std::string url = "https://marketplace.secondlife.com/";
+
+ if (!LLGridManager::getInstance()->isInProductionGrid())
+ {
+ std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
+ url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
+
+ // TEMP for Jim's pdp
+ //url = "http://pdp24.lindenlab.com:3000/";
+ }
+
+ url += "api/1/users/";
+ url += gAgent.getID().getString();
+ url += "/user_status";
+
+ llinfos << "http get: " << url << llendl;
+ LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), LLViewerMedia::getHeaders());
+}
+
+
+LLSD LLViewerMedia::getHeaders()
+{
+ LLSD headers = LLSD::emptyMap();
+ headers["Accept"] = "*/*";
+ headers["Cookie"] = sOpenIDCookie;
+ headers["User-Agent"] = getCurrentUserAgent();
+
+ return headers;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::setOpenIDCookie()
@@ -1433,28 +1505,14 @@ void LLViewerMedia::setOpenIDCookie()
std::string profile_url = getProfileURL("");
LLURL raw_profile_url( profile_url.c_str() );
+ LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << llendl;
+ LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << llendl;
LLHTTPClient::get(profile_url,
new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),
headers);
- std::string url = "https://marketplace.secondlife.com/";
-
- if (!LLGridManager::getInstance()->isInProductionGrid())
- {
- std::string gridLabel = LLGridManager::getInstance()->getGridLabel();
- url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str());
- }
-
- url += "api/1/users/";
- url += gAgent.getID().getString();
- url += "/user_status";
-
- headers = LLSD::emptyMap();
- headers["Accept"] = "*/*";
- headers["Cookie"] = sOpenIDCookie;
- headers["User-Agent"] = getCurrentUserAgent();
-
- LLHTTPClient::get(url, new LLInventoryUserStatusResponder(), headers);
+ // FUI: No longer perform the user_status query
+ //doOnetimeEarlyHTTPRequests();
}
}
@@ -1626,6 +1684,15 @@ void LLViewerMedia::onTeleportFinished()
gSavedSettings.setBOOL("MediaTentativeAutoPlay", true);
}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::setOnlyAudibleMediaTextureID(const LLUUID& texture_id)
+{
+ sOnlyAudibleTextureID = texture_id;
+ sForceUpdate = true;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
// LLViewerMediaImpl
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1672,7 +1739,8 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
mNavigateSuspended(false),
mNavigateSuspendedDeferred(false),
mIsUpdated(false),
- mTrustedBrowser(false)
+ mTrustedBrowser(false),
+ mZoomFactor(1.0)
{
// Set up the mute list observer if it hasn't been set up already.
@@ -1763,6 +1831,7 @@ void LLViewerMediaImpl::createMediaSource()
LL_WARNS("Media") << "Failed to initialize media for mime type " << mMimeType << LL_ENDL;
}
}
+
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1867,7 +1936,10 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
// collect 'javascript enabled' setting from prefs and send to embedded browser
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
media_source->setJavascriptEnabled( javascript_enabled );
-
+
+ bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
+ media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled );
+
media_source->setTarget(target);
const std::string plugin_dir = gDirUtilp->getLLPluginDir();
@@ -2188,7 +2260,14 @@ void LLViewerMediaImpl::updateVolume()
}
}
- mMediaSource->setVolume(volume);
+ if (sOnlyAudibleTextureID == LLUUID::null || sOnlyAudibleTextureID == mTextureId)
+ {
+ mMediaSource->setVolume(volume);
+ }
+ else
+ {
+ mMediaSource->setVolume(0.0f);
+ }
}
}
@@ -2247,6 +2326,17 @@ void LLViewerMediaImpl::clearCache()
}
}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+void LLViewerMediaImpl::setPageZoomFactor( double factor )
+{
+ if(mMediaSource && factor != mZoomFactor)
+ {
+ mZoomFactor = factor;
+ mMediaSource->set_page_zoom_factor( factor );
+ }
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button)
{
@@ -2395,44 +2485,58 @@ BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask)
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::updateJavascriptObject()
{
+ static LLFrameTimer timer ;
+
if ( mMediaSource )
{
// flag to expose this information to internal browser or not.
bool enable = gSavedSettings.getBOOL("BrowserEnableJSObject");
+
+ if(!enable)
+ {
+ return ; //no need to go further.
+ }
+
+ if(timer.getElapsedTimeF32() < 1.0f)
+ {
+ return ; //do not update more than once per second.
+ }
+ timer.reset() ;
+
mMediaSource->jsEnableObject( enable );
// these values are only menaingful after login so don't set them before
bool logged_in = LLLoginInstance::getInstance()->authSuccess();
if ( logged_in )
{
- // current location within a region
- LLVector3 agent_pos = gAgent.getPositionAgent();
- double x = agent_pos.mV[ VX ];
- double y = agent_pos.mV[ VY ];
- double z = agent_pos.mV[ VZ ];
- mMediaSource->jsAgentLocationEvent( x, y, z );
-
- // current location within the grid
- LLVector3d agent_pos_global = gAgent.getLastPositionGlobal();
- double global_x = agent_pos_global.mdV[ VX ];
- double global_y = agent_pos_global.mdV[ VY ];
- double global_z = agent_pos_global.mdV[ VZ ];
- mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z );
-
- // current agent orientation
- double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] );
- double angle = rotation * RAD_TO_DEG;
- if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation!
- mMediaSource->jsAgentOrientationEvent( angle );
-
- // current region agent is in
- std::string region_name("");
- LLViewerRegion* region = gAgent.getRegion();
- if ( region )
- {
- region_name = region->getName();
- };
- mMediaSource->jsAgentRegionEvent( region_name );
+ // current location within a region
+ LLVector3 agent_pos = gAgent.getPositionAgent();
+ double x = agent_pos.mV[ VX ];
+ double y = agent_pos.mV[ VY ];
+ double z = agent_pos.mV[ VZ ];
+ mMediaSource->jsAgentLocationEvent( x, y, z );
+
+ // current location within the grid
+ LLVector3d agent_pos_global = gAgent.getLastPositionGlobal();
+ double global_x = agent_pos_global.mdV[ VX ];
+ double global_y = agent_pos_global.mdV[ VY ];
+ double global_z = agent_pos_global.mdV[ VZ ];
+ mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z );
+
+ // current agent orientation
+ double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] );
+ double angle = rotation * RAD_TO_DEG;
+ if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation!
+ mMediaSource->jsAgentOrientationEvent( angle );
+
+ // current region agent is in
+ std::string region_name("");
+ LLViewerRegion* region = gAgent.getRegion();
+ if ( region )
+ {
+ region_name = region->getName();
+ };
+ mMediaSource->jsAgentRegionEvent( region_name );
}
// language code the viewer is set to
@@ -2451,7 +2555,7 @@ void LLViewerMediaImpl::updateJavascriptObject()
}
//////////////////////////////////////////////////////////////////////////////////////////
-std::string LLViewerMediaImpl::getName() const
+const std::string& LLViewerMediaImpl::getName() const
{
if (mMediaSource)
{
@@ -2713,8 +2817,14 @@ bool LLViewerMediaImpl::canNavigateBack()
}
//////////////////////////////////////////////////////////////////////////////////////////
+static LLFastTimer::DeclareTimer FTM_MEDIA_DO_UPDATE("Do Update");
+static LLFastTimer::DeclareTimer FTM_MEDIA_GET_DATA("Get Data");
+static LLFastTimer::DeclareTimer FTM_MEDIA_SET_SUBIMAGE("Set Subimage");
+
+
void LLViewerMediaImpl::update()
{
+ LLFastTimer t(FTM_MEDIA_DO_UPDATE);
if(mMediaSource == NULL)
{
if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED)
@@ -2814,20 +2924,27 @@ void LLViewerMediaImpl::update()
if(width > 0 && height > 0)
{
- U8* data = mMediaSource->getBitsData();
+ U8* data = NULL;
+ {
+ LLFastTimer t(FTM_MEDIA_GET_DATA);
+ data = mMediaSource->getBitsData();
+ }
// Offset the pixels pointer to match x_pos and y_pos
data += ( x_pos * mMediaSource->getTextureDepth() * mMediaSource->getBitsWidth() );
data += ( y_pos * mMediaSource->getTextureDepth() );
- placeholder_image->setSubImage(
- data,
- mMediaSource->getBitsWidth(),
- mMediaSource->getBitsHeight(),
- x_pos,
- y_pos,
- width,
- height);
+ {
+ LLFastTimer t(FTM_MEDIA_SET_SUBIMAGE);
+ placeholder_image->setSubImage(
+ data,
+ mMediaSource->getBitsWidth(),
+ mMediaSource->getBitsHeight(),
+ x_pos,
+ y_pos,
+ width,
+ height);
+ }
}
@@ -3286,7 +3403,6 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
{
// This close request is directed at another instance
pass_through = false;
- LLFloaterMediaBrowser::closeRequest(uuid);
LLFloaterWebContent::closeRequest(uuid);
}
}
@@ -3306,7 +3422,6 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
{
// This request is directed at another instance
pass_through = false;
- LLFloaterMediaBrowser::geometryChanged(uuid, plugin->getGeometryX(), plugin->getGeometryY(), plugin->getGeometryWidth(), plugin->getGeometryHeight());
LLFloaterWebContent::geometryChanged(uuid, plugin->getGeometryX(), plugin->getGeometryY(), plugin->getGeometryWidth(), plugin->getGeometryHeight());
}
}
@@ -3400,8 +3515,11 @@ BOOL LLViewerMediaImpl::isUpdated()
return mIsUpdated ;
}
+static LLFastTimer::DeclareTimer FTM_MEDIA_CALCULATE_INTEREST("Calculate Interest");
+
void LLViewerMediaImpl::calculateInterest()
{
+ LLFastTimer t(FTM_MEDIA_CALCULATE_INTEREST);
LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId );
if(texture != NULL)