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 <string> | 14 #include <string> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/common_video/libyuv/include/scaler.h" | 17 #include "webrtc/common_video/libyuv/include/scaler.h" |
18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
19 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 19 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
20 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" | 20 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" |
21 #include "webrtc/modules/video_coding/codecs/test/stats.h" | 21 #include "webrtc/modules/video_coding/codecs/test/stats.h" |
22 #include "webrtc/system_wrappers/include/tick_util.h" | |
23 #include "webrtc/test/testsupport/frame_reader.h" | 22 #include "webrtc/test/testsupport/frame_reader.h" |
24 #include "webrtc/test/testsupport/frame_writer.h" | 23 #include "webrtc/test/testsupport/frame_writer.h" |
25 #include "webrtc/video_frame.h" | 24 #include "webrtc/video_frame.h" |
26 | 25 |
27 namespace webrtc { | 26 namespace webrtc { |
28 namespace test { | 27 namespace test { |
29 | 28 |
30 // Defines which frame types shall be excluded from packet loss and when. | 29 // Defines which frame types shall be excluded from packet loss and when. |
31 enum ExcludeFrameTypes { | 30 enum ExcludeFrameTypes { |
32 // Will exclude the first keyframe in the video sequence from packet loss. | 31 // Will exclude the first keyframe in the video sequence from packet loss. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 171 |
173 private: | 172 private: |
174 // Invoked by the callback when a frame has completed encoding. | 173 // Invoked by the callback when a frame has completed encoding. |
175 void FrameEncoded(webrtc::VideoCodecType codec, | 174 void FrameEncoded(webrtc::VideoCodecType codec, |
176 const webrtc::EncodedImage& encodedImage, | 175 const webrtc::EncodedImage& encodedImage, |
177 const webrtc::RTPFragmentationHeader* fragmentation); | 176 const webrtc::RTPFragmentationHeader* fragmentation); |
178 // Invoked by the callback when a frame has completed decoding. | 177 // Invoked by the callback when a frame has completed decoding. |
179 void FrameDecoded(const webrtc::VideoFrame& image); | 178 void FrameDecoded(const webrtc::VideoFrame& image); |
180 // Used for getting a 32-bit integer representing time | 179 // Used for getting a 32-bit integer representing time |
181 // (checks the size is within signed 32-bit bounds before casting it) | 180 // (checks the size is within signed 32-bit bounds before casting it) |
182 int GetElapsedTimeMicroseconds(const webrtc::TickTime& start, | 181 int GetElapsedTimeMicroseconds(int64_t start, int64_t stop); |
183 const webrtc::TickTime& stop); | |
184 // Updates the encoder with the target bit rate and the frame rate. | 182 // Updates the encoder with the target bit rate and the frame rate. |
185 void SetRates(int bit_rate, int frame_rate) override; | 183 void SetRates(int bit_rate, int frame_rate) override; |
186 // Return the size of the encoded frame in bytes. | 184 // Return the size of the encoded frame in bytes. |
187 size_t EncodedFrameSize() override; | 185 size_t EncodedFrameSize() override; |
188 // Return the encoded frame type (key or delta). | 186 // Return the encoded frame type (key or delta). |
189 FrameType EncodedFrameType() override; | 187 FrameType EncodedFrameType() override; |
190 // Return the number of dropped frames. | 188 // Return the number of dropped frames. |
191 int NumberDroppedFrames() override; | 189 int NumberDroppedFrames() override; |
192 // Return the number of spatial resizes. | 190 // Return the number of spatial resizes. |
193 int NumberSpatialResizes() override; | 191 int NumberSpatialResizes() override; |
(...skipping 24 matching lines...) Expand all Loading... |
218 FrameType encoded_frame_type_; | 216 FrameType encoded_frame_type_; |
219 int prev_time_stamp_; | 217 int prev_time_stamp_; |
220 int num_dropped_frames_; | 218 int num_dropped_frames_; |
221 int num_spatial_resizes_; | 219 int num_spatial_resizes_; |
222 int last_encoder_frame_width_; | 220 int last_encoder_frame_width_; |
223 int last_encoder_frame_height_; | 221 int last_encoder_frame_height_; |
224 Scaler scaler_; | 222 Scaler scaler_; |
225 | 223 |
226 // Statistics | 224 // Statistics |
227 double bit_rate_factor_; // multiply frame length with this to get bit rate | 225 double bit_rate_factor_; // multiply frame length with this to get bit rate |
228 webrtc::TickTime encode_start_; | 226 int64_t encode_start_ns_; |
229 webrtc::TickTime decode_start_; | 227 int64_t decode_start_ns_; |
230 | 228 |
231 // Callback class required to implement according to the VideoEncoder API. | 229 // Callback class required to implement according to the VideoEncoder API. |
232 class VideoProcessorEncodeCompleteCallback | 230 class VideoProcessorEncodeCompleteCallback |
233 : public webrtc::EncodedImageCallback { | 231 : public webrtc::EncodedImageCallback { |
234 public: | 232 public: |
235 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) | 233 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) |
236 : video_processor_(vp) {} | 234 : video_processor_(vp) {} |
237 int32_t Encoded( | 235 int32_t Encoded( |
238 const webrtc::EncodedImage& encoded_image, | 236 const webrtc::EncodedImage& encoded_image, |
239 const webrtc::CodecSpecificInfo* codec_specific_info, | 237 const webrtc::CodecSpecificInfo* codec_specific_info, |
(...skipping 18 matching lines...) Expand all Loading... |
258 | 256 |
259 private: | 257 private: |
260 VideoProcessorImpl* video_processor_; | 258 VideoProcessorImpl* video_processor_; |
261 }; | 259 }; |
262 }; | 260 }; |
263 | 261 |
264 } // namespace test | 262 } // namespace test |
265 } // namespace webrtc | 263 } // namespace webrtc |
266 | 264 |
267 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ | 265 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
OLD | NEW |