Bug 1049107 - Fix build with --disable-eme. r=kentuckyfriedtakahe

This commit is contained in:
Chris Pearce 2014-08-08 14:44:04 +12:00
Родитель dcc882e43c
Коммит f7c6083ca7
13 изменённых файлов: 76 добавлений и 7 удалений

Просмотреть файл

@ -2653,9 +2653,11 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
mDecoder->SetPreservesPitch(mPreservesPitch);
mDecoder->SetPlaybackRate(mPlaybackRate);
#ifdef MOZ_EME
if (mMediaKeys) {
mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy());
}
#endif
if (mPreloadAction == HTMLMediaElement::PRELOAD_METADATA) {
mDecoder->SetMinimizePrerollUntilPlaybackStarts();
}

Просмотреть файл

@ -25,7 +25,9 @@ class ReentrantMonitor;
class VideoFrameContainer;
class TimedMetadata;
class MediaDecoderOwner;
#ifdef MOZ_EME
class CDMProxy;
#endif
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
@ -139,8 +141,10 @@ public:
uint32_t& mDecoded;
};
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) { return NS_ERROR_NOT_IMPLEMENTED; }
virtual CDMProxy* GetCDMProxy() { return nullptr; }
#endif
};
class MetadataEventRunner : public nsRunnable

Просмотреть файл

@ -1666,6 +1666,7 @@ bool MediaDecoder::CanPlayThrough()
stats.mDownloadPosition > stats.mPlaybackPosition + readAheadMargin;
}
#ifdef MOZ_EME
nsresult
MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
{
@ -1684,6 +1685,7 @@ MediaDecoder::GetCDMProxy()
MOZ_ASSERT(OnDecodeThread() || NS_IsMainThread());
return mProxy;
}
#endif
#ifdef MOZ_RAW
bool

Просмотреть файл

@ -190,7 +190,9 @@ destroying the MediaDecoder object.
#include "MediaStreamGraph.h"
#include "AbstractMediaDecoder.h"
#include "necko-config.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
class nsIStreamListener;
class nsIPrincipal;
@ -850,11 +852,13 @@ public:
// The decoder monitor must be held.
bool IsLogicallyPlaying();
#ifdef MOZ_EME
// This takes the decoder monitor.
virtual nsresult SetCDMProxy(CDMProxy* aProxy) MOZ_OVERRIDE;
// Decoder monitor must be held.
virtual CDMProxy* GetCDMProxy() MOZ_OVERRIDE;
#endif
#ifdef MOZ_RAW
static bool IsRawEnabled();
@ -1107,7 +1111,9 @@ private:
// The |RestrictedAccessMonitor| member object.
RestrictedAccessMonitor mReentrantMonitor;
#ifdef MOZ_EME
nsRefPtr<CDMProxy> mProxy;
#endif
protected:
// Data about MediaStreams that are being fed by this decoder.

Просмотреть файл

@ -138,11 +138,13 @@ public:
// when the connection between Rtsp server and client gets lost.
virtual void ResetConnectionState() = 0;
#ifdef MOZ_EME
// Dispatches a "needkey" event to the HTMLMediaElement, with the
// provided init data.
// Main thread only.
virtual void DispatchNeedKey(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) = 0;
#endif
};
}

Просмотреть файл

@ -8,7 +8,9 @@
#include "MP4Reader.h"
#include "MediaDecoderStateMachine.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
#include "prlog.h"
#ifdef XP_WIN
@ -29,6 +31,7 @@ MediaDecoderStateMachine* MP4Decoder::CreateStateMachine()
return new MediaDecoderStateMachine(this, new MP4Reader(this));
}
#ifdef MOZ_EME
nsresult
MP4Decoder::SetCDMProxy(CDMProxy* aProxy)
{
@ -45,6 +48,7 @@ MP4Decoder::SetCDMProxy(CDMProxy* aProxy)
}
return NS_OK;
}
#endif
bool
MP4Decoder::GetSupportedCodecs(const nsACString& aType,

Просмотреть файл

@ -24,7 +24,9 @@ public:
virtual MediaDecoderStateMachine* CreateStateMachine();
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) MOZ_OVERRIDE;
#endif
// Returns true if aType is a MIME type that we can render with the
// a MP4 platform decoder backend. If aCodecList is non null,

Просмотреть файл

