| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 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 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2431 iter != feedback_params.params().end(); ++iter) { | 2431 iter != feedback_params.params().end(); ++iter) { |
| 2432 codec->AddFeedbackParam(*iter); | 2432 codec->AddFeedbackParam(*iter); |
| 2433 } | 2433 } |
| 2434 } | 2434 } |
| 2435 | 2435 |
| 2436 // Gets the current codec setting associated with |payload_type|. If there | 2436 // Gets the current codec setting associated with |payload_type|. If there |
| 2437 // is no Codec associated with that payload type it returns an empty codec | 2437 // is no Codec associated with that payload type it returns an empty codec |
| 2438 // with that payload type. | 2438 // with that payload type. |
| 2439 template <class T> | 2439 template <class T> |
| 2440 T GetCodecWithPayloadType(const std::vector<T>& codecs, int payload_type) { | 2440 T GetCodecWithPayloadType(const std::vector<T>& codecs, int payload_type) { |
| 2441 const T* codec = FindCodecById(codecs, payload_type); |
| 2442 if (codec) |
| 2443 return *codec; |
| 2444 // Return empty codec with |payload_type|. |
| 2441 T ret_val; | 2445 T ret_val; |
| 2442 if (!FindCodecById(codecs, payload_type, &ret_val)) { | 2446 ret_val.id = payload_type; |
| 2443 ret_val.id = payload_type; | |
| 2444 } | |
| 2445 return ret_val; | 2447 return ret_val; |
| 2446 } | 2448 } |
| 2447 | 2449 |
| 2448 // Updates or creates a new codec entry in the audio description. | 2450 // Updates or creates a new codec entry in the audio description. |
| 2449 template <class T, class U> | 2451 template <class T, class U> |
| 2450 void AddOrReplaceCodec(MediaContentDescription* content_desc, const U& codec) { | 2452 void AddOrReplaceCodec(MediaContentDescription* content_desc, const U& codec) { |
| 2451 T* desc = static_cast<T*>(content_desc); | 2453 T* desc = static_cast<T*>(content_desc); |
| 2452 std::vector<U> codecs = desc->codecs(); | 2454 std::vector<U> codecs = desc->codecs(); |
| 2453 bool found = false; | 2455 bool found = false; |
| 2454 | 2456 |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3172 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3174 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
| 3173 media_desc, payload_type, feedback_param); | 3175 media_desc, payload_type, feedback_param); |
| 3174 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3176 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
| 3175 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3177 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
| 3176 media_desc, payload_type, feedback_param); | 3178 media_desc, payload_type, feedback_param); |
| 3177 } | 3179 } |
| 3178 return true; | 3180 return true; |
| 3179 } | 3181 } |
| 3180 | 3182 |
| 3181 } // namespace webrtc | 3183 } // namespace webrtc |
| OLD | NEW |