| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include "webrtc/config.h" | 10 #include "webrtc/call/config.h" |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <sstream> | 13 #include <sstream> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "webrtc/rtc_base/checks.h" | 16 #include "webrtc/rtc_base/checks.h" |
| 17 | 17 |
| 18 namespace webrtc { | 18 namespace webrtc { |
| 19 std::string NackConfig::ToString() const { | 19 std::string NackConfig::ToString() const { |
| 20 std::stringstream ss; | 20 std::stringstream ss; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 ss << '}'; | 31 ss << '}'; |
| 32 return ss.str(); | 32 return ss.str(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool UlpfecConfig::operator==(const UlpfecConfig& other) const { | 35 bool UlpfecConfig::operator==(const UlpfecConfig& other) const { |
| 36 return ulpfec_payload_type == other.ulpfec_payload_type && | 36 return ulpfec_payload_type == other.ulpfec_payload_type && |
| 37 red_payload_type == other.red_payload_type && | 37 red_payload_type == other.red_payload_type && |
| 38 red_rtx_payload_type == other.red_rtx_payload_type; | 38 red_rtx_payload_type == other.red_rtx_payload_type; |
| 39 } | 39 } |
| 40 | 40 |
| 41 std::string RtpExtension::ToString() const { | |
| 42 std::stringstream ss; | |
| 43 ss << "{uri: " << uri; | |
| 44 ss << ", id: " << id; | |
| 45 if (encrypt) { | |
| 46 ss << ", encrypt"; | |
| 47 } | |
| 48 ss << '}'; | |
| 49 return ss.str(); | |
| 50 } | |
| 51 | |
| 52 const char RtpExtension::kAudioLevelUri[] = | |
| 53 "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; | |
| 54 const int RtpExtension::kAudioLevelDefaultId = 1; | |
| 55 | |
| 56 const char RtpExtension::kTimestampOffsetUri[] = | |
| 57 "urn:ietf:params:rtp-hdrext:toffset"; | |
| 58 const int RtpExtension::kTimestampOffsetDefaultId = 2; | |
| 59 | |
| 60 const char RtpExtension::kAbsSendTimeUri[] = | |
| 61 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; | |
| 62 const int RtpExtension::kAbsSendTimeDefaultId = 3; | |
| 63 | |
| 64 const char RtpExtension::kVideoRotationUri[] = "urn:3gpp:video-orientation"; | |
| 65 const int RtpExtension::kVideoRotationDefaultId = 4; | |
| 66 | |
| 67 const char RtpExtension::kTransportSequenceNumberUri[] = | |
| 68 "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"; | |
| 69 const int RtpExtension::kTransportSequenceNumberDefaultId = 5; | |
| 70 | |
| 71 // This extension allows applications to adaptively limit the playout delay | |
| 72 // on frames as per the current needs. For example, a gaming application | |
| 73 // has very different needs on end-to-end delay compared to a video-conference | |
| 74 // application. | |
| 75 const char RtpExtension::kPlayoutDelayUri[] = | |
| 76 "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"; | |
| 77 const int RtpExtension::kPlayoutDelayDefaultId = 6; | |
| 78 | |
| 79 const char RtpExtension::kVideoContentTypeUri[] = | |
| 80 "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type"; | |
| 81 const int RtpExtension::kVideoContentTypeDefaultId = 7; | |
| 82 | |
| 83 const char RtpExtension::kVideoTimingUri[] = | |
| 84 "http://www.webrtc.org/experiments/rtp-hdrext/video-timing"; | |
| 85 const int RtpExtension::kVideoTimingDefaultId = 8; | |
| 86 | |
| 87 const char RtpExtension::kEncryptHeaderExtensionsUri[] = | |
| 88 "urn:ietf:params:rtp-hdrext:encrypt"; | |
| 89 | |
| 90 const int RtpExtension::kMinId = 1; | |
| 91 const int RtpExtension::kMaxId = 14; | |
| 92 | |
| 93 bool RtpExtension::IsSupportedForAudio(const std::string& uri) { | |
| 94 return uri == webrtc::RtpExtension::kAudioLevelUri || | |
| 95 uri == webrtc::RtpExtension::kTransportSequenceNumberUri; | |
| 96 } | |
| 97 | |
| 98 bool RtpExtension::IsSupportedForVideo(const std::string& uri) { | |
| 99 return uri == webrtc::RtpExtension::kTimestampOffsetUri || | |
| 100 uri == webrtc::RtpExtension::kAbsSendTimeUri || | |
| 101 uri == webrtc::RtpExtension::kVideoRotationUri || | |
| 102 uri == webrtc::RtpExtension::kTransportSequenceNumberUri || | |
| 103 uri == webrtc::RtpExtension::kPlayoutDelayUri || | |
| 104 uri == webrtc::RtpExtension::kVideoContentTypeUri || | |
| 105 uri == webrtc::RtpExtension::kVideoTimingUri; | |
| 106 } | |
| 107 | |
| 108 bool RtpExtension::IsEncryptionSupported(const std::string& uri) { | |
| 109 return uri == webrtc::RtpExtension::kAudioLevelUri || | |
| 110 uri == webrtc::RtpExtension::kTimestampOffsetUri || | |
| 111 #if !defined(ENABLE_EXTERNAL_AUTH) | |
| 112 // TODO(jbauch): Figure out a way to always allow "kAbsSendTimeUri" | |
| 113 // here and filter out later if external auth is really used in | |
| 114 // srtpfilter. External auth is used by Chromium and replaces the | |
| 115 // extension header value of "kAbsSendTimeUri", so it must not be | |
| 116 // encrypted (which can't be done by Chromium). | |
| 117 uri == webrtc::RtpExtension::kAbsSendTimeUri || | |
| 118 #endif | |
| 119 uri == webrtc::RtpExtension::kVideoRotationUri || | |
| 120 uri == webrtc::RtpExtension::kTransportSequenceNumberUri || | |
| 121 uri == webrtc::RtpExtension::kPlayoutDelayUri || | |
| 122 uri == webrtc::RtpExtension::kVideoContentTypeUri; | |
| 123 } | |
| 124 | |
| 125 const RtpExtension* RtpExtension::FindHeaderExtensionByUri( | |
| 126 const std::vector<RtpExtension>& extensions, | |
| 127 const std::string& uri) { | |
| 128 for (const auto& extension : extensions) { | |
| 129 if (extension.uri == uri) { | |
| 130 return &extension; | |
| 131 } | |
| 132 } | |
| 133 return nullptr; | |
| 134 } | |
| 135 | |
| 136 std::vector<RtpExtension> RtpExtension::FilterDuplicateNonEncrypted( | |
| 137 const std::vector<RtpExtension>& extensions) { | |
| 138 std::vector<RtpExtension> filtered; | |
| 139 for (auto extension = extensions.begin(); extension != extensions.end(); | |
| 140 ++extension) { | |
| 141 if (extension->encrypt) { | |
| 142 filtered.push_back(*extension); | |
| 143 continue; | |
| 144 } | |
| 145 | |
| 146 // Only add non-encrypted extension if no encrypted with the same URI | |
| 147 // is also present... | |
| 148 if (std::find_if(extension + 1, extensions.end(), | |
| 149 [extension](const RtpExtension& check) { | |
| 150 return extension->uri == check.uri; | |
| 151 }) != extensions.end()) { | |
| 152 continue; | |
| 153 } | |
| 154 | |
| 155 // ...and has not been added before. | |
| 156 if (!FindHeaderExtensionByUri(filtered, extension->uri)) { | |
| 157 filtered.push_back(*extension); | |
| 158 } | |
| 159 } | |
| 160 return filtered; | |
| 161 } | |
| 162 | |
| 163 VideoStream::VideoStream() | 41 VideoStream::VideoStream() |
| 164 : width(0), | 42 : width(0), |
| 165 height(0), | 43 height(0), |
| 166 max_framerate(-1), | 44 max_framerate(-1), |
| 167 min_bitrate_bps(-1), | 45 min_bitrate_bps(-1), |
| 168 target_bitrate_bps(-1), | 46 target_bitrate_bps(-1), |
| 169 max_bitrate_bps(-1), | 47 max_bitrate_bps(-1), |
| 170 max_qp(-1) {} | 48 max_qp(-1) {} |
| 171 | 49 |
| 172 VideoStream::~VideoStream() = default; | 50 VideoStream::~VideoStream() = default; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings( | 152 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings( |
| 275 const VideoCodecVP9& specifics) | 153 const VideoCodecVP9& specifics) |
| 276 : specifics_(specifics) {} | 154 : specifics_(specifics) {} |
| 277 | 155 |
| 278 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9( | 156 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9( |
| 279 VideoCodecVP9* vp9_settings) const { | 157 VideoCodecVP9* vp9_settings) const { |
| 280 *vp9_settings = specifics_; | 158 *vp9_settings = specifics_; |
| 281 } | 159 } |
| 282 | 160 |
| 283 } // namespace webrtc | 161 } // namespace webrtc |
| OLD | NEW |