Bug 1002306: don't accidentally disable non-H264 codecs in the OMX code r=ekr
authorRandell Jesup <rjesup@jesup.org>
Mon, 28 Apr 2014 19:52:16 -0400
changeset 181143 32c92d57273a780f8474ed9cf375cc0fe841a8e4
parent 181142 f3e6e477d626363503d53a8a0149b734c06981ce
child 181144 325b86accc17665739b041b3469140c35de44662
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersekr
bugs1002306
milestone32.0a1
Bug 1002306: don't accidentally disable non-H264 codecs in the OMX code r=ekr
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -2115,43 +2115,51 @@ short vcmTxOpen(cc_mcapid_t mcap_id,
 /*
  * Add external H.264 video codec.
  */
 static int vcmEnsureExternalCodec(
     const mozilla::RefPtr<mozilla::VideoSessionConduit>& conduit,
     mozilla::VideoCodecConfig* config,
     bool send)
 {
+  if (config->mName == "VP8") {
+    // whitelist internal codecs; I420 will be here once we resolve bug 995884
+    return 0;
 #ifdef MOZ_WEBRTC_OMX
-  // Here we use "I420" to register H.264 because WebRTC.org code has a
-  // whitelist of supported video codec in |webrtc::ViECodecImpl::CodecValid()|
-  // and will reject registration of those not in it.
-  // TODO: bug 995884 to support H.264 in WebRTC.org code.
-  if (config->mName != "I420") {
-    // Do nothing for non-I420 config.
+  } else if (config->mName == "I420") {
+    // Here we use "I420" to register H.264 because WebRTC.org code has a
+    // whitelist of supported video codec in |webrtc::ViECodecImpl::CodecValid()|
+    // and will reject registration of those not in it.
+    // TODO: bug 995884 to support H.264 in WebRTC.org code.
+
+    // Register H.264 codec.
+    if (send) {
+      VideoEncoder* encoder = OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
+      if (encoder) {
+        return conduit->SetExternalSendCodec(config->mType, encoder);
+      } else {
+        return kMediaConduitInvalidSendCodec;
+      }
+    } else {
+      VideoDecoder* decoder = OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
+      if (decoder) {
+        return conduit->SetExternalRecvCodec(config->mType, decoder);
+      } else {
+        return kMediaConduitInvalidReceiveCodec;
+      }
+    }
+    NS_NOTREACHED("Shouldn't get here!");
+#else
+  } else if (config->mName == "I420") {
+    return 0;
+#endif
+  } else {
+    CSFLogError( logTag, "%s: Invalid video codec configured: %s", __FUNCTION__, config->mName.c_str());
     return send ? kMediaConduitInvalidSendCodec : kMediaConduitInvalidReceiveCodec;
   }
-  // Register H.264 codec.
-  if (send) {
-    VideoEncoder* encoder = OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
-    if (encoder) {
-      return conduit->SetExternalSendCodec(config->mType, encoder);
-    } else {
-      return kMediaConduitInvalidSendCodec;
-    }
-  } else {
-    VideoDecoder* decoder = OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
-    if (decoder) {
-      return conduit->SetExternalRecvCodec(config->mType, decoder);
-    } else {
-      return kMediaConduitInvalidReceiveCodec;
-    }
-  }
-  NS_NOTREACHED("Shouldn't get here!");
-#endif
 
   return 0;
 }
 
 /**
  *  start tx stream
  *  Note: For video calls, for a given call_handle there will be
  *        two media lines and the corresponding group_id/stream_id pair.