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

Side by Side Diff: webrtc/video/replay.cc

Issue 1228913003: Remove empty-string comparisons. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | no next file » | 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 * 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 static int TransmissionOffsetId() { 99 static int TransmissionOffsetId() {
100 return static_cast<int>(FLAGS_transmission_offset_id); 100 return static_cast<int>(FLAGS_transmission_offset_id);
101 } 101 }
102 static const bool timestamp_offset_dummy = 102 static const bool timestamp_offset_dummy =
103 google::RegisterFlagValidator(&FLAGS_transmission_offset_id, 103 google::RegisterFlagValidator(&FLAGS_transmission_offset_id,
104 &ValidateRtpHeaderExtensionId); 104 &ValidateRtpHeaderExtensionId);
105 105
106 // Flag for rtpdump input file. 106 // Flag for rtpdump input file.
107 bool ValidateInputFilenameNotEmpty(const char* flagname, 107 bool ValidateInputFilenameNotEmpty(const char* flagname,
108 const std::string& string) { 108 const std::string& string) {
109 return string != ""; 109 return !string.empty();
110 } 110 }
111 111
112 DEFINE_string(input_file, "", "input file"); 112 DEFINE_string(input_file, "", "input file");
113 static std::string InputFile() { 113 static std::string InputFile() {
114 return static_cast<std::string>(FLAGS_input_file); 114 return static_cast<std::string>(FLAGS_input_file);
115 } 115 }
116 static const bool input_file_dummy = 116 static const bool input_file_dummy =
117 google::RegisterFlagValidator(&FLAGS_input_file, 117 google::RegisterFlagValidator(&FLAGS_input_file,
118 &ValidateInputFilenameNotEmpty); 118 &ValidateInputFilenameNotEmpty);
119 119
(...skipping 29 matching lines...) Expand all
149 ~FileRenderPassthrough() { 149 ~FileRenderPassthrough() {
150 if (file_ != nullptr) 150 if (file_ != nullptr)
151 fclose(file_); 151 fclose(file_);
152 } 152 }
153 153
154 private: 154 private:
155 void RenderFrame(const VideoFrame& video_frame, 155 void RenderFrame(const VideoFrame& video_frame,
156 int time_to_render_ms) override { 156 int time_to_render_ms) override {
157 if (renderer_ != nullptr) 157 if (renderer_ != nullptr)
158 renderer_->RenderFrame(video_frame, time_to_render_ms); 158 renderer_->RenderFrame(video_frame, time_to_render_ms);
159 if (basename_ == "") 159 if (basename_.empty())
160 return; 160 return;
161 if (last_width_ != video_frame.width() || 161 if (last_width_ != video_frame.width() ||
162 last_height_ != video_frame.height()) { 162 last_height_ != video_frame.height()) {
163 if (file_ != nullptr) 163 if (file_ != nullptr)
164 fclose(file_); 164 fclose(file_);
165 std::stringstream filename; 165 std::stringstream filename;
166 filename << basename_; 166 filename << basename_;
167 if (++count_ > 1) 167 if (++count_ > 1)
168 filename << '-' << count_; 168 filename << '-' << count_;
169 filename << '_' << video_frame.width() << 'x' << video_frame.height() 169 filename << '_' << video_frame.width() << 'x' << video_frame.height()
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 receive_config.rtp.extensions.push_back( 234 receive_config.rtp.extensions.push_back(
235 RtpExtension(RtpExtension::kAbsSendTime, flags::AbsSendTimeId())); 235 RtpExtension(RtpExtension::kAbsSendTime, flags::AbsSendTimeId()));
236 } 236 }
237 receive_config.renderer = &file_passthrough; 237 receive_config.renderer = &file_passthrough;
238 238
239 VideoSendStream::Config::EncoderSettings encoder_settings; 239 VideoSendStream::Config::EncoderSettings encoder_settings;
240 encoder_settings.payload_name = flags::Codec(); 240 encoder_settings.payload_name = flags::Codec();
241 encoder_settings.payload_type = flags::PayloadType(); 241 encoder_settings.payload_type = flags::PayloadType();
242 VideoReceiveStream::Decoder decoder; 242 VideoReceiveStream::Decoder decoder;
243 rtc::scoped_ptr<DecoderBitstreamFileWriter> bitstream_writer; 243 rtc::scoped_ptr<DecoderBitstreamFileWriter> bitstream_writer;
244 if (flags::DecoderBitstreamFilename() != "") { 244 if (!flags::DecoderBitstreamFilename().empty()) {
245 bitstream_writer.reset(new DecoderBitstreamFileWriter( 245 bitstream_writer.reset(new DecoderBitstreamFileWriter(
246 flags::DecoderBitstreamFilename().c_str())); 246 flags::DecoderBitstreamFilename().c_str()));
247 receive_config.pre_decode_callback = bitstream_writer.get(); 247 receive_config.pre_decode_callback = bitstream_writer.get();
248 } 248 }
249 decoder = test::CreateMatchingDecoder(encoder_settings); 249 decoder = test::CreateMatchingDecoder(encoder_settings);
250 if (flags::DecoderBitstreamFilename() != "") { 250 if (!flags::DecoderBitstreamFilename().empty()) {
251 // Replace with a null decoder if we're writing the bitstream to a file 251 // Replace with a null decoder if we're writing the bitstream to a file
252 // instead. 252 // instead.
253 delete decoder.decoder; 253 delete decoder.decoder;
254 decoder.decoder = new test::FakeNullDecoder(); 254 decoder.decoder = new test::FakeNullDecoder();
255 } 255 }
256 receive_config.decoders.push_back(decoder); 256 receive_config.decoders.push_back(decoder);
257 257
258 VideoReceiveStream* receive_stream = 258 VideoReceiveStream* receive_stream =
259 call->CreateVideoReceiveStream(receive_config); 259 call->CreateVideoReceiveStream(receive_config);
260 260
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 } // namespace webrtc 325 } // namespace webrtc
326 326
327 int main(int argc, char* argv[]) { 327 int main(int argc, char* argv[]) {
328 ::testing::InitGoogleTest(&argc, argv); 328 ::testing::InitGoogleTest(&argc, argv);
329 google::ParseCommandLineFlags(&argc, &argv, true); 329 google::ParseCommandLineFlags(&argc, &argv, true);
330 330
331 webrtc::test::RunTest(webrtc::RtpReplay); 331 webrtc::test::RunTest(webrtc::RtpReplay);
332 return 0; 332 return 0;
333 } 333 }
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698