| 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 24 matching lines...) Expand all Loading... |
| 35 external_decoder_(nullptr), | 35 external_decoder_(nullptr), |
| 36 cng_decoder_(CngDecoder::Create(audio_format)), | 36 cng_decoder_(CngDecoder::Create(audio_format)), |
| 37 subtype_(SubtypeFromFormat(audio_format)) {} | 37 subtype_(SubtypeFromFormat(audio_format)) {} |
| 38 | 38 |
| 39 DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format, | 39 DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format, |
| 40 AudioDecoderFactory* factory) | 40 AudioDecoderFactory* factory) |
| 41 : DecoderInfo(audio_format, factory, audio_format.name) {} | 41 : DecoderInfo(audio_format, factory, audio_format.name) {} |
| 42 | 42 |
| 43 DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct, | 43 DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct, |
| 44 AudioDecoderFactory* factory) | 44 AudioDecoderFactory* factory) |
| 45 : DecoderInfo(*acm2::RentACodec::NetEqDecoderToSdpAudioFormat(ct), | 45 : DecoderInfo(*NetEqDecoderToSdpAudioFormat(ct), factory) {} |
| 46 factory) {} | |
| 47 | 46 |
| 48 DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format, | 47 DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format, |
| 49 AudioDecoder* ext_dec, | 48 AudioDecoder* ext_dec, |
| 50 const std::string& codec_name) | 49 const std::string& codec_name) |
| 51 : name_(codec_name), | 50 : name_(codec_name), |
| 52 audio_format_(audio_format), | 51 audio_format_(audio_format), |
| 53 factory_(nullptr), | 52 factory_(nullptr), |
| 54 external_decoder_(ext_dec), | 53 external_decoder_(ext_dec), |
| 55 subtype_(Subtype::kNormal) { | 54 subtype_(Subtype::kNormal) { |
| 56 RTC_CHECK(ext_dec); | 55 RTC_CHECK(ext_dec); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 NetEqDecoder codec_type, | 127 NetEqDecoder codec_type, |
| 129 const std::string& name) { | 128 const std::string& name) { |
| 130 if (rtp_payload_type > 0x7F) { | 129 if (rtp_payload_type > 0x7F) { |
| 131 return kInvalidRtpPayloadType; | 130 return kInvalidRtpPayloadType; |
| 132 } | 131 } |
| 133 // kCodecArbitrary is only supported through InsertExternal. | 132 // kCodecArbitrary is only supported through InsertExternal. |
| 134 if (codec_type == NetEqDecoder::kDecoderArbitrary || | 133 if (codec_type == NetEqDecoder::kDecoderArbitrary || |
| 135 !CodecSupported(codec_type)) { | 134 !CodecSupported(codec_type)) { |
| 136 return kCodecNotSupported; | 135 return kCodecNotSupported; |
| 137 } | 136 } |
| 138 const auto opt_format = | 137 const auto opt_format = NetEqDecoderToSdpAudioFormat(codec_type); |
| 139 acm2::RentACodec::NetEqDecoderToSdpAudioFormat(codec_type); | |
| 140 if (!opt_format) { | 138 if (!opt_format) { |
| 141 return kCodecNotSupported; | 139 return kCodecNotSupported; |
| 142 } | 140 } |
| 143 DecoderInfo info(*opt_format, decoder_factory_, name); | 141 DecoderInfo info(*opt_format, decoder_factory_, name); |
| 144 auto ret = | 142 auto ret = |
| 145 decoders_.insert(std::make_pair(rtp_payload_type, std::move(info))); | 143 decoders_.insert(std::make_pair(rtp_payload_type, std::move(info))); |
| 146 if (ret.second == false) { | 144 if (ret.second == false) { |
| 147 // Database already contains a decoder with type |rtp_payload_type|. | 145 // Database already contains a decoder with type |rtp_payload_type|. |
| 148 return kDecoderExists; | 146 return kDecoderExists; |
| 149 } | 147 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 168 NetEqDecoder codec_type, | 166 NetEqDecoder codec_type, |
| 169 const std::string& codec_name, | 167 const std::string& codec_name, |
| 170 AudioDecoder* decoder) { | 168 AudioDecoder* decoder) { |
| 171 if (rtp_payload_type > 0x7F) { | 169 if (rtp_payload_type > 0x7F) { |
| 172 return kInvalidRtpPayloadType; | 170 return kInvalidRtpPayloadType; |
| 173 } | 171 } |
| 174 if (!decoder) { | 172 if (!decoder) { |
| 175 return kInvalidPointer; | 173 return kInvalidPointer; |
| 176 } | 174 } |
| 177 | 175 |
| 178 const auto opt_db_format = | 176 const auto opt_db_format = NetEqDecoderToSdpAudioFormat(codec_type); |
| 179 acm2::RentACodec::NetEqDecoderToSdpAudioFormat(codec_type); | |
| 180 const SdpAudioFormat format = opt_db_format.value_or({"arbitrary", 0, 0}); | 177 const SdpAudioFormat format = opt_db_format.value_or({"arbitrary", 0, 0}); |
| 181 | 178 |
| 182 std::pair<DecoderMap::iterator, bool> ret; | 179 std::pair<DecoderMap::iterator, bool> ret; |
| 183 DecoderInfo info(format, decoder, codec_name); | 180 DecoderInfo info(format, decoder, codec_name); |
| 184 ret = decoders_.insert(std::make_pair(rtp_payload_type, std::move(info))); | 181 ret = decoders_.insert(std::make_pair(rtp_payload_type, std::move(info))); |
| 185 if (ret.second == false) { | 182 if (ret.second == false) { |
| 186 // Database already contains a decoder with type |rtp_payload_type|. | 183 // Database already contains a decoder with type |rtp_payload_type|. |
| 187 return kDecoderExists; | 184 return kDecoderExists; |
| 188 } | 185 } |
| 189 return kOK; | 186 return kOK; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // Payload type is not found. | 314 // Payload type is not found. |
| 318 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " | 315 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " |
| 319 << static_cast<int>(it->payload_type); | 316 << static_cast<int>(it->payload_type); |
| 320 return kDecoderNotFound; | 317 return kDecoderNotFound; |
| 321 } | 318 } |
| 322 } | 319 } |
| 323 return kOK; | 320 return kOK; |
| 324 } | 321 } |
| 325 | 322 |
| 326 } // namespace webrtc | 323 } // namespace webrtc |
| OLD | NEW |