Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // Check that this is a registered payload type. | 336 // Check that this is a registered payload type. |
| 337 if (it == payload_type_map_.end()) { | 337 if (it == payload_type_map_.end()) { |
| 338 return false; | 338 return false; |
| 339 } | 339 } |
| 340 *payload = it->second->typeSpecific; | 340 *payload = it->second->typeSpecific; |
| 341 return true; | 341 return true; |
| 342 } | 342 } |
| 343 | 343 |
| 344 int RTPPayloadRegistry::GetPayloadTypeFrequency( | 344 int RTPPayloadRegistry::GetPayloadTypeFrequency( |
| 345 uint8_t payload_type) const { | 345 uint8_t payload_type) const { |
| 346 RtpUtility::Payload* payload; | 346 const RtpUtility::Payload* payload = PayloadTypeToPayload(payload_type); |
| 347 if (!PayloadTypeToPayload(payload_type, payload)) { | 347 if (payload == nullptr) { |
|
mflodman
2015/12/09 09:19:13
We've started going towards 'if (!payload)' rather
danilchap
2015/12/09 11:23:36
Done.
| |
| 348 return -1; | 348 return -1; |
| 349 } | 349 } |
| 350 CriticalSectionScoped cs(crit_sect_.get()); | 350 CriticalSectionScoped cs(crit_sect_.get()); |
| 351 return rtp_payload_strategy_->GetPayloadTypeFrequency(*payload); | 351 return rtp_payload_strategy_->GetPayloadTypeFrequency(*payload); |
| 352 } | 352 } |
| 353 | 353 |
| 354 bool RTPPayloadRegistry::PayloadTypeToPayload( | 354 RtpUtility::Payload* RTPPayloadRegistry::PayloadTypeToPayload( |
| 355 const uint8_t payload_type, | 355 uint8_t payload_type) const { |
| 356 RtpUtility::Payload*& payload) const { | |
| 357 CriticalSectionScoped cs(crit_sect_.get()); | 356 CriticalSectionScoped cs(crit_sect_.get()); |
| 358 | 357 |
| 359 RtpUtility::PayloadTypeMap::const_iterator it = | 358 RtpUtility::PayloadTypeMap::const_iterator it = |
| 360 payload_type_map_.find(payload_type); | 359 payload_type_map_.find(payload_type); |
| 361 | 360 |
| 362 // Check that this is a registered payload type. | 361 // Check that this is a registered payload type. |
| 363 if (it == payload_type_map_.end()) { | 362 if (it == payload_type_map_.end()) { |
| 364 return false; | 363 return nullptr; |
| 365 } | 364 } |
| 366 | 365 |
| 367 payload = it->second; | 366 return it->second; |
| 368 return true; | |
| 369 } | 367 } |
| 370 | 368 |
| 371 void RTPPayloadRegistry::SetIncomingPayloadType(const RTPHeader& header) { | 369 void RTPPayloadRegistry::SetIncomingPayloadType(const RTPHeader& header) { |
| 372 CriticalSectionScoped cs(crit_sect_.get()); | 370 CriticalSectionScoped cs(crit_sect_.get()); |
| 373 if (!IsRtxInternal(header)) | 371 if (!IsRtxInternal(header)) |
| 374 incoming_payload_type_ = header.payloadType; | 372 incoming_payload_type_ = header.payloadType; |
| 375 } | 373 } |
| 376 | 374 |
| 377 bool RTPPayloadRegistry::ReportMediaPayloadType(uint8_t media_payload_type) { | 375 bool RTPPayloadRegistry::ReportMediaPayloadType(uint8_t media_payload_type) { |
| 378 CriticalSectionScoped cs(crit_sect_.get()); | 376 CriticalSectionScoped cs(crit_sect_.get()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( | 481 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( |
| 484 const bool handling_audio) { | 482 const bool handling_audio) { |
| 485 if (handling_audio) { | 483 if (handling_audio) { |
| 486 return new RTPPayloadAudioStrategy(); | 484 return new RTPPayloadAudioStrategy(); |
| 487 } else { | 485 } else { |
| 488 return new RTPPayloadVideoStrategy(); | 486 return new RTPPayloadVideoStrategy(); |
| 489 } | 487 } |
| 490 } | 488 } |
| 491 | 489 |
| 492 } // namespace webrtc | 490 } // namespace webrtc |
| OLD | NEW |