mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 1340582 - handle shared memory allocation failure. r=jchen
MozReview-Commit-ID: ETk9nHHkyYA
This commit is contained in:
parent
83ea92dc1b
commit
584224e8cd
@ -584,9 +584,11 @@ RemoteDataDecoder::Decode(MediaRawData* aSample)
|
||||
bufferInfo->Set(0, sample->Size(), sample->mTime, 0);
|
||||
|
||||
mDrainStatus = DrainStatus::DRAINABLE;
|
||||
RefPtr<DecodePromise> p = mDecodePromise.Ensure(__func__);
|
||||
mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(sample));
|
||||
return p;
|
||||
return mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(sample))
|
||||
? mDecodePromise.Ensure(__func__)
|
||||
: DecodePromise::CreateAndReject(
|
||||
MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -177,29 +177,25 @@ public final class CodecProxy {
|
||||
}
|
||||
mRemote.queueInput(sample);
|
||||
sample.dispose();
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
} catch (RemoteException | IOException e) {
|
||||
Log.e(LOGTAG, "fail to input sample: size=" + info.size +
|
||||
", pts=" + info.presentationTimeUs +
|
||||
", flags=" + Integer.toHexString(info.flags));
|
||||
", flags=" + Integer.toHexString(info.flags) +
|
||||
", e=" + e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Sample processInput(ByteBuffer bytes, BufferInfo info, CryptoInfo cryptoInfo) throws RemoteException {
|
||||
private Sample processInput(ByteBuffer bytes, BufferInfo info, CryptoInfo cryptoInfo)
|
||||
throws RemoteException, IOException {
|
||||
if (info.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
|
||||
mCallbacks.setEndOfInput(true);
|
||||
return Sample.EOS;
|
||||
} else {
|
||||
mCallbacks.setEndOfInput(false);
|
||||
try {
|
||||
return mRemote.dequeueInput(info.size).set(bytes, info, cryptoInfo);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return mRemote.dequeueInput(info.size).set(bytes, info, cryptoInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user