pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [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 | 75851e0 | 2016-02-03 12:29:59 | [diff] [blame] | 20 | ss << ", red_rtx_payload_type: " << red_rtx_payload_type; |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 21 | ss << '}'; |
| 22 | return ss.str(); |
| 23 | } |
| 24 | |
| 25 | std::string RtpExtension::ToString() const { |
| 26 | std::stringstream ss; |
| 27 | ss << "{name: " << name; |
| 28 | ss << ", id: " << id; |
| 29 | ss << '}'; |
| 30 | return ss.str(); |
| 31 | } |
| 32 | |
Fredrik Solenberg | ad86786 | 2015-04-29 13:24:01 | [diff] [blame] | 33 | const char* RtpExtension::kTOffset = "urn:ietf:params:rtp-hdrext:toffset"; |
| 34 | const char* RtpExtension::kAbsSendTime = |
| 35 | "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; |
| 36 | const char* RtpExtension::kVideoRotation = "urn:3gpp:video-orientation"; |
| 37 | const char* RtpExtension::kAudioLevel = |
| 38 | "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; |
sprang | 374a570 | 2015-08-03 11:38:41 | [diff] [blame] | 39 | const char* RtpExtension::kTransportSequenceNumber = |
Stefan Holmer | cd0022e | 2016-03-01 15:27:20 | [diff] [blame] | 40 | "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"; |
Fredrik Solenberg | ad86786 | 2015-04-29 13:24:01 | [diff] [blame] | 41 | |
| 42 | bool RtpExtension::IsSupportedForAudio(const std::string& name) { |
| 43 | return name == webrtc::RtpExtension::kAbsSendTime || |
sprang | 374a570 | 2015-08-03 11:38:41 | [diff] [blame] | 44 | name == webrtc::RtpExtension::kAudioLevel || |
| 45 | name == webrtc::RtpExtension::kTransportSequenceNumber; |
Fredrik Solenberg | ad86786 | 2015-04-29 13:24:01 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | bool RtpExtension::IsSupportedForVideo(const std::string& name) { |
| 49 | return name == webrtc::RtpExtension::kTOffset || |
| 50 | name == webrtc::RtpExtension::kAbsSendTime || |
sprang | 374a570 | 2015-08-03 11:38:41 | [diff] [blame] | 51 | name == webrtc::RtpExtension::kVideoRotation || |
| 52 | name == webrtc::RtpExtension::kTransportSequenceNumber; |
Fredrik Solenberg | ad86786 | 2015-04-29 13:24:01 | [diff] [blame] | 53 | } |
| 54 | |
kwiberg@webrtc.org | c4e2cd0 | 2015-02-26 13:59:22 | [diff] [blame] | 55 | VideoStream::VideoStream() |
| 56 | : width(0), |
| 57 | height(0), |
| 58 | max_framerate(-1), |
| 59 | min_bitrate_bps(-1), |
| 60 | target_bitrate_bps(-1), |
| 61 | max_bitrate_bps(-1), |
| 62 | max_qp(-1) {} |
| 63 | |
| 64 | VideoStream::~VideoStream() = default; |
| 65 | |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 66 | std::string VideoStream::ToString() const { |
| 67 | std::stringstream ss; |
| 68 | ss << "{width: " << width; |
| 69 | ss << ", height: " << height; |
| 70 | ss << ", max_framerate: " << max_framerate; |
| 71 | ss << ", min_bitrate_bps:" << min_bitrate_bps; |
| 72 | ss << ", target_bitrate_bps:" << target_bitrate_bps; |
| 73 | ss << ", max_bitrate_bps:" << max_bitrate_bps; |
| 74 | ss << ", max_qp: " << max_qp; |
| 75 | |
pbos@webrtc.org | 98dd0b8 | 2014-11-06 09:35:08 | [diff] [blame] | 76 | ss << ", temporal_layer_thresholds_bps: ["; |
pbos@webrtc.org | ddb84aa | 2014-10-31 13:08:10 | [diff] [blame] | 77 | for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) { |
| 78 | ss << temporal_layer_thresholds_bps[i]; |
| 79 | if (i != temporal_layer_thresholds_bps.size() - 1) |
pbos@webrtc.org | 98dd0b8 | 2014-11-06 09:35:08 | [diff] [blame] | 80 | ss << ", "; |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 81 | } |
pbos@webrtc.org | 98dd0b8 | 2014-11-06 09:35:08 | [diff] [blame] | 82 | ss << ']'; |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 83 | |
| 84 | ss << '}'; |
| 85 | return ss.str(); |
| 86 | } |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 87 | |
kwiberg@webrtc.org | c4e2cd0 | 2015-02-26 13:59:22 | [diff] [blame] | 88 | VideoEncoderConfig::VideoEncoderConfig() |
Erik Språng | fc398fe | 2015-04-28 08:01:41 | [diff] [blame] | 89 | : content_type(ContentType::kRealtimeVideo), |
kwiberg@webrtc.org | c4e2cd0 | 2015-02-26 13:59:22 | [diff] [blame] | 90 | encoder_specific_settings(NULL), |
Erik Språng | fc398fe | 2015-04-28 08:01:41 | [diff] [blame] | 91 | min_transmit_bitrate_bps(0) { |
| 92 | } |
kwiberg@webrtc.org | c4e2cd0 | 2015-02-26 13:59:22 | [diff] [blame] | 93 | |
| 94 | VideoEncoderConfig::~VideoEncoderConfig() = default; |
| 95 | |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 96 | std::string VideoEncoderConfig::ToString() const { |
| 97 | std::stringstream ss; |
| 98 | |
pbos@webrtc.org | 98dd0b8 | 2014-11-06 09:35:08 | [diff] [blame] | 99 | ss << "{streams: ["; |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 100 | for (size_t i = 0; i < streams.size(); ++i) { |
| 101 | ss << streams[i].ToString(); |
| 102 | if (i != streams.size() - 1) |
pbos@webrtc.org | 98dd0b8 | 2014-11-06 09:35:08 | [diff] [blame] | 103 | ss << ", "; |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 104 | } |
pbos@webrtc.org | 98dd0b8 | 2014-11-06 09:35:08 | [diff] [blame] | 105 | ss << ']'; |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 106 | ss << ", content_type: "; |
| 107 | switch (content_type) { |
Erik Språng | fc398fe | 2015-04-28 08:01:41 | [diff] [blame] | 108 | case ContentType::kRealtimeVideo: |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 109 | ss << "kRealtimeVideo"; |
| 110 | break; |
Erik Språng | fc398fe | 2015-04-28 08:01:41 | [diff] [blame] | 111 | case ContentType::kScreen: |
pbos@webrtc.org | 2366875 | 2014-10-24 09:23:21 | [diff] [blame] | 112 | ss << "kScreenshare"; |
| 113 | break; |
| 114 | } |
| 115 | ss << ", encoder_specific_settings: "; |
| 116 | ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL"); |
| 117 | |
| 118 | ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps; |
| 119 | ss << '}'; |
| 120 | return ss.str(); |
| 121 | } |
| 122 | |
pbos@webrtc.org | 7e68693 | 2014-05-15 09:35:06 | [diff] [blame] | 123 | } // namespace webrtc |