Skip to content

Commit

Permalink
Bug 1273774. Part 2 - do decoding jobs synchronously without dispatch…
Browse files Browse the repository at this point in the history
…ing. r=jya.

MozReview-Commit-ID: CkGrZfgEIhu

--HG--
extra : rebase_source : 0407045b22206a790d38ca5e4fa92e088564a042
  • Loading branch information
jwwang committed May 18, 2016
1 parent 1658845 commit 8e5351a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
28 changes: 2 additions & 26 deletions dom/media/platforms/agnostic/WAVDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,10 @@ WaveDataDecoder::Init()
nsresult
WaveDataDecoder::Input(MediaRawData* aSample)
{
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
this, &WaveDataDecoder::ProcessDecode, aSample));

return NS_OK;
}

void
WaveDataDecoder::ProcessDecode(MediaRawData* aSample)
{
if (mIsFlushing) {
return;
}
if (!DoDecode(aSample)) {
mCallback->Error();
} else if (mTaskQueue->IsEmpty()) {
mCallback->InputExhausted();
}
return NS_OK;
}

bool
Expand Down Expand Up @@ -149,27 +136,16 @@ WaveDataDecoder::DoDecode(MediaRawData* aSample)
return true;
}

void
WaveDataDecoder::ProcessDrain()
{
mCallback->DrainComplete();
}

nsresult
WaveDataDecoder::Drain()
{
mTaskQueue->Dispatch(NewRunnableMethod(this, &WaveDataDecoder::ProcessDrain));
mCallback->DrainComplete();
return NS_OK;
}

nsresult
WaveDataDecoder::Flush()
{
mIsFlushing = true;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([this] () {
});
SyncRunnable::DispatchToThread(mTaskQueue, r);
mIsFlushing = false;
return NS_OK;
}

Expand Down
2 changes: 0 additions & 2 deletions dom/media/platforms/agnostic/WAVDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class WaveDataDecoder : public MediaDataDecoder
return "wave audio decoder";
}

void ProcessDecode(MediaRawData* aSample);
bool DoDecode(MediaRawData* aSample);
void ProcessDrain();

const AudioInfo& mInfo;
const RefPtr<TaskQueue> mTaskQueue;
Expand Down

0 comments on commit 8e5351a

Please sign in to comment.