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; |
| 20 | ss << '}'; |
| 21 | return ss.str(); |
| 22 | } |
| 23 | |
| 24 | std::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 Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 32 | const char* RtpExtension::kTOffset = "urn:ietf:params:rtp-hdrext:toffset"; |
| 33 | const char* RtpExtension::kAbsSendTime = |
| 34 | "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; |
| 35 | const char* RtpExtension::kVideoRotation = "urn:3gpp:video-orientation"; |
| 36 | const char* RtpExtension::kAudioLevel = |
| 37 | "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 38 | const char* RtpExtension::kTransportSequenceNumber = |
stefan | c1aeaf0 | 2015-10-15 07:26:07 -0700 | [diff] [blame] | 39 | "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions"; |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 40 | |
| 41 | bool RtpExtension::IsSupportedForAudio(const std::string& name) { |
| 42 | return name == webrtc::RtpExtension::kAbsSendTime || |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 43 | name == webrtc::RtpExtension::kAudioLevel || |
| 44 | name == webrtc::RtpExtension::kTransportSequenceNumber; |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | bool RtpExtension::IsSupportedForVideo(const std::string& name) { |
| 48 | return name == webrtc::RtpExtension::kTOffset || |
| 49 | name == webrtc::RtpExtension::kAbsSendTime || |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 50 | name == webrtc::RtpExtension::kVideoRotation || |
| 51 | name == webrtc::RtpExtension::kTransportSequenceNumber; |
Fredrik Solenberg | 23fba1f | 2015-04-29 15:24:01 +0200 | [diff] [blame] | 52 | } |
| 53 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 54 | VideoStream::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 | |
| 63 | VideoStream::~VideoStream() = default; |
| 64 | |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 65 | std::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.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 75 | ss << ", temporal_layer_thresholds_bps: ["; |
pbos@webrtc.org | b7ed779 | 2014-10-31 13:08:10 +0000 | [diff] [blame] | 76 | 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.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 79 | ss << ", "; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 80 | } |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 81 | ss << ']'; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 82 | |
| 83 | ss << '}'; |
| 84 | return ss.str(); |
| 85 | } |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 86 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 87 | VideoEncoderConfig::VideoEncoderConfig() |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 88 | : content_type(ContentType::kRealtimeVideo), |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 89 | encoder_specific_settings(NULL), |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 90 | min_transmit_bitrate_bps(0) { |
| 91 | } |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 +0000 | [diff] [blame] | 92 | |
| 93 | VideoEncoderConfig::~VideoEncoderConfig() = default; |
| 94 | |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 95 | std::string VideoEncoderConfig::ToString() const { |
| 96 | std::stringstream ss; |
| 97 | |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 98 | ss << "{streams: ["; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 99 | for (size_t i = 0; i < streams.size(); ++i) { |
| 100 | ss << streams[i].ToString(); |
| 101 | if (i != streams.size() - 1) |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 102 | ss << ", "; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 103 | } |
pbos@webrtc.org | 931e3da | 2014-11-06 09:35:08 +0000 | [diff] [blame] | 104 | ss << ']'; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 105 | ss << ", content_type: "; |
| 106 | switch (content_type) { |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 107 | case ContentType::kRealtimeVideo: |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 108 | ss << "kRealtimeVideo"; |
| 109 | break; |
Erik Språng | 143cec1 | 2015-04-28 10:01:41 +0200 | [diff] [blame] | 110 | case ContentType::kScreen: |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 111 | 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.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 122 | } // namespace webrtc |