From e16bcd08aae85a7d9c2de5a4b1c733280cb81112 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 13 May 2018 00:08:52 +0200 Subject: Remove MOZ_WIDGET_GONK [2/2] Tag #288 --- dom/media/DOMMediaStream.cpp | 102 +-------------------- dom/media/DOMMediaStream.h | 11 --- dom/media/MediaData.cpp | 53 ----------- dom/media/MediaManager.cpp | 17 +--- dom/media/android/AndroidMediaPluginHost.cpp | 8 +- dom/media/encoder/OpusTrackEncoder.cpp | 5 - dom/media/encoder/TrackEncoder.cpp | 5 - dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp | 5 - dom/media/gmp/GMPServiceParent.cpp | 4 - dom/media/ogg/OggCodecState.cpp | 12 --- dom/media/ogg/OggWriter.cpp | 5 - dom/media/platforms/omx/OmxPlatformLayer.cpp | 5 - .../systemservices/MediaSystemResourceService.cpp | 17 ---- dom/media/webrtc/MediaEngineCameraVideoSource.cpp | 2 +- dom/media/webrtc/MediaEngineDefault.cpp | 2 +- dom/media/webrtc/MediaEngineWebRTC.cpp | 2 +- 16 files changed, 9 insertions(+), 246 deletions(-) (limited to 'dom/media') diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index c1d451035..118d845a3 100755 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -1505,20 +1505,6 @@ DOMAudioNodeMediaStream::CreateTrackUnionStreamAsInput(nsPIDOMWindowInner* aWind DOMHwMediaStream::DOMHwMediaStream(nsPIDOMWindowInner* aWindow) : DOMLocalMediaStream(aWindow, nullptr) { -#ifdef MOZ_WIDGET_GONK - if (!mWindow) { - NS_ERROR("Expected window here."); - mPrincipalHandle = PRINCIPAL_HANDLE_NONE; - return; - } - nsIDocument* doc = mWindow->GetExtantDoc(); - if (!doc) { - NS_ERROR("Expected document here."); - mPrincipalHandle = PRINCIPAL_HANDLE_NONE; - return; - } - mPrincipalHandle = MakePrincipalHandle(doc->NodePrincipal()); -#endif } DOMHwMediaStream::~DOMHwMediaStream() @@ -1545,31 +1531,8 @@ DOMHwMediaStream::Init(MediaStream* stream, OverlayImage* aImage) { SourceMediaStream* srcStream = stream->AsSourceStream(); -#ifdef MOZ_WIDGET_GONK - if (aImage) { - mOverlayImage = aImage; - } else { - Data imageData; - imageData.mOverlayId = DEFAULT_IMAGE_ID; - imageData.mSize.width = DEFAULT_IMAGE_WIDTH; - imageData.mSize.height = DEFAULT_IMAGE_HEIGHT; - - mOverlayImage = new OverlayImage(); - mOverlayImage->SetData(imageData); - } -#endif - if (srcStream) { VideoSegment segment; -#ifdef MOZ_WIDGET_GONK - const StreamTime delta = STREAM_TIME_MAX; // Because MediaStreamGraph will run out frames in non-autoplay mode, - // we must give it bigger frame length to cover this situation. - - RefPtr image = static_cast(mOverlayImage.get()); - mozilla::gfx::IntSize size = image->GetSize(); - - segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle); -#endif srcStream->AddTrack(TRACK_VIDEO_PRIMARY, 0, new VideoSegment()); srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment); srcStream->AdvanceKnownTracksTime(STREAM_TIME_MAX); @@ -1579,30 +1542,13 @@ DOMHwMediaStream::Init(MediaStream* stream, OverlayImage* aImage) int32_t DOMHwMediaStream::RequestOverlayId() { -#ifdef MOZ_WIDGET_GONK - return mOverlayImage->GetOverlayId(); -#else + /*** STUB ***/ return -1; -#endif } void DOMHwMediaStream::SetImageSize(uint32_t width, uint32_t height) { -#ifdef MOZ_WIDGET_GONK - if (mOverlayImage->GetSidebandStream().IsValid()) { - OverlayImage::SidebandStreamData imgData; - imgData.mStream = mOverlayImage->GetSidebandStream(); - imgData.mSize = IntSize(width, height); - mOverlayImage->SetData(imgData); - } else { - OverlayImage::Data imgData; - imgData.mOverlayId = mOverlayImage->GetOverlayId(); - imgData.mSize = IntSize(width, height); - mOverlayImage->SetData(imgData); - } -#endif - SourceMediaStream* srcStream = GetInputStream()->AsSourceStream(); StreamTracks::Track* track = srcStream->FindTrack(TRACK_VIDEO_PRIMARY); @@ -1610,23 +1556,6 @@ DOMHwMediaStream::SetImageSize(uint32_t width, uint32_t height) return; } -#ifdef MOZ_WIDGET_GONK - // Clear the old segment. - // Changing the existing content of segment is a Very BAD thing, and this way will - // confuse consumers of MediaStreams. - // It is only acceptable for DOMHwMediaStream - // because DOMHwMediaStream doesn't have consumers of TV streams currently. - track->GetSegment()->Clear(); - - // Change the image size. - const StreamTime delta = STREAM_TIME_MAX; - RefPtr image = static_cast(mOverlayImage.get()); - mozilla::gfx::IntSize size = image->GetSize(); - VideoSegment segment; - - segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle); - srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment); -#endif } void @@ -1635,9 +1564,6 @@ DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage) if (!aImage) { return; } -#ifdef MOZ_WIDGET_GONK - mOverlayImage = aImage; -#endif SourceMediaStream* srcStream = GetInputStream()->AsSourceStream(); StreamTracks::Track* track = srcStream->FindTrack(TRACK_VIDEO_PRIMARY); @@ -1646,34 +1572,10 @@ DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage) return; } -#ifdef MOZ_WIDGET_GONK - // Clear the old segment. - // Changing the existing content of segment is a Very BAD thing, and this way will - // confuse consumers of MediaStreams. - // It is only acceptable for DOMHwMediaStream - // because DOMHwMediaStream doesn't have consumers of TV streams currently. - track->GetSegment()->Clear(); - - // Change the image size. - const StreamTime delta = STREAM_TIME_MAX; - RefPtr image = static_cast(mOverlayImage.get()); - mozilla::gfx::IntSize size = image->GetSize(); - VideoSegment segment; - - segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle); - srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment); -#endif } void DOMHwMediaStream::SetOverlayId(int32_t aOverlayId) { -#ifdef MOZ_WIDGET_GONK - OverlayImage::Data imgData; - - imgData.mOverlayId = aOverlayId; - imgData.mSize = mOverlayImage->GetSize(); - - mOverlayImage->SetData(imgData); -#endif + /*** STUB ***/ } diff --git a/dom/media/DOMMediaStream.h b/dom/media/DOMMediaStream.h index 12f3529a8..5618f8b00 100644 --- a/dom/media/DOMMediaStream.h +++ b/dom/media/DOMMediaStream.h @@ -833,9 +833,6 @@ class DOMHwMediaStream : public DOMLocalMediaStream { typedef mozilla::gfx::IntSize IntSize; typedef layers::OverlayImage OverlayImage; -#ifdef MOZ_WIDGET_GONK - typedef layers::OverlayImage::Data Data; -#endif public: explicit DOMHwMediaStream(nsPIDOMWindowInner* aWindow); @@ -853,14 +850,6 @@ protected: private: void Init(MediaStream* aStream, OverlayImage* aImage); - -#ifdef MOZ_WIDGET_GONK - const int DEFAULT_IMAGE_ID = 0x01; - const int DEFAULT_IMAGE_WIDTH = 400; - const int DEFAULT_IMAGE_HEIGHT = 300; - RefPtr mOverlayImage; - PrincipalHandle mPrincipalHandle; -#endif }; } // namespace mozilla diff --git a/dom/media/MediaData.cpp b/dom/media/MediaData.cpp index 4a52c22ae..94f5f32a0 100644 --- a/dom/media/MediaData.cpp +++ b/dom/media/MediaData.cpp @@ -9,9 +9,6 @@ #include "VideoUtils.h" #include "ImageContainer.h" -#ifdef MOZ_WIDGET_GONK -#include -#endif #include namespace mozilla { @@ -93,31 +90,6 @@ ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane) aPlane.mStride > 0 && aPlane.mWidth <= aPlane.mStride; } -#ifdef MOZ_WIDGET_GONK -static bool -IsYV12Format(const VideoData::YCbCrBuffer::Plane& aYPlane, - const VideoData::YCbCrBuffer::Plane& aCbPlane, - const VideoData::YCbCrBuffer::Plane& aCrPlane) -{ - return - aYPlane.mWidth % 2 == 0 && - aYPlane.mHeight % 2 == 0 && - aYPlane.mWidth / 2 == aCbPlane.mWidth && - aYPlane.mHeight / 2 == aCbPlane.mHeight && - aCbPlane.mWidth == aCrPlane.mWidth && - aCbPlane.mHeight == aCrPlane.mHeight; -} - -static bool -IsInEmulator() -{ - char propQemu[PROPERTY_VALUE_MAX]; - property_get("ro.kernel.qemu", propQemu, ""); - return !strncmp(propQemu, "1", 1); -} - -#endif - VideoData::VideoData(int64_t aOffset, int64_t aTime, int64_t aDuration, @@ -310,19 +282,8 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo, aTimecode, aInfo.mDisplay, 0)); -#ifdef MOZ_WIDGET_GONK - const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0]; - const YCbCrBuffer::Plane &Cb = aBuffer.mPlanes[1]; - const YCbCrBuffer::Plane &Cr = aBuffer.mPlanes[2]; -#endif - // Currently our decoder only knows how to output to ImageFormat::PLANAR_YCBCR // format. -#ifdef MOZ_WIDGET_GONK - if (IsYV12Format(Y, Cb, Cr) && !IsInEmulator()) { - v->mImage = new layers::GrallocImage(); - } -#endif if (!v->mImage) { v->mImage = aContainer->CreatePlanarYCbCrImage(); } @@ -341,20 +302,6 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo, return nullptr; } -#ifdef MOZ_WIDGET_GONK - if (!videoImage->IsValid() && IsYV12Format(Y, Cb, Cr)) { - // Failed to allocate gralloc. Try fallback. - v->mImage = aContainer->CreatePlanarYCbCrImage(); - if (!v->mImage) { - return nullptr; - } - videoImage = v->mImage->AsPlanarYCbCrImage(); - if (!VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture, - true /* aCopyData */)) { - return nullptr; - } - } -#endif return v.forget(); } diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 44f330e99..ba6b4cd47 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -13,9 +13,6 @@ #include "nsArray.h" #include "nsContentUtils.h" #include "nsHashPropertyBag.h" -#ifdef MOZ_WIDGET_GONK -#include "nsIAudioManager.h" -#endif #include "nsIEventTarget.h" #include "nsIUUIDGenerator.h" #include "nsIScriptGlobalObject.h" @@ -1569,7 +1566,7 @@ private: RefPtr mManager; // get ref to this when creating the runnable }; -#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK) +#if defined(ANDROID) class GetUserMediaRunnableWrapper : public Runnable { public: @@ -3042,18 +3039,6 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic, } return NS_OK; } -#ifdef MOZ_WIDGET_GONK - else if (!strcmp(aTopic, "phone-state-changed")) { - nsString state(aData); - nsresult rv; - uint32_t phoneState = state.ToInteger(&rv); - - if (NS_SUCCEEDED(rv) && phoneState == nsIAudioManager::PHONE_STATE_IN_CALL) { - StopMediaStreams(); - } - return NS_OK; - } -#endif return NS_OK; } diff --git a/dom/media/android/AndroidMediaPluginHost.cpp b/dom/media/android/AndroidMediaPluginHost.cpp index d3dce2b93..cc3adbbd3 100644 --- a/dom/media/android/AndroidMediaPluginHost.cpp +++ b/dom/media/android/AndroidMediaPluginHost.cpp @@ -22,7 +22,7 @@ #include "nsIPropertyBag2.h" -#if defined(ANDROID) || defined(MOZ_WIDGET_GONK) +#if defined(ANDROID) #include "android/log.h" #define ALOG(args...) __android_log_print(ANDROID_LOG_INFO, "AndroidMediaPluginHost" , ## args) #else @@ -134,7 +134,7 @@ static bool IsOmxSupported() // nullptr is returned if Omx decoding is not supported on the device, static const char* GetOmxLibraryName() { -#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK) +#if defined(ANDROID) nsCOMPtr infoService = do_GetService("@mozilla.org/system-info;1"); NS_ASSERTION(infoService, "Could not find a system info service"); @@ -172,7 +172,7 @@ static const char* GetOmxLibraryName() if (!IsOmxSupported()) return nullptr; -#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK) +#if defined(ANDROID) if (version >= 17) { return "libomxpluginkk.so"; } @@ -180,8 +180,6 @@ static const char* GetOmxLibraryName() // Ice Cream Sandwich and Jellybean return "libomxplugin.so"; -#elif defined(ANDROID) && defined(MOZ_WIDGET_GONK) - return "libomxplugin.so"; #else return nullptr; #endif diff --git a/dom/media/encoder/OpusTrackEncoder.cpp b/dom/media/encoder/OpusTrackEncoder.cpp index c65d57788..4b55b3954 100644 --- a/dom/media/encoder/OpusTrackEncoder.cpp +++ b/dom/media/encoder/OpusTrackEncoder.cpp @@ -9,12 +9,7 @@ #include #undef LOG -#ifdef MOZ_WIDGET_GONK -#include -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args); -#else #define LOG(args, ...) -#endif namespace mozilla { diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index ea39bb5a6..df6b24409 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -10,12 +10,7 @@ #include "VideoUtils.h" #undef LOG -#ifdef MOZ_WIDGET_GONK -#include -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args); -#else #define LOG(args, ...) -#endif namespace mozilla { diff --git a/dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp b/dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp index fa23616e9..cb4524e00 100644 --- a/dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp +++ b/dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp @@ -13,12 +13,7 @@ #include "GeckoProfiler.h" #undef LOG -#ifdef MOZ_WIDGET_GONK -#include -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args); -#else #define LOG(args, ...) -#endif namespace mozilla { diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index b58ab8853..2b4831cd6 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -270,11 +270,7 @@ GeckoMediaPluginServiceParent::InitStorage() // Directory service is main thread only, so cache the profile dir here // so that we can use it off main thread. -#ifdef MOZ_WIDGET_GONK - nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/b2g/mozilla"), false, getter_AddRefs(mStorageBaseDir)); -#else nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mStorageBaseDir)); -#endif if (NS_WARN_IF(NS_FAILED(rv))) { return rv; diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index 6830639e8..e7e1ca4a3 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -18,18 +18,6 @@ #include #include "opus/opus_multistream.h" -// On Android JellyBean, the hardware.h header redefines version_major and -// version_minor, which breaks our build. See: -// https://bugzilla.mozilla.org/show_bug.cgi?id=912702#c6 -#ifdef MOZ_WIDGET_GONK -#ifdef version_major -#undef version_major -#endif -#ifdef version_minor -#undef version_minor -#endif -#endif - namespace mozilla { extern LazyLogModule gMediaDecoderLog; diff --git a/dom/media/ogg/OggWriter.cpp b/dom/media/ogg/OggWriter.cpp index bb0dca67b..e1aa93eaf 100644 --- a/dom/media/ogg/OggWriter.cpp +++ b/dom/media/ogg/OggWriter.cpp @@ -7,12 +7,7 @@ #include "GeckoProfiler.h" #undef LOG -#ifdef MOZ_WIDGET_GONK -#include -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args); -#else #define LOG(args, ...) -#endif namespace mozilla { diff --git a/dom/media/platforms/omx/OmxPlatformLayer.cpp b/dom/media/platforms/omx/OmxPlatformLayer.cpp index d1f43144d..039b4a22f 100644 --- a/dom/media/platforms/omx/OmxPlatformLayer.cpp +++ b/dom/media/platforms/omx/OmxPlatformLayer.cpp @@ -8,11 +8,6 @@ #include "OMX_VideoExt.h" // For VP8. -#if defined(MOZ_WIDGET_GONK) && (ANDROID_VERSION == 20 || ANDROID_VERSION == 19) -#define OMX_PLATFORM_GONK -#include "GonkOmxPlatformLayer.h" -#endif - #include "VPXDecoder.h" #ifdef LOG diff --git a/dom/media/systemservices/MediaSystemResourceService.cpp b/dom/media/systemservices/MediaSystemResourceService.cpp index 0e5d6a50c..4434c54c2 100644 --- a/dom/media/systemservices/MediaSystemResourceService.cpp +++ b/dom/media/systemservices/MediaSystemResourceService.cpp @@ -47,23 +47,6 @@ MediaSystemResourceService::MediaSystemResourceService() : mDestroyed(false) { MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); -#ifdef MOZ_WIDGET_GONK - // The maximum number of hardware resoureces available. - // XXX need to hange to a dynamic way. - enum - { - VIDEO_DECODER_COUNT = 1, - VIDEO_ENCODER_COUNT = 1 - }; - - MediaSystemResource* resource; - - resource = new MediaSystemResource(VIDEO_DECODER_COUNT); - mResources.Put(static_cast(MediaSystemResourceType::VIDEO_DECODER), resource); - - resource = new MediaSystemResource(VIDEO_ENCODER_COUNT); - mResources.Put(static_cast(MediaSystemResourceType::VIDEO_ENCODER), resource); -#endif } MediaSystemResourceService::~MediaSystemResourceService() diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp index a0f31d937..e1e572724 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp @@ -325,7 +325,7 @@ MediaEngineCameraVideoSource::SetName(nsString aName) VideoFacingModeEnum facingMode = VideoFacingModeEnum::User; // Set facing mode based on device name. -#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK) +#if defined(ANDROID) // Names are generated. Example: "Camera 0, Facing back, Orientation 90" // // See media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/ diff --git a/dom/media/webrtc/MediaEngineDefault.cpp b/dom/media/webrtc/MediaEngineDefault.cpp index 9c97d197f..eb0ac2b6f 100644 --- a/dom/media/webrtc/MediaEngineDefault.cpp +++ b/dom/media/webrtc/MediaEngineDefault.cpp @@ -192,7 +192,7 @@ MediaEngineDefaultVideoSource::Start(SourceMediaStream* aStream, TrackID aID, mTrackID = aID; // Start timer for subsequent frames -#if (defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)) && defined(DEBUG) +#if defined(MOZ_WIDGET_ANDROID) && defined(DEBUG) // emulator debug is very, very slow and has problems dealing with realtime audio inputs mTimer->InitWithCallback(this, (1000 / mOpts.mFPS)*10, nsITimer::TYPE_REPEATING_SLACK); #else diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index 1a2dc9a04..a77800424 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -335,7 +335,7 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource, int nDevices = 0; mAudioInput->GetNumOfRecordingDevices(nDevices); int i; -#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) +#if defined(MOZ_WIDGET_ANDROID) i = 0; // Bug 1037025 - let the OS handle defaulting for now on android/b2g #else // -1 is "default communications device" depending on OS in webrtc.org code -- cgit v1.2.3