Bug 1204407: P2. Remove no longer required MediaDataDemuxer APIs. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 14 Sep 2015 18:36:53 +1000
changeset 295357 176b5ef8e88119bc025a63286b46b6ffefc33715
parent 295356 52a5d0cabf5878f64caf497d6026b90d449d3e6d
child 295358 6211333b9ae57a7deab9e1936f992ada4d6261bc
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1204407
milestone43.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 1204407: P2. Remove no longer required MediaDataDemuxer APIs. r=cpearce
dom/media/MP3Demuxer.cpp
dom/media/MP3Demuxer.h
dom/media/MediaDataDemuxer.h
dom/media/fmp4/MP4Demuxer.cpp
dom/media/fmp4/MP4Demuxer.h
dom/media/mediasource/MediaSourceDemuxer.h
dom/media/webm/WebMDemuxer.cpp
dom/media/webm/WebMDemuxer.h
--- a/dom/media/MP3Demuxer.cpp
+++ b/dom/media/MP3Demuxer.cpp
@@ -54,26 +54,16 @@ MP3Demuxer::Init() {
     return InitPromise::CreateAndReject(
       DemuxerFailureReason::WAITING_FOR_DATA, __func__);
   }
 
   MP3DEMUXER_LOG("MP3Demuxer::Init() successful");
   return InitPromise::CreateAndResolve(NS_OK, __func__);
 }
 
