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

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/opus_fec_test.cc

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Rebase onto cleanup change Created 4 years, 11 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "webrtc/base/format_macros.h"
12 #include "webrtc/base/scoped_ptr.h" 13 #include "webrtc/base/scoped_ptr.h"
13 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" 14 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
14 #include "webrtc/test/testsupport/fileutils.h" 15 #include "webrtc/test/testsupport/fileutils.h"
15 16
16 using ::std::string; 17 using ::std::string;
17 using ::std::tr1::tuple; 18 using ::std::tr1::tuple;
18 using ::std::tr1::get; 19 using ::std::tr1::get;
19 using ::testing::TestWithParam; 20 using ::testing::TestWithParam;
20 21
21 namespace webrtc { 22 namespace webrtc {
(...skipping 18 matching lines...) Expand all
40 virtual void TearDown(); 41 virtual void TearDown();
41 42
42 virtual void EncodeABlock(); 43 virtual void EncodeABlock();
43 44
44 virtual void DecodeABlock(bool lost_previous, bool lost_current); 45 virtual void DecodeABlock(bool lost_previous, bool lost_current);
45 46
46 int block_duration_ms_; 47 int block_duration_ms_;
47 int sampling_khz_; 48 int sampling_khz_;
48 size_t block_length_sample_; 49 size_t block_length_sample_;
49 50
50 int channels_; 51 size_t channels_;
51 int bit_rate_; 52 int bit_rate_;
52 53
53 size_t data_pointer_; 54 size_t data_pointer_;
54 size_t loop_length_samples_; 55 size_t loop_length_samples_;
55 size_t max_bytes_; 56 size_t max_bytes_;
56 size_t encoded_bytes_; 57 size_t encoded_bytes_;
57 58
58 WebRtcOpusEncInst* opus_encoder_; 59 WebRtcOpusEncInst* opus_encoder_;
59 WebRtcOpusDecInst* opus_decoder_; 60 WebRtcOpusDecInst* opus_decoder_;
60 61
61 string in_filename_; 62 string in_filename_;
62 63
63 rtc::scoped_ptr<int16_t[]> in_data_; 64 rtc::scoped_ptr<int16_t[]> in_data_;
64 rtc::scoped_ptr<int16_t[]> out_data_; 65 rtc::scoped_ptr<int16_t[]> out_data_;
65 rtc::scoped_ptr<uint8_t[]> bit_stream_; 66 rtc::scoped_ptr<uint8_t[]> bit_stream_;
66 }; 67 };
67 68
68 void OpusFecTest::SetUp() { 69 void OpusFecTest::SetUp() {
69 channels_ = get<0>(GetParam()); 70 channels_ = static_cast<size_t>(get<0>(GetParam()));
minyue-webrtc 2015/12/29 10:42:47 Nit: can redefine this param if you like
Peter Kasting 2015/12/30 00:55:45 I don't understand what "redefine" means here. Wh
minyue-webrtc 2016/01/04 09:06:02 See line 25.
Peter Kasting 2016/01/04 19:49:42 Oh. Hmm, I'm not familiar with how TestWithParam<
minyue-webrtc 2016/01/04 22:03:18 I think it is just safe to change the first param
Peter Kasting 2016/01/08 02:45:06 Done.
70 bit_rate_ = get<1>(GetParam()); 71 bit_rate_ = get<1>(GetParam());
71 printf("Coding %d channel signal at %d bps.\n", channels_, bit_rate_); 72 printf("Coding %" PRIuS " channel signal at %d bps.\n", channels_, bit_rate_);
72 73
73 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam())); 74 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam()));
74 75
75 FILE* fp = fopen(in_filename_.c_str(), "rb"); 76 FILE* fp = fopen(in_filename_.c_str(), "rb");
76 ASSERT_FALSE(fp == NULL); 77 ASSERT_FALSE(fp == NULL);
77 78
78 // Obtain file size. 79 // Obtain file size.
79 fseek(fp, 0, SEEK_END); 80 fseek(fp, 0, SEEK_END);
80 loop_length_samples_ = ftell(fp) / sizeof(int16_t); 81 loop_length_samples_ = ftell(fp) / sizeof(int16_t);
81 rewind(fp); 82 rewind(fp);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), 232 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"),
232 string("pcm")), 233 string("pcm")),
233 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), 234 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"),
234 string("pcm"))}; 235 string("pcm"))};
235 236
236 // 64 kbps, stereo 237 // 64 kbps, stereo
237 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, 238 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest,
238 ::testing::ValuesIn(param_set)); 239 ::testing::ValuesIn(param_set));
239 240
240 } // namespace webrtc 241 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698