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

Side by Side Diff: webrtc/modules/video_coding/test/test_util.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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 << extension; 62 << extension;
63 return ss.str(); 63 return ss.str();
64 } 64 }
65 65
66 } // namespace 66 } // namespace
67 67
68 FileOutputFrameReceiver::FileOutputFrameReceiver( 68 FileOutputFrameReceiver::FileOutputFrameReceiver(
69 const std::string& base_out_filename, 69 const std::string& base_out_filename,
70 uint32_t ssrc) 70 uint32_t ssrc)
71 : out_filename_(), 71 : out_filename_(),
72 out_file_(NULL), 72 out_file_(nullptr),
73 timing_file_(NULL), 73 timing_file_(nullptr),
74 width_(0), 74 width_(0),
75 height_(0), 75 height_(0),
76 count_(0) { 76 count_(0) {
77 std::string basename; 77 std::string basename;
78 std::string extension; 78 std::string extension;
79 if (base_out_filename.empty()) { 79 if (base_out_filename.empty()) {
80 basename = webrtc::test::OutputPath() + "rtp_decoded"; 80 basename = webrtc::test::OutputPath() + "rtp_decoded";
81 extension = "yuv"; 81 extension = "yuv";
82 } else { 82 } else {
83 SplitFilename(base_out_filename, &basename, &extension); 83 SplitFilename(base_out_filename, &basename, &extension);
84 } 84 }
85 std::stringstream ss; 85 std::stringstream ss;
86 ss << basename << "_" << std::hex << std::setw(8) << std::setfill('0') << ssrc 86 ss << basename << "_" << std::hex << std::setw(8) << std::setfill('0') << ssrc
87 << "." << extension; 87 << "." << extension;
88 out_filename_ = ss.str(); 88 out_filename_ = ss.str();
89 } 89 }
90 90
91 FileOutputFrameReceiver::~FileOutputFrameReceiver() { 91 FileOutputFrameReceiver::~FileOutputFrameReceiver() {
92 if (timing_file_ != NULL) { 92 if (timing_file_ != nullptr) {
93 fclose(timing_file_); 93 fclose(timing_file_);
94 } 94 }
95 if (out_file_ != NULL) { 95 if (out_file_ != nullptr) {
96 fclose(out_file_); 96 fclose(out_file_);
97 } 97 }
98 } 98 }
99 99
100 int32_t FileOutputFrameReceiver::FrameToRender(webrtc::VideoFrame& video_frame, 100 int32_t FileOutputFrameReceiver::FrameToRender(webrtc::VideoFrame& video_frame,
101 rtc::Optional<uint8_t> qp) { 101 rtc::Optional<uint8_t> qp) {
102 if (timing_file_ == NULL) { 102 if (timing_file_ == nullptr) {
103 std::string basename; 103 std::string basename;
104 std::string extension; 104 std::string extension;
105 SplitFilename(out_filename_, &basename, &extension); 105 SplitFilename(out_filename_, &basename, &extension);
106 timing_file_ = fopen((basename + "_renderTiming.txt").c_str(), "w"); 106 timing_file_ = fopen((basename + "_renderTiming.txt").c_str(), "w");
107 if (timing_file_ == NULL) { 107 if (timing_file_ == nullptr) {
108 return -1; 108 return -1;
109 } 109 }
110 } 110 }
111 if (out_file_ == NULL || video_frame.width() != width_ || 111 if (out_file_ == nullptr || video_frame.width() != width_ ||
112 video_frame.height() != height_) { 112 video_frame.height() != height_) {
113 if (out_file_) { 113 if (out_file_) {
114 fclose(out_file_); 114 fclose(out_file_);
115 } 115 }
116 printf("New size: %dx%d\n", video_frame.width(), video_frame.height()); 116 printf("New size: %dx%d\n", video_frame.width(), video_frame.height());
117 width_ = video_frame.width(); 117 width_ = video_frame.width();
118 height_ = video_frame.height(); 118 height_ = video_frame.height();
119 std::string filename_with_width_height = 119 std::string filename_with_width_height =
120 AppendWidthHeightCount(out_filename_, width_, height_, count_); 120 AppendWidthHeightCount(out_filename_, width_, height_, count_);
121 ++count_; 121 ++count_;
122 out_file_ = fopen(filename_with_width_height.c_str(), "wb"); 122 out_file_ = fopen(filename_with_width_height.c_str(), "wb");
123 if (out_file_ == NULL) { 123 if (out_file_ == nullptr) {
124 return -1; 124 return -1;
125 } 125 }
126 } 126 }
127 fprintf(timing_file_, "%u, %u\n", video_frame.timestamp(), 127 fprintf(timing_file_, "%u, %u\n", video_frame.timestamp(),
128 webrtc::MaskWord64ToUWord32(video_frame.render_time_ms())); 128 webrtc::MaskWord64ToUWord32(video_frame.render_time_ms()));
129 if (PrintVideoFrame(video_frame, out_file_) < 0) { 129 if (PrintVideoFrame(video_frame, out_file_) < 0) {
130 return -1; 130 return -1;
131 } 131 }
132 return 0; 132 return 0;
133 } 133 }
134 134
135 webrtc::RtpVideoCodecTypes ConvertCodecType(const char* plname) { 135 webrtc::RtpVideoCodecTypes ConvertCodecType(const char* plname) {
136 if (strncmp(plname, "VP8", 3) == 0) { 136 if (strncmp(plname, "VP8", 3) == 0) {
137 return webrtc::kRtpVideoVp8; 137 return webrtc::kRtpVideoVp8;
138 } else { 138 } else {
139 // Default value. 139 // Default value.
140 return webrtc::kRtpVideoGeneric; 140 return webrtc::kRtpVideoGeneric;
141 } 141 }
142 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698