Bug 1542440 - Recycle sample directly rather than through CodecProxy. r=jya

mJavaDecoder is invalid after the decoder is shut down and should never
be used.

Differential Revision: https://phabricator.services.mozilla.com/D26438

--HG--
extra : moz-landing-system : lando
This commit is contained in:
John Lin 2019-04-08 09:16:20 +00:00
parent ef3c576ac4
commit 2441080e34
3 changed files with 3 additions and 14 deletions

View File

@ -243,7 +243,7 @@ class RemoteVideoDecoder : public RemoteDataDecoder {
AssertOnTaskQueue();
if (GetState() == State::SHUTDOWN) {
mJavaDecoder->DisposeOutput(aSample);
aSample->Dispose();
return;
}
@ -427,7 +427,7 @@ class RemoteAudioDecoder : public RemoteDataDecoder {
AssertOnTaskQueue();
if (GetState() == State::SHUTDOWN || !aBuffer->IsValid()) {
mJavaDecoder->DisposeOutput(aSample);
aSample->Dispose();
return;
}

View File

@ -412,18 +412,6 @@ public final class CodecProxy {
return true;
}
// Dispose Sample objects without sending requests to remote codec.
// Native callbacks use this method instead of releaseOutput() to save
// unnecessary IPC calls when recycling samples that have been released by
// release() or flush().
@WrapForJNI
public void disposeOutput(final Sample sample) {
if (mOutputSurface != null) {
mSurfaceOutputs.remove(sample);
}
sample.dispose();
}
/* package */ void reportError(final boolean fatal) {
mCallbacks.reportError(fatal);
}

View File

@ -98,6 +98,7 @@ public final class Sample implements Parcelable {
crypto.mode);
}
@WrapForJNI
public void dispose() {
if (isEOS()) {
return;