Henry's Media Fixes

This commit is contained in:
Siana Gearz
2010-11-11 22:00:01 +01:00
parent 5a49ceab6d
commit c06db583a2
11 changed files with 287 additions and 84 deletions

View File

@@ -303,8 +303,14 @@ void LLPluginMessagePipe::processInput(void)
while((delim = mInput.find(MESSAGE_DELIMITER, start)) != std::string::npos)
{
// Let the owner process this message
if (mOwner)
{
mOwner->receiveMessageRaw(mInput.substr(start, delim - start));
}
else
{
LL_WARNS("Plugin") << "!mOwner" << LL_ENDL;
}
start = delim + 1;
}

View File

@@ -53,8 +53,14 @@ LLPluginProcessChild::~LLPluginProcessChild()
if(mInstance != NULL)
{
sendMessageToPlugin(LLPluginMessage("base", "cleanup"));
delete mInstance;
mInstance = NULL;
// IMPORTANT: under some (unknown) circumstances the apr_dso_unload() triggered when mInstance is deleted
// appears to fail and lock up which means that a given instance of the slplugin process never exits.
// This is bad, especially when users try to update their version of SL - it fails because the slplugin
// process as well as a bunch of plugin specific files are locked and cannot be overwritten.
exit(0);
//delete mInstance;
//mInstance = NULL;
}
}
@@ -270,6 +276,8 @@ bool LLPluginProcessChild::isDone(void)
void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message)
{
if (mInstance)
{
std::string buffer = message.generate();
LL_DEBUGS("Plugin") << "Sending to plugin: " << buffer << LL_ENDL;
@@ -278,6 +286,11 @@ void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message)
mInstance->sendMessage(buffer);
mCPUElapsed += elapsed.getElapsedTimeF64();
}
else
{
LL_WARNS("Plugin") << "mInstance == NULL" << LL_ENDL;
}
}
void LLPluginProcessChild::sendMessageToParent(const LLPluginMessage &message)
@@ -352,6 +365,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
else
{
LL_WARNS("Plugin") << "Couldn't create a shared memory segment!" << LL_ENDL;
delete region;
}
}

View File

@@ -53,7 +53,7 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
mDebug = false;
mPluginLaunchTimeout = 60.0f;
mPluginLockupTimeout = 30.0f;
mPluginLockupTimeout = 15.0f;
// Don't start the timer here -- start it when we actually launch the plugin process.
mHeartbeat.stop();

View File

@@ -203,6 +203,8 @@ int main(int argc, char **argv)
// see the missing heartbeat and log appropriately.
initExceptionHandler();
#elif LL_DARWIN || LL_LINUX
setpriority(PRIO_PROCESS, getpid(), 19);
if(argc < 2)
{
LL_ERRS("slplugin") << "usage: " << argv[0] << " launcher_port" << LL_ENDL;
@@ -236,6 +238,9 @@ int main(int argc, char **argv)
checkExceptionHandler();
#endif
#if LL_DARWIN
EventTargetRef event_target = GetEventDispatcherTarget();
#endif
while(!plugin->isDone())
{
timer.reset();
@@ -243,8 +248,12 @@ int main(int argc, char **argv)
#if LL_DARWIN
{
// Some plugins (webkit at least) will want an event loop. This qualifies.
EventRecord evt;
WaitNextEvent(0, &evt, 0, NULL);
EventRef event;
if(ReceiveNextEvent(0, 0, kEventDurationNoWait, true, &event) == noErr)
{
SendEventToEventTarget (event, event_target);
ReleaseEvent(event);
}
}
#endif
F64 elapsed = timer.getElapsedTimeF64();