(Auto)update libjingle 69337301-> 69359922

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6457 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/mediaconstraintsinterface.cc b/talk/app/webrtc/mediaconstraintsinterface.cc
index b19604b..6f88d79 100644
--- a/talk/app/webrtc/mediaconstraintsinterface.cc
+++ b/talk/app/webrtc/mediaconstraintsinterface.cc
@@ -118,6 +118,8 @@
     "googHighBitrate";
 const char MediaConstraintsInterface::kVeryHighBitrate[] =
     "googVeryHighBitrate";
+const char MediaConstraintsInterface::kPayloadPadding[] = "googPayloadPadding";
+
 
 // Set |value| to the value associated with the first appearance of |key|, or
 // return false if |key| is not found.
diff --git a/talk/app/webrtc/mediaconstraintsinterface.h b/talk/app/webrtc/mediaconstraintsinterface.h
index 36cf20d..0db39a6 100644
--- a/talk/app/webrtc/mediaconstraintsinterface.h
+++ b/talk/app/webrtc/mediaconstraintsinterface.h
@@ -132,6 +132,7 @@
   static const char kHighStartBitrate[];  // googHighStartBitrate
   static const char kHighBitrate[];  // googHighBitrate
   static const char kVeryHighBitrate[];  // googVeryHighBitrate
+  static const char kPayloadPadding[];  // googPayloadPadding
 
   // The prefix of internal-only constraints whose JS set values should be
   // stripped by Chrome before passed down to Libjingle.
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc
index 17177bd..9575579 100644
--- a/talk/app/webrtc/webrtcsession.cc
+++ b/talk/app/webrtc/webrtcsession.cc
@@ -371,14 +371,15 @@
 
 // Set |option| to the highest-priority value of |key| in the optional
 // constraints if the key is found and has a valid value.
