Bug 1051566: Support H.264 Mode 0 in GMP OpenH264 r=ehugg
authorRandell Jesup <rjesup@jesup.org>
Mon, 11 Aug 2014 17:13:59 -0400
changeset 198994 71a31a3e83878458a5a6fc36909297259fabd3be
parent 198993 1150a58d8b3a38cb15ce99ee53b036dfc33dcd6c
child 198995 3e54857a5004eb642064eac8cad826fb6151598f
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehugg
bugs1051566
milestone34.0a1
Bug 1051566: Support H.264 Mode 0 in GMP OpenH264 r=ehugg
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
@@ -193,22 +193,24 @@ WebrtcGmpVideoEncoder::InitEncode_g(cons
 
   codec.mGMPApiVersion = 33;
   codec.mWidth = aCodecSettings->width;
   codec.mHeight = aCodecSettings->height;
   codec.mStartBitrate = aCodecSettings->startBitrate;
   codec.mMinBitrate = aCodecSettings->minBitrate;
   codec.mMaxBitrate = aCodecSettings->maxBitrate;
   codec.mMaxFramerate = aCodecSettings->maxFramerate;
+  if (aCodecSettings->codecSpecific.H264.packetizationMode == 1) {
+    aMaxPayloadSize = 4*1024*1024; // insanely large
+  }
 
   // Pass dummy codecSpecific data for now...
   nsTArray<uint8_t> codecSpecific;
 
-  // H.264 mode 1 only supported so far
-  GMPErr err = mGMP->InitEncode(codec, codecSpecific, this, 1, 1024*1024 /*aMaxPayloadSize*/);
+  GMPErr err = mGMP->InitEncode(codec, codecSpecific, this, 1, aMaxPayloadSize);
   if (err != GMPNoErr) {
     return WEBRTC_VIDEO_CODEC_ERROR;
   }
 
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
 
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -2856,18 +2856,21 @@ int vcmGetVideoCodecList(int request_typ
 /**
  * Get supported H.264 video packetization modes
  * @return mask of supported video packetization modes for H.264. Value returned
  * must be 1 to 3 (bit 0 is mode 0, bit 1 is mode 1.
  * Bit 2 (Mode 2) is not supported yet.
  */
 int vcmGetH264SupportedPacketizationModes()
 {
-  // We support mode 1 packetization only in webrtc currently
+#ifdef MOZ_WEBRTC_OMX
   return VCM_H264_MODE_1;
+#else
+  return VCM_H264_MODE_0|VCM_H264_MODE_1;
+#endif
 }
 
 /**
  * Get supported H.264 profile-level-id
  * @return supported profile-level-id value
  */
 uint32_t vcmGetVideoH264ProfileLevelID()
 {