Bug 1410090 - Remove remnant of FFOS OMX code. r?cpearce draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 19 Oct 2017 16:51:04 +0200
changeset 683307 3cc406fd522c41f9d70c6167e44e86b6519558b8
parent 683256 96cba7e41b19424fc5099932d368c1c78073c257
child 736603 e3cfcf0357bc4d2cf896ca543d71c64ca26b20f0
push id85330
push userbmo:jyavenard@mozilla.com
push dateThu, 19 Oct 2017 14:51:57 +0000
reviewerscpearce
bugs1410090, 1355048
milestone58.0a1
Bug 1410090 - Remove remnant of FFOS OMX code. r?cpearce For webrtc, the most important part of the code had already been removed in bug 1355048 and could no longer be called MozReview-Commit-ID: Fx9XI0zR1gn
build/gyp.mozbuild
dom/media/DecoderTraits.cpp
dom/media/moz.build
dom/media/test/can_play_type_webm.js
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/trunk/webrtc/build/common.gypi
--- a/build/gyp.mozbuild
+++ b/build/gyp.mozbuild
@@ -55,17 +55,16 @@ gyp_vars.update({
     'use_glib': 1 if CONFIG['GLIB_LIBS'] else 0,
     # bug 1373485 - avoid pkg-config for gtk2 in webrtc
     'use_gtk': 0,
 
      # turn off mandatory use of NEON and instead use NEON detection
     'arm_neon': 0,
     'arm_neon_optional': 1,
 
-    'moz_webrtc_omx': 0,
     'moz_webrtc_mediacodec': 0,
 
     # Turn off multi monitor screen share
     'multi_monitor_screenshare%' : 0,
 
     # (for vp8) chromium sets to 0 also
     'use_temporal_layers': 0,
 
@@ -119,9 +118,9 @@ if CONFIG['INTEL_ARCHITECTURE']:
 
 if CONFIG['MACOS_SDK_DIR']:
     gyp_vars['mac_sdk_path'] = CONFIG['MACOS_SDK_DIR']
 
 if not CONFIG['MOZ_SYSTEM_LIBVPX']:
     gyp_vars['libvpx_dir'] =  '/media/libvpx/libvpx'
 
 if not CONFIG['MOZ_SYSTEM_LIBEVENT']:
-    gyp_vars['libevent_dir'] = '/ipc/chromium/src/third_party/libevent' 
+    gyp_vars['libevent_dir'] = '/ipc/chromium/src/third_party/libevent'
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -89,26 +89,24 @@ CanHandleCodecsType(const MediaContainer
   if (WaveDecoder::IsSupportedType(MediaContainerType(mimeType))) {
     if (WaveDecoder::IsSupportedType(aType)) {
       return CANPLAY_YES;
     }
     // We can only reach this position if a particular codec was requested,
     // ogg is supported and working: the codec must be invalid.
     return CANPLAY_NO;
   }
-#if !defined(MOZ_OMX_WEBM_DECODER)
   if (WebMDecoder::IsSupportedType(mimeType)) {
     if (WebMDecoder::IsSupportedType(aType)) {
       return CANPLAY_YES;
     }
     // We can only reach this position if a particular codec was requested,
     // webm is supported and working: the codec must be invalid.
     return CANPLAY_NO;
   }
-#endif
 #ifdef MOZ_FMP4
   if (MP4Decoder::IsSupportedType(mimeType,
                                   /* DecoderDoctorDiagnostics* */ nullptr)) {
     if (MP4Decoder::IsSupportedType(aType, aDiagnostics)) {
       return CANPLAY_YES;
     }
     // We can only reach this position if a particular codec was requested,
     // fmp4 is supported and working: the codec must be invalid.
@@ -161,21 +159,19 @@ CanHandleMediaType(const MediaContainerT
   if (WaveDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
 #ifdef MOZ_FMP4
   if (MP4Decoder::IsSupportedType(mimeType, aDiagnostics)) {
     return CANPLAY_MAYBE;
   }
 #endif
-#if !defined(MOZ_OMX_WEBM_DECODER)
   if (WebMDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
-#endif
   if (MP3Decoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
   if (ADTSDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
   }
   if (FlacDecoder::IsSupportedType(mimeType)) {
     return CANPLAY_MAYBE;
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -312,19 +312,16 @@ LOCAL_INCLUDES += [
 if CONFIG['MOZ_WEBRTC']:
     LOCAL_INCLUDES += [
         '/media/webrtc/signaling/src/common',
         '/media/webrtc/trunk',
     ]
 
 DEFINES['MOZILLA_INTERNAL_API'] = True
 
-if CONFIG['ANDROID_VERSION'] > '15':
-    DEFINES['MOZ_OMX_WEBM_DECODER'] = True
-
 if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
     DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 # Suppress some GCC warnings being treated as errors:
 #  - about attributes on forward declarations for types that are already
 #    defined, which complains about an important MOZ_EXPORT for android::AString
--- a/dom/media/test/can_play_type_webm.js
+++ b/dom/media/test/can_play_type_webm.js
@@ -4,41 +4,16 @@ function check_webm(v, enabled) {
   }
 
   // WebM types
   check("video/webm", "maybe");
   check("audio/webm", "maybe");
 
   var video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
   var audio = ['vorbis', 'opus'];
-  // Check for FxOS case.
-  // Since we want to use OMX webm HW acceleration to speed up vp8 decoding,
-  // we enabled it after Android version 16(JB) as MOZ_OMX_WEBM_DECODER
-  // defined in moz.build. More information is on Bug 986381.
-  // Currently OMX (KK included) webm decoders can only support vp8 and vorbis,
-  // so only vp8 and vorbis will be tested when OMX webm decoder is enabled.
-  if (navigator.userAgent.indexOf("Mobile") != -1 &&
-      navigator.userAgent.indexOf("Android") == -1) {
-    // See nsSystemInfo.cpp, the getProperty('version') and
-    // getProperty('sdk_version') are different.
-    var androidSDKVer = SpecialPowers.Cc['@mozilla.org/system-info;1']
-                                     .getService(SpecialPowers.Ci.nsIPropertyBag2)
-                                     .getProperty('sdk_version');
-    info("android version:"+androidSDKVer);
-
-    // Since from Android KK, vp9 sw decoder is supported.
-    if (androidSDKVer > 18) {
-      video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
-      audio = ['vorbis'];
-    } else if (androidSDKVer > 15) {
-      video = ['vp8', 'vp8.0'];
-      audio = ['vorbis'];
-    }
-
-  }
 
   audio.forEach(function(acodec) {
     check("audio/webm; codecs=" + acodec, "probably");
     check("video/webm; codecs=" + acodec, "probably");
   });
   video.forEach(function(vcodec) {
     check("video/webm; codecs=" + vcodec, "probably");
     audio.forEach(function(acodec) {
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -42,20 +42,16 @@
 #include "mozilla/Unused.h"
 
 #if defined(MOZ_WIDGET_ANDROID)
 #include "AndroidJNIWrapper.h"
 #include "VideoEngine.h"
 #endif
 
 #include "GmpVideoCodec.h"
-#ifdef MOZ_WEBRTC_OMX
-#include "OMXCodecWrapper.h"
-#include "OMXVideoCodec.h"
-#endif
 
 #ifdef MOZ_WEBRTC_MEDIACODEC
 #include "MediaCodecVideoCodec.h"
 #endif
 #include "WebrtcGmpVideoCodec.h"
 
 #include "MediaDataDecoderCodec.h"
 
@@ -1472,21 +1468,17 @@ WebrtcVideoConduit::CreateDecoder(webrtc
   decoder = MediaDataDecoderCodec::CreateDecoder(aType);
   if (decoder) {
     return decoder;
   }
 
   switch (aType) {
     case webrtc::VideoCodecType::kVideoCodecH264:
       // get an external decoder
-#ifdef MOZ_WEBRTC_OMX
-      decoder = OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
-#else
       decoder = GmpVideoCodec::CreateDecoder();
-#endif
       if (decoder) {
         mRecvCodecPlugin = static_cast<WebrtcVideoDecoder*>(decoder);
       }
       break;
 
     case webrtc::VideoCodecType::kVideoCodecVP8:
 #ifdef MOZ_WEBRTC_MEDIACODEC
       // attempt to get a decoder
@@ -1537,21 +1529,17 @@ WebrtcVideoConduit::CreateEncoder(webrtc
   webrtc::VideoEncoder* encoder = nullptr;
 #ifdef MOZ_WEBRTC_MEDIACODEC
   bool enabled = false;
 #endif
 
   switch (aType) {
     case webrtc::VideoCodecType::kVideoCodecH264:
       // get an external encoder
-#ifdef MOZ_WEBRTC_OMX
-      encoder = OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
-#else
       encoder = GmpVideoCodec::CreateEncoder();
-#endif
       if (encoder) {
         mSendCodecPlugin = static_cast<WebrtcVideoEncoder*>(encoder);
       }
       break;
 
     case webrtc::VideoCodecType::kVideoCodecVP8:
 #ifdef MOZ_WEBRTC_MEDIACODEC
       // attempt to get a encoder
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -117,21 +117,16 @@
 
 #ifdef USE_FAKE_PCOBSERVER
 #include "FakePCObserver.h"
 #else
 #include "mozilla/dom/PeerConnectionObserverBinding.h"
 #endif
 #include "mozilla/dom/PeerConnectionObserverEnumsBinding.h"
 
-#ifdef MOZ_WEBRTC_OMX
-#include "OMXVideoCodec.h"
-#include "OMXCodecWrapper.h"
-#endif
-
 #define ICE_PARSING "In RTCConfiguration passed to RTCPeerConnection constructor"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 typedef PCObserverString ObString;
 
 static const char* pciLogTag = "PeerConnectionImpl";
@@ -846,58 +841,25 @@ class ConfigureCodec {
       mVP8MaxFs(0),
       mVP8MaxFr(0),
       mUseTmmbr(false),
       mUseRemb(false),
       mUseAudioFec(false),
       mRedUlpfecEnabled(false),
       mDtmfEnabled(false)
     {
-#ifdef MOZ_WEBRTC_OMX
-      // Check to see if what HW codecs are available (not in use) at this moment.
-      // Note that streaming video decode can reserve a decoder
-
-      // XXX See bug 1018791 Implement W3 codec reservation policy
-      // Note that currently, OMXCodecReservation needs to be held by an sp<> because it puts
-      // 'this' into an sp<EventListener> to talk to the resource reservation code
-
-      // This pref is a misnomer; it is solely for h264 _hardware_ support.
-      branch->GetBoolPref("media.peerconnection.video.h264_enabled",
-          &mHardwareH264Enabled);
-
-      if (mHardwareH264Enabled) {
-        // Ok, it is preffed on. Can we actually do it?
-        android::sp<android::OMXCodecReservation> encode = new android::OMXCodecReservation(true);
-        android::sp<android::OMXCodecReservation> decode = new android::OMXCodecReservation(false);
-
-        // Currently we just check if they're available right now, which will fail if we're
-        // trying to call ourself, for example.  It will work for most real-world cases, like
-        // if we try to add a person to a 2-way call to make a 3-way mesh call
-        if (encode->ReserveOMXCodec() && decode->ReserveOMXCodec()) {
-          CSFLogDebug( LOGTAG, "%s: H264 hardware codec available", __FUNCTION__);
-          mHardwareH264Supported = true;
-        }
-      }
-
-#endif // MOZ_WEBRTC_OMX
-
       mSoftwareH264Enabled = PeerConnectionCtx::GetInstance()->gmpHasH264();
 
       mH264Enabled = mHardwareH264Supported || mSoftwareH264Enabled;
 
       branch->GetIntPref("media.navigator.video.h264.level", &mH264Level);
       mH264Level &= 0xFF;
 
       branch->GetIntPref("media.navigator.video.h264.max_br", &mH264MaxBr);
 
-#ifdef MOZ_WEBRTC_OMX
-      // Level 1.2; but let's allow CIF@30 or QVGA@30+ by default
-      mH264MaxMbps = 11880;
-#endif
-
       branch->GetIntPref("media.navigator.video.h264.max_mbps", &mH264MaxMbps);
 
       branch->GetBoolPref("media.peerconnection.video.vp9_enabled",
           &mVP9Enabled);
 
       branch->GetBoolPref("media.peerconnection.video.vp9_preferred",
           &mVP9Preferred);
 
--- a/media/webrtc/trunk/webrtc/build/common.gypi
+++ b/media/webrtc/trunk/webrtc/build/common.gypi
@@ -538,21 +538,16 @@
         # Re-enable some warnings that Chromium disables.
         'msvs_disabled_warnings!': [4189,],
       }],
       ['enable_android_opensl==1 and OS=="android"', {
         'defines': [
           'WEBRTC_ANDROID_OPENSLES',
         ],
       }],
-      ['moz_webrtc_omx==1', {
-        'defines' : [
-          'MOZ_WEBRTC_OMX'
-        ],
-      }],
       ['OS=="android"', {
         'defines': [
           'WEBRTC_LINUX',
           'WEBRTC_ANDROID',
          ],
          'conditions': [
            ['clang==0', {
              # The Android NDK doesn't provide optimized versions of these