-already_AddRefed<MediaDataDemuxer>
-MP3Demuxer::Clone() const {
-  nsRefPtr<MP3Demuxer> demuxer = new MP3Demuxer(mSource);
-  if (!demuxer->InitInternal()) {
-    NS_WARNING("Couldn't recreate MP3Demuxer");
-    return nullptr;
-  }
-  return demuxer.forget();
-}
-
 bool
 MP3Demuxer::HasTrackType(TrackInfo::TrackType aType) const {
   return aType == TrackInfo::kAudioTrack;
 }
 
 uint32_t
 MP3Demuxer::GetNumberTracks(TrackInfo::TrackType aType) const {
   return aType == TrackInfo::kAudioTrack ? 1u : 0u;
--- a/dom/media/MP3Demuxer.h
+++ b/dom/media/MP3Demuxer.h
@@ -14,17 +14,16 @@ namespace mp3 {
 
 class MP3TrackDemuxer;
 
 class MP3Demuxer : public MediaDataDemuxer {
 public:
   // MediaDataDemuxer interface.
   explicit MP3Demuxer(MediaResource* aSource);
   nsRefPtr<InitPromise> Init() override;
-  already_AddRefed<MediaDataDemuxer> Clone() const override;
   bool HasTrackType(TrackInfo::TrackType aType) const override;
   uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
   already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(
       TrackInfo::TrackType aType, uint32_t aTrackNumber) override;
   bool IsSeekable() const override;
   void NotifyDataArrived(uint32_t aLength, int64_t aOffset) override;
   void NotifyDataRemoved() override;
 
--- a/dom/media/MediaDataDemuxer.h
+++ b/dom/media/MediaDataDemuxer.h
@@ -46,29 +46,16 @@ public:
   // Initializes the demuxer. Other methods cannot be called unless
   // initialization has completed and succeeded.
   // Typically a demuxer will wait to parse the metadata before resolving the
   // promise. The promise will be rejected with WAITING_FOR_DATA should
   // insufficient data be available at the time. Init() would have to be called
   // again to retry once more data has been received.
   virtual nsRefPtr<InitPromise> Init() = 0;
 
-  // MediaFormatReader ensures that calls to the MediaDataDemuxer are thread-safe.
-  // This is done by having multiple demuxers, created with Clone(), one per
-  // running thread.
-  // However, should the MediaDataDemuxer object guaranteed to be thread-safe
-  // such cloning is unecessary and only one demuxer will be used across
-  // all threads.
-  virtual bool IsThreadSafe() { return false; }
-
-  // Clone the demuxer and return a new initialized demuxer.
-  // This can only be called once Init() has succeeded.
-  // The new demuxer can be immediately use to retrieve the track demuxers.
-  virtual already_AddRefed<MediaDataDemuxer> Clone() const = 0;
-
   // Returns true if a aType track type is available.
   virtual bool HasTrackType(TrackInfo::TrackType aType) const = 0;
 
   // Returns the number of tracks of aType type available. A value of
   // 0 indicates that no such type is available.
   virtual uint32_t GetNumberTracks(TrackInfo::TrackType aType) const = 0;
 
   // Returns the MediaTrackDemuxer associated with aTrackNumber aType track.
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -97,32 +97,16 @@ MP4Demuxer::Init()
   if (!mMetadata->GetNumberTracks(mozilla::TrackInfo::kAudioTrack) &&
       !mMetadata->GetNumberTracks(mozilla::TrackInfo::kVideoTrack)) {
     return InitPromise::CreateAndReject(DemuxerFailureReason::DEMUXER_ERROR, __func__);
   }
 
   return InitPromise::CreateAndResolve(NS_OK, __func__);
 }
 
-already_AddRefed<MediaDataDemuxer>
-MP4Demuxer::Clone() const
-{
-  nsRefPtr<MP4Demuxer> demuxer = new MP4Demuxer(mResource);
-  demuxer->mInitData = mInitData;
-  nsRefPtr<mp4_demuxer::BufferStream> bufferstream =
-    new mp4_demuxer::BufferStream(mInitData);
-  demuxer->mMetadata = MakeUnique<mp4_demuxer::MP4Metadata>(bufferstream);
-  if (!mMetadata->GetNumberTracks(mozilla::TrackInfo::kAudioTrack) &&
-      !mMetadata->GetNumberTracks(mozilla::TrackInfo::kVideoTrack)) {
-    NS_WARNING("Couldn't recreate MP4Demuxer");
-    return nullptr;
-  }
-  return demuxer.forget();
-}
-
 bool
 MP4Demuxer::HasTrackType(TrackInfo::TrackType aType) const
 {
   return !!GetNumberTracks(aType);
 }
 
 uint32_t
 MP4Demuxer::GetNumberTracks(TrackInfo::TrackType aType) const
--- a/dom/media/fmp4/MP4Demuxer.h
+++ b/dom/media/fmp4/MP4Demuxer.h
@@ -25,18 +25,16 @@ class MP4TrackDemuxer;
 
 class MP4Demuxer : public MediaDataDemuxer
 {
 public:
   explicit MP4Demuxer(MediaResource* aResource);
 
   virtual nsRefPtr<InitPromise> Init() override;
 
-  virtual already_AddRefed<MediaDataDemuxer> Clone() const override;
-
   virtual bool HasTrackType(TrackInfo::TrackType aType) const override;
 
   virtual uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
 
   virtual already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(TrackInfo::TrackType aType,
                                                               uint32_t aTrackNumber) override;
 
   virtual bool IsSeekable() const override;
--- a/dom/media/mediasource/MediaSourceDemuxer.h
+++ b/dom/media/mediasource/MediaSourceDemuxer.h
@@ -24,24 +24,16 @@ class MediaSourceTrackDemuxer;
 
 class MediaSourceDemuxer : public MediaDataDemuxer
 {
 public:
   explicit MediaSourceDemuxer();
 
   nsRefPtr<InitPromise> Init() override;
 
-  bool IsThreadSafe() override { return true; }
-
-  already_AddRefed<MediaDataDemuxer> Clone() const override
-  {
-    MOZ_CRASH("Shouldn't be called");
-    return nullptr;
-  }
-
   bool HasTrackType(TrackInfo::TrackType aType) const override;
 
   uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
 
   already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(TrackInfo::TrackType aType,
                                                               uint32_t aTrackNumber) override;
 
   bool IsSeekable() const override;
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -177,28 +177,16 @@ WebMDemuxer::Init()
 
 void
 WebMDemuxer::InitBufferedState()
 {
   MOZ_ASSERT(!mBufferedState);
   mBufferedState = new WebMBufferedState;
 }
 
-already_AddRefed<MediaDataDemuxer>
-WebMDemuxer::Clone() const
-{
-  nsRefPtr<WebMDemuxer> demuxer = new WebMDemuxer(mResource.GetResource());
-  demuxer->InitBufferedState();
-  if (NS_FAILED(demuxer->ReadMetadata())) {
-    NS_WARNING("Couldn't recreate WebMDemuxer");
-    return nullptr;
-  }
-  return demuxer.forget();
-}
-
 bool
 WebMDemuxer::HasTrackType(TrackInfo::TrackType aType) const
 {
   return !!GetNumberTracks(aType);
 }
 
 uint32_t
 WebMDemuxer::GetNumberTracks(TrackInfo::TrackType aType) const
--- a/dom/media/webm/WebMDemuxer.h
+++ b/dom/media/webm/WebMDemuxer.h
@@ -75,18 +75,16 @@ class WebMDemuxer : public MediaDataDemu
 public:
   explicit WebMDemuxer(MediaResource* aResource);
   // Indicate if the WebMDemuxer is to be used with MediaSource. In which
   // case the demuxer will stop reads to the last known complete block.
   WebMDemuxer(MediaResource* aResource, bool aIsMediaSource);
   
   nsRefPtr<InitPromise> Init() override;
 
-  already_AddRefed<MediaDataDemuxer> Clone() const override;
-
   bool HasTrackType(TrackInfo::TrackType aType) const override;
 
   uint32_t GetNumberTracks(TrackInfo::TrackType aType) const override;
 
   UniquePtr<TrackInfo> GetTrackInfo(TrackInfo::TrackType aType, size_t aTrackNumber) const;
 
   already_AddRefed<MediaTrackDemuxer> GetTrackDemuxer(TrackInfo::TrackType aType,
                                                       uint32_t aTrackNumber) override;