Bug 1365227: P1. Create AVCC header for converted annexB. r=JamesCheng

Otherwise AnnexB::IsAVCC will return false on those converted samples.

MozReview-Commit-ID: 6OBV6L49InL

--HG--
extra : rebase_source : b4c315583392cfe455d0932f4345a8a02e367f2f
This commit is contained in:
Jean-Yves Avenard 2017-05-16 14:22:43 +02:00
parent 7a4b622a04
commit dd9e7bd359

View File

@ -250,7 +250,25 @@ AnnexB::ConvertSampleToAVCC(mozilla::MediaRawData* aSample)
return false;
}
nsAutoPtr<MediaRawDataWriter> samplewriter(aSample->CreateWriter());
return samplewriter->Replace(nalu.begin(), nalu.length());
if (!samplewriter->Replace(nalu.begin(), nalu.length())) {
return false;
}
// Create the AVCC header.
RefPtr<mozilla::MediaByteBuffer> extradata = new mozilla::MediaByteBuffer;
static const uint8_t kFakeExtraData[] = {
1 /* version */,
0x64 /* profile (High) */,
0 /* profile compat (0) */,
40 /* level (40) */,
0xfc | 3 /* nal size - 1 */,
0xe0 /* num SPS (0) */,
0 /* num PPS (0) */
};
if (!extradata->AppendElements(kFakeExtraData, ArrayLength(kFakeExtraData))) {
return false;
}
aSample->mExtraData = extradata;
return true;
}
already_AddRefed<mozilla::MediaByteBuffer>