Backed out changeset a622dbe33efb (bug 1135544) for ASAN mochitest-3 bustage on CLOSED TREE
authorNigel Babu <nigelbabu@gmail.com>
Mon, 02 Mar 2015 18:13:39 +0530
changeset 247470 b768d5460be09d04308cec054a65ce0f9f728f25
parent 247469 1cd9344eb281a4ddbbbc3637b6a549e49b532275
child 247471 acc733decf7ac40e15931c5acdac4ad03644ce63
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-esr52@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1135544
milestone39.0a1
backs outa622dbe33efb6e9053073ebd8c51cbd3493111dd
Backed out changeset a622dbe33efb (bug 1135544) for ASAN mochitest-3 bustage on CLOSED TREE
dom/media/fmp4/MP4Reader.cpp
dom/media/fmp4/MP4Reader.h
dom/media/gtest/TestMP4Demuxer.cpp
media/libstagefright/binding/MP4TrackDemuxer.cpp
media/libstagefright/binding/include/demuxer/TrackDemuxer.h
media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
media/libstagefright/binding/include/mp4_demuxer/MP4TrackDemuxer.h
media/libstagefright/binding/include/mp4_demuxer/mp4_demuxer.h
media/libstagefright/moz.build
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -15,17 +15,16 @@
 #include "Layers.h"
 #include "SharedThreadPool.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/TimeRanges.h"
 #include "mp4_demuxer/AnnexB.h"
 #include "mp4_demuxer/H264.h"
 #include "SharedDecoderManager.h"
-#include "mp4_demuxer/MP4TrackDemuxer.h"
 
 #ifdef MOZ_EME
 #include "mozilla/CDMProxy.h"
 #endif
 
 using mozilla::layers::Image;
 using mozilla::layers::LayerManager;
 using mozilla::layers::LayersBackend;
@@ -328,18 +327,18 @@ bool MP4Reader::IsWaitingMediaResources(
   // whether *it* will decode, or whether we need to create a PDM to do the
   // decoding
   return IsWaitingOnCDMResource() || IsWaitingOnCodecResource();
 }
 
 void
 MP4Reader::ExtractCryptoInitData(nsTArray<uint8_t>& aInitData)
 {
-  MOZ_ASSERT(mCrypto.valid);
-  const nsTArray<mp4_demuxer::PsshInfo>& psshs = mCrypto.pssh;
+  MOZ_ASSERT(mDemuxer->Crypto().valid);
+  const nsTArray<mp4_demuxer::PsshInfo>& psshs = mDemuxer->Crypto().pssh;
   for (uint32_t i = 0; i < psshs.Length(); i++) {
     aInitData.AppendElements(psshs[i].data);
   }
 }
 
 bool
 MP4Reader::IsSupportedAudioMimeType(const char* aMimeType)
 {
@@ -380,43 +379,36 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo
     MonitorAutoLock mon(mDemuxerMonitor);
     bool ok = InvokeAndRetry(this, &MP4Reader::InitDemuxer, mStream, &mDemuxerMonitor);
     NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
     mIndexReady = true;
 
     // To decode, we need valid video and a place to put it.
     mInfo.mVideo.mHasVideo = mVideo.mActive = mDemuxer->HasValidVideo() &&
                                               mDecoder->GetImageContainer();
-    if (mVideo.mActive) {
-      mVideo.mTrackDemuxer = new MP4VideoDemuxer(mDemuxer);
-    }
 
     mInfo.mAudio.mHasAudio = mAudio.mActive = mDemuxer->HasValidAudio();
-    if (mAudio.mActive) {
-      mAudio.mTrackDemuxer = new MP4AudioDemuxer(mDemuxer);
-    }
-    mCrypto = mDemuxer->Crypto();
 
     {
       MonitorAutoUnlock unlock(mDemuxerMonitor);
       ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-      mInfo.mIsEncrypted = mIsEncrypted = mCrypto.valid;
+      mInfo.mIsEncrypted = mIsEncrypted = mDemuxer->Crypto().valid;
     }
 
     // Remember that we've initialized the demuxer, so that if we're decoding
     // an encrypted stream and we need to wait for a CDM to be set, we don't
     // need to reinit the demuxer.
     mDemuxerInitialized = true;
   } else if (mPlatform && !IsWaitingMediaResources()) {
     *aInfo = mInfo;
     *aTags = nullptr;
     return NS_OK;
   }
 
