pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 15 | namespace webrtc { |
| 16 | std::string FecConfig::ToString() const { |
| 17 | std::stringstream ss; |
| 18 | ss << "{ulpfec_payload_type: " << ulpfec_payload_type; |
| 19 | ss << ", red_payload_type: " << red_payload_type; |
Stefan Holmer | 1088001 | 2016-02-03 13:29:59 +0100 | [diff] [blame] | 20 | ss << ", red_rtx_payload_type: " << red_rtx_payload_type; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 21 | ss << '}'; |
| 22 | return ss.str(); |
| 23 | } |
| 24 | |
| 25 | std::string RtpExtension::ToString() const { |
| 26 | std::stringstream ss; |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 27 | ss << "{uri: " << uri; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 28 | ss << ", id: " << id; |
| 29 | ss << '}'; |
| 30 | return ss.str(); |
| 31 | } |
| 32 | |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 33 | const char* RtpExtension::kAudioLevelUri = |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 34 | "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 35 | const int RtpExtension::kAudioLevelDefaultId = 1; |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 36 | |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 37 | const char* RtpExtension::kTimestampOffsetUri = |
| 38 | "urn:ietf:params:rtp-hdrext:toffset"; |
| 39 | const int RtpExtension::kTimestampOffsetDefaultId = 2; |
| 40 | |
| 41 | const char* RtpExtension::kAbsSendTimeUri = |
| 42 | "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; |
| 43 | const int RtpExtension::kAbsSendTimeDefaultId = 3; |
| 44 | |
| 45 | const char* RtpExtension::kVideoRotationUri = "urn:3gpp:video-orientation"; |
| 46 | const int RtpExtension::kVideoRotationDefaultId = 4; |
| 47 | |
| 48 | const char* RtpExtension::kTransportSequenceNumberUri = |
| 49 | "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"; |
| 50 | const int RtpExtension::kTransportSequenceNumberDefaultId = 5; |
| 51 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 52 | // This extension allows applications to adaptively limit the playout delay |
| 53 | // on frames as per the current needs. For example, a gaming application |
| 54 | // has very different needs on end-to-end delay compared to a video-conference |
| 55 | // application. |
| 56 | const char* RtpExtension::kPlayoutDelayUri = |
| 57 | "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"; |
| 58 | const int RtpExtension::kPlayoutDelayDefaultId = 6; |
| 59 | |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 60 | bool RtpExtension::IsSupportedForAudio(const std::string& uri) { |
| 61 | return uri == webrtc::RtpExtension::kAbsSendTimeUri || |
| 62 | uri == webrtc::RtpExtension::kAudioLevelUri || |
| 63 | uri == webrtc::RtpExtension::kTransportSequenceNumberUri; |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 64 | } |
| 65 | |
isheriff | 6f8d686 | 2016-05-26 11:24:55 -0700 | [diff] [blame] | 66 | bool RtpExtension::IsSupportedForVideo(const std::string& uri) { |
| 67 | return uri == webrtc::RtpExtension::kTimestampOffsetUri || |
| 68 | uri == webrtc::RtpExtension::kAbsSendTimeUri || |
| 69 | uri == webrtc::RtpExtension::kVideoRotationUri || |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 70 | uri == webrtc::RtpExtension::kTransportSequenceNumberUri || |
| 71 | uri == webrtc::RtpExtension::kPlayoutDelayUri; |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 72 | } |
| 73 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 74 | VideoStream::VideoStream() |
| 75 | : width(0), |
| 76 | height(0), |
| 77 | max_framerate(-1), |
| 78 | min_bitrate_bps(-1), |
| 79 | target_bitrate_bps(-1), |
| 80 | max_bitrate_bps(-1), |
| 81 | max_qp(-1) {} |
| 82 | |
| 83 | VideoStream::~VideoStream() = default; |
| 84 | |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 85 | std::string VideoStream::ToString() const { |
| 86 | std::stringstream ss; |
| 87 | ss << "{width: " << width; |
| 88 | ss << ", height: " << height; |
| 89 | ss << ", max_framerate: " << max_framerate; |
| 90 | ss << ", min_bitrate_bps:" << min_bitrate_bps; |
| 91 | ss << ", target_bitrate_bps:" << target_bitrate_bps; |
| 92 | ss << ", max_bitrate_bps:" << max_bitrate_bps; |
| 93 | ss << ", max_qp: " << max_qp; |
| 94 | |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 95 | ss << ", temporal_layer_thresholds_bps: ["; |
pbos@webrtc.org | b7ed779 | 2014-10-31 13:08:10 +0000 | [diff] [blame] | 96 | for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) { |
| 97 | ss << temporal_layer_thresholds_bps[i]; |
| 98 | if (i != temporal_layer_thresholds_bps.size() - 1) |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 99 | ss << ", "; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 100 | } |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 101 | ss << ']'; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 102 | |
| 103 | ss << '}'; |
| 104 | return ss.str(); |
| 105 | } |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 106 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 107 | VideoEncoderConfig::VideoEncoderConfig() |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 108 | : content_type(ContentType::kRealtimeVideo), |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 109 | encoder_specific_settings(NULL), |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 110 | min_transmit_bitrate_bps(0) { |
| 111 | } |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 112 | |
| 113 | VideoEncoderConfig::~VideoEncoderConfig() = default; |
| 114 | |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 115 | std::string VideoEncoderConfig::ToString() const { |
| 116 | std::stringstream ss; |
| 117 | |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 118 | ss << "{streams: ["; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 119 | for (size_t i = 0; i < streams.size(); ++i) { |
| 120 | ss << streams[i].ToString(); |
| 121 | if (i != streams.size() - 1) |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 122 | ss << ", "; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 123 | } |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 124 | ss << ']'; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 125 | ss << ", content_type: "; |
| 126 | switch (content_type) { |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 127 | case ContentType::kRealtimeVideo: |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 128 | ss << "kRealtimeVideo"; |
| 129 | break; |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 130 | case ContentType::kScreen: |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 131 | ss << "kScreenshare"; |
| 132 | break; |
| 133 | } |
| 134 | ss << ", encoder_specific_settings: "; |
| 135 | ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL"); |
| 136 | |
| 137 | ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps; |
| 138 | ss << '}'; |
| 139 | return ss.str(); |
| 140 | } |
| 141 | |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 142 | } // namespace webrtc |