Browse Source

Remove MOZ_WIDGET_GONK [2/2]

Tag #288
pull/1/head
wolfbeast 4 years ago committed by Roy Tam
parent
commit
2531de02eb
  1. 102
      dom/media/DOMMediaStream.cpp
  2. 11
      dom/media/DOMMediaStream.h
  3. 53
      dom/media/MediaData.cpp
  4. 17
      dom/media/MediaManager.cpp
  5. 8
      dom/media/android/AndroidMediaPluginHost.cpp
  6. 5
      dom/media/encoder/OpusTrackEncoder.cpp
  7. 5
      dom/media/encoder/TrackEncoder.cpp
  8. 5
      dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp
  9. 4
      dom/media/gmp/GMPServiceParent.cpp
  10. 12
      dom/media/ogg/OggCodecState.cpp
  11. 5
      dom/media/ogg/OggWriter.cpp
  12. 5
      dom/media/platforms/omx/OmxPlatformLayer.cpp
  13. 17
      dom/media/systemservices/MediaSystemResourceService.cpp
  14. 2
      dom/media/webrtc/MediaEngineCameraVideoSource.cpp
  15. 2
      dom/media/webrtc/MediaEngineDefault.cpp
  16. 2
      dom/media/webrtc/MediaEngineWebRTC.cpp
  17. 7
      embedding/components/windowwatcher/nsWindowWatcher.cpp
  18. 4
      ipc/chromium/src/base/platform_thread_posix.cc
  19. 45
      ipc/chromium/src/base/process_util_linux.cc
  20. 46
      ipc/contentproc/plugin-container.cpp
  21. 5
      ipc/dbus/DBusHelpers.cpp
  22. 5
      ipc/dbus/DBusUtils.cpp
  23. 14
      ipc/glue/GeckoChildProcessHost.cpp
  24. 5
      ipc/hal/DaemonSocket.cpp
  25. 5
      ipc/hal/DaemonSocketConnector.cpp
  26. 5
      ipc/hal/DaemonSocketPDU.cpp
  27. 14
      ipc/hal/DaemonSocketPDUHelpers.cpp
  28. 5
      ipc/keystore/KeyStore.cpp
  29. 5
      ipc/keystore/KeyStoreConnector.cpp
  30. 5
      ipc/ril/Ril.cpp
  31. 4
      ipc/ril/RilConnector.cpp
  32. 5
      ipc/unixfd/UnixFdWatcher.cpp
  33. 5
      media/libcubeb/src/cubeb_opensl.c
  34. 13
      media/libpng/pnglibconf.h
  35. 26
      media/omx-plugin/OmxPlugin.cpp
  36. 17
      media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp
  37. 4
      media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
  38. 2
      media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_utility_android.h
  39. 28
      media/webrtc/trunk/webrtc/modules/audio_device/android/audio_manager.cc
  40. 8
      media/webrtc/trunk/webrtc/modules/audio_device/android/audio_manager.h
  41. 4
      media/webrtc/trunk/webrtc/video_engine/include/vie_base.h
  42. 2
      memory/build/mozmemory_wrap.h
  43. 5
      memory/mozjemalloc/jemalloc.c
  44. 9
      memory/volatile/tests/TestVolatileBuffer.cpp
  45. 54
      modules/libpref/init/all.js
  46. 17
      mozglue/build/BionicGlue.cpp
  47. 4
      mozglue/misc/TimeStamp.h
  48. 5
      netwerk/base/nsIOService.cpp
  49. 21
      netwerk/base/nsIncrementalDownload.cpp
  50. 5
      netwerk/base/nsNetUtil.cpp
  51. 37
      netwerk/base/nsUDPSocket.cpp
  52. 8
      netwerk/base/nsUDPSocket.h
  53. 27
      netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp
  54. 2
      netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp
  55. 47
      netwerk/protocol/ftp/nsFtpConnectionThread.cpp
  56. 9
      netwerk/protocol/ftp/nsFtpConnectionThread.h
  57. 25
      netwerk/protocol/http/nsHttpHandler.cpp
  58. 46
      netwerk/protocol/http/nsHttpTransaction.cpp
  59. 8
      netwerk/protocol/http/nsHttpTransaction.h
  60. 48
      netwerk/protocol/websocket/WebSocketChannel.cpp
  61. 8
      netwerk/protocol/websocket/WebSocketChannel.h
  62. 12
      netwerk/system/linux/nsNotifyAddrListener_Linux.cpp
  63. 30
      netwerk/wifi/nsWifiMonitor.h
  64. 2
      toolkit/components/build/nsToolkitCompsModule.cpp
  65. 3
      toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp
  66. 2
      toolkit/components/jsdownloads/src/DownloadIntegration.jsm
  67. 2
      toolkit/components/jsdownloads/src/DownloadPlatform.cpp
  68. 4
      toolkit/components/startup/nsAppStartup.cpp
  69. 2
      toolkit/components/telemetry/Telemetry.cpp
  70. 38
      toolkit/components/telemetry/TelemetryHistogram.cpp
  71. 9
      toolkit/crashreporter/nsExceptionHandler.cpp
  72. 2
      toolkit/modules/AppConstants.jsm
  73. 2
      toolkit/mozapps/extensions/extensions.manifest
  74. 137
      toolkit/mozapps/update/updater/updater.cpp
  75. 2
      toolkit/mozapps/webextensions/extensions.manifest
  76. 23
      toolkit/profile/nsProfileLock.cpp
  77. 35
      toolkit/xre/EventTracer.cpp
  78. 2
      toolkit/xre/nsEmbedFunctions.cpp
  79. 144
      toolkit/xre/nsUpdateDriver.cpp
  80. 12
      toolkit/xre/nsXREDirProvider.cpp
  81. 17
      uriloader/exthandler/nsExternalHelperAppService.cpp
  82. 2
      widget/EventMessageList.h
  83. 5
      widget/PuppetWidget.cpp
  84. 3
      widget/nsContentProcessWidgetFactory.cpp
  85. 7
      xpfe/appshell/nsAppShellService.cpp

