Bug 1414213. P1 - H264::NumSPS() should return 0 if aExtraData is empty. r=jya
authorJW Wang <jwwang@mozilla.com>
Fri, 03 Nov 2017 17:40:32 +0800
changeset 443546 fe1d819e6cca883629d37b7cf055894ded17658f
parent 443545 408257c94413fe9376d282edcb53097764be1491
child 443547 bbe8f621038333bea5eb4f6cbf157d1030166700
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1414213
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414213. P1 - H264::NumSPS() should return 0 if aExtraData is empty. r=jya MozReview-Commit-ID: JTzEqYt9mQr
media/libstagefright/binding/H264.cpp
--- a/media/libstagefright/binding/H264.cpp
+++ b/media/libstagefright/binding/H264.cpp
@@ -957,17 +957,17 @@ H264::ExtractExtraData(const mozilla::Me
 H264::HasSPS(const mozilla::MediaByteBuffer* aExtraData)
 {
   return NumSPS(aExtraData) > 0;
 }
 
 /* static */ uint8_t
 H264::NumSPS(const mozilla::MediaByteBuffer* aExtraData)
 {
-  if (!aExtraData) {
+  if (!aExtraData || aExtraData->IsEmpty()) {
     return 0;
   }
 
   BufferReader reader(aExtraData);
   const uint8_t* ptr = reader.Read(5);
   auto res = reader.ReadU8();
   if (!ptr || res.isErr()) {
     return 0;