Bug 1240630: [ffmpeg] P4. Rename FFmpegH264Decoder into FFmpegVideoDecoder. r=kentuckyfriedtakahe
☠☠ backed out by 72660585b6a3 ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 19 Jan 2016 22:20:01 +1100
changeset 280809 dc949ca1e1ecc7eb5324fc4d5e510ebbc9e2ee0b
parent 280808 06abea99a29206ba64d2231ace8ac9d25b1da3a7
child 280810 8b78eccf2c296d54da1d8ed02d1293a8ff6138e3
push id29922
push usercbook@mozilla.com
push dateThu, 21 Jan 2016 10:51:00 +0000
treeherdermozilla-central@977d78a8dd78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe
bugs1240630
milestone46.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 1240630: [ffmpeg] P4. Rename FFmpegH264Decoder into FFmpegVideoDecoder. r=kentuckyfriedtakahe The days we used to only be able to use the FFmpeg decoder for H264 are long gone. It can do H264, VP6, VP8 and VP9.
dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp
dom/media/platforms/ffmpeg/FFmpegH264Decoder.h
dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
dom/media/platforms/ffmpeg/ffmpeg57/moz.build
dom/media/platforms/ffmpeg/ffvpx/moz.build
dom/media/platforms/ffmpeg/libav53/moz.build
dom/media/platforms/ffmpeg/libav54/moz.build
dom/media/platforms/ffmpeg/libav55/moz.build
--- a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
+++ b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
@@ -4,17 +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/. */
 
 #ifndef __FFmpegDecoderModule_h__
 #define __FFmpegDecoderModule_h__
 
 #include "PlatformDecoderModule.h"
 #include "FFmpegAudioDecoder.h"
