Added mutex to image stream thread to serialize calls to Quicktime.

This commit is contained in:
Robert Osfield 2004-07-06 15:10:33 +00:00
parent 105c3568f8
commit 3c7dfa389d

View File

@ -129,6 +129,8 @@ void QuicktimeImageStream::load(std::string fileName)
void QuicktimeImageStream::run()
{
static OpenThreads::Mutex s_qtMutex;
bool playing = false;
bool done = false;
OSErr err;
@ -140,6 +142,9 @@ void QuicktimeImageStream::run()
// osg::notify(osg::ALWAYS) << "movietime: " << _data->getMovieTime() << " state " << getCmd() << std::endl;
// Handle commands
ThreadCommand cmd = getCmd();
s_qtMutex.lock();
if (cmd != THREAD_IDLE) {
switch (cmd) {
case THREAD_START: // Start or continue stream
@ -175,6 +180,9 @@ void QuicktimeImageStream::run()
MoviesTask(_data->getMovie(),0);
float currentTime = _data->getMovieTime();
s_qtMutex.unlock();
if (_lastUpdate!= currentTime) {
dirty();
_lastUpdate = currentTime;