Bug 1028962 - Fix for setting maxFramerate with Gecko Media Plugins. r=jesup, a=lmandel
authorEthan Hugg <ethanhugg@gmail.com>
Wed, 25 Jun 2014 09:08:41 -0700
changeset 208513 f62422f3864cc6743d4649f2f9b2da4e5a5ab76c
parent 208512 8bc2222d4b0d2ccd157cbb1340e55904f0b25b21
child 208514 ae91134619c5219c786ceb2fbcac0a3aa9787da0
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, lmandel
bugs1028962
milestone32.0a2
Bug 1028962 - Fix for setting maxFramerate with Gecko Media Plugins. r=jesup, a=lmandel
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -25,16 +25,18 @@
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidJNIWrapper.h"
 #endif
 
 #include <algorithm>
 #include <math.h>
 
+#define DEFAULT_VIDEO_MAX_FRAMERATE 30
+
 namespace mozilla {
 
 static const char* logTag ="WebrtcVideoSessionConduit";
 
 // 32 bytes is what WebRTC CodecInst expects
 const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32;
 
 /**
@@ -525,16 +527,18 @@ WebrtcVideoConduit::ConfigureSendMediaCo
 {
   CSFLogDebug(logTag,  "%s for %s", __FUNCTION__, codecConfig ? codecConfig->mName.c_str() : "<null>");
   bool codecFound = false;
   MediaConduitErrorCode condError = kMediaConduitNoError;
   int error = 0; //webrtc engine errors
   webrtc::VideoCodec  video_codec;
   std::string payloadName;
 
+  memset(&video_codec, 0, sizeof(video_codec));
+
   //validate basic params
   if((condError = ValidateCodecConfig(codecConfig,true)) != kMediaConduitNoError)
   {
     return condError;
   }
 
   //Check if we have same codec already applied
   if(CheckCodecsForMatch(mCurSendCodecConfig, codecConfig))
@@ -1257,20 +1261,22 @@ WebrtcVideoConduit::CodecConfigToWebRTCC
     PL_strncpyz(cinst.plName, "VP8", sizeof(cinst.plName));
   } else if (codecInfo->mName == "I420") {
     cinst.codecType = webrtc::kVideoCodecI420;
     PL_strncpyz(cinst.plName, "I420", sizeof(cinst.plName));
   }
 
   // width/height will be overridden on the first frame; they must be 'sane' for
   // SetSendCodec()
-  if (codecInfo->mMaxFrameRate > 0)
-  {
+  if (codecInfo->mMaxFrameRate > 0) {
     cinst.maxFramerate = codecInfo->mMaxFrameRate;
+  } else {
+    cinst.maxFramerate = DEFAULT_VIDEO_MAX_FRAMERATE;
   }
+
   cinst.minBitrate = mMinBitrate;
   cinst.startBitrate = mStartBitrate;
   cinst.maxBitrate = mMaxBitrate;
 
   if (cinst.codecType == webrtc::kVideoCodecH264)
   {
     cinst.codecSpecific.H264.profile = codecInfo->mProfile;
     cinst.codecSpecific.H264.constraints = codecInfo->mConstraints;