| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 RTC_DCHECK_EQ(codecType, kVideoCodecVP8); | 94 RTC_DCHECK_EQ(codecType, kVideoCodecVP8); |
| 95 return &codec_specific_.VP8; | 95 return &codec_specific_.VP8; |
| 96 } | 96 } |
| 97 | 97 |
| 98 const VideoCodecVP8& VideoCodec::VP8() const { | 98 const VideoCodecVP8& VideoCodec::VP8() const { |
| 99 RTC_DCHECK_EQ(codecType, kVideoCodecVP8); | 99 RTC_DCHECK_EQ(codecType, kVideoCodecVP8); |
| 100 return codec_specific_.VP8; | 100 return codec_specific_.VP8; |
| 101 } | 101 } |
| 102 | 102 |
| 103 VideoCodecVP9* VideoCodec::VP9() { | 103 VideoCodecVP9* VideoCodec::VP9() { |
| 104 RTC_DCHECK_EQ(codecType, kVideoCodecVP9); | 104 // RTC_DCHECK_EQ(codecType, kVideoCodecVP9); |
| 105 return &codec_specific_.VP9; | 105 return &codec_specific_.VP9; |
| 106 } | 106 } |
| 107 | 107 |
| 108 const VideoCodecVP9& VideoCodec::VP9() const { | 108 const VideoCodecVP9& VideoCodec::VP9() const { |
| 109 RTC_DCHECK_EQ(codecType, kVideoCodecVP9); | 109 // RTC_DCHECK_EQ(codecType, kVideoCodecVP9); |
| 110 return codec_specific_.VP9; | 110 return codec_specific_.VP9; |
| 111 } | 111 } |
| 112 | 112 |
| 113 VideoCodecH264* VideoCodec::H264() { | 113 VideoCodecH264* VideoCodec::H264() { |
| 114 RTC_DCHECK_EQ(codecType, kVideoCodecH264); | 114 RTC_DCHECK_EQ(codecType, kVideoCodecH264); |
| 115 return &codec_specific_.H264; | 115 return &codec_specific_.H264; |
| 116 } | 116 } |
| 117 | 117 |
| 118 const VideoCodecH264& VideoCodec::H264() const { | 118 const VideoCodecH264& VideoCodec::H264() const { |
| 119 RTC_DCHECK_EQ(codecType, kVideoCodecH264); | 119 RTC_DCHECK_EQ(codecType, kVideoCodecH264); |
| 120 return codec_specific_.H264; | 120 return codec_specific_.H264; |
| 121 } | 121 } |
| 122 | 122 |
| 123 static const char* kPayloadNameVp8 = "VP8"; | 123 static const char* kPayloadNameVp8 = "VP8"; |
| 124 static const char* kPayloadNameVp9 = "VP9"; | 124 static const char* kPayloadNameVp9 = "VP9"; |
| 125 static const char* kPayloadNameH264 = "H264"; | 125 static const char* kPayloadNameH264 = "H264"; |
| 126 static const char* kPayloadNameI420 = "I420"; | 126 static const char* kPayloadNameI420 = "I420"; |
| 127 static const char* kPayloadNameRED = "RED"; | 127 static const char* kPayloadNameRED = "RED"; |
| 128 static const char* kPayloadNameULPFEC = "ULPFEC"; | 128 static const char* kPayloadNameULPFEC = "ULPFEC"; |
| 129 static const char* kPayloadNameGeneric = "Generic"; | 129 static const char* kPayloadNameGeneric = "Generic"; |
| 130 static const char* kPayloadNameStereo = "stereo"; |
| 130 | 131 |
| 131 static bool CodecNamesEq(const char* name1, const char* name2) { | 132 static bool CodecNamesEq(const char* name1, const char* name2) { |
| 132 return _stricmp(name1, name2) == 0; | 133 return _stricmp(name1, name2) == 0; |
| 133 } | 134 } |
| 134 | 135 |
| 135 rtc::Optional<const char*> CodecTypeToPayloadName(VideoCodecType type) { | 136 rtc::Optional<const char*> CodecTypeToPayloadName(VideoCodecType type) { |
| 136 switch (type) { | 137 switch (type) { |
| 137 case kVideoCodecVP8: | 138 case kVideoCodecVP8: |
| 138 return rtc::Optional<const char*>(kPayloadNameVp8); | 139 return rtc::Optional<const char*>(kPayloadNameVp8); |
| 139 case kVideoCodecVP9: | 140 case kVideoCodecVP9: |
| 140 return rtc::Optional<const char*>(kPayloadNameVp9); | 141 return rtc::Optional<const char*>(kPayloadNameVp9); |
| 141 case kVideoCodecH264: | 142 case kVideoCodecH264: |
| 142 return rtc::Optional<const char*>(kPayloadNameH264); | 143 return rtc::Optional<const char*>(kPayloadNameH264); |
| 143 case kVideoCodecI420: | 144 case kVideoCodecI420: |
| 144 return rtc::Optional<const char*>(kPayloadNameI420); | 145 return rtc::Optional<const char*>(kPayloadNameI420); |
| 145 case kVideoCodecRED: | 146 case kVideoCodecRED: |
| 146 return rtc::Optional<const char*>(kPayloadNameRED); | 147 return rtc::Optional<const char*>(kPayloadNameRED); |
| 147 case kVideoCodecULPFEC: | 148 case kVideoCodecULPFEC: |
| 148 return rtc::Optional<const char*>(kPayloadNameULPFEC); | 149 return rtc::Optional<const char*>(kPayloadNameULPFEC); |
| 149 case kVideoCodecGeneric: | 150 case kVideoCodecGeneric: |
| 150 return rtc::Optional<const char*>(kPayloadNameGeneric); | 151 return rtc::Optional<const char*>(kPayloadNameGeneric); |
| 152 case kVideoCodecStereo: |
| 153 return rtc::Optional<const char*>(kPayloadNameStereo); |
| 151 default: | 154 default: |
| 152 return rtc::Optional<const char*>(); | 155 return rtc::Optional<const char*>(); |
| 153 } | 156 } |
| 154 } | 157 } |
| 155 | 158 |
| 156 rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name) { | 159 rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name) { |
| 157 if (CodecNamesEq(name.c_str(), kPayloadNameVp8)) | 160 if (CodecNamesEq(name.c_str(), kPayloadNameVp8)) |
| 158 return rtc::Optional<VideoCodecType>(kVideoCodecVP8); | 161 return rtc::Optional<VideoCodecType>(kVideoCodecVP8); |
| 159 if (CodecNamesEq(name.c_str(), kPayloadNameVp9)) | 162 if (CodecNamesEq(name.c_str(), kPayloadNameVp9)) |
| 160 return rtc::Optional<VideoCodecType>(kVideoCodecVP9); | 163 return rtc::Optional<VideoCodecType>(kVideoCodecVP9); |
| 161 if (CodecNamesEq(name.c_str(), kPayloadNameH264)) | 164 if (CodecNamesEq(name.c_str(), kPayloadNameH264)) |
| 162 return rtc::Optional<VideoCodecType>(kVideoCodecH264); | 165 return rtc::Optional<VideoCodecType>(kVideoCodecH264); |
| 163 if (CodecNamesEq(name.c_str(), kPayloadNameI420)) | 166 if (CodecNamesEq(name.c_str(), kPayloadNameI420)) |
| 164 return rtc::Optional<VideoCodecType>(kVideoCodecI420); | 167 return rtc::Optional<VideoCodecType>(kVideoCodecI420); |
| 165 if (CodecNamesEq(name.c_str(), kPayloadNameRED)) | 168 if (CodecNamesEq(name.c_str(), kPayloadNameRED)) |
| 166 return rtc::Optional<VideoCodecType>(kVideoCodecRED); | 169 return rtc::Optional<VideoCodecType>(kVideoCodecRED); |
| 167 if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC)) | 170 if (CodecNamesEq(name.c_str(), kPayloadNameULPFEC)) |
| 168 return rtc::Optional<VideoCodecType>(kVideoCodecULPFEC); | 171 return rtc::Optional<VideoCodecType>(kVideoCodecULPFEC); |
| 169 if (CodecNamesEq(name.c_str(), kPayloadNameGeneric)) | 172 if (CodecNamesEq(name.c_str(), kPayloadNameGeneric)) |
| 170 return rtc::Optional<VideoCodecType>(kVideoCodecGeneric); | 173 return rtc::Optional<VideoCodecType>(kVideoCodecGeneric); |
| 174 if (CodecNamesEq(name.c_str(), kPayloadNameStereo)) |
| 175 return rtc::Optional<VideoCodecType>(kVideoCodecStereo); |
| 171 return rtc::Optional<VideoCodecType>(); | 176 return rtc::Optional<VideoCodecType>(); |
| 172 } | 177 } |
| 173 | 178 |
| 174 const uint32_t BitrateAllocation::kMaxBitrateBps = | 179 const uint32_t BitrateAllocation::kMaxBitrateBps = |
| 175 std::numeric_limits<uint32_t>::max(); | 180 std::numeric_limits<uint32_t>::max(); |
| 176 | 181 |
| 177 BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{} {} | 182 BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{} {} |
| 178 | 183 |
| 179 bool BitrateAllocation::SetBitrate(size_t spatial_index, | 184 bool BitrateAllocation::SetBitrate(size_t spatial_index, |
| 180 size_t temporal_index, | 185 size_t temporal_index, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 oss << " ]"; | 257 oss << " ]"; |
| 253 return oss.str(); | 258 return oss.str(); |
| 254 } | 259 } |
| 255 | 260 |
| 256 std::ostream& BitrateAllocation::operator<<(std::ostream& os) const { | 261 std::ostream& BitrateAllocation::operator<<(std::ostream& os) const { |
| 257 os << ToString(); | 262 os << ToString(); |
| 258 return os; | 263 return os; |
| 259 } | 264 } |
| 260 | 265 |
| 261 } // namespace webrtc | 266 } // namespace webrtc |
| OLD | NEW |