kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 1 | /* |
marpan@webrtc.org | f4c2de9 | 2012-06-05 21:07:28 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
kjellander@webrtc.org | 5b97b12 | 2011-12-08 07:42:18 +0000 | [diff] [blame] | 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
| 12 | #define MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 13 | |
brandtr | b57f426 | 2017-08-30 06:29:51 -0700 | [diff] [blame] | 14 | #include <map> |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 15 | #include <memory> |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 16 | #include <string> |
brandtr | 17b958c | 2017-03-07 01:41:43 -0800 | [diff] [blame] | 17 | #include <vector> |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 18 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 19 | #include "api/video/video_frame.h" |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 20 | #include "common_video/include/video_bitrate_allocator.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #include "modules/video_coding/codecs/test/stats.h" |
Åsa Persson | 2d27fb5 | 2017-10-19 14:05:50 +0200 | [diff] [blame] | 22 | #include "modules/video_coding/codecs/test/test_config.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 23 | #include "modules/video_coding/utility/ivf_file_writer.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "rtc_base/buffer.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "rtc_base/constructormagic.h" |
| 26 | #include "rtc_base/sequenced_task_checker.h" |
| 27 | #include "rtc_base/task_queue.h" |
| 28 | #include "test/testsupport/frame_reader.h" |
| 29 | #include "test/testsupport/frame_writer.h" |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 30 | |
| 31 | namespace webrtc { |
| 32 | namespace test { |
| 33 | |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 34 | // Handles encoding/decoding of video using the VideoEncoder/VideoDecoder |
| 35 | // interfaces. This is done in a sequential manner in order to be able to |
| 36 | // measure times properly. |
| 37 | // The class processes a frame at the time for the configured input file. |
| 38 | // It maintains state of where in the source input file the processing is at. |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 39 | class VideoProcessor { |
| 40 | public: |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 41 | using VideoDecoderList = std::vector<std::unique_ptr<VideoDecoder>>; |
| 42 | using IvfFileWriterList = std::vector<std::unique_ptr<IvfFileWriter>>; |
| 43 | using FrameWriterList = std::vector<std::unique_ptr<FrameWriter>>; |
| 44 | |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 45 | VideoProcessor(webrtc::VideoEncoder* encoder, |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 46 | VideoDecoderList* decoders, |
| 47 | FrameReader* input_frame_reader, |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 48 | const TestConfig& config, |
Sergey Silkin | 06a8f30 | 2018-02-20 09:48:26 +0100 | [diff] [blame] | 49 | Stats* stats, |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 50 | IvfFileWriterList* encoded_frame_writers, |
| 51 | FrameWriterList* decoded_frame_writers); |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 52 | ~VideoProcessor(); |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 53 | |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 54 | // Reads a frame and sends it to the encoder. When the encode callback |
| 55 | // is received, the encoded frame is buffered. After encoding is finished |
| 56 | // buffered frame is sent to decoder. Quality evaluation is done in |
| 57 | // the decode callback. |
brandtr | 8935d97 | 2017-09-06 01:53:22 -0700 | [diff] [blame] | 58 | void ProcessFrame(); |
marpan@webrtc.org | f4c2de9 | 2012-06-05 21:07:28 +0000 | [diff] [blame] | 59 | |
brandtr | bdd555c | 2017-08-21 01:34:04 -0700 | [diff] [blame] | 60 | // Updates the encoder with target rates. Must be called at least once. |
Sergey Silkin | 3be2a55 | 2018-01-17 15:11:44 +0100 | [diff] [blame] | 61 | void SetRates(size_t bitrate_kbps, size_t framerate_fps); |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 62 | |
| 63 | private: |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 64 | class VideoProcessorEncodeCompleteCallback |
pbos@webrtc.org | 7f7162a | 2013-07-30 15:18:31 +0000 | [diff] [blame] | 65 | : public webrtc::EncodedImageCallback { |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 66 | public: |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 67 | explicit VideoProcessorEncodeCompleteCallback( |
| 68 | VideoProcessor* video_processor) |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 69 | : video_processor_(video_processor), |
Rasmus Brandt | 4b381af | 2018-02-07 13:56:16 +0100 | [diff] [blame] | 70 | task_queue_(rtc::TaskQueue::Current()) { |
Rasmus Brandt | 5f7a891 | 2018-02-28 17:17:15 +0100 | [diff] [blame] | 71 | RTC_DCHECK(video_processor_); |
Rasmus Brandt | 4b381af | 2018-02-07 13:56:16 +0100 | [diff] [blame] | 72 | RTC_DCHECK(task_queue_); |
| 73 | } |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 74 | |
Sergey Ulanov | 525df3f | 2016-08-02 17:46:41 -0700 | [diff] [blame] | 75 | Result OnEncodedImage( |
pbos@webrtc.org | 273a414 | 2014-12-01 15:23:21 +0000 | [diff] [blame] | 76 | const webrtc::EncodedImage& encoded_image, |
| 77 | const webrtc::CodecSpecificInfo* codec_specific_info, |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 78 | const webrtc::RTPFragmentationHeader* fragmentation) override { |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 79 | RTC_CHECK(codec_specific_info); |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 80 | |
Rasmus Brandt | 4b381af | 2018-02-07 13:56:16 +0100 | [diff] [blame] | 81 | // Post the callback to the right task queue, if needed. |
| 82 | if (!task_queue_->IsCurrent()) { |
brandtr | 4553562 | 2017-08-22 03:33:11 -0700 | [diff] [blame] | 83 | task_queue_->PostTask( |
| 84 | std::unique_ptr<rtc::QueuedTask>(new EncodeCallbackTask( |
| 85 | video_processor_, encoded_image, codec_specific_info))); |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 86 | return Result(Result::OK, 0); |
| 87 | } |
| 88 | |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 89 | video_processor_->FrameEncoded(encoded_image, *codec_specific_info); |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 90 | return Result(Result::OK, 0); |
| 91 | } |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 92 | |
| 93 | private: |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 94 | class EncodeCallbackTask : public rtc::QueuedTask { |
| 95 | public: |
| 96 | EncodeCallbackTask(VideoProcessor* video_processor, |
| 97 | const webrtc::EncodedImage& encoded_image, |
brandtr | 4553562 | 2017-08-22 03:33:11 -0700 | [diff] [blame] | 98 | const webrtc::CodecSpecificInfo* codec_specific_info) |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 99 | : video_processor_(video_processor), |
| 100 | buffer_(encoded_image._buffer, encoded_image._length), |
| 101 | encoded_image_(encoded_image), |
| 102 | codec_specific_info_(*codec_specific_info) { |
| 103 | encoded_image_._buffer = buffer_.data(); |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | bool Run() override { |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 107 | video_processor_->FrameEncoded(encoded_image_, codec_specific_info_); |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 108 | return true; |
| 109 | } |
| 110 | |
| 111 | private: |
| 112 | VideoProcessor* const video_processor_; |
| 113 | rtc::Buffer buffer_; |
| 114 | webrtc::EncodedImage encoded_image_; |
| 115 | const webrtc::CodecSpecificInfo codec_specific_info_; |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 116 | }; |
| 117 | |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 118 | VideoProcessor* const video_processor_; |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 119 | rtc::TaskQueue* const task_queue_; |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 120 | }; |
| 121 | |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 122 | class VideoProcessorDecodeCompleteCallback |
philipel | cce46fc | 2015-12-21 03:04:49 -0800 | [diff] [blame] | 123 | : public webrtc::DecodedImageCallback { |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 124 | public: |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 125 | explicit VideoProcessorDecodeCompleteCallback( |
| 126 | VideoProcessor* video_processor) |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 127 | : video_processor_(video_processor), |
Rasmus Brandt | 4b381af | 2018-02-07 13:56:16 +0100 | [diff] [blame] | 128 | task_queue_(rtc::TaskQueue::Current()) { |
Rasmus Brandt | 5f7a891 | 2018-02-28 17:17:15 +0100 | [diff] [blame] | 129 | RTC_DCHECK(video_processor_); |
Rasmus Brandt | 4b381af | 2018-02-07 13:56:16 +0100 | [diff] [blame] | 130 | RTC_DCHECK(task_queue_); |
| 131 | } |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 132 | |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 133 | int32_t Decoded(webrtc::VideoFrame& image) override { |
Rasmus Brandt | 4b381af | 2018-02-07 13:56:16 +0100 | [diff] [blame] | 134 | // Post the callback to the right task queue, if needed. |
| 135 | if (!task_queue_->IsCurrent()) { |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 136 | task_queue_->PostTask( |
| 137 | [this, image]() { video_processor_->FrameDecoded(image); }); |
| 138 | return 0; |
| 139 | } |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 140 | video_processor_->FrameDecoded(image); |
| 141 | return 0; |
| 142 | } |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 143 | |
philipel | cce46fc | 2015-12-21 03:04:49 -0800 | [diff] [blame] | 144 | int32_t Decoded(webrtc::VideoFrame& image, |
| 145 | int64_t decode_time_ms) override { |
brandtr | 6bb8e0e | 2017-02-20 04:35:52 -0800 | [diff] [blame] | 146 | return Decoded(image); |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 147 | } |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 148 | |
brandtr | 6bb8e0e | 2017-02-20 04:35:52 -0800 | [diff] [blame] | 149 | void Decoded(webrtc::VideoFrame& image, |
sakal | cc452e1 | 2017-02-09 04:53:45 -0800 | [diff] [blame] | 150 | rtc::Optional<int32_t> decode_time_ms, |
| 151 | rtc::Optional<uint8_t> qp) override { |
brandtr | bea36fd | 2017-08-07 03:36:54 -0700 | [diff] [blame] | 152 | Decoded(image); |
sakal | cc452e1 | 2017-02-09 04:53:45 -0800 | [diff] [blame] | 153 | } |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 154 | |
| 155 | private: |
brandtr | c409552 | 2017-08-07 08:12:33 -0700 | [diff] [blame] | 156 | VideoProcessor* const video_processor_; |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 157 | rtc::TaskQueue* const task_queue_; |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 158 | }; |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 159 | |
brandtr | bdd555c | 2017-08-21 01:34:04 -0700 | [diff] [blame] | 160 | // Invoked by the callback adapter when a frame has completed encoding. |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 161 | void FrameEncoded(const webrtc::EncodedImage& encoded_image, |
| 162 | const webrtc::CodecSpecificInfo& codec_specific); |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 163 | |
brandtr | bdd555c | 2017-08-21 01:34:04 -0700 | [diff] [blame] | 164 | // Invoked by the callback adapter when a frame has completed decoding. |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 165 | void FrameDecoded(const webrtc::VideoFrame& image); |
| 166 | |
Rasmus Brandt | 0f1c0bd | 2018-03-12 10:01:16 +0100 | [diff] [blame] | 167 | // In order to supply the SVC decoders with super frames containing all |
| 168 | // lower layer frames, we merge and store the layer frames in this method. |
| 169 | const webrtc::EncodedImage* MergeAndStoreEncodedImageForSvcDecoding( |
| 170 | const EncodedImage& encoded_image, |
| 171 | const VideoCodecType codec, |
| 172 | size_t frame_number, |
| 173 | size_t simulcast_svc_idx) RTC_RUN_ON(sequence_checker_); |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 174 | |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 175 | // Test input/output. |
danilchap | 56359be | 2017-09-07 07:53:45 -0700 | [diff] [blame] | 176 | TestConfig config_ RTC_GUARDED_BY(sequence_checker_); |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 177 | const size_t num_simulcast_or_spatial_layers_; |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 178 | Stats* const stats_; |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 179 | |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 180 | // Codecs. |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 181 | webrtc::VideoEncoder* const encoder_; |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 182 | VideoDecoderList* const decoders_; |
brandtr | aebc61e | 2017-02-28 07:13:47 -0800 | [diff] [blame] | 183 | const std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_; |
Sergey Silkin | 3be2a55 | 2018-01-17 15:11:44 +0100 | [diff] [blame] | 184 | BitrateAllocation bitrate_allocation_ RTC_GUARDED_BY(sequence_checker_); |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 185 | uint32_t framerate_fps_ RTC_GUARDED_BY(sequence_checker_); |
brandtr | aebc61e | 2017-02-28 07:13:47 -0800 | [diff] [blame] | 186 | |
| 187 | // Adapters for the codec callbacks. |
brandtr | bdd555c | 2017-08-21 01:34:04 -0700 | [diff] [blame] | 188 | VideoProcessorEncodeCompleteCallback encode_callback_; |
| 189 | VideoProcessorDecodeCompleteCallback decode_callback_; |
brandtr | aebc61e | 2017-02-28 07:13:47 -0800 | [diff] [blame] | 190 | |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 191 | // Each call to ProcessFrame() will read one frame from |input_frame_reader_|. |
| 192 | FrameReader* const input_frame_reader_; |
| 193 | |
| 194 | // Input frames are used as reference for frame quality evaluations. |
Sergey Silkin | 64eaa99 | 2017-11-17 14:47:32 +0100 | [diff] [blame] | 195 | // Async codecs might queue frames. To handle that we keep input frame |
| 196 | // and release it after corresponding coded frame is decoded and quality |
| 197 | // measurement is done. |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 198 | // frame_number -> frame. |
| 199 | std::map<size_t, VideoFrame> input_frames_ RTC_GUARDED_BY(sequence_checker_); |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 200 | |
| 201 | // Encoder delivers coded frame layer-by-layer. We store coded frames and |
| 202 | // then, after all layers are encoded, decode them. Such separation of |
| 203 | // frame processing on superframe level simplifies encoding/decoding time |
| 204 | // measurement. |
Rasmus Brandt | 0f1c0bd | 2018-03-12 10:01:16 +0100 | [diff] [blame] | 205 | // simulcast_svc_idx -> merged SVC encoded frame. |
| 206 | std::vector<EncodedImage> merged_encoded_frames_ |
Sergey Silkin | 10d9d59 | 2018-02-01 13:25:17 +0100 | [diff] [blame] | 207 | RTC_GUARDED_BY(sequence_checker_); |
| 208 | |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 209 | // These (optional) file writers are used to persistently store the encoded |
| 210 | // and decoded bitstreams. Each frame writer is enabled by being non-null. |
| 211 | IvfFileWriterList* const encoded_frame_writers_; |
| 212 | FrameWriterList* const decoded_frame_writers_; |
| 213 | rtc::Buffer tmp_i420_buffer_; // Temp storage for format conversion. |
brandtr | 8bc9385 | 2017-02-15 05:19:51 -0800 | [diff] [blame] | 214 | |
Rasmus Brandt | 0f1c0bd | 2018-03-12 10:01:16 +0100 | [diff] [blame] | 215 | // Metadata for inputed/encoded/decoded frames. Used for frame identification, |
| 216 | // frame drop detection, etc. We assume that encoded/decoded frames are |
| 217 | // ordered within each simulcast/spatial layer, but we do not make any |
| 218 | // assumptions of frame ordering between layers. |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 219 | size_t last_inputed_frame_num_ RTC_GUARDED_BY(sequence_checker_); |
| 220 | size_t last_inputed_timestamp_ RTC_GUARDED_BY(sequence_checker_); |
Rasmus Brandt | 0f1c0bd | 2018-03-12 10:01:16 +0100 | [diff] [blame] | 221 | // simulcast_svc_idx -> encode status. |
| 222 | std::vector<bool> first_encoded_frame_ RTC_GUARDED_BY(sequence_checker_); |
| 223 | // simulcast_svc_idx -> frame_number. |
| 224 | std::vector<size_t> last_encoded_frame_num_ RTC_GUARDED_BY(sequence_checker_); |
| 225 | // simulcast_svc_idx -> decode status. |
| 226 | std::vector<bool> first_decoded_frame_ RTC_GUARDED_BY(sequence_checker_); |
| 227 | // simulcast_svc_idx -> frame_number. |
| 228 | std::vector<size_t> last_decoded_frame_num_ RTC_GUARDED_BY(sequence_checker_); |
| 229 | // frame size (pixels) -> simulcast_svc_idx. |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 230 | std::map<size_t, size_t> frame_wxh_to_simulcast_svc_idx_ |
| 231 | RTC_GUARDED_BY(sequence_checker_); |
| 232 | |
Sergey Silkin | c89eed9 | 2018-04-01 23:57:51 +0200 | [diff] [blame^] | 233 | // Time spent in frame encode callback. It is accumulated for layers and |
| 234 | // reset when frame encode starts. When next layer is encoded post-encode time |
| 235 | // is substracted from measured encode time. Thus we get pure encode time. |
| 236 | int64_t post_encode_time_ns_ RTC_GUARDED_BY(sequence_checker_); |
| 237 | |
Rasmus Brandt | d062a3c | 2018-03-08 16:45:54 +0100 | [diff] [blame] | 238 | // This class must be operated on a TaskQueue. |
brandtr | c8c5905 | 2017-08-21 06:44:16 -0700 | [diff] [blame] | 239 | rtc::SequencedTaskChecker sequence_checker_; |
brandtr | bdd555c | 2017-08-21 01:34:04 -0700 | [diff] [blame] | 240 | |
| 241 | RTC_DISALLOW_COPY_AND_ASSIGN(VideoProcessor); |
kjellander@webrtc.org | 35a1756 | 2011-10-06 06:44:54 +0000 | [diff] [blame] | 242 | }; |
| 243 | |
| 244 | } // namespace test |
| 245 | } // namespace webrtc |
| 246 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 247 | #endif // MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ |