blob: d870878a631c16e29eab52077c7d34726abdfba0 [file] [log] [blame]
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +00001/*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10#include "webrtc/config.h"
11
12#include <sstream>
13#include <string>
14
15namespace webrtc {
solenberg971cab02016-06-14 10:02:41 -070016std::string NackConfig::ToString() const {
17 std::stringstream ss;
18 ss << "{rtp_history_ms: " << rtp_history_ms;
19 ss << '}';
20 return ss.str();
21}
22
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000023std::string FecConfig::ToString() const {
24 std::stringstream ss;
25 ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
26 ss << ", red_payload_type: " << red_payload_type;
Stefan Holmer10880012016-02-03 13:29:59 +010027 ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000028 ss << '}';
29 return ss.str();
30}
31
32std::string RtpExtension::ToString() const {
33 std::stringstream ss;
isheriff6f8d6862016-05-26 11:24:55 -070034 ss << "{uri: " << uri;
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000035 ss << ", id: " << id;
36 ss << '}';
37 return ss.str();
38}
39
isheriff6f8d6862016-05-26 11:24:55 -070040const char* RtpExtension::kAudioLevelUri =
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020041 "urn:ietf:params:rtp-hdrext:ssrc-audio-level";
isheriff6f8d6862016-05-26 11:24:55 -070042const int RtpExtension::kAudioLevelDefaultId = 1;
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020043
isheriff6f8d6862016-05-26 11:24:55 -070044const char* RtpExtension::kTimestampOffsetUri =
45 "urn:ietf:params:rtp-hdrext:toffset";
46const int RtpExtension::kTimestampOffsetDefaultId = 2;
47
48const char* RtpExtension::kAbsSendTimeUri =
49 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
50const int RtpExtension::kAbsSendTimeDefaultId = 3;
51
52const char* RtpExtension::kVideoRotationUri = "urn:3gpp:video-orientation";
53const int RtpExtension::kVideoRotationDefaultId = 4;
54
55const char* RtpExtension::kTransportSequenceNumberUri =
56 "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
57const int RtpExtension::kTransportSequenceNumberDefaultId = 5;
58
isheriff6b4b5f32016-06-08 00:24:21 -070059// This extension allows applications to adaptively limit the playout delay
60// on frames as per the current needs. For example, a gaming application
61// has very different needs on end-to-end delay compared to a video-conference
62// application.
63const char* RtpExtension::kPlayoutDelayUri =
64 "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
65const int RtpExtension::kPlayoutDelayDefaultId = 6;
66
isheriff6f8d6862016-05-26 11:24:55 -070067bool RtpExtension::IsSupportedForAudio(const std::string& uri) {
68 return uri == webrtc::RtpExtension::kAbsSendTimeUri ||
69 uri == webrtc::RtpExtension::kAudioLevelUri ||
70 uri == webrtc::RtpExtension::kTransportSequenceNumberUri;
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020071}
72
isheriff6f8d6862016-05-26 11:24:55 -070073bool RtpExtension::IsSupportedForVideo(const std::string& uri) {
74 return uri == webrtc::RtpExtension::kTimestampOffsetUri ||
75 uri == webrtc::RtpExtension::kAbsSendTimeUri ||
76 uri == webrtc::RtpExtension::kVideoRotationUri ||
isheriff6b4b5f32016-06-08 00:24:21 -070077 uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
78 uri == webrtc::RtpExtension::kPlayoutDelayUri;
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020079}
80
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000081VideoStream::VideoStream()
82 : width(0),
83 height(0),
84 max_framerate(-1),
85 min_bitrate_bps(-1),
86 target_bitrate_bps(-1),
87 max_bitrate_bps(-1),
88 max_qp(-1) {}
89
90VideoStream::~VideoStream() = default;
91
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000092std::string VideoStream::ToString() const {
93 std::stringstream ss;
94 ss << "{width: " << width;
95 ss << ", height: " << height;
96 ss << ", max_framerate: " << max_framerate;
97 ss << ", min_bitrate_bps:" << min_bitrate_bps;
98 ss << ", target_bitrate_bps:" << target_bitrate_bps;
99 ss << ", max_bitrate_bps:" << max_bitrate_bps;
100 ss << ", max_qp: " << max_qp;
101
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000102 ss << ", temporal_layer_thresholds_bps: [";
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +0000103 for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) {
104 ss << temporal_layer_thresholds_bps[i];
105 if (i != temporal_layer_thresholds_bps.size() - 1)
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000106 ss << ", ";
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000107 }
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000108 ss << ']';
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000109
110 ss << '}';
111 return ss.str();
112}
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000113
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000114VideoEncoderConfig::VideoEncoderConfig()
Erik Språng143cec12015-04-28 10:01:41 +0200115 : content_type(ContentType::kRealtimeVideo),
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000116 encoder_specific_settings(NULL),
skvlad3abb7642016-06-16 12:08:03 -0700117 min_transmit_bitrate_bps(0),
118 expect_encode_from_texture(false) {}
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000119
120VideoEncoderConfig::~VideoEncoderConfig() = default;
121
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000122std::string VideoEncoderConfig::ToString() const {
123 std::stringstream ss;
124
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000125 ss << "{streams: [";
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000126 for (size_t i = 0; i < streams.size(); ++i) {
127 ss << streams[i].ToString();
128 if (i != streams.size() - 1)
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000129 ss << ", ";
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000130 }
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000131 ss << ']';
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000132 ss << ", content_type: ";
133 switch (content_type) {
Erik Språng143cec12015-04-28 10:01:41 +0200134 case ContentType::kRealtimeVideo:
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000135 ss << "kRealtimeVideo";
136 break;
Erik Språng143cec12015-04-28 10:01:41 +0200137 case ContentType::kScreen:
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000138 ss << "kScreenshare";
139 break;
140 }
141 ss << ", encoder_specific_settings: ";
142 ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
143
144 ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
145 ss << '}';
146 return ss.str();
147}
148
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000149} // namespace webrtc