@ -15,6 +15,10 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/TimeRanges.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
using mozilla::layers::Image;
using mozilla::layers::LayerManager;
using mozilla::layers::LayersBackend;
@ -204,6 +208,7 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor)
return NS_OK;
}
#ifdef MOZ_EME
class DispatchKeyNeededEvent : public nsRunnable {
public:
DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder,
@ -229,9 +234,11 @@ private:
nsTArray<uint8_t> mInitData;
nsString mInitDataType;
};
#endif
bool MP4Reader::IsWaitingMediaResources()
{
#ifdef MOZ_EME
nsRefPtr<CDMProxy> proxy;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
@ -251,6 +258,9 @@ bool MP4Reader::IsWaitingMediaResources()
LOG("MP4Reader::IsWaitingMediaResources() capsKnown=%d", caps.AreCapsKnown());
return !caps.AreCapsKnown();
}
#else
return false;
#endif
}
void
@ -296,6 +306,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
mDemuxerInitialized = true;
}
if (mDemuxer->Crypto().valid) {
#ifdef MOZ_EME
if (!sIsEMEEnabled) {
// TODO: Need to signal DRM/EME required somehow...
return NS_ERROR_FAILURE;
@ -330,6 +341,10 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo,
HasVideo(),
GetTaskQueue());
NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE);
#else
// EME not supported.
return NS_ERROR_FAILURE;
#endif
} else {
mPlatform = PlatformDecoderModule::Create();
NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE);

Просмотреть файл

@ -12,7 +12,6 @@
#include "PlatformDecoderModule.h"
#include "mp4_demuxer/mp4_demuxer.h"
#include "MediaTaskQueue.h"
#include "mozilla/CDMProxy.h"
#include <deque>
#include "mozilla/Monitor.h"

Просмотреть файл

@ -15,8 +15,10 @@
#include "AppleDecoderModule.h"
#endif
#include "mozilla/Preferences.h"
#ifdef MOZ_EME
#include "EMEDecoderModule.h"
#include "mozilla/CDMProxy.h"
#endif
#include "SharedThreadPool.h"
#include "MediaTaskQueue.h"
@ -70,6 +72,7 @@ CreateTaskQueue()
return t->mTaskQueue.forget();
}
#ifdef MOZ_EME
/* static */
PlatformDecoderModule*
PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy,
@ -101,6 +104,7 @@ PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy,
cdmDecodesVideo,
CreateTaskQueue());
}
#endif
/* static */
PlatformDecoderModule*

Просмотреть файл

@ -66,6 +66,7 @@ public:
// This is called on the decode task queue.
static PlatformDecoderModule* Create();
#ifdef MOZ_EME
// Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or
// decrypt-and-decode EME encrypted content. If the CDM only decrypts and
// does not decode, we create a PDM and use that to create MediaDataDecoders
@ -75,6 +76,7 @@ public:
bool aHasAudio,
bool aHasVideo,
MediaTaskQueue* aTaskQueue);
#endif
// Called to shutdown the decoder module and cleanup state. The PDM
// is deleted immediately after Shutdown() is called. Shutdown() is

Просмотреть файл

@ -0,0 +1,30 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
EXPORTS += [
'EMEAACDecoder.h',
'EMEDecoderModule.h',
'EMEH264Decoder.h',
]
UNIFIED_SOURCES += [
'EMEAACDecoder.cpp',
'EMEDecoderModule.cpp',
'EMEH264Decoder.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'../base',
]
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['NOMINMAX'] = True

Просмотреть файл

@ -5,9 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS += [
'eme/EMEAACDecoder.h',
'eme/EMEDecoderModule.h',
'eme/EMEH264Decoder.h',
'MP4Decoder.h',
'MP4Reader.h',
'PlatformDecoderModule.h',
@ -15,9 +12,6 @@ EXPORTS += [
UNIFIED_SOURCES += [
'BlankDecoderModule.cpp',
'eme/EMEAACDecoder.cpp',
'eme/EMEDecoderModule.cpp',
'eme/EMEH264Decoder.cpp',
'PlatformDecoderModule.cpp',
]
@ -29,6 +23,9 @@ SOURCES += [
if CONFIG['MOZ_WMF']:
DIRS += [ 'wmf' ];
if CONFIG['MOZ_EME']:
DIRS += ['eme']
if CONFIG['MOZ_FFMPEG']:
EXPORTS += [
'ffmpeg/FFmpegRuntimeLinker.h',