Bug 1250635 - remove ENABLE_TESTS from dom/media cpp files. r=esawin
authorJoel Maher <jmaher@mozilla.com>
Tue, 23 Feb 2016 12:04:27 -0800
changeset 285591 7bcbdd73b99f84aef3da7e68ea1b54d49f9841d8
parent 285590 2899d594244e661e00b7cbe47def2164792475d2
child 285592 3a55e7c48a530eab188db1e011ede8498c2190fc
push id17831
push userkwierso@gmail.com
push dateThu, 25 Feb 2016 22:42:17 +0000
treeherderfx-team@8e34b12969bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1250635
milestone47.0a1
Bug 1250635 - remove ENABLE_TESTS from dom/media cpp files. r=esawin MozReview-Commit-ID: D6T1253vNwP
dom/media/ADTSDemuxer.cpp
dom/media/ADTSDemuxer.h
dom/media/MP3Demuxer.cpp
dom/media/MP3Demuxer.h
--- a/dom/media/ADTSDemuxer.cpp
+++ b/dom/media/ADTSDemuxer.cpp
@@ -188,38 +188,30 @@ private:
 
 class FrameParser {
 public:
 
   // Returns the currently parsed frame. Reset via Reset or EndFrameSession.
   const Frame& CurrentFrame() const { return mFrame; }
 
 
-#ifdef ENABLE_TESTS
-  // Returns the previously parsed frame. Reset via Reset.
-  const Frame& PrevFrame() const { return mPrevFrame; }
-#endif
-
   // Returns the first parsed frame. Reset via Reset.
   const Frame& FirstFrame() const { return mFirstFrame; }
 
   // Resets the parser. Don't use between frames as first frame data is reset.
   void Reset() {
     EndFrameSession();
     mFirstFrame.Reset();
   }
 
   // Clear the last parsed frame to allow for next frame parsing, i.e.:
   // - sets PrevFrame to CurrentFrame
   // - resets the CurrentFrame
   // - resets ID3Header if no valid header was parsed yet
   void EndFrameSession() {
-#ifdef ENABLE_TESTS
-    mPrevFrame = mFrame;
-#endif
     mFrame.Reset();
   }
 
   // Parses contents of given ByteReader for a valid frame header and returns true
   // if one was found. After returning, the variable passed to 'aBytesToSkip' holds
   // the amount of bytes to be skipped (if any) in order to jump across a large
   // ID3v2 tag spanning multiple buffers.
   bool Parse(int64_t aOffset, uint8_t* aStart, uint8_t* aEnd) {
@@ -232,19 +224,16 @@ public:
     return found;
   }
 
 private:
   // We keep the first parsed frame around for static info access, the
   // previously parsed frame for debugging and the currently parsed frame.
   Frame mFirstFrame;
   Frame mFrame;
-#ifdef ENABLE_TESTS
-  Frame mPrevFrame;
-#endif
 };
 
 
 // Return the AAC Profile Level Indication based upon sample rate and channels
 // Information based upon table 1.10 from ISO/IEC 14496-3:2005(E)
 static int8_t
 ProfileLevelIndication(const Frame& frame)
 {
@@ -431,36 +420,16 @@ ADTSTrackDemuxer::Init()
   InitAudioSpecificConfig(mParser->FirstFrame(), mInfo->mCodecSpecificConfig);
 
   ADTSLOG("Init mInfo={mRate=%u mChannels=%u mBitDepth=%u mDuration=%" PRId64 "}",
           mInfo->mRate, mInfo->mChannels, mInfo->mBitDepth, mInfo->mDuration);
 
   return mSamplesPerSecond && mChannels;
 }
 
-#ifdef ENABLE_TESTS
-const adts::Frame&
-ADTSTrackDemuxer::LastFrame() const
-{
-  return mParser->PrevFrame();
-}
-
-RefPtr<MediaRawData>
-ADTSTrackDemuxer::DemuxSample()
-{
-  return GetNextFrame(FindNextFrame());
-}
-
-media::TimeUnit
-ADTSTrackDemuxer::SeekPosition() const
-{
-  return Duration(mFrameIndex);
-}
-#endif
-
 UniquePtr<TrackInfo>
 ADTSTrackDemuxer::GetInfo() const
 {
   return mInfo->Clone();
 }
 
 RefPtr<ADTSTrackDemuxer::SeekPromise>
 ADTSTrackDemuxer::Seek(media::TimeUnit aTime)
--- a/dom/media/ADTSDemuxer.h
+++ b/dom/media/ADTSDemuxer.h
@@ -54,22 +54,16 @@ public:
 
   // Returns the estimated stream duration, or a 0-duration if unknown.
   media::TimeUnit Duration() const;
 
   // Returns the estimated duration up to the given frame number,
   // or a 0-duration if unknown.
   media::TimeUnit Duration(int64_t aNumFrames) const;
 
