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 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 32const 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"; 38const char* RtpExtension::kTransportSequenceNumber = 39 "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions"; 40 41bool RtpExtension::IsSupportedForAudio(const std::string& name) { 42 return name == webrtc::RtpExtension::kAbsSendTime || 43 name == webrtc::RtpExtension::kAudioLevel || 44 name == webrtc::RtpExtension::kTransportSequenceNumber; 45} 46 47bool RtpExtension::IsSupportedForVideo(const std::string& name) { 48 return name == webrtc::RtpExtension::kTOffset || 49 name == webrtc::RtpExtension::kAbsSendTime || 50 name == webrtc::RtpExtension::kVideoRotation || 51 name == webrtc::RtpExtension::kTransportSequenceNumber; 52} 53 54VideoStream::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 65std::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 75 ss << ", temporal_layer_thresholds_bps: ["; 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) 79 ss << ", "; 80 } 81 ss << ']'; 82 83 ss << '}'; 84 return ss.str(); 85} 86 87VideoEncoderConfig::VideoEncoderConfig() 88 : content_type(ContentType::kRealtimeVideo), 89 encoder_specific_settings(NULL), 90 min_transmit_bitrate_bps(0) { 91} 92 93VideoEncoderConfig::~VideoEncoderConfig() = default; 94 95std::string VideoEncoderConfig::ToString() const { 96 std::stringstream ss; 97 98 ss << "{streams: ["; 99 for (size_t i = 0; i < streams.size(); ++i) { 100 ss << streams[i].ToString(); 101 if (i != streams.size() - 1) 102 ss << ", "; 103 } 104 ss << ']'; 105 ss << ", content_type: "; 106 switch (content_type) { 107 case ContentType::kRealtimeVideo: 108 ss << "kRealtimeVideo"; 109 break; 110 case ContentType::kScreen: 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 122} // namespace webrtc 123