diff --git a/dom/media/gmp/widevine-adapter/WidevineVideoDecoder.cpp b/dom/media/gmp/widevine-adapter/WidevineVideoDecoder.cpp index c0c60b5d0a31..288ef82b0cbc 100644 --- a/dom/media/gmp/widevine-adapter/WidevineVideoDecoder.cpp +++ b/dom/media/gmp/widevine-adapter/WidevineVideoDecoder.cpp @@ -112,7 +112,7 @@ WidevineVideoDecoder::Decode(GMPVideoEncodedFrame* aInputFrame, RefPtr raw( new MediaRawData(aInputFrame->Buffer(), aInputFrame->Size())); - if (!raw->Data()) { + if (aInputFrame->Size() && !raw->Data()) { // OOM. mCallback->Error(GMPAllocErr); return; diff --git a/dom/media/ipc/VideoDecoderParent.cpp b/dom/media/ipc/VideoDecoderParent.cpp index 71e52bf6fdda..7b46435fc699 100644 --- a/dom/media/ipc/VideoDecoderParent.cpp +++ b/dom/media/ipc/VideoDecoderParent.cpp @@ -128,7 +128,7 @@ VideoDecoderParent::RecvInput(const MediaRawDataIPDL& aData) // we'd just take ownership of the shmem. RefPtr data = new MediaRawData(aData.buffer().get(), aData.buffer().Size()); - if (!data->Data()) { + if (aData.buffer().Size() && !data->Data()) { // OOM Error(NS_ERROR_OUT_OF_MEMORY); return IPC_OK(); diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index e748448b8613..cc5c510b84be 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -248,7 +248,7 @@ OggCodecState::PacketOutAsMediaRawData() !IsHeader(packet.get()), "PacketOutAsMediaRawData can only be called on non-header packets"); RefPtr sample = new MediaRawData(packet->packet, packet->bytes); - if (!sample->Data()) { + if (packet->bytes && !sample->Data()) { // OOM. return nullptr; } diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index 5a5ba0ef363e..5276dec57438 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -702,13 +702,13 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, RefPtr sample; if (mInfo.mVideo.HasAlpha() && alphaLength != 0) { sample = new MediaRawData(data, length, alphaData, alphaLength); - if (!sample->Data() || !sample->AlphaData()) { + if ((length && !sample->Data()) || (alphaLength && !sample->AlphaData())) { // OOM. return false; } } else { sample = new MediaRawData(data, length); - if (!sample->Data()) { + if (length && !sample->Data()) { // OOM. return false; }