summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-05-15 09:35:06 +0000
committerpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-05-15 09:35:06 +0000
commit7e68693b6862ad571ea422828b12f102aeea0a15 (patch)
tree087da2edc6172ae079fc18e92737910a97d006e1
parent3362d4237f3f92c15a275878061ce02f28b204c2 (diff)
downloadwebrtc-7e68693b6862ad571ea422828b12f102aeea0a15.tar.gz
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
-rw-r--r--common.gyp20
-rw-r--r--common_types.h26
-rw-r--r--config.cc53
-rw-r--r--config.h32
-rw-r--r--video/video_send_stream.cc93
-rw-r--r--video_send_stream.h8
-rw-r--r--webrtc.gyp2
7 files changed, 207 insertions, 27 deletions
diff --git a/common.gyp b/common.gyp
new file mode 100644
index 00000000..b6b6354a
--- /dev/null
+++ b/common.gyp
@@ -0,0 +1,20 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+{
+ 'includes': ['build/common.gypi'],
+ 'targets': [
+ {
+ 'target_name': 'webrtc_common',
+ 'type': 'static_library',
+ 'sources': [
+ 'config.h',
+ 'config.cc',
+ ],
+ },
+ ],
+}
diff --git a/common_types.h b/common_types.h
index 2d93102d..6892a83f 100644
--- a/common_types.h
+++ b/common_types.h
@@ -13,6 +13,8 @@
#include <stddef.h>
#include <string.h>
+
+#include <string>
#include <vector>
#include "webrtc/typedefs.h"
@@ -781,30 +783,6 @@ struct RTPHeader {
RTPHeaderExtension extension;
};
-struct VideoStream {
- VideoStream()
- : width(0),
- height(0),
- max_framerate(-1),
- min_bitrate_bps(-1),
- target_bitrate_bps(-1),
- max_bitrate_bps(-1),
- max_qp(-1) {}
-
- size_t width;
- size_t height;
- int max_framerate;
-
- int min_bitrate_bps;
- int target_bitrate_bps;
- int max_bitrate_bps;
-
- int max_qp;
-
- // Bitrate thresholds for enabling additional temporal layers.
- std::vector<int> temporal_layers;
-};
-
} // namespace webrtc
#endif // WEBRTC_COMMON_TYPES_H_
diff --git a/config.cc b/config.cc
new file mode 100644
index 00000000..e0324b9e
--- /dev/null
+++ b/config.cc
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#include "webrtc/config.h"
+
+#include <sstream>
+#include <string>
+
+namespace webrtc {
+std::string FecConfig::ToString() const {
+ std::stringstream ss;
+ ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
+ ss << ", red_payload_type: " << red_payload_type;
+ ss << '}';
+ return ss.str();
+}
+
+std::string RtpExtension::ToString() const {
+ std::stringstream ss;
+ ss << "{name: " << name;
+ ss << ", id: " << id;
+ ss << '}';
+ return ss.str();
+}
+
+std::string VideoStream::ToString() const {
+ std::stringstream ss;
+ ss << "{width: " << width;
+ ss << ", height: " << height;
+ ss << ", max_framerate: " << max_framerate;
+ ss << ", min_bitrate_bps:" << min_bitrate_bps;
+ ss << ", target_bitrate_bps:" << target_bitrate_bps;
+ ss << ", max_bitrate_bps:" << max_bitrate_bps;
+ ss << ", max_qp: " << max_qp;
+
+ ss << ", temporal_layers: {";
+ for (size_t i = 0; i < temporal_layers.size(); ++i) {
+ ss << temporal_layers[i];
+ if (i != temporal_layers.size() - 1)
+ ss << "}, {";
+ }
+ ss << '}';
+
+ ss << '}';
+ return ss.str();
+}
+} // namespace webrtc
diff --git a/config.h b/config.h
index 105d9a54..7717bbad 100644
--- a/config.h
+++ b/config.h
@@ -57,6 +57,7 @@ struct NackConfig {
// payload types to '-1' to disable.
struct FecConfig {
FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {}
+ std::string ToString() const;
// Payload type used for ULPFEC packets.
int ulpfec_payload_type;
@@ -66,13 +67,40 @@ struct FecConfig {
// RTP header extension to use for the video stream, see RFC 5285.
struct RtpExtension {
- static const char* kTOffset;
- static const char* kAbsSendTime;
RtpExtension(const char* name, int id) : name(name), id(id) {}
+ std::string ToString() const;
// TODO(mflodman) Add API to query supported extensions.
+ static const char* kTOffset;
+ static const char* kAbsSendTime;
std::string name;
int id;
};
+
+struct VideoStream {
+ VideoStream()
+ : width(0),
+ height(0),
+ max_framerate(-1),
+ min_bitrate_bps(-1),
+ target_bitrate_bps(-1),
+ max_bitrate_bps(-1),
+ max_qp(-1) {}
+ std::string ToString() const;
+
+ size_t width;
+ size_t height;
+ int max_framerate;
+
+ int min_bitrate_bps;
+ int target_bitrate_bps;
+ int max_bitrate_bps;
+
+ int max_qp;
+
+ // Bitrate thresholds for enabling additional temporal layers.
+ std::vector<int> temporal_layers;
+};
+
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_CONFIG_H_
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index e6e683a1..c1de2745 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,
diff --git a/video_send_stream.h b/video_send_stream.h
index aa027b0e..1a94121d 100644
--- a/video_send_stream.h
+++ b/video_send_stream.h
@@ -64,9 +64,13 @@ class VideoSendStream {
target_delay_ms(0),
pacing(false),
suspend_below_min_bitrate(false) {}
+ std::string ToString() const;
+
struct EncoderSettings {
EncoderSettings()
: payload_type(-1), encoder(NULL), encoder_settings(NULL) {}
+ std::string ToString() const;
+
std::string payload_name;
int payload_type;
@@ -87,6 +91,7 @@ class VideoSendStream {
Rtp()
: max_packet_size(kDefaultMaxPacketSize),
min_transmit_bitrate_bps(0) {}
+ std::string ToString() const;
std::vector<uint32_t> ssrcs;
@@ -111,6 +116,7 @@ class VideoSendStream {
// details.
struct Rtx {
Rtx() : payload_type(0) {}
+ std::string ToString() const;
// SSRCs to use for the RTX streams.
std::vector<uint32_t> ssrcs;
@@ -136,7 +142,7 @@ class VideoSendStream {
// Expected delay needed by the renderer, i.e. the frame will be delivered
// this many milliseconds, if possible, earlier than expected render time.
- // Only valid if |renderer| is set.
+ // Only valid if |local_renderer| is set.
int render_delay_ms;
// Target delay in milliseconds. A positive value indicates this stream is
diff --git a/webrtc.gyp b/webrtc.gyp
index f376c064..d50552d9 100644
--- a/webrtc.gyp
+++ b/webrtc.gyp
@@ -20,6 +20,7 @@
'variables': {
'webrtc_all_dependencies': [
'base/base.gyp:*',
+ 'common.gyp:*',
'common_audio/common_audio.gyp:*',
'common_video/common_video.gyp:*',
'modules/modules.gyp:*',
@@ -75,6 +76,7 @@
'<@(webrtc_video_sources)',
],
'dependencies': [
+ 'common.gyp:*',
'<@(webrtc_video_dependencies)',
],
},