Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
| 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "webrtc/api/video/video_frame.h" | 17 #include "webrtc/api/video/video_frame.h" |
| 18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| 21 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" | 21 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" |
| 22 #include "webrtc/modules/video_coding/codecs/test/stats.h" | 22 #include "webrtc/modules/video_coding/codecs/test/stats.h" |
| 23 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | |
| 23 #include "webrtc/test/testsupport/frame_reader.h" | 24 #include "webrtc/test/testsupport/frame_reader.h" |
| 24 #include "webrtc/test/testsupport/frame_writer.h" | 25 #include "webrtc/test/testsupport/frame_writer.h" |
| 25 | 26 |
| 26 namespace webrtc { | 27 namespace webrtc { |
| 27 | 28 |
| 28 class VideoBitrateAllocator; | 29 class VideoBitrateAllocator; |
| 29 | 30 |
| 30 namespace test { | 31 namespace test { |
| 31 | 32 |
| 32 // Defines which frame types shall be excluded from packet loss and when. | 33 // Defines which frame types shall be excluded from packet loss and when. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 virtual int NumberDroppedFrames() = 0; | 155 virtual int NumberDroppedFrames() = 0; |
| 155 | 156 |
| 156 // Return the number of spatial resizes. | 157 // Return the number of spatial resizes. |
| 157 virtual int NumberSpatialResizes() = 0; | 158 virtual int NumberSpatialResizes() = 0; |
| 158 }; | 159 }; |
| 159 | 160 |
| 160 class VideoProcessorImpl : public VideoProcessor { | 161 class VideoProcessorImpl : public VideoProcessor { |
| 161 public: | 162 public: |
| 162 VideoProcessorImpl(webrtc::VideoEncoder* encoder, | 163 VideoProcessorImpl(webrtc::VideoEncoder* encoder, |
| 163 webrtc::VideoDecoder* decoder, | 164 webrtc::VideoDecoder* decoder, |
| 164 FrameReader* frame_reader, | 165 FrameReader* analysis_frame_reader, |
| 165 FrameWriter* frame_writer, | 166 FrameWriter* analysis_frame_writer, |
| 166 PacketManipulator* packet_manipulator, | 167 PacketManipulator* packet_manipulator, |
| 167 const TestConfig& config, | 168 const TestConfig& config, |
| 168 Stats* stats); | 169 Stats* stats, |
| 170 FrameWriter* source_frame_writer, | |
| 171 IvfFileWriter* encoded_frame_writer, | |
| 172 FrameWriter* decoded_frame_writer); | |
|
sprang_webrtc
2017/02/17 10:08:22
What's the difference between analysis_frame_write
brandtr
2017/02/20 13:17:31
Done.
The difference is very small: |decoded_fram
| |
| 169 virtual ~VideoProcessorImpl(); | 173 virtual ~VideoProcessorImpl(); |
| 170 bool Init() override; | 174 bool Init() override; |
| 171 bool ProcessFrame(int frame_number) override; | 175 bool ProcessFrame(int frame_number) override; |
| 172 | 176 |
| 173 private: | 177 private: |
| 174 // Callback class required to implement according to the VideoEncoder API. | 178 // Callback class required to implement according to the VideoEncoder API. |
| 175 class VideoProcessorEncodeCompleteCallback | 179 class VideoProcessorEncodeCompleteCallback |
| 176 : public webrtc::EncodedImageCallback { | 180 : public webrtc::EncodedImageCallback { |
| 177 public: | 181 public: |
| 178 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) | 182 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 | 245 |
| 242 // Return the number of dropped frames. | 246 // Return the number of dropped frames. |
| 243 int NumberDroppedFrames() override; | 247 int NumberDroppedFrames() override; |
| 244 | 248 |
| 245 // Return the number of spatial resizes. | 249 // Return the number of spatial resizes. |
| 246 int NumberSpatialResizes() override; | 250 int NumberSpatialResizes() override; |
| 247 | 251 |
| 248 webrtc::VideoEncoder* const encoder_; | 252 webrtc::VideoEncoder* const encoder_; |
| 249 webrtc::VideoDecoder* const decoder_; | 253 webrtc::VideoDecoder* const decoder_; |
| 250 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_; | 254 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_; |
| 251 FrameReader* const frame_reader_; | 255 FrameReader* const analysis_frame_reader_; |
| 252 FrameWriter* const frame_writer_; | 256 FrameWriter* const analysis_frame_writer_; |
| 253 PacketManipulator* const packet_manipulator_; | 257 PacketManipulator* const packet_manipulator_; |
| 254 const TestConfig& config_; | 258 const TestConfig& config_; |
| 255 Stats* stats_; | 259 Stats* stats_; |
| 260 FrameWriter* const source_frame_writer_; | |
| 261 IvfFileWriter* const encoded_frame_writer_; | |
| 262 FrameWriter* const decoded_frame_writer_; | |
| 256 | 263 |
| 257 std::unique_ptr<EncodedImageCallback> encode_callback_; | 264 std::unique_ptr<EncodedImageCallback> encode_callback_; |
| 258 std::unique_ptr<DecodedImageCallback> decode_callback_; | 265 std::unique_ptr<DecodedImageCallback> decode_callback_; |
| 259 | 266 |
| 260 // Keep track of the last successful frame, since we need to write that | 267 // Keep track of the last successful frame, since we need to write that |
| 261 // when decoding fails. | 268 // when decoding fails. |
| 262 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_; | 269 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_; |
| 263 // To keep track of if we have excluded the first key frame from packet loss. | 270 // To keep track of if we have excluded the first key frame from packet loss. |
| 264 bool first_key_frame_has_been_excluded_; | 271 bool first_key_frame_has_been_excluded_; |
| 265 // To tell the decoder previous frame have been dropped due to packet loss. | 272 // To tell the decoder previous frame have been dropped due to packet loss. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 277 // Statistics. | 284 // Statistics. |
| 278 double bit_rate_factor_; // Multiply frame length with this to get bit rate. | 285 double bit_rate_factor_; // Multiply frame length with this to get bit rate. |
| 279 int64_t encode_start_ns_; | 286 int64_t encode_start_ns_; |
| 280 int64_t decode_start_ns_; | 287 int64_t decode_start_ns_; |
| 281 }; | 288 }; |
| 282 | 289 |
| 283 } // namespace test | 290 } // namespace test |
| 284 } // namespace webrtc | 291 } // namespace webrtc |
| 285 | 292 |
| 286 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ | 293 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
| OLD | NEW |