henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [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 | |
henrik.lundin@webrtc.org | 9c55f0f | 2014-06-09 08:10:28 +0000 | [diff] [blame] | 11 | #include "webrtc/modules/audio_coding/neteq/decoder_database.h" |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 12 | |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 13 | #include <utility> // pair |
| 14 | |
henrik.lundin | 4cf61dd | 2015-12-09 06:20:58 -0800 | [diff] [blame] | 15 | #include "webrtc/base/checks.h" |
Henrik Lundin | d67a219 | 2015-08-03 12:54:37 +0200 | [diff] [blame] | 16 | #include "webrtc/base/logging.h" |
kwiberg@webrtc.org | e04a93b | 2014-12-09 10:12:53 +0000 | [diff] [blame] | 17 | #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
kwiberg | 5178ee8 | 2016-05-03 01:39:01 -0700 | [diff] [blame] | 21 | DecoderDatabase::DecoderDatabase( |
ossu | e725f7c | 2016-05-19 10:48:04 -0700 | [diff] [blame] | 22 | const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) |
kwiberg | 5178ee8 | 2016-05-03 01:39:01 -0700 | [diff] [blame] | 23 | : active_decoder_type_(-1), |
| 24 | active_cng_decoder_type_(-1), |
ossu | e725f7c | 2016-05-19 10:48:04 -0700 | [diff] [blame] | 25 | decoder_factory_(decoder_factory) {} |
pbos@webrtc.org | 2d1a55c | 2013-07-31 15:54:00 +0000 | [diff] [blame] | 26 | |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 27 | DecoderDatabase::~DecoderDatabase() = default; |
pbos@webrtc.org | 2d1a55c | 2013-07-31 15:54:00 +0000 | [diff] [blame] | 28 | |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 29 | DecoderDatabase::DecoderInfo::DecoderInfo( |
| 30 | NetEqDecoder ct, |
| 31 | const std::string& nm, |
| 32 | AudioDecoderFactory* factory) |
kwiberg | c0f2dcf | 2016-05-31 06:28:03 -0700 | [diff] [blame] | 33 | : codec_type(ct), |
| 34 | name(nm), |
| 35 | audio_format_(acm2::RentACodec::NetEqDecoderToSdpAudioFormat(ct)), |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 36 | factory_(factory), |
kwiberg | 342f740 | 2016-06-16 03:18:00 -0700 | [diff] [blame] | 37 | external_decoder_(nullptr), |
kwiberg | c0f2dcf | 2016-05-31 06:28:03 -0700 | [diff] [blame] | 38 | cng_decoder_(CngDecoder::Create(ct)) {} |
| 39 | |
| 40 | DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct, |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 41 | const std::string& nm, |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 42 | AudioDecoder* ext_dec) |
| 43 | : codec_type(ct), |
| 44 | name(nm), |
kwiberg | c0f2dcf | 2016-05-31 06:28:03 -0700 | [diff] [blame] | 45 | audio_format_(acm2::RentACodec::NetEqDecoderToSdpAudioFormat(ct)), |
kwiberg | 342f740 | 2016-06-16 03:18:00 -0700 | [diff] [blame] | 46 | external_decoder_(ext_dec) { |
kwiberg | c0f2dcf | 2016-05-31 06:28:03 -0700 | [diff] [blame] | 47 | RTC_CHECK(ext_dec); |
| 48 | } |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 49 | |
| 50 | DecoderDatabase::DecoderInfo::DecoderInfo(DecoderInfo&&) = default; |
| 51 | DecoderDatabase::DecoderInfo::~DecoderInfo() = default; |
| 52 | |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 53 | AudioDecoder* DecoderDatabase::DecoderInfo::GetDecoder() const { |
kwiberg | 342f740 | 2016-06-16 03:18:00 -0700 | [diff] [blame] | 54 | if (external_decoder_) { |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 55 | RTC_DCHECK(!decoder_); |
kwiberg | 342f740 | 2016-06-16 03:18:00 -0700 | [diff] [blame] | 56 | RTC_DCHECK(!cng_decoder_); |
| 57 | return external_decoder_; |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 58 | } |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 59 | if (IsRed() || IsComfortNoise() || IsDtmf()) |
| 60 | return nullptr; |
kwiberg | 5178ee8 | 2016-05-03 01:39:01 -0700 | [diff] [blame] | 61 | RTC_DCHECK(audio_format_); |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 62 | if (!decoder_) { |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 63 | RTC_DCHECK(factory_); |
| 64 | decoder_ = factory_->MakeAudioDecoder(*audio_format_); |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 65 | } |
kwiberg | 5178ee8 | 2016-05-03 01:39:01 -0700 | [diff] [blame] | 66 | RTC_DCHECK(decoder_) << "Failed to create: " << *audio_format_; |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 67 | return decoder_.get(); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 68 | } |
| 69 | |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 70 | |
| 71 | bool DecoderDatabase::DecoderInfo::IsComfortNoise() const { |
| 72 | return codec_type == NetEqDecoder::kDecoderCNGnb |
| 73 | || codec_type == NetEqDecoder::kDecoderCNGwb |
| 74 | || codec_type == NetEqDecoder::kDecoderCNGswb32kHz |
| 75 | || codec_type == NetEqDecoder::kDecoderCNGswb48kHz; |
| 76 | } |
| 77 | |
| 78 | bool DecoderDatabase::DecoderInfo::IsDtmf() const { |
| 79 | return codec_type == NetEqDecoder::kDecoderAVT; |
| 80 | } |
| 81 | |
| 82 | bool DecoderDatabase::DecoderInfo::IsRed() const { |
| 83 | return codec_type == NetEqDecoder::kDecoderRED; |
| 84 | } |
| 85 | |
kwiberg | c0f2dcf | 2016-05-31 06:28:03 -0700 | [diff] [blame] | 86 | rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder> |
| 87 | DecoderDatabase::DecoderInfo::CngDecoder::Create(NetEqDecoder ct) { |
| 88 | const auto cng = [](int sample_rate_hz) { |
| 89 | return rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder>( |
| 90 | {sample_rate_hz}); |
| 91 | }; |
| 92 | switch (ct) { |
| 93 | case NetEqDecoder::kDecoderCNGnb: |
| 94 | return cng(8000); |
| 95 | case NetEqDecoder::kDecoderCNGwb: |
| 96 | return cng(16000); |
| 97 | case NetEqDecoder::kDecoderCNGswb32kHz: |
| 98 | return cng(32000); |
| 99 | case NetEqDecoder::kDecoderCNGswb48kHz: |
| 100 | return cng(48000); |
| 101 | default: |
| 102 | return rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder>(); |
| 103 | } |
| 104 | } |
| 105 | |
pbos@webrtc.org | 2d1a55c | 2013-07-31 15:54:00 +0000 | [diff] [blame] | 106 | bool DecoderDatabase::Empty() const { return decoders_.empty(); } |
| 107 | |
turaj@webrtc.org | 362a55e | 2013-09-20 16:25:28 +0000 | [diff] [blame] | 108 | int DecoderDatabase::Size() const { return static_cast<int>(decoders_.size()); } |
pbos@webrtc.org | 2d1a55c | 2013-07-31 15:54:00 +0000 | [diff] [blame] | 109 | |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 110 | void DecoderDatabase::Reset() { |
| 111 | decoders_.clear(); |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 112 | active_decoder_type_ = -1; |
| 113 | active_cng_decoder_type_ = -1; |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | int DecoderDatabase::RegisterPayload(uint8_t rtp_payload_type, |
henrik.lundin | 4cf61dd | 2015-12-09 06:20:58 -0800 | [diff] [blame] | 117 | NetEqDecoder codec_type, |
| 118 | const std::string& name) { |
pkasting@chromium.org | d324546 | 2015-02-23 21:28:22 +0000 | [diff] [blame] | 119 | if (rtp_payload_type > 0x7F) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 120 | return kInvalidRtpPayloadType; |
| 121 | } |
kwiberg@webrtc.org | e04a93b | 2014-12-09 10:12:53 +0000 | [diff] [blame] | 122 | if (!CodecSupported(codec_type)) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 123 | return kCodecNotSupported; |
| 124 | } |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 125 | DecoderInfo info(codec_type, name, decoder_factory_.get()); |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 126 | auto ret = |
| 127 | decoders_.insert(std::make_pair(rtp_payload_type, std::move(info))); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 128 | if (ret.second == false) { |
| 129 | // Database already contains a decoder with type |rtp_payload_type|. |
| 130 | return kDecoderExists; |
| 131 | } |
| 132 | return kOK; |
| 133 | } |
| 134 | |
| 135 | int DecoderDatabase::InsertExternal(uint8_t rtp_payload_type, |
| 136 | NetEqDecoder codec_type, |
henrik.lundin | 4cf61dd | 2015-12-09 06:20:58 -0800 | [diff] [blame] | 137 | const std::string& codec_name, |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 138 | AudioDecoder* decoder) { |
| 139 | if (rtp_payload_type > 0x7F) { |
| 140 | return kInvalidRtpPayloadType; |
| 141 | } |
kwiberg@webrtc.org | e04a93b | 2014-12-09 10:12:53 +0000 | [diff] [blame] | 142 | if (!CodecSupported(codec_type)) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 143 | return kCodecNotSupported; |
| 144 | } |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 145 | if (!decoder) { |
| 146 | return kInvalidPointer; |
| 147 | } |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 148 | std::pair<DecoderMap::iterator, bool> ret; |
kwiberg | 342f740 | 2016-06-16 03:18:00 -0700 | [diff] [blame] | 149 | DecoderInfo info(codec_type, codec_name, decoder); |
kwiberg | 0fa0a97 | 2016-04-19 05:03:45 -0700 | [diff] [blame] | 150 | ret = decoders_.insert(std::make_pair(rtp_payload_type, std::move(info))); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 151 | if (ret.second == false) { |
| 152 | // Database already contains a decoder with type |rtp_payload_type|. |
| 153 | return kDecoderExists; |
| 154 | } |
| 155 | return kOK; |
| 156 | } |
| 157 | |
| 158 | int DecoderDatabase::Remove(uint8_t rtp_payload_type) { |
| 159 | if (decoders_.erase(rtp_payload_type) == 0) { |
| 160 | // No decoder with that |rtp_payload_type|. |
| 161 | return kDecoderNotFound; |
| 162 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 163 | if (active_decoder_type_ == rtp_payload_type) { |
| 164 | active_decoder_type_ = -1; // No active decoder. |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 165 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 166 | if (active_cng_decoder_type_ == rtp_payload_type) { |
| 167 | active_cng_decoder_type_ = -1; // No active CNG decoder. |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 168 | } |
| 169 | return kOK; |
| 170 | } |
| 171 | |
kwiberg | 6b19b56 | 2016-09-20 04:02:25 -0700 | [diff] [blame] | 172 | void DecoderDatabase::RemoveAll() { |
| 173 | decoders_.clear(); |
| 174 | active_decoder_type_ = -1; // No active decoder. |
| 175 | active_cng_decoder_type_ = -1; // No active CNG decoder. |
| 176 | } |
| 177 | |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 178 | const DecoderDatabase::DecoderInfo* DecoderDatabase::GetDecoderInfo( |
| 179 | uint8_t rtp_payload_type) const { |
| 180 | DecoderMap::const_iterator it = decoders_.find(rtp_payload_type); |
| 181 | if (it == decoders_.end()) { |
| 182 | // Decoder not found. |
| 183 | return NULL; |
| 184 | } |
| 185 | return &(*it).second; |
| 186 | } |
| 187 | |
| 188 | uint8_t DecoderDatabase::GetRtpPayloadType( |
| 189 | NetEqDecoder codec_type) const { |
| 190 | DecoderMap::const_iterator it; |
| 191 | for (it = decoders_.begin(); it != decoders_.end(); ++it) { |
| 192 | if ((*it).second.codec_type == codec_type) { |
| 193 | // Match found. |
| 194 | return (*it).first; |
| 195 | } |
| 196 | } |
| 197 | // No match. |
| 198 | return kRtpPayloadTypeError; |
| 199 | } |
| 200 | |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 201 | int DecoderDatabase::SetActiveDecoder(uint8_t rtp_payload_type, |
| 202 | bool* new_decoder) { |
| 203 | // Check that |rtp_payload_type| exists in the database. |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 204 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 205 | if (!info) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 206 | // Decoder not found. |
| 207 | return kDecoderNotFound; |
| 208 | } |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 209 | RTC_CHECK(!info->IsComfortNoise()); |
| 210 | RTC_DCHECK(new_decoder); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 211 | *new_decoder = false; |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 212 | if (active_decoder_type_ < 0) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 213 | // This is the first active decoder. |
| 214 | *new_decoder = true; |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 215 | } else if (active_decoder_type_ != rtp_payload_type) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 216 | // Moving from one active decoder to another. Delete the first one. |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 217 | const DecoderInfo *old_info = GetDecoderInfo(active_decoder_type_); |
| 218 | RTC_DCHECK(old_info); |
| 219 | old_info->DropDecoder(); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 220 | *new_decoder = true; |
| 221 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 222 | active_decoder_type_ = rtp_payload_type; |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 223 | return kOK; |
| 224 | } |
| 225 | |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 226 | AudioDecoder* DecoderDatabase::GetActiveDecoder() const { |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 227 | if (active_decoder_type_ < 0) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 228 | // No active decoder. |
| 229 | return NULL; |
| 230 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 231 | return GetDecoder(active_decoder_type_); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | int DecoderDatabase::SetActiveCngDecoder(uint8_t rtp_payload_type) { |
| 235 | // Check that |rtp_payload_type| exists in the database. |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 236 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 237 | if (!info) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 238 | // Decoder not found. |
| 239 | return kDecoderNotFound; |
| 240 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 241 | if (active_cng_decoder_type_ >= 0 && |
| 242 | active_cng_decoder_type_ != rtp_payload_type) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 243 | // Moving from one active CNG decoder to another. Delete the first one. |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 244 | RTC_DCHECK(active_cng_decoder_); |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 245 | active_cng_decoder_.reset(); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 246 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 247 | active_cng_decoder_type_ = rtp_payload_type; |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 248 | return kOK; |
| 249 | } |
| 250 | |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 251 | ComfortNoiseDecoder* DecoderDatabase::GetActiveCngDecoder() const { |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 252 | if (active_cng_decoder_type_ < 0) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 253 | // No active CNG decoder. |
| 254 | return NULL; |
| 255 | } |
ossu | 97ba30e | 2016-04-25 07:55:58 -0700 | [diff] [blame] | 256 | if (!active_cng_decoder_) { |
| 257 | active_cng_decoder_.reset(new ComfortNoiseDecoder); |
| 258 | } |
| 259 | return active_cng_decoder_.get(); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 260 | } |
| 261 | |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 262 | AudioDecoder* DecoderDatabase::GetDecoder(uint8_t rtp_payload_type) const { |
| 263 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 264 | return info ? info->GetDecoder() : nullptr; |
| 265 | } |
| 266 | |
| 267 | bool DecoderDatabase::IsType(uint8_t rtp_payload_type, |
| 268 | NetEqDecoder codec_type) const { |
| 269 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 270 | return info && info->codec_type == codec_type; |
| 271 | } |
| 272 | |
| 273 | bool DecoderDatabase::IsComfortNoise(uint8_t rtp_payload_type) const { |
| 274 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 275 | return info && info->IsComfortNoise(); |
| 276 | } |
| 277 | |
| 278 | bool DecoderDatabase::IsDtmf(uint8_t rtp_payload_type) const { |
| 279 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 280 | return info && info->IsDtmf(); |
| 281 | } |
| 282 | |
| 283 | bool DecoderDatabase::IsRed(uint8_t rtp_payload_type) const { |
| 284 | const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 285 | return info && info->IsRed(); |
| 286 | } |
| 287 | |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 288 | int DecoderDatabase::CheckPayloadTypes(const PacketList& packet_list) const { |
| 289 | PacketList::const_iterator it; |
| 290 | for (it = packet_list.begin(); it != packet_list.end(); ++it) { |
ossu | 84bc985 | 2016-08-26 05:41:23 -0700 | [diff] [blame] | 291 | if (!GetDecoderInfo((*it)->header.payloadType)) { |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 292 | // Payload type is not found. |
Henrik Lundin | d67a219 | 2015-08-03 12:54:37 +0200 | [diff] [blame] | 293 | LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " |
| 294 | << static_cast<int>((*it)->header.payloadType); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 295 | return kDecoderNotFound; |
| 296 | } |
| 297 | } |
| 298 | return kOK; |
| 299 | } |
| 300 | |
| 301 | |
| 302 | } // namespace webrtc |