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

Side by Side Diff: webrtc/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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
(...skipping 16 matching lines...) Expand all
27 input_length_sample_( 27 input_length_sample_(
28 static_cast<size_t>(block_duration_ms_ * input_sampling_khz_)), 28 static_cast<size_t>(block_duration_ms_ * input_sampling_khz_)),
29 output_length_sample_( 29 output_length_sample_(
30 static_cast<size_t>(block_duration_ms_ * output_sampling_khz_)), 30 static_cast<size_t>(block_duration_ms_ * output_sampling_khz_)),
31 data_pointer_(0), 31 data_pointer_(0),
32 loop_length_samples_(0), 32 loop_length_samples_(0),
33 max_bytes_(0), 33 max_bytes_(0),
34 encoded_bytes_(0), 34 encoded_bytes_(0),
35 encoding_time_ms_(0.0), 35 encoding_time_ms_(0.0),
36 decoding_time_ms_(0.0), 36 decoding_time_ms_(0.0),
37 out_file_(NULL) { 37 out_file_(nullptr) {}
38 }
39 38
40 void AudioCodecSpeedTest::SetUp() { 39 void AudioCodecSpeedTest::SetUp() {
41 channels_ = get<0>(GetParam()); 40 channels_ = get<0>(GetParam());
42 bit_rate_ = get<1>(GetParam()); 41 bit_rate_ = get<1>(GetParam());
43 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam())); 42 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam()));
44 save_out_data_ = get<4>(GetParam()); 43 save_out_data_ = get<4>(GetParam());
45 44
46 FILE* fp = fopen(in_filename_.c_str(), "rb"); 45 FILE* fp = fopen(in_filename_.c_str(), "rb");
47 assert(fp != NULL); 46 assert(fp != nullptr);
48 47
49 // Obtain file size. 48 // Obtain file size.
50 fseek(fp, 0, SEEK_END); 49 fseek(fp, 0, SEEK_END);
51 loop_length_samples_ = ftell(fp) / sizeof(int16_t); 50 loop_length_samples_ = ftell(fp) / sizeof(int16_t);
52 rewind(fp); 51 rewind(fp);
53 52
54 // Allocate memory to contain the whole file. 53 // Allocate memory to contain the whole file.
55 in_data_.reset(new int16_t[loop_length_samples_ + 54 in_data_.reset(new int16_t[loop_length_samples_ +
56 input_length_sample_ * channels_]); 55 input_length_sample_ * channels_]);
57 56
(...skipping 19 matching lines...) Expand all
77 ::testing::UnitTest::GetInstance()->current_test_info()->name(); 76 ::testing::UnitTest::GetInstance()->current_test_info()->name();
78 77
79 // Erase '/' 78 // Erase '/'
80 size_t found; 79 size_t found;
81 while ((found = out_filename.find('/')) != std::string::npos) 80 while ((found = out_filename.find('/')) != std::string::npos)
82 out_filename.replace(found, 1, "_"); 81 out_filename.replace(found, 1, "_");
83 82
84 out_filename = test::OutputPath() + out_filename + ".pcm"; 83 out_filename = test::OutputPath() + out_filename + ".pcm";
85 84
86 out_file_ = fopen(out_filename.c_str(), "wb"); 85 out_file_ = fopen(out_filename.c_str(), "wb");
87 assert(out_file_ != NULL); 86 assert(out_file_ != nullptr);
88 87
89 printf("Output to be saved in %s.\n", out_filename.c_str()); 88 printf("Output to be saved in %s.\n", out_filename.c_str());
90 } 89 }
91 } 90 }
92 91
93 void AudioCodecSpeedTest::TearDown() { 92 void AudioCodecSpeedTest::TearDown() {
94 if (save_out_data_) { 93 if (save_out_data_) {
95 fclose(out_file_); 94 fclose(out_file_);
96 } 95 }
97 } 96 }
(...skipping 20 matching lines...) Expand all
118 loop_length_samples_; 117 loop_length_samples_;
119 time_now_ms += block_duration_ms_; 118 time_now_ms += block_duration_ms_;
120 } 119 }
121 120
122 printf("Encoding: %.2f%% real time,\nDecoding: %.2f%% real time.\n", 121 printf("Encoding: %.2f%% real time,\nDecoding: %.2f%% real time.\n",
123 (encoding_time_ms_ / audio_duration_sec) / 10.0, 122 (encoding_time_ms_ / audio_duration_sec) / 10.0,
124 (decoding_time_ms_ / audio_duration_sec) / 10.0); 123 (decoding_time_ms_ / audio_duration_sec) / 10.0);
125 } 124 }
126 125
127 } // namespace webrtc 126 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698