Bug 1609417 - don't treat 0 size samples as an error in RemoteDecoderParent::DecodeNextSample. r=jya

Vorbis can send a 0-length sample, and we want to let the decoder deal
with the handling the error returning a NS_ERROR_DOM_MEDIA_DECODE_ERR, instead
of RemoteDecoderParent::DecodeNextSample returning NS_ERROR_OUT_OF_MEMORY.  Only
return NS_ERROR_OUT_OF_MEMORY if MediaRawData is smaller than the actual sample
size recorded in MediaRawDataIPDL that comes from RemoteDecoderChild::Decode.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Froman 2020-01-22 02:34:16 +00:00
parent cf930c4250
commit ae688ea6fa

View File

@ -82,7 +82,9 @@ void RemoteDecoderParent::DecodeNextSample(nsTArray<MediaRawDataIPDL>&& aData,
rawData.buffer().get<uint8_t>(),
std::min((unsigned long)rawData.bufferSize(),
(unsigned long)rawData.buffer().Size<uint8_t>()));
if (rawData.buffer().Size<uint8_t>() && !data->Data()) {
// if MediaRawData's size is less than the actual buffer size recorded
// in MediaRawDataIPDL, consider it an OOM situation.
if ((int64_t)data->Size() < rawData.bufferSize()) {
// OOM
ReleaseUsedShmems();
aResolver(MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__));