-#include "FFmpegH264Decoder.h"
+#include "FFmpegVideoDecoder.h"
 
 namespace mozilla
 {
 
 template <int V>
 class FFmpegDecoderModule : public PlatformDecoderModule
 {
 public:
@@ -32,18 +32,18 @@ public:
   already_AddRefed<MediaDataDecoder>
   CreateVideoDecoder(const VideoInfo& aConfig,
                      layers::LayersBackend aLayersBackend,
                      layers::ImageContainer* aImageContainer,
                      FlushableTaskQueue* aVideoTaskQueue,
                      MediaDataDecoderCallback* aCallback) override
   {
     RefPtr<MediaDataDecoder> decoder =
-      new FFmpegH264Decoder<V>(aVideoTaskQueue, aCallback, aConfig,
-                               aImageContainer);
+      new FFmpegVideoDecoder<V>(aVideoTaskQueue, aCallback, aConfig,
+                                aImageContainer);
     return decoder.forget();
   }
 
   already_AddRefed<MediaDataDecoder>
   CreateAudioDecoder(const AudioInfo& aConfig,
                      FlushableTaskQueue* aAudioTaskQueue,
                      MediaDataDecoderCallback* aCallback) override
   {
@@ -58,17 +58,17 @@ public:
 
   bool SupportsMimeType(const nsACString& aMimeType) const override
   {
 #ifdef USING_MOZFFVPX
     AVCodecID audioCodec = AV_CODEC_ID_NONE;
 #else
     AVCodecID audioCodec = FFmpegAudioDecoder<V>::GetCodecId(aMimeType);
 #endif
-    AVCodecID videoCodec = FFmpegH264Decoder<V>::GetCodecId(aMimeType);
+    AVCodecID videoCodec = FFmpegVideoDecoder<V>::GetCodecId(aMimeType);
     if (audioCodec == AV_CODEC_ID_NONE && videoCodec == AV_CODEC_ID_NONE) {
       return false;
     }
     AVCodecID codec = audioCodec != AV_CODEC_ID_NONE ? audioCodec : videoCodec;
     return !!FFmpegDataDecoder<V>::FindAVCodec(codec);
   }
 
   ConversionRequired
rename from dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp
rename to dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
@@ -7,17 +7,17 @@
 #include "mozilla/TaskQueue.h"
 
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "ImageContainer.h"
 
 #include "MediaInfo.h"
 
-#include "FFmpegH264Decoder.h"
+#include "FFmpegVideoDecoder.h"
 #include "FFmpegLog.h"
 #include "mozilla/PodOperations.h"
 
 #include "libavutil/pixfmt.h"
 #if LIBAVCODEC_VERSION_MAJOR < 54
 #define AVPixelFormat PixelFormat
 #define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
 #define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
@@ -54,26 +54,26 @@ ChoosePixelFormat(AVCodecContext* aCodec
         break;
     }
   }
 
   NS_WARNING("FFmpeg does not share any supported pixel formats.");
   return AV_PIX_FMT_NONE;
 }
 
-FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::PtsCorrectionContext()
+FFmpegVideoDecoder<LIBAV_VER>::PtsCorrectionContext::PtsCorrectionContext()
   : mNumFaultyPts(0)
   , mNumFaultyDts(0)
   , mLastPts(INT64_MIN)
   , mLastDts(INT64_MIN)
 {
 }
 
 int64_t
-FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::GuessCorrectPts(int64_t aPts, int64_t aDts)
+FFmpegVideoDecoder<LIBAV_VER>::PtsCorrectionContext::GuessCorrectPts(int64_t aPts, int64_t aDts)
 {
   int64_t pts = AV_NOPTS_VALUE;
 
   if (aDts != int64_t(AV_NOPTS_VALUE)) {
     mNumFaultyDts += aDts <= mLastDts;
     mLastDts = aDts;
   }
   if (aPts != int64_t(AV_NOPTS_VALUE)) {
@@ -85,52 +85,52 @@ FFmpegH264Decoder<LIBAV_VER>::PtsCorrect
     pts = aPts;
   } else {
     pts = aDts;
   }
   return pts;
 }
 
 void
-FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::Reset()
+FFmpegVideoDecoder<LIBAV_VER>::PtsCorrectionContext::Reset()
 {
   mNumFaultyPts = 0;
   mNumFaultyDts = 0;
   mLastPts = INT64_MIN;
   mLastDts = INT64_MIN;
 }
 
-FFmpegH264Decoder<LIBAV_VER>::FFmpegH264Decoder(
+FFmpegVideoDecoder<LIBAV_VER>::FFmpegVideoDecoder(
   FlushableTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
   const VideoInfo& aConfig,
   ImageContainer* aImageContainer)
   : FFmpegDataDecoder(aTaskQueue, aCallback, GetCodecId(aConfig.mMimeType))
   , mImageContainer(aImageContainer)
   , mDisplay(aConfig.mDisplay)
   , mImage(aConfig.mImage)
   , mCodecParser(nullptr)
 {
-  MOZ_COUNT_CTOR(FFmpegH264Decoder);
+  MOZ_COUNT_CTOR(FFmpegVideoDecoder);
   // Use a new MediaByteBuffer as the object will be modified during initialization.
   mExtraData = new MediaByteBuffer;
   mExtraData->AppendElements(*aConfig.mExtraData);
 }
 
 RefPtr<MediaDataDecoder::InitPromise>
-FFmpegH264Decoder<LIBAV_VER>::Init()
+FFmpegVideoDecoder<LIBAV_VER>::Init()
 {
   if (NS_FAILED(InitDecoder())) {
     return InitPromise::CreateAndReject(DecoderFailureReason::INIT_ERROR, __func__);
   }
 
   return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
 }
 
 void
-FFmpegH264Decoder<LIBAV_VER>::InitCodecContext()
+FFmpegVideoDecoder<LIBAV_VER>::InitCodecContext()
 {
   mCodecContext->width = mImage.width;
   mCodecContext->height = mImage.height;
 
   // We use the same logic as libvpx in determining the number of threads to use
   // so that we end up behaving in the same fashion when using ffmpeg as
   // we would otherwise cause various crashes (see bug 1236167)
   int decode_threads = 1;
@@ -152,18 +152,18 @@ FFmpegH264Decoder<LIBAV_VER>::InitCodecC
   mCodecContext->get_format = ChoosePixelFormat;
 
   mCodecParser = AV_CALL(av_parser_init(mCodecID));
   if (mCodecParser) {
     mCodecParser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
   }
 }
 
-FFmpegH264Decoder<LIBAV_VER>::DecodeResult
-FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample)
+FFmpegVideoDecoder<LIBAV_VER>::DecodeResult
+FFmpegVideoDecoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample)
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
 
   uint8_t* inputData = const_cast<uint8_t*>(aSample->Data());
   size_t inputSize = aSample->Size();
 
 #if LIBAVCODEC_VERSION_MAJOR >= 54
   if (inputSize && mCodecParser && (mCodecID == AV_CODEC_ID_VP8
@@ -198,18 +198,18 @@ FFmpegH264Decoder<LIBAV_VER>::DoDecodeFr
       }
     }
     return gotFrame ? DecodeResult::DECODE_FRAME : DecodeResult::DECODE_NO_FRAME;
   }
 #endif
   return DoDecodeFrame(aSample, inputData, inputSize);
 }
 
