зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374774: P9. Only look for SPS changes in stream format change detection. r=gerald
All decoders appear capable of handling content change when just new PPS appears. So we restrict the test to SPS changes. MozReview-Commit-ID: LPSfMaTIj6C --HG-- extra : rebase_source : 524316ba61ffff1549a0828685ac657abe687426
This commit is contained in:
Родитель
0392b68694
Коммит
7d1e767817
|
@ -919,28 +919,51 @@ H264::ExtractExtraData(const mozilla::MediaRawData* aSample)
|
|||
|
||||
/* static */ bool
|
||||
H264::HasSPS(const mozilla::MediaByteBuffer* aExtraData)
|
||||
{
|
||||
return NumSPS(aExtraData) > 0;
|
||||
}
|
||||
|
||||
/* static */ uint8_t
|
||||
H264::NumSPS(const mozilla::MediaByteBuffer* aExtraData)
|
||||
{
|
||||
if (!aExtraData) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ByteReader reader(aExtraData);
|
||||
const uint8_t* ptr = reader.Read(5);
|
||||
if (!ptr || !reader.CanRead8()) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
uint8_t numSps = reader.ReadU8() & 0x1f;
|
||||
|
||||
return numSps > 0;
|
||||
return reader.ReadU8() & 0x1f;
|
||||
}
|
||||
|
||||
|
||||
/* static */ bool
|
||||
H264::CompareExtraData(const mozilla::MediaByteBuffer* aExtraData1,
|
||||
const mozilla::MediaByteBuffer* aExtraData2)
|
||||
{
|
||||
// Very crude comparison.
|
||||
return aExtraData1 == aExtraData2 || *aExtraData1 == *aExtraData2;
|
||||
if (aExtraData1 == aExtraData2) {
|
||||
return true;
|
||||
}
|
||||
uint8_t numSPS = NumSPS(aExtraData1);
|
||||
if (numSPS == 0 || numSPS != NumSPS(aExtraData2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We only compare if the SPS are the same as the various H264 decoders can
|
||||
// deal with in-band change of PPS.
|
||||
|
||||
SPSNALIterator it1(aExtraData1);
|
||||
SPSNALIterator it2(aExtraData2);
|
||||
|
||||
while (it1 && it2) {
|
||||
if (*it1 != *it2) {
|
||||
return false;
|
||||
}
|
||||
++it1;
|
||||
++it2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef READUE
|
||||
|
|
|
@ -457,6 +457,7 @@ private:
|
|||
static bool vui_parameters(BitReader& aBr, SPSData& aDest);
|
||||
// Read HRD parameters, all data is ignored.
|
||||
static void hrd_parameters(BitReader& aBr);
|
||||
static uint8_t NumSPS(const mozilla::MediaByteBuffer* aExtraData);
|
||||
};
|
||||
|
||||
} // namespace mp4_demuxer
|
||||
|
|
Загрузка…
Ссылка в новой задаче