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 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2180 }; | 2180 }; |
2181 | 2181 |
2182 void MaybeCreateStaticPayloadAudioCodecs( | 2182 void MaybeCreateStaticPayloadAudioCodecs( |
2183 const std::vector<int>& fmts, AudioContentDescription* media_desc) { | 2183 const std::vector<int>& fmts, AudioContentDescription* media_desc) { |
2184 if (!media_desc) { | 2184 if (!media_desc) { |
2185 return; | 2185 return; |
2186 } | 2186 } |
2187 RTC_DCHECK(media_desc->codecs().empty()); | 2187 RTC_DCHECK(media_desc->codecs().empty()); |
2188 std::vector<int>::const_iterator it = fmts.begin(); | 2188 std::vector<int>::const_iterator it = fmts.begin(); |
2189 for (; it != fmts.end(); ++it) { | 2189 for (; it != fmts.end(); ++it) { |
2190 int payload_type = *it; | 2190 int payload_type = *it; |
henrika_webrtc
2016/06/20 13:55:55
can't you do
size_t payload_type = *it
here in
kjellander_webrtc
2016/06/20 14:02:26
I tried, but line 2192 checks if it's >=0 so it se
| |
2191 if (!media_desc->HasCodec(payload_type) && | 2191 if (!media_desc->HasCodec(payload_type) && |
2192 payload_type >= 0 && | 2192 payload_type >= 0 && |
2193 payload_type < arraysize(kStaticPayloadAudioCodecs)) { | 2193 static_cast<uint32_t>(payload_type) < |
2194 arraysize(kStaticPayloadAudioCodecs)) { | |
2194 std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; | 2195 std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; |
2195 int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; | 2196 int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; |
2196 size_t channels = kStaticPayloadAudioCodecs[payload_type].channels; | 2197 size_t channels = kStaticPayloadAudioCodecs[payload_type].channels; |
2197 media_desc->AddCodec(cricket::AudioCodec(payload_type, encoding_name, | 2198 media_desc->AddCodec(cricket::AudioCodec(payload_type, encoding_name, |
2198 clock_rate, 0, channels)); | 2199 clock_rate, 0, channels)); |
2199 } | 2200 } |
2200 } | 2201 } |
2201 } | 2202 } |
2202 | 2203 |
2203 template <class C> | 2204 template <class C> |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3176 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3177 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3177 media_desc, payload_type, feedback_param); | 3178 media_desc, payload_type, feedback_param); |
3178 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3179 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3179 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3180 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3180 media_desc, payload_type, feedback_param); | 3181 media_desc, payload_type, feedback_param); |
3181 } | 3182 } |
3182 return true; | 3183 return true; |
3183 } | 3184 } |
3184 | 3185 |
3185 } // namespace webrtc | 3186 } // namespace webrtc |
OLD | NEW |