Bug 1361984 - Fix the logic of AnnexB::ConvertSampleToAnnexB that checks the sample's extradata field even the sample is AVCC format converted by ConvertSampleToAVCC from AnnexB format. r=jya

MozReview-Commit-ID: C5cAlvRwkYj

--HG--
extra : rebase_source : 58e0ea5939446f21395a417ce23ffd2b91f5d83c
This commit is contained in:
James Cheng 2017-05-11 16:43:12 +08:00
parent 3a65ebf0a5
commit bbc9597929

View File

@ -22,12 +22,12 @@ AnnexB::ConvertSampleToAnnexB(mozilla::MediaRawData* aSample, bool aAddSPS)
{
MOZ_ASSERT(aSample);
if (!IsAVCC(aSample)) {
if (IsAnnexB(aSample)) {
return true;
}
MOZ_ASSERT(aSample->Data());
if (!ConvertSampleTo4BytesAVCC(aSample)) {
if (IsAVCC(aSample) && !ConvertSampleTo4BytesAVCC(aSample)) {
return false;
}
@ -63,7 +63,7 @@ AnnexB::ConvertSampleToAnnexB(mozilla::MediaRawData* aSample, bool aAddSPS)
}
// Prepend the Annex B NAL with SPS and PPS tables to keyframes.
if (aAddSPS && aSample->mKeyframe) {
if (aAddSPS && aSample->mKeyframe && IsAVCC(aSample)) {
RefPtr<MediaByteBuffer> annexB =
ConvertExtraDataToAnnexB(aSample->mExtraData);
if (!samplewriter->Prepend(annexB->Elements(), annexB->Length())) {