-FFmpegH264Decoder<LIBAV_VER>::DecodeResult
-FFmpegH264Decoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample,
+FFmpegVideoDecoder<LIBAV_VER>::DecodeResult
+FFmpegVideoDecoder<LIBAV_VER>::DoDecodeFrame(MediaRawData* aSample,
                                             uint8_t* aData, int aSize)
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
 
   AVPacket packet;
   AV_CALL(av_init_packet(&packet));
 
   packet.data = aData;
@@ -312,67 +312,67 @@ FFmpegH264Decoder<LIBAV_VER>::DoDecodeFr
     }
     mCallback->Output(v);
     return DecodeResult::DECODE_FRAME;
   }
   return DecodeResult::DECODE_NO_FRAME;
 }
 
 void
-FFmpegH264Decoder<LIBAV_VER>::DecodeFrame(MediaRawData* aSample)
+FFmpegVideoDecoder<LIBAV_VER>::DecodeFrame(MediaRawData* aSample)
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
 
   if (DoDecodeFrame(aSample) != DecodeResult::DECODE_ERROR &&
       mTaskQueue->IsEmpty()) {
     mCallback->InputExhausted();
   }
 }
 
 nsresult
-FFmpegH264Decoder<LIBAV_VER>::Input(MediaRawData* aSample)
+FFmpegVideoDecoder<LIBAV_VER>::Input(MediaRawData* aSample)
 {
   nsCOMPtr<nsIRunnable> runnable(
     NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
-      this, &FFmpegH264Decoder<LIBAV_VER>::DecodeFrame,
+      this, &FFmpegVideoDecoder<LIBAV_VER>::DecodeFrame,
       RefPtr<MediaRawData>(aSample)));
   mTaskQueue->Dispatch(runnable.forget());
 
   return NS_OK;
 }
 
 void
-FFmpegH264Decoder<LIBAV_VER>::ProcessDrain()
+FFmpegVideoDecoder<LIBAV_VER>::ProcessDrain()
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
   RefPtr<MediaRawData> empty(new MediaRawData());
   while (DoDecodeFrame(empty) == DecodeResult::DECODE_FRAME) {
   }
   mCallback->DrainComplete();
 }
 
 void
-FFmpegH264Decoder<LIBAV_VER>::ProcessFlush()
+FFmpegVideoDecoder<LIBAV_VER>::ProcessFlush()
 {
   mPtsContext.Reset();
   mDurationMap.Clear();
   FFmpegDataDecoder::ProcessFlush();
 }
 
-FFmpegH264Decoder<LIBAV_VER>::~FFmpegH264Decoder()
+FFmpegVideoDecoder<LIBAV_VER>::~FFmpegVideoDecoder()
 {
-  MOZ_COUNT_DTOR(FFmpegH264Decoder);
+  MOZ_COUNT_DTOR(FFmpegVideoDecoder);
   if (mCodecParser) {
     AV_CALL(av_parser_close(mCodecParser));
     mCodecParser = nullptr;
   }
 }
 
 AVCodecID
