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

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.h

Issue 2946263002: Make VideoProcessor::Init void (always returning true). (Closed)
Patch Set: fix warning Created 3 years, 6 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 | « no previous file | webrtc/modules/video_coding/codecs/test/videoprocessor.cc » ('j') | 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Packet loss in such important frames is handled on a higher level in the 129 // Packet loss in such important frames is handled on a higher level in the
130 // Video Engine, where signaling would request a retransmit of the lost packets, 130 // Video Engine, where signaling would request a retransmit of the lost packets,
131 // since they're so important. 131 // since they're so important.
132 // 132 //
133 // Note this class is not thread safe in any way and is meant for simple testing 133 // Note this class is not thread safe in any way and is meant for simple testing
134 // purposes. 134 // purposes.
135 class VideoProcessor { 135 class VideoProcessor {
136 public: 136 public:
137 virtual ~VideoProcessor() {} 137 virtual ~VideoProcessor() {}
138 138
139 // Performs initial calculations about frame size, sets up callbacks etc. 139 // Sets up callbacks and initializes the encoder and decoder.
140 // Returns false if an error has occurred, in addition to printing to stderr. 140 virtual void Init() = 0;
141 virtual bool Init() = 0;
142 141
143 // Processes a single frame. Returns true as long as there's more frames 142 // Processes a single frame. Returns true as long as there's more frames
144 // available in the source clip. 143 // available in the source clip.
145 // Frame number must be an integer >= 0. 144 // Frame number must be an integer >= 0.
146 virtual bool ProcessFrame(int frame_number) = 0; 145 virtual bool ProcessFrame(int frame_number) = 0;
147 146
148 // Updates the encoder with the target bit rate and the frame rate. 147 // Updates the encoder with the target bit rate and the frame rate.
149 virtual void SetRates(int bit_rate, int frame_rate) = 0; 148 virtual void SetRates(int bit_rate, int frame_rate) = 0;
150 149
151 // Return the size of the encoded frame in bytes. Dropped frames by the 150 // Return the size of the encoded frame in bytes. Dropped frames by the
(...skipping 22 matching lines...) Expand all
174 webrtc::VideoDecoder* decoder, 173 webrtc::VideoDecoder* decoder,
175 FrameReader* analysis_frame_reader, 174 FrameReader* analysis_frame_reader,
176 FrameWriter* analysis_frame_writer, 175 FrameWriter* analysis_frame_writer,
177 PacketManipulator* packet_manipulator, 176 PacketManipulator* packet_manipulator,
178 const TestConfig& config, 177 const TestConfig& config,
179 Stats* stats, 178 Stats* stats,
180 FrameWriter* source_frame_writer, 179 FrameWriter* source_frame_writer,
181 IvfFileWriter* encoded_frame_writer, 180 IvfFileWriter* encoded_frame_writer,
182 FrameWriter* decoded_frame_writer); 181 FrameWriter* decoded_frame_writer);
183 virtual ~VideoProcessorImpl(); 182 virtual ~VideoProcessorImpl();
184 bool Init() override; 183 void Init() override;
185 bool ProcessFrame(int frame_number) override; 184 bool ProcessFrame(int frame_number) override;
186 185
187 private: 186 private:
188 // Container that holds per-frame information that needs to be stored between 187 // Container that holds per-frame information that needs to be stored between
189 // calls to Encode and Decode, as well as the corresponding callbacks. It is 188 // calls to Encode and Decode, as well as the corresponding callbacks. It is
190 // not directly used for statistics -- for that, test::FrameStatistic is used. 189 // not directly used for statistics -- for that, test::FrameStatistic is used.
191 struct FrameInfo { 190 struct FrameInfo {
192 FrameInfo() 191 FrameInfo()
193 : timestamp(0), 192 : timestamp(0),
194 encode_start_ns(0), 193 encode_start_ns(0),
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const std::unique_ptr<EncodedImageCallback> encode_callback_; 296 const std::unique_ptr<EncodedImageCallback> encode_callback_;
298 const std::unique_ptr<DecodedImageCallback> decode_callback_; 297 const std::unique_ptr<DecodedImageCallback> decode_callback_;
299 298
300 PacketManipulator* const packet_manipulator_; 299 PacketManipulator* const packet_manipulator_;
301 const TestConfig& config_; 300 const TestConfig& config_;
302 301
303 // These (mandatory) file manipulators are used for, e.g., objective PSNR and 302 // These (mandatory) file manipulators are used for, e.g., objective PSNR and
304 // SSIM calculations at the end of a test run. 303 // SSIM calculations at the end of a test run.
305 FrameReader* const analysis_frame_reader_; 304 FrameReader* const analysis_frame_reader_;
306 FrameWriter* const analysis_frame_writer_; 305 FrameWriter* const analysis_frame_writer_;
307 const int num_frames_;
308 306
309 // These (optional) file writers are used for persistently storing the output 307 // These (optional) file writers are used for persistently storing the output
310 // of the coding pipeline at different stages: pre encode (source), post 308 // of the coding pipeline at different stages: pre encode (source), post
311 // encode (encoded), and post decode (decoded). The purpose is to give the 309 // encode (encoded), and post decode (decoded). The purpose is to give the
312 // experimenter an option to subjectively evaluate the quality of the 310 // experimenter an option to subjectively evaluate the quality of the
313 // encoding, given the test settings. Each frame writer is enabled by being 311 // encoding, given the test settings. Each frame writer is enabled by being
314 // non-null. 312 // non-null.
315 FrameWriter* const source_frame_writer_; 313 FrameWriter* const source_frame_writer_;
316 IvfFileWriter* const encoded_frame_writer_; 314 IvfFileWriter* const encoded_frame_writer_;
317 FrameWriter* const decoded_frame_writer_; 315 FrameWriter* const decoded_frame_writer_;
318 316
319 // Multiply frame length with this to get bit rate.
320 const double bit_rate_factor_;
321
322 bool initialized_; 317 bool initialized_;
323 318
324 // Frame metadata for all frames that have been added through a call to 319 // Frame metadata for all frames that have been added through a call to
325 // ProcessFrames(). We need to store this metadata over the course of the 320 // ProcessFrames(). We need to store this metadata over the course of the
326 // test run, to support pipelining HW codecs. 321 // test run, to support pipelining HW codecs.
327 std::vector<FrameInfo> frame_infos_; 322 std::vector<FrameInfo> frame_infos_;
328 int last_encoded_frame_num_; 323 int last_encoded_frame_num_;
329 int last_decoded_frame_num_; 324 int last_decoded_frame_num_;
330 325
331 // Keep track of if we have excluded the first key frame from packet loss. 326 // Keep track of if we have excluded the first key frame from packet loss.
332 bool first_key_frame_has_been_excluded_; 327 bool first_key_frame_has_been_excluded_;
333 328
334 // Keep track of the last successfully decoded frame, since we write that 329 // Keep track of the last successfully decoded frame, since we write that
335 // frame to disk when decoding fails. 330 // frame to disk when decoding fails.
336 rtc::Buffer last_decoded_frame_buffer_; 331 rtc::Buffer last_decoded_frame_buffer_;
337 332
338 // Statistics. 333 // Statistics.
339 Stats* stats_; 334 Stats* stats_;
340 int num_dropped_frames_; 335 int num_dropped_frames_;
341 int num_spatial_resizes_; 336 int num_spatial_resizes_;
342 }; 337 };
343 338
344 } // namespace test 339 } // namespace test
345 } // namespace webrtc 340 } // namespace webrtc
346 341
347 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ 342 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/test/videoprocessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698