kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 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 | |
Mirko Bonadei | 7120742 | 2017-09-15 11:58:09 | [diff] [blame] | 11 | #include "common_types.h" // NOLINT(build/include) |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 | [diff] [blame] | 12 | |
| 13 | #include <string.h> |
eladalon | d0244c2 | 2017-06-08 11:19:13 | [diff] [blame] | 14 | #include <algorithm> |
danilchap | ef8d773 | 2017-04-19 09:59:48 | [diff] [blame] | 15 | #include <limits> |
| 16 | #include <type_traits> |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 | [diff] [blame] | 17 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 18 | #include "rtc_base/checks.h" |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 19 | #include "rtc_base/strings/string_builder.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 20 | #include "rtc_base/stringutils.h" |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 21 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | |
Niels Möller | def1ef5 | 2018-03-19 12:48:44 | [diff] [blame] | 24 | bool VideoCodecVP8::operator==(const VideoCodecVP8& other) const { |
| 25 | // Doesn't compare the tl_factory pointers, which are constructed |
| 26 | // based on other members. |
| 27 | return (complexity == other.complexity && |
| 28 | resilience == other.resilience && |
| 29 | numberOfTemporalLayers == other.numberOfTemporalLayers && |
| 30 | denoisingOn == other.denoisingOn && |
| 31 | automaticResizeOn == other.automaticResizeOn && |
| 32 | frameDroppingOn == other.frameDroppingOn && |
| 33 | keyFrameInterval == other.keyFrameInterval); |
| 34 | } |
| 35 | |
| 36 | bool VideoCodecVP9::operator==(const VideoCodecVP9& other) const { |
| 37 | return (complexity == other.complexity && |
| 38 | resilienceOn == other.resilienceOn && |
| 39 | numberOfTemporalLayers == other.numberOfTemporalLayers && |
| 40 | denoisingOn == other.denoisingOn && |
| 41 | frameDroppingOn == other.frameDroppingOn && |
| 42 | keyFrameInterval == other.keyFrameInterval && |
| 43 | adaptiveQpMode == other.adaptiveQpMode && |
| 44 | automaticResizeOn == other.automaticResizeOn && |
| 45 | numberOfSpatialLayers == other.numberOfSpatialLayers && |
| 46 | flexibleMode == other.flexibleMode); |
| 47 | } |
| 48 | |
| 49 | bool VideoCodecH264::operator==(const VideoCodecH264& other) const { |
| 50 | return (frameDroppingOn == other.frameDroppingOn && |
| 51 | keyFrameInterval == other.keyFrameInterval && |
| 52 | spsLen == other.spsLen && |
| 53 | ppsLen == other.ppsLen && |
| 54 | profile == other.profile && |
| 55 | (spsLen == 0 || memcmp(spsData, other.spsData, spsLen) == 0) && |
| 56 | (ppsLen == 0 || memcmp(ppsData, other.ppsData, ppsLen) == 0)); |
| 57 | } |
| 58 | |
| 59 | bool SpatialLayer::operator==(const SpatialLayer& other) const { |
| 60 | return (width == other.width && |
| 61 | height == other.height && |
| 62 | numberOfTemporalLayers == other.numberOfTemporalLayers && |
| 63 | maxBitrate == other.maxBitrate && |
| 64 | targetBitrate == other.targetBitrate && |
| 65 | minBitrate == other.minBitrate && |
| 66 | qpMax == other.qpMax && |
| 67 | active == other.active); |
| 68 | } |
| 69 | |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 70 | VideoCodec::VideoCodec() |
| 71 | : codecType(kVideoCodecUnknown), |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 72 | plType(0), |
| 73 | width(0), |
| 74 | height(0), |
| 75 | startBitrate(0), |
| 76 | maxBitrate(0), |
| 77 | minBitrate(0), |
| 78 | targetBitrate(0), |
| 79 | maxFramerate(0), |
Seth Hampson | f6464c9 | 2018-01-17 21:55:14 | [diff] [blame] | 80 | active(true), |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 81 | qpMax(0), |
| 82 | numberOfSimulcastStreams(0), |
| 83 | simulcastStream(), |
| 84 | spatialLayers(), |
| 85 | mode(kRealtimeVideo), |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 86 | expect_encode_from_texture(false), |
ilnik | 04f4d12 | 2017-06-19 14:18:55 | [diff] [blame] | 87 | timing_frame_thresholds({0, 0}), |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 88 | codec_specific_() {} |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 89 | |
| 90 | VideoCodecVP8* VideoCodec::VP8() { |
| 91 | RTC_DCHECK_EQ(codecType, kVideoCodecVP8); |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 92 | return &codec_specific_.VP8; |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | const VideoCodecVP8& VideoCodec::VP8() const { |
| 96 | RTC_DCHECK_EQ(codecType, kVideoCodecVP8); |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 97 | return codec_specific_.VP8; |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | VideoCodecVP9* VideoCodec::VP9() { |
| 101 | RTC_DCHECK_EQ(codecType, kVideoCodecVP9); |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 102 | return &codec_specific_.VP9; |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | const VideoCodecVP9& VideoCodec::VP9() const { |
| 106 | RTC_DCHECK_EQ(codecType, kVideoCodecVP9); |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 107 | return codec_specific_.VP9; |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | VideoCodecH264* VideoCodec::H264() { |
| 111 | RTC_DCHECK_EQ(codecType, kVideoCodecH264); |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 112 | return &codec_specific_.H264; |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | const VideoCodecH264& VideoCodec::H264() const { |
| 116 | RTC_DCHECK_EQ(codecType, kVideoCodecH264); |
hta | 527d347 | 2016-11-17 07:23:04 | [diff] [blame] | 117 | return codec_specific_.H264; |
hta | 257dc39 | 2016-10-25 16:05:06 | [diff] [blame] | 118 | } |
| 119 | |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 120 | static const char* kPayloadNameVp8 = "VP8"; |
| 121 | static const char* kPayloadNameVp9 = "VP9"; |
| 122 | static const char* kPayloadNameH264 = "H264"; |
| 123 | static const char* kPayloadNameI420 = "I420"; |
| 124 | static const char* kPayloadNameRED = "RED"; |
| 125 | static const char* kPayloadNameULPFEC = "ULPFEC"; |
Danil Chapovalov | 3c70697 | 2018-01-30 10:11:08 | [diff] [blame] | 126 | static const char* kPayloadNameFlexfec = "flexfec-03"; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 127 | static const char* kPayloadNameGeneric = "Generic"; |
Emircan Uysaler | d7ae3c3 | 2018-01-25 21:01:09 | [diff] [blame] | 128 | static const char* kPayloadNameMultiplex = "Multiplex"; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 129 | |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 130 | static bool CodecNamesEq(const char* name1, const char* name2) { |
| 131 | return _stricmp(name1, name2) == 0; |
| 132 | } |
| 133 | |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 134 | const char* CodecTypeToPayloadString(VideoCodecType type) { |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 135 | switch (type) { |
| 136 | case kVideoCodecVP8: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 137 | return kPayloadNameVp8; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 138 | case kVideoCodecVP9: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 139 | return kPayloadNameVp9; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 140 | case kVideoCodecH264: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 141 | return kPayloadNameH264; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 142 | case kVideoCodecI420: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 143 | return kPayloadNameI420; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 144 | case kVideoCodecRED: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 145 | return kPayloadNameRED; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 146 | case kVideoCodecULPFEC: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 147 | return kPayloadNameULPFEC; |
Danil Chapovalov | 3c70697 | 2018-01-30 10:11:08 | [diff] [blame] | 148 | case kVideoCodecFlexfec: |
| 149 | return kPayloadNameFlexfec; |
Emircan Uysaler | 0a37547 | 2017-12-11 06:51:02 | [diff] [blame] | 150 | // Other codecs default to generic. |
Emircan Uysaler | d7ae3c3 | 2018-01-25 21:01:09 | [diff] [blame] | 151 | case kVideoCodecMultiplex: |
Emircan Uysaler | 0a37547 | 2017-12-11 06:51:02 | [diff] [blame] | 152 | case kVideoCodecGeneric: |
| 153 | case kVideoCodecUnknown: |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 154 | return kPayloadNameGeneric; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 155 | } |
Emircan Uysaler | 0a37547 | 2017-12-11 06:51:02 | [diff] [blame] | 156 | return kPayloadNameGeneric; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 157 | } |
| 158 | |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 159 | VideoCodecType PayloadStringToCodecType(const std::string& name) { |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 160 | if (CodecNamesEq(name.c_str(), kPayloadNameVp8)) |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 161 | return kVideoCodecVP8; |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 162 | if (CodecNamesEq(name.c_str(), kPayloadNameVp9)) |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 163 | return kVideoCodecVP9; |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 164 | if (CodecNamesEq(name.c_str(), kPayloadNameH264)) |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 165 | return kVideoCodecH264; |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 166 | if (CodecNamesEq(name.c_str(), kPayloadNameI420)) |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 167 | return kVideoCodecI420; |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 168 | if (CodecNamesEq(name.c_str(), kPayloadNameRED)) |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 169 | return kVideoCodecRED; |
magjed | 10165ab | 2016-11-22 18:16:57 | [diff] [blame] | 170 | if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC)) |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 171 | return kVideoCodecULPFEC; |
Danil Chapovalov | 3c70697 | 2018-01-30 10:11:08 | [diff] [blame] | 172 | if (CodecNamesEq(name.c_str(), kPayloadNameFlexfec)) |
| 173 | return kVideoCodecFlexfec; |
Emircan Uysaler | d7ae3c3 | 2018-01-25 21:01:09 | [diff] [blame] | 174 | if (CodecNamesEq(name.c_str(), kPayloadNameMultiplex)) |
| 175 | return kVideoCodecMultiplex; |
kthelgason | 1cdddc9 | 2017-08-24 10:52:48 | [diff] [blame] | 176 | return kVideoCodecGeneric; |
| 177 | } |
| 178 | |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 179 | const uint32_t BitrateAllocation::kMaxBitrateBps = |
| 180 | std::numeric_limits<uint32_t>::max(); |
| 181 | |
erikvarga@webrtc.org | 01f2ec3 | 2017-11-15 13:58:23 | [diff] [blame] | 182 | BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{}, has_bitrate_{} {} |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 183 | |
| 184 | bool BitrateAllocation::SetBitrate(size_t spatial_index, |
| 185 | size_t temporal_index, |
| 186 | uint32_t bitrate_bps) { |
sprang | 6d314c7 | 2016-12-06 14:08:53 | [diff] [blame] | 187 | RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
| 188 | RTC_CHECK_LT(temporal_index, kMaxTemporalStreams); |
| 189 | RTC_CHECK_LE(bitrates_[spatial_index][temporal_index], sum_); |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 190 | uint64_t new_bitrate_sum_bps = sum_; |
| 191 | new_bitrate_sum_bps -= bitrates_[spatial_index][temporal_index]; |
| 192 | new_bitrate_sum_bps += bitrate_bps; |
| 193 | if (new_bitrate_sum_bps > kMaxBitrateBps) |
| 194 | return false; |
| 195 | |
| 196 | bitrates_[spatial_index][temporal_index] = bitrate_bps; |
erikvarga@webrtc.org | 01f2ec3 | 2017-11-15 13:58:23 | [diff] [blame] | 197 | has_bitrate_[spatial_index][temporal_index] = true; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 198 | sum_ = static_cast<uint32_t>(new_bitrate_sum_bps); |
| 199 | return true; |
| 200 | } |
| 201 | |
erikvarga@webrtc.org | 01f2ec3 | 2017-11-15 13:58:23 | [diff] [blame] | 202 | bool BitrateAllocation::HasBitrate(size_t spatial_index, |
| 203 | size_t temporal_index) const { |
| 204 | RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
| 205 | RTC_CHECK_LT(temporal_index, kMaxTemporalStreams); |
| 206 | return has_bitrate_[spatial_index][temporal_index]; |
| 207 | } |
| 208 | |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 209 | uint32_t BitrateAllocation::GetBitrate(size_t spatial_index, |
| 210 | size_t temporal_index) const { |
sprang | 6d314c7 | 2016-12-06 14:08:53 | [diff] [blame] | 211 | RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
| 212 | RTC_CHECK_LT(temporal_index, kMaxTemporalStreams); |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 213 | return bitrates_[spatial_index][temporal_index]; |
| 214 | } |
| 215 | |
erikvarga@webrtc.org | 01f2ec3 | 2017-11-15 13:58:23 | [diff] [blame] | 216 | // Whether the specific spatial layers has the bitrate set in any of its |
| 217 | // temporal layers. |
| 218 | bool BitrateAllocation::IsSpatialLayerUsed(size_t spatial_index) const { |
| 219 | RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
| 220 | for (int i = 0; i < kMaxTemporalStreams; ++i) { |
| 221 | if (has_bitrate_[spatial_index][i]) |
| 222 | return true; |
| 223 | } |
| 224 | return false; |
| 225 | } |
| 226 | |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 227 | // Get the sum of all the temporal layer for a specific spatial layer. |
| 228 | uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const { |
sprang | 6d314c7 | 2016-12-06 14:08:53 | [diff] [blame] | 229 | RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 230 | uint32_t sum = 0; |
| 231 | for (int i = 0; i < kMaxTemporalStreams; ++i) |
| 232 | sum += bitrates_[spatial_index][i]; |
| 233 | return sum; |
| 234 | } |
| 235 | |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 236 | std::vector<uint32_t> BitrateAllocation::GetTemporalLayerAllocation( |
| 237 | size_t spatial_index) const { |
| 238 | RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
| 239 | std::vector<uint32_t> temporal_rates; |
| 240 | |
| 241 | // Find the highest temporal layer with a defined bitrate in order to |
| 242 | // determine the size of the temporal layer allocation. |
| 243 | for (size_t i = kMaxTemporalStreams; i > 0; --i) { |
| 244 | if (has_bitrate_[spatial_index][i - 1]) { |
| 245 | temporal_rates.resize(i); |
| 246 | break; |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | for (size_t i = 0; i < temporal_rates.size(); ++i) { |
| 251 | temporal_rates[i] = bitrates_[spatial_index][i]; |
| 252 | } |
| 253 | |
| 254 | return temporal_rates; |
| 255 | } |
| 256 | |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 257 | std::string BitrateAllocation::ToString() const { |
| 258 | if (sum_ == 0) |
| 259 | return "BitrateAllocation [ [] ]"; |
| 260 | |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 261 | // Max string length in practice is 260, but let's have some overhead and |
| 262 | // round up to nearest power of two. |
| 263 | char string_buf[512]; |
| 264 | rtc::SimpleStringBuilder ssb(string_buf); |
| 265 | |
| 266 | ssb << "BitrateAllocation ["; |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 267 | uint32_t spatial_cumulator = 0; |
| 268 | for (int si = 0; si < kMaxSpatialLayers; ++si) { |
| 269 | RTC_DCHECK_LE(spatial_cumulator, sum_); |
| 270 | if (spatial_cumulator == sum_) |
| 271 | break; |
| 272 | |
| 273 | const uint32_t layer_sum = GetSpatialLayerSum(si); |
| 274 | if (layer_sum == sum_) { |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 275 | ssb << " ["; |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 276 | } else { |
| 277 | if (si > 0) |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 278 | ssb << ","; |
| 279 | ssb << '\n' << " ["; |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 280 | } |
| 281 | spatial_cumulator += layer_sum; |
| 282 | |
| 283 | uint32_t temporal_cumulator = 0; |
| 284 | for (int ti = 0; ti < kMaxTemporalStreams; ++ti) { |
| 285 | RTC_DCHECK_LE(temporal_cumulator, layer_sum); |
| 286 | if (temporal_cumulator == layer_sum) |
| 287 | break; |
| 288 | |
| 289 | if (ti > 0) |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 290 | ssb << ", "; |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 291 | |
| 292 | uint32_t bitrate = bitrates_[si][ti]; |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 293 | ssb << bitrate; |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 294 | temporal_cumulator += bitrate; |
| 295 | } |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 296 | ssb << "]"; |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | RTC_DCHECK_EQ(spatial_cumulator, sum_); |
Erik Språng | bb60a3a | 2018-03-19 17:25:10 | [diff] [blame] | 300 | ssb << " ]"; |
| 301 | return ssb.str(); |
sprang | d0fc37a | 2017-06-22 12:40:25 | [diff] [blame] | 302 | } |
| 303 | |
kwiberg@webrtc.org | ac2d27d | 2015-02-26 13:59:22 | [diff] [blame] | 304 | } // namespace webrtc |