Bug 1316211. P16 - remove MediaDecoderReader completely and fix includes. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 20 Jul 2017 09:56:08 +0800
changeset 611850 f1eb9418443e336147dc7c805b6d807b70823fb9
parent 611849 66dcbd7e4ffb91cab6605cc27434d3a6f25de28b
child 612756 9fb662dad622d4b757d02a8093e007a31a160298
push id69302
push userjwwang@mozilla.com
push dateThu, 20 Jul 2017 02:52:36 +0000
bugs1316211
milestone56.0a1
Bug 1316211. P16 - remove MediaDecoderReader completely and fix includes. MozReview-Commit-ID: AGNyyh4kt3e
dom/media/AbstractMediaDecoder.h
dom/media/MediaDecoderReader.cpp
dom/media/MediaDecoderReader.h
dom/media/MediaDecoderStateMachine.cpp
dom/media/MediaDecoderStateMachine.h
dom/media/MediaFormatReader.h
dom/media/MediaInfo.h
dom/media/SeekJob.h
dom/media/VideoUtils.h
dom/media/gtest/TestAudioCompactor.cpp
dom/media/gtest/TestVideoTrackEncoder.cpp
dom/media/mediasource/MediaSourceDemuxer.h
dom/media/moz.build
dom/media/platforms/PlatformDecoderModule.h
dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
dom/media/platforms/omx/OmxDataDecoder.h
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
dom/media/webaudio/MediaBufferDecoder.cpp
--- a/dom/media/AbstractMediaDecoder.h
+++ b/dom/media/AbstractMediaDecoder.h
@@ -27,18 +27,16 @@ class KnowsCompositor;
 class AbstractThread;
 class MediaResource;
 class ReentrantMonitor;
 class VideoFrameContainer;
 class MediaDecoderOwner;
 class CDMProxy;
 class GMPCrashHelper;
 
-typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
-
 /**
  * The AbstractMediaDecoder class describes the public interface for a media decoder
  * and is used by the MediaReader classes.
  */
 class AbstractMediaDecoder : public nsIObserver
 {
 public:
   // Increments the parsed, decoded and dropped frame counters by the passed in
deleted file mode 100644
--- a/dom/media/MediaDecoderReader.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "MediaDecoderReader.h"
-
-#include "AbstractMediaDecoder.h"
-#include "ImageContainer.h"
-#include "MediaPrefs.h"
-#include "MediaResource.h"
-#include "VideoUtils.h"
-#include "mozilla/Mutex.h"
-#include "mozilla/SharedThreadPool.h"
-#include "mozilla/TaskQueue.h"
-#include "mozilla/mozalloc.h"
-#include "nsPrintfCString.h"
-#include <algorithm>
-#include <stdint.h>
-
-using namespace mozilla::media;
-
-namespace mozilla {
-
-// Un-comment to enable logging of seek bisections.
-//#define SEEK_LOGGING
-
-extern LazyLogModule gMediaDecoderLog;
-
-// avoid redefined macro in unified build
-#undef FMT
-#undef DECODER_LOG
-#undef DECODER_WARN
-
-#define FMT(x, ...) "Decoder=%p " x, mDecoder, ##__VA_ARGS__
-#define DECODER_LOG(...) MOZ_LOG(gMediaDecoderLog, LogLevel::Debug,   (FMT(__VA_ARGS__)))
-#define DECODER_WARN(...) NS_WARNING(nsPrintfCString(FMT(__VA_ARGS__)).get())
-
-MediaDecoderReader::MediaDecoderReader()
-{
-  MOZ_COUNT_CTOR(MediaDecoderReader);
-  MOZ_ASSERT(NS_IsMainThread());
-}
-
-MediaDecoderReader::~MediaDecoderReader()
-{
-  MOZ_COUNT_DTOR(MediaDecoderReader);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/MediaDecoderReader.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-#if !defined(MediaDecoderReader_h_)
-#define MediaDecoderReader_h_
-
-#include "AbstractMediaDecoder.h"
-#include "AudioCompactor.h"
-#include "Intervals.h"
-#include "MediaData.h"
-#include "MediaInfo.h"
-#include "MediaMetadataManager.h"
-#include "MediaQueue.h"
-#include "MediaResult.h"
-#include "MediaTimer.h"
-#include "SeekTarget.h"
-#include "TimeUnits.h"
-#include "mozilla/EnumSet.h"
-#include "mozilla/MozPromise.h"
-#include "nsAutoPtr.h"
-
-namespace mozilla {
-
-class CDMProxy;
-class GMPCrashHelper;
-class MediaDecoderReader;
-class TaskQueue;
-class VideoFrameContainer;
-
-// Encapsulates the decoding and reading of media data. Reading can either
-// synchronous and done on the calling "decode" thread, or asynchronous and
-// performed on a background thread, with the result being returned by
-// callback.
-// Unless otherwise specified, methods and fields of this class can only
-// be accessed on the decode task queue.
-class MediaDecoderReader
-{
-public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)
-
-  // The caller must ensure that Shutdown() is called before aDecoder is
-  // destroyed.
-  MediaDecoderReader();
-
-protected:
-  virtual ~MediaDecoderReader();
-};
-
-} // namespace mozilla
-
-#endif
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -40,17 +40,16 @@
 #include "nsTArray.h"
 #include "nsDeque.h"
 #include "prenv.h"
 
 #include "AudioSegment.h"
 #include "DOMMediaStream.h"
 #include "ImageContainer.h"
 #include "MediaDecoder.h"
-#include "MediaDecoderReader.h"
 #include "MediaDecoderReaderWrapper.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaShutdownManager.h"
 #include "MediaPrefs.h"
 #include "MediaTimer.h"
 #include "TimeUnits.h"
 #include "VideoSegment.h"
 #include "VideoUtils.h"
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -88,16 +88,17 @@ hardware (via AudioStream).
 
 #include "nsAutoPtr.h"
 #include "nsThreadUtils.h"
 #include "MediaDecoder.h"
 #include "MediaDecoderOwner.h"
 #include "MediaEventSource.h"
 #include "MediaFormatReader.h"
 #include "MediaMetadataManager.h"
+#include "MediaQueue.h"
 #include "MediaStatistics.h"
 #include "MediaTimer.h"
 #include "ImageContainer.h"
 #include "SeekJob.h"
 
 namespace mozilla {
 
 namespace media {
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -9,24 +9,28 @@
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Mutex.h"
 
 #include "MediaEventSource.h"
 #include "MediaDataDemuxer.h"
+#include "MediaMetadataManager.h"
 #include "MediaPrefs.h"
 #include "nsAutoPtr.h"
 #include "PDMFactory.h"
+#include "SeekTarget.h"
 
 namespace mozilla {
 
+class AbstractMediaDecoder;
 class CDMProxy;
 class GMPCrashHelper;
+class MediaResource;
 class VideoFrameContainer;
 
 struct WaitForDataRejectValue
 {
   enum Reason
   {
     SHUTDOWN,
     CANCELED
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -4,16 +4,17 @@
  * 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/. */
 #if !defined(MediaInfo_h)
 #define MediaInfo_h
 
 #include "mozilla/UniquePtr.h"
 #include "nsRect.h"
 #include "mozilla/RefPtr.h"
+#include "nsDataHashtable.h"
 #include "nsSize.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "ImageTypes.h"
 #include "MediaData.h"
 #include "StreamTracks.h" // for TrackID
 #include "TimeUnits.h"
 
@@ -31,16 +32,18 @@ public:
     : mKey(aKey)
     , mValue(aValue)
   {
   }
   nsCString mKey;
   nsCString mValue;
 };
 
+typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
+
   // Maximum channel number we can currently handle (7.1)
 #define MAX_AUDIO_CHANNELS 8
 
 class TrackInfo
 {
 public:
   enum TrackType
   {
--- a/dom/media/SeekJob.h
+++ b/dom/media/SeekJob.h
@@ -4,17 +4,16 @@
  * 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 SEEK_JOB_H
 #define SEEK_JOB_H
 
 #include "mozilla/MozPromise.h"
 #include "MediaDecoder.h"
-#include "MediaDecoderReader.h"
 #include "SeekTarget.h"
 
 namespace mozilla {
 
 struct SeekJob
 {
   SeekJob() = default;
   SeekJob(SeekJob&& aOther) = default;
--- a/dom/media/VideoUtils.h
+++ b/dom/media/VideoUtils.h
@@ -188,17 +188,17 @@ class SharedThreadPool;
 // thread pool to ensure they can run when the MediaDataDecoder clients'
 // thread pool is blocked.  Tasks on the PLATFORM_DECODER thread pool must not
 // wait on tasks in the PLAYBACK thread pool.
 //
 // No new dependencies on this mechanism should be added, as methods are being
 // made async supported by MozPromise, making this unnecessary and
 // permitting unifying the pool.
 enum class MediaThreadType {
-  PLAYBACK, // MediaDecoderStateMachine and MediaDecoderReader
+  PLAYBACK, // MediaDecoderStateMachine and MediaFormatReader
   PLATFORM_DECODER
 };
 // Returns the thread pool that is shared amongst all decoder state machines
 // for decoding streams.
 already_AddRefed<SharedThreadPool> GetMediaThreadPool(MediaThreadType aType);
 
 enum H264_PROFILE {
   H264_PROFILE_UNKNOWN                     = 0,
--- a/dom/media/gtest/TestAudioCompactor.cpp
+++ b/dom/media/gtest/TestAudioCompactor.cpp
@@ -1,21 +1,19 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "gtest/gtest.h"
 #include "AudioCompactor.h"
-#include "MediaDecoderReader.h"
 
 using mozilla::AudioCompactor;
 using mozilla::AudioData;
 using mozilla::AudioDataValue;
-using mozilla::MediaDecoderReader;
 using mozilla::MediaQueue;
 
 class MemoryFunctor : public nsDequeFunctor {
 public:
   MemoryFunctor() : mSize(0) {}
   MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
 
   void* operator()(void* aObject) override {
--- a/dom/media/gtest/TestVideoTrackEncoder.cpp
+++ b/dom/media/gtest/TestVideoTrackEncoder.cpp
@@ -1,15 +1,16 @@
 /* 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 "gtest/gtest.h"
 #include <algorithm>
 
+#include "prtime.h"
 #include "mozilla/ArrayUtils.h"
 #include "VP8TrackEncoder.h"
 #include "ImageContainer.h"
 #include "MediaStreamGraph.h"
 #include "MediaStreamListener.h"
 #include "WebMWriter.h" // TODO: it's weird to include muxer header to get the class definition of VP8 METADATA
 
 using ::testing::TestWithParam;
--- a/dom/media/mediasource/MediaSourceDemuxer.h
+++ b/dom/media/mediasource/MediaSourceDemuxer.h
@@ -8,17 +8,16 @@
 #define MediaSourceDemuxer_h_
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Monitor.h"
 #include "AutoTaskQueue.h"
 
 #include "MediaDataDemuxer.h"
-#include "MediaDecoderReader.h"
 #include "MediaResource.h"
 #include "MediaSource.h"
 #include "TrackBuffersManager.h"
 
 namespace mozilla {
 
 class AbstractThread;
 class MediaResult;
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -109,17 +109,16 @@ EXPORTS += [
     'Intervals.h',
     'Latency.h',
     'MediaCache.h',
     'MediaContainerType.h',
     'MediaData.h',
     'MediaDataDemuxer.h',
     'MediaDecoder.h',
     'MediaDecoderOwner.h',
-    'MediaDecoderReader.h',
     'MediaDecoderStateMachine.h',
     'MediaEventSource.h',
     'MediaFormatReader.h',
     'MediaInfo.h',
     'MediaMetadataManager.h',
     'MediaMIMETypes.h',
     'MediaPrefs.h',
     'MediaQueue.h',
@@ -217,17 +216,16 @@ UNIFIED_SOURCES += [
     'FileBlockCache.cpp',
     'GetUserMediaRequest.cpp',
     'GraphDriver.cpp',
     'Latency.cpp',
     'MediaCache.cpp',
     'MediaContainerType.cpp',
     'MediaData.cpp',
     'MediaDecoder.cpp',
-    'MediaDecoderReader.cpp',
     'MediaDecoderReaderWrapper.cpp',
     'MediaDecoderStateMachine.cpp',
     'MediaDeviceInfo.cpp',
     'MediaDevices.cpp',
     'MediaFormatReader.cpp',
     'MediaInfo.cpp',
     'MediaManager.cpp',
     'MediaMIMETypes.cpp',
--- a/dom/media/platforms/PlatformDecoderModule.h
+++ b/dom/media/platforms/PlatformDecoderModule.h
@@ -3,22 +3,23 @@
 /* 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/. */
 
 #if !defined(PlatformDecoderModule_h_)
 #define PlatformDecoderModule_h_
 
 #include "GMPCrashHelper.h"
-#include "MediaDecoderReader.h"
+#include "MediaEventSource.h"
 #include "MediaInfo.h"
 #include "MediaResult.h"
 #include "mozilla/EnumSet.h"
 #include "mozilla/MozPromise.h"
 #include "mozilla/RefPtr.h"
+#include "mozilla/TaskQueue.h"
 #include "mozilla/layers/KnowsCompositor.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "nsTArray.h"
 #include <queue>
 
 namespace mozilla {
 class TrackInfo;
 class AudioInfo;
--- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
@@ -3,16 +3,17 @@
 /* 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 "mozilla/TaskQueue.h"
 
 #include "FFmpegAudioDecoder.h"
 #include "TimeUnits.h"
+#include "VideoUtils.h"
 
 #define MAX_CHANNELS 16
 
 namespace mozilla {
 
 FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(FFmpegLibWrapper* aLib,
   TaskQueue* aTaskQueue, const AudioInfo& aConfig)
   : FFmpegDataDecoder(aLib, aTaskQueue, GetCodecId(aConfig.mMimeType))
--- a/dom/media/platforms/omx/OmxDataDecoder.h
+++ b/dom/media/platforms/omx/OmxDataDecoder.h
@@ -3,16 +3,17 @@
 /* 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/. */
 
 #if !defined(OmxDataDecoder_h_)
 #define OmxDataDecoder_h_
 
 #include "mozilla/Monitor.h"
+#include "mozilla/StateWatching.h"
 
 #include "AudioCompactor.h"
 #include "ImageContainer.h"
 #include "MediaInfo.h"
 #include "PlatformDecoderModule.h"
 
 #include "OMX_Component.h"
 
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -7,17 +7,16 @@
 #include "WMFVideoMFTManager.h"
 
 #include "DXVA2Manager.h"
 #include "GMPUtils.h" // For SplitAt. TODO: Move SplitAt to a central place.
 #include "IMFYCbCrImage.h"
 #include "ImageContainer.h"
 #include "Layers.h"
 #include "MP4Decoder.h"
-#include "MediaDecoderReader.h"
 #include "MediaInfo.h"
 #include "MediaTelemetryConstants.h"
 #include "VPXDecoder.h"
 #include "VideoUtils.h"
 #include "WMFUtils.h"
 #include "gfx2DGlue.h"
 #include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
--- a/dom/media/webaudio/MediaBufferDecoder.cpp
+++ b/dom/media/webaudio/MediaBufferDecoder.cpp
@@ -10,16 +10,17 @@
 #include "mozilla/dom/BaseAudioContextBinding.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/AbstractThread.h"
 #include <speex/speex_resampler.h>
 #include "nsXPCOMCIDInternal.h"
 #include "nsComponentManagerUtils.h"
 #include "MediaFormatReader.h"
+#include "MediaQueue.h"
 #include "BufferMediaResource.h"
 #include "DecoderTraits.h"
 #include "AudioContext.h"
 #include "AudioBuffer.h"
 #include "MediaContainerType.h"
 #include "nsContentUtils.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptError.h"