-FFmpegH264Decoder<LIBAV_VER>::GetCodecId(const nsACString& aMimeType)
+FFmpegVideoDecoder<LIBAV_VER>::GetCodecId(const nsACString& aMimeType)
 {
   if (aMimeType.EqualsLiteral("video/avc") || aMimeType.EqualsLiteral("video/mp4")) {
     return AV_CODEC_ID_H264;
   }
 
   if (aMimeType.EqualsLiteral("video/x-vnd.on2.vp6")) {
     return AV_CODEC_ID_VP6F;
   }
rename from dom/media/platforms/ffmpeg/FFmpegH264Decoder.h
rename to dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
--- a/dom/media/platforms/ffmpeg/FFmpegH264Decoder.h
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
@@ -1,47 +1,47 @@
 /* -*- 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/. */
 
-#ifndef __FFmpegH264Decoder_h__
-#define __FFmpegH264Decoder_h__
+#ifndef __FFmpegVideoDecoder_h__
+#define __FFmpegVideoDecoder_h__
 
 #include "FFmpegDataDecoder.h"
 #include "mozilla/Pair.h"
 #include "nsTArray.h"
 
 namespace mozilla
 {
 
 template <int V>
-class FFmpegH264Decoder : public FFmpegDataDecoder<V>
+class FFmpegVideoDecoder : public FFmpegDataDecoder<V>
 {
 };
 
 template <>
-class FFmpegH264Decoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
+class FFmpegVideoDecoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
 {
   typedef mozilla::layers::Image Image;
   typedef mozilla::layers::ImageContainer ImageContainer;
 
   enum DecodeResult {
     DECODE_FRAME,
     DECODE_NO_FRAME,
     DECODE_ERROR
   };
 
 public:
-  FFmpegH264Decoder(FlushableTaskQueue* aTaskQueue,
+  FFmpegVideoDecoder(FlushableTaskQueue* aTaskQueue,
                     MediaDataDecoderCallback* aCallback,
                     const VideoInfo& aConfig,
                     ImageContainer* aImageContainer);
-  virtual ~FFmpegH264Decoder();
+  virtual ~FFmpegVideoDecoder();
 
   RefPtr<InitPromise> Init() override;
   nsresult Input(MediaRawData* aSample) override;
   void ProcessDrain() override;
   void ProcessFlush() override;
   void InitCodecContext() override;
   static AVCodecID GetCodecId(const nsACString& aMimeType);
 
@@ -117,9 +117,9 @@ private:
     nsAutoTArray<DurationElement, 16> mMap;
   };
 
   DurationMap mDurationMap;
 };
 
 } // namespace mozilla
 
-#endif // __FFmpegH264Decoder_h__
+#endif // __FFmpegVideoDecoder_h__
--- a/dom/media/platforms/ffmpeg/ffmpeg57/moz.build
+++ b/dom/media/platforms/ffmpeg/ffmpeg57/moz.build
@@ -3,17 +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/.
 
 UNIFIED_SOURCES += [
     '../FFmpegAudioDecoder.cpp',
     '../FFmpegDataDecoder.cpp',
     '../FFmpegDecoderModule.cpp',
-    '../FFmpegH264Decoder.cpp',
+    '../FFmpegVideoDecoder.cpp',
 ]
 LOCAL_INCLUDES += [
     '..',
     'include',
 ]
 
 if CONFIG['GNU_CXX']:
   CXXFLAGS += [ '-Wno-deprecated-declarations' ]
--- a/dom/media/platforms/ffmpeg/ffvpx/moz.build
+++ b/dom/media/platforms/ffmpeg/ffvpx/moz.build
@@ -7,17 +7,17 @@
 LOCAL_INCLUDES += ['/xpcom/build']
 EXPORTS += [
     'FFVPXRuntimeLinker.h',
 ]
 
 UNIFIED_SOURCES += [
     '../FFmpegDataDecoder.cpp',
     '../FFmpegDecoderModule.cpp',
-    '../FFmpegH264Decoder.cpp',
+    '../FFmpegVideoDecoder.cpp',
 ]
 SOURCES += [
     'FFVPXRuntimeLinker.cpp',
 ]
 LOCAL_INCLUDES += [
     '..',
     '../ffmpeg57/include',
 ]
--- a/dom/media/platforms/ffmpeg/libav53/moz.build
+++ b/dom/media/platforms/ffmpeg/libav53/moz.build
@@ -3,17 +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/.
 
 UNIFIED_SOURCES += [
     '../FFmpegAudioDecoder.cpp',
     '../FFmpegDataDecoder.cpp',
     '../FFmpegDecoderModule.cpp',
-    '../FFmpegH264Decoder.cpp',
+    '../FFmpegVideoDecoder.cpp',
 ]
 LOCAL_INCLUDES += [
     '..',
     'include',
 ]
 
 FINAL_LIBRARY = 'xul'
 
--- a/dom/media/platforms/ffmpeg/libav54/moz.build
+++ b/dom/media/platforms/ffmpeg/libav54/moz.build
@@ -3,17 +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/.
 
 UNIFIED_SOURCES += [
     '../FFmpegAudioDecoder.cpp',
     '../FFmpegDataDecoder.cpp',
     '../FFmpegDecoderModule.cpp',
-    '../FFmpegH264Decoder.cpp',
+    '../FFmpegVideoDecoder.cpp',
 ]
 LOCAL_INCLUDES += [
     '..',
     'include',
 ]
 
 FINAL_LIBRARY = 'xul'
 
--- a/dom/media/platforms/ffmpeg/libav55/moz.build
+++ b/dom/media/platforms/ffmpeg/libav55/moz.build
@@ -3,17 +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/.
 
 UNIFIED_SOURCES += [
     '../FFmpegAudioDecoder.cpp',
     '../FFmpegDataDecoder.cpp',
     '../FFmpegDecoderModule.cpp',
-    '../FFmpegH264Decoder.cpp',
+    '../FFmpegVideoDecoder.cpp',
 ]
 LOCAL_INCLUDES += [
     '..',
     'include',
 ]
 
 if CONFIG['GNU_CXX']:
   CXXFLAGS += [ '-Wno-deprecated-declarations' ]