List Info

Thread: CN: Flash Guest Player: FLV playback fix




CN: Flash Guest Player: FLV playback fix
country flaguser name
United States
2007-11-26 14:23:31
Synopsis: FLV playback was broken on Windows because the FLV
wrapper to 
Helix communication broke due to some security fixes. The
performance of 
the security fix could use some improvements when there were
several 
commands queued.

Overview: Add back DisableLocalSecurity to the trusted FLV
wrapper SWF 
which is loaded from a resource, and the FlashPlayerTrust
file mapping.
Change the processing of Flash commands to better handle
groups of 
commands, process as many commands as possible within
200ms.

Files:
datatype/flash/flashhost/flash_guest_player.cpp
datatype/flash/flashhost/platform/win32/flash_guest_player_a
x.cpp

Branch: Atlas320

Diff:
Index: flash_guest_player.cpp
============================================================
=======
RCS file:
/cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
retrieving revision 1.33.2.10.2.2
diff -w -u -5 -r1.33.2.10.2.2 flash_guest_player.cpp
--- flash_guest_player.cpp    16 Nov 2007 23:09:42 -0000   
1.33.2.10.2.2
+++ flash_guest_player.cpp    26 Nov 2007 19:59:58 -0000
 -1357,12
+1357,10 
 CFlashGuestPlayer::GetFlashLocalURL(CHXString&
pLocalURL)
 {
     // default flash local URL
     pLocalURL = "file:///helix.swf";
 
-/*
- * XXXctd Commented out since we may not need to use
FlashPlayerTrust
 #if defined(_WINDOWS)
     static int dummy;
     CHXFileSpecifier fileSpec = 
CHXFileSpecUtils::GetModuleFileSpecByAddress(&dummy);
     if (fileSpec.IsSet())
     {
 -1370,11
+1368,10 
     pLocalURL.FindAndReplace("\", "/",
TRUE);
     pLocalURL = HXEscapeUtil::EscapePath(pLocalURL, 0);
     pLocalURL = "file:///" + pLocalURL +
"/FlashPlayerTrust/helix.swf";
     }
 #endif // _WINDOWS
-*/
 }
 
 #if defined(_WINDOWS)   
 HWND
 CFlashGuestPlayer::FindFlashWnd(HWND hParentWnd)
Index: platform/win32/flash_guest_player_ax.cpp
============================================================
=======
RCS file: 
/cvsroot/datatype/flash/flashhost/platform/win32/flash_guest
_player_ax.cpp,v
retrieving revision 1.21.2.12.2.1
diff -w -u -5 -r1.21.2.12.2.1 flash_guest_player_ax.cpp
--- platform/win32/flash_guest_player_ax.cpp    16 Nov 2007
23:09:43 
-0000    1.21.2.12.2.1
+++ platform/win32/flash_guest_player_ax.cpp    26 Nov 2007
19:35:19 -0000
 -71,10
+71,11 
 #include "safestring.h"
 #include "xml_flash.h"
 #include "hxurlmoniker.h"
 #include "get_debug_string.h"
 #include "hxtick.h"
+#include "hxprefutil.h"
 
 #if !defined(_STATICALLY_LINKED)
 CComModule _Module;
 #endif /* _STATICALLY_LINKED */
 
 -148,11
+149,11 
         , m_ulDIBitsWidth(0)
         , m_ulDIBitsHeight(0)
         , m_hOldBitmap(0)
         , m_bOLEInitialized(FALSE)
     , m_pPollingCallback(NULL)
-        , m_ulPollingInterval(250)
+        , m_ulPollingInterval(150)
         , m_bStopPollingCallback(FALSE)
 {
     HXLOGL4(HXLOG_FPHR, "CON CFlashGuestPlayerAX
this=%p", this);
     // The ActiveX-based guest player by default does NOT
handle the 
file i/o
     // but lets the flash ActiveX control handle it.
 -277,10
+278,23 
             {
                 // Set the player state to initialized
                
SetGuestPlayerState(HXGUEST_STATE_PLAYER_INITIALIZED);
             }
         }
+
+    // Get the polling interval
+    IHXBuffer* pInterval = NULL;
+    if (SUCCEEDED(ReadPrefStringBuffer(m_pContext, 
"FlashHostPollingInterval", pInterval)) &&
pInterval
+            && *((const
char*)pInterval->GetBuffer()) != '')
+    {
+        UINT32 ulPollingInterval=0;
+        if (sscanf((const char*)pInterval->GetBuffer(),
"%d", 
&ulPollingInterval) == 1)
+        {
+        m_ulPollingInterval = ulPollingInterval;
+        }
+    }
+
     }
 
     return retVal;
 }
 
 -480,11
