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@6170 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
1aae6bf735
commit
1e92b0a93d
20
webrtc/common.gyp
Normal file
20
webrtc/common.gyp
Normal file
@ -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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
@ -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_
|
||||
|
53
webrtc/config.cc
Normal file
53
webrtc/config.cc
Normal file
@ -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
|
@ -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 {
|
||||
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;
|
||||
RtpExtension(const char* name, int id) : name(name), id(id) {}
|
||||
// TODO(mflodman) Add API to query supported extensions.
|
||||
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_
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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)',
|
||||
],
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user