blob: 3a74e5238e7d831a145ae97d33d54f6d76b10c51 [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 {
16std::string FecConfig::ToString() const {
17 std::stringstream ss;
18 ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
19 ss << ", red_payload_type: " << red_payload_type;
20 ss << '}';
21 return ss.str();
22}
23
24std::string RtpExtension::ToString() const {
25 std::stringstream ss;
26 ss << "{name: " << name;
27 ss << ", id: " << id;
28 ss << '}';
29 return ss.str();
30}
31
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020032const char* RtpExtension::kTOffset = "urn:ietf:params:rtp-hdrext:toffset";
33const char* RtpExtension::kAbsSendTime =
34 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
35const char* RtpExtension::kVideoRotation = "urn:3gpp:video-orientation";
36const char* RtpExtension::kAudioLevel =
37 "urn:ietf:params:rtp-hdrext:ssrc-audio-level";
sprang867fb522015-08-03 04:38:41 -070038const char* RtpExtension::kTransportSequenceNumber =
stefanc1aeaf02015-10-15 07:26:07 -070039 "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions";
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020040
41bool RtpExtension::IsSupportedForAudio(const std::string& name) {
42 return name == webrtc::RtpExtension::kAbsSendTime ||
sprang867fb522015-08-03 04:38:41 -070043 name == webrtc::RtpExtension::kAudioLevel ||
44 name == webrtc::RtpExtension::kTransportSequenceNumber;
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020045}
46
47bool RtpExtension::IsSupportedForVideo(const std::string& name) {
48 return name == webrtc::RtpExtension::kTOffset ||
49 name == webrtc::RtpExtension::kAbsSendTime ||
sprang867fb522015-08-03 04:38:41 -070050 name == webrtc::RtpExtension::kVideoRotation ||
51 name == webrtc::RtpExtension::kTransportSequenceNumber;
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +020052}
53
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000054VideoStream::VideoStream()
55 : width(0),
56 height(0),
57 max_framerate(-1),
58 min_bitrate_bps(-1),
59 target_bitrate_bps(-1),
60 max_bitrate_bps(-1),
61 max_qp(-1) {}
62
63VideoStream::~VideoStream() = default;
64
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000065std::string VideoStream::ToString() const {
66 std::stringstream ss;
67 ss << "{width: " << width;
68 ss << ", height: " << height;
69 ss << ", max_framerate: " << max_framerate;
70 ss << ", min_bitrate_bps:" << min_bitrate_bps;
71 ss << ", target_bitrate_bps:" << target_bitrate_bps;
72 ss << ", max_bitrate_bps:" << max_bitrate_bps;
73 ss << ", max_qp: " << max_qp;
74
pbos@webrtc.org931e3da2014-11-06 09:35:08 +000075 ss << ", temporal_layer_thresholds_bps: [";
pbos@webrtc.orgb7ed7792014-10-31 13:08:10 +000076 for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) {
77 ss << temporal_layer_thresholds_bps[i];
78 if (i != temporal_layer_thresholds_bps.size() - 1)
pbos@webrtc.org931e3da2014-11-06 09:35:08 +000079 ss << ", ";
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000080 }
pbos@webrtc.org931e3da2014-11-06 09:35:08 +000081 ss << ']';
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +000082
83 ss << '}';
84 return ss.str();
85}
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +000086
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000087VideoEncoderConfig::VideoEncoderConfig()
Erik Språng143cec12015-04-28 10:01:41 +020088 : content_type(ContentType::kRealtimeVideo),
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000089 encoder_specific_settings(NULL),
Erik Språng143cec12015-04-28 10:01:41 +020090 min_transmit_bitrate_bps(0) {
91}
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +000092
93VideoEncoderConfig::~VideoEncoderConfig() = default;
94
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +000095std::string VideoEncoderConfig::ToString() const {
96 std::stringstream ss;
97
pbos@webrtc.org931e3da2014-11-06 09:35:08 +000098 ss << "{streams: [";
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +000099 for (size_t i = 0; i < streams.size(); ++i) {
100 ss << streams[i].ToString();
101 if (i != streams.size() - 1)
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000102 ss << ", ";
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000103 }
pbos@webrtc.org931e3da2014-11-06 09:35:08 +0000104 ss << ']';
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000105 ss << ", content_type: ";
106 switch (content_type) {
Erik Språng143cec12015-04-28 10:01:41 +0200107 case ContentType::kRealtimeVideo:
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000108 ss << "kRealtimeVideo";
109 break;
Erik Språng143cec12015-04-28 10:01:41 +0200110 case ContentType::kScreen:
pbos@webrtc.orgad3b5a52014-10-24 09:23:21 +0000111 ss << "kScreenshare";
112 break;
113 }
114 ss << ", encoder_specific_settings: ";
115 ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
116
117 ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
118 ss << '}';
119 return ss.str();
120}
121
pbos@webrtc.org1e92b0a2014-05-15 09:35:06 +0000122} // namespace webrtc