Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexp-sssup committed Aug 6, 2010
1 parent 4ae4ed6 commit cba812b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
18 changes: 12 additions & 6 deletions flashnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ void NetStream::execute()
uint32_t decodedAudioBytes=0;
//The decoded time is computed from the decodedAudioBytes to avoid drifts
uint32_t decodedTime=0;
bool waitForFlush=true;
try
{
Chronometer chronometer;
Expand Down Expand Up @@ -530,21 +531,26 @@ void NetStream::execute()
{
cout << e.cause << endl;
threadAbort();
waitForFlush=false;
}
catch(JobTerminationException& e)
{
waitForFlush=false;
}
catch(exception& e)
{
LOG(LOG_ERROR, "Exception in reading: "<<e.what());
}

//Put the decoders in the flushing state and wait for the complete consumption of contents
audioDecoder->setFlushing();
videoDecoder->setFlushing();

audioDecoder->waitFlushed();
videoDecoder->waitFlushed();
if(waitForFlush)
{
//Put the decoders in the flushing state and wait for the complete consumption of contents
audioDecoder->setFlushing();
videoDecoder->setFlushing();

audioDecoder->waitFlushed();
videoDecoder->waitFlushed();
}

sem_wait(&mutex);
sys->downloadManager->destroy(downloader);
Expand Down
4 changes: 1 addition & 3 deletions sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ void SoundManager::streamWriteCB(pa_stream* stream, size_t askedData, SoundStrea
while(frameSize);

if(totalWritten)
{
pa_stream_write(stream, dest, totalWritten, NULL, 0, PA_SEEK_RELATIVE);
pa_stream_cork(stream, 0, NULL, NULL); //Start the stream, just in case it's still stopped
}
else
pa_stream_cancel_write(stream);
//If the server asked for more data we have to sent it the inefficient way
Expand All @@ -160,6 +157,7 @@ void SoundManager::streamWriteCB(pa_stream* stream, size_t askedData, SoundStrea
pa_stream_write(stream, dest, totalWritten, NULL, 0, PA_SEEK_RELATIVE);
delete[] dest;
}
pa_stream_cork(stream, 0, NULL, NULL); //Start the stream, just in case it's still stopped
}

void SoundManager::freeStream(uint32_t id)
Expand Down
19 changes: 9 additions & 10 deletions swf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,7 @@ SWF_HEADER::SWF_HEADER(istream& in):valid(false)
LOG(LOG_NO_INFO,"No SWF file signature found");
return;
}
pt->version=Version;
in >> FrameSize >> FrameRate >> FrameCount;
float frameRate=FrameRate;
frameRate/=256;
LOG(LOG_NO_INFO,"FrameRate " << frameRate);

pt->root->setFrameRate(frameRate);
//TODO: setting render rate should be done when the clip is added to the displaylist
sys->setRenderRate(frameRate);
pt->root->version=Version;
pt->root->fileLenght=FileLength;
valid=true;
}

Expand Down Expand Up @@ -821,6 +811,15 @@ void ParseThread::execute()
SWF_HEADER h(f);
if(!h.valid)
throw ParseException("Not an SWF file");
version=h.Version;
root->version=h.Version;
root->fileLenght=h.FileLength;
float frameRate=h.FrameRate;
frameRate/=256;
LOG(LOG_NO_INFO,"FrameRate " << frameRate);
root->setFrameRate(frameRate);
//TODO: setting render rate should be done when the clip is added to the displaylist
sys->setRenderRate(frameRate);
root->setFrameSize(h.getFrameSize());
root->setFrameCount(h.FrameCount);

Expand Down

0 comments on commit cba812b

Please sign in to comment.