| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 decoders_.clear(); | 207 decoders_.clear(); |
| 208 active_decoder_type_ = -1; // No active decoder. | 208 active_decoder_type_ = -1; // No active decoder. |
| 209 active_cng_decoder_type_ = -1; // No active CNG decoder. | 209 active_cng_decoder_type_ = -1; // No active CNG decoder. |
| 210 } | 210 } |
| 211 | 211 |
| 212 const DecoderDatabase::DecoderInfo* DecoderDatabase::GetDecoderInfo( | 212 const DecoderDatabase::DecoderInfo* DecoderDatabase::GetDecoderInfo( |
| 213 uint8_t rtp_payload_type) const { | 213 uint8_t rtp_payload_type) const { |
| 214 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type); | 214 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type); |
| 215 if (it == decoders_.end()) { | 215 if (it == decoders_.end()) { |
| 216 // Decoder not found. | 216 // Decoder not found. |
| 217 return NULL; | 217 return nullptr; |
| 218 } | 218 } |
| 219 return &it->second; | 219 return &it->second; |
| 220 } | 220 } |
| 221 | 221 |
| 222 int DecoderDatabase::SetActiveDecoder(uint8_t rtp_payload_type, | 222 int DecoderDatabase::SetActiveDecoder(uint8_t rtp_payload_type, |
| 223 bool* new_decoder) { | 223 bool* new_decoder) { |
| 224 // Check that |rtp_payload_type| exists in the database. | 224 // Check that |rtp_payload_type| exists in the database. |
| 225 const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); | 225 const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 226 if (!info) { | 226 if (!info) { |
| 227 // Decoder not found. | 227 // Decoder not found. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 240 old_info->DropDecoder(); | 240 old_info->DropDecoder(); |
| 241 *new_decoder = true; | 241 *new_decoder = true; |
| 242 } | 242 } |
| 243 active_decoder_type_ = rtp_payload_type; | 243 active_decoder_type_ = rtp_payload_type; |
| 244 return kOK; | 244 return kOK; |
| 245 } | 245 } |
| 246 | 246 |
| 247 AudioDecoder* DecoderDatabase::GetActiveDecoder() const { | 247 AudioDecoder* DecoderDatabase::GetActiveDecoder() const { |
| 248 if (active_decoder_type_ < 0) { | 248 if (active_decoder_type_ < 0) { |
| 249 // No active decoder. | 249 // No active decoder. |
| 250 return NULL; | 250 return nullptr; |
| 251 } | 251 } |
| 252 return GetDecoder(active_decoder_type_); | 252 return GetDecoder(active_decoder_type_); |
| 253 } | 253 } |
| 254 | 254 |
| 255 int DecoderDatabase::SetActiveCngDecoder(uint8_t rtp_payload_type) { | 255 int DecoderDatabase::SetActiveCngDecoder(uint8_t rtp_payload_type) { |
| 256 // Check that |rtp_payload_type| exists in the database. | 256 // Check that |rtp_payload_type| exists in the database. |
| 257 const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); | 257 const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 258 if (!info) { | 258 if (!info) { |
| 259 // Decoder not found. | 259 // Decoder not found. |
| 260 return kDecoderNotFound; | 260 return kDecoderNotFound; |
| 261 } | 261 } |
| 262 if (active_cng_decoder_type_ >= 0 && | 262 if (active_cng_decoder_type_ >= 0 && |
| 263 active_cng_decoder_type_ != rtp_payload_type) { | 263 active_cng_decoder_type_ != rtp_payload_type) { |
| 264 // Moving from one active CNG decoder to another. Delete the first one. | 264 // Moving from one active CNG decoder to another. Delete the first one. |
| 265 RTC_DCHECK(active_cng_decoder_); | 265 RTC_DCHECK(active_cng_decoder_); |
| 266 active_cng_decoder_.reset(); | 266 active_cng_decoder_.reset(); |
| 267 } | 267 } |
| 268 active_cng_decoder_type_ = rtp_payload_type; | 268 active_cng_decoder_type_ = rtp_payload_type; |
| 269 return kOK; | 269 return kOK; |
| 270 } | 270 } |
| 271 | 271 |
| 272 ComfortNoiseDecoder* DecoderDatabase::GetActiveCngDecoder() const { | 272 ComfortNoiseDecoder* DecoderDatabase::GetActiveCngDecoder() const { |
| 273 if (active_cng_decoder_type_ < 0) { | 273 if (active_cng_decoder_type_ < 0) { |
| 274 // No active CNG decoder. | 274 // No active CNG decoder. |
| 275 return NULL; | 275 return nullptr; |
| 276 } | 276 } |
| 277 if (!active_cng_decoder_) { | 277 if (!active_cng_decoder_) { |
| 278 active_cng_decoder_.reset(new ComfortNoiseDecoder); | 278 active_cng_decoder_.reset(new ComfortNoiseDecoder); |
| 279 } | 279 } |
| 280 return active_cng_decoder_.get(); | 280 return active_cng_decoder_.get(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 AudioDecoder* DecoderDatabase::GetDecoder(uint8_t rtp_payload_type) const { | 283 AudioDecoder* DecoderDatabase::GetDecoder(uint8_t rtp_payload_type) const { |
| 284 const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); | 284 const DecoderInfo *info = GetDecoderInfo(rtp_payload_type); |
| 285 return info ? info->GetDecoder() : nullptr; | 285 return info ? info->GetDecoder() : nullptr; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // Payload type is not found. | 317 // Payload type is not found. |
| 318 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " | 318 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " |
| 319 << static_cast<int>(it->payload_type); | 319 << static_cast<int>(it->payload_type); |
| 320 return kDecoderNotFound; | 320 return kDecoderNotFound; |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 return kOK; | 323 return kOK; |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace webrtc | 326 } // namespace webrtc |
| OLD | NEW |