+template<typename T>
 static void SetOptionFromOptionalConstraint(
     const MediaConstraintsInterface* constraints,
-    const std::string& key, cricket::Settable<int>* option) {
+    const std::string& key, cricket::Settable<T>* option) {
   if (!constraints) {
     return;
   }
   std::string string_value;
-  int value;
+  T value;
   if (constraints->GetOptional().FindFirst(key, &string_value)) {
     if (talk_base::FromString(string_value, &value)) {
       option->Set(value);
@@ -565,26 +566,22 @@
       MediaConstraintsInterface::kCpuOveruseThreshold,
       &video_options_.cpu_overuse_threshold);
   SetOptionFromOptionalConstraint(constraints,
+      MediaConstraintsInterface::kCpuOveruseDetection,
+      &video_options_.cpu_overuse_detection);
+  SetOptionFromOptionalConstraint(constraints,
+      MediaConstraintsInterface::kCpuOveruseEncodeUsage,
+      &video_options_.cpu_overuse_encode_usage);
+  SetOptionFromOptionalConstraint(constraints,
       MediaConstraintsInterface::kCpuUnderuseEncodeRsdThreshold,
       &video_options_.cpu_underuse_encode_rsd_threshold);
   SetOptionFromOptionalConstraint(constraints,
       MediaConstraintsInterface::kCpuOveruseEncodeRsdThreshold,
       &video_options_.cpu_overuse_encode_rsd_threshold);
 
-  if (FindConstraint(
-      constraints,
-      MediaConstraintsInterface::kCpuOveruseDetection,
-      &value,
-      NULL)) {
-    video_options_.cpu_overuse_detection.Set(value);
-  }
-  if (FindConstraint(
-      constraints,
-      MediaConstraintsInterface::kCpuOveruseEncodeUsage,
-      &value,
-      NULL)) {
-    video_options_.cpu_overuse_encode_usage.Set(value);
-  }
+  // Find payload padding constraint.
+  SetOptionFromOptionalConstraint(constraints,
+      MediaConstraintsInterface::kPayloadPadding,
+      &video_options_.use_payload_padding);
 
   // Find improved wifi bwe constraint.
   if (FindConstraint(
@@ -598,13 +595,9 @@
     video_options_.use_improved_wifi_bandwidth_estimator.Set(true);
   }
 
-  if (FindConstraint(
-        constraints,
-        MediaConstraintsInterface::kHighStartBitrate,
-        &value,
-        NULL)) {
-    video_options_.video_start_bitrate.Set(cricket::kHighStartBitrate);
-  }
+  SetOptionFromOptionalConstraint(constraints,
+      MediaConstraintsInterface::kHighStartBitrate,
+      &video_options_.video_start_bitrate);
 
   if (FindConstraint(
       constraints,
diff --git a/talk/media/base/mediachannel.h b/talk/media/base/mediachannel.h
index 49902ee..2d65daf 100644
--- a/talk/media/base/mediachannel.h
+++ b/talk/media/base/mediachannel.h
@@ -335,6 +335,7 @@
     screencast_min_bitrate.SetFrom(change.screencast_min_bitrate);
     use_improved_wifi_bandwidth_estimator.SetFrom(
         change.use_improved_wifi_bandwidth_estimator);
+    use_payload_padding.SetFrom(change.use_payload_padding);
   }
 
   bool operator==(const VideoOptions& o) const {
@@ -374,7 +375,8 @@
         skip_encoding_unused_streams == o.skip_encoding_unused_streams &&
         screencast_min_bitrate == o.screencast_min_bitrate &&
         use_improved_wifi_bandwidth_estimator ==
-            o.use_improved_wifi_bandwidth_estimator;
+            o.use_improved_wifi_bandwidth_estimator &&
+        use_payload_padding == o.use_payload_padding;
   }
 
   std::string ToString() const {
@@ -421,6 +423,7 @@
     ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate);
     ost << ToStringIfSet("improved wifi bwe",
                          use_improved_wifi_bandwidth_estimator);
+    ost << ToStringIfSet("payload padding", use_payload_padding);
     ost << "}";
     return ost.str();
   }
@@ -501,6 +504,8 @@
   Settable<int> screencast_min_bitrate;
   // Enable improved bandwidth estiamtor on wifi.
   Settable<bool> use_improved_wifi_bandwidth_estimator;
+  // Enable payload padding.
+  Settable<bool> use_payload_padding;
 };
 
 // A class for playing out soundclips.
diff --git a/talk/media/webrtc/fakewebrtcvideoengine.h b/talk/media/webrtc/fakewebrtcvideoengine.h
index 3eba47b..85c59d8 100644
--- a/talk/media/webrtc/fakewebrtcvideoengine.h
+++ b/talk/media/webrtc/fakewebrtcvideoengine.h
@@ -1000,6 +1000,10 @@
     return 0;
   }
 
+#ifdef USE_WEBRTC_DEV_BRANCH
+  WEBRTC_STUB(SetPadWithRedundantPayloads, (int, bool));
+#endif
+
   WEBRTC_FUNC(SetRtxReceivePayloadType, (const int channel,
                                          const uint8 payload_type)) {
     WEBRTC_CHECK_CHANNEL(channel);
@@ -1111,7 +1115,7 @@
     channels_[channel]->transmission_smoothing_ = enable;
     return 0;
   }
-  WEBRTC_FUNC(SetReservedTransmitBitrate, (int channel, 
+  WEBRTC_FUNC(SetReservedTransmitBitrate, (int channel,
       unsigned int reserved_transmit_bitrate_bps)) {
     WEBRTC_CHECK_CHANNEL(channel);
     channels_[channel]->reserved_transmit_bitrate_bps_ =
diff --git a/talk/media/webrtc/webrtcvideoengine.cc b/talk/media/webrtc/webrtcvideoengine.cc
index f1810bf..41518e8 100644
--- a/talk/media/webrtc/webrtcvideoengine.cc
+++ b/talk/media/webrtc/webrtcvideoengine.cc
@@ -2988,6 +2988,11 @@
       options_.use_improved_wifi_bandwidth_estimator !=
           options.use_improved_wifi_bandwidth_estimator;
 
+#ifdef USE_WEBRTC_DEV_BRANCH
+  bool payload_padding_changed = options.use_payload_padding.IsSet() &&
+      options_.use_payload_padding != options.use_payload_padding;
+#endif
+
 
   // Save the options, to be interpreted where appropriate.
   // Use options_.SetAll() instead of assignment so that unset value in options
@@ -3120,6 +3125,17 @@
           it->second->channel_id(), config);
     }
   }
+#ifdef USE_WEBRTC_DEV_BRANCH
+  if (payload_padding_changed) {
+    LOG(LS_INFO) << "Payload-based padding called.";
+    for (SendChannelMap::iterator it = send_channels_.begin();
+            it != send_channels_.end(); ++it) {
+      engine()->vie()->rtp()->SetPadWithRedundantPayloads(
+          it->second->channel_id(),
+          options_.use_payload_padding.GetWithDefaultIfUnset(false));
+    }
+  }
+#endif
   webrtc::CpuOveruseOptions overuse_options;
   if (GetCpuOveruseOptions(options_, &overuse_options)) {
     for (SendChannelMap::iterator it = send_channels_.begin();