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

Side by Side Diff: talk/media/webrtc/simulcast.cc

Issue 1405023016: Convert usage of ARRAY_SIZE to arraysize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: static_cast<int> Created 5 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 | « talk/media/sctp/sctpdataengine.cc ('k') | talk/media/webrtc/webrtcmediaengine.cc » ('j') | 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 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 11 matching lines...) Expand all
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include <stdio.h> 28 #include <stdio.h>
29 29
30 #include "talk/media/base/streamparams.h" 30 #include "talk/media/base/streamparams.h"
31 #include "talk/media/webrtc/simulcast.h" 31 #include "talk/media/webrtc/simulcast.h"
32 #include "webrtc/base/arraysize.h"
32 #include "webrtc/base/common.h" 33 #include "webrtc/base/common.h"
33 #include "webrtc/base/logging.h" 34 #include "webrtc/base/logging.h"
34 #include "webrtc/system_wrappers/include/field_trial.h" 35 #include "webrtc/system_wrappers/include/field_trial.h"
36
35 namespace cricket { 37 namespace cricket {
36 38
37 struct SimulcastFormat { 39 struct SimulcastFormat {
38 int width; 40 int width;
39 int height; 41 int height;
40 // The maximum number of simulcast layers can be used for 42 // The maximum number of simulcast layers can be used for
41 // resolutions at |widthxheigh|. 43 // resolutions at |widthxheigh|.
42 size_t max_layers; 44 size_t max_layers;
43 // The maximum bitrate for encoding stream at |widthxheight|, when we are 45 // The maximum bitrate for encoding stream at |widthxheight|, when we are
44 // not sending the next higher spatial stream. 46 // not sending the next higher spatial stream.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (*width < *height) { 88 if (*width < *height) {
87 int temp = *width; 89 int temp = *width;
88 *width = *height; 90 *width = *height;
89 *height = temp; 91 *height = temp;
90 } 92 }
91 } 93 }
92 94
93 int FindSimulcastFormatIndex(int width, int height) { 95 int FindSimulcastFormatIndex(int width, int height) {
94 MaybeExchangeWidthHeight(&width, &height); 96 MaybeExchangeWidthHeight(&width, &height);
95 97
96 for (int i = 0; i < ARRAY_SIZE(kSimulcastFormats); ++i) { 98 for (int i = 0; i < arraysize(kSimulcastFormats); ++i) {
97 if (width >= kSimulcastFormats[i].width && 99 if (width >= kSimulcastFormats[i].width &&
98 height >= kSimulcastFormats[i].height) { 100 height >= kSimulcastFormats[i].height) {
99 return i; 101 return i;
100 } 102 }
101 } 103 }
102 return -1; 104 return -1;
103 } 105 }
104 106
105 int FindSimulcastFormatIndex(int width, int height, size_t max_layers) { 107 int FindSimulcastFormatIndex(int width, int height, size_t max_layers) {
106 MaybeExchangeWidthHeight(&width, &height); 108 MaybeExchangeWidthHeight(&width, &height);
107 109
108 for (int i = 0; i < ARRAY_SIZE(kSimulcastFormats); ++i) { 110 for (int i = 0; i < arraysize(kSimulcastFormats); ++i) {
109 if (width >= kSimulcastFormats[i].width && 111 if (width >= kSimulcastFormats[i].width &&
110 height >= kSimulcastFormats[i].height && 112 height >= kSimulcastFormats[i].height &&
111 max_layers == kSimulcastFormats[i].max_layers) { 113 max_layers == kSimulcastFormats[i].max_layers) {
112 return i; 114 return i;
113 } 115 }
114 } 116 }
115 return -1; 117 return -1;
116 } 118 }
117 119
118 // Simulcast stream width and height must both be dividable by 120 // Simulcast stream width and height must both be dividable by
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return false; 284 return false;
283 } 285 }
284 286
285 config->tl0_bitrate_kbps = tl0_bitrate; 287 config->tl0_bitrate_kbps = tl0_bitrate;
286 config->tl1_bitrate_kbps = tl1_bitrate; 288 config->tl1_bitrate_kbps = tl1_bitrate;
287 289
288 return true; 290 return true;
289 } 291 }
290 292
291 } // namespace cricket 293 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/sctp/sctpdataengine.cc ('k') | talk/media/webrtc/webrtcmediaengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698