Bug 1340129: P1. Allow empty raw frames. r=gerald

MozReview-Commit-ID: AU0QrahHtYe

--HG--
extra : rebase_source : 34604298e01db1b7b481fc55c25cb5f23e806fa2
This commit is contained in:
Jean-Yves Avenard 2017-02-16 23:41:44 +01:00
parent 5e01f5beb4
commit 52e09e4b68
4 changed files with 5 additions and 5 deletions

View File

@ -112,7 +112,7 @@ WidevineVideoDecoder::Decode(GMPVideoEncodedFrame* aInputFrame,
RefPtr<MediaRawData> raw( RefPtr<MediaRawData> raw(
new MediaRawData(aInputFrame->Buffer(), aInputFrame->Size())); new MediaRawData(aInputFrame->Buffer(), aInputFrame->Size()));
if (!raw->Data()) { if (aInputFrame->Size() && !raw->Data()) {
// OOM. // OOM.
mCallback->Error(GMPAllocErr); mCallback->Error(GMPAllocErr);
return; return;

View File

@ -128,7 +128,7 @@ VideoDecoderParent::RecvInput(const MediaRawDataIPDL& aData)
// we'd just take ownership of the shmem. // we'd just take ownership of the shmem.
RefPtr<MediaRawData> data = new MediaRawData(aData.buffer().get<uint8_t>(), RefPtr<MediaRawData> data = new MediaRawData(aData.buffer().get<uint8_t>(),
aData.buffer().Size<uint8_t>()); aData.buffer().Size<uint8_t>());
if (!data->Data()) { if (aData.buffer().Size<uint8_t>() && !data->Data()) {
// OOM // OOM
Error(NS_ERROR_OUT_OF_MEMORY); Error(NS_ERROR_OUT_OF_MEMORY);
return IPC_OK(); return IPC_OK();

View File

@ -248,7 +248,7 @@ OggCodecState::PacketOutAsMediaRawData()
!IsHeader(packet.get()), !IsHeader(packet.get()),
"PacketOutAsMediaRawData can only be called on non-header packets"); "PacketOutAsMediaRawData can only be called on non-header packets");
RefPtr<MediaRawData> sample = new MediaRawData(packet->packet, packet->bytes); RefPtr<MediaRawData> sample = new MediaRawData(packet->packet, packet->bytes);
if (!sample->Data()) { if (packet->bytes && !sample->Data()) {
// OOM. // OOM.
return nullptr; return nullptr;
} }

View File

@ -702,13 +702,13 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType,
RefPtr<MediaRawData> sample; RefPtr<MediaRawData> sample;
if (mInfo.mVideo.HasAlpha() && alphaLength != 0) { if (mInfo.mVideo.HasAlpha() && alphaLength != 0) {
sample = new MediaRawData(data, length, alphaData, alphaLength); sample = new MediaRawData(data, length, alphaData, alphaLength);
if (!sample->Data() || !sample->AlphaData()) { if ((length && !sample->Data()) || (alphaLength && !sample->AlphaData())) {
// OOM. // OOM.
return false; return false;
} }
} else { } else {
sample = new MediaRawData(data, length); sample = new MediaRawData(data, length);
if (!sample->Data()) { if (length && !sample->Data()) {
// OOM. // OOM.
return false; return false;
} }