-  if (mCrypto.valid) {
+  if (mDemuxer->Crypto().valid) {
 #ifdef MOZ_EME
     // We have encrypted audio or video. We'll need a CDM to decrypt and
     // possibly decode this. Wait until we've received a CDM from the
     // JavaScript player app. Note: we still go through the motions here
     // even if EME is disabled, so that if script tries and fails to create
     // a CDM, we can detect that and notify chrome and show some UI explaining
     // that we failed due to EME being disabled.
     nsRefPtr<CDMProxy> proxy;
@@ -532,17 +524,17 @@ MP4Reader::ReadUpdatedMetadata(MediaInfo
 }
 
 bool
 MP4Reader::IsMediaSeekable()
 {
   // We can seek if we get a duration *and* the reader reports that it's
   // seekable.
   MonitorAutoLock mon(mDemuxerMonitor);
-  return mDecoder->GetResource()->IsTransportSeekable();
+  return mDecoder->GetResource()->IsTransportSeekable() && mDemuxer->CanSeek();
 }
 
 bool
 MP4Reader::HasAudio()
 {
   return mAudio.mActive;
 }
 
@@ -561,17 +553,17 @@ MP4Reader::GetDecoderData(TrackType aTra
   }
   return mVideo;
 }
 
 Microseconds
 MP4Reader::GetNextKeyframeTime()
 {
   MonitorAutoLock mon(mDemuxerMonitor);
-  return mVideo.mTrackDemuxer->GetNextKeyframeTime();
+  return mDemuxer->GetNextKeyframeTime();
 }
 
 bool
 MP4Reader::ShouldSkip(bool aSkipToNextKeyframe, int64_t aTimeThreshold)
 {
   // The MP4Reader doesn't do normal skip-to-next-keyframe if the demuxer
   // has exposes where the next keyframe is. We can then instead skip only
   // if the time threshold (the current playback position) is after the next
@@ -714,26 +706,26 @@ MP4Reader::Update(TrackType aTrack)
   VLOG("Update(%s) ni=%d no=%d iex=%d fl=%d",
        TrackTypeToStr(aTrack),
        needInput,
        needOutput,
        decoder.mInputExhausted,
        decoder.mIsFlushing);
 
   if (needInput) {
-    MediaSample* sample = PopSample(aTrack);
+    MP4Sample* sample = PopSample(aTrack);
 
     // Collect telemetry from h264 Annex B SPS.
-    if (sample && !mFoundSPSForTelemetry && AnnexB::HasSPS(sample->mMp4Sample)) {
-      nsRefPtr<ByteBuffer> extradata = AnnexB::ExtractExtraData(sample->mMp4Sample);
+    if (sample && !mFoundSPSForTelemetry && AnnexB::HasSPS(sample)) {
+      nsRefPtr<ByteBuffer> extradata = AnnexB::ExtractExtraData(sample);
       mFoundSPSForTelemetry = AccumulateSPSTelemetry(extradata);
     }
 
     if (sample) {
-      decoder.mDecoder->Input(sample->mMp4Sample.forget());
+      decoder.mDecoder->Input(sample);
       if (aTrack == kVideo) {
         parsed++;
       }
     } else {
       {
         MonitorAutoLock lock(decoder.mMonitor);
         MOZ_ASSERT(!decoder.mDemuxEOS);
         decoder.mDemuxEOS = true;
@@ -767,35 +759,35 @@ MP4Reader::ReturnOutput(MediaData* aData
     }
 
     mAudio.mPromise.Resolve(audioData, __func__);
   } else if (aTrack == kVideo) {
     mVideo.mPromise.Resolve(static_cast<VideoData*>(aData), __func__);
   }
 }
 
-MediaSample*
+MP4Sample*
 MP4Reader::PopSample(TrackType aTrack)
 {
   MonitorAutoLock mon(mDemuxerMonitor);
   return PopSampleLocked(aTrack);
 }
 
-MediaSample*
+MP4Sample*
 MP4Reader::PopSampleLocked(TrackType aTrack)
 {
   mDemuxerMonitor.AssertCurrentThreadOwns();
   switch (aTrack) {
     case kAudio:
-      return InvokeAndRetry(mAudio.mTrackDemuxer.get(), &TrackDemuxer::DemuxSample, mStream, &mDemuxerMonitor);
+      return InvokeAndRetry(mDemuxer.get(), &MP4Demuxer::DemuxAudioSample, mStream, &mDemuxerMonitor);
     case kVideo:
       if (mQueuedVideoSample) {
         return mQueuedVideoSample.forget();
       }
-      return InvokeAndRetry(mVideo.mTrackDemuxer.get(), &TrackDemuxer::DemuxSample, mStream, &mDemuxerMonitor);
+      return InvokeAndRetry(mDemuxer.get(), &MP4Demuxer::DemuxVideoSample, mStream, &mDemuxerMonitor);
 
     default:
       return nullptr;
   }
 }
 
 size_t
 MP4Reader::SizeOfVideoQueueInFrames()
@@ -819,25 +811,25 @@ MP4Reader::SizeOfQueue(TrackType aTrack)
 
 nsresult
 MP4Reader::ResetDecode()
 {
   MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn());
   Flush(kVideo);
   {
     MonitorAutoLock mon(mDemuxerMonitor);
-    if (mVideo.mTrackDemuxer) {
-      mVideo.mTrackDemuxer->Seek(0);
+    if (mDemuxer) {
+      mDemuxer->SeekVideo(0);
     }
   }
   Flush(kAudio);
   {
     MonitorAutoLock mon(mDemuxerMonitor);
-    if (mAudio.mTrackDemuxer) {
-      mAudio.mTrackDemuxer->Seek(0);
+    if (mDemuxer) {
+      mDemuxer->SeekAudio(0);
     }
   }
   return MediaDecoderReader::ResetDecode();
 }
 
 void
 MP4Reader::Output(TrackType aTrack, MediaData* aSample)
 {
@@ -943,26 +935,26 @@ MP4Reader::SkipVideoDemuxToNextKeyFrame(
   MOZ_ASSERT(GetTaskQueue()->IsCurrentThreadIn());
 
   MOZ_ASSERT(mVideo.mDecoder);
 
   Flush(kVideo);
 
   // Loop until we reach the next keyframe after the threshold.
   while (true) {
-    nsAutoPtr<MediaSample> compressed(PopSample(kVideo));
+    nsAutoPtr<MP4Sample> compressed(PopSample(kVideo));
     if (!compressed) {
       // EOS, or error. This code assumes EOS, which may or may not be right.
       MonitorAutoLock mon(mVideo.mMonitor);
       mVideo.mDemuxEOS = true;
       return false;
     }
     parsed++;
-    if (!compressed->mMp4Sample->is_sync_point ||
-        compressed->mMp4Sample->composition_timestamp < aTimeThreshold) {
+    if (!compressed->is_sync_point ||
+        compressed->composition_timestamp < aTimeThreshold) {
       continue;
     }
     mQueuedVideoSample = compressed;
     break;
   }
 
   return true;
 }
@@ -976,24 +968,24 @@ MP4Reader::Seek(int64_t aTime, int64_t a
   if (!mDecoder->GetResource()->IsTransportSeekable() || !mDemuxer->CanSeek()) {
     VLOG("Seek() END (Unseekable)");
     return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
 
   int64_t seekTime = aTime;
   mQueuedVideoSample = nullptr;
   if (mDemuxer->HasValidVideo()) {
-    mVideo.mTrackDemuxer->Seek(seekTime);
+    mDemuxer->SeekVideo(seekTime);
     mQueuedVideoSample = PopSampleLocked(kVideo);
     if (mQueuedVideoSample) {
-      seekTime = mQueuedVideoSample->mMp4Sample->composition_timestamp;
+      seekTime = mQueuedVideoSample->composition_timestamp;
     }
   }
   if (mDemuxer->HasValidAudio()) {
-    mAudio.mTrackDemuxer->Seek(seekTime);
+    mDemuxer->SeekAudio(seekTime);
   }
   LOG("MP4Reader::Seek(%lld) exit", aTime);
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
 void
 MP4Reader::UpdateIndex()
 {
--- a/dom/media/fmp4/MP4Reader.h
+++ b/dom/media/fmp4/MP4Reader.h
@@ -6,29 +6,28 @@
 
 #if !defined(MP4Reader_h_)
 #define MP4Reader_h_
 
 #include "MediaDecoderReader.h"
 #include "nsAutoPtr.h"
 #include "PlatformDecoderModule.h"
 #include "mp4_demuxer/mp4_demuxer.h"
-#include "demuxer/TrackDemuxer.h"
 #include "MediaTaskQueue.h"
 
 #include <deque>
 #include "mozilla/Monitor.h"
 
 namespace mozilla {
 
 namespace dom {
 class TimeRanges;
 }
 
-typedef std::deque<MediaSample*> MediaSampleQueue;
+typedef std::deque<mp4_demuxer::MP4Sample*> MP4SampleQueue;
 
 class MP4Stream;
 
 class MP4Reader MOZ_FINAL : public MediaDecoderReader
 {
   typedef mp4_demuxer::TrackType TrackType;
 
 public:
@@ -97,18 +96,18 @@ private:
 
   void ExtractCryptoInitData(nsTArray<uint8_t>& aInitData);
 
   // Initializes mLayersBackendType if possible.
   void InitLayersBackendType();
 
   // Blocks until the demuxer produces an sample of specified type.
   // Returns nullptr on error on EOS. Caller must delete sample.
-  MediaSample* PopSample(mp4_demuxer::TrackType aTrack);
-  MediaSample* PopSampleLocked(mp4_demuxer::TrackType aTrack);
+  mp4_demuxer::MP4Sample* PopSample(mp4_demuxer::TrackType aTrack);
+  mp4_demuxer::MP4Sample* PopSampleLocked(mp4_demuxer::TrackType aTrack);
 
   bool SkipVideoDemuxToNextKeyFrame(int64_t aTimeThreshold, uint32_t& parsed);
 
   // DecoderCallback proxies the MediaDataDecoderCallback calls to these
   // functions.
   void Output(mp4_demuxer::TrackType aType, MediaData* aSample);
   void InputExhausted(mp4_demuxer::TrackType aTrack);
   void Error(mp4_demuxer::TrackType aTrack);
@@ -123,19 +122,18 @@ private:
   virtual bool IsWaitingOnCDMResource() MOZ_OVERRIDE;
 
   Microseconds GetNextKeyframeTime();
   bool ShouldSkip(bool aSkipToNextKeyframe, int64_t aTimeThreshold);
 
   size_t SizeOfQueue(TrackType aTrack);
 
   nsRefPtr<MP4Stream> mStream;
-  nsRefPtr<mp4_demuxer::MP4Demuxer> mDemuxer;
+  nsAutoPtr<mp4_demuxer::MP4Demuxer> mDemuxer;
   nsRefPtr<PlatformDecoderModule> mPlatform;
-  mp4_demuxer::CryptoFile mCrypto;
 
   class DecoderCallback : public MediaDataDecoderCallback {
   public:
     DecoderCallback(MP4Reader* aReader,
                     mp4_demuxer::TrackType aType)
       : mReader(aReader)
       , mType(aType)
     {
@@ -178,17 +176,16 @@ private:
       , mIsFlushing(false)
       , mUpdateScheduled(false)
       , mDemuxEOS(false)
       , mDrainComplete(false)
       , mDiscontinuity(false)
     {
     }
 
-    nsAutoPtr<TrackDemuxer> mTrackDemuxer;
     // The platform decoder.
     nsRefPtr<MediaDataDecoder> mDecoder;
     // TaskQueue on which decoder can choose to decode.
     // Only non-null up until the decoder is created.
     nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
     // Callback that receives output and error notifications from the decoder.
     nsAutoPtr<DecoderCallback> mCallback;
     // Decoded samples returned my mDecoder awaiting being returned to
@@ -237,17 +234,17 @@ private:
     }
   };
 
   DecoderDataWithPromise<AudioDataPromise> mAudio;
   DecoderDataWithPromise<VideoDataPromise> mVideo;
 
   // Queued samples extracted by the demuxer, but not yet sent to the platform
   // decoder.
-  nsAutoPtr<MediaSample> mQueuedVideoSample;
+  nsAutoPtr<mp4_demuxer::MP4Sample> mQueuedVideoSample;
 
   // Returns true when the decoder for this track needs input.
   // aDecoder.mMonitor must be locked.
   bool NeedInput(DecoderData& aDecoder);
 
   // The last number of decoded output frames that we've reported to
   // MediaDecoder::NotifyDecoded(). We diff the number of output video
   // frames every time that DecodeVideoData() is called, and report the
--- a/dom/media/gtest/TestMP4Demuxer.cpp
+++ b/dom/media/gtest/TestMP4Demuxer.cpp
@@ -14,17 +14,17 @@ using namespace mp4_demuxer;
 
 class MP4DemuxerBinding
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MP4DemuxerBinding);
 
   nsRefPtr<MockMediaResource> resource;
   Monitor mMonitor;
-  nsRefPtr<MP4Demuxer> demuxer;
+  nsAutoPtr<MP4Demuxer> demuxer;
 
   explicit MP4DemuxerBinding(const char* aFileName = "dash_dashinit.mp4")
     : resource(new MockMediaResource(aFileName))
     , mMonitor("TestMP4Demuxer monitor")
     , demuxer(new MP4Demuxer(new MP4Stream(resource), &mMonitor))
   {
     EXPECT_EQ(NS_OK, resource->Open(nullptr));
   }
deleted file mode 100644
--- a/media/libstagefright/binding/MP4TrackDemuxer.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mp4_demuxer/MP4TrackDemuxer.h"
-
-using namespace mozilla;
-
-namespace mp4_demuxer {
-
-void
-MP4AudioDemuxer::Seek(Microseconds aTime)
-{
-  mDemuxer->SeekAudio(aTime);
-}
-
-MediaSample*
-MP4AudioDemuxer::DemuxSample()
-{
-  nsAutoPtr<MP4Sample> sample(mDemuxer->DemuxAudioSample());
-  if (!sample) {
-    return nullptr;
-  }
-  return new MediaSample(sample.forget());
-}
-
-Microseconds
-MP4AudioDemuxer::GetNextKeyframeTime()
-{
-  return -1;
-}
-
-void
-MP4VideoDemuxer::Seek(Microseconds aTime)
-{
-  mDemuxer->SeekVideo(aTime);
-}
-
-MediaSample*
-MP4VideoDemuxer::DemuxSample()
-{
-  nsAutoPtr<MP4Sample> sample(mDemuxer->DemuxVideoSample());
-  if (!sample) {
-    return nullptr;
-  }
-  return new MediaSample(sample.forget());
-}
-
-Microseconds
-MP4VideoDemuxer::GetNextKeyframeTime()
-{
-  return mDemuxer->GetNextKeyframeTime();
-}
-
-}
deleted file mode 100644
--- a/media/libstagefright/binding/include/demuxer/TrackDemuxer.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef TRACK_DEMUXER_H_
-#define TRACK_DEMUXER_H_
-
-namespace mp4_demuxer { class MP4Sample; }
-
-namespace mozilla {
-
-class MediaByteRange;
-
-typedef int64_t Microseconds;
-
-class MediaSample {
-public:
-  explicit MediaSample(mp4_demuxer::MP4Sample* aMp4Sample) : mMp4Sample(aMp4Sample)
-  {
-  }
-
-  nsAutoPtr<mp4_demuxer::MP4Sample> mMp4Sample;
-};
-
-class TrackDemuxer {
-public:
-  TrackDemuxer() {}
-  virtual ~TrackDemuxer() {}
-
-  virtual void Seek(Microseconds aTime) = 0;
-
-  // DemuxSample returns nullptr on end of stream or error.
-  virtual MediaSample* DemuxSample() = 0;
-
-  // Returns timestamp of next keyframe, or -1 if demuxer can't
-  // report this.
-  virtual Microseconds GetNextKeyframeTime() = 0;
-};
-
-}
-
-#endif
--- a/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
@@ -39,22 +39,16 @@ struct PsshInfo
   PsshInfo(const PsshInfo& aOther) : uuid(aOther.uuid), data(aOther.data) {}
   nsTArray<uint8_t> uuid;
   nsTArray<uint8_t> data;
 };
 
 class CryptoFile
 {
 public:
-  CryptoFile() {}
-  CryptoFile(const CryptoFile& aCryptoFile) : valid(aCryptoFile.valid)
-  {
-    pssh.AppendElements(aCryptoFile.pssh);
-  }
-
   void Update(stagefright::sp<stagefright::MetaData>& aMetaData)
   {
     valid = DoUpdate(aMetaData);
   }
 
   bool valid;
   nsTArray<PsshInfo> pssh;
 
deleted file mode 100644
--- a/media/libstagefright/binding/include/mp4_demuxer/MP4TrackDemuxer.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MP4_TRACK_DEMUXER_H_
-#define MP4_TRACK_DEMUXER_H_
-
-#include "mozilla/Attributes.h"
-#include "demuxer/TrackDemuxer.h"
-
-namespace mp4_demuxer
-{
-
-class MP4AudioDemuxer : public mozilla::TrackDemuxer {
-public:
-  explicit MP4AudioDemuxer(MP4Demuxer* aDemuxer) : mDemuxer(aDemuxer) {}
-  virtual void Seek(Microseconds aTime) MOZ_OVERRIDE;
-  virtual mozilla::MediaSample* DemuxSample() MOZ_OVERRIDE;
-  virtual Microseconds GetNextKeyframeTime() MOZ_OVERRIDE;
-
-private:
-  nsRefPtr<MP4Demuxer> mDemuxer;
-};
-
-class MP4VideoDemuxer : public mozilla::TrackDemuxer {
-public:
-  explicit MP4VideoDemuxer(MP4Demuxer* aDemuxer) : mDemuxer(aDemuxer) {}
-  virtual void Seek(Microseconds aTime) MOZ_OVERRIDE;
-  virtual mozilla::MediaSample* DemuxSample() MOZ_OVERRIDE;
-  virtual Microseconds GetNextKeyframeTime() MOZ_OVERRIDE;
-
-private:
-  nsRefPtr<MP4Demuxer> mDemuxer;
-};
-
-}
-
-#endif
--- a/media/libstagefright/binding/include/mp4_demuxer/mp4_demuxer.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/mp4_demuxer.h
@@ -38,19 +38,18 @@ protected:
   virtual ~Stream() {}
 };
 
 enum TrackType { kVideo = 1, kAudio };
 
 class MP4Demuxer
 {
 public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MP4Demuxer)
-
   explicit MP4Demuxer(Stream* aSource, Monitor* aMonitor);
+  ~MP4Demuxer();
 
   bool Init();
   Microseconds Duration();
   bool CanSeek();
 
   bool HasValidAudio();
   bool HasValidVideo();
 
@@ -73,19 +72,16 @@ public:
     nsTArray<Interval<Microseconds>>* aIntervals);
 
   int64_t GetEvictionOffset(Microseconds aTime);
 
   // Returns timestamp of next keyframe, or -1 if demuxer can't
   // report this.
   Microseconds GetNextKeyframeTime();
 
-protected:
-  ~MP4Demuxer();
-
 private:
   AudioDecoderConfig mAudioConfig;
   VideoDecoderConfig mVideoConfig;
   CryptoFile mCrypto;
 
   nsAutoPtr<StageFrightPrivate> mPrivate;
   nsRefPtr<Stream> mSource;
   nsTArray<mozilla::MediaByteRange> mCachedByteRanges;
--- a/media/libstagefright/moz.build
+++ b/media/libstagefright/moz.build
@@ -55,24 +55,19 @@ EXPORTS.mp4_demuxer += [
     'binding/include/mp4_demuxer/BufferStream.h',
     'binding/include/mp4_demuxer/ByteReader.h',
     'binding/include/mp4_demuxer/ByteWriter.h',
     'binding/include/mp4_demuxer/DecoderData.h',
     'binding/include/mp4_demuxer/H264.h',
     'binding/include/mp4_demuxer/Interval.h',
     'binding/include/mp4_demuxer/MoofParser.h',
     'binding/include/mp4_demuxer/mp4_demuxer.h',
-    'binding/include/mp4_demuxer/MP4TrackDemuxer.h',
     'binding/include/mp4_demuxer/SinfParser.h',
 ]
 
-EXPORTS.demuxer += [
-    'binding/include/demuxer/TrackDemuxer.h',
-]
-
 SOURCES += [
     'frameworks/av/media/libstagefright/foundation/hexdump.cpp',
     'frameworks/av/media/libstagefright/MetaData.cpp',
     'system/core/libutils/RefBase.cpp',
     'system/core/libutils/String16.cpp',
     'system/core/libutils/String8.cpp',
     'system/core/libutils/VectorImpl.cpp',
 ]
@@ -82,17 +77,16 @@ UNIFIED_SOURCES += [
     'binding/AnnexB.cpp',
     'binding/Box.cpp',
     'binding/BufferStream.cpp',
     'binding/DecoderData.cpp',
     'binding/H264.cpp',
     'binding/Index.cpp',
     'binding/MoofParser.cpp',
     'binding/mp4_demuxer.cpp',
-    'binding/MP4TrackDemuxer.cpp',
     'binding/SinfParser.cpp',
     'frameworks/av/media/libstagefright/DataSource.cpp',
     'frameworks/av/media/libstagefright/ESDS.cpp',
     'frameworks/av/media/libstagefright/foundation/AAtomizer.cpp',
     'frameworks/av/media/libstagefright/foundation/ABitReader.cpp',
     'frameworks/av/media/libstagefright/foundation/ABuffer.cpp',
     'frameworks/av/media/libstagefright/foundation/AString.cpp',
     'frameworks/av/media/libstagefright/id3/ID3.cpp',