102
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> image = static_cast<Image*>(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> image = static_cast<Image*>(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> image = static_cast<Image*>(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 ***/
}

11
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<OverlayImage> mOverlayImage;
PrincipalHandle mPrincipalHandle;
#endif
};
} // namespace mozilla

53
dom/media/MediaData.cpp

@ -9,9 +9,6 @@
#include "VideoUtils.h"
#include "ImageContainer.h"
#ifdef MOZ_WIDGET_GONK
#include <cutils/properties.h>
#endif
#include <stdint.h>
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();
}

17
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<MediaManager> mManager; // get ref to this when creating the runnable
};
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID)
class GetUserMediaRunnableWrapper : public Runnable
{
public:
@ -3052,18 +3049,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;
}

8
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<nsIPropertyBag2> 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

5
dom/media/encoder/OpusTrackEncoder.cpp

@ -9,12 +9,7 @@
#include <opus/opus.h>
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {

5
dom/media/encoder/TrackEncoder.cpp

@ -10,12 +10,7 @@
#include "VideoUtils.h"
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {

5
dom/media/encoder/fmp4_muxer/ISOMediaWriter.cpp

@ -13,12 +13,7 @@
#include "GeckoProfiler.h"
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {

4
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;

12
dom/media/ogg/OggCodecState.cpp

@ -18,18 +18,6 @@
#include <opus/opus.h>
#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;

5
dom/media/ogg/OggWriter.cpp

@ -7,12 +7,7 @@
#include "GeckoProfiler.h"
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {

5
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

17
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<uint32_t>(MediaSystemResourceType::VIDEO_DECODER), resource);
resource = new MediaSystemResource(VIDEO_ENCODER_COUNT);
mResources.Put(static_cast<uint32_t>(MediaSystemResourceType::VIDEO_ENCODER), resource);
#endif
}
MediaSystemResourceService::~MediaSystemResourceService()

2
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/

2
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

2
dom/media/webrtc/MediaEngineWebRTC.cpp

@ -339,7 +339,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

7
embedding/components/windowwatcher/nsWindowWatcher.cpp

@ -494,13 +494,6 @@ nsWindowWatcher::CreateChromeWindow(const nsACString& aFeatures,
return NS_ERROR_UNEXPECTED;
}
// B2G multi-screen support. mozDisplayId is returned from the
// "display-changed" event, it is also platform-dependent.
#ifdef MOZ_WIDGET_GONK
int retval = WinHasOption(aFeatures, "mozDisplayId", 0, nullptr);
windowCreator2->SetScreenId(retval);
#endif
bool cancel = false;
nsCOMPtr<nsIWebBrowserChrome> newWindowChrome;
nsresult rv =

4
ipc/chromium/src/base/platform_thread_posix.cc

@ -48,11 +48,7 @@ PlatformThreadId PlatformThread::CurrentId() {
mach_port_deallocate(mach_task_self(), port);
return port;
#elif defined(OS_LINUX)
#ifdef MOZ_WIDGET_GONK
return (intptr_t) (pthread_self());
#else
return syscall(__NR_gettid);
#endif
#elif defined(OS_OPENBSD) || defined(__GLIBC__)
return (intptr_t) (pthread_self());
#elif defined(OS_NETBSD)

45
ipc/chromium/src/base/process_util_linux.cc

@ -24,24 +24,13 @@
#include "prenv.h"
#include "prmem.h"
#ifdef MOZ_WIDGET_GONK
/*
* AID_APP is the first application UID used by Android. We're using
* it as our unprivilegied UID. This ensure the UID used is not
* shared with any other processes than our own childs.
*/
# include <private/android_filesystem_config.h>
# define CHILD_UNPRIVILEGED_UID AID_APP
# define CHILD_UNPRIVILEGED_GID AID_APP
#else
/*
* On platforms that are not gonk based, we fall back to an arbitrary
* UID. This is generally the UID for user `nobody', albeit it is not
* On our platforms we use an arbitrary UID.
* This is generally the UID for user `nobody', albeit it is not
* always the case.
*/
# define CHILD_UNPRIVILEGED_UID 65534
# define CHILD_UNPRIVILEGED_GID 65534
#endif
namespace {
@ -229,36 +218,6 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
gid_t gid = CHILD_UNPRIVILEGED_GID;
uid_t uid = CHILD_UNPRIVILEGED_UID;
#ifdef MOZ_WIDGET_GONK
{
static bool checked_pix_max, pix_max_ok;
if (!checked_pix_max) {
checked_pix_max = true;
int fd = open("/proc/sys/kernel/pid_max", O_CLOEXEC | O_RDONLY);
if (fd < 0) {
DLOG(ERROR) << "Failed to open pid_max";
_exit(127);
}
char buf[PATH_MAX];
ssize_t len = read(fd, buf, sizeof(buf) - 1);
close(fd);
if (len < 0) {
DLOG(ERROR) << "Failed to read pid_max";
_exit(127);
}
buf[len] = '\0';
int pid_max = atoi(buf);
pix_max_ok =
(pid_max + CHILD_UNPRIVILEGED_UID > CHILD_UNPRIVILEGED_UID);
}
if (!pix_max_ok) {
DLOG(ERROR) << "Can't safely get unique uid/gid";
_exit(127);
}
gid += getpid();
uid += getpid();
}
#endif
if (setgid(gid) != 0) {
DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS";
_exit(127);

46
ipc/contentproc/plugin-container.cpp

@ -22,41 +22,6 @@
#include "GMPLoader.h"
#ifdef MOZ_WIDGET_GONK
# include <sys/time.h>
# include <sys/resource.h>
# include <binder/ProcessState.h>
# ifdef LOGE_IF
# undef LOGE_IF
# endif
# include <android/log.h>
# define LOGE_IF(cond, ...) \
( (CONDITION(cond)) \
? ((void)__android_log_print(ANDROID_LOG_ERROR, \
"Gecko:MozillaRntimeMain", __VA_ARGS__)) \
: (void)0 )
#endif // MOZ_WIDGET_GONK
#ifdef MOZ_WIDGET_GONK
static void
InitializeBinder(void *aDummy) {
// Change thread priority to 0 only during calling ProcessState::self().
// The priority is registered to binder driver and used for default Binder
// Thread's priority.
// To change the process's priority to small value need's root permission.
int curPrio = getpriority(PRIO_PROCESS, 0);
int err = setpriority(PRIO_PROCESS, 0, 0);
MOZ_ASSERT(!err);
LOGE_IF(err, "setpriority failed. Current process needs root permission.");
android::ProcessState::self()->startThreadPool();
setpriority(PRIO_PROCESS, 0, curPrio);
}
#endif
mozilla::gmp::SandboxStarter*
MakeSandboxStarter()
{
@ -76,15 +41,6 @@ content_process_main(int argc, char* argv[])
XRE_SetProcessType(argv[--argc]);
#ifdef MOZ_WIDGET_GONK
// This creates a ThreadPool for binder ipc. A ThreadPool is necessary to
// receive binder calls, though not necessary to send binder calls.
// ProcessState::Self() also needs to be called once on the main thread to
// register the main thread with the binder driver.
InitializeBinder(nullptr);
#endif
#ifdef XP_WIN
// For plugins, this is done in PluginProcessChild::Init, as we need to
// avoid it for unsupported plugins. See PluginProcessChild::Init for
@ -94,7 +50,7 @@ content_process_main(int argc, char* argv[])
SetDllDirectoryW(L"");
}
#endif
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK) && defined(MOZ_PLUGIN_CONTAINER)
#if !defined(MOZ_WIDGET_ANDROID) && defined(MOZ_PLUGIN_CONTAINER)
// On desktop, the GMPLoader lives in plugin-container, so that its
// code can be covered by an EME/GMP vendor's voucher.
nsAutoPtr<mozilla::gmp::SandboxStarter> starter(MakeSandboxStarter());

5
ipc/dbus/DBusHelpers.cpp

@ -14,12 +14,7 @@
#include "nsThreadUtils.h"
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#else
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {

5
ipc/dbus/DBusUtils.cpp

@ -20,12 +20,7 @@
#include "DBusUtils.h"
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#else
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {

14
ipc/glue/GeckoChildProcessHost.cpp

@ -62,13 +62,9 @@ static const int kMagicAndroidSystemPropFd = 5;
#endif
static const bool kLowRightsSubprocesses =
// We currently only attempt to drop privileges on gonk, because we
// have no plugins or extensions to worry about breaking.
#ifdef MOZ_WIDGET_GONK
true
#else
// We only attempted to drop privileges on gonk, because it
// had no plugins or extensions to worry about breaking.
false
#endif
;
static bool
@ -699,12 +695,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
}
#endif // ANDROID
#ifdef MOZ_WIDGET_GONK
if (const char *ldPreloadPath = getenv("LD_PRELOAD")) {
newEnvVars["LD_PRELOAD"] = ldPreloadPath;
}
#endif // MOZ_WIDGET_GONK
// remap the IPC socket fd to a well-known int, as the OS does for
// STDOUT_FILENO, for example
int srcChannelFd, dstChannelFd;

5
ipc/hal/DaemonSocket.cpp

@ -14,14 +14,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {

5
ipc/hal/DaemonSocketConnector.cpp

@ -18,14 +18,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {

5
ipc/hal/DaemonSocketPDU.cpp

@ -12,14 +12,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {

14
ipc/hal/DaemonSocketPDUHelpers.cpp

@ -15,26 +15,12 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) \
__android_log_print(ANDROID_LOG_INFO, "HAL-IPC", args);
#define CHROMIUM_LOG_VA(fmt, ap) \
__android_log_vprint(ANDROID_LOG_INFO, "HAL-IPC", fmt, ap);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) { printf(args); }
#define CHROMIUM_LOG_VA(fmt, ap) if (IODEBUG) { vprintf(fmt, ap); }
#endif
namespace mozilla {
namespace ipc {
namespace DaemonSocketPDUHelpers {

5
ipc/keystore/KeyStore.cpp

@ -10,12 +10,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define KEYSTORE_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define KEYSTORE_LOG(args...) printf(args);
#endif
#include "KeyStore.h"
#include "jsfriendapi.h"

5
ipc/keystore/KeyStoreConnector.cpp

@ -13,12 +13,7 @@
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define KEYSTORE_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define KEYSTORE_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {

5
ipc/ril/Ril.cpp

@ -21,12 +21,7 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {

4
ipc/ril/RilConnector.cpp

@ -181,11 +181,7 @@ RilConnector::CreateStreamSocket(struct sockaddr* aAddress,
socklen_t* aAddressLength,
int& aStreamFd)
{
#ifdef MOZ_WIDGET_GONK
static const int sDomain = AF_UNIX;
#else
static const int sDomain = AF_INET;
#endif
ScopedClose fd;

5
ipc/unixfd/UnixFdWatcher.cpp

@ -11,14 +11,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {

5
media/libcubeb/src/cubeb_opensl.c

@ -187,10 +187,6 @@ static void opensl_destroy(cubeb * ctx);
#if defined(__ANDROID__)
// The bionic header file on B2G contains the required
// declarations on all releases.
#ifndef MOZ_WIDGET_GONK
#if (__ANDROID_API__ >= ANDROID_VERSION_LOLLIPOP)
typedef int (system_property_get)(const char*, char*);
@ -212,7 +208,6 @@ __system_property_get(const char* name, char* value)
return ret;
}
#endif
#endif
static int
get_android_version(void)

13
media/libpng/pnglibconf.h

@ -95,19 +95,6 @@
#define PNG_SEQUENTIAL_READ_SUPPORTED
#endif
/* necessary for boot animation code (Gonk) */
#ifdef MOZ_WIDGET_GONK
#define PNG_bKGD_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#endif
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_APNG_SUPPORTED
#define PNG_WRITE_tRNS_SUPPORTED

26
media/omx-plugin/OmxPlugin.cpp

@ -10,11 +10,7 @@
#include <stagefright/MetaData.h>
#include <stagefright/OMXCodec.h>
#include <media/stagefright/MediaErrors.h>
#ifdef MOZ_WIDGET_GONK
#include <OMX.h>
#else
#include <stagefright/OMXClient.h>
#endif
#include <algorithm>
#include "mozilla/Assertions.h"
@ -125,7 +121,6 @@ public:
bool ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs);
};
#if !defined(MOZ_WIDGET_GONK)
static class OmxClientInstance {
public:
OmxClientInstance()
@ -156,7 +151,6 @@ private:
OMXClient *mClient;
status_t mStatus;
} sClientInstance;
#endif
OmxDecoder::OmxDecoder(PluginHost *aPluginHost, Decoder *aDecoder) :
mPluginHost(aPluginHost),
@ -210,16 +204,6 @@ public:
}
};
#ifdef MOZ_WIDGET_GONK
static sp<IOMX> sOMX = nullptr;
static sp<IOMX> GetOMX() {
if(sOMX.get() == nullptr) {
sOMX = reinterpret_cast<IOMX*>(new OMX);
}
return sOMX;
}
#endif
static uint32_t
GetDefaultStagefrightFlags(PluginHost *aPluginHost)
{
@ -246,11 +230,6 @@ GetDefaultStagefrightFlags(PluginHost *aPluginHost)
static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
{
#ifdef MOZ_WIDGET_GONK
// Flag value of zero means return a hardware or software decoder
// depending on what the device supports.
return 0;
#else
// Check whether the user has set a pref to override our default OMXCodec
// CreationFlags flags. This is useful for A/B testing hardware and software
// decoders for performance and bugs. The interesting flag values are:
@ -271,7 +250,6 @@ static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
flags |= GetDefaultStagefrightFlags(aPluginHost);
return static_cast<uint32_t>(flags);
#endif
}
enum ColorFormatSupport {
@ -481,11 +459,7 @@ bool OmxDecoder::Init()
int64_t totalDurationUs = 0;
#ifdef MOZ_WIDGET_GONK
sp<IOMX> omx = GetOMX();
#else
sp<IOMX> omx = sClientInstance.get()->interface();
#endif
sp<MediaSource> videoTrack;
sp<MediaSource> videoSource;

17
media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp

@ -26,9 +26,6 @@ using namespace android;
#include "runnable_utils.h"
// Gecko
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
#include "GonkBufferQueueProducer.h"
#endif
#include "GonkNativeWindow.h"
#include "GrallocImages.h"
#include "mozilla/Atomics.h"
@ -326,30 +323,16 @@ public:
mHeight = aHeight;
sp<Surface> surface = nullptr;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
sp<IGraphicBufferProducer> producer;
sp<IGonkGraphicBufferConsumer> consumer;
GonkBufferQueue::createBufferQueue(&producer, &consumer);
mNativeWindow = new GonkNativeWindow(consumer);
#else
mNativeWindow = new GonkNativeWindow();
#endif
if (mNativeWindow.get()) {
// listen to buffers queued by MediaCodec::RenderOutputBufferAndRelease().
mNativeWindow->setNewFrameCallback(this);
// XXX remove buffer changes after a better solution lands - bug 1009420
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
static_cast<GonkBufferQueueProducer*>(producer.get())->setSynchronousMode(false);
// More spare buffers to avoid OMX decoder waiting for native window
consumer->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
surface = new Surface(producer);
#else
sp<GonkBufferQueue> bq = mNativeWindow->getBufferQueue();
bq->setSynchronousMode(false);
// More spare buffers to avoid OMX decoder waiting for native window
bq->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
surface = new Surface(bq);
#endif
}
status_t result = mCodec->configure(config, surface, nullptr, 0);
if (result == OK) {

4
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp

@ -2217,11 +2217,7 @@ public:
#if defined(MOZILLA_INTERNAL_API)
if (buffer) {
// Create a video frame using |buffer|.
#ifdef MOZ_WIDGET_GONK
RefPtr<PlanarYCbCrImage> yuvImage = new GrallocImage();
#else
RefPtr<PlanarYCbCrImage> yuvImage = image_container_->CreatePlanarYCbCrImage();
#endif
uint8_t* frame = const_cast<uint8_t*>(static_cast<const uint8_t*> (buffer));
PlanarYCbCrData yuvData;

2
media/webrtc/trunk/webrtc/modules/audio_device/android/audio_device_utility_android.h

@ -15,9 +15,7 @@
#ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_ANDROID_H
#define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_ANDROID_H
#if !defined(MOZ_WIDGET_GONK)
#include <jni.h>
#endif
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_device/audio_device_utility.h"

28
media/webrtc/trunk/webrtc/modules/audio_device/android/audio_manager.cc

@ -9,18 +9,14 @@
*/
#include "webrtc/modules/audio_device/android/audio_manager.h"
#if !defined(MOZ_WIDGET_GONK)
#include "AndroidJNIWrapper.h"
#endif
#include <android/log.h>
#include "webrtc/base/arraysize.h"
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_device/android/audio_common.h"
#if !defined(MOZ_WIDGET_GONK)
#include "webrtc/modules/utility/interface/helpers_android.h"
#endif
#define TAG "AudioManager"
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
@ -31,14 +27,11 @@
namespace webrtc {
#if !defined(MOZ_WIDGET_GONK)
static JavaVM* g_jvm = NULL;
static jobject g_context = NULL;
static jclass g_audio_manager_class = NULL;
#endif
void AudioManager::SetAndroidAudioDeviceObjects(void* jvm, void* context) {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("SetAndroidAudioDeviceObjects%s", GetThreadInfo().c_str());
CHECK(jvm);
@ -65,11 +58,9 @@ void AudioManager::SetAndroidAudioDeviceObjects(void* jvm, void* context) {
jni->RegisterNatives(g_audio_manager_class,
native_methods, arraysize(native_methods));
CHECK_EXCEPTION(jni) << "Error during RegisterNatives";
#endif
}
void AudioManager::ClearAndroidAudioDeviceObjects() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("ClearAndroidAudioDeviceObjects%s", GetThreadInfo().c_str());
JNIEnv* jni = GetEnv(g_jvm);
CHECK(jni) << "AttachCurrentThread must be called on this tread";
@ -80,36 +71,28 @@ void AudioManager::ClearAndroidAudioDeviceObjects() {
DeleteGlobalRef(jni, g_context);
g_context = NULL;
g_jvm = NULL;
#endif
}
AudioManager::AudioManager()
: initialized_(false) {
#if !defined(MOZ_WIDGET_GONK)
j_audio_manager_ = NULL;
ALOGD("ctor%s", GetThreadInfo().c_str());
#endif
CHECK(HasDeviceObjects());
CreateJavaInstance();
}
AudioManager::~AudioManager() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("~dtor%s", GetThreadInfo().c_str());
#endif
DCHECK(thread_checker_.CalledOnValidThread());
Close();
#if !defined(MOZ_WIDGET_GONK)
AttachThreadScoped ats(g_jvm);
JNIEnv* jni = ats.env();
jni->DeleteGlobalRef(j_audio_manager_);
j_audio_manager_ = NULL;
#endif
DCHECK(!initialized_);
}
bool AudioManager::Init() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("Init%s", GetThreadInfo().c_str());
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!initialized_);
@ -122,13 +105,11 @@ bool AudioManager::Init() {
ALOGE("init failed!");
return false;
}
#endif
initialized_ = true;
return true;
}
bool AudioManager::Close() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("Close%s", GetThreadInfo().c_str());
DCHECK(thread_checker_.CalledOnValidThread());
if (!initialized_)
@ -139,12 +120,10 @@ bool AudioManager::Close() {
jni, g_audio_manager_class, "dispose", "()V");
jni->CallVoidMethod(j_audio_manager_, disposeID);
CHECK_EXCEPTION(jni);
#endif
initialized_ = false;
return true;
}
#if !defined(MOZ_WIDGET_GONK)
void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env, jobject obj,
jint sample_rate, jint channels, jlong nativeAudioManager) {
webrtc::AudioManager* this_object =