| 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/config.h" |
| 11 | 11 |
| 12 #include <algorithm> |
| 12 #include <sstream> | 13 #include <sstream> |
| 13 #include <string> | 14 #include <string> |
| 14 | 15 |
| 15 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 16 | 17 |
| 17 namespace webrtc { | 18 namespace webrtc { |
| 18 std::string NackConfig::ToString() const { | 19 std::string NackConfig::ToString() const { |
| 19 std::stringstream ss; | 20 std::stringstream ss; |
| 20 ss << "{rtp_history_ms: " << rtp_history_ms; | 21 ss << "{rtp_history_ms: " << rtp_history_ms; |
| 21 ss << '}'; | 22 ss << '}'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 bool UlpfecConfig::operator==(const UlpfecConfig& other) const { | 35 bool UlpfecConfig::operator==(const UlpfecConfig& other) const { |
| 35 return ulpfec_payload_type == other.ulpfec_payload_type && | 36 return ulpfec_payload_type == other.ulpfec_payload_type && |
| 36 red_payload_type == other.red_payload_type && | 37 red_payload_type == other.red_payload_type && |
| 37 red_rtx_payload_type == other.red_rtx_payload_type; | 38 red_rtx_payload_type == other.red_rtx_payload_type; |
| 38 } | 39 } |
| 39 | 40 |
| 40 std::string RtpExtension::ToString() const { | 41 std::string RtpExtension::ToString() const { |
| 41 std::stringstream ss; | 42 std::stringstream ss; |
| 42 ss << "{uri: " << uri; | 43 ss << "{uri: " << uri; |
| 43 ss << ", id: " << id; | 44 ss << ", id: " << id; |
| 45 if (encrypt) { |
| 46 ss << ", encrypt"; |
| 47 } |
| 44 ss << '}'; | 48 ss << '}'; |
| 45 return ss.str(); | 49 return ss.str(); |
| 46 } | 50 } |
| 47 | 51 |
| 48 const char* RtpExtension::kAudioLevelUri = | 52 const char* RtpExtension::kAudioLevelUri = |
| 49 "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; | 53 "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; |
| 50 const int RtpExtension::kAudioLevelDefaultId = 1; | 54 const int RtpExtension::kAudioLevelDefaultId = 1; |
| 51 | 55 |
| 52 const char* RtpExtension::kTimestampOffsetUri = | 56 const char* RtpExtension::kTimestampOffsetUri = |
| 53 "urn:ietf:params:rtp-hdrext:toffset"; | 57 "urn:ietf:params:rtp-hdrext:toffset"; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 const int RtpExtension::kPlayoutDelayDefaultId = 6; | 77 const int RtpExtension::kPlayoutDelayDefaultId = 6; |
| 74 | 78 |
| 75 const char* RtpExtension::kVideoContentTypeUri = | 79 const char* RtpExtension::kVideoContentTypeUri = |
| 76 "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type"; | 80 "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type"; |
| 77 const int RtpExtension::kVideoContentTypeDefaultId = 7; | 81 const int RtpExtension::kVideoContentTypeDefaultId = 7; |
| 78 | 82 |
| 79 const char* RtpExtension::kVideoTimingUri = | 83 const char* RtpExtension::kVideoTimingUri = |
| 80 "http://www.webrtc.org/experiments/rtp-hdrext/video-timing"; | 84 "http://www.webrtc.org/experiments/rtp-hdrext/video-timing"; |
| 81 const int RtpExtension::kVideoTimingDefaultId = 8; | 85 const int RtpExtension::kVideoTimingDefaultId = 8; |
| 82 | 86 |
| 87 const char* RtpExtension::kEncryptHeaderExtensionsUri = |
| 88 "urn:ietf:params:rtp-hdrext:encrypt"; |
| 89 |
| 83 const int RtpExtension::kMinId = 1; | 90 const int RtpExtension::kMinId = 1; |
| 84 const int RtpExtension::kMaxId = 14; | 91 const int RtpExtension::kMaxId = 14; |
| 85 | 92 |
| 86 bool RtpExtension::IsSupportedForAudio(const std::string& uri) { | 93 bool RtpExtension::IsSupportedForAudio(const std::string& uri) { |
| 87 return uri == webrtc::RtpExtension::kAudioLevelUri || | 94 return uri == webrtc::RtpExtension::kAudioLevelUri || |
| 88 uri == webrtc::RtpExtension::kTransportSequenceNumberUri; | 95 uri == webrtc::RtpExtension::kTransportSequenceNumberUri; |
| 89 } | 96 } |
| 90 | 97 |
| 91 bool RtpExtension::IsSupportedForVideo(const std::string& uri) { | 98 bool RtpExtension::IsSupportedForVideo(const std::string& uri) { |
| 92 return uri == webrtc::RtpExtension::kTimestampOffsetUri || | 99 return uri == webrtc::RtpExtension::kTimestampOffsetUri || |
| 93 uri == webrtc::RtpExtension::kAbsSendTimeUri || | 100 uri == webrtc::RtpExtension::kAbsSendTimeUri || |
| 94 uri == webrtc::RtpExtension::kVideoRotationUri || | 101 uri == webrtc::RtpExtension::kVideoRotationUri || |
| 95 uri == webrtc::RtpExtension::kTransportSequenceNumberUri || | 102 uri == webrtc::RtpExtension::kTransportSequenceNumberUri || |
| 96 uri == webrtc::RtpExtension::kPlayoutDelayUri || | 103 uri == webrtc::RtpExtension::kPlayoutDelayUri || |
| 97 uri == webrtc::RtpExtension::kVideoContentTypeUri || | 104 uri == webrtc::RtpExtension::kVideoContentTypeUri || |
| 98 uri == webrtc::RtpExtension::kVideoTimingUri; | 105 uri == webrtc::RtpExtension::kVideoTimingUri; |
| 99 } | 106 } |
| 100 | 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 |
| 101 VideoStream::VideoStream() | 163 VideoStream::VideoStream() |
| 102 : width(0), | 164 : width(0), |
| 103 height(0), | 165 height(0), |
| 104 max_framerate(-1), | 166 max_framerate(-1), |
| 105 min_bitrate_bps(-1), | 167 min_bitrate_bps(-1), |
| 106 target_bitrate_bps(-1), | 168 target_bitrate_bps(-1), |
| 107 max_bitrate_bps(-1), | 169 max_bitrate_bps(-1), |
| 108 max_qp(-1) {} | 170 max_qp(-1) {} |
| 109 | 171 |
| 110 VideoStream::~VideoStream() = default; | 172 VideoStream::~VideoStream() = default; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings( | 274 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings( |
| 213 const VideoCodecVP9& specifics) | 275 const VideoCodecVP9& specifics) |
| 214 : specifics_(specifics) {} | 276 : specifics_(specifics) {} |
| 215 | 277 |
| 216 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9( | 278 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9( |
| 217 VideoCodecVP9* vp9_settings) const { | 279 VideoCodecVP9* vp9_settings) const { |
| 218 *vp9_settings = specifics_; | 280 *vp9_settings = specifics_; |
| 219 } | 281 } |
| 220 | 282 |
| 221 } // namespace webrtc | 283 } // namespace webrtc |
| OLD | NEW |