+494,11 
             }
 
         if (m_bIsFLVSource)
         {
                 // When we have FLV playback, we pass in a
simple wrapper
-                // SWF from a resource which simply tels
the Flash player
+                // SWF from a resource which simply tells
the Flash player
                 // to play an FLV from the URL we provide.
                 IHXFileObject* pWrapperSWFFileObject =
NULL;
                 UINT32         ulWrapperSWFFileSize  = 0;
                 retVal =
GetFLVWrapperFileObject(pWrapperSWFFileObject, 
ulWrapperSWFFileSize);
         if (SUCCEEDED(retVal))
 -505,10
+519,16 
                     m_pFileObject    =
pWrapperSWFFileObject;
                     // Our ref on the wrapper swf file
object has been 
transferred
                     pWrapperSWFFileObject = NULL;
                     // Get the wrapper SWF URL
                    
CFlashGuestPlayer::GetFlashLocalURL(m_strURL);
+            //XXXctd Call DisableLocalSecurity to enable
trusted 
communication between FLV and the wrapper swf
+            // We may need to revert back to using the
polling command 
(GetVariable) fix for custom wrapper swf's.
+            if (m_lFlashVersion >= 8)
+            {
+            m_pFlashPlayer->DisableLocalSecurity();
+            }
                     // Make path consistent with the file
object
                     FixFlashURL(m_strURL, m_pContext);
         }
 
         // Set the FLV source URL
 -3171,10
+3191,17 
         }
         HX_RELEASE(m_pPollingCallback);
     }
     else
     {
+    HXBOOL bProcessNextCommand=FALSE;
+    UINT32 ulLoopEntryTime = HX_GET_BETTERTICKCOUNT();
+
+    do
+    {
+        bProcessNextCommand = FALSE;
+
     // Get the variable "FlashCommand" from the
SWF
     CHXString strReturn;
     try {
         _bstr_t
bstrReturn(m_pFlashPlayer->GetVariable("FlashCommand
"));
         if (bstrReturn.length() > 0)
 -3186,24
+3213,28 
     } catch (...)
     {
         HXLOGL4(HXLOG_FPHR, "GetVariable
FAILED");
     }
 
+        if (!strReturn.IsEmpty())
+        {
+        // Clear the command once we have the data, shift
the next 
command into the FlashCommand var.
+        //CHXString strResponse;
+        //strResponse = strReturn + ";
Result=HXR_OK";
+        //SendFlashMessage("GetFlashCommand",
strResponse); // Future 
enhancement
+        SendFlashMessage("GetFlashCommand");
+
     if
(strReturn.Find("HXExternalInterfaceStatus") >=
0)
     {
-            SendFlashMessage("GetFlashCommand");
// Clear the command
         if (!m_bStopPollingCallback)
         {
         // If we have reached this point, we know that 
ExternalInterface.call is not working.
             HXLOGL4(HXLOG_FPHR,
"ExternalInterface.call failed, using 
GetVariable to receive Flash commands.");
         }
     }
-    else if (!strReturn.IsEmpty())
+        else
     {
-        // Clear the command once we have the data, shift
the next 
command into the FlashCommand var.
-            SendFlashMessage("GetFlashCommand");
-
         // Extract the invoke name and its args
         // Variable will be of the form 
,[invokeArg1[,invokeArg2[,invokeArgN]]], e.g., 
"HXFullScreen,true"
         CHXString strInvokeName = strReturn;
         CHXString strInvokeArgs;
         INT16 nIndex = strReturn.Find(',');
 -3224,10
+3255,18 
             FlashCall(bstrRequest);
         }
         }
     }
        
+        if ((HX_GET_BETTERTICKCOUNT() - ulLoopEntryTime)
< 200)
+        {
+            // dequeue next command
+            bProcessNextCommand = TRUE;
+        }
+        }
+    } while (bProcessNextCommand);
+       
     // Schedule another callback
     if (m_pPollingCallback &&
         !m_pPollingCallback->IsCallbackPending()
&& m_ulPollingInterval 
 > 0)
     {
        
m_pPollingCallback->ScheduleRelative(m_pScheduler, 
m_ulPollingInterval);


_______________________________________________
Datatype-dev mailing list
Datatype-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/da
tatype-dev

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )