| 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 15 matching lines...) Expand all Loading... |
| 26 ssrc_rtx_(0) {} | 26 ssrc_rtx_(0) {} |
| 27 | 27 |
| 28 RTPPayloadRegistry::~RTPPayloadRegistry() { | 28 RTPPayloadRegistry::~RTPPayloadRegistry() { |
| 29 while (!payload_type_map_.empty()) { | 29 while (!payload_type_map_.empty()) { |
| 30 RtpUtility::PayloadTypeMap::iterator it = payload_type_map_.begin(); | 30 RtpUtility::PayloadTypeMap::iterator it = payload_type_map_.begin(); |
| 31 delete it->second; | 31 delete it->second; |
| 32 payload_type_map_.erase(it); | 32 payload_type_map_.erase(it); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 int32_t RTPPayloadRegistry::RegisterReceivePayload(const CodecInst& audio_codec, |
| 37 bool* created_new_payload) { |
| 38 return RegisterReceivePayload( |
| 39 audio_codec.plname, audio_codec.pltype, audio_codec.plfreq, |
| 40 audio_codec.channels, std::max(0, audio_codec.rate), |
| 41 created_new_payload); |
| 42 } |
| 43 |
| 44 int32_t RTPPayloadRegistry::RegisterReceivePayload( |
| 45 const VideoCodec& video_codec, |
| 46 bool* created_new_payload) { |
| 47 return RegisterReceivePayload(video_codec.plName, video_codec.plType, |
| 48 kVideoPayloadTypeFrequency, 0 /* channels */, |
| 49 0 /* rate */, created_new_payload); |
| 50 } |
| 51 |
| 36 int32_t RTPPayloadRegistry::RegisterReceivePayload( | 52 int32_t RTPPayloadRegistry::RegisterReceivePayload( |
| 37 const char* const payload_name, | 53 const char* const payload_name, |
| 38 const int8_t payload_type, | 54 const int8_t payload_type, |
| 39 const uint32_t frequency, | 55 const uint32_t frequency, |
| 40 const size_t channels, | 56 const size_t channels, |
| 41 const uint32_t rate, | 57 const uint32_t rate, |
| 42 bool* created_new_payload) { | 58 bool* created_new_payload) { |
| 43 assert(payload_type >= 0); | 59 assert(payload_type >= 0); |
| 44 assert(payload_name); | 60 assert(payload_name); |
| 45 *created_new_payload = false; | 61 *created_new_payload = false; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 174 } |
| 159 } else if (RtpUtility::StringCompare(payload_name, "red", 3)) { | 175 } else if (RtpUtility::StringCompare(payload_name, "red", 3)) { |
| 160 delete payload; | 176 delete payload; |
| 161 payload_type_map_.erase(iterator); | 177 payload_type_map_.erase(iterator); |
| 162 break; | 178 break; |
| 163 } | 179 } |
| 164 } | 180 } |
| 165 } | 181 } |
| 166 } | 182 } |
| 167 | 183 |
| 184 int32_t RTPPayloadRegistry::ReceivePayloadType(const CodecInst& audio_codec, |
| 185 int8_t* payload_type) const { |
| 186 return ReceivePayloadType(audio_codec.plname, audio_codec.plfreq, |
| 187 audio_codec.channels, std::max(0, audio_codec.rate), |
| 188 payload_type); |
| 189 } |
| 190 |
| 191 int32_t RTPPayloadRegistry::ReceivePayloadType(const VideoCodec& video_codec, |
| 192 int8_t* payload_type) const { |
| 193 return ReceivePayloadType(video_codec.plName, kVideoPayloadTypeFrequency, |
| 194 0 /* channels */, 0 /* rate */, |
| 195 payload_type); |
| 196 } |
| 197 |
| 168 int32_t RTPPayloadRegistry::ReceivePayloadType(const char* const payload_name, | 198 int32_t RTPPayloadRegistry::ReceivePayloadType(const char* const payload_name, |
| 169 const uint32_t frequency, | 199 const uint32_t frequency, |
| 170 const size_t channels, | 200 const size_t channels, |
| 171 const uint32_t rate, | 201 const uint32_t rate, |
| 172 int8_t* payload_type) const { | 202 int8_t* payload_type) const { |
| 173 assert(payload_type); | 203 assert(payload_type); |
| 174 size_t payload_name_length = strlen(payload_name); | 204 size_t payload_name_length = strlen(payload_name); |
| 175 | 205 |
| 176 rtc::CritScope cs(&crit_sect_); | 206 rtc::CritScope cs(&crit_sect_); |
| 177 | 207 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( | 492 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( |
| 463 const bool handling_audio) { | 493 const bool handling_audio) { |
| 464 if (handling_audio) { | 494 if (handling_audio) { |
| 465 return new RTPPayloadAudioStrategy(); | 495 return new RTPPayloadAudioStrategy(); |
| 466 } else { | 496 } else { |
| 467 return new RTPPayloadVideoStrategy(); | 497 return new RTPPayloadVideoStrategy(); |
| 468 } | 498 } |
| 469 } | 499 } |
| 470 | 500 |
| 471 } // namespace webrtc | 501 } // namespace webrtc |
| OLD | NEW |