Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc

Issue 2515163002: Don't declare function arguments of array type (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
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( 36 int32_t RTPPayloadRegistry::RegisterReceivePayload(
37 const char payload_name[RTP_PAYLOAD_NAME_SIZE], 37 const char* const payload_name,
38 const int8_t payload_type, 38 const int8_t payload_type,
39 const uint32_t frequency, 39 const uint32_t frequency,
40 const size_t channels, 40 const size_t channels,
41 const uint32_t rate, 41 const uint32_t rate,
42 bool* created_new_payload) { 42 bool* created_new_payload) {
43 assert(payload_type >= 0); 43 assert(payload_type >= 0);
44 assert(payload_name); 44 assert(payload_name);
45 *created_new_payload = false; 45 *created_new_payload = false;
46 46
47 // Sanity check. 47 // Sanity check.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 assert(it != payload_type_map_.end()); 126 assert(it != payload_type_map_.end());
127 delete it->second; 127 delete it->second;
128 payload_type_map_.erase(it); 128 payload_type_map_.erase(it);
129 return 0; 129 return 0;
130 } 130 }
131 131
132 // There can't be several codecs with the same rate, frequency and channels 132 // There can't be several codecs with the same rate, frequency and channels
133 // for audio codecs, but there can for video. 133 // for audio codecs, but there can for video.
134 // Always called from within a critical section. 134 // Always called from within a critical section.
135 void RTPPayloadRegistry::DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( 135 void RTPPayloadRegistry::DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
136 const char payload_name[RTP_PAYLOAD_NAME_SIZE], 136 const char* const payload_name,
137 const size_t payload_name_length, 137 const size_t payload_name_length,
138 const uint32_t frequency, 138 const uint32_t frequency,
139 const size_t channels, 139 const size_t channels,
140 const uint32_t rate) { 140 const uint32_t rate) {
141 RtpUtility::PayloadTypeMap::iterator iterator = payload_type_map_.begin(); 141 RtpUtility::PayloadTypeMap::iterator iterator = payload_type_map_.begin();
142 for (; iterator != payload_type_map_.end(); ++iterator) { 142 for (; iterator != payload_type_map_.end(); ++iterator) {
143 RtpUtility::Payload* payload = iterator->second; 143 RtpUtility::Payload* payload = iterator->second;
144 size_t name_length = strlen(payload->name); 144 size_t name_length = strlen(payload->name);
145 145
146 if (payload_name_length == name_length && 146 if (payload_name_length == name_length &&
(...skipping 11 matching lines...) Expand all
158 } 158 }
159 } else if (RtpUtility::StringCompare(payload_name, "red", 3)) { 159 } else if (RtpUtility::StringCompare(payload_name, "red", 3)) {
160 delete payload; 160 delete payload;
161 payload_type_map_.erase(iterator); 161 payload_type_map_.erase(iterator);
162 break; 162 break;
163 } 163 }
164 } 164 }
165 } 165 }
166 } 166 }
167 167
168 int32_t RTPPayloadRegistry::ReceivePayloadType( 168 int32_t RTPPayloadRegistry::ReceivePayloadType(const char* const payload_name,
169 const char payload_name[RTP_PAYLOAD_NAME_SIZE], 169 const uint32_t frequency,
170 const uint32_t frequency, 170 const size_t channels,
171 const size_t channels, 171 const uint32_t rate,
172 const uint32_t rate, 172 int8_t* payload_type) const {
173 int8_t* payload_type) const {
174 assert(payload_type); 173 assert(payload_type);
175 size_t payload_name_length = strlen(payload_name); 174 size_t payload_name_length = strlen(payload_name);
176 175
177 rtc::CritScope cs(&crit_sect_); 176 rtc::CritScope cs(&crit_sect_);
178 177
179 RtpUtility::PayloadTypeMap::const_iterator it = payload_type_map_.begin(); 178 RtpUtility::PayloadTypeMap::const_iterator it = payload_type_map_.begin();
180 179
181 for (; it != payload_type_map_.end(); ++it) { 180 for (; it != payload_type_map_.end(); ++it) {
182 RtpUtility::Payload* payload = it->second; 181 RtpUtility::Payload* payload = it->second;
183 assert(payload); 182 assert(payload);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 payload.typeSpecific.Audio.channels == channels && 380 payload.typeSpecific.Audio.channels == channels &&
382 (payload.typeSpecific.Audio.rate == rate || 381 (payload.typeSpecific.Audio.rate == rate ||
383 payload.typeSpecific.Audio.rate == 0 || rate == 0); 382 payload.typeSpecific.Audio.rate == 0 || rate == 0);
384 } 383 }
385 384
386 void UpdatePayloadRate(RtpUtility::Payload* payload, 385 void UpdatePayloadRate(RtpUtility::Payload* payload,
387 const uint32_t rate) const override { 386 const uint32_t rate) const override {
388 payload->typeSpecific.Audio.rate = rate; 387 payload->typeSpecific.Audio.rate = rate;
389 } 388 }
390 389
391 RtpUtility::Payload* CreatePayloadType( 390 RtpUtility::Payload* CreatePayloadType(const char* const payloadName,
392 const char payloadName[RTP_PAYLOAD_NAME_SIZE], 391 const int8_t payloadType,
393 const int8_t payloadType, 392 const uint32_t frequency,
394 const uint32_t frequency, 393 const size_t channels,
395 const size_t channels, 394 const uint32_t rate) const override {
396 const uint32_t rate) const override {
397 RtpUtility::Payload* payload = new RtpUtility::Payload; 395 RtpUtility::Payload* payload = new RtpUtility::Payload;
398 payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0; 396 payload->name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
399 strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1); 397 strncpy(payload->name, payloadName, RTP_PAYLOAD_NAME_SIZE - 1);
400 assert(frequency >= 1000); 398 assert(frequency >= 1000);
401 payload->typeSpecific.Audio.frequency = frequency; 399 payload->typeSpecific.Audio.frequency = frequency;
402 payload->typeSpecific.Audio.channels = channels; 400 payload->typeSpecific.Audio.channels = channels;
403 payload->typeSpecific.Audio.rate = rate; 401 payload->typeSpecific.Audio.rate = rate;
404 payload->audio = true; 402 payload->audio = true;
405 return payload; 403 return payload;
406 } 404 }
(...skipping 11 matching lines...) Expand all
418 bool PayloadIsCompatible(const RtpUtility::Payload& payload, 416 bool PayloadIsCompatible(const RtpUtility::Payload& payload,
419 const uint32_t frequency, 417 const uint32_t frequency,
420 const size_t channels, 418 const size_t channels,
421 const uint32_t rate) const override { 419 const uint32_t rate) const override {
422 return !payload.audio; 420 return !payload.audio;
423 } 421 }
424 422
425 void UpdatePayloadRate(RtpUtility::Payload* payload, 423 void UpdatePayloadRate(RtpUtility::Payload* payload,
426 const uint32_t rate) const override {} 424 const uint32_t rate) const override {}
427 425
428 RtpUtility::Payload* CreatePayloadType( 426 RtpUtility::Payload* CreatePayloadType(const char* const payloadName,
429 const char payloadName[RTP_PAYLOAD_NAME_SIZE], 427 const int8_t payloadType,
430 const int8_t payloadType, 428 const uint32_t frequency,
431 const uint32_t frequency, 429 const size_t channels,
432 const size_t channels, 430 const uint32_t rate) const override {
433 const uint32_t rate) const override {
434 RtpVideoCodecTypes videoType = kRtpVideoGeneric; 431 RtpVideoCodecTypes videoType = kRtpVideoGeneric;
435 432
436 if (RtpUtility::StringCompare(payloadName, "VP8", 3)) { 433 if (RtpUtility::StringCompare(payloadName, "VP8", 3)) {
437 videoType = kRtpVideoVp8; 434 videoType = kRtpVideoVp8;
438 } else if (RtpUtility::StringCompare(payloadName, "VP9", 3)) { 435 } else if (RtpUtility::StringCompare(payloadName, "VP9", 3)) {
439 videoType = kRtpVideoVp9; 436 videoType = kRtpVideoVp9;
440 } else if (RtpUtility::StringCompare(payloadName, "H264", 4)) { 437 } else if (RtpUtility::StringCompare(payloadName, "H264", 4)) {
441 videoType = kRtpVideoH264; 438 videoType = kRtpVideoH264;
442 } else if (RtpUtility::StringCompare(payloadName, "I420", 4)) { 439 } else if (RtpUtility::StringCompare(payloadName, "I420", 4)) {
443 videoType = kRtpVideoGeneric; 440 videoType = kRtpVideoGeneric;
(...skipping 21 matching lines...) Expand all
465 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( 462 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy(
466 const bool handling_audio) { 463 const bool handling_audio) {
467 if (handling_audio) { 464 if (handling_audio) {
468 return new RTPPayloadAudioStrategy(); 465 return new RTPPayloadAudioStrategy();
469 } else { 466 } else {
470 return new RTPPayloadVideoStrategy(); 467 return new RTPPayloadVideoStrategy();
471 } 468 }
472 } 469 }
473 470
474 } // namespace webrtc 471 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698