diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index c72e80f091..7398c7d527 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -3484,37 +3484,6 @@ void LLViewerMediaTexture::addMediaToFace(LLFace* facep)
if(facep)
{
facep->setHasMedia(true);
-
- // If using CEF then set a texture matrix to flip around the Y Axis.
- static bool sFlipY = gSavedSettings.getBOOL( "FSFlipCEFY" );
-
- LLViewerMediaImpl *pMedia = mMediaImplp;
- if( !pMedia )
- pMedia = LLViewerMedia::getMediaImplFromTextureID(mID);
-
- std::string strMimeType;
- if( pMedia )
- strMimeType = pMedia->getMimeType();
-
- std::string strImpl = LLMIMETypes::implType( strMimeType );
- bool bCoordsOpenGl = sFlipY;
- if( pMedia && pMedia->getMediaPlugin() )
- bCoordsOpenGl = pMedia->getMediaPlugin()->getTextureCoordsOpenGL();
-
- if( strImpl == "media_plugin_cef" && !bCoordsOpenGl )
- {
- if( !facep->mTextureMatrix )
- {
- facep->mTextureMatrix = new LLMatrix4();
- facep->mTextureMatrix->mMatrix[ 1 ][ 1 ] = -1.0f;
- facep->mTextureMatrix->mMatrix[ 2 ][ 1 ] = 1.0f;
- }
- else
- {
- LL_WARNS() << "Matrix for media face is already set." << LL_ENDL;
- }
- }
- //
}
if(!mIsPlaying)
{
@@ -3686,6 +3655,37 @@ void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep)
if(mIsPlaying) //old textures switch to the media texture
{
+ // If using CEF then set a texture matrix to flip around the Y Axis.
+ static bool sFlipY = gSavedSettings.getBOOL( "FSFlipCEFY" );
+
+ LLViewerMediaImpl *pMedia = mMediaImplp;
+ if( !pMedia )
+ pMedia = LLViewerMedia::getMediaImplFromTextureID(mID);
+
+ std::string strMimeType;
+ if( pMedia )
+ strMimeType = pMedia->getMimeType();
+
+ std::string strImpl = LLMIMETypes::implType( strMimeType );
+ bool bCoordsOpenGl = sFlipY;
+ if( pMedia && pMedia->getMediaPlugin() )
+ bCoordsOpenGl = pMedia->getMediaPlugin()->getTextureCoordsOpenGL();
+
+ if( strImpl == "media_plugin_cef" && !bCoordsOpenGl )
+ {
+ if( !facep->mTextureMatrix )
+ {
+ facep->mTextureMatrix = new LLMatrix4();
+ facep->mTextureMatrix->mMatrix[ 1 ][ 1 ] = -1.0f;
+ facep->mTextureMatrix->mMatrix[ 2 ][ 1 ] = 1.0f;
+ }
+ else
+ {
+ LL_WARNS() << "Matrix for media face is already set." << LL_ENDL;
+ }
+ }
+ //
+
facep->switchTexture(ch, this);
}
else //switch to old textures.