Bug 1313398: P2. Always check for SPS/PPS inband. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 31 May 2017 16:15:45 +0200
changeset 361781 18c7e0ab522082c69fe0b3e7b0fe1feb3f84c833
parent 361780 45edd8ee9c43a746c40d01cba280e6949f271540
child 361782 fb7c6768faf53c6000f5021e3686590bec0eab41
push id31942
push userryanvm@gmail.com
push dateThu, 01 Jun 2017 15:54:15 +0000
treeherdermozilla-central@cac2fd43de81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1313398
milestone55.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 1313398: P2. Always check for SPS/PPS inband. r=gerald Ignore the known out of band extradata. MozReview-Commit-ID: 8ARjrTtxhwY
media/libstagefright/binding/AnnexB.cpp
media/libstagefright/binding/include/mp4_demuxer/AnnexB.h
--- a/media/libstagefright/binding/AnnexB.cpp
+++ b/media/libstagefright/binding/AnnexB.cpp
@@ -272,21 +272,16 @@ AnnexB::ConvertSampleToAVCC(mozilla::Med
 }
 
 already_AddRefed<mozilla::MediaByteBuffer>
 AnnexB::ExtractExtraData(const mozilla::MediaRawData* aSample)
 {
   MOZ_ASSERT(IsAVCC(aSample));
 
   RefPtr<mozilla::MediaByteBuffer> extradata = new mozilla::MediaByteBuffer;
-  if (HasSPS(aSample->mExtraData)) {
-    // We already have an explicit extradata, re-use it.
-    extradata = aSample->mExtraData;
-    return extradata.forget();
-  }
 
   // SPS content
   mozilla::Vector<uint8_t> sps;
   ByteWriter spsw(sps);
   int numSps = 0;
   // PPS content
   mozilla::Vector<uint8_t> pps;
   ByteWriter ppsw(pps);
--- a/media/libstagefright/binding/include/mp4_demuxer/AnnexB.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/AnnexB.h
@@ -24,19 +24,18 @@ public:
   // Convert a sample from Annex B to AVCC.
   // an AVCC extradata must not be set.
   static bool ConvertSampleToAVCC(mozilla::MediaRawData* aSample);
   static bool ConvertSampleTo4BytesAVCC(mozilla::MediaRawData* aSample);
 
   // Parse an AVCC extradata and construct the Annex B sample header.
   static already_AddRefed<mozilla::MediaByteBuffer> ConvertExtraDataToAnnexB(
     const mozilla::MediaByteBuffer* aExtraData);
-  // Extract SPS and PPS NALs from aSample, aSample must be in AVCC format.
-  // If aSample already contains an extradata with an SPS, it will be returned
-  // otherwise the SPS/PPS NALs are searched in-band.
+  // Extract SPS and PPS NALs from aSample by looking into each NALs.
+  // aSample must be in AVCC format.
   static already_AddRefed<mozilla::MediaByteBuffer> ExtractExtraData(
     const mozilla::MediaRawData* aSample);
   static bool HasSPS(const mozilla::MediaRawData* aSample);
   static bool HasSPS(const mozilla::MediaByteBuffer* aExtraData);
   // Returns true if format is AVCC and sample has valid extradata.
   static bool IsAVCC(const mozilla::MediaRawData* aSample);
   // Returns true if format is AnnexB.
   static bool IsAnnexB(const mozilla::MediaRawData* aSample);