Skip to content

Commit

Permalink
[media] Enable ffmpeg decoding. Fixes JB#49556
Browse files Browse the repository at this point in the history
Revert MP4DECODER defines to MOZ_FMP4. Should be squashed with
commit c87b5b3 "Disable MP4 decoder related code paths from EME".
Drop disable of ffmpeg, fmp4 and eme in build config.
Require ffmpeg for build.
  • Loading branch information
abranson committed May 12, 2020
1 parent 6f0feeb commit a348742
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 34 deletions.
6 changes: 3 additions & 3 deletions dom/media/platforms/PDMFactory.cpp
Expand Up @@ -44,7 +44,7 @@

#include "DecoderDoctorDiagnostics.h"

#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif
#include "mozilla/dom/RemoteVideoDecoder.h"
Expand Down Expand Up @@ -124,7 +124,7 @@ class SupportChecker
RefPtr<MediaByteBuffer> extraData = aTrackConfig.GetAsVideoInfo()->mExtraData;
AddToCheckList(
[mimeType, extraData]() {
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(mimeType)) {
mp4_demuxer::SPSData spsdata;
// WMF H.264 Video Decoder and Apple ATDecoder
Expand Down Expand Up @@ -306,7 +306,7 @@ PDMFactory::CreateDecoderWithPDM(PlatformDecoderModule* aPDM,

CreateDecoderParams params = aParams;
params.mCallback = callback;
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(config.mMimeType) && !aParams.mUseBlankDecoder) {
RefPtr<H264Converter> h = new H264Converter(aPDM, params);
const nsresult rv = h->GetLastError();
Expand Down
6 changes: 3 additions & 3 deletions dom/media/platforms/agnostic/BlankDecoderModule.cpp
Expand Up @@ -13,7 +13,7 @@
#include "mozilla/TaskQueue.h"
#include "mp4_demuxer/AnnexB.h"
#include "mp4_demuxer/H264.h"
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif
#include "nsAutoPtr.h"
Expand All @@ -36,7 +36,7 @@ class BlankMediaDataDecoder : public MediaDataDecoder {
: mCreator(aCreator)
, mCallback(aParams.mCallback)
, mMaxRefFrames(
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
aParams.mConfig.GetType() == TrackInfo::kVideoTrack &&
MP4Decoder::IsH264(aParams.mConfig.mMimeType)
? mp4_demuxer::AnnexB::HasSPS(aParams.VideoConfig().mExtraData)
Expand Down Expand Up @@ -267,7 +267,7 @@ class BlankDecoderModule : public PlatformDecoderModule {
ConversionRequired
DecoderNeedsConversion(const TrackInfo& aConfig) const override
{
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (aConfig.IsVideo() && MP4Decoder::IsH264(aConfig.mMimeType)) {
return ConversionRequired::kNeedAVCC;
} else {
Expand Down
4 changes: 2 additions & 2 deletions dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
Expand Up @@ -17,7 +17,7 @@
#include "nsClassHashtable.h"
#include "GMPDecoderModule.h"

#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif

Expand Down Expand Up @@ -291,7 +291,7 @@ EMEDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams)
PlatformDecoderModule::ConversionRequired
EMEDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
{
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (aConfig.IsVideo() && MP4Decoder::IsH264(aConfig.mMimeType)) {
return ConversionRequired::kNeedAVCC;
} else
Expand Down
4 changes: 2 additions & 2 deletions dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp
Expand Up @@ -8,7 +8,7 @@
#include "GMPVideoEncodedFrameImpl.h"
#include "mozilla/CDMProxy.h"
#include "MediaData.h"
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif
#include "VPXDecoder.h"
Expand Down Expand Up @@ -41,7 +41,7 @@ void
EMEVideoDecoder::InitTags(nsTArray<nsCString>& aTags)
{
VideoInfo config = GetConfig();
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(config.mMimeType)) {
aTags.AppendElement(NS_LITERAL_CSTRING("h264"));
} else if (VPXDecoder::IsVP8(config.mMimeType)) {
Expand Down
12 changes: 6 additions & 6 deletions dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
Expand Up @@ -17,7 +17,7 @@
#include "mozilla/StaticMutex.h"
#include "gmp-audio-decode.h"
#include "gmp-video-decode.h"
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif
#include "VPXDecoder.h"
Expand Down Expand Up @@ -53,7 +53,7 @@ CreateDecoderWrapper(MediaDataDecoderCallback* aCallback)
already_AddRefed<MediaDataDecoder>
GMPDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
{
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (!MP4Decoder::IsH264(aParams.mConfig.mMimeType) &&
!VPXDecoder::IsVP8(aParams.mConfig.mMimeType) &&
!VPXDecoder::IsVP9(aParams.mConfig.mMimeType)) {
Expand Down Expand Up @@ -103,7 +103,7 @@ PlatformDecoderModule::ConversionRequired
GMPDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
{
// GMPVideoCodecType::kGMPVideoCodecH264 specifies that encoded frames must be in AVCC format.
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (aConfig.IsVideo() && MP4Decoder::IsH264(aConfig.mMimeType)) {
return ConversionRequired::kNeedAVCC;
} else
Expand All @@ -126,7 +126,7 @@ GMPDecoderModule::PreferredGMP(const nsACString& aMimeType)
}
}

#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(aMimeType)) {
switch (MediaPrefs::GMPH264Preferred()) {
case 1: rv.emplace(kEMEKeySystemClearkey); break;
Expand All @@ -148,7 +148,7 @@ GMPDecoderModule::SupportsMimeType(const nsACString& aMimeType,
return false;
}

#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(aMimeType)) {
return HaveGMPFor(NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER),
{ NS_LITERAL_CSTRING("h264"), aGMP.value()});
Expand All @@ -165,7 +165,7 @@ GMPDecoderModule::SupportsMimeType(const nsACString& aMimeType,
{ NS_LITERAL_CSTRING("vp8"), aGMP.value()});
}

#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsAAC(aMimeType)) {
return HaveGMPFor(NS_LITERAL_CSTRING(GMP_API_AUDIO_DECODER),
{ NS_LITERAL_CSTRING("aac"), aGMP.value()});
Expand Down
4 changes: 2 additions & 2 deletions dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
Expand Up @@ -160,7 +160,7 @@ GMPVideoDecoder::GMPVideoDecoder(const GMPVideoDecoderParams& aParams)
void
GMPVideoDecoder::InitTags(nsTArray<nsCString>& aTags)
{
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(mConfig.mMimeType)) {
aTags.AppendElement(NS_LITERAL_CSTRING("h264"));
const Maybe<nsCString> gmp(
Expand Down Expand Up @@ -257,7 +257,7 @@ GMPVideoDecoder::GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost)

codec.mGMPApiVersion = kGMPVersion33;
nsTArray<uint8_t> codecSpecific;
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(mConfig.mMimeType)) {
codec.mCodecType = kGMPVideoCodecH264;
codecSpecific.AppendElement(0); // mPacketizationMode.
Expand Down
4 changes: 2 additions & 2 deletions dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
Expand Up @@ -11,7 +11,7 @@

#include "MediaInfo.h"
#include "VPXDecoder.h"
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif

Expand Down Expand Up @@ -369,7 +369,7 @@ FFmpegVideoDecoder<LIBAV_VER>::~FFmpegVideoDecoder()
AVCodecID
FFmpegVideoDecoder<LIBAV_VER>::GetCodecId(const nsACString& aMimeType)
{
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(aMimeType)) {
return AV_CODEC_ID_H264;
}
Expand Down
6 changes: 3 additions & 3 deletions dom/media/platforms/wmf/WMFDecoderModule.cpp
Expand Up @@ -26,7 +26,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/WindowsVersion.h"
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif
#include "VPXDecoder.h"
Expand Down Expand Up @@ -212,7 +212,7 @@ WMFDecoderModule::Supports(const TrackInfo& aTrackInfo,
WMFDecoderModule::HasAAC()) {
return true;
}
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (MP4Decoder::IsH264(aTrackInfo.mMimeType) && WMFDecoderModule::HasH264()) {
const VideoInfo* videoInfo = aTrackInfo.GetAsVideoInfo();
MOZ_ASSERT(videoInfo);
Expand Down Expand Up @@ -251,7 +251,7 @@ WMFDecoderModule::Supports(const TrackInfo& aTrackInfo,
PlatformDecoderModule::ConversionRequired
WMFDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
{
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
if (aConfig.IsVideo() && MP4Decoder::IsH264(aConfig.mMimeType)) {
return ConversionRequired::kNeedAnnexB;
} else
Expand Down
4 changes: 2 additions & 2 deletions dom/media/platforms/wmf/WMFVideoMFTManager.cpp
Expand Up @@ -29,7 +29,7 @@
#include "nsPrintfCString.h"
#include "MediaTelemetryConstants.h"
#include "GMPUtils.h" // For SplitAt. TODO: Move SplitAt to a central place.
#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
#include "MP4Decoder.h"
#endif
#include "VPXDecoder.h"
Expand Down Expand Up @@ -100,7 +100,7 @@ WMFVideoMFTManager::WMFVideoMFTManager(
{
MOZ_COUNT_CTOR(WMFVideoMFTManager);

#if defined(MP4DECODER)
#if defined(MOZ_FMP4)
// Need additional checks/params to check vp8/vp9
if (MP4Decoder::IsH264(aConfig.mMimeType)) {
mStreamType = H264;
Expand Down
2 changes: 0 additions & 2 deletions embedding/embedlite/config/mozconfig.merqtxulrunner
Expand Up @@ -15,7 +15,6 @@ ac_add_options --prefix=/usr
ac_add_options --with-system-jpeg
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --disable-ffmpeg
ac_add_options --enable-system-sqlite

ac_add_options --without-x
Expand Down Expand Up @@ -47,5 +46,4 @@ ac_add_options --enable-profiling
ac_add_options --disable-dbus
ac_add_options --disable-necko-wifi
ac_add_options --disable-elf-hack
ac_add_options --disable-fmp4
ac_add_options --disable-accessibility
13 changes: 6 additions & 7 deletions rpm/xulrunner-qt5.spec
Expand Up @@ -76,9 +76,12 @@ BuildRequires: pkgconfig(sqlite3) >= 3.8.9
%endif
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libproxy-1.0)
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavfilter)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libswresample)
BuildRequires: pkgconfig(libswscale)
BuildRequires: pkgconfig(Qt5Positioning)
BuildRequires: pkgconfig(contentaction5)
BuildRequires: qt5-qttools
Expand Down Expand Up @@ -177,10 +180,6 @@ echo "ac_add_options --disable-tests" >> "$MOZCONFIG"
echo "ac_add_options --disable-strip" >> "$MOZCONFIG"
echo "ac_add_options --with-app-name=%{name}" >> "$MOZCONFIG"

# Encrypted Media Extension (EME) support requires Fragmented MP4 support
echo "ac_add_options --disable-fmp4" >> "$MOZCONFIG"
echo "ac_add_options --disable-eme" >> "$MOZCONFIG"

%if %{system_nss}
echo "ac_add_options --with-system-nss" >> "$MOZCONFIG"
%endif
Expand Down

0 comments on commit a348742

Please sign in to comment.