| Index: webrtc/tools/agc/activity_metric.cc
|
| diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc
|
| index a98730a3422bd1c3966f9bae0da7237a188eee7a..c0b29f043c82a84828d10cbb21000202f7ce7457 100644
|
| --- a/webrtc/tools/agc/activity_metric.cc
|
| +++ b/webrtc/tools/agc/activity_metric.cc
|
| @@ -79,13 +79,13 @@ class AgcStat {
|
| audio_processing_(new VadAudioProc()),
|
| vad_(new PitchBasedVad()),
|
| standalone_vad_(StandaloneVad::Create()),
|
| - audio_content_fid_(NULL) {
|
| + audio_content_fid_(nullptr) {
|
| for (size_t n = 0; n < kMaxNumFrames; n++)
|
| video_vad_[n] = 0.5;
|
| }
|
|
|
| ~AgcStat() {
|
| - if (audio_content_fid_ != NULL) {
|
| + if (audio_content_fid_ != nullptr) {
|
| fclose(audio_content_fid_);
|
| }
|
| }
|
| @@ -129,7 +129,7 @@ class AgcStat {
|
| for (size_t n = 0; n < features.num_frames; n++) {
|
| audio_content_->Update(features.rms[n], p[n]);
|
| double ac = audio_content_->AudioContent();
|
| - if (audio_content_fid_ != NULL) {
|
| + if (audio_content_fid_ != nullptr) {
|
| fwrite(&ac, sizeof(ac), 1, audio_content_fid_);
|
| }
|
| if (ac > kAgcAnalWindowSamples * activity_threshold_) {
|
| @@ -168,20 +168,20 @@ void void_main(int argc, char* argv[]) {
|
| webrtc::AgcStat agc_stat;
|
|
|
| FILE* pcm_fid = fopen(argv[1], "rb");
|
| - ASSERT_TRUE(pcm_fid != NULL) << "Cannot open PCM file " << argv[1];
|
| + ASSERT_TRUE(pcm_fid != nullptr) << "Cannot open PCM file " << argv[1];
|
|
|
| if (argc < 2) {
|
| fprintf(stderr, "\nNot Enough arguments\n");
|
| }
|
|
|
| - FILE* true_vad_fid = NULL;
|
| + FILE* true_vad_fid = nullptr;
|
| ASSERT_GT(FLAGS_true_vad.size(), 0u) << "Specify the file containing true "
|
| "VADs using --true_vad flag.";
|
| true_vad_fid = fopen(FLAGS_true_vad.c_str(), "rb");
|
| - ASSERT_TRUE(true_vad_fid != NULL) << "Cannot open the active list " <<
|
| - FLAGS_true_vad;
|
| + ASSERT_TRUE(true_vad_fid != nullptr) << "Cannot open the active list "
|
| + << FLAGS_true_vad;
|
|
|
| - FILE* results_fid = NULL;
|
| + FILE* results_fid = nullptr;
|
| if (FLAGS_result.size() > 0) {
|
| // True if this is the first time writing to this function and we add a
|
| // header to the beginning of the file.
|
| @@ -189,7 +189,7 @@ void void_main(int argc, char* argv[]) {
|
| // Open in the read mode. If it fails, the file doesn't exist and has to
|
| // write a header for it. Otherwise no need to write a header.
|
| results_fid = fopen(FLAGS_result.c_str(), "r");
|
| - if (results_fid == NULL) {
|
| + if (results_fid == nullptr) {
|
| write_header = true;
|
| } else {
|
| fclose(results_fid);
|
| @@ -197,8 +197,9 @@ void void_main(int argc, char* argv[]) {
|
| }
|
| // Open in append mode.
|
| results_fid = fopen(FLAGS_result.c_str(), "a");
|
| - ASSERT_TRUE(results_fid != NULL) << "Cannot open the file, " <<
|
| - FLAGS_result << ", to write the results.";
|
| + ASSERT_TRUE(results_fid != nullptr) << "Cannot open the file, "
|
| + << FLAGS_result
|
| + << ", to write the results.";
|
| // Write the header if required.
|
| if (write_header) {
|
| fprintf(results_fid, "%% Total Active, Misdetection, "
|
| @@ -207,20 +208,22 @@ void void_main(int argc, char* argv[]) {
|
| }
|
| }
|
|
|
| - FILE* video_vad_fid = NULL;
|
| + FILE* video_vad_fid = nullptr;
|
| if (FLAGS_video_vad.size() > 0) {
|
| video_vad_fid = fopen(FLAGS_video_vad.c_str(), "rb");
|
| - ASSERT_TRUE(video_vad_fid != NULL) << "Cannot open the file, " <<
|
| - FLAGS_video_vad << " to read video-based VAD decisions.\n";
|
| + ASSERT_TRUE(video_vad_fid != nullptr)
|
| + << "Cannot open the file, " << FLAGS_video_vad
|
| + << " to read video-based VAD decisions.\n";
|
| }
|
|
|
| // AgsStat will be the owner of this file and will close it at its
|
| // destructor.
|
| - FILE* audio_content_fid = NULL;
|
| + FILE* audio_content_fid = nullptr;
|
| if (FLAGS_audio_content.size() > 0) {
|
| audio_content_fid = fopen(FLAGS_audio_content.c_str(), "wb");
|
| - ASSERT_TRUE(audio_content_fid != NULL) << "Cannot open file, " <<
|
| - FLAGS_audio_content << " to write audio-content.\n";
|
| + ASSERT_TRUE(audio_content_fid != nullptr) << "Cannot open file, "
|
| + << FLAGS_audio_content
|
| + << " to write audio-content.\n";
|
| agc_stat.set_audio_content_file(audio_content_fid);
|
| }
|
|
|
| @@ -257,7 +260,7 @@ void void_main(int argc, char* argv[]) {
|
| ASSERT_EQ(1u, fread(&true_vad[true_vad_index], sizeof(*true_vad), 1,
|
| true_vad_fid))
|
| << "Size mismatch between True-VAD and the PCM file.\n";
|
| - if (video_vad_fid != NULL) {
|
| + if (video_vad_fid != nullptr) {
|
| ASSERT_EQ(1u, fread(&p_video, sizeof(p_video), 1, video_vad_fid)) <<
|
| "Not enough video-based VAD probabilities.";
|
| }
|
| @@ -333,7 +336,7 @@ void void_main(int argc, char* argv[]) {
|
| }
|
| }
|
|
|
| - if (results_fid != NULL) {
|
| + if (results_fid != nullptr) {
|
| fprintf(results_fid, "%4d %4d %4d %4d %4d %4d %4.0f %4.0f\n",
|
| total_active,
|
| total_missed_detection,
|
| @@ -358,10 +361,10 @@ void void_main(int argc, char* argv[]) {
|
|
|
| fclose(true_vad_fid);
|
| fclose(pcm_fid);
|
| - if (video_vad_fid != NULL) {
|
| + if (video_vad_fid != nullptr) {
|
| fclose(video_vad_fid);
|
| }
|
| - if (results_fid != NULL) {
|
| + if (results_fid != nullptr) {
|
| fclose(results_fid);
|
| }
|
| }
|
|
|