ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 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 | */ |
| 10 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 11 | #include <cstddef> |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 12 | #include <vector> |
| 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include "api/video/video_timing.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 15 | #include "modules/video_coding/generic_encoder.h" |
| 16 | #include "modules/video_coding/include/video_coding_defines.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame^] | 17 | #include "rtc_base/fake_clock.h" |
| 18 | #include "rtc_base/time_utils.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 19 | #include "test/gtest.h" |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | namespace test { |
| 23 | namespace { |
| 24 | inline size_t FrameSize(const size_t& min_frame_size, |
| 25 | const size_t& max_frame_size, |
| 26 | const int& s, |
| 27 | const int& i) { |
| 28 | return min_frame_size + (s + 1) * i % (max_frame_size - min_frame_size); |
| 29 | } |
| 30 | |
| 31 | class FakeEncodedImageCallback : public EncodedImageCallback { |
| 32 | public: |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 33 | FakeEncodedImageCallback() |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 34 | : last_frame_was_timing_(false), |
| 35 | num_frames_dropped_(0), |
| 36 | last_capture_timestamp_(-1) {} |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 37 | Result OnEncodedImage(const EncodedImage& encoded_image, |
| 38 | const CodecSpecificInfo* codec_specific_info, |
| 39 | const RTPFragmentationHeader* fragmentation) override { |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 40 | last_frame_was_timing_ = |
Ilya Nikolaevskiy | b6c462d | 2018-06-05 15:21:32 +0200 | [diff] [blame] | 41 | encoded_image.timing_.flags != VideoSendTiming::kInvalid && |
| 42 | encoded_image.timing_.flags != VideoSendTiming::kNotTriggered; |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 43 | last_capture_timestamp_ = encoded_image.capture_time_ms_; |
mflodman | 351424e | 2017-08-10 02:43:14 -0700 | [diff] [blame] | 44 | return Result(Result::OK); |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 47 | void OnDroppedFrame(DropReason reason) override { ++num_frames_dropped_; } |
| 48 | |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 49 | bool WasTimingFrame() { return last_frame_was_timing_; } |
| 50 | |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 51 | size_t GetNumFramesDropped() { return num_frames_dropped_; } |
| 52 | |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 53 | int64_t GetLastCaptureTimestamp() { return last_capture_timestamp_; } |
| 54 | |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 55 | private: |
| 56 | bool last_frame_was_timing_; |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 57 | size_t num_frames_dropped_; |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 58 | int64_t last_capture_timestamp_; |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | enum class FrameType { |
| 62 | kNormal, |
| 63 | kTiming, |
| 64 | kDropped, |
| 65 | }; |
| 66 | |
| 67 | // Emulates |num_frames| on |num_streams| frames with capture timestamps |
| 68 | // increased by 1 from 0. Size of each frame is between |
| 69 | // |min_frame_size| and |max_frame_size|, outliers are counted relatevely to |
| 70 | // |average_frame_sizes[]| for each stream. |
| 71 | std::vector<std::vector<FrameType>> GetTimingFrames( |
| 72 | const int64_t delay_ms, |
| 73 | const size_t min_frame_size, |
| 74 | const size_t max_frame_size, |
| 75 | std::vector<size_t> average_frame_sizes, |
| 76 | const int num_streams, |
| 77 | const int num_frames) { |
| 78 | FakeEncodedImageCallback sink; |
Niels Möller | 6bb5ab9 | 2019-01-11 11:11:10 +0100 | [diff] [blame] | 79 | VCMEncodedFrameCallback callback(&sink); |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 80 | const size_t kFramerate = 30; |
| 81 | callback.SetTimingFramesThresholds( |
| 82 | {delay_ms, kDefaultOutlierFrameSizePercent}); |
| 83 | callback.OnFrameRateChanged(kFramerate); |
| 84 | int s, i; |
| 85 | std::vector<std::vector<FrameType>> result(num_streams); |
| 86 | for (s = 0; s < num_streams; ++s) |
| 87 | callback.OnTargetBitrateChanged(average_frame_sizes[s] * kFramerate, s); |
| 88 | int64_t current_timestamp = 0; |
| 89 | for (i = 0; i < num_frames; ++i) { |
| 90 | current_timestamp += 1; |
| 91 | for (s = 0; s < num_streams; ++s) { |
| 92 | // every (5+s)-th frame is dropped on s-th stream by design. |
| 93 | bool dropped = i % (5 + s) == 0; |
| 94 | |
| 95 | EncodedImage image; |
| 96 | CodecSpecificInfo codec_specific; |
| 97 | image._length = FrameSize(min_frame_size, max_frame_size, s, i); |
| 98 | image.capture_time_ms_ = current_timestamp; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 99 | image.SetTimestamp(static_cast<uint32_t>(current_timestamp * 90)); |
Niels Möller | d3b8c63 | 2018-08-27 15:33:42 +0200 | [diff] [blame] | 100 | image.SetSpatialIndex(s); |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 101 | codec_specific.codecType = kVideoCodecGeneric; |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 102 | callback.OnEncodeStarted(static_cast<uint32_t>(current_timestamp * 90), |
| 103 | current_timestamp, s); |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 104 | if (dropped) { |
| 105 | result[s].push_back(FrameType::kDropped); |
| 106 | continue; |
| 107 | } |
| 108 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 109 | if (sink.WasTimingFrame()) { |
| 110 | result[s].push_back(FrameType::kTiming); |
| 111 | } else { |
| 112 | result[s].push_back(FrameType::kNormal); |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | return result; |
| 117 | } |
| 118 | } // namespace |
| 119 | |
| 120 | TEST(TestVCMEncodedFrameCallback, MarksTimingFramesPeriodicallyTogether) { |
| 121 | const int64_t kDelayMs = 29; |
| 122 | const size_t kMinFrameSize = 10; |
| 123 | const size_t kMaxFrameSize = 20; |
| 124 | const int kNumFrames = 1000; |
| 125 | const int kNumStreams = 3; |
| 126 | // No outliers as 1000 is larger than anything from range [10,20]. |
| 127 | const std::vector<size_t> kAverageSize = {1000, 1000, 1000}; |
| 128 | auto frames = GetTimingFrames(kDelayMs, kMinFrameSize, kMaxFrameSize, |
| 129 | kAverageSize, kNumStreams, kNumFrames); |
| 130 | // Timing frames should be tirggered every delayMs. |
| 131 | // As no outliers are expected, frames on all streams have to be |
| 132 | // marked together. |
| 133 | int last_timing_frame = -1; |
| 134 | for (int i = 0; i < kNumFrames; ++i) { |
| 135 | int num_normal = 0; |
| 136 | int num_timing = 0; |
| 137 | int num_dropped = 0; |
| 138 | for (int s = 0; s < kNumStreams; ++s) { |
| 139 | if (frames[s][i] == FrameType::kTiming) { |
| 140 | ++num_timing; |
| 141 | } else if (frames[s][i] == FrameType::kNormal) { |
| 142 | ++num_normal; |
| 143 | } else { |
| 144 | ++num_dropped; |
| 145 | } |
| 146 | } |
| 147 | // Can't have both normal and timing frames at the same timstamp. |
| 148 | EXPECT_TRUE(num_timing == 0 || num_normal == 0); |
| 149 | if (num_dropped < kNumStreams) { |
| 150 | if (last_timing_frame == -1 || i >= last_timing_frame + kDelayMs) { |
| 151 | // If didn't have timing frames for a period, current sent frame has to |
| 152 | // be one. No normal frames should be sent. |
| 153 | EXPECT_EQ(num_normal, 0); |
| 154 | } else { |
| 155 | // No unneeded timing frames should be sent. |
| 156 | EXPECT_EQ(num_timing, 0); |
| 157 | } |
| 158 | } |
| 159 | if (num_timing > 0) |
| 160 | last_timing_frame = i; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | TEST(TestVCMEncodedFrameCallback, MarksOutliers) { |
| 165 | const int64_t kDelayMs = 29; |
| 166 | const size_t kMinFrameSize = 2495; |
| 167 | const size_t kMaxFrameSize = 2505; |
| 168 | const int kNumFrames = 1000; |
| 169 | const int kNumStreams = 3; |
| 170 | // Possible outliers as 1000 lies in range [995, 1005]. |
| 171 | const std::vector<size_t> kAverageSize = {998, 1000, 1004}; |
| 172 | auto frames = GetTimingFrames(kDelayMs, kMinFrameSize, kMaxFrameSize, |
| 173 | kAverageSize, kNumStreams, kNumFrames); |
| 174 | // All outliers should be marked. |
| 175 | for (int i = 0; i < kNumFrames; ++i) { |
| 176 | for (int s = 0; s < kNumStreams; ++s) { |
| 177 | if (FrameSize(kMinFrameSize, kMaxFrameSize, s, i) >= |
| 178 | kAverageSize[s] * kDefaultOutlierFrameSizePercent / 100) { |
| 179 | // Too big frame. May be dropped or timing, but not normal. |
| 180 | EXPECT_NE(frames[s][i], FrameType::kNormal); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 186 | TEST(TestVCMEncodedFrameCallback, NoTimingFrameIfNoEncodeStartTime) { |
| 187 | EncodedImage image; |
| 188 | CodecSpecificInfo codec_specific; |
| 189 | int64_t timestamp = 1; |
| 190 | image._length = 500; |
| 191 | image.capture_time_ms_ = timestamp; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 192 | image.SetTimestamp(static_cast<uint32_t>(timestamp * 90)); |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 193 | codec_specific.codecType = kVideoCodecGeneric; |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 194 | FakeEncodedImageCallback sink; |
Niels Möller | 6bb5ab9 | 2019-01-11 11:11:10 +0100 | [diff] [blame] | 195 | VCMEncodedFrameCallback callback(&sink); |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 196 | VideoCodec::TimingFrameTriggerThresholds thresholds; |
| 197 | thresholds.delay_ms = 1; // Make all frames timing frames. |
| 198 | callback.SetTimingFramesThresholds(thresholds); |
Ilya Nikolaevskiy | e0da9ea | 2017-11-08 14:39:02 +0100 | [diff] [blame] | 199 | callback.OnTargetBitrateChanged(500, 0); |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 200 | |
| 201 | // Verify a single frame works with encode start time set. |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 202 | callback.OnEncodeStarted(static_cast<uint32_t>(timestamp * 90), timestamp, 0); |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 203 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 204 | EXPECT_TRUE(sink.WasTimingFrame()); |
| 205 | |
| 206 | // New frame, now skip OnEncodeStarted. Should not result in timing frame. |
| 207 | image.capture_time_ms_ = ++timestamp; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 208 | image.SetTimestamp(static_cast<uint32_t>(timestamp * 90)); |
sprang | ba050a6 | 2017-08-18 02:51:12 -0700 | [diff] [blame] | 209 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 210 | EXPECT_FALSE(sink.WasTimingFrame()); |
| 211 | } |
| 212 | |
Ilya Nikolaevskiy | 764aeb7 | 2018-04-03 10:01:52 +0200 | [diff] [blame] | 213 | TEST(TestVCMEncodedFrameCallback, AdjustsCaptureTimeForInternalSourceEncoder) { |
| 214 | rtc::ScopedFakeClock clock; |
| 215 | clock.SetTimeMicros(1234567); |
| 216 | EncodedImage image; |
| 217 | CodecSpecificInfo codec_specific; |
| 218 | const int64_t kEncodeStartDelayMs = 2; |
| 219 | const int64_t kEncodeFinishDelayMs = 10; |
| 220 | int64_t timestamp = 1; |
| 221 | image._length = 500; |
| 222 | image.capture_time_ms_ = timestamp; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 223 | image.SetTimestamp(static_cast<uint32_t>(timestamp * 90)); |
Ilya Nikolaevskiy | 764aeb7 | 2018-04-03 10:01:52 +0200 | [diff] [blame] | 224 | codec_specific.codecType = kVideoCodecGeneric; |
Ilya Nikolaevskiy | 764aeb7 | 2018-04-03 10:01:52 +0200 | [diff] [blame] | 225 | FakeEncodedImageCallback sink; |
Niels Möller | 6bb5ab9 | 2019-01-11 11:11:10 +0100 | [diff] [blame] | 226 | VCMEncodedFrameCallback callback(&sink); |
Ilya Nikolaevskiy | 764aeb7 | 2018-04-03 10:01:52 +0200 | [diff] [blame] | 227 | callback.SetInternalSource(true); |
| 228 | VideoCodec::TimingFrameTriggerThresholds thresholds; |
| 229 | thresholds.delay_ms = 1; // Make all frames timing frames. |
| 230 | callback.SetTimingFramesThresholds(thresholds); |
| 231 | callback.OnTargetBitrateChanged(500, 0); |
| 232 | |
| 233 | // Verify a single frame without encode timestamps isn't a timing frame. |
| 234 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 235 | EXPECT_FALSE(sink.WasTimingFrame()); |
| 236 | |
| 237 | // New frame, but this time with encode timestamps set in timing_. |
| 238 | // This should be a timing frame. |
| 239 | image.capture_time_ms_ = ++timestamp; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 240 | image.SetTimestamp(static_cast<uint32_t>(timestamp * 90)); |
Ilya Nikolaevskiy | 764aeb7 | 2018-04-03 10:01:52 +0200 | [diff] [blame] | 241 | image.timing_.encode_start_ms = timestamp + kEncodeStartDelayMs; |
| 242 | image.timing_.encode_finish_ms = timestamp + kEncodeFinishDelayMs; |
| 243 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 244 | EXPECT_TRUE(sink.WasTimingFrame()); |
| 245 | // Frame is captured kEncodeFinishDelayMs before it's encoded, so restored |
| 246 | // capture timestamp should be kEncodeFinishDelayMs in the past. |
| 247 | EXPECT_EQ( |
| 248 | sink.GetLastCaptureTimestamp(), |
| 249 | clock.TimeNanos() / rtc::kNumNanosecsPerMillisec - kEncodeFinishDelayMs); |
| 250 | } |
| 251 | |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 252 | TEST(TestVCMEncodedFrameCallback, NotifiesAboutDroppedFrames) { |
| 253 | EncodedImage image; |
| 254 | CodecSpecificInfo codec_specific; |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 255 | const int64_t kTimestampMs1 = 47721840; |
| 256 | const int64_t kTimestampMs2 = 47721850; |
| 257 | const int64_t kTimestampMs3 = 47721860; |
| 258 | const int64_t kTimestampMs4 = 47721870; |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 259 | codec_specific.codecType = kVideoCodecGeneric; |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 260 | FakeEncodedImageCallback sink; |
Niels Möller | 6bb5ab9 | 2019-01-11 11:11:10 +0100 | [diff] [blame] | 261 | VCMEncodedFrameCallback callback(&sink); |
Ilya Nikolaevskiy | e0da9ea | 2017-11-08 14:39:02 +0100 | [diff] [blame] | 262 | // Any non-zero bitrate needed to be set before the first frame. |
| 263 | callback.OnTargetBitrateChanged(500, 0); |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 264 | image.capture_time_ms_ = kTimestampMs1; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 265 | image.SetTimestamp(static_cast<uint32_t>(image.capture_time_ms_ * 90)); |
| 266 | callback.OnEncodeStarted(image.Timestamp(), image.capture_time_ms_, 0); |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 267 | EXPECT_EQ(0u, sink.GetNumFramesDropped()); |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 268 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 269 | |
| 270 | image.capture_time_ms_ = kTimestampMs2; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 271 | image.SetTimestamp(static_cast<uint32_t>(image.capture_time_ms_ * 90)); |
| 272 | callback.OnEncodeStarted(image.Timestamp(), image.capture_time_ms_, 0); |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 273 | // No OnEncodedImageCall for timestamp2. Yet, at this moment it's not known |
| 274 | // that frame with timestamp2 was dropped. |
| 275 | EXPECT_EQ(0u, sink.GetNumFramesDropped()); |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 276 | |
| 277 | image.capture_time_ms_ = kTimestampMs3; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 278 | image.SetTimestamp(static_cast<uint32_t>(image.capture_time_ms_ * 90)); |
| 279 | callback.OnEncodeStarted(image.Timestamp(), image.capture_time_ms_, 0); |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 280 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 281 | EXPECT_EQ(1u, sink.GetNumFramesDropped()); |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 282 | |
| 283 | image.capture_time_ms_ = kTimestampMs4; |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 284 | image.SetTimestamp(static_cast<uint32_t>(image.capture_time_ms_ * 90)); |
| 285 | callback.OnEncodeStarted(image.Timestamp(), image.capture_time_ms_, 0); |
Ilya Nikolaevskiy | d79314f | 2017-10-23 10:45:37 +0200 | [diff] [blame] | 286 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 287 | EXPECT_EQ(1u, sink.GetNumFramesDropped()); |
| 288 | } |
| 289 | |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 290 | TEST(TestVCMEncodedFrameCallback, RestoresCaptureTimestamps) { |
| 291 | EncodedImage image; |
| 292 | CodecSpecificInfo codec_specific; |
| 293 | const int64_t kTimestampMs = 123456; |
| 294 | codec_specific.codecType = kVideoCodecGeneric; |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 295 | FakeEncodedImageCallback sink; |
Niels Möller | 6bb5ab9 | 2019-01-11 11:11:10 +0100 | [diff] [blame] | 296 | VCMEncodedFrameCallback callback(&sink); |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 297 | // Any non-zero bitrate needed to be set before the first frame. |
| 298 | callback.OnTargetBitrateChanged(500, 0); |
| 299 | image.capture_time_ms_ = kTimestampMs; // Incorrect timesetamp. |
Niels Möller | 2377588 | 2018-08-16 10:24:12 +0200 | [diff] [blame] | 300 | image.SetTimestamp(static_cast<uint32_t>(image.capture_time_ms_ * 90)); |
| 301 | callback.OnEncodeStarted(image.Timestamp(), image.capture_time_ms_, 0); |
Ilya Nikolaevskiy | 76f2a85 | 2017-11-16 14:33:53 +0100 | [diff] [blame] | 302 | image.capture_time_ms_ = 0; // Incorrect timesetamp. |
| 303 | callback.OnEncodedImage(image, &codec_specific, nullptr); |
| 304 | EXPECT_EQ(kTimestampMs, sink.GetLastCaptureTimestamp()); |
| 305 | } |
| 306 | |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 307 | } // namespace test |
| 308 | } // namespace webrtc |