-#ifdef ENABLE_TESTS
-  const adts::Frame& LastFrame() const;
-  RefPtr<MediaRawData> DemuxSample();
-  media::TimeUnit SeekPosition() const;
-#endif
-
   // MediaTrackDemuxer interface.
   UniquePtr<TrackInfo> GetInfo() const override;
   RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
   void Reset() override;
   RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(
     media::TimeUnit aTimeThreshold) override;
   int64_t GetResourceOffset() const override;
--- a/dom/media/MP3Demuxer.cpp
+++ b/dom/media/MP3Demuxer.cpp
@@ -152,27 +152,25 @@ media::TimeUnit
 MP3TrackDemuxer::SeekPosition() const {
   TimeUnit pos = Duration(mFrameIndex);
   if (Duration() > TimeUnit()) {
     pos = std::min(Duration(), pos);
   }
   return pos;
 }
 
-#ifdef ENABLE_TESTS
 const FrameParser::Frame&
 MP3TrackDemuxer::LastFrame() const {
   return mParser.PrevFrame();
 }
 
 RefPtr<MediaRawData>
 MP3TrackDemuxer::DemuxSample() {
   return GetNextFrame(FindNextFrame());
 }
-#endif
 
 const ID3Parser::ID3Header&
 MP3TrackDemuxer::ID3Header() const {
   return mParser.ID3Header();
 }
 
 const FrameParser::VBRHeader&
 MP3TrackDemuxer::VBRInfo() const {
@@ -656,33 +654,29 @@ FrameParser::Reset() {
 }
 
 void
 FrameParser::EndFrameSession() {
   if (!mID3Parser.Header().IsValid()) {
     // Reset ID3 tags only if we have not parsed a valid ID3 header yet.
     mID3Parser.Reset();
   }
-#ifdef ENABLE_TESTS
   mPrevFrame = mFrame;
-#endif
   mFrame.Reset();
 }
 
 const FrameParser::Frame&
 FrameParser::CurrentFrame() const {
   return mFrame;
 }
 
-#ifdef ENABLE_TESTS
 const FrameParser::Frame&
 FrameParser::PrevFrame() const {
   return mPrevFrame;
 }
-#endif
 
 const FrameParser::Frame&
 FrameParser::FirstFrame() const {
   return mFirstFrame;
 }
 
 const ID3Parser::ID3Header&
 FrameParser::ID3Header() const {
--- a/dom/media/MP3Demuxer.h
+++ b/dom/media/MP3Demuxer.h
@@ -292,20 +292,18 @@ public:
   };
 
   // Constructor.
   FrameParser();
 
   // Returns the currently parsed frame. Reset via Reset or EndFrameSession.
   const Frame& CurrentFrame() const;
 
-#ifdef ENABLE_TESTS
   // Returns the previously parsed frame. Reset via Reset.
   const Frame& PrevFrame() const;
-#endif
 
   // Returns the first parsed frame. Reset via Reset.
   const Frame& FirstFrame() const;
 
   // Returns the parsed ID3 header. Note: check for validity.
   const ID3Parser::ID3Header& ID3Header() const;
 
   // Returns the parsed VBR header info. Note: check for validity by type.
@@ -338,19 +336,17 @@ private:
 
   // VBR header parser.
   VBRHeader mVBRHeader;
 
   // We keep the first parsed frame around for static info access, the
   // previously parsed frame for debugging and the currently parsed frame.
   Frame mFirstFrame;
   Frame mFrame;
-#ifdef ENABLE_TESTS
   Frame mPrevFrame;
-#endif
 };
 
 // The MP3 demuxer used to extract MPEG frames and side information out of
 // MPEG streams.
 class MP3TrackDemuxer : public MediaTrackDemuxer {
 public:
   // Constructor, expecting a valid media resource.
   explicit MP3TrackDemuxer(MediaResource* aSource);
@@ -367,20 +363,18 @@ public:
 
   // Returns the estimated duration up to the given frame number,
   // or a 0-duration if unknown.
   media::TimeUnit Duration(int64_t aNumFrames) const;
 
   // Returns the estimated current seek position time.
   media::TimeUnit SeekPosition() const;
 
-#ifdef ENABLE_TESTS
   const FrameParser::Frame& LastFrame() const;
   RefPtr<MediaRawData> DemuxSample();
-#endif
 
   const ID3Parser::ID3Header& ID3Header() const;
   const FrameParser::VBRHeader& VBRInfo() const;
 
   // MediaTrackDemuxer interface.
   UniquePtr<TrackInfo> GetInfo() const override;
   RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;