Add ToString() to VideoSendStream::Config.

Adds ToString() to subsequent parts as well as a common.gyp to define
ToString() methods for config.h. VideoStream is also moved to config.h.

BUG=3171
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/11329004

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6170 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index e6e683a..c1de274 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -10,6 +10,7 @@
 
 #include "webrtc/video/video_send_stream.h"
 
+#include <sstream>
 #include <string>
 #include <vector>
 
@@ -25,6 +26,98 @@
 #include "webrtc/video_send_stream.h"
 
 namespace webrtc {
+std::string
+VideoSendStream::VideoSendStream::Config::EncoderSettings::ToString() const {
+  std::stringstream ss;
+  ss << "{payload_name: " << payload_name;
+  ss << ", payload_type: " << payload_type;
+  if (encoder != NULL)
+    ss << ", (encoder)";
+  if (encoder_settings != NULL)
+    ss << ", (encoder_settings)";
+
+  ss << ", streams: {";
+  for (size_t i = 0; i < streams.size(); ++i) {
+    ss << streams[i].ToString();
+    if (i != streams.size() - 1)
+      ss << "}, {";
+  }
+  ss << '}';
+
+  ss << '}';
+  return ss.str();
+}
+
+std::string VideoSendStream::VideoSendStream::Config::Rtp::Rtx::ToString()
+    const {
+  std::stringstream ss;
+  ss << "{ssrcs: {";
+  for (size_t i = 0; i < ssrcs.size(); ++i) {
+    ss << ssrcs[i];
+    if (i != ssrcs.size() - 1)
+      ss << "}, {";
+  }
+  ss << '}';
+
+  ss << ", payload_type: " << payload_type;
+  ss << '}';
+  return ss.str();
+}
+
+std::string VideoSendStream::VideoSendStream::Config::Rtp::ToString() const {
+  std::stringstream ss;
+  ss << "{ssrcs: {";
+  for (size_t i = 0; i < ssrcs.size(); ++i) {
+    ss << ssrcs[i];
+    if (i != ssrcs.size() - 1)
+      ss << "}, {";
+  }
+  ss << '}';
+
+  ss << ", max_packet_size: " << max_packet_size;
+  if (min_transmit_bitrate_bps != 0)
+    ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
+
+  ss << ", extensions: {";
+  for (size_t i = 0; i < extensions.size(); ++i) {
+    ss << extensions[i].ToString();
+    if (i != extensions.size() - 1)
+      ss << "}, {";
+  }
+  ss << '}';
+
+  if (nack.rtp_history_ms != 0)
+    ss << ", nack.rtp_history_ms: " << nack.rtp_history_ms;
+  if (fec.ulpfec_payload_type != -1 || fec.red_payload_type != -1)
+    ss << ", fec: " << fec.ToString();
+  if (rtx.payload_type != 0 || !rtx.ssrcs.empty())
+    ss << ", rtx: " << rtx.ToString();
+  if (c_name != "")
+    ss << ", c_name: " << c_name;
+  ss << '}';
+  return ss.str();
+}
+
+std::string VideoSendStream::VideoSendStream::Config::ToString() const {
+  std::stringstream ss;
+  ss << "{encoder_settings: " << encoder_settings.ToString();
+  ss << ", rtp: " << rtp.ToString();
+  if (pre_encode_callback != NULL)
+    ss << ", (pre_encode_callback)";
+  if (post_encode_callback != NULL)
+    ss << ", (post_encode_callback)";
+  if (local_renderer != NULL) {
+    ss << ", (local_renderer, render_delay_ms: " << render_delay_ms << ")";
+  }
+  if (target_delay_ms > 0)
+    ss << ", target_delay_ms: " << target_delay_ms;
+  if (pacing)
+    ss << ", pacing: on";
+  if (suspend_below_min_bitrate)
+    ss << ", suspend_below_min_bitrate: on";
+  ss << '}';
+  return ss.str();
+}
 namespace internal {
 
 VideoSendStream::VideoSendStream(newapi::Transport* transport,