summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-03-17 13:03:37 -0700
committerMonroe Linden <monroe@lindenlab.com>2010-03-17 13:03:37 -0700
commitb54c7b525b01bc137246b3a57ec9f8318d0c8f81 (patch)
tree3fe926251a1b0037509722010ce84c740d5e780d
parent49bb6eebe879573fbada33c7fd6e25f323ab44ce (diff)
Fix for EXT-5975: don't display a toast warning for none/none parcel media mime type
Modified LLParcelMediaAutoPlay and LLParcelMedia so that it should no longer attempt to create media instances when the media type is set to "none/none". Also, made LLViewerParcelMedia::getURL() return an empty string when the media type is none/none, which should make the UI better reflect the fact that it won't be loaded. Reviewed by Callum at http://codereview.lindenlab.com/686010
-rw-r--r--indra/newview/llviewerparcelmedia.cpp49
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.cpp18
2 files changed, 39 insertions, 28 deletions
diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp
index 2c5c0a37e8..b967436df6 100644
--- a/indra/newview/llviewerparcelmedia.cpp
+++ b/indra/newview/llviewerparcelmedia.cpp
@@ -210,25 +210,29 @@ void LLViewerParcelMedia::play(LLParcel* parcel)
// A new impl will be created below.
}
}
-
- if(!sMediaImpl)
+
+ // Don't ever try to play if the media type is set to "none/none"
+ if(stricmp(mime_type.c_str(), "none/none") != 0)
{
- LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL;
-
- // There is no media impl, make a new one
- sMediaImpl = LLViewerMedia::newMediaImpl(
- placeholder_texture_id,
- media_width,
- media_height,
- media_auto_scale,
- media_loop);
- sMediaImpl->setIsParcelMedia(true);
- sMediaImpl->navigateTo(media_url, mime_type, true);
- }
+ if(!sMediaImpl)
+ {
+ LL_DEBUGS("Media") << "new media impl with mime type " << mime_type << ", url " << media_url << LL_ENDL;
+
+ // There is no media impl, make a new one
+ sMediaImpl = LLViewerMedia::newMediaImpl(
+ placeholder_texture_id,
+ media_width,
+ media_height,
+ media_auto_scale,
+ media_loop);
+ sMediaImpl->setIsParcelMedia(true);
+ sMediaImpl->navigateTo(media_url, mime_type, true);
+ }
- //LLFirstUse::useMedia();
+ //LLFirstUse::useMedia();
- LLViewerParcelMediaAutoPlay::playStarted();
+ LLViewerParcelMediaAutoPlay::playStarted();
+ }
}
// static
@@ -312,11 +316,14 @@ std::string LLViewerParcelMedia::getURL()
if(sMediaImpl.notNull())
url = sMediaImpl->getMediaURL();
- if (url.empty())
- url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL();
-
- if (url.empty())
- url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaURL();
+ if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), "none/none") != 0)
+ {
+ if (url.empty())
+ url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL();
+
+ if (url.empty())
+ url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaURL();
+ }
return url;
}
diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp
index ad2723b66b..f55d6d89c4 100644
--- a/indra/newview/llviewerparcelmediaautoplay.cpp
+++ b/indra/newview/llviewerparcelmediaautoplay.cpp
@@ -86,6 +86,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
LLParcel *this_parcel = NULL;
LLViewerRegion *this_region = NULL;
std::string this_media_url;
+ std::string this_media_type;
LLUUID this_media_texture_id;
S32 this_parcel_id = 0;
LLUUID this_region_id;
@@ -101,7 +102,9 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
if (this_parcel)
{
- this_media_url = std::string(this_parcel->getMediaURL());
+ this_media_url = this_parcel->getMediaURL();
+
+ this_media_type = this_parcel->getMediaType();
this_media_texture_id = this_parcel->getMediaID();
@@ -118,14 +121,15 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
mLastRegionID = this_region_id;
}
- mTimeInParcel += mPeriod; // increase mTimeInParcel by the amount of time between ticks
+ mTimeInParcel += mPeriod; // increase mTimeInParcel by the amount of time between ticks
- if ((!mPlayed) && // if we've never played
- (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds
- (this_media_url.size() != 0) && // and if the parcel has media
- (LLViewerParcelMedia::sMediaImpl.isNull())) // and if the media is not already playing
+ if ((!mPlayed) && // if we've never played
+ (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds
+ (!this_media_url.empty()) && // and if the parcel has media
+ (stricmp(this_media_type.c_str(), "none/none") != 0) &&
+ (LLViewerParcelMedia::sMediaImpl.isNull())) // and if the media is not already playing
{
- if (this_media_texture_id.notNull()) // and if the media texture is good
+ if (this_media_texture_id.notNull()) // and if the media texture is good
{
LLViewerMediaTexture *image = LLViewerTextureManager::getMediaTexture(this_media_texture